From c93682ba2de4a8689201248c17d223e830fa3965 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 7 Jul 2023 19:59:46 +0530 Subject: [PATCH 001/132] vni crud changes --- .../IBM/vpc-go-sdk/.bumpversion.cfg | 13 + .../github.com/IBM/vpc-go-sdk/.gitattributes | 1 + common/github.com/IBM/vpc-go-sdk/.gitignore | 18 + common/github.com/IBM/vpc-go-sdk/.releaserc | 21 + common/github.com/IBM/vpc-go-sdk/.travis.yml | 39 + common/github.com/IBM/vpc-go-sdk/CHANGELOG.md | 96 + .../IBM/vpc-go-sdk/CODE_OF_CONDUCT.md | 76 + .../github.com/IBM/vpc-go-sdk/CONTRIBUTING.md | 14 + common/github.com/IBM/vpc-go-sdk/LICENSE | 201 + common/github.com/IBM/vpc-go-sdk/Makefile | 23 + common/github.com/IBM/vpc-go-sdk/README.md | 195 + .../IBM/vpc-go-sdk/common/headers.go | 53 + .../IBM/vpc-go-sdk/common/headers_test.go | 25 + .../IBM/vpc-go-sdk/common/version.go | 4 + common/github.com/IBM/vpc-go-sdk/go.mod | 17 + common/github.com/IBM/vpc-go-sdk/go.sum | 143 + .../IBM/vpc-go-sdk/package-lock.json | 828 + .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 110444 +++++++++++++++ examples/ibm-is-ng/main.tf | 37 + go.mod | 2 + ibm/provider/provider.go | 2 + .../vpc/resource_ibm_is_instance_template.go | 2 +- ...source_ibm_is_virtual_network_interface.go | 1115 + ...e_ibm_is_virtual_network_interface_test.go | 181 + ...is_virtual_network_interface.html.markdown | 216 + 25 files changed, 113765 insertions(+), 1 deletion(-) create mode 100644 common/github.com/IBM/vpc-go-sdk/.bumpversion.cfg create mode 100644 common/github.com/IBM/vpc-go-sdk/.gitattributes create mode 100644 common/github.com/IBM/vpc-go-sdk/.gitignore create mode 100644 common/github.com/IBM/vpc-go-sdk/.releaserc create mode 100644 common/github.com/IBM/vpc-go-sdk/.travis.yml create mode 100644 common/github.com/IBM/vpc-go-sdk/CHANGELOG.md create mode 100644 common/github.com/IBM/vpc-go-sdk/CODE_OF_CONDUCT.md create mode 100644 common/github.com/IBM/vpc-go-sdk/CONTRIBUTING.md create mode 100644 common/github.com/IBM/vpc-go-sdk/LICENSE create mode 100644 common/github.com/IBM/vpc-go-sdk/Makefile create mode 100644 common/github.com/IBM/vpc-go-sdk/README.md create mode 100644 common/github.com/IBM/vpc-go-sdk/common/headers.go create mode 100644 common/github.com/IBM/vpc-go-sdk/common/headers_test.go create mode 100644 common/github.com/IBM/vpc-go-sdk/common/version.go create mode 100644 common/github.com/IBM/vpc-go-sdk/go.mod create mode 100644 common/github.com/IBM/vpc-go-sdk/go.sum create mode 100644 common/github.com/IBM/vpc-go-sdk/package-lock.json create mode 100644 common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go create mode 100644 ibm/service/vpc/resource_ibm_is_virtual_network_interface.go create mode 100644 ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go create mode 100644 website/docs/r/is_virtual_network_interface.html.markdown 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..00d92fdb3c --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/common/headers.go @@ -0,0 +1,53 @@ +package common + +import ( + "fmt" + "runtime" +) + +const ( + HEADER_NAME_USER_AGENT = "User-Agent" + + SDK_NAME = "vpc-go-sdk" +) + +// GetSdkHeaders - returns the set of SDK-specific headers to be included in an outgoing request. +// +// This function is invoked by generated service methods (i.e. methods which implement the REST API operations +// defined within the API definition). The purpose of this function is to give the SDK implementor the opportunity +// to provide SDK-specific HTTP headers that will be sent with an outgoing REST API request. +// This function is invoked for each invocation of a generated service method, +// so the set of HTTP headers could be request-specific. +// As an optimization, if your SDK will be returning the same set of HTTP headers for each invocation of this +// function, it is recommended that you initialize the returned map just once (perhaps by using +// lazy initialization) and simply return it each time the function is invoked, instead of building it each time +// as in the example below. +// +// Parameters: +// +// serviceName - the name of the service as defined in the API definition (e.g. "MyService1") +// serviceVersion - the version of the service as defined in the API definition (e.g. "V1") +// operationId - the operationId as defined in the API definition (e.g. getContext) +// +// Returns: +// +// a Map which contains the set of headers to be included in the REST API request +func GetSdkHeaders(serviceName string, serviceVersion string, operationId string) map[string]string { + sdkHeaders := make(map[string]string) + + sdkHeaders[HEADER_NAME_USER_AGENT] = GetUserAgentInfo() + + return sdkHeaders +} + +var UserAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo()) + +func GetUserAgentInfo() string { + return UserAgent +} + +var systemInfo = fmt.Sprintf("(arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version()) + +func GetSystemInfo() string { + return systemInfo +} diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go new file mode 100644 index 0000000000..deca50645d --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go @@ -0,0 +1,25 @@ +package common + +import ( + "github.com/stretchr/testify/assert" + "strings" + "testing" +) + +func TestGetSystemInfo(t *testing.T) { + var sysinfo = GetSystemInfo() + assert.NotNil(t, sysinfo) + assert.True(t, strings.Contains(sysinfo, "arch=")) + assert.True(t, strings.Contains(sysinfo, "os=")) + assert.True(t, strings.Contains(sysinfo, "go.version=")) +} + +func TestGetSdkHeaders(t *testing.T) { + var headers = GetSdkHeaders("myService", "v123", "myOperation") + assert.NotNil(t, headers) + + var foundIt bool + + _, foundIt = headers[HEADER_NAME_USER_AGENT] + assert.True(t, foundIt) +} diff --git a/common/github.com/IBM/vpc-go-sdk/common/version.go b/common/github.com/IBM/vpc-go-sdk/common/version.go new file mode 100644 index 0000000000..623548bdac --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/common/version.go @@ -0,0 +1,4 @@ +package common + +// Version of the SDK +const Version = "0.6.0" diff --git a/common/github.com/IBM/vpc-go-sdk/go.mod b/common/github.com/IBM/vpc-go-sdk/go.mod new file mode 100644 index 0000000000..466fa3d20e --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/go.mod @@ -0,0 +1,17 @@ +module github.com/IBM/vpc-go-sdk + +go 1.16 + +require ( + github.com/IBM/go-sdk-core/v5 v5.12.1 + github.com/go-openapi/strfmt v0.21.3 + github.com/onsi/ginkgo v1.16.5 + github.com/onsi/gomega v1.20.0 + github.com/stretchr/testify v1.8.0 +) + +retract ( + v1.0.2 + v1.0.1 + v1.0.0 +) \ No newline at end of file diff --git a/common/github.com/IBM/vpc-go-sdk/go.sum b/common/github.com/IBM/vpc-go-sdk/go.sum new file mode 100644 index 0000000000..88c822dd8e --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/go.sum @@ -0,0 +1,143 @@ +github.com/IBM/go-sdk-core/v5 v5.9.1 h1:06pXbD9Rgmqqe2HA5YAeQbB4eYRRFgIoOT+Kh3cp1zo= +github.com/IBM/go-sdk-core/v5 v5.9.1/go.mod h1:axE2JrRq79gIJTjKPBwV6gWHswvVptBjbcvvCPIxARM= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/go-openapi/errors v0.19.8 h1:doM+tQdZbUm9gydV9yR+iQNmztbjj7I3sW4sIcAwIzc= +github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/strfmt v0.21.1 h1:G6s2t5V5kGCHLVbSdZ/6lI8Wm4OzoPFkc3/cjAsKQrM= +github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= +github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4= +github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M= +github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ= +github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +go.mongodb.org/mongo-driver v1.7.5 h1:ny3p0reEpgsR2cfA5cjgwFZg3Cv/ofFh/8jbhGtz9VI= +go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+an+ZQdDaD1M= +gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/common/github.com/IBM/vpc-go-sdk/package-lock.json b/common/github.com/IBM/vpc-go-sdk/package-lock.json new file mode 100644 index 0000000000..20f48c59f1 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/package-lock.json @@ -0,0 +1,828 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "@babel/code-frame": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", + "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "requires": { + "@babel/highlight": "^7.12.13" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==" + }, + "@babel/highlight": { + "version": "7.13.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", + "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", + "requires": { + "@babel/helper-validator-identifier": "^7.12.11", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", + "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", + "requires": { + "@nodelib/fs.stat": "2.0.4", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==" + }, + "@nodelib/fs.walk": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", + "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "requires": { + "@nodelib/fs.scandir": "2.1.4", + "fastq": "^1.6.0" + } + }, + "@octokit/auth-token": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz", + "integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==", + "requires": { + "@octokit/types": "^6.0.3" + } + }, + "@octokit/core": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.4.0.tgz", + "integrity": "sha512-6/vlKPP8NF17cgYXqucdshWqmMZGXkuvtcrWCgU5NOI0Pl2GjlmZyWgBMrU8zJ3v2MJlM6++CiB45VKYmhiWWg==", + "requires": { + "@octokit/auth-token": "^2.4.4", + "@octokit/graphql": "^4.5.8", + "@octokit/request": "^5.4.12", + "@octokit/request-error": "^2.0.5", + "@octokit/types": "^6.0.3", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/endpoint": { + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.11.tgz", + "integrity": "sha512-fUIPpx+pZyoLW4GCs3yMnlj2LfoXTWDUVPTC4V3MUEKZm48W+XYpeWSZCv+vYF1ZABUm2CqnDVf1sFtIYrj7KQ==", + "requires": { + "@octokit/types": "^6.0.3", + "is-plain-object": "^5.0.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/graphql": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.6.1.tgz", + "integrity": "sha512-2lYlvf4YTDgZCTXTW4+OX+9WTLFtEUc6hGm4qM1nlZjzxj+arizM4aHWzBVBCxY9glh7GIs0WEuiSgbVzv8cmA==", + "requires": { + "@octokit/request": "^5.3.0", + "@octokit/types": "^6.0.3", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/openapi-types": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-6.0.0.tgz", + "integrity": "sha512-CnDdK7ivHkBtJYzWzZm7gEkanA7gKH6a09Eguz7flHw//GacPJLmkHA3f3N++MJmlxD1Fl+mB7B32EEpSCwztQ==" + }, + "@octokit/plugin-paginate-rest": { + "version": "2.13.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.13.3.tgz", + "integrity": "sha512-46lptzM9lTeSmIBt/sVP/FLSTPGx6DCzAdSX3PfeJ3mTf4h9sGC26WpaQzMEq/Z44cOcmx8VsOhO+uEgE3cjYg==", + "requires": { + "@octokit/types": "^6.11.0" + } + }, + "@octokit/plugin-request-log": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.3.tgz", + "integrity": "sha512-4RFU4li238jMJAzLgAwkBAw+4Loile5haQMQr+uhFq27BmyJXcXSKvoQKqh0agsZEiUlW6iSv3FAgvmGkur7OQ==" + }, + "@octokit/plugin-rest-endpoint-methods": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.0.0.tgz", + "integrity": "sha512-Jc7CLNUueIshXT+HWt6T+M0sySPjF32mSFQAK7UfAg8qGeRI6OM1GSBxDLwbXjkqy2NVdnqCedJcP1nC785JYg==", + "requires": { + "@octokit/types": "^6.13.0", + "deprecation": "^2.3.1" + } + }, + "@octokit/request": { + "version": "5.4.14", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.14.tgz", + "integrity": "sha512-VkmtacOIQp9daSnBmDI92xNIeLuSRDOIuplp/CJomkvzt7M18NXgG044Cx/LFKLgjKt9T2tZR6AtJayba9GTSA==", + "requires": { + "@octokit/endpoint": "^6.0.1", + "@octokit/request-error": "^2.0.0", + "@octokit/types": "^6.7.1", + "deprecation": "^2.0.0", + "is-plain-object": "^5.0.0", + "node-fetch": "^2.6.1", + "once": "^1.4.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/request-error": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.5.tgz", + "integrity": "sha512-T/2wcCFyM7SkXzNoyVNWjyVlUwBvW3igM3Btr/eKYiPmucXTtkxt2RBsf6gn3LTzaLSLTQtNmvg+dGsOxQrjZg==", + "requires": { + "@octokit/types": "^6.0.3", + "deprecation": "^2.0.0", + "once": "^1.4.0" + } + }, + "@octokit/rest": { + "version": "18.5.2", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.5.2.tgz", + "integrity": "sha512-Kz03XYfKS0yYdi61BkL9/aJ0pP2A/WK5vF/syhu9/kY30J8He3P68hv9GRpn8bULFx2K0A9MEErn4v3QEdbZcw==", + "requires": { + "@octokit/core": "^3.2.3", + "@octokit/plugin-paginate-rest": "^2.6.2", + "@octokit/plugin-request-log": "^1.0.2", + "@octokit/plugin-rest-endpoint-methods": "5.0.0" + } + }, + "@octokit/types": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.13.0.tgz", + "integrity": "sha512-W2J9qlVIU11jMwKHUp5/rbVUeErqelCsO5vW5PKNb7wAXQVUz87Rc+imjlEvpvbH8yUb+KHmv8NEjVZdsdpyxA==", + "requires": { + "@octokit/openapi-types": "^6.0.0" + } + }, + "@semantic-release/changelog": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@semantic-release/changelog/-/changelog-5.0.1.tgz", + "integrity": "sha512-unvqHo5jk4dvAf2nZ3aw4imrlwQ2I50eVVvq9D47Qc3R+keNqepx1vDYwkjF8guFXnOYaYcR28yrZWno1hFbiw==", + "requires": { + "@semantic-release/error": "^2.1.0", + "aggregate-error": "^3.0.0", + "fs-extra": "^9.0.0", + "lodash": "^4.17.4" + } + }, + "@semantic-release/error": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-2.2.0.tgz", + "integrity": "sha512-9Tj/qn+y2j+sjCI3Jd+qseGtHjOAeg7dU2/lVcqIQ9TV3QDaDXDYXcoOHU+7o2Hwh8L8ymL4gfuO7KxDs3q2zg==" + }, + "@semantic-release/exec": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/exec/-/exec-5.0.0.tgz", + "integrity": "sha512-t7LWXIvDJQbuGCy2WmMG51WyaGSLTvZBv9INvcI4S0kn+QjnnVVUMhcioIqhb0r3yqqarMzHVcABFug0q0OXjw==", + "requires": { + "@semantic-release/error": "^2.1.0", + "aggregate-error": "^3.0.0", + "debug": "^4.0.0", + "execa": "^4.0.0", + "lodash": "^4.17.4", + "parse-json": "^5.0.0" + } + }, + "@semantic-release/git": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/git/-/git-9.0.0.tgz", + "integrity": "sha512-AZ4Zha5NAPAciIJH3ipzw/WU9qLAn8ENaoVAhD6srRPxTpTzuV3NhNh14rcAo8Paj9dO+5u4rTKcpetOBluYVw==", + "requires": { + "@semantic-release/error": "^2.1.0", + "aggregate-error": "^3.0.0", + "debug": "^4.0.0", + "dir-glob": "^3.0.0", + "execa": "^4.0.0", + "lodash": "^4.17.4", + "micromatch": "^4.0.0", + "p-reduce": "^2.0.0" + } + }, + "@semantic-release/github": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/@semantic-release/github/-/github-7.2.1.tgz", + "integrity": "sha512-+gOhbaG4T3xJb6aTZu1/7KvCmYKRChkasdIyFWdaGaTWVeGpdl4o0zMviV1z3kRcgPOSXeqjHSQ6SOQAfHQiDw==", + "requires": { + "@octokit/rest": "^18.0.0", + "@semantic-release/error": "^2.2.0", + "aggregate-error": "^3.0.0", + "bottleneck": "^2.18.1", + "debug": "^4.0.0", + "dir-glob": "^3.0.0", + "fs-extra": "^9.0.0", + "globby": "^11.0.0", + "http-proxy-agent": "^4.0.0", + "https-proxy-agent": "^5.0.0", + "issue-parser": "^6.0.0", + "lodash": "^4.17.4", + "mime": "^2.4.3", + "p-filter": "^2.0.0", + "p-retry": "^4.0.0", + "url-join": "^4.0.0" + } + }, + "@tootallnate/once": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", + "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==" + }, + "@types/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==" + }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + } + }, + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" + }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" + }, + "before-after-hook": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.1.tgz", + "integrity": "sha512-/6FKxSTWoJdbsLDF8tdIjaRiFXiE6UHsEHE3OPI/cwPURCVi1ukP0gmLn7XWEiFk5TcwQjjY5PWsU+j+tgXgmw==" + }, + "bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==" + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==" + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "requires": { + "path-type": "^4.0.0" + } + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "execa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", + "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "fast-glob": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + } + }, + "fastq": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", + "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "requires": { + "reusify": "^1.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "requires": { + "is-glob": "^4.0.1" + } + }, + "globby": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.3.tgz", + "integrity": "sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg==", + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + }, + "graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "http-proxy-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "requires": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + } + }, + "https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==" + }, + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==" + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==" + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "issue-parser": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/issue-parser/-/issue-parser-6.0.0.tgz", + "integrity": "sha512-zKa/Dxq2lGsBIXQ7CUZWTHfvxPC2ej0KfO7fIPqLlHB9J2hJ7rGhZ5rilhuufylr4RXYPzJUeFjKxz305OsNlA==", + "requires": { + "lodash.capitalize": "^4.2.1", + "lodash.escaperegexp": "^4.1.2", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.uniqby": "^4.7.0" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=" + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "lodash.capitalize": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", + "integrity": "sha1-+CbJtOKoUR2E46yinbBeGk87cqk=" + }, + "lodash.escaperegexp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", + "integrity": "sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=" + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" + }, + "lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" + }, + "lodash.uniqby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz", + "integrity": "sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI=" + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "mime": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", + "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==" + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "requires": { + "path-key": "^3.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "p-filter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-2.1.0.tgz", + "integrity": "sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==", + "requires": { + "p-map": "^2.0.0" + } + }, + "p-map": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", + "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==" + }, + "p-reduce": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-2.1.0.tgz", + "integrity": "sha512-2USApvnsutq8uoxZBGbbWM0JIYLiEMJ9RlaN7fAzVNb9OZN0SHjjTTfIcb667XynS5Y1VhwDJVDa72TnPzAYWw==" + }, + "p-retry": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.5.0.tgz", + "integrity": "sha512-5Hwh4aVQSu6BEP+w2zKlVXtFAaYQe1qWuVADSgoeVlLjwe/Q/AMSoRR4MDeaAfu8llT+YNbEijWu/YF3m6avkg==", + "requires": { + "@types/retry": "^0.12.0", + "retry": "^0.12.0" + } + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" + }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=" + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "universal-user-agent": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", + "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + }, + "url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + } +} diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go new file mode 100644 index 0000000000..c29949bba9 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -0,0 +1,110444 @@ +/** + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * 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.70.0-7df966bf-20230419-195904 + */ + +// Package vpcv1 : Operations and models for the VpcV1 service +package vpcv1 + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/IBM/go-sdk-core/v5/core" + common "github.com/IBM/vpc-go-sdk/common" + "github.com/go-openapi/strfmt" +) + +// VpcV1 : The IBM Cloud Virtual Private Cloud (VPC) API can be used to programmatically provision and manage virtual +// server instances, along with subnets, volumes, load balancers, and more. +// +// API Version: today +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 `2022-09-13` + // and `2023-07-07`. + Version *string +} + +// DefaultServiceURL is the default URL to make service requests to. +const DefaultServiceURL = "https://us-south.iaas.cloud.ibm.com/v1" + +// DefaultServiceName is the default key used to find external configuration information. +const DefaultServiceName = "vpc" + +// VpcV1Options : Service options +type VpcV1Options struct { + ServiceName string + URL string + Authenticator core.Authenticator + + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` + // and `2023-07-07`. + Version *string +} + +// NewVpcV1UsingExternalConfig : constructs an instance of VpcV1 with passed in options and external configuration. +func NewVpcV1UsingExternalConfig(options *VpcV1Options) (vpc *VpcV1, err error) { + if options.ServiceName == "" { + options.ServiceName = DefaultServiceName + } + + if options.Authenticator == nil { + options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) + if err != nil { + return + } + } + + vpc, err = NewVpcV1(options) + if err != nil { + return + } + + err = vpc.Service.ConfigureService(options.ServiceName) + if err != nil { + return + } + + if options.URL != "" { + err = vpc.Service.SetServiceURL(options.URL) + } + return +} + +// NewVpcV1 : constructs an instance of VpcV1 with passed in options. +func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { + serviceOptions := &core.ServiceOptions{ + URL: DefaultServiceURL, + Authenticator: options.Authenticator, + } + + err = core.ValidateStruct(options, "options") + if err != nil { + return + } + + baseService, err := core.NewBaseService(serviceOptions) + if err != nil { + return + } + + if options.URL != "" { + err = baseService.SetServiceURL(options.URL) + if err != nil { + return + } + } + + if options.Version == nil { + options.Version = core.StringPtr("2023-06-27") + } + + service = &VpcV1{ + Service: baseService, + generation: core.Int64Ptr(2), + Version: options.Version, + } + + return +} + +// GetServiceURLForRegion returns the service URL to be used for the specified region +func GetServiceURLForRegion(region string) (string, error) { + return "", fmt.Errorf("service does not support regional URLs") +} + +// Clone makes a copy of "vpc" suitable for processing requests. +func (vpc *VpcV1) Clone() *VpcV1 { + if core.IsNil(vpc) { + return nil + } + clone := *vpc + clone.Service = vpc.Service.Clone() + return &clone +} + +// SetServiceURL sets the service URL +func (vpc *VpcV1) SetServiceURL(url string) error { + return vpc.Service.SetServiceURL(url) +} + +// GetServiceURL returns the service URL +func (vpc *VpcV1) GetServiceURL() string { + return vpc.Service.GetServiceURL() +} + +// SetDefaultHeaders sets HTTP headers to be sent in every request +func (vpc *VpcV1) SetDefaultHeaders(headers http.Header) { + vpc.Service.SetDefaultHeaders(headers) +} + +// SetEnableGzipCompression sets the service's EnableGzipCompression field +func (vpc *VpcV1) SetEnableGzipCompression(enableGzip bool) { + vpc.Service.SetEnableGzipCompression(enableGzip) +} + +// GetEnableGzipCompression returns the service's EnableGzipCompression field +func (vpc *VpcV1) GetEnableGzipCompression() bool { + return vpc.Service.GetEnableGzipCompression() +} + +// EnableRetries enables automatic retries for requests invoked for this service instance. +// If either parameter is specified as 0, then a default value is used instead. +func (vpc *VpcV1) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { + vpc.Service.EnableRetries(maxRetries, maxRetryInterval) +} + +// DisableRetries disables automatic retries for requests invoked for this service instance. +func (vpc *VpcV1) DisableRetries() { + vpc.Service.DisableRetries() +} + +// ListVpcs : List all VPCs +// This request lists all VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical +// isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC +// can contain resources in multiple zones in a region. +func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + return vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) +} + +// ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter +func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVpcsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVpcsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) + } + if listVpcsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVpcsOptions.Limit)) + } + if listVpcsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVpcsOptions.ResourceGroupID)) + } + if listVpcsOptions.ClassicAccess != nil { + builder.AddQuery("classic_access", fmt.Sprint(*listVpcsOptions.ClassicAccess)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPC : Create a VPC +// This request creates a new VPC from a VPC prototype object. The prototype object is structured in the same way as a +// retrieved VPC, and contains the information necessary to create the new VPC. +func (vpc *VpcV1) CreateVPC(createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.CreateVPCWithContext(context.Background(), createVPCOptions) +} + +// CreateVPCWithContext is an alternate form of the CreateVPC method which supports a Context parameter +func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(createVPCOptions, "createVPCOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPC") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCOptions.AddressPrefixManagement != nil { + body["address_prefix_management"] = createVPCOptions.AddressPrefixManagement + } + if createVPCOptions.ClassicAccess != nil { + body["classic_access"] = createVPCOptions.ClassicAccess + } + if createVPCOptions.Name != nil { + body["name"] = createVPCOptions.Name + } + if createVPCOptions.ResourceGroup != nil { + body["resource_group"] = createVPCOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPC : Delete a VPC +// This request deletes a VPC. This operation cannot be reversed. For this request to succeed, the VPC must not contain +// any instances, subnets, public gateways, or endpoint gateways. All security groups and network ACLs associated with +// the VPC are automatically deleted. All flow log collectors with `auto_delete` set to `true` targeting the VPC or any +// resource in the VPC are automatically deleted. +func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) +} + +// DeleteVPCWithContext is an alternate form of the DeleteVPC method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCOptions, "deleteVPCOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVPCOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPC : Retrieve a VPC +// This request retrieves a single VPC specified by the identifier in the URL. +func (vpc *VpcV1) GetVPC(getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.GetVPCWithContext(context.Background(), getVPCOptions) +} + +// GetVPCWithContext is an alternate form of the GetVPC method which supports a Context parameter +func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCOptions, "getVPCOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCOptions, "getVPCOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPC : Update a VPC +// This request updates a VPC with the information provided in a VPC patch object. The patch object is structured in the +// same way as a retrieved VPC and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) +} + +// UpdateVPCWithContext is an alternate form of the UpdateVPC method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCOptions, "updateVPCOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVPCOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCDefaultNetworkACL : Retrieve a VPC's default network ACL +// This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default +// network ACL is applied to any new subnets in the VPC which do not specify a network ACL. +func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) +} + +// GetVPCDefaultNetworkACLWithContext is an alternate form of the GetVPCDefaultNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCDefaultNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_network_acl`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCDefaultRoutingTable : Retrieve a VPC's default routing table +// This request retrieves the default routing table for the VPC specified by the identifier in the URL. The default +// routing table is associated with any subnets in the VPC which have not been explicitly associated with another +// routing table. +func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) +} + +// GetVPCDefaultRoutingTableWithContext is an alternate form of the GetVPCDefaultRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCDefaultRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_routing_table`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCDefaultSecurityGroup : Retrieve a VPC's default security group +// This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources +// created in this VPC that allow a security group to be optionally specified will use this security group by default. +func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) +} + +// GetVPCDefaultSecurityGroupWithContext is an alternate form of the GetVPCDefaultSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCDefaultSecurityGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_security_group`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPCAddressPrefixes : List all address prefixes for a VPC +// This request lists all address pool prefixes for a VPC. +func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) +} + +// ListVPCAddressPrefixesWithContext is an alternate form of the ListVPCAddressPrefixes method which supports a Context parameter +func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCAddressPrefixesOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCAddressPrefixesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) + } + if listVPCAddressPrefixesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCAddressPrefix : Create an address prefix for a VPC +// This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way +// as a retrieved prefix, and contains the information necessary to create the new prefix. +func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) +} + +// CreateVPCAddressPrefixWithContext is an alternate form of the CreateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCAddressPrefixOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCAddressPrefixOptions.CIDR != nil { + body["cidr"] = createVPCAddressPrefixOptions.CIDR + } + if createVPCAddressPrefixOptions.Zone != nil { + body["zone"] = createVPCAddressPrefixOptions.Zone + } + if createVPCAddressPrefixOptions.IsDefault != nil { + body["is_default"] = createVPCAddressPrefixOptions.IsDefault + } + if createVPCAddressPrefixOptions.Name != nil { + body["name"] = createVPCAddressPrefixOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPCAddressPrefix : Delete an address prefix +// This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses +// from this prefix. +func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) +} + +// DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, + "id": *deleteVPCAddressPrefixOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCAddressPrefix : Retrieve an address prefix +// This request retrieves a single prefix specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) +} + +// GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCAddressPrefixOptions.VPCID, + "id": *getVPCAddressPrefixOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCAddressPrefix : Update an address prefix +// This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured +// in the same way as a retrieved prefix and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) +} + +// UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCAddressPrefixOptions.VPCID, + "id": *updateVPCAddressPrefixOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCAddressPrefixOptions.AddressPrefixPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPCRoutes : List all routes in a VPC's default routing table +// This request lists all routes in the VPC's default routing table. Each route is zone-specific and directs any packets +// matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's +// destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) +} + +// ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") + err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCRoutesOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCRoutesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCRoutesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) + } + if listVPCRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutesOptions.Start)) + } + if listVPCRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollectionVPCContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCRoute : Create a route in a VPC's default routing table +// This request creates a new route in the VPC's default routing table. The route prototype object is structured in the +// same way as a retrieved route, and contains the information necessary to create the new route. The request will fail +// if the new route will cause a loop. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) +} + +// CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") + err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCRouteOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCRouteOptions.Destination != nil { + body["destination"] = createVPCRouteOptions.Destination + } + if createVPCRouteOptions.Zone != nil { + body["zone"] = createVPCRouteOptions.Zone + } + if createVPCRouteOptions.Action != nil { + body["action"] = createVPCRouteOptions.Action + } + if createVPCRouteOptions.Name != nil { + body["name"] = createVPCRouteOptions.Name + } + if createVPCRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRouteOptions.NextHop + } + if createVPCRouteOptions.Priority != nil { + body["priority"] = createVPCRouteOptions.Priority + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPCRoute : Delete a VPC route +// This request deletes a route. This operation cannot be reversed. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) +} + +// DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: DeleteVPCRoute") + err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRouteOptions.VPCID, + "id": *deleteVPCRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCRoute : Retrieve a VPC route +// This request retrieves a single route specified by the identifier in the URL. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) +} + +// GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") + err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCRouteOptions.VPCID, + "id": *getVPCRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCRoute : Update a VPC route +// This request updates a route with the information in a provided route patch. The route patch object is structured in +// the same way as a retrieved route and contains only the information to be updated. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) +} + +// UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") + err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCRouteOptions.VPCID, + "id": *updateVPCRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCRouteOptions.RoutePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPCRoutingTables : List all routing tables for a VPC +// This request lists all routing tables for a VPC. Each subnet in a VPC is associated with a routing table, which +// controls delivery of packets sent on that subnet according to the action of the most specific matching route in the +// table. If multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, +// delivery will be controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) +} + +// ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCRoutingTablesOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCRoutingTablesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) + } + if listVPCRoutingTablesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTablesOptions.Limit)) + } + if listVPCRoutingTablesOptions.IsDefault != nil { + builder.AddQuery("is_default", fmt.Sprint(*listVPCRoutingTablesOptions.IsDefault)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCRoutingTable : Create a routing table for a VPC +// This request creates a routing table from a routing table prototype object. The prototype object is structured in the +// same way as a retrieved routing table, and contains the information necessary to create the new routing table. +func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) +} + +// CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCRoutingTableOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { + body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom + } + if createVPCRoutingTableOptions.Name != nil { + body["name"] = createVPCRoutingTableOptions.Name + } + if createVPCRoutingTableOptions.RouteDirectLinkIngress != nil { + body["route_direct_link_ingress"] = createVPCRoutingTableOptions.RouteDirectLinkIngress + } + if createVPCRoutingTableOptions.RouteInternetIngress != nil { + body["route_internet_ingress"] = createVPCRoutingTableOptions.RouteInternetIngress + } + if createVPCRoutingTableOptions.RouteTransitGatewayIngress != nil { + body["route_transit_gateway_ingress"] = createVPCRoutingTableOptions.RouteTransitGatewayIngress + } + if createVPCRoutingTableOptions.RouteVPCZoneIngress != nil { + body["route_vpc_zone_ingress"] = createVPCRoutingTableOptions.RouteVPCZoneIngress + } + if createVPCRoutingTableOptions.Routes != nil { + body["routes"] = createVPCRoutingTableOptions.Routes + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPCRoutingTable : Delete a VPC routing table +// This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the +// VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) +} + +// DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRoutingTableOptions.VPCID, + "id": *deleteVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteVPCRoutingTableOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCRoutingTableOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCRoutingTable : Retrieve a VPC routing table +// This request retrieves a single routing table specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) +} + +// GetVPCRoutingTableWithContext is an alternate form of the GetVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableOptions, "getVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCRoutingTableOptions.VPCID, + "id": *getVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCRoutingTable : Update a VPC routing table +// This request updates a routing table with the information in a provided routing table patch. The patch object is +// structured in the same way as a retrieved table and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) +} + +// UpdateVPCRoutingTableWithContext is an alternate form of the UpdateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCRoutingTableOptions.VPCID, + "id": *updateVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVPCRoutingTableOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPCRoutingTableOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPCRoutingTableRoutes : List all routes in a VPC routing table +// This request lists all routes in a VPC routing table. If subnets are associated with this routing table, delivery of +// packets sent on a subnet is performed according to the action of the most specific matching route in the table +// (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, the route with the +// highest priority will be used. If two matching routes have the same destination and priority, traffic will be +// distributed between them. If no routes match, delivery will be controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) +} + +// ListVPCRoutingTableRoutesWithContext is an alternate form of the ListVPCRoutingTableRoutes method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCRoutingTableRoutesOptions.VPCID, + "routing_table_id": *listVPCRoutingTableRoutesOptions.RoutingTableID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCRoutingTableRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) + } + if listVPCRoutingTableRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCRoutingTableRoute : Create a route in a VPC routing table +// This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the +// same way as a retrieved VPC route and contains the information necessary to create the route. +func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) +} + +// CreateVPCRoutingTableRouteWithContext is an alternate form of the CreateVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *createVPCRoutingTableRouteOptions.RoutingTableID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCRoutingTableRouteOptions.Destination != nil { + body["destination"] = createVPCRoutingTableRouteOptions.Destination + } + if createVPCRoutingTableRouteOptions.Zone != nil { + body["zone"] = createVPCRoutingTableRouteOptions.Zone + } + if createVPCRoutingTableRouteOptions.Action != nil { + body["action"] = createVPCRoutingTableRouteOptions.Action + } + if createVPCRoutingTableRouteOptions.Name != nil { + body["name"] = createVPCRoutingTableRouteOptions.Name + } + if createVPCRoutingTableRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop + } + if createVPCRoutingTableRouteOptions.Priority != nil { + body["priority"] = createVPCRoutingTableRouteOptions.Priority + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPCRoutingTableRoute : Delete a VPC routing table route +// This request deletes a VPC route. This operation cannot be reversed. Only VPC routes with an `origin` of `user` are +// allowed to be deleted. +func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) +} + +// DeleteVPCRoutingTableRouteWithContext is an alternate form of the DeleteVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *deleteVPCRoutingTableRouteOptions.RoutingTableID, + "id": *deleteVPCRoutingTableRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCRoutingTableRoute : Retrieve a VPC routing table route +// This request retrieves a single VPC route specified by the identifier in the URL path. +func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) +} + +// GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *getVPCRoutingTableRouteOptions.RoutingTableID, + "id": *getVPCRoutingTableRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCRoutingTableRoute : Update a VPC routing table route +// This request updates a VPC route with the information provided in a route patch object. The patch object is +// structured in the same way as a retrieved VPC route and needs to contain only the information to be updated. Only VPC +// routes with an `origin` of `user` are allowed to be updated. +func (vpc *VpcV1) UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRoutingTableRouteWithContext(context.Background(), updateVPCRoutingTableRouteOptions) +} + +// UpdateVPCRoutingTableRouteWithContext is an alternate form of the UpdateVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *updateVPCRoutingTableRouteOptions.RoutingTableID, + "id": *updateVPCRoutingTableRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCRoutingTableRouteOptions.RoutePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSubnets : List all subnets +// This request lists all subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block +// notation. Each subnet is within a particular zone and cannot span multiple zones or regions. +func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + return vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) +} + +// ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter +func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSubnetsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSubnetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) + } + if listSubnetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetsOptions.Limit)) + } + if listSubnetsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) + } + if listSubnetsOptions.RoutingTableID != nil { + builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) + } + if listSubnetsOptions.RoutingTableName != nil { + builder.AddQuery("routing_table.name", fmt.Sprint(*listSubnetsOptions.RoutingTableName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSubnet : Create a subnet +// This request creates a new subnet from a subnet prototype object. The prototype object is structured in the same way +// as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, +// the prototype's CIDR block must not overlap with an existing subnet in the VPC. +func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) +} + +// CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createSubnetOptions.SubnetPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSubnet : Delete a subnet +// This request deletes a subnet. This operation cannot be reversed. For this request to succeed, the subnet must not be +// referenced by any network interfaces, VPN gateways, or load balancers. A delete operation automatically detaches the +// subnet from any network ACLs, public gateways, or endpoint gateways. All flow log collectors with `auto_delete` set +// to `true` targeting the subnet or any resource in the subnet are automatically deleted. +func (vpc *VpcV1) DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) +} + +// DeleteSubnetWithContext is an alternate form of the DeleteSubnet method which supports a Context parameter +func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSubnetOptions, "deleteSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSubnetOptions, "deleteSubnetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnet") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSubnet : Retrieve a subnet +// This request retrieves a single subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) +} + +// GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter +func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateSubnet : Update a subnet +// This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured +// in the same way as a retrieved subnet and contains only the information to be updated. +func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) +} + +// UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter +func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSubnetOptions.SubnetPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetSubnetNetworkACL : Retrieve a subnet's attached network ACL +// This request retrieves the network ACL attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetNetworkACL(getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.GetSubnetNetworkACLWithContext(context.Background(), getSubnetNetworkACLOptions) +} + +// GetSubnetNetworkACLWithContext is an alternate form of the GetSubnetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ReplaceSubnetNetworkACL : Replace the network ACL for a subnet +// This request replaces the existing network ACL for a subnet with the network ACL specified in the request body. +func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) +} + +// ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *replaceSubnetNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(replaceSubnetNetworkACLOptions.NetworkACLIdentity) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UnsetSubnetPublicGateway : Detach a public gateway from a subnet +// This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. +func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) +} + +// UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *unsetSubnetPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSubnetPublicGateway : Retrieve a subnet's attached public gateway +// This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) +} + +// GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// SetSubnetPublicGateway : Attach a public gateway to a subnet +// This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet +// identifier in the URL. The public gateway must have the same VPC and zone as the subnet. +func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) +} + +// SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *setSubnetPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(setSubnetPublicGatewayOptions.PublicGatewayIdentity) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetSubnetRoutingTable : Retrieve a subnet's attached routing table +// This request retrieves the routing table attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) +} + +// GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ReplaceSubnetRoutingTable : Replace the routing table for a subnet +// This request replaces the existing routing table for a subnet with the routing table specified in the request body. +// +// For this request to succeed, the routing table `route_direct_link_ingress`, +// `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. +func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) +} + +// ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *replaceSubnetRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(replaceSubnetRoutingTableOptions.RoutingTableIdentity) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSubnetReservedIps : List all reserved IPs in a subnet +// This request lists all reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet +// which is not available for use. +func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + return vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) +} + +// ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter +func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *listSubnetReservedIpsOptions.SubnetID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSubnetReservedIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) + } + if listSubnetReservedIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetReservedIpsOptions.Limit)) + } + if listSubnetReservedIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) + } + if listSubnetReservedIpsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listSubnetReservedIpsOptions.TargetID)) + } + if listSubnetReservedIpsOptions.TargetCRN != nil { + builder.AddQuery("target.crn", fmt.Sprint(*listSubnetReservedIpsOptions.TargetCRN)) + } + if listSubnetReservedIpsOptions.TargetName != nil { + builder.AddQuery("target.name", fmt.Sprint(*listSubnetReservedIpsOptions.TargetName)) + } + if listSubnetReservedIpsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listSubnetReservedIpsOptions.TargetResourceType)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSubnetReservedIP : Reserve an IP in a subnet +// This request reserves an IP address in a subnet. If the provided prototype object includes an `address`, the address +// must not already be reserved. +func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) +} + +// CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *createSubnetReservedIPOptions.SubnetID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createSubnetReservedIPOptions.Address != nil { + body["address"] = createSubnetReservedIPOptions.Address + } + if createSubnetReservedIPOptions.AutoDelete != nil { + body["auto_delete"] = createSubnetReservedIPOptions.AutoDelete + } + if createSubnetReservedIPOptions.Name != nil { + body["name"] = createSubnetReservedIPOptions.Name + } + if createSubnetReservedIPOptions.Target != nil { + body["target"] = createSubnetReservedIPOptions.Target + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSubnetReservedIP : Delete a reserved IP +// This request releases a reserved IP. This operation cannot be reversed. +// +// For this request to succeed, the reserved IP must not be required by another resource, such as a network interface +// for which it is the primary IP. A provider-owned reserved IP is not allowed to be deleted. +func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) +} + +// DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *deleteSubnetReservedIPOptions.SubnetID, + "id": *deleteSubnetReservedIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSubnetReservedIP : Retrieve a reserved IP +// This request retrieves a single reserved IP specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) +} + +// GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *getSubnetReservedIPOptions.SubnetID, + "id": *getSubnetReservedIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateSubnetReservedIP : Update a reserved IP +// This request updates a reserved IP with the information in a provided reserved IP patch. The reserved IP patch object +// is structured in the same way as a retrieved reserved IP and contains only the information to be updated. +// +// A provider-owned reserved IP is not allowed to be updated. +func (vpc *VpcV1) UpdateSubnetReservedIP(updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.UpdateSubnetReservedIPWithContext(context.Background(), updateSubnetReservedIPOptions) +} + +// UpdateSubnetReservedIPWithContext is an alternate form of the UpdateSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *updateSubnetReservedIPOptions.SubnetID, + "id": *updateSubnetReservedIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSubnetReservedIPOptions.ReservedIPPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListImages : List all images +// This request lists all images available in the region. An image provides source data for a volume. Images are either +// system-provided, or created from another source, such as importing from Cloud Object Storage. +// +// The images will be sorted by their `created_at` property values, with the newest first. Images with identical +// `created_at` values will be secondarily sorted by ascending `id` property values. +func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + return vpc.ListImagesWithContext(context.Background(), listImagesOptions) +} + +// ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter +func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listImagesOptions, "listImagesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listImagesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listImagesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) + } + if listImagesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listImagesOptions.Limit)) + } + if listImagesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listImagesOptions.ResourceGroupID)) + } + if listImagesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) + } + if listImagesOptions.Visibility != nil { + builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateImage : Create an image +// This request creates a new image from an image prototype object. The prototype object is structured in the same way +// as a retrieved image, and contains the information necessary to create the new image. If an image is being imported, +// a URL to the image file on object storage must be specified. If an image is being created from an existing volume, +// that volume must be specified. +func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.CreateImageWithContext(context.Background(), createImageOptions) +} + +// CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter +func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createImageOptions, "createImageOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteImage : Delete an image +// This request deletes an image. Any active image export jobs will be completed first. This operation cannot be +// reversed. A system-provided image is not allowed to be deleted. Additionally, an image cannot be deleted if it: +// - has a `status` of `deleting` +// - has a `status` of `pending` with a `status_reasons` code of `image_request_in_progress` +// - has `catalog_offering.managed` set to `true`. +func (vpc *VpcV1) DeleteImage(deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteImageWithContext(context.Background(), deleteImageOptions) +} + +// DeleteImageWithContext is an alternate form of the DeleteImage method which supports a Context parameter +func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteImageOptions, "deleteImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteImageOptions, "deleteImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetImage : Retrieve an image +// This request retrieves a single image specified by the identifier in the URL. +func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.GetImageWithContext(context.Background(), getImageOptions) +} + +// GetImageWithContext is an alternate form of the GetImage method which supports a Context parameter +func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getImageOptions, "getImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getImageOptions, "getImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateImage : Update an image +// This request updates an image with the information in a provided image patch. The image patch object is structured in +// the same way as a retrieved image and contains only the information to be updated. A system-provided image is not +// allowed to be updated. An image with a `status` of `deleting` cannot be updated. +func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.UpdateImageWithContext(context.Background(), updateImageOptions) +} + +// UpdateImageWithContext is an alternate form of the UpdateImage method which supports a Context parameter +func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateImageOptions, "updateImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateImageOptions, "updateImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateImageOptions.ImagePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListImageExportJobs : List all image export jobs +// This request lists all export jobs for an image. Each job tracks the exporting of the image to another location, such +// as a bucket within cloud object storage. +// +// The jobs will be sorted by their `created_at` property values, with newest jobs first. Jobs with identical +// `created_at` property values will in turn be sorted by ascending +// `name` property values. +func (vpc *VpcV1) ListImageExportJobs(listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListImageExportJobsWithContext(context.Background(), listImageExportJobsOptions) +} + +// ListImageExportJobsWithContext is an alternate form of the ListImageExportJobs method which supports a Context parameter +func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listImageExportJobsOptions, "listImageExportJobsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listImageExportJobsOptions, "listImageExportJobsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *listImageExportJobsOptions.ImageID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listImageExportJobsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageExportJobs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listImageExportJobsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJobUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateImageExportJob : Create an image export job +// This request creates and queues a new export job for the image specified in the URL using the image export job +// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, or `unusable` +// state. The prototype object is structured in the same way as a retrieved image export job, and contains the +// information necessary to create and queue the new image export job. +func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + return vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) +} + +// CreateImageExportJobWithContext is an alternate form of the CreateImageExportJob method which supports a Context parameter +func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createImageExportJobOptions, "createImageExportJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *createImageExportJobOptions.ImageID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createImageExportJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createImageExportJobOptions.StorageBucket != nil { + body["storage_bucket"] = createImageExportJobOptions.StorageBucket + } + if createImageExportJobOptions.Format != nil { + body["format"] = createImageExportJobOptions.Format + } + if createImageExportJobOptions.Name != nil { + body["name"] = createImageExportJobOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteImageExportJob : Delete an image export job +// This request deletes an image export job. This operation cannot be reversed. If the job has not completed, the job +// will be canceled, and the incomplete exported image object deleted. If the job has completed, the exported image +// object will not be deleted. +func (vpc *VpcV1) DeleteImageExportJob(deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) +} + +// DeleteImageExportJobWithContext is an alternate form of the DeleteImageExportJob method which supports a Context parameter +func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteImageExportJobOptions, "deleteImageExportJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *deleteImageExportJobOptions.ImageID, + "id": *deleteImageExportJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteImageExportJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetImageExportJob : Retrieve an image export job +// This request retrieves a single image export job specified by the identifier in the URL. +func (vpc *VpcV1) GetImageExportJob(getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + return vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) +} + +// GetImageExportJobWithContext is an alternate form of the GetImageExportJob method which supports a Context parameter +func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getImageExportJobOptions, "getImageExportJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *getImageExportJobOptions.ImageID, + "id": *getImageExportJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getImageExportJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImageExportJob") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateImageExportJob : Update an image export job +// This request updates an image export job with the information in a provided image export job patch. The image export +// job patch object is structured in the same way as a retrieved image export job and contains only the information to +// be updated. +func (vpc *VpcV1) UpdateImageExportJob(updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + return vpc.UpdateImageExportJobWithContext(context.Background(), updateImageExportJobOptions) +} + +// UpdateImageExportJobWithContext is an alternate form of the UpdateImageExportJob method which supports a Context parameter +func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateImageExportJobOptions, "updateImageExportJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateImageExportJobOptions, "updateImageExportJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *updateImageExportJobOptions.ImageID, + "id": *updateImageExportJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateImageExportJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImageExportJob") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateImageExportJobOptions.ImageExportJobPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListOperatingSystems : List all operating systems +// This request lists all operating systems in the region. +func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + return vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) +} + +// ListOperatingSystemsWithContext is an alternate form of the ListOperatingSystems method which supports a Context parameter +func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listOperatingSystemsOptions, "listOperatingSystemsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listOperatingSystemsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listOperatingSystemsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) + } + if listOperatingSystemsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listOperatingSystemsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetOperatingSystem : Retrieve an operating system +// This request retrieves a single operating system specified by the name in the URL. +func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + return vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) +} + +// GetOperatingSystemWithContext is an alternate form of the GetOperatingSystem method which supports a Context parameter +func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOperatingSystemOptions, "getOperatingSystemOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getOperatingSystemOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getOperatingSystemOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListKeys : List all keys +// This request lists all keys in the region. A key contains a public SSH key which may be installed on instances when +// they are created. Private keys are not stored. +func (vpc *VpcV1) ListKeys(listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { + return vpc.ListKeysWithContext(context.Background(), listKeysOptions) +} + +// ListKeysWithContext is an alternate form of the ListKeys method which supports a Context parameter +func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listKeysOptions, "listKeysOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listKeysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListKeys") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listKeysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listKeysOptions.Start)) + } + if listKeysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listKeysOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKeyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateKey : Create a key +// This request creates a new SSH key from an key prototype object. The prototype object is structured in the same way +// as a retrieved key, and contains the information necessary to create the new key. The public key value must be +// provided. +func (vpc *VpcV1) CreateKey(createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.CreateKeyWithContext(context.Background(), createKeyOptions) +} + +// CreateKeyWithContext is an alternate form of the CreateKey method which supports a Context parameter +func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createKeyOptions, "createKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createKeyOptions, "createKeyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createKeyOptions.PublicKey != nil { + body["public_key"] = createKeyOptions.PublicKey + } + if createKeyOptions.Name != nil { + body["name"] = createKeyOptions.Name + } + if createKeyOptions.ResourceGroup != nil { + body["resource_group"] = createKeyOptions.ResourceGroup + } + if createKeyOptions.Type != nil { + body["type"] = createKeyOptions.Type + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteKey : Delete a key +// This request deletes a key. This operation cannot be reversed. +func (vpc *VpcV1) DeleteKey(deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteKeyWithContext(context.Background(), deleteKeyOptions) +} + +// DeleteKeyWithContext is an alternate form of the DeleteKey method which supports a Context parameter +func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteKeyOptions, "deleteKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteKeyOptions, "deleteKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetKey : Retrieve a key +// This request retrieves a single key specified by the identifier in the URL. +func (vpc *VpcV1) GetKey(getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.GetKeyWithContext(context.Background(), getKeyOptions) +} + +// GetKeyWithContext is an alternate form of the GetKey method which supports a Context parameter +func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getKeyOptions, "getKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getKeyOptions, "getKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateKey : Update a key +// This request updates a key's name. +func (vpc *VpcV1) UpdateKey(updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.UpdateKeyWithContext(context.Background(), updateKeyOptions) +} + +// UpdateKeyWithContext is an alternate form of the UpdateKey method which supports a Context parameter +func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateKeyOptions, "updateKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateKeyOptions, "updateKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateKeyOptions.KeyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceProfiles : List all instance profiles +// This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the +// region. An instance profile specifies the performance characteristics and pricing model for an instance. +func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) +} + +// ListInstanceProfilesWithContext is an alternate form of the ListInstanceProfiles method which supports a Context parameter +func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceProfilesOptions, "listInstanceProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceProfile : Retrieve an instance profile +// This request retrieves a single instance profile specified by the name in the URL. +func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + return vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) +} + +// GetInstanceProfileWithContext is an alternate form of the GetInstanceProfile method which supports a Context parameter +func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceProfileOptions, "getInstanceProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getInstanceProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceTemplates : List all instance templates +// This request lists all instance templates in the region. +func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) +} + +// ListInstanceTemplatesWithContext is an alternate form of the ListInstanceTemplates method which supports a Context parameter +func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceTemplatesOptions, "listInstanceTemplatesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceTemplatesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplateCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceTemplate : Create an instance template +// This request creates a new instance template. The prototype object is structured in the same way as a retrieved +// instance template, and contains the information necessary to provision a new instance from the template. +// +// If a `source_template` is specified in the prototype object, its contents are copied into the new template prior to +// copying any other properties provided in the prototype object. +func (vpc *VpcV1) CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) +} + +// CreateInstanceTemplateWithContext is an alternate form of the CreateInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceTemplateOptions, "createInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceTemplateOptions, "createInstanceTemplateOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceTemplate") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceTemplateOptions.InstanceTemplatePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceTemplate : Delete an instance template +// This request deletes the instance template. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) +} + +// DeleteInstanceTemplateWithContext is an alternate form of the DeleteInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceTemplate : Retrieve an instance template +// This request retrieves a single instance template specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) +} + +// GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceTemplate : Update an instance template +// This request updates an instance template with the information provided in the instance template patch. The instance +// template patch object is structured in the same way as a retrieved instance template and contains only the +// information to be updated. +func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) +} + +// UpdateInstanceTemplateWithContext is an alternate form of the UpdateInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceTemplateOptions, "updateInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceTemplateOptions.InstanceTemplatePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstances : List all instances +// This request lists all instances in the region. +func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) +} + +// ListInstancesWithContext is an alternate form of the ListInstances method which supports a Context parameter +func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstancesOptions, "listInstancesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstancesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstancesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) + } + if listInstancesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstancesOptions.Limit)) + } + if listInstancesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listInstancesOptions.ResourceGroupID)) + } + if listInstancesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) + } + if listInstancesOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) + } + if listInstancesOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) + } + if listInstancesOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) + } + if listInstancesOptions.NetworkAttachmentsSubnetID != nil { + builder.AddQuery("network_attachments[].subnet.id", fmt.Sprint(*listInstancesOptions.NetworkAttachmentsSubnetID)) + } + if listInstancesOptions.NetworkAttachmentsSubnetCRN != nil { + builder.AddQuery("network_attachments[].subnet.crn", fmt.Sprint(*listInstancesOptions.NetworkAttachmentsSubnetCRN)) + } + if listInstancesOptions.NetworkAttachmentsSubnetName != nil { + builder.AddQuery("network_attachments[].subnet.name", fmt.Sprint(*listInstancesOptions.NetworkAttachmentsSubnetName)) + } + if listInstancesOptions.DedicatedHostID != nil { + builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) + } + if listInstancesOptions.DedicatedHostCRN != nil { + builder.AddQuery("dedicated_host.crn", fmt.Sprint(*listInstancesOptions.DedicatedHostCRN)) + } + if listInstancesOptions.DedicatedHostName != nil { + builder.AddQuery("dedicated_host.name", fmt.Sprint(*listInstancesOptions.DedicatedHostName)) + } + if listInstancesOptions.PlacementGroupID != nil { + builder.AddQuery("placement_group.id", fmt.Sprint(*listInstancesOptions.PlacementGroupID)) + } + if listInstancesOptions.PlacementGroupCRN != nil { + builder.AddQuery("placement_group.crn", fmt.Sprint(*listInstancesOptions.PlacementGroupCRN)) + } + if listInstancesOptions.PlacementGroupName != nil { + builder.AddQuery("placement_group.name", fmt.Sprint(*listInstancesOptions.PlacementGroupName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstance : Create an instance +// This request provisions a new instance from an instance prototype object. The prototype object is structured in the +// same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance +// is automatically started. +func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) +} + +// CreateInstanceWithContext is an alternate form of the CreateInstance method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceOptions, "createInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceOptions.InstancePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstance : Delete an instance +// This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with the instance's +// network interfaces are implicitly disassociated. All flow log collectors with `auto_delete` set to `true` targeting +// the instance and/or the instance's network interfaces are automatically deleted. +func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) +} + +// DeleteInstanceWithContext is an alternate form of the DeleteInstance method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceOptions, "deleteInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceOptions, "deleteInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstance : Retrieve an instance +// This request retrieves a single instance specified by the identifier in the URL. +func (vpc *VpcV1) GetInstance(getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) +} + +// GetInstanceWithContext is an alternate form of the GetInstance method which supports a Context parameter +func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceOptions, "getInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceOptions, "getInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstance : Update an instance +// This request updates an instance with the information in a provided instance patch. The instance patch object is +// structured in the same way as a retrieved instance and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) +} + +// UpdateInstanceWithContext is an alternate form of the UpdateInstance method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceOptions, "updateInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceInitialization : Retrieve initialization configuration for an instance +// This request retrieves configuration used to initialize the instance, such as SSH keys and the Windows administrator +// password. These can subsequently be changed on the instance and therefore may not be current. +func (vpc *VpcV1) GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { + return vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) +} + +// GetInstanceInitializationWithContext is an alternate form of the GetInstanceInitialization method which supports a Context parameter +func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceInitializationOptions, "getInstanceInitializationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceInitializationOptions, "getInstanceInitializationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceInitializationOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}/initialization`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceInitializationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceInitialization") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceInitialization) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceAction : Create an instance action +// This request creates a new action which will be queued up to run as soon as any pending or running actions have +// completed. +func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) +} + +// CreateInstanceActionWithContext is an alternate form of the CreateInstanceAction method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceActionOptions, "createInstanceActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceActionOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/actions`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceActionOptions.Type != nil { + body["type"] = createInstanceActionOptions.Type + } + if createInstanceActionOptions.Force != nil { + body["force"] = createInstanceActionOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceConsoleAccessToken : Create a console access token for an instance +// This request creates a new single-use console access token for an instance. All console configuration is provided at +// token create time, and the token is subsequently used in the `access_token` query parameter for the WebSocket +// request. The access token is only valid for a short period of time, and a maximum of one token is valid for a given +// instance at a time. +func (vpc *VpcV1) CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) +} + +// CreateInstanceConsoleAccessTokenWithContext is an alternate form of the CreateInstanceConsoleAccessToken method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Context, createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceConsoleAccessTokenOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/console_access_token`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceConsoleAccessTokenOptions.ConsoleType != nil { + body["console_type"] = createInstanceConsoleAccessTokenOptions.ConsoleType + } + if createInstanceConsoleAccessTokenOptions.Force != nil { + body["force"] = createInstanceConsoleAccessTokenOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceDisks : List all disks on an instance +// This request lists all disks on an instance. A disk is a block device that is locally attached to the instance's +// physical host and is also referred to as instance storage. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) +} + +// ListInstanceDisksWithContext is an alternate form of the ListInstanceDisks method which supports a Context parameter +func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceDisksOptions, "listInstanceDisksOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceDisksOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceDisksOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceDisk : Retrieve an instance disk +// This request retrieves a single instance disk specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + return vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) +} + +// GetInstanceDiskWithContext is an alternate form of the GetInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceDiskOptions, "getInstanceDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceDiskOptions.InstanceID, + "id": *getInstanceDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceDisk : Update an instance disk +// This request updates the instance disk with the information in a provided patch. +func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) +} + +// UpdateInstanceDiskWithContext is an alternate form of the UpdateInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceDiskOptions, "updateInstanceDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceDiskOptions.InstanceID, + "id": *updateInstanceDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceDiskOptions.InstanceDiskPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceNetworkAttachments : List all network attachments on an instance +// This request lists all network attachments on an instance. This request lists all network attachments on an instance. +// A network attachment represents a device on the instance to which a virtual network interface is attached. +// +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) +} + +// ListInstanceNetworkAttachmentsWithContext is an alternate form of the ListInstanceNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkAttachmentsOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachmentCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceNetworkAttachment : Create a network attachment on an instance +// This request creates a new instance network attachment from an instance network attachment prototype object. The +// prototype object is structured in the same way as a retrieved instance network attachment, and contains the +// information necessary to create the new instance network attachment. +func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) +} + +// CreateInstanceNetworkAttachmentWithContext is an alternate form of the CreateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context, createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceNetworkAttachmentOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceNetworkAttachmentOptions.VirtualNetworkInterface != nil { + body["virtual_network_interface"] = createInstanceNetworkAttachmentOptions.VirtualNetworkInterface + } + if createInstanceNetworkAttachmentOptions.Name != nil { + body["name"] = createInstanceNetworkAttachmentOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceNetworkAttachment : Delete an instance network attachment +// This request deletes an instance network attachment. This operation cannot be reversed. Any floating IPs associated +// with the instance network attachment are implicitly disassociated. All flow log collectors with `auto_delete` set to +// `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment +// is not allowed to be deleted. +func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) +} + +// DeleteInstanceNetworkAttachmentWithContext is an alternate form of the DeleteInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context, deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *deleteInstanceNetworkAttachmentOptions.InstanceID, + "id": *deleteInstanceNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceNetworkAttachment : Retrieve an instance network attachment +// This request retrieves a single instance network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) +} + +// GetInstanceNetworkAttachmentWithContext is an alternate form of the GetInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkAttachmentOptions.InstanceID, + "id": *getInstanceNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceNetworkAttachment : Update an instance network attachment +// This request updates an instance network attachment with the information provided in an instance network interface +// patch object. The instance network attachment patch object is structured in the same way as a retrieved instance +// network attachment and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) +} + +// UpdateInstanceNetworkAttachmentWithContext is an alternate form of the UpdateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context, updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceNetworkAttachmentOptions.InstanceID, + "id": *updateInstanceNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceNetworkInterfaces : List all network interfaces on an instance +// This request lists all network interfaces on an instance. A network interface is an abstract representation of a +// network interface card and connects an instance to a subnet. While each network interface can attach to only one +// subnet, multiple network interfaces can be created to attach to multiple subnets. Multiple interfaces may also attach +// to the same subnet. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) +} + +// ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaces") + err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkInterfacesOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceNetworkInterface : Create a network interface on an instance +// This request creates a new network interface from a network interface prototype object. The prototype object is +// structured in the same way as a retrieved network interface, and contains the information necessary to create the new +// network interface. Any subnet in the instance's VPC may be specified, even if it is already attached to another +// network interface. Addresses on the network interface must be within the specified subnet's CIDR blocks. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) +} + +// CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: CreateInstanceNetworkInterface") + err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceNetworkInterfaceOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceNetworkInterfaceOptions.Subnet != nil { + body["subnet"] = createInstanceNetworkInterfaceOptions.Subnet + } + if createInstanceNetworkInterfaceOptions.AllowIPSpoofing != nil { + body["allow_ip_spoofing"] = createInstanceNetworkInterfaceOptions.AllowIPSpoofing + } + if createInstanceNetworkInterfaceOptions.Name != nil { + body["name"] = createInstanceNetworkInterfaceOptions.Name + } + if createInstanceNetworkInterfaceOptions.PrimaryIP != nil { + body["primary_ip"] = createInstanceNetworkInterfaceOptions.PrimaryIP + } + if createInstanceNetworkInterfaceOptions.SecurityGroups != nil { + body["security_groups"] = createInstanceNetworkInterfaceOptions.SecurityGroups + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceNetworkInterface : Delete a network interface +// This request deletes a network interface. This operation cannot be reversed. Any floating IPs associated with the +// network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to `true` targeting +// the network interface are automatically deleted. The primary network interface is not allowed to be deleted. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) +} + +// DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: DeleteInstanceNetworkInterface") + err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *deleteInstanceNetworkInterfaceOptions.InstanceID, + "id": *deleteInstanceNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceNetworkInterface : Retrieve a network interface +// This request retrieves a single network interface specified by the identifier in the URL. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) +} + +// GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterface") + err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkInterfaceOptions.InstanceID, + "id": *getInstanceNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceNetworkInterface : Update a network interface +// This request updates a network interface with the information provided in a network interface patch object. The +// network interface patch object is structured in the same way as a retrieved network interface and needs to contain +// only the information to be updated. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) +} + +// UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: UpdateInstanceNetworkInterface") + err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceNetworkInterfaceOptions.InstanceID, + "id": *updateInstanceNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with a network interface +// This request lists all floating IPs associated with a network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) +} + +// ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceFloatingIps") + err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkInterfaceFloatingIpsOptions.InstanceID, + "network_interface_id": *listInstanceNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from a network interface +// This request disassociates the specified floating IP from the specified network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) +} + +// RemoveInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: RemoveInstanceNetworkInterfaceFloatingIP") + err = core.ValidateNotNil(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *removeInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *removeInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeInstanceNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveInstanceNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP address if it is associated with the network interface and instance +// specified in the URL. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) +} + +// GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceFloatingIP") + err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *getInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with a network interface +// This request associates the specified floating IP with the specified network interface, replacing any existing +// association. For this request to succeed, the existing floating IP must not be required by another resource, such as +// a public gateway. A request body is not required, and if provided, is ignored. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) +} + +// AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: AddInstanceNetworkInterfaceFloatingIP") + err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *addInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *addInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceNetworkInterfaceIps : List all reserved IPs bound to a network interface +// This request lists all reserved IPs bound to a network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) +} + +// ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceIps") + err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkInterfaceIpsOptions.InstanceID, + "network_interface_id": *listInstanceNetworkInterfaceIpsOptions.NetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkInterfaceIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceNetworkInterfaceIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) + } + if listInstanceNetworkInterfaceIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceNetworkInterfaceIP : Retrieve bound reserved IP +// This request retrieves the specified reserved IP address if it is bound to the network interface and instance +// specified in the URL. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) +} + +// GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceIP") + err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkInterfaceIPOptions.InstanceID, + "network_interface_id": *getInstanceNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getInstanceNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceVolumeAttachments : List all volumes attachments on an instance +// This request lists all volume attachments on an instance. A volume attachment connects a volume to an instance. Each +// instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one +// volume. +func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) +} + +// ListInstanceVolumeAttachmentsWithContext is an alternate form of the ListInstanceVolumeAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceVolumeAttachmentsOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachmentCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceVolumeAttachment : Create a volume attachment on an instance +// This request creates a new volume attachment from a volume attachment prototype object, connecting a volume to an +// instance. For this request to succeed, the specified volume must not be busy. The prototype object is structured in +// the same way as a retrieved volume attachment, and contains the information necessary to create the new volume +// attachment. +func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) +} + +// CreateInstanceVolumeAttachmentWithContext is an alternate form of the CreateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceVolumeAttachmentOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceVolumeAttachmentOptions.Volume != nil { + body["volume"] = createInstanceVolumeAttachmentOptions.Volume + } + if createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete != nil { + body["delete_volume_on_instance_delete"] = createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete + } + if createInstanceVolumeAttachmentOptions.Name != nil { + body["name"] = createInstanceVolumeAttachmentOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceVolumeAttachment : Delete a volume attachment +// This request deletes a volume attachment. This operation cannot be reversed, but a new volume attachment may +// subsequently be created for the volume. For this request to succeed, the volume must not be busy. +func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) +} + +// DeleteInstanceVolumeAttachmentWithContext is an alternate form of the DeleteInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *deleteInstanceVolumeAttachmentOptions.InstanceID, + "id": *deleteInstanceVolumeAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceVolumeAttachment : Retrieve a volume attachment +// This request retrieves a single volume attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) +} + +// GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, + "id": *getInstanceVolumeAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceVolumeAttachment : Update a volume attachment +// This request updates a volume attachment with the information provided in a volume attachment patch object. The +// volume attachment patch object is structured in the same way as a retrieved volume attachment and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) +} + +// UpdateInstanceVolumeAttachmentWithContext is an alternate form of the UpdateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceVolumeAttachmentOptions.InstanceID, + "id": *updateInstanceVolumeAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceGroups : List all instance groups +// This request lists all instance groups in the region. +func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) +} + +// ListInstanceGroupsWithContext is an alternate form of the ListInstanceGroups method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceGroupsOptions, "listInstanceGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) + } + if listInstanceGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceGroup : Create an instance group +// This request creates a new instance group. +func (vpc *VpcV1) CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupWithContext(context.Background(), createInstanceGroupOptions) +} + +// CreateInstanceGroupWithContext is an alternate form of the CreateInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupOptions, "createInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupOptions, "createInstanceGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceGroupOptions.InstanceTemplate != nil { + body["instance_template"] = createInstanceGroupOptions.InstanceTemplate + } + if createInstanceGroupOptions.Subnets != nil { + body["subnets"] = createInstanceGroupOptions.Subnets + } + if createInstanceGroupOptions.ApplicationPort != nil { + body["application_port"] = createInstanceGroupOptions.ApplicationPort + } + if createInstanceGroupOptions.LoadBalancer != nil { + body["load_balancer"] = createInstanceGroupOptions.LoadBalancer + } + if createInstanceGroupOptions.LoadBalancerPool != nil { + body["load_balancer_pool"] = createInstanceGroupOptions.LoadBalancerPool + } + if createInstanceGroupOptions.MembershipCount != nil { + body["membership_count"] = createInstanceGroupOptions.MembershipCount + } + if createInstanceGroupOptions.Name != nil { + body["name"] = createInstanceGroupOptions.Name + } + if createInstanceGroupOptions.ResourceGroup != nil { + body["resource_group"] = createInstanceGroupOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroup : Delete an instance group +// This request deletes an instance group. This operation cannot be reversed. Any instances associated with the group +// will be deleted. +func (vpc *VpcV1) DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) +} + +// DeleteInstanceGroupWithContext is an alternate form of the DeleteInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupOptions, "deleteInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupOptions, "deleteInstanceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteInstanceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroup : Retrieve an instance group +// This request retrieves a single instance group specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) +} + +// GetInstanceGroupWithContext is an alternate form of the GetInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupOptions, "getInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroup : Update an instance group +// This request updates an instance group with the information provided instance group patch. The instance group patch +// object is structured in the same way as a retrieved instance group and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) +} + +// UpdateInstanceGroupWithContext is an alternate form of the UpdateInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupOptions, "updateInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateInstanceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupOptions.InstanceGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer +// This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) +} + +// DeleteInstanceGroupLoadBalancerWithContext is an alternate form of the DeleteInstanceGroupLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context, deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupLoadBalancerOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/load_balancer`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListInstanceGroupManagers : List all managers for an instance group +// This request lists all managers for an instance group. +func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) +} + +// ListInstanceGroupManagersWithContext is an alternate form of the ListInstanceGroupManagers method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupManagersOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupManagersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) + } + if listInstanceGroupManagersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagersOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceGroupManager : Create a manager for an instance group +// This request creates a new instance group manager. +func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) +} + +// CreateInstanceGroupManagerWithContext is an alternate form of the CreateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroupManager : Delete an instance group manager +// This request deletes an instance group manager. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) +} + +// DeleteInstanceGroupManagerWithContext is an alternate form of the DeleteInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupManagerOptions.InstanceGroupID, + "id": *deleteInstanceGroupManagerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroupManager : Retrieve an instance group manager +// This request retrieves a single instance group manager specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) +} + +// GetInstanceGroupManagerWithContext is an alternate form of the GetInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupManagerOptions.InstanceGroupID, + "id": *getInstanceGroupManagerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroupManager : Update an instance group manager +// This request updates an instance group manager with the information provided instance group manager patch. +func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) +} + +// UpdateInstanceGroupManagerWithContext is an alternate form of the UpdateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupManagerOptions.InstanceGroupID, + "id": *updateInstanceGroupManagerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceGroupManagerActions : List all actions for an instance group manager +// This request lists all instance group actions for an instance group manager. +func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) +} + +// ListInstanceGroupManagerActionsWithContext is an alternate form of the ListInstanceGroupManagerActions method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context, listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupManagerActionsOptions.InstanceGroupID, + "instance_group_manager_id": *listInstanceGroupManagerActionsOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupManagerActionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupManagerActionsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) + } + if listInstanceGroupManagerActionsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerActionsCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceGroupManagerAction : Create an instance group manager action +// This request creates a new instance group manager action. +func (vpc *VpcV1) CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) +} + +// CreateInstanceGroupManagerActionWithContext is an alternate form of the CreateInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Context, createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *createInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *createInstanceGroupManagerActionOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerAction") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroupManagerAction : Delete specified instance group manager action +// This request deletes an instance group manager action. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) +} + +// DeleteInstanceGroupManagerActionWithContext is an alternate form of the DeleteInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Context, deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerActionOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroupManagerAction : Retrieve specified instance group manager action +// This request retrieves a single instance group manager action specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerActionWithContext(context.Background(), getInstanceGroupManagerActionOptions) +} + +// GetInstanceGroupManagerActionWithContext is an alternate form of the GetInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *getInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *getInstanceGroupManagerActionOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupManagerActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerAction") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroupManagerAction : Update specified instance group manager action +// This request updates an instance group manager action. +func (vpc *VpcV1) UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) +} + +// UpdateInstanceGroupManagerActionWithContext is an alternate form of the UpdateInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Context, updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *updateInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupManagerActionOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerAction") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceGroupManagerPolicies : List all policies for an instance group manager +// This request lists all policies for an instance group manager. +func (vpc *VpcV1) ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) +} + +// ListInstanceGroupManagerPoliciesWithContext is an alternate form of the ListInstanceGroupManagerPolicies method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Context, listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupID, + "instance_group_manager_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupManagerPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerPolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupManagerPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Start)) + } + if listInstanceGroupManagerPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager +// This request creates a new instance group manager policy. +func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) +} + +// CreateInstanceGroupManagerPolicyWithContext is an alternate form of the CreateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Context, createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy +// This request deletes an instance group manager policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) +} + +// DeleteInstanceGroupManagerPolicyWithContext is an alternate form of the DeleteInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Context, deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy +// This request retrieves a single instance group manager policy specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) +} + +// GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *getInstanceGroupManagerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroupManagerPolicy : Update an instance group manager policy +// This request updates an instance group manager policy. +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) +} + +// UpdateInstanceGroupManagerPolicyWithContext is an alternate form of the UpdateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Context, updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupManagerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroupMemberships : Delete all memberships from an instance group +// This request deletes all memberships of an instance group. This operation cannot be reversed. reversed. Any +// memberships that have `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. +func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) +} + +// DeleteInstanceGroupMembershipsWithContext is an alternate form of the DeleteInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupMembershipsOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListInstanceGroupMemberships : List all memberships for an instance group +// This request lists all instance group memberships for an instance group. +func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) +} + +// ListInstanceGroupMembershipsWithContext is an alternate form of the ListInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupMembershipsOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupMembershipsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) + } + if listInstanceGroupMembershipsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroupMembership : Delete an instance group membership +// This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the +// membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. +func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) +} + +// DeleteInstanceGroupMembershipWithContext is an alternate form of the DeleteInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupMembershipOptions.InstanceGroupID, + "id": *deleteInstanceGroupMembershipOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroupMembership : Retrieve an instance group membership +// This request retrieves a single instance group membership specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) +} + +// GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupMembershipOptions.InstanceGroupID, + "id": *getInstanceGroupMembershipOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroupMembership : Update an instance group membership +// This request updates an instance group membership with the information provided instance group membership patch. +func (vpc *VpcV1) UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupMembershipWithContext(context.Background(), updateInstanceGroupMembershipOptions) +} + +// UpdateInstanceGroupMembershipWithContext is an alternate form of the UpdateInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupMembershipOptions.InstanceGroupID, + "id": *updateInstanceGroupMembershipOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupMembershipOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupMembership") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupMembershipOptions.InstanceGroupMembershipPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListDedicatedHostGroups : List all dedicated host groups +// This request lists all dedicated host groups in the region. Host groups are a collection of dedicated hosts for +// placement of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. +func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) +} + +// ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listDedicatedHostGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) + } + if listDedicatedHostGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) + } + if listDedicatedHostGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostGroupsOptions.ResourceGroupID)) + } + if listDedicatedHostGroupsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostGroupsOptions.ZoneName)) + } + if listDedicatedHostGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listDedicatedHostGroupsOptions.Name)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateDedicatedHostGroup : Create a dedicated host group +// This request creates a new dedicated host group. +func (vpc *VpcV1) CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.CreateDedicatedHostGroupWithContext(context.Background(), createDedicatedHostGroupOptions) +} + +// CreateDedicatedHostGroupWithContext is an alternate form of the CreateDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createDedicatedHostGroupOptions.Class != nil { + body["class"] = createDedicatedHostGroupOptions.Class + } + if createDedicatedHostGroupOptions.Family != nil { + body["family"] = createDedicatedHostGroupOptions.Family + } + if createDedicatedHostGroupOptions.Zone != nil { + body["zone"] = createDedicatedHostGroupOptions.Zone + } + if createDedicatedHostGroupOptions.Name != nil { + body["name"] = createDedicatedHostGroupOptions.Name + } + if createDedicatedHostGroupOptions.ResourceGroup != nil { + body["resource_group"] = createDedicatedHostGroupOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteDedicatedHostGroup : Delete a dedicated host group +// This request deletes a dedicated host group. +func (vpc *VpcV1) DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteDedicatedHostGroupWithContext(context.Background(), deleteDedicatedHostGroupOptions) +} + +// DeleteDedicatedHostGroupWithContext is an alternate form of the DeleteDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteDedicatedHostGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetDedicatedHostGroup : Retrieve a dedicated host group +// This request retrieves a single dedicated host group specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) +} + +// GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getDedicatedHostGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateDedicatedHostGroup : Update a dedicated host group +// This request updates a dedicated host group with the information in a provided dedicated host group patch. The +// dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only +// the information to be updated. +func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) +} + +// UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateDedicatedHostGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListDedicatedHostProfiles : List all dedicated host profiles +// This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in +// the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. +func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) +} + +// ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listDedicatedHostProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) + } + if listDedicatedHostProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetDedicatedHostProfile : Retrieve a dedicated host profile +// This request retrieves a single dedicated host profile specified by the name in the URL. +func (vpc *VpcV1) GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostProfileWithContext(context.Background(), getDedicatedHostProfileOptions) +} + +// GetDedicatedHostProfileWithContext is an alternate form of the GetDedicatedHostProfile method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getDedicatedHostProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListDedicatedHosts : List all dedicated hosts +// This request lists all dedicated hosts in the region. +func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) +} + +// ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listDedicatedHostsOptions.DedicatedHostGroupID != nil { + builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) + } + if listDedicatedHostsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostsOptions.Start)) + } + if listDedicatedHostsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostsOptions.Limit)) + } + if listDedicatedHostsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostsOptions.ResourceGroupID)) + } + if listDedicatedHostsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostsOptions.ZoneName)) + } + if listDedicatedHostsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listDedicatedHostsOptions.Name)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateDedicatedHost : Create a dedicated host +// This request creates a new dedicated host. +func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) +} + +// CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createDedicatedHostOptions.DedicatedHostPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListDedicatedHostDisks : List all disks on a dedicated host +// This request lists all disks on a dedicated host. A disk is a physical device that is locally attached to the +// compute node. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) +} + +// ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "dedicated_host_id": *listDedicatedHostDisksOptions.DedicatedHostID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetDedicatedHostDisk : Retrieve a dedicated host disk +// This request retrieves a single dedicated host disk specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) +} + +// GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "dedicated_host_id": *getDedicatedHostDiskOptions.DedicatedHostID, + "id": *getDedicatedHostDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateDedicatedHostDisk : Update a dedicated host disk +// This request updates the dedicated host disk with the information in a provided patch. +func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) +} + +// UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "dedicated_host_id": *updateDedicatedHostDiskOptions.DedicatedHostID, + "id": *updateDedicatedHostDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteDedicatedHost : Delete a dedicated host +// This request deletes a dedicated host. +func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) +} + +// DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetDedicatedHost : Retrieve a dedicated host +// This request retrieves a single dedicated host specified by the identifiers in the URL. +func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) +} + +// GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateDedicatedHost : Update a dedicated host +// This request updates a dedicated host with the information in a provided dedicated host patch. The dedicated host +// patch object is structured in the same way as a retrieved dedicated host and contains only the information to be +// updated. +func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) +} + +// UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBackupPolicies : List all backup policies +// This request lists all backup policies in the region. Backup policies control which sources are selected for backup +// and include a set of backup policy plans that provide the backup schedules and deletion triggers. +func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) +} + +// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter +func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listBackupPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBackupPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) + } + if listBackupPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) + } + if listBackupPoliciesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) + } + if listBackupPoliciesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) + } + if listBackupPoliciesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBackupPolicy : Create a backup policy +// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in +// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. +func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + return vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) +} + +// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createBackupPolicyOptions.MatchUserTags != nil { + body["match_user_tags"] = createBackupPolicyOptions.MatchUserTags + } + if createBackupPolicyOptions.MatchResourceTypes != nil { + body["match_resource_types"] = createBackupPolicyOptions.MatchResourceTypes + } + if createBackupPolicyOptions.Name != nil { + body["name"] = createBackupPolicyOptions.Name + } + if createBackupPolicyOptions.Plans != nil { + body["plans"] = createBackupPolicyOptions.Plans + } + if createBackupPolicyOptions.ResourceGroup != nil { + body["resource_group"] = createBackupPolicyOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBackupPolicyJobs : List all jobs for a backup policy +// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan +// for a resource matching the policy's criteria. +func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) +} + +// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBackupPolicyJobsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) + } + if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) + } + if listBackupPolicyJobsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) + } + if listBackupPolicyJobsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) + } + if listBackupPolicyJobsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) + } + if listBackupPolicyJobsOptions.SourceID != nil { + builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { + builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { + builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBackupPolicyJob : Retrieve a backup policy job +// This request retrieves a single backup policy job specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) +} + +// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, + "id": *getBackupPolicyJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBackupPolicyJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBackupPolicyPlans : List all plans for a backup policy +// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. +func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) +} + +// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBackupPolicyPlansOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBackupPolicyPlan : Create a plan for a backup policy +// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is +// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the +// new backup policy plan. +// +// Backups created by this plan will use the resource group of the source being backed up. +// +// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character +// suffix. +func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) +} + +// CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createBackupPolicyPlanOptions.CronSpec != nil { + body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec + } + if createBackupPolicyPlanOptions.Active != nil { + body["active"] = createBackupPolicyPlanOptions.Active + } + if createBackupPolicyPlanOptions.AttachUserTags != nil { + body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags + } + if createBackupPolicyPlanOptions.ClonePolicy != nil { + body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy + } + if createBackupPolicyPlanOptions.CopyUserTags != nil { + body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags + } + if createBackupPolicyPlanOptions.DeletionTrigger != nil { + body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger + } + if createBackupPolicyPlanOptions.Name != nil { + body["name"] = createBackupPolicyPlanOptions.Name + } + if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil { + body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBackupPolicyPlan : Delete a backup policy plan +// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by +// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with +// the plan will run to completion before the plan is deleted. +// +// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing +// completes, the backup policy plan will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) +} + +// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, + "id": *deleteBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBackupPolicyPlan : Retrieve a backup policy plan +// This request retrieves a single backup policy plan specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) +} + +// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, + "id": *getBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBackupPolicyPlan : Update a backup policy plan +// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is +// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) +} + +// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, + "id": *updateBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBackupPolicy : Delete a backup policy +// This request deletes a backup policy. This operation cannot be reversed. +// +// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, +// the backup policy will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + return vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) +} + +// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteBackupPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBackupPolicy : Retrieve a backup policy +// This request retrieves a single backup policy specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) +} + +// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getBackupPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBackupPolicy : Update a backup policy +// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch +// object is structured in the same way as a retrieved backup policy and contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) +} + +// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateBackupPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListPlacementGroups : List all placement groups +// This request lists all placement groups in the region. +func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) +} + +// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter +func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listPlacementGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listPlacementGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) + } + if listPlacementGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreatePlacementGroup : Create a placement group +// This request creates a new placement group. +func (vpc *VpcV1) CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + return vpc.CreatePlacementGroupWithContext(context.Background(), createPlacementGroupOptions) +} + +// CreatePlacementGroupWithContext is an alternate form of the CreatePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPlacementGroupOptions, "createPlacementGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createPlacementGroupOptions, "createPlacementGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createPlacementGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePlacementGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createPlacementGroupOptions.Strategy != nil { + body["strategy"] = createPlacementGroupOptions.Strategy + } + if createPlacementGroupOptions.Name != nil { + body["name"] = createPlacementGroupOptions.Name + } + if createPlacementGroupOptions.ResourceGroup != nil { + body["resource_group"] = createPlacementGroupOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeletePlacementGroup : Delete a placement group +// This request deletes a placement group. This operation cannot be reversed. For this request to succeed, the placement +// group must not be associated with an instance. +func (vpc *VpcV1) DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeletePlacementGroupWithContext(context.Background(), deletePlacementGroupOptions) +} + +// DeletePlacementGroupWithContext is an alternate form of the DeletePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePlacementGroupOptions, "deletePlacementGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deletePlacementGroupOptions, "deletePlacementGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deletePlacementGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deletePlacementGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePlacementGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetPlacementGroup : Retrieve a placement group +// This request retrieves a single placement group specified by identifier in the URL. +func (vpc *VpcV1) GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + return vpc.GetPlacementGroupWithContext(context.Background(), getPlacementGroupOptions) +} + +// GetPlacementGroupWithContext is an alternate form of the GetPlacementGroup method which supports a Context parameter +func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPlacementGroupOptions, "getPlacementGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getPlacementGroupOptions, "getPlacementGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getPlacementGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getPlacementGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPlacementGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdatePlacementGroup : Update a placement group +// This request updates a placement group with the information provided placement group patch. The placement group patch +// object is structured in the same way as a retrieved placement group and contains only the information to be updated. +func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + return vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) +} + +// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updatePlacementGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updatePlacementGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updatePlacementGroupOptions.PlacementGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerProfiles : List all bare metal server profiles +// This request lists all [bare metal server +// profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) available in the region. A bare metal +// server profile specifies the performance characteristics and pricing model for a bare metal server. +func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) +} + +// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) + } + if listBareMetalServerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerProfile : Retrieve a bare metal server profile +// This request retrieves a single bare metal server profile specified by the name in the URL. +func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) +} + +// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getBareMetalServerProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServers : List all bare metal servers +// This request lists all bare metal servers in the region. +func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) +} + +// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) + } + if listBareMetalServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) + } + if listBareMetalServersOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) + } + if listBareMetalServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) + } + if listBareMetalServersOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) + } + if listBareMetalServersOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) + } + if listBareMetalServersOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) + } + if listBareMetalServersOptions.NetworkInterfacesSubnetID != nil { + builder.AddQuery("network_interfaces.subnet.id", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetID)) + } + if listBareMetalServersOptions.NetworkAttachmentsSubnetID != nil { + builder.AddQuery("network_attachments[].subnet.id", fmt.Sprint(*listBareMetalServersOptions.NetworkAttachmentsSubnetID)) + } + if listBareMetalServersOptions.NetworkInterfacesSubnetCRN != nil { + builder.AddQuery("network_interfaces.subnet.crn", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetCRN)) + } + if listBareMetalServersOptions.NetworkAttachmentsSubnetCRN != nil { + builder.AddQuery("network_attachments[].subnet.crn", fmt.Sprint(*listBareMetalServersOptions.NetworkAttachmentsSubnetCRN)) + } + if listBareMetalServersOptions.NetworkInterfacesSubnetName != nil { + builder.AddQuery("network_interfaces.subnet.name", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetName)) + } + if listBareMetalServersOptions.NetworkAttachmentsSubnetName != nil { + builder.AddQuery("network_attachments[].subnet.name", fmt.Sprint(*listBareMetalServersOptions.NetworkAttachmentsSubnetName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBareMetalServer : Create a bare metal server +// This request provisions a new bare metal server from a prototype object. The prototype object is structured in the +// same way as a retrieved bare metal server, and contains the information necessary to provision the new bare metal +// server. The bare metal server is automatically started. +func (vpc *VpcV1) CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerWithContext(context.Background(), createBareMetalServerOptions) +} + +// CreateBareMetalServerWithContext is an alternate form of the CreateBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerOptions, "createBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBareMetalServerOptions, "createBareMetalServerOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createBareMetalServerOptions.BareMetalServerPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBareMetalServerConsoleAccessToken : Create a console access token for a bare metal server +// This request creates a new single-use console access token for a bare metal server. All console configuration is +// provided at token create time, and the token is subsequently used in the `access_token` query parameter for the +// WebSocket request. The access token is only valid for a short period of time, and a maximum of one token is valid +// for a given bare metal server at a time. +func (vpc *VpcV1) CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerConsoleAccessTokenWithContext(context.Background(), createBareMetalServerConsoleAccessTokenOptions) +} + +// CreateBareMetalServerConsoleAccessTokenWithContext is an alternate form of the CreateBareMetalServerConsoleAccessToken method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context.Context, createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *createBareMetalServerConsoleAccessTokenOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/console_access_token`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createBareMetalServerConsoleAccessTokenOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerConsoleAccessToken") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createBareMetalServerConsoleAccessTokenOptions.ConsoleType != nil { + body["console_type"] = createBareMetalServerConsoleAccessTokenOptions.ConsoleType + } + if createBareMetalServerConsoleAccessTokenOptions.Force != nil { + body["force"] = createBareMetalServerConsoleAccessTokenOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerConsoleAccessToken) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerDisks : List all disks on a bare metal server +// This request lists all disks on a bare metal server. A disk is a block device that is locally attached to the +// physical server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk +// first. +func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) +} + +// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerDisk : Retrieve a bare metal server disk +// This request retrieves a single disk specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) +} + +// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, + "id": *getBareMetalServerDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBareMetalServerDisk : Update a bare metal server disk +// This request updates the bare metal server disk with the information in a provided patch. +func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) +} + +// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, + "id": *updateBareMetalServerDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server +// This request lists all network attachments on a bare metal server. A network attachment represents a device on the +// bare metal server to which a virtual network interface is attached. Network attachments can be `pci` or `vlan` +// devices for `amd64` based systems, or +// `hipersocket` devices for `s390x` based systems. +// +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) +} + +// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServerNetworkAttachmentsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) + } + if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server +// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and +// contains the information necessary to create the new bare metal server network attachment. +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) +} + +// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment +// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network attachment are implicitly disassociated. +// +// The bare metal server's primary network attachment cannot be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) +} + +// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment +// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) +} + +// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment +// This request updates a bare metal server network attachment with the information provided in a bare metal server +// network attachment patch object. The bare metal server network attachment patch object is structured in the same way +// as a retrieved bare metal server network attachment and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) +} + +// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server +// This request lists all network interfaces on a bare metal server. A network interface is an abstract representation +// of a network interface card and connects a bare metal server to a subnet. While each network interface can attach to +// only one subnet, multiple network interfaces can be created to attach to multiple subnets. Multiple interfaces may +// also attach to the same subnet. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) +} + +// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaces") + err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServerNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) + } + if listBareMetalServerNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server +// This request creates a new network interface from a network interface prototype object. The prototype object is +// structured in the same way as a retrieved network interface, and contains the information necessary to create the new +// network interface. Any subnet in the bare metal server's VPC may be specified, even if it is already attached to +// another network interface. Addresses on the network interface must be within the specified subnet's CIDR blocks. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) +} + +// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: CreateBareMetalServerNetworkInterface") + err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBareMetalServerNetworkInterface : Delete a network interface +// This request deletes a network interface. This operation cannot be reversed. Any floating IPs associated with the +// network interface are implicitly disassociated. The primary network interface is not allowed to be deleted. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) +} + +// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: DeleteBareMetalServerNetworkInterface") + err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetBareMetalServerNetworkInterface : Retrieve a network interface +// This request retrieves a single network interface specified by the identifier in the URL. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) +} + +// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterface") + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBareMetalServerNetworkInterface : Update a network interface +// This request updates a network interface with the information provided in a network interface patch object. The +// network interface patch object is structured in the same way as a retrieved network interface and needs to contain +// only the information to be updated. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) +} + +// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: UpdateBareMetalServerNetworkInterface") + err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a network interface +// This request lists all floating IPs associated with a network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) +} + +// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaceFloatingIps") + err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a network interface +// This request disassociates the specified floating IP from the specified network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) +} + +// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: RemoveBareMetalServerNetworkInterfaceFloatingIP") + err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP if it is associated with the network interface and bare metal server +// specified in the URL. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) +} + +// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceFloatingIP") + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a network interface +// This request associates the specified floating IP with the specified network interface. If +// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` +// is `true`, this replaces any existing association. For this request to succeed, the existing floating IP must not be +// required by another resource, such as a public gateway. A request body is not required, and if provided, is ignored. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) +} + +// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: AddBareMetalServerNetworkInterfaceFloatingIP") + err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerNetworkInterfaceIps : List all reserved IPs bound to a network interface +// This request lists all reserved IPs bound to a network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) +} + +// ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaceIps") + err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceIpsOptions.NetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerNetworkInterfaceIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerNetworkInterfaceIP : Retrieve bound reserved IP +// This request retrieves the specified reserved IP address if it is bound to the network interface and bare metal +// server specified in the URL. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) +} + +// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBareMetalServer : Delete a bare metal server +// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the +// bare metal server's network interfaces are implicitly disassociated. +func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) +} + +// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetBareMetalServer : Retrieve a bare metal server +// This request retrieves a single bare metal server specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) +} + +// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBareMetalServer : Update a bare metal server +// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object +// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) +} + +// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerOptions.BareMetalServerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server +// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and +// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be +// current. +func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) +} + +// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getBareMetalServerInitializationOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RestartBareMetalServer : Restart a bare metal server +// This request restarts a bare metal server. It will run immediately regardless of the state of the server. +func (vpc *VpcV1) RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.RestartBareMetalServerWithContext(context.Background(), restartBareMetalServerOptions) +} + +// RestartBareMetalServerWithContext is an alternate form of the RestartBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(restartBareMetalServerOptions, "restartBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(restartBareMetalServerOptions, "restartBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *restartBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/restart`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range restartBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RestartBareMetalServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// StartBareMetalServer : Start a bare metal server +// This request starts a bare metal server. It will run immediately provided the server is stopped. +func (vpc *VpcV1) StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.StartBareMetalServerWithContext(context.Background(), startBareMetalServerOptions) +} + +// StartBareMetalServerWithContext is an alternate form of the StartBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(startBareMetalServerOptions, "startBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(startBareMetalServerOptions, "startBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *startBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/start`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range startBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StartBareMetalServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// StopBareMetalServer : Stop a bare metal server +// This request stops a bare metal server. It will run immediately provided the server is running. Note: A soft stop may +// not complete as it relies on the operating system to perform the operation. +func (vpc *VpcV1) StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.StopBareMetalServerWithContext(context.Background(), stopBareMetalServerOptions) +} + +// StopBareMetalServerWithContext is an alternate form of the StopBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(stopBareMetalServerOptions, "stopBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(stopBareMetalServerOptions, "stopBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *stopBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/stop`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range stopBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StopBareMetalServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if stopBareMetalServerOptions.Type != nil { + body["type"] = stopBareMetalServerOptions.Type + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListVolumeProfiles : List all volume profiles +// This request lists all [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available +// in the region. A volume profile specifies the performance characteristics and pricing model for a volume. +func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) +} + +// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter +func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVolumeProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVolumeProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) + } + if listVolumeProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVolumeProfile : Retrieve a volume profile +// This request retrieves a single volume profile specified by the name in the URL. +func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + return vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) +} + +// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter +func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getVolumeProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVolumeProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVolumes : List all volumes +// This request lists all volumes in the region. Volumes are network-connected block storage devices that may be +// attached to one or more instances in the same region. +func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + return vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) +} + +// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter +func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVolumesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVolumesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) + } + if listVolumesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) + } + if listVolumesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) + } + if listVolumesOptions.AttachmentState != nil { + builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) + } + if listVolumesOptions.Encryption != nil { + builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) + } + if listVolumesOptions.OperatingSystemFamily != nil { + builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) + } + if listVolumesOptions.OperatingSystemArchitecture != nil { + builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) + } + if listVolumesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVolume : Create a volume +// This request creates a new volume from a volume prototype object. The prototype object is structured in the same way +// as a retrieved volume, and contains the information necessary to create the new volume. +func (vpc *VpcV1) CreateVolume(createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) +} + +// CreateVolumeWithContext is an alternate form of the CreateVolume method which supports a Context parameter +func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVolumeOptions, "createVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createVolumeOptions.VolumePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVolume : Delete a volume +// This request deletes a volume. This operation cannot be reversed. For this request to succeed, the volume must not be +// attached to any instances. +func (vpc *VpcV1) DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) +} + +// DeleteVolumeWithContext is an alternate form of the DeleteVolume method which supports a Context parameter +func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVolumeOptions, "deleteVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVolumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVolumeOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVolume : Retrieve a volume +// This request retrieves a single volume specified by the identifier in the URL. +func (vpc *VpcV1) GetVolume(getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) +} + +// GetVolumeWithContext is an alternate form of the GetVolume method which supports a Context parameter +func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeOptions, "getVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVolumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVolume : Update a volume +// This request updates a volume with the information in a provided volume patch. The volume patch object is structured +// in the same way as a retrieved volume and contains only the information to be updated. +func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) +} + +// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter +func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVolumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSnapshots : Delete a filtered collection of snapshots +// This request deletes all snapshots created from a specific source volume. +func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) +} + +// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + if err != nil { + return + } + + for headerName, headerValue := range deleteSnapshotsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListSnapshots : List all snapshots +// This request lists all snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is +// created. +func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + return vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) +} + +// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSnapshotsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSnapshotsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) + } + if listSnapshotsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) + } + if listSnapshotsOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) + } + if listSnapshotsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) + } + if listSnapshotsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) + } + if listSnapshotsOptions.SourceVolumeID != nil { + builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) + } + if listSnapshotsOptions.SourceVolumeCRN != nil { + builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) + } + if listSnapshotsOptions.SourceImageID != nil { + builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) + } + if listSnapshotsOptions.SourceImageCRN != nil { + builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) + } + if listSnapshotsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) + } + if listSnapshotsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) + } + 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)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSnapshot : Create a snapshot +// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same +// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. +func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) +} + +// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createSnapshotOptions.SnapshotPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSnapshot : Delete a snapshot +// This request deletes a snapshot. This operation cannot be reversed. +func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) +} + +// DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSnapshot : Retrieve a snapshot +// This request retrieves a single snapshot specified by the identifier in the URL. +func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) +} + +// GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateSnapshot : Update a snapshot +// This request updates a snapshot's name. +func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) +} + +// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSnapshotClones : List all clones for a snapshot +// This request lists all clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. +func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + return vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) +} + +// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *listSnapshotClonesOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listSnapshotClonesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSnapshotClone : Delete a snapshot clone +// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated +// from the snapshot. +func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) +} + +// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSnapshotCloneOptions.ID, + "zone_name": *deleteSnapshotCloneOptions.ZoneName, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSnapshotClone : Retrieve a snapshot clone +// This request retrieves a single clone specified by the snapshot identifier and zone name in the URL. +func (vpc *VpcV1) GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + return vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions) +} + +// GetSnapshotCloneWithContext is an alternate form of the GetSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotCloneOptions, "getSnapshotCloneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSnapshotCloneOptions.ID, + "zone_name": *getSnapshotCloneOptions.ZoneName, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSnapshotCloneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSnapshotClone : Create a clone for a snapshot +// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if +// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. +func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + return vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) +} + +// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *createSnapshotCloneOptions.ID, + "zone_name": *createSnapshotCloneOptions.ZoneName, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createSnapshotCloneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListShareProfiles : List all file share profiles +// This request lists all [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) +// available in the region. A file share profile specifies the performance characteristics and pricing model for a file +// share. +func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) +} + +// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter +func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listShareProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listShareProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) + } + if listShareProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) + } + if listShareProfilesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetShareProfile : Retrieve a file share profile +// This request retrieves a single file share profile specified by the name in the URL. +func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + return vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) +} + +// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter +func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getShareProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getShareProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListShares : List all file shares +// This request lists all file shares in the region. +func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + return vpc.ListSharesWithContext(context.Background(), listSharesOptions) +} + +// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter +func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSharesOptions, "listSharesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSharesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSharesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) + } + if listSharesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) + } + if listSharesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) + } + if listSharesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) + } + if listSharesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) + } + if listSharesOptions.ReplicationRole != nil { + builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateShare : Create a file share +// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, +// a replica share, or both a source and replica share. +// +// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to +// provision the new file shares. +func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.CreateShareWithContext(context.Background(), createShareOptions) +} + +// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter +func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createShareOptions, "createShareOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createShareOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + if err != nil { + return + } + response.Result = result + } + + return +} + +// 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 `status` will be set to `deleting`. Otherwise, once deletion processing +// completes, the share will no longer be retrievable. +func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) +} + +// DeleteShareWithContext is an alternate form of the DeleteShare method which supports a Context parameter +func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareOptions, "deleteShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteShareOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteShareOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + if deleteShareOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteShareOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetShare : Retrieve a file share +// This request retrieves a single file share specified by the identifier in the URL. +func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.GetShareWithContext(context.Background(), getShareOptions) +} + +// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter +func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getShareOptions, "getShareOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getShareOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getShareOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateShare : Update a file share +// This request updates a share with the information in a provided share patch. The share patch object is structured in +// the same way as a retrieved share and contains only the information to be updated. +func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.UpdateShareWithContext(context.Background(), updateShareOptions) +} + +// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter +func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateShareOptions, "updateShareOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateShareOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateShareOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateShareOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + if err != nil { + return + } + response.Result = result + } + + return +} + +// FailoverShare : Failover to replica file share +// This request triggers a failover to the replica file share specified by the identifier in the URL. The failover +// cannot be started if a source share or the replica share has a `lifecycle_state` of `updating`, or has a replication +// operation in progress. +// +// If `fallback_policy` is specified as `split`, and the request is accepted but the failover operation cannot be +// performed, a split will be triggered. +func (vpc *VpcV1) FailoverShare(failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { + return vpc.FailoverShareWithContext(context.Background(), failoverShareOptions) +} + +// FailoverShareWithContext is an alternate form of the FailoverShare method which supports a Context parameter +func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(failoverShareOptions, "failoverShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(failoverShareOptions, "failoverShareOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *failoverShareOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/failover`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range failoverShareOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if failoverShareOptions.FallbackPolicy != nil { + body["fallback_policy"] = failoverShareOptions.FallbackPolicy + } + if failoverShareOptions.Timeout != nil { + body["timeout"] = failoverShareOptions.Timeout + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListShareMountTargets : List all mount targets for a file share +// This request retrieves all share mount targets for a file share. +// +// A share mount target is a network endpoint at which a file share may be mounted. +// +// It exists within the same zone where the file share resides in. +// +// The file share can be mounted by instances in the same VPC and zone after creating share mount targets. +func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + return vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) +} + +// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter +func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *listShareMountTargetsOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listShareMountTargetsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listShareMountTargetsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateShareMountTarget : Create a mount target for a file share +// This request creates a new share mount target from a share mount target prototype object. +// +// The prototype object is structured in the same way as a retrieved share mount target, and contains the information +// necessary to provision the new file share mount target. +func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) +} + +// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *createShareMountTargetOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createShareMountTargetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteShareMountTarget : Delete a share mount target +// This request deletes a share mount target. This operation cannot be reversed. +// +// If the request is accepted, the share mount target `status` will be set to `deleting`. Otherwise, once deletion +// processing completes, the share mount target will no longer be retrievable. +func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) +} + +// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *deleteShareMountTargetOptions.ShareID, + "id": *deleteShareMountTargetOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteShareMountTargetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetShareMountTarget : Retrieve a share mount target +// This request retrieves a single share mount target specified by the identifier in the URL. +func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) +} + +// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *getShareMountTargetOptions.ShareID, + "id": *getShareMountTargetOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getShareMountTargetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateShareMountTarget : Update a share mount target +// This request updates a share mount target with the information provided in a share mount target patch object. The +// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) +} + +// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *updateShareMountTargetOptions.ShareID, + "id": *updateShareMountTargetOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateShareMountTargetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateShareMountTargetOptions.ShareMountTargetPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteShareSource : Split the source file share from a replica share +// This request removes the replication relationship between a source share and the replica share specified by the +// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a +// `lifecycle_state` of `updating`, or has a replication operation in progress. +// +// This operation cannot be reversed. +func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) +} + +// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter +func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *deleteShareSourceOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteShareSourceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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 *Share, response *core.DetailedResponse, err error) { + return vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) +} + +// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter +func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *getShareSourceOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getShareSourceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListRegions : List all regions +// This request lists all regions. Each region is a separate geographic area that contains multiple isolated zones. +// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones +// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation +// available. Resources deployed within a single region also benefit from the low latency afforded by geographic +// proximity. +func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + return vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) +} + +// ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter +func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listRegionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetRegion : Retrieve a region +// This request retrieves a single region specified by the name in the URL. +func (vpc *VpcV1) GetRegion(getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { + return vpc.GetRegionWithContext(context.Background(), getRegionOptions) +} + +// GetRegionWithContext is an alternate form of the GetRegion method which supports a Context parameter +func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getRegionOptions, "getRegionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getRegionOptions, "getRegionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getRegionOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getRegionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegion) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListRegionZones : List all zones in a region +// This request lists all zones in a region. Zones represent logically-isolated data centers with high-bandwidth and +// low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. +func (vpc *VpcV1) ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { + return vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) +} + +// ListRegionZonesWithContext is an alternate form of the ListRegionZones method which supports a Context parameter +func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listRegionZonesOptions, "listRegionZonesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "region_name": *listRegionZonesOptions.RegionName, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listRegionZonesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetRegionZone : Retrieve a zone +// This request retrieves a single zone specified by the region and zone names in the URL. +func (vpc *VpcV1) GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { + return vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) +} + +// GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter +func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "region_name": *getRegionZoneOptions.RegionName, + "name": *getRegionZoneOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getRegionZoneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVirtualNetworkInterfaces : List all virtual network interfaces +// This request lists all virtual network interfaces in the region. A virtual network interface is a logical abstraction +// of a network interface in a subnet, and may be attached to a target resource. +// +// The virtual network interfaces will be sorted by their `created_at` property values, with newest virtual network +// interfaces first. Virtual network interfaces with identical +// `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + return vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) +} + +// ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVirtualNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) + } + if listVirtualNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Limit)) + } + if listVirtualNetworkInterfacesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVirtualNetworkInterfacesOptions.ResourceGroupID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVirtualNetworkInterface : Create a virtual network interface +// This request creates a new virtual network interface from a virtual network interface prototype object. The prototype +// object is structured in the same way as a retrieved virtual network interface, and contains the information necessary +// to create the new virtual network interface. +func (vpc *VpcV1) CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + return vpc.CreateVirtualNetworkInterfaceWithContext(context.Background(), createVirtualNetworkInterfaceOptions) +} + +// CreateVirtualNetworkInterfaceWithContext is an alternate form of the CreateVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVirtualNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVirtualNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVirtualNetworkInterfaceOptions.AllowIPSpoofing != nil { + body["allow_ip_spoofing"] = createVirtualNetworkInterfaceOptions.AllowIPSpoofing + } + if createVirtualNetworkInterfaceOptions.AutoDelete != nil { + body["auto_delete"] = createVirtualNetworkInterfaceOptions.AutoDelete + } + if createVirtualNetworkInterfaceOptions.EnableInfrastructureNat != nil { + body["enable_infrastructure_nat"] = createVirtualNetworkInterfaceOptions.EnableInfrastructureNat + } + if createVirtualNetworkInterfaceOptions.Ips != nil { + body["ips"] = createVirtualNetworkInterfaceOptions.Ips + } + if createVirtualNetworkInterfaceOptions.Name != nil { + body["name"] = createVirtualNetworkInterfaceOptions.Name + } + if createVirtualNetworkInterfaceOptions.PrimaryIP != nil { + body["primary_ip"] = createVirtualNetworkInterfaceOptions.PrimaryIP + } + if createVirtualNetworkInterfaceOptions.ResourceGroup != nil { + body["resource_group"] = createVirtualNetworkInterfaceOptions.ResourceGroup + } + if createVirtualNetworkInterfaceOptions.SecurityGroups != nil { + body["security_groups"] = createVirtualNetworkInterfaceOptions.SecurityGroups + } + if createVirtualNetworkInterfaceOptions.Subnet != nil { + body["subnet"] = createVirtualNetworkInterfaceOptions.Subnet + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVirtualNetworkInterfaces : Delete a virtual network interface +// This request deletes a virtual network interface. This operation cannot be reversed. For this request to succeed, the +// virtual network interface must not be required by another resource, such as a primary network attachment. +func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) +} + +// DeleteVirtualNetworkInterfacesWithContext is an alternate form of the DeleteVirtualNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVirtualNetworkInterfacesOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVirtualNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVirtualNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVirtualNetworkInterface : Retrieve a virtual network interface +// This request retrieves a single virtual network interface specified by the identifier in the URL. +func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + return vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions) +} + +// GetVirtualNetworkInterfaceWithContext is an alternate form of the GetVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVirtualNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVirtualNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVirtualNetworkInterface : Update a virtual network interface +// This request updates a virtual network interface with the information in a provided virtual network interface patch. +// The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and +// contains only the information to be updated. +func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + return vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) +} + +// UpdateVirtualNetworkInterfaceWithContext is an alternate form of the UpdateVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVirtualNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVirtualNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListNetworkInterfaceFloatingIps : List all floating IPs associated with a virtual network interface +// This request lists all floating IPs associated with a virtual network interface. +func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) +} + +// ListNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *listNetworkInterfaceFloatingIpsOptions.VirtualNetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listNetworkInterfaceFloatingIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) + } + if listNetworkInterfaceFloatingIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Limit)) + } + if listNetworkInterfaceFloatingIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface +// This request disassociates the specified floating IP from the specified virtual network interface. +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) +} + +// RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *removeNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *removeNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP if it is associated with the virtual network interface specified in +// the URL. +func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + return vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) +} + +// GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *getNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddNetworkInterfaceFloatingIP : Associate a floating IP with a virtual network interface +// This request associates the specified floating IP with the specified virtual network interface. The specified +// floating IP must not be required by another resource, such as a public gateway. A request body is not required, and +// if provided, is ignored. +// +// If `enable_infrastructure_nat` is `true`, this replaces any existing association. +// +// If `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. +func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + return vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) +} + +// AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *addNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVirtualNetworkInterfaceIps : List all reserved IPs bound to a virtual network interface +// This request lists all reserved IPs bound to a virtual network interface. +func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) +} + +// ListVirtualNetworkInterfaceIpsWithContext is an alternate form of the ListVirtualNetworkInterfaceIps method which supports a Context parameter +func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *listVirtualNetworkInterfaceIpsOptions.VirtualNetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVirtualNetworkInterfaceIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaceIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVirtualNetworkInterfaceIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start)) + } + if listVirtualNetworkInterfaceIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Limit)) + } + if listVirtualNetworkInterfaceIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveVirtualNetworkInterfaceIP : Unbind a reserved IP from a virtual network interface +// This request unbinds the specified reserved IP from the specified virtual network interface. If the reserved IP has +// `auto_delete` set to `true`, the reserved IP will be deleted. +// +// The reserved IP for the `primary_ip` cannot be unbound. +func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveVirtualNetworkInterfaceIPWithContext(context.Background(), removeVirtualNetworkInterfaceIPOptions) +} + +// RemoveVirtualNetworkInterfaceIPWithContext is an alternate form of the RemoveVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context, removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *removeVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *removeVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeVirtualNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVirtualNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP +// This request retrieves the specified reserved IP address if it is bound to the network interface specified in the +// URL. +func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + return vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) +} + +// GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *getVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *getVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddVirtualNetworkInterfaceIP : Bind a reserved IP to a virtual network interface +// This request binds the specified reserved IP to the specified virtual network interface. The reserved IP must +// currently be unbound and in the same subnet as the `primary_ip`. +func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + return vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) +} + +// AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *addVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListPublicGateways : List all public gateways +// This request lists all public gateways in the region. A public gateway is a virtual network device associated with a +// VPC, which allows access to the Internet. A public gateway resides in a zone and can be connected to subnets in the +// same zone only. +func (vpc *VpcV1) ListPublicGateways(listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { + return vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) +} + +// ListPublicGatewaysWithContext is an alternate form of the ListPublicGateways method which supports a Context parameter +func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPublicGatewaysOptions, "listPublicGatewaysOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listPublicGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listPublicGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) + } + if listPublicGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) + } + if listPublicGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreatePublicGateway : Create a public gateway +// This request creates a new public gateway from a public gateway prototype object. For this to succeed, the VPC must +// not already have a public gateway in the specified zone. +// +// If a floating IP is provided, it must be unbound. If a floating IP is not provided, one will be created and bound to +// the public gateway. Once a public gateway has been created, its floating IP cannot be unbound. A public gateway must +// be explicitly attached to each subnet it will provide connectivity for. +func (vpc *VpcV1) CreatePublicGateway(createPublicGatewayOptions *CreatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions) +} + +// CreatePublicGatewayWithContext is an alternate form of the CreatePublicGateway method which supports a Context parameter +func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPublicGatewayOptions *CreatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPublicGatewayOptions, "createPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createPublicGatewayOptions.VPC != nil { + body["vpc"] = createPublicGatewayOptions.VPC + } + if createPublicGatewayOptions.Zone != nil { + body["zone"] = createPublicGatewayOptions.Zone + } + if createPublicGatewayOptions.FloatingIP != nil { + body["floating_ip"] = createPublicGatewayOptions.FloatingIP + } + if createPublicGatewayOptions.Name != nil { + body["name"] = createPublicGatewayOptions.Name + } + if createPublicGatewayOptions.ResourceGroup != nil { + body["resource_group"] = createPublicGatewayOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeletePublicGateway : Delete a public gateway +// This request deletes a public gateway. This operation cannot be reversed. For this request to succeed, the public +// gateway must not be attached to any subnets. The public gateway's floating IP will be automatically unbound. If the +// floating IP was created when the public gateway was created, it will be deleted. +func (vpc *VpcV1) DeletePublicGateway(deletePublicGatewayOptions *DeletePublicGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions) +} + +// DeletePublicGatewayWithContext is an alternate form of the DeletePublicGateway method which supports a Context parameter +func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePublicGatewayOptions *DeletePublicGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePublicGatewayOptions, "deletePublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deletePublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deletePublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetPublicGateway : Retrieve a public gateway +// This request retrieves a single public gateway specified by the identifier in the URL. +func (vpc *VpcV1) GetPublicGateway(getPublicGatewayOptions *GetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions) +} + +// GetPublicGatewayWithContext is an alternate form of the GetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGatewayOptions *GetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPublicGatewayOptions, "getPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdatePublicGateway : Update a public gateway +// This request updates a public gateway's name. +func (vpc *VpcV1) UpdatePublicGateway(updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) +} + +// UpdatePublicGatewayWithContext is an alternate form of the UpdatePublicGateway method which supports a Context parameter +func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePublicGatewayOptions, "updatePublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updatePublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updatePublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListFloatingIps : List all floating IPs +// This request lists all floating IPs in the region. Floating IPs allow inbound and outbound traffic from the Internet +// to an instance. +func (vpc *VpcV1) ListFloatingIps(listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { + return vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) +} + +// ListFloatingIpsWithContext is an alternate form of the ListFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listFloatingIpsOptions, "listFloatingIpsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listFloatingIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listFloatingIpsOptions.Start)) + } + if listFloatingIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listFloatingIpsOptions.Limit)) + } + if listFloatingIpsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listFloatingIpsOptions.ResourceGroupID)) + } + if listFloatingIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listFloatingIpsOptions.Sort)) + } + if listFloatingIpsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listFloatingIpsOptions.TargetID)) + } + if listFloatingIpsOptions.TargetCRN != nil { + builder.AddQuery("target.crn", fmt.Sprint(*listFloatingIpsOptions.TargetCRN)) + } + if listFloatingIpsOptions.TargetName != nil { + builder.AddQuery("target.name", fmt.Sprint(*listFloatingIpsOptions.TargetName)) + } + if listFloatingIpsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listFloatingIpsOptions.TargetResourceType)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateFloatingIP : Reserve a floating IP +// This request reserves a new floating IP. +func (vpc *VpcV1) CreateFloatingIP(createFloatingIPOptions *CreateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions) +} + +// CreateFloatingIPWithContext is an alternate form of the CreateFloatingIP method which supports a Context parameter +func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatingIPOptions *CreateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createFloatingIPOptions, "createFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createFloatingIPOptions.FloatingIPPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteFloatingIP : Delete a floating IP +// This request disassociates (if associated) and releases a floating IP. This operation cannot be reversed. For this +// request to succeed, the floating IP must not be required by another resource, such as a public gateway. +func (vpc *VpcV1) DeleteFloatingIP(deleteFloatingIPOptions *DeleteFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions) +} + +// DeleteFloatingIPWithContext is an alternate form of the DeleteFloatingIP method which supports a Context parameter +func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatingIPOptions *DeleteFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteFloatingIPOptions, "deleteFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetFloatingIP : Retrieve a floating IP +// This request retrieves a single floating IP specified by the identifier in the URL. +func (vpc *VpcV1) GetFloatingIP(getFloatingIPOptions *GetFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions) +} + +// GetFloatingIPWithContext is an alternate form of the GetFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOptions *GetFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getFloatingIPOptions, "getFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateFloatingIP : Update a floating IP +// This request updates a floating IP's name and/or target. +func (vpc *VpcV1) UpdateFloatingIP(updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) +} + +// UpdateFloatingIPWithContext is an alternate form of the UpdateFloatingIP method which supports a Context parameter +func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateFloatingIPOptions, "updateFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateFloatingIPOptions.FloatingIPPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListNetworkAcls : List all network ACLs +// This request lists all network ACLs in the region. A network ACL defines a set of packet filtering (5-tuple) rules +// for all traffic in and out of a subnet. Both allow and deny rules can be defined, and rules are stateless such that +// reverse traffic in response to allowed traffic is not automatically permitted. +func (vpc *VpcV1) ListNetworkAcls(listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { + return vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) +} + +// ListNetworkAclsWithContext is an alternate form of the ListNetworkAcls method which supports a Context parameter +func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listNetworkAclsOptions, "listNetworkAclsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listNetworkAclsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listNetworkAclsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) + } + if listNetworkAclsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkAclsOptions.Limit)) + } + if listNetworkAclsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listNetworkAclsOptions.ResourceGroupID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateNetworkACL : Create a network ACL +// This request creates a new stateless network ACL from a network ACL prototype object. The prototype object is +// structured in the same way as a retrieved network ACL, and contains the information necessary to create the new +// network ACL. +func (vpc *VpcV1) CreateNetworkACL(createNetworkACLOptions *CreateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions) +} + +// CreateNetworkACLWithContext is an alternate form of the CreateNetworkACL method which supports a Context parameter +func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetworkACLOptions *CreateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createNetworkACLOptions, "createNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createNetworkACLOptions.NetworkACLPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteNetworkACL : Delete a network ACL +// This request deletes a network ACL. This operation cannot be reversed. For this request to succeed, the network ACL +// must not be the default network ACL for any VPCs, and the network ACL must not be attached to any subnets. +func (vpc *VpcV1) DeleteNetworkACL(deleteNetworkACLOptions *DeleteNetworkACLOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions) +} + +// DeleteNetworkACLWithContext is an alternate form of the DeleteNetworkACL method which supports a Context parameter +func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetworkACLOptions *DeleteNetworkACLOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteNetworkACLOptions, "deleteNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteNetworkACLOptions, "deleteNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetNetworkACL : Retrieve a network ACL +// This request retrieves a single network ACL specified by the identifier in the URL. +func (vpc *VpcV1) GetNetworkACL(getNetworkACLOptions *GetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions) +} + +// GetNetworkACLWithContext is an alternate form of the GetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOptions *GetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkACLOptions, "getNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateNetworkACL : Update a network ACL +// This request updates a network ACL's name. +func (vpc *VpcV1) UpdateNetworkACL(updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) +} + +// UpdateNetworkACLWithContext is an alternate form of the UpdateNetworkACL method which supports a Context parameter +func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateNetworkACLOptions, "updateNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListNetworkACLRules : List all rules for a network ACL +// This request lists all rules for a network ACL. These rules can allow or deny traffic between a source CIDR block and +// a destination CIDR block over a particular protocol and port range. +func (vpc *VpcV1) ListNetworkACLRules(listNetworkACLRulesOptions *ListNetworkACLRulesOptions) (result *NetworkACLRuleCollection, response *core.DetailedResponse, err error) { + return vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions) +} + +// ListNetworkACLRulesWithContext is an alternate form of the ListNetworkACLRules method which supports a Context parameter +func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetworkACLRulesOptions *ListNetworkACLRulesOptions) (result *NetworkACLRuleCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listNetworkACLRulesOptions, "listNetworkACLRulesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *listNetworkACLRulesOptions.NetworkACLID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listNetworkACLRulesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listNetworkACLRulesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkACLRulesOptions.Start)) + } + if listNetworkACLRulesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkACLRulesOptions.Limit)) + } + if listNetworkACLRulesOptions.Direction != nil { + builder.AddQuery("direction", fmt.Sprint(*listNetworkACLRulesOptions.Direction)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRuleCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateNetworkACLRule : Create a rule for a network ACL +// This request creates a new rule from a network ACL rule prototype object. The prototype object is structured in the +// same way as a retrieved rule, and contains the information necessary to create the new rule. +func (vpc *VpcV1) CreateNetworkACLRule(createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + return vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) +} + +// CreateNetworkACLRuleWithContext is an alternate form of the CreateNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createNetworkACLRuleOptions, "createNetworkACLRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteNetworkACLRule : Delete a network ACL rule +// This request deletes a rule. This operation cannot be reversed. +func (vpc *VpcV1) DeleteNetworkACLRule(deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) +} + +// DeleteNetworkACLRuleWithContext is an alternate form of the DeleteNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *deleteNetworkACLRuleOptions.NetworkACLID, + "id": *deleteNetworkACLRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetNetworkACLRule : Retrieve a network ACL rule +// This request retrieves a single rule specified by the identifier in the URL. +func (vpc *VpcV1) GetNetworkACLRule(getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + return vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) +} + +// GetNetworkACLRuleWithContext is an alternate form of the GetNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkACLRuleOptions, "getNetworkACLRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *getNetworkACLRuleOptions.NetworkACLID, + "id": *getNetworkACLRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateNetworkACLRule : Update a network ACL rule +// This request updates a rule with the information in a provided rule patch. The rule patch object contains only the +// information to be updated. The request will fail if the information is not applicable to the rule's protocol. +func (vpc *VpcV1) UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions) +} + +// UpdateNetworkACLRuleWithContext is an alternate form of the UpdateNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *updateNetworkACLRuleOptions.NetworkACLID, + "id": *updateNetworkACLRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACLRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSecurityGroups : List all security groups +// This request lists all security groups in the region. Security groups provide a way to apply IP filtering rules to +// instances in the associated VPC. With security groups, all traffic is denied by default, and rules added to security +// groups define which traffic the security group permits. Security group rules are stateful such that reverse traffic +// in response to allowed traffic is automatically permitted. +func (vpc *VpcV1) ListSecurityGroups(listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) +} + +// ListSecurityGroupsWithContext is an alternate form of the ListSecurityGroups method which supports a Context parameter +func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSecurityGroupsOptions, "listSecurityGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSecurityGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSecurityGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupsOptions.Start)) + } + if listSecurityGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupsOptions.Limit)) + } + if listSecurityGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSecurityGroupsOptions.ResourceGroupID)) + } + if listSecurityGroupsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listSecurityGroupsOptions.VPCID)) + } + if listSecurityGroupsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listSecurityGroupsOptions.VPCCRN)) + } + if listSecurityGroupsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listSecurityGroupsOptions.VPCName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSecurityGroup : Create a security group +// This request creates a new security group from a security group prototype object. The prototype object is structured +// in the same way as a retrieved security group, and contains the information necessary to create the new security +// group. If security group rules are included in the prototype object, those rules will be added to the security group. +// Each security group is scoped to one VPC. Only network interfaces on instances in that VPC can be added to the +// security group. +func (vpc *VpcV1) CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + return vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) +} + +// CreateSecurityGroupWithContext is an alternate form of the CreateSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSecurityGroupOptions, "createSecurityGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createSecurityGroupOptions.VPC != nil { + body["vpc"] = createSecurityGroupOptions.VPC + } + if createSecurityGroupOptions.Name != nil { + body["name"] = createSecurityGroupOptions.Name + } + if createSecurityGroupOptions.ResourceGroup != nil { + body["resource_group"] = createSecurityGroupOptions.ResourceGroup + } + if createSecurityGroupOptions.Rules != nil { + body["rules"] = createSecurityGroupOptions.Rules + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSecurityGroup : Delete a security group +// This request deletes a security group. A security group cannot be deleted if it is referenced by any security group +// targets or rules. Additionally, a VPC's default security group cannot be deleted. This operation cannot be reversed. +func (vpc *VpcV1) DeleteSecurityGroup(deleteSecurityGroupOptions *DeleteSecurityGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) +} + +// DeleteSecurityGroupWithContext is an alternate form of the DeleteSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecurityGroupOptions *DeleteSecurityGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSecurityGroupOptions, "deleteSecurityGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSecurityGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSecurityGroup : Retrieve a security group +// This request retrieves a single security group specified by the identifier in the URL path. +func (vpc *VpcV1) GetSecurityGroup(getSecurityGroupOptions *GetSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + return vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) +} + +// GetSecurityGroupWithContext is an alternate form of the GetSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGroupOptions *GetSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSecurityGroupOptions, "getSecurityGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSecurityGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateSecurityGroup : Update a security group +// This request updates a security group with the information provided in a security group patch object. The security +// group patch object is structured in the same way as a retrieved security group and contains only the information to +// be updated. +func (vpc *VpcV1) UpdateSecurityGroup(updateSecurityGroupOptions *UpdateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) +} + +// UpdateSecurityGroupWithContext is an alternate form of the UpdateSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecurityGroupOptions *UpdateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSecurityGroupOptions, "updateSecurityGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateSecurityGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSecurityGroupOptions.SecurityGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSecurityGroupRules : List all rules in a security group +// This request lists all rules in a security group. These rules define what traffic the security group permits. +// Security group rules are stateful, such that reverse traffic in response to allowed traffic is automatically +// permitted. +func (vpc *VpcV1) ListSecurityGroupRules(listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) (result *SecurityGroupRuleCollection, response *core.DetailedResponse, err error) { + return vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) +} + +// ListSecurityGroupRulesWithContext is an alternate form of the ListSecurityGroupRules method which supports a Context parameter +func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) (result *SecurityGroupRuleCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *listSecurityGroupRulesOptions.SecurityGroupID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSecurityGroupRule : Create a rule for a security group +// This request creates a new security group rule from a security group rule prototype object. The prototype object is +// structured in the same way as a retrieved security group rule and contains the information necessary to create the +// rule. As part of creating a new rule in a security group, the rule is applied to all the networking interfaces in the +// security group. Rules specify which IP traffic a security group will allow. Security group rules are stateful, such +// that reverse traffic in response to allowed traffic is automatically permitted. A rule allowing inbound TCP traffic +// on port 80 also allows outbound TCP traffic on port 80 without the need for an additional rule. +func (vpc *VpcV1) CreateSecurityGroupRule(createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + return vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) +} + +// CreateSecurityGroupRuleWithContext is an alternate form of the CreateSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *createSecurityGroupRuleOptions.SecurityGroupID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSecurityGroupRule : Delete a security group rule +// This request deletes a security group rule. This operation cannot be reversed. Removing a security group rule will +// not end existing connections allowed by that rule. +func (vpc *VpcV1) DeleteSecurityGroupRule(deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) +} + +// DeleteSecurityGroupRuleWithContext is an alternate form of the DeleteSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *deleteSecurityGroupRuleOptions.SecurityGroupID, + "id": *deleteSecurityGroupRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSecurityGroupRule : Retrieve a security group rule +// This request retrieves a single security group rule specified by the identifier in the URL path. +func (vpc *VpcV1) GetSecurityGroupRule(getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + return vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions) +} + +// GetSecurityGroupRuleWithContext is an alternate form of the GetSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *getSecurityGroupRuleOptions.SecurityGroupID, + "id": *getSecurityGroupRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateSecurityGroupRule : Update a security group rule +// This request updates a security group rule with the information in a provided rule patch object. The rule patch +// object contains only the information to be updated. The request will fail if the information is not applicable to the +// rule's protocol. +func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) +} + +// UpdateSecurityGroupRuleWithContext is an alternate form of the UpdateSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *updateSecurityGroupRuleOptions.SecurityGroupID, + "id": *updateSecurityGroupRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSecurityGroupTargets : List all targets associated with a security group +// This request lists all targets associated with a security group, to which the rules in the security group are +// applied. +func (vpc *VpcV1) ListSecurityGroupTargets(listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) (result *SecurityGroupTargetCollection, response *core.DetailedResponse, err error) { + return vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) +} + +// ListSecurityGroupTargetsWithContext is an alternate form of the ListSecurityGroupTargets method which supports a Context parameter +func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) (result *SecurityGroupTargetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *listSecurityGroupTargetsOptions.SecurityGroupID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSecurityGroupTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) + } + if listSecurityGroupTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSecurityGroupTargetBinding : Remove a target from a security group +// This request removes a target from a security group. For this request to succeed, the target must be attached to at +// least one other security group. The specified target identifier can be: +// +// - A bare metal server network interface identifier +// - A virtual network interface identifier +// - A VPN server identifier +// - An application load balancer identifier +// - An endpoint gateway identifier +// - An instance network interface identifier +// +// Security groups are stateful, so any changes to a target's security groups are applied to new connections. Existing +// connections are not affected. +func (vpc *VpcV1) DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) +} + +// DeleteSecurityGroupTargetBindingWithContext is an alternate form of the DeleteSecurityGroupTargetBinding method which supports a Context parameter +func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Context, deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *deleteSecurityGroupTargetBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSecurityGroupTarget : Retrieve a security group target +// This request retrieves a single target specified by the identifier in the URL path. The target must be an existing +// target of the security group. +func (vpc *VpcV1) GetSecurityGroupTarget(getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + return vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) +} + +// GetSecurityGroupTargetWithContext is an alternate form of the GetSecurityGroupTarget method which supports a Context parameter +func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *getSecurityGroupTargetOptions.SecurityGroupID, + "id": *getSecurityGroupTargetOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSecurityGroupTargetBinding : Add a target to a security group +// This request adds a resource to an existing security group. The specified target identifier can be: +// +// - A bare metal server network interface identifier +// - A virtual network interface identifier +// - A VPN server identifier +// - An application load balancer identifier +// - An endpoint gateway identifier +// - An instance network interface identifier +// +// When a target is added to a security group, the security group rules are applied to the target. A request body is not +// required, and if provided, is ignored. +func (vpc *VpcV1) CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + return vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions) +} + +// CreateSecurityGroupTargetBindingWithContext is an alternate form of the CreateSecurityGroupTargetBinding method which supports a Context parameter +func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Context, createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *createSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *createSecurityGroupTargetBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListIkePolicies : List all IKE policies +// This request lists all IKE policies in the region. +func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) +} + +// ListIkePoliciesWithContext is an alternate form of the ListIkePolicies method which supports a Context parameter +func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listIkePoliciesOptions, "listIkePoliciesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listIkePoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listIkePoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listIkePoliciesOptions.Start)) + } + if listIkePoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listIkePoliciesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateIkePolicy : Create an IKE policy +// This request creates a new IKE policy. +func (vpc *VpcV1) CreateIkePolicy(createIkePolicyOptions *CreateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + return vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) +} + +// CreateIkePolicyWithContext is an alternate form of the CreateIkePolicy method which supports a Context parameter +func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolicyOptions *CreateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createIkePolicyOptions, "createIkePolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createIkePolicyOptions.AuthenticationAlgorithm != nil { + body["authentication_algorithm"] = createIkePolicyOptions.AuthenticationAlgorithm + } + if createIkePolicyOptions.DhGroup != nil { + body["dh_group"] = createIkePolicyOptions.DhGroup + } + if createIkePolicyOptions.EncryptionAlgorithm != nil { + body["encryption_algorithm"] = createIkePolicyOptions.EncryptionAlgorithm + } + if createIkePolicyOptions.IkeVersion != nil { + body["ike_version"] = createIkePolicyOptions.IkeVersion + } + if createIkePolicyOptions.KeyLifetime != nil { + body["key_lifetime"] = createIkePolicyOptions.KeyLifetime + } + if createIkePolicyOptions.Name != nil { + body["name"] = createIkePolicyOptions.Name + } + if createIkePolicyOptions.ResourceGroup != nil { + body["resource_group"] = createIkePolicyOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteIkePolicy : Delete an IKE policy +// This request deletes an IKE policy. This operation cannot be reversed. For this request to succeed, there must not be +// any VPN gateway connections using this policy. +func (vpc *VpcV1) DeleteIkePolicy(deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) +} + +// DeleteIkePolicyWithContext is an alternate form of the DeleteIkePolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteIkePolicyOptions, "deleteIkePolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetIkePolicy : Retrieve an IKE policy +// This request retrieves a single IKE policy specified by the identifier in the URL. +func (vpc *VpcV1) GetIkePolicy(getIkePolicyOptions *GetIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + return vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) +} + +// GetIkePolicyWithContext is an alternate form of the GetIkePolicy method which supports a Context parameter +func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptions *GetIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getIkePolicyOptions, "getIkePolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateIkePolicy : Update an IKE policy +// This request updates the properties of an existing IKE policy. +func (vpc *VpcV1) UpdateIkePolicy(updateIkePolicyOptions *UpdateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) +} + +// UpdateIkePolicyWithContext is an alternate form of the UpdateIkePolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolicyOptions *UpdateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateIkePolicyOptions, "updateIkePolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIkePolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateIkePolicyOptions.IkePolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListIkePolicyConnections : List all VPN gateway connections that use a specified IKE policy +// This request lists all VPN gateway connections that use a policy. +func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) +} + +// ListIkePolicyConnectionsWithContext is an alternate form of the ListIkePolicyConnections method which supports a Context parameter +func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *listIkePolicyConnectionsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListIpsecPolicies : List all IPsec policies +// This request lists all IPsec policies in the region. +func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) +} + +// ListIpsecPoliciesWithContext is an alternate form of the ListIpsecPolicies method which supports a Context parameter +func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listIpsecPoliciesOptions, "listIpsecPoliciesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listIpsecPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listIpsecPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listIpsecPoliciesOptions.Start)) + } + if listIpsecPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listIpsecPoliciesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateIpsecPolicy : Create an IPsec policy +// This request creates a new IPsec policy. +func (vpc *VpcV1) CreateIpsecPolicy(createIpsecPolicyOptions *CreateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + return vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) +} + +// CreateIpsecPolicyWithContext is an alternate form of the CreateIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecPolicyOptions *CreateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createIpsecPolicyOptions, "createIpsecPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIpsecPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createIpsecPolicyOptions.AuthenticationAlgorithm != nil { + body["authentication_algorithm"] = createIpsecPolicyOptions.AuthenticationAlgorithm + } + if createIpsecPolicyOptions.EncryptionAlgorithm != nil { + body["encryption_algorithm"] = createIpsecPolicyOptions.EncryptionAlgorithm + } + if createIpsecPolicyOptions.Pfs != nil { + body["pfs"] = createIpsecPolicyOptions.Pfs + } + if createIpsecPolicyOptions.KeyLifetime != nil { + body["key_lifetime"] = createIpsecPolicyOptions.KeyLifetime + } + if createIpsecPolicyOptions.Name != nil { + body["name"] = createIpsecPolicyOptions.Name + } + if createIpsecPolicyOptions.ResourceGroup != nil { + body["resource_group"] = createIpsecPolicyOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteIpsecPolicy : Delete an IPsec policy +// This request deletes an IPsec policy. This operation cannot be reversed. For this request to succeed, there must not +// be any VPN gateway connections using this policy. +func (vpc *VpcV1) DeleteIpsecPolicy(deleteIpsecPolicyOptions *DeleteIpsecPolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions) +} + +// DeleteIpsecPolicyWithContext is an alternate form of the DeleteIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecPolicyOptions *DeleteIpsecPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteIpsecPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetIpsecPolicy : Retrieve an IPsec policy +// This request retrieves a single IPsec policy specified by the identifier in the URL. +func (vpc *VpcV1) GetIpsecPolicy(getIpsecPolicyOptions *GetIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + return vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) +} + +// GetIpsecPolicyWithContext is an alternate form of the GetIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyOptions *GetIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getIpsecPolicyOptions, "getIpsecPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getIpsecPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateIpsecPolicy : Update an IPsec policy +// This request updates the properties of an existing IPsec policy. +func (vpc *VpcV1) UpdateIpsecPolicy(updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) +} + +// UpdateIpsecPolicyWithContext is an alternate form of the UpdateIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateIpsecPolicyOptions, "updateIpsecPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateIpsecPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListIpsecPolicyConnections : List all VPN gateway connections that use a specified IPsec policy +// This request lists all VPN gateway connections that use a policy. +func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) +} + +// ListIpsecPolicyConnectionsWithContext is an alternate form of the ListIpsecPolicyConnections method which supports a Context parameter +func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *listIpsecPolicyConnectionsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPNGateways : List all VPN gateways +// This request lists all VPN gateways in the region. +func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions) +} + +// ListVPNGatewaysWithContext is an alternate form of the ListVPNGateways method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVPNGatewaysOptions, "listVPNGatewaysOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPNGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNGatewaysOptions.Start)) + } + if listVPNGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNGatewaysOptions.Limit)) + } + if listVPNGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNGatewaysOptions.ResourceGroupID)) + } + if listVPNGatewaysOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNGatewaysOptions.Sort)) + } + if listVPNGatewaysOptions.Mode != nil { + builder.AddQuery("mode", fmt.Sprint(*listVPNGatewaysOptions.Mode)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPNGateway : Create a VPN gateway +// This request creates a new VPN gateway. +func (vpc *VpcV1) CreateVPNGateway(createVPNGatewayOptions *CreateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + return vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) +} + +// CreateVPNGatewayWithContext is an alternate form of the CreateVPNGateway method which supports a Context parameter +func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGatewayOptions *CreateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNGatewayOptions, "createVPNGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPNGateway : Delete a VPN gateway +// This request deletes a VPN gateway. This operation cannot be reversed. For this request to succeed, the VPN gateway +// must not have a `status` of `pending`, and there must not be any VPC routes using the VPN gateway's connections as a +// next hop. +func (vpc *VpcV1) DeleteVPNGateway(deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) +} + +// DeleteVPNGatewayWithContext is an alternate form of the DeleteVPNGateway method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNGatewayOptions, "deleteVPNGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVPNGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPNGateway : Retrieve a VPN gateway +// This request retrieves a single VPN gateway specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNGateway(getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + return vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) +} + +// GetVPNGatewayWithContext is an alternate form of the GetVPNGateway method which supports a Context parameter +func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNGatewayOptions, "getVPNGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPNGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPNGateway : Update a VPN gateway +// This request updates the properties of an existing VPN gateway. +func (vpc *VpcV1) UpdateVPNGateway(updateVPNGatewayOptions *UpdateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) +} + +// UpdateVPNGatewayWithContext is an alternate form of the UpdateVPNGateway method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGatewayOptions *UpdateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNGatewayOptions, "updateVPNGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVPNGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPNGatewayOptions.VPNGatewayPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPNGatewayConnections : List all connections of a VPN gateway +// This request lists all connections of a VPN gateway. +func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) +} + +// ListVPNGatewayConnectionsWithContext is an alternate form of the ListVPNGatewayConnections method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *listVPNGatewayConnectionsOptions.VPNGatewayID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPNGatewayConnectionsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPNGatewayConnection : Create a connection for a VPN gateway +// This request creates a new VPN gateway connection. +func (vpc *VpcV1) CreateVPNGatewayConnection(createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + return vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) +} + +// CreateVPNGatewayConnectionWithContext is an alternate form of the CreateVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPNGatewayConnection : Delete a VPN gateway connection +// This request deletes a VPN gateway connection. This operation cannot be reversed. For this request to succeed, there +// must not be VPC routes using this VPN connection as a next hop. +func (vpc *VpcV1) DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) +} + +// DeleteVPNGatewayConnectionWithContext is an alternate form of the DeleteVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *deleteVPNGatewayConnectionOptions.VPNGatewayID, + "id": *deleteVPNGatewayConnectionOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPNGatewayConnection : Retrieve a VPN gateway connection +// This request retrieves a single VPN gateway connection specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNGatewayConnection(getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + return vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions) +} + +// GetVPNGatewayConnectionWithContext is an alternate form of the GetVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *getVPNGatewayConnectionOptions.VPNGatewayID, + "id": *getVPNGatewayConnectionOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPNGatewayConnection : Update a VPN gateway connection +// This request updates the properties of an existing VPN gateway connection. +func (vpc *VpcV1) UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) +} + +// UpdateVPNGatewayConnectionWithContext is an alternate form of the UpdateVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *updateVPNGatewayConnectionOptions.VPNGatewayID, + "id": *updateVPNGatewayConnectionOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPNGatewayConnectionLocalCIDRs : List all local CIDRs for a VPN gateway connection +// This request lists all local CIDRs for a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionLocalCIDRsOptions) +} + +// ListVPNGatewayConnectionLocalCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionLocalCIDRs method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *listVPNGatewayConnectionLocalCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionLocalCIDRsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewayConnectionLocalCIDRsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionLocalCIDRs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionLocalCIDRs) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveVPNGatewayConnectionLocalCIDR : Remove a local CIDR from a VPN gateway connection +// This request removes a CIDR from a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveVPNGatewayConnectionLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionLocalCIDROptions) +} + +// RemoveVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *removeVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *removeVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *removeVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *removeVPNGatewayConnectionLocalCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeVPNGatewayConnectionLocalCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionLocalCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// CheckVPNGatewayConnectionLocalCIDR : Check if the specified local CIDR exists on a VPN gateway connection +// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.CheckVPNGatewayConnectionLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionLocalCIDROptions) +} + +// CheckVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *checkVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *checkVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *checkVPNGatewayConnectionLocalCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range checkVPNGatewayConnectionLocalCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionLocalCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// AddVPNGatewayConnectionLocalCIDR : Set a local CIDR on a VPN gateway connection +// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified +// CIDR already exists. A request body is not required, and if provided, is ignored. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.AddVPNGatewayConnectionLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionLocalCIDROptions) +} + +// AddVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the AddVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *addVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *addVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *addVPNGatewayConnectionLocalCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addVPNGatewayConnectionLocalCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionLocalCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListVPNGatewayConnectionPeerCIDRs : List all peer CIDRs for a VPN gateway connection +// This request lists all peer CIDRs for a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionPeerCIDRsOptions) +} + +// ListVPNGatewayConnectionPeerCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionPeerCIDRs method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *listVPNGatewayConnectionPeerCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionPeerCIDRsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewayConnectionPeerCIDRsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionPeerCIDRs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionPeerCIDRs) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveVPNGatewayConnectionPeerCIDR : Remove a peer CIDR from a VPN gateway connection +// This request removes a CIDR from a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveVPNGatewayConnectionPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionPeerCIDROptions) +} + +// RemoveVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *removeVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *removeVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *removeVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *removeVPNGatewayConnectionPeerCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeVPNGatewayConnectionPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionPeerCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// CheckVPNGatewayConnectionPeerCIDR : Check if the specified peer CIDR exists on a VPN gateway connection +// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.CheckVPNGatewayConnectionPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionPeerCIDROptions) +} + +// CheckVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *checkVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *checkVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *checkVPNGatewayConnectionPeerCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range checkVPNGatewayConnectionPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionPeerCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// AddVPNGatewayConnectionPeerCIDR : Set a peer CIDR on a VPN gateway connection +// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified +// CIDR already exists. A request body is not required, and if provided, is ignored. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.AddVPNGatewayConnectionPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionPeerCIDROptions) +} + +// AddVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the AddVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *addVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *addVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *addVPNGatewayConnectionPeerCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addVPNGatewayConnectionPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionPeerCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListVPNServers : List all VPN servers +// This request lists all VPN servers. +func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) +} + +// ListVPNServersWithContext is an alternate form of the ListVPNServers method which supports a Context parameter +func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVPNServersOptions, "listVPNServersOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVPNServersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPNServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) + } + if listVPNServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServersOptions.Start)) + } + if listVPNServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServersOptions.Limit)) + } + if listVPNServersOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNServersOptions.ResourceGroupID)) + } + if listVPNServersOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServersOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPNServer : Create a VPN server +// This request creates a new VPN server. +func (vpc *VpcV1) CreateVPNServer(createVPNServerOptions *CreateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + return vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions) +} + +// CreateVPNServerWithContext is an alternate form of the CreateVPNServer method which supports a Context parameter +func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServerOptions *CreateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNServerOptions, "createVPNServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPNServerOptions.Certificate != nil { + body["certificate"] = createVPNServerOptions.Certificate + } + if createVPNServerOptions.ClientAuthentication != nil { + body["client_authentication"] = createVPNServerOptions.ClientAuthentication + } + if createVPNServerOptions.ClientIPPool != nil { + body["client_ip_pool"] = createVPNServerOptions.ClientIPPool + } + if createVPNServerOptions.Subnets != nil { + body["subnets"] = createVPNServerOptions.Subnets + } + if createVPNServerOptions.ClientDnsServerIps != nil { + body["client_dns_server_ips"] = createVPNServerOptions.ClientDnsServerIps + } + if createVPNServerOptions.ClientIdleTimeout != nil { + body["client_idle_timeout"] = createVPNServerOptions.ClientIdleTimeout + } + if createVPNServerOptions.EnableSplitTunneling != nil { + body["enable_split_tunneling"] = createVPNServerOptions.EnableSplitTunneling + } + if createVPNServerOptions.Name != nil { + body["name"] = createVPNServerOptions.Name + } + if createVPNServerOptions.Port != nil { + body["port"] = createVPNServerOptions.Port + } + if createVPNServerOptions.Protocol != nil { + body["protocol"] = createVPNServerOptions.Protocol + } + if createVPNServerOptions.ResourceGroup != nil { + body["resource_group"] = createVPNServerOptions.ResourceGroup + } + if createVPNServerOptions.SecurityGroups != nil { + body["security_groups"] = createVPNServerOptions.SecurityGroups + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPNServer : Delete a VPN server +// This request deletes a VPN server. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPNServer(deleteVPNServerOptions *DeleteVPNServerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions) +} + +// DeleteVPNServerWithContext is an alternate form of the DeleteVPNServer method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServerOptions *DeleteVPNServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNServerOptions, "deleteVPNServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVPNServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteVPNServerOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPNServerOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPNServer : Retrieve a VPN server +// This request retrieves a single VPN server specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNServer(getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + return vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) +} + +// GetVPNServerWithContext is an alternate form of the GetVPNServer method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerOptions, "getVPNServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPNServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPNServer : Update a VPN server +// This request updates the properties of an existing VPN server. Any property changes will cause all connected VPN +// clients are disconnected from this VPN server except for the name change. +func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) +} + +// UpdateVPNServerWithContext is an alternate form of the UpdateVPNServer method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNServerOptions, "updateVPNServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVPNServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVPNServerOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPNServerOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPNServerClientConfiguration : Retrieve client configuration +// This request retrieves OpenVPN client configuration on a single VPN server specified by the identifier in the URL. +// This configuration includes directives compatible with OpenVPN releases 2.4 and 2.5. +func (vpc *VpcV1) GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) { + return vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) +} + +// GetVPNServerClientConfigurationWithContext is an alternate form of the GetVPNServerClientConfiguration method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context, getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPNServerClientConfigurationOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}/client_configuration`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "text/plain") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, &result) + + return +} + +// ListVPNServerClients : List all VPN clients for a VPN server +// This request retrieves all connected VPN clients, and any disconnected VPN clients that the VPN server has not yet +// deleted based on its auto-deletion policy. +func (vpc *VpcV1) ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) +} + +// ListVPNServerClientsWithContext is an alternate form of the ListVPNServerClients method which supports a Context parameter +func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNServerClientsOptions, "listVPNServerClientsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *listVPNServerClientsOptions.VPNServerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNServerClientsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPNServerClientsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start)) + } + if listVPNServerClientsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServerClientsOptions.Limit)) + } + if listVPNServerClientsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServerClientsOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPNServerClient : Delete a VPN client +// This request disconnects and deletes the VPN client from the VPN server. The VPN client may reconnect unless its +// authentication permissions for the configured authentication methods (such as its client certificate) have been +// revoked. +func (vpc *VpcV1) DeleteVPNServerClient(deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) +} + +// DeleteVPNServerClientWithContext is an alternate form of the DeleteVPNServerClient method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNServerClientOptions, "deleteVPNServerClientOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *deleteVPNServerClientOptions.VPNServerID, + "id": *deleteVPNServerClientOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNServerClientOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPNServerClient : Retrieve a VPN client +// This request retrieves a single VPN client specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) { + return vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) +} + +// GetVPNServerClientWithContext is an alternate form of the GetVPNServerClient method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerClientOptions, "getVPNServerClientOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *getVPNServerClientOptions.VPNServerID, + "id": *getVPNServerClientOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNServerClientOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DisconnectVPNClient : Disconnect a VPN client +// This request disconnects the specified VPN client, and deletes the client according to the VPN server's auto-deletion +// policy. The VPN client may reconnect unless its authentication permissions for the configured authentication methods +// (such as its client certificate) have been revoked. +func (vpc *VpcV1) DisconnectVPNClient(disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) { + return vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) +} + +// DisconnectVPNClientWithContext is an alternate form of the DisconnectVPNClient method which supports a Context parameter +func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(disconnectVPNClientOptions, "disconnectVPNClientOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *disconnectVPNClientOptions.VPNServerID, + "id": *disconnectVPNClientOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}/disconnect`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range disconnectVPNClientOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListVPNServerRoutes : List all VPN routes for a VPN server +// This request lists all VPN routes in a VPN server. All VPN routes are provided to the VPN client when the connection +// is established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN route +// matching their specified destinations. All VPN routes must be unique within the VPN server. +func (vpc *VpcV1) ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) +} + +// ListVPNServerRoutesWithContext is an alternate form of the ListVPNServerRoutes method which supports a Context parameter +func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNServerRoutesOptions, "listVPNServerRoutesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *listVPNServerRoutesOptions.VPNServerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNServerRoutesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPNServerRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServerRoutesOptions.Start)) + } + if listVPNServerRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServerRoutesOptions.Limit)) + } + if listVPNServerRoutesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServerRoutesOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRouteCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPNServerRoute : Create a VPN route for a VPN server +// This request creates a new VPN route in the VPN server. All VPN routes are provided to the VPN client when the +// connection is established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN +// route matching their specified destinations. All VPN routes must be unique within the VPN server. destination of the +// packet. +func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + return vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) +} + +// CreateVPNServerRouteWithContext is an alternate form of the CreateVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNServerRouteOptions, "createVPNServerRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *createVPNServerRouteOptions.VPNServerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPNServerRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPNServerRouteOptions.Destination != nil { + body["destination"] = createVPNServerRouteOptions.Destination + } + if createVPNServerRouteOptions.Action != nil { + body["action"] = createVPNServerRouteOptions.Action + } + if createVPNServerRouteOptions.Name != nil { + body["name"] = createVPNServerRouteOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPNServerRoute : Delete a VPN route +// This request deletes a VPN route. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPNServerRoute(deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) +} + +// DeleteVPNServerRouteWithContext is an alternate form of the DeleteVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *deleteVPNServerRouteOptions.VPNServerID, + "id": *deleteVPNServerRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPNServerRoute : Retrieve a VPN route +// This request retrieves a single VPN route specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNServerRoute(getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + return vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) +} + +// GetVPNServerRouteWithContext is an alternate form of the GetVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerRouteOptions, "getVPNServerRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPNServerRouteOptions, "getVPNServerRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *getVPNServerRouteOptions.VPNServerID, + "id": *getVPNServerRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNServerRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPNServerRoute : Update a VPN route +// This request updates a VPN route with the information in a provided VPN route patch. The VPN route patch object is +// structured in the same way as a retrieved VPN route and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPNServerRoute(updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions) +} + +// UpdateVPNServerRouteWithContext is an alternate form of the UpdateVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNServerRouteOptions, "updateVPNServerRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *updateVPNServerRouteOptions.VPNServerID, + "id": *updateVPNServerRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNServerRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPNServerRouteOptions.VPNServerRoutePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerProfiles : List all load balancer profiles +// This request lists all load balancer profiles available in the region. A load balancer profile specifies the +// performance characteristics and pricing model for a load balancer. +func (vpc *VpcV1) ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) +} + +// ListLoadBalancerProfilesWithContext is an alternate form of the ListLoadBalancerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listLoadBalancerProfilesOptions, "listLoadBalancerProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listLoadBalancerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) + } + if listLoadBalancerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetLoadBalancerProfile : Retrieve a load balancer profile +// This request retrieves a load balancer profile specified by the name in the URL. +func (vpc *VpcV1) GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) +} + +// GetLoadBalancerProfileWithContext is an alternate form of the GetLoadBalancerProfile method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getLoadBalancerProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancers : List all load balancers +// This request lists all load balancers in the region. +func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) +} + +// ListLoadBalancersWithContext is an alternate form of the ListLoadBalancers method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listLoadBalancersOptions, "listLoadBalancersOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listLoadBalancersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start)) + } + if listLoadBalancersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listLoadBalancersOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateLoadBalancer : Create a load balancer +// This request creates and provisions a new load balancer. +func (vpc *VpcV1) CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) +} + +// CreateLoadBalancerWithContext is an alternate form of the CreateLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerOptions, "createLoadBalancerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerOptions.IsPublic != nil { + body["is_public"] = createLoadBalancerOptions.IsPublic + } + if createLoadBalancerOptions.Subnets != nil { + body["subnets"] = createLoadBalancerOptions.Subnets + } + if createLoadBalancerOptions.Datapath != nil { + body["datapath"] = createLoadBalancerOptions.Datapath + } + if createLoadBalancerOptions.Dns != nil { + body["dns"] = createLoadBalancerOptions.Dns + } + if createLoadBalancerOptions.Listeners != nil { + body["listeners"] = createLoadBalancerOptions.Listeners + } + if createLoadBalancerOptions.Logging != nil { + body["logging"] = createLoadBalancerOptions.Logging + } + if createLoadBalancerOptions.Name != nil { + body["name"] = createLoadBalancerOptions.Name + } + if createLoadBalancerOptions.Pools != nil { + body["pools"] = createLoadBalancerOptions.Pools + } + if createLoadBalancerOptions.Profile != nil { + body["profile"] = createLoadBalancerOptions.Profile + } + if createLoadBalancerOptions.ResourceGroup != nil { + body["resource_group"] = createLoadBalancerOptions.ResourceGroup + } + if createLoadBalancerOptions.RouteMode != nil { + body["route_mode"] = createLoadBalancerOptions.RouteMode + } + if createLoadBalancerOptions.SecurityGroups != nil { + body["security_groups"] = createLoadBalancerOptions.SecurityGroups + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteLoadBalancer : Delete a load balancer +// This request deletes a load balancer. This operation cannot be reversed. A load balancer cannot be deleted if its +// `provisioning_status` is `delete_pending`. +func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) +} + +// DeleteLoadBalancerWithContext is an alternate form of the DeleteLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerOptions, "deleteLoadBalancerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteLoadBalancerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetLoadBalancer : Retrieve a load balancer +// This request retrieves a single load balancer specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancer(getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) +} + +// GetLoadBalancerWithContext is an alternate form of the GetLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerOptions, "getLoadBalancerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getLoadBalancerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateLoadBalancer : Update a load balancer +// This request updates a load balancer with the information in a provided load balancer patch. The load balancer patch +// object is structured in the same way as a retrieved load balancer and contains only the information to be updated. A +// load balancer can only be updated if its `provisioning_status` is `active`. +func (vpc *VpcV1) UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) +} + +// UpdateLoadBalancerWithContext is an alternate form of the UpdateLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerOptions, "updateLoadBalancerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateLoadBalancerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetLoadBalancerStatistics : List all statistics of a load balancer +// This request lists statistics of a load balancer. +func (vpc *VpcV1) GetLoadBalancerStatistics(getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) +} + +// GetLoadBalancerStatisticsWithContext is an alternate form of the GetLoadBalancerStatistics method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getLoadBalancerStatisticsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}/statistics`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerListeners : List all listeners for a load balancer +// This request lists all listeners for a load balancer. +func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) +} + +// ListLoadBalancerListenersWithContext is an alternate form of the ListLoadBalancerListeners method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateLoadBalancerListener : Create a listener for a load balancer +// This request creates a new listener for a load balancer. +func (vpc *VpcV1) CreateLoadBalancerListener(createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) +} + +// CreateLoadBalancerListenerWithContext is an alternate form of the CreateLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerListenerOptions.Protocol != nil { + body["protocol"] = createLoadBalancerListenerOptions.Protocol + } + if createLoadBalancerListenerOptions.AcceptProxyProtocol != nil { + body["accept_proxy_protocol"] = createLoadBalancerListenerOptions.AcceptProxyProtocol + } + if createLoadBalancerListenerOptions.CertificateInstance != nil { + body["certificate_instance"] = createLoadBalancerListenerOptions.CertificateInstance + } + if createLoadBalancerListenerOptions.ConnectionLimit != nil { + body["connection_limit"] = createLoadBalancerListenerOptions.ConnectionLimit + } + if createLoadBalancerListenerOptions.DefaultPool != nil { + body["default_pool"] = createLoadBalancerListenerOptions.DefaultPool + } + if createLoadBalancerListenerOptions.HTTPSRedirect != nil { + body["https_redirect"] = createLoadBalancerListenerOptions.HTTPSRedirect + } + if createLoadBalancerListenerOptions.IdleConnectionTimeout != nil { + body["idle_connection_timeout"] = createLoadBalancerListenerOptions.IdleConnectionTimeout + } + if createLoadBalancerListenerOptions.Policies != nil { + body["policies"] = createLoadBalancerListenerOptions.Policies + } + if createLoadBalancerListenerOptions.Port != nil { + body["port"] = createLoadBalancerListenerOptions.Port + } + if createLoadBalancerListenerOptions.PortMax != nil { + body["port_max"] = createLoadBalancerListenerOptions.PortMax + } + if createLoadBalancerListenerOptions.PortMin != nil { + body["port_min"] = createLoadBalancerListenerOptions.PortMin + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteLoadBalancerListener : Delete a load balancer listener +// This request deletes a load balancer listener. This operation cannot be reversed. For this operation to succeed, the +// listener must not be the target of another load balancer listener. +func (vpc *VpcV1) DeleteLoadBalancerListener(deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) +} + +// DeleteLoadBalancerListenerWithContext is an alternate form of the DeleteLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerListenerOptions.LoadBalancerID, + "id": *deleteLoadBalancerListenerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetLoadBalancerListener : Retrieve a load balancer listener +// This request retrieves a single listener specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListener(getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) +} + +// GetLoadBalancerListenerWithContext is an alternate form of the GetLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerListenerOptions.LoadBalancerID, + "id": *getLoadBalancerListenerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateLoadBalancerListener : Update a load balancer listener +// This request updates a load balancer listener from a listener patch. +func (vpc *VpcV1) UpdateLoadBalancerListener(updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) +} + +// UpdateLoadBalancerListenerWithContext is an alternate form of the UpdateLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerListenerOptions.LoadBalancerID, + "id": *updateLoadBalancerListenerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerListenerPolicies : List all policies for a load balancer listener +// This request lists all policies for a load balancer listener. +func (vpc *VpcV1) ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) +} + +// ListLoadBalancerListenerPoliciesWithContext is an alternate form of the ListLoadBalancerListenerPolicies method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Context, listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerListenerPoliciesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPoliciesOptions.ListenerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener +// Creates a new policy for a load balancer listener. +func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) +} + +// CreateLoadBalancerListenerPolicyWithContext is an alternate form of the CreateLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Context, createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyOptions.ListenerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerListenerPolicyOptions.Action != nil { + body["action"] = createLoadBalancerListenerPolicyOptions.Action + } + if createLoadBalancerListenerPolicyOptions.Priority != nil { + body["priority"] = createLoadBalancerListenerPolicyOptions.Priority + } + if createLoadBalancerListenerPolicyOptions.Name != nil { + body["name"] = createLoadBalancerListenerPolicyOptions.Name + } + if createLoadBalancerListenerPolicyOptions.Rules != nil { + body["rules"] = createLoadBalancerListenerPolicyOptions.Rules + } + if createLoadBalancerListenerPolicyOptions.Target != nil { + body["target"] = createLoadBalancerListenerPolicyOptions.Target + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteLoadBalancerListenerPolicy : Delete a load balancer listener policy +// Deletes a policy of the load balancer listener. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) +} + +// DeleteLoadBalancerListenerPolicyWithContext is an alternate form of the DeleteLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyOptions.ListenerID, + "id": *deleteLoadBalancerListenerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetLoadBalancerListenerPolicy : Retrieve a load balancer listener policy +// Retrieve a single policy specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) +} + +// GetLoadBalancerListenerPolicyWithContext is an alternate form of the GetLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, + "id": *getLoadBalancerListenerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy +// Updates a policy from a policy patch. +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) +} + +// UpdateLoadBalancerListenerPolicyWithContext is an alternate form of the UpdateLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Context, updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, + "id": *updateLoadBalancerListenerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy +// This request lists all rules of a load balancer listener policy. +func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) +} + +// ListLoadBalancerListenerPolicyRulesWithContext is an alternate form of the ListLoadBalancerListenerPolicyRules method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Context, listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, + "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateLoadBalancerListenerPolicyRule : Create a rule for a load balancer listener policy +// Creates a new rule for the load balancer listener policy. +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) +} + +// CreateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the CreateLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerListenerPolicyRuleOptions.Condition != nil { + body["condition"] = createLoadBalancerListenerPolicyRuleOptions.Condition + } + if createLoadBalancerListenerPolicyRuleOptions.Type != nil { + body["type"] = createLoadBalancerListenerPolicyRuleOptions.Type + } + if createLoadBalancerListenerPolicyRuleOptions.Value != nil { + body["value"] = createLoadBalancerListenerPolicyRuleOptions.Value + } + if createLoadBalancerListenerPolicyRuleOptions.Field != nil { + body["field"] = createLoadBalancerListenerPolicyRuleOptions.Field + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteLoadBalancerListenerPolicyRule : Delete a load balancer listener policy rule +// Deletes a rule from the load balancer listener policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) +} + +// DeleteLoadBalancerListenerPolicyRuleWithContext is an alternate form of the DeleteLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *deleteLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *deleteLoadBalancerListenerPolicyRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetLoadBalancerListenerPolicyRule : Retrieve a load balancer listener policy rule +// Retrieves a single rule specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) +} + +// GetLoadBalancerListenerPolicyRuleWithContext is an alternate form of the GetLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *getLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *getLoadBalancerListenerPolicyRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateLoadBalancerListenerPolicyRule : Update a load balancer listener policy rule +// Updates a rule of the load balancer listener policy. +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) +} + +// UpdateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the UpdateLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *updateLoadBalancerListenerPolicyRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerPools : List all pools of a load balancer +// This request lists all pools of a load balancer. +func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) +} + +// ListLoadBalancerPoolsWithContext is an alternate form of the ListLoadBalancerPools method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerPoolsOptions.LoadBalancerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateLoadBalancerPool : Create a load balancer pool +// This request creates a new pool from a pool prototype object. +func (vpc *VpcV1) CreateLoadBalancerPool(createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) +} + +// CreateLoadBalancerPoolWithContext is an alternate form of the CreateLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerPoolOptions.LoadBalancerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerPoolOptions.Algorithm != nil { + body["algorithm"] = createLoadBalancerPoolOptions.Algorithm + } + if createLoadBalancerPoolOptions.HealthMonitor != nil { + body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor + } + if createLoadBalancerPoolOptions.Protocol != nil { + body["protocol"] = createLoadBalancerPoolOptions.Protocol + } + if createLoadBalancerPoolOptions.Members != nil { + body["members"] = createLoadBalancerPoolOptions.Members + } + if createLoadBalancerPoolOptions.Name != nil { + body["name"] = createLoadBalancerPoolOptions.Name + } + if createLoadBalancerPoolOptions.ProxyProtocol != nil { + body["proxy_protocol"] = createLoadBalancerPoolOptions.ProxyProtocol + } + if createLoadBalancerPoolOptions.SessionPersistence != nil { + body["session_persistence"] = createLoadBalancerPoolOptions.SessionPersistence + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteLoadBalancerPool : Delete a load balancer pool +// This request deletes a load balancer pool. This operation cannot be reversed. The pool must not currently be the +// default pool for any listener in the load balancer. +func (vpc *VpcV1) DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) +} + +// DeleteLoadBalancerPoolWithContext is an alternate form of the DeleteLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerPoolOptions.LoadBalancerID, + "id": *deleteLoadBalancerPoolOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetLoadBalancerPool : Retrieve a load balancer pool +// This request retrieves a single pool specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerPool(getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) +} + +// GetLoadBalancerPoolWithContext is an alternate form of the GetLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerPoolOptions.LoadBalancerID, + "id": *getLoadBalancerPoolOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateLoadBalancerPool : Update a load balancer pool +// This request updates a load balancer pool from a pool patch. +func (vpc *VpcV1) UpdateLoadBalancerPool(updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) +} + +// UpdateLoadBalancerPoolWithContext is an alternate form of the UpdateLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerPoolOptions.LoadBalancerID, + "id": *updateLoadBalancerPoolOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerPoolMembers : List all members of a load balancer pool +// This request lists all members of a load balancer pool. +func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) +} + +// ListLoadBalancerPoolMembersWithContext is an alternate form of the ListLoadBalancerPoolMembers method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *listLoadBalancerPoolMembersOptions.PoolID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateLoadBalancerPoolMember : Create a member in a load balancer pool +// This request creates a new member and adds the member to the pool. +func (vpc *VpcV1) CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) +} + +// CreateLoadBalancerPoolMemberWithContext is an alternate form of the CreateLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerPoolMemberOptions.Port != nil { + body["port"] = createLoadBalancerPoolMemberOptions.Port + } + if createLoadBalancerPoolMemberOptions.Target != nil { + body["target"] = createLoadBalancerPoolMemberOptions.Target + } + if createLoadBalancerPoolMemberOptions.Weight != nil { + body["weight"] = createLoadBalancerPoolMemberOptions.Weight + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ReplaceLoadBalancerPoolMembers : Replace load balancer pool members +// This request replaces the existing members of the load balancer pool with new members created from the collection of +// member prototype objects. +func (vpc *VpcV1) ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + return vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) +} + +// ReplaceLoadBalancerPoolMembersWithContext is an alternate form of the ReplaceLoadBalancerPoolMembers method which supports a Context parameter +func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if replaceLoadBalancerPoolMembersOptions.Members != nil { + body["members"] = replaceLoadBalancerPoolMembersOptions.Members + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteLoadBalancerPoolMember : Delete a load balancer pool member +// This request deletes a member from the pool. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) +} + +// DeleteLoadBalancerPoolMemberWithContext is an alternate form of the DeleteLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *deleteLoadBalancerPoolMemberOptions.PoolID, + "id": *deleteLoadBalancerPoolMemberOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetLoadBalancerPoolMember : Retrieve a load balancer pool member +// This request retrieves a single member specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) +} + +// GetLoadBalancerPoolMemberWithContext is an alternate form of the GetLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *getLoadBalancerPoolMemberOptions.PoolID, + "id": *getLoadBalancerPoolMemberOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateLoadBalancerPoolMember : Update a load balancer pool member +// This request updates an existing member from a member patch. +func (vpc *VpcV1) UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) +} + +// UpdateLoadBalancerPoolMemberWithContext is an alternate form of the UpdateLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *updateLoadBalancerPoolMemberOptions.PoolID, + "id": *updateLoadBalancerPoolMemberOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListEndpointGateways : List all endpoint gateways +// This request lists all endpoint gateways in the region. An endpoint gateway maps one or more reserved IPs in a VPC to +// a target outside the VPC. +func (vpc *VpcV1) ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { + return vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) +} + +// ListEndpointGatewaysWithContext is an alternate form of the ListEndpointGateways method which supports a Context parameter +func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listEndpointGatewaysOptions, "listEndpointGatewaysOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listEndpointGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listEndpointGatewaysOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listEndpointGatewaysOptions.Name)) + } + if listEndpointGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listEndpointGatewaysOptions.Start)) + } + if listEndpointGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewaysOptions.Limit)) + } + if listEndpointGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listEndpointGatewaysOptions.ResourceGroupID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateEndpointGateway : Create an endpoint gateway +// This request creates a new endpoint gateway. An endpoint gateway maps one or more reserved IPs in a VPC to a target +// outside the VPC. +func (vpc *VpcV1) CreateEndpointGateway(createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + return vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) +} + +// CreateEndpointGatewayWithContext is an alternate form of the CreateEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createEndpointGatewayOptions, "createEndpointGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createEndpointGatewayOptions.Target != nil { + body["target"] = createEndpointGatewayOptions.Target + } + if createEndpointGatewayOptions.VPC != nil { + body["vpc"] = createEndpointGatewayOptions.VPC + } + if createEndpointGatewayOptions.Ips != nil { + body["ips"] = createEndpointGatewayOptions.Ips + } + if createEndpointGatewayOptions.Name != nil { + body["name"] = createEndpointGatewayOptions.Name + } + if createEndpointGatewayOptions.ResourceGroup != nil { + body["resource_group"] = createEndpointGatewayOptions.ResourceGroup + } + if createEndpointGatewayOptions.SecurityGroups != nil { + body["security_groups"] = createEndpointGatewayOptions.SecurityGroups + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway +// This request lists all reserved IPs bound to an endpoint gateway. +func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { + return vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) +} + +// ListEndpointGatewayIpsWithContext is an alternate form of the ListEndpointGatewayIps method which supports a Context parameter +func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listEndpointGatewayIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listEndpointGatewayIpsOptions.Start)) + } + if listEndpointGatewayIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewayIpsOptions.Limit)) + } + if listEndpointGatewayIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listEndpointGatewayIpsOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveEndpointGatewayIP : Unbind a reserved IP from an endpoint gateway +// This request unbinds the specified reserved IP from the specified endpoint gateway. If the reserved IP has +// `auto_delete` set to `true`, the reserved IP will be deleted. +func (vpc *VpcV1) RemoveEndpointGatewayIP(removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) +} + +// RemoveEndpointGatewayIPWithContext is an alternate form of the RemoveEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *removeEndpointGatewayIPOptions.EndpointGatewayID, + "id": *removeEndpointGatewayIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetEndpointGatewayIP : Retrieve a reserved IP bound to an endpoint gateway +// This request retrieves the specified reserved IP address if it is bound to the endpoint gateway specified in the URL. +func (vpc *VpcV1) GetEndpointGatewayIP(getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) +} + +// GetEndpointGatewayIPWithContext is an alternate form of the GetEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *getEndpointGatewayIPOptions.EndpointGatewayID, + "id": *getEndpointGatewayIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddEndpointGatewayIP : Bind a reserved IP to an endpoint gateway +// This request binds the specified reserved IP to the specified endpoint gateway. The reserved IP: +// +// - must currently be unbound, or not required by its target +// - must not be in the same zone as any other reserved IP bound to the endpoint gateway. +func (vpc *VpcV1) AddEndpointGatewayIP(addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) +} + +// AddEndpointGatewayIPWithContext is an alternate form of the AddEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, + "id": *addEndpointGatewayIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteEndpointGateway : Delete an endpoint gateway +// This request deletes an endpoint gateway. This operation cannot be reversed. +// +// Reserved IPs that were bound to the endpoint gateway will be released if their +// `auto_delete` property is set to true. +func (vpc *VpcV1) DeleteEndpointGateway(deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) +} + +// DeleteEndpointGatewayWithContext is an alternate form of the DeleteEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteEndpointGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetEndpointGateway : Retrieve an endpoint gateway +// This request retrieves a single endpoint gateway specified by the identifier in the URL. +func (vpc *VpcV1) GetEndpointGateway(getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + return vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) +} + +// GetEndpointGatewayWithContext is an alternate form of the GetEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getEndpointGatewayOptions, "getEndpointGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getEndpointGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateEndpointGateway : Update an endpoint gateway +// This request updates an endpoint gateway's name. +func (vpc *VpcV1) UpdateEndpointGateway(updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + return vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) +} + +// UpdateEndpointGatewayWithContext is an alternate form of the UpdateEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateEndpointGatewayOptions, "updateEndpointGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateEndpointGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateEndpointGatewayOptions.EndpointGatewayPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListFlowLogCollectors : List all flow log collectors +// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over one or more +// network interfaces within a VPC, depending on the chosen target. +func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { + return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) +} + +// ListFlowLogCollectorsWithContext is an alternate form of the ListFlowLogCollectors method which supports a Context parameter +func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listFlowLogCollectorsOptions, "listFlowLogCollectorsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listFlowLogCollectorsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listFlowLogCollectorsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listFlowLogCollectorsOptions.Start)) + } + if listFlowLogCollectorsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listFlowLogCollectorsOptions.Limit)) + } + if listFlowLogCollectorsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listFlowLogCollectorsOptions.ResourceGroupID)) + } + if listFlowLogCollectorsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listFlowLogCollectorsOptions.Name)) + } + if listFlowLogCollectorsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listFlowLogCollectorsOptions.VPCID)) + } + if listFlowLogCollectorsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listFlowLogCollectorsOptions.VPCCRN)) + } + if listFlowLogCollectorsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listFlowLogCollectorsOptions.VPCName)) + } + if listFlowLogCollectorsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listFlowLogCollectorsOptions.TargetID)) + } + if listFlowLogCollectorsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listFlowLogCollectorsOptions.TargetResourceType)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateFlowLogCollector : Create a flow log collector +// This request creates and starts a new flow log collector from a flow log collector prototype object. The prototype +// object is structured in the same way as a retrieved flow log collector, and contains the information necessary to +// create and start the new flow log collector. +func (vpc *VpcV1) CreateFlowLogCollector(createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + return vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions) +} + +// CreateFlowLogCollectorWithContext is an alternate form of the CreateFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createFlowLogCollectorOptions, "createFlowLogCollectorOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createFlowLogCollectorOptions, "createFlowLogCollectorOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createFlowLogCollectorOptions.StorageBucket != nil { + body["storage_bucket"] = createFlowLogCollectorOptions.StorageBucket + } + if createFlowLogCollectorOptions.Target != nil { + body["target"] = createFlowLogCollectorOptions.Target + } + if createFlowLogCollectorOptions.Active != nil { + body["active"] = createFlowLogCollectorOptions.Active + } + if createFlowLogCollectorOptions.Name != nil { + body["name"] = createFlowLogCollectorOptions.Name + } + if createFlowLogCollectorOptions.ResourceGroup != nil { + body["resource_group"] = createFlowLogCollectorOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteFlowLogCollector : Delete a flow log collector +// This request stops and deletes a flow log collector. This operation cannot be reversed. +// +// Collected flow logs remain available within the flow log collector's Cloud Object Storage bucket. +func (vpc *VpcV1) DeleteFlowLogCollector(deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) +} + +// DeleteFlowLogCollectorWithContext is an alternate form of the DeleteFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteFlowLogCollectorOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetFlowLogCollector : Retrieve a flow log collector +// This request retrieves a single flow log collector specified by the identifier in the URL. +func (vpc *VpcV1) GetFlowLogCollector(getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + return vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) +} + +// GetFlowLogCollectorWithContext is an alternate form of the GetFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getFlowLogCollectorOptions, "getFlowLogCollectorOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getFlowLogCollectorOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateFlowLogCollector : Update a flow log collector +// This request updates a flow log collector with the information in a provided flow log collector patch. The flow log +// collector patch object is structured in the same way as a retrieved flow log collector and contains only the +// information to be updated. +func (vpc *VpcV1) UpdateFlowLogCollector(updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + return vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) +} + +// UpdateFlowLogCollectorWithContext is an alternate form of the UpdateFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateFlowLogCollectorOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateFlowLogCollectorOptions.FlowLogCollectorPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AccountReference : AccountReference struct +type AccountReference struct { + // The unique identifier for this account. + ID *string `json:"id" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the AccountReference.ResourceType property. +// The resource type. +const ( + AccountReferenceResourceTypeAccountConst = "account" +) + +// UnmarshalAccountReference unmarshals an instance of AccountReference from the specified map of raw messages. +func UnmarshalAccountReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccountReference) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AddBareMetalServerNetworkInterfaceFloatingIPOptions : The AddBareMetalServerNetworkInterfaceFloatingIP options. +type AddBareMetalServerNetworkInterfaceFloatingIPOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The network interface identifier. + NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate AddBareMetalServerNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewAddBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + return &AddBareMetalServerNetworkInterfaceFloatingIPOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// AddEndpointGatewayIPOptions : The AddEndpointGatewayIP options. +type AddEndpointGatewayIPOptions struct { + // The endpoint gateway identifier. + EndpointGatewayID *string `json:"endpoint_gateway_id" validate:"required,ne="` + + // The reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddEndpointGatewayIPOptions : Instantiate AddEndpointGatewayIPOptions +func (*VpcV1) NewAddEndpointGatewayIPOptions(endpointGatewayID string, id string) *AddEndpointGatewayIPOptions { + return &AddEndpointGatewayIPOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + ID: core.StringPtr(id), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (_options *AddEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *AddEndpointGatewayIPOptions { + _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddEndpointGatewayIPOptions) SetID(id string) *AddEndpointGatewayIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddEndpointGatewayIPOptions) SetHeaders(param map[string]string) *AddEndpointGatewayIPOptions { + options.Headers = param + return options +} + +// AddInstanceNetworkInterfaceFloatingIPOptions : The AddInstanceNetworkInterfaceFloatingIP options. +type AddInstanceNetworkInterfaceFloatingIPOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The network interface identifier. + NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddInstanceNetworkInterfaceFloatingIPOptions : Instantiate AddInstanceNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewAddInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *AddInstanceNetworkInterfaceFloatingIPOptions { + return &AddInstanceNetworkInterfaceFloatingIPOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *AddInstanceNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddInstanceNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// AddNetworkInterfaceFloatingIPOptions : The AddNetworkInterfaceFloatingIP options. +type AddNetworkInterfaceFloatingIPOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` + + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddNetworkInterfaceFloatingIPOptions : Instantiate AddNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewAddNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *AddNetworkInterfaceFloatingIPOptions { + return &AddNetworkInterfaceFloatingIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *AddNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *AddNetworkInterfaceFloatingIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddNetworkInterfaceFloatingIPOptions) SetID(id string) *AddNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// AddVirtualNetworkInterfaceIPOptions : The AddVirtualNetworkInterfaceIP options. +type AddVirtualNetworkInterfaceIPOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` + + // The reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddVirtualNetworkInterfaceIPOptions : Instantiate AddVirtualNetworkInterfaceIPOptions +func (*VpcV1) NewAddVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *AddVirtualNetworkInterfaceIPOptions { + return &AddVirtualNetworkInterfaceIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *AddVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *AddVirtualNetworkInterfaceIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddVirtualNetworkInterfaceIPOptions) SetID(id string) *AddVirtualNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *AddVirtualNetworkInterfaceIPOptions { + options.Headers = param + return options +} + +// AddVPNGatewayConnectionLocalCIDROptions : The AddVPNGatewayConnectionLocalCIDR options. +type AddVPNGatewayConnectionLocalCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // The address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddVPNGatewayConnectionLocalCIDROptions : Instantiate AddVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { + return &AddVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionLocalCIDROptions { + options.Headers = param + return options +} + +// AddVPNGatewayConnectionPeerCIDROptions : The AddVPNGatewayConnectionPeerCIDR options. +type AddVPNGatewayConnectionPeerCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // The address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddVPNGatewayConnectionPeerCIDROptions : Instantiate AddVPNGatewayConnectionPeerCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { + return &AddVPNGatewayConnectionPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetID(id string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionPeerCIDROptions { + options.Headers = param + return options +} + +// AddressPrefix : AddressPrefix struct +type AddressPrefix struct { + // The CIDR block for this prefix. + CIDR *string `json:"cidr" validate:"required"` + + // The date and time that the prefix was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // Indicates whether subnets exist with addresses from this prefix. + HasSubnets *bool `json:"has_subnets" validate:"required"` + + // The URL for this address prefix. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this address prefix. + ID *string `json:"id" validate:"required"` + + // Indicates whether this is the default prefix for this zone in this VPC. If a default prefix was automatically + // created when the VPC was created, the prefix is automatically named using a hyphenated list of randomly-selected + // words, but may be changed. + IsDefault *bool `json:"is_default" validate:"required"` + + // The name for this address prefix. The name must not be used by another address prefix for the VPC. + Name *string `json:"name" validate:"required"` + + // The zone this address prefix resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalAddressPrefix unmarshals an instance of AddressPrefix from the specified map of raw messages. +func UnmarshalAddressPrefix(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefix) + err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "has_subnets", &obj.HasSubnets) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AddressPrefixCollection : AddressPrefixCollection struct +type AddressPrefixCollection struct { + // Collection of address prefixes. + AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"` + + // A link to the first page of resources. + First *AddressPrefixCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *AddressPrefixCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalAddressPrefixCollection unmarshals an instance of AddressPrefixCollection from the specified map of raw messages. +func UnmarshalAddressPrefixCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixCollection) + err = core.UnmarshalModel(m, "address_prefixes", &obj.AddressPrefixes, UnmarshalAddressPrefix) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalAddressPrefixCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalAddressPrefixCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *AddressPrefixCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// AddressPrefixCollectionFirst : A link to the first page of resources. +type AddressPrefixCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalAddressPrefixCollectionFirst unmarshals an instance of AddressPrefixCollectionFirst from the specified map of raw messages. +func UnmarshalAddressPrefixCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AddressPrefixCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type AddressPrefixCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalAddressPrefixCollectionNext unmarshals an instance of AddressPrefixCollectionNext from the specified map of raw messages. +func UnmarshalAddressPrefixCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AddressPrefixPatch : AddressPrefixPatch struct +type AddressPrefixPatch struct { + // Indicates whether this is the default prefix for this zone in this VPC. Updating to true makes this prefix the + // default prefix for this zone in this VPC, provided the VPC currently has no default address prefix for this zone. + // Updating to false removes the default prefix for this zone in this VPC. + IsDefault *bool `json:"is_default,omitempty"` + + // The name for this address prefix. The name must not be used by another address prefix for the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalAddressPrefixPatch unmarshals an instance of AddressPrefixPatch from the specified map of raw messages. +func UnmarshalAddressPrefixPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixPatch) + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the AddressPrefixPatch +func (addressPrefixPatch *AddressPrefixPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(addressPrefixPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// BackupPolicy : BackupPolicy struct +type BackupPolicy struct { + // The date and time that the backup policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this backup policy. + CRN *string `json:"crn" validate:"required"` + + // The URL for this backup policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this backup policy. + ID *string `json:"id" validate:"required"` + + // The date and time that the most recent job for this backup policy completed. + // + // If absent, no job has yet completed for this backup policy. + LastJobCompletedAt *strfmt.DateTime `json:"last_job_completed_at,omitempty"` + + // The lifecycle state of the backup policy. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will + // be subject to the backup policy. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + MatchResourceTypes []string `json:"match_resource_types" validate:"required"` + + // The user tags this backup policy applies to. Resources that have both a matching user tag and a matching type will + // be subject to the backup policy. + MatchUserTags []string `json:"match_user_tags" validate:"required"` + + // The 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"` +} + +// Constants associated with the BackupPolicy.LifecycleState property. +// The lifecycle state of the backup policy. +const ( + BackupPolicyLifecycleStateDeletingConst = "deleting" + BackupPolicyLifecycleStateFailedConst = "failed" + BackupPolicyLifecycleStatePendingConst = "pending" + BackupPolicyLifecycleStateStableConst = "stable" + BackupPolicyLifecycleStateSuspendedConst = "suspended" + BackupPolicyLifecycleStateUpdatingConst = "updating" + BackupPolicyLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BackupPolicy.MatchResourceTypes property. +// The resource type. +const ( + BackupPolicyMatchResourceTypesVolumeConst = "volume" +) + +// Constants associated with the BackupPolicy.ResourceType property. +// The resource type. +const ( + BackupPolicyResourceTypeBackupPolicyConst = "backup_policy" +) + +// UnmarshalBackupPolicy unmarshals an instance of BackupPolicy from the specified map of raw messages. +func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicy) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_resource_types", &obj.MatchResourceTypes) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyCollection : BackupPolicyCollection struct +type BackupPolicyCollection struct { + // Collection of backup policies. + BackupPolicies []BackupPolicy `json:"backup_policies" validate:"required"` + + // A link to the first page of resources. + First *BackupPolicyCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *BackupPolicyCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalBackupPolicyCollection unmarshals an instance of BackupPolicyCollection from the specified map of raw messages. +func UnmarshalBackupPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyCollection) + err = core.UnmarshalModel(m, "backup_policies", &obj.BackupPolicies, UnmarshalBackupPolicy) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BackupPolicyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// BackupPolicyCollectionFirst : A link to the first page of resources. +type BackupPolicyCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBackupPolicyCollectionFirst unmarshals an instance of BackupPolicyCollectionFirst from the specified map of raw messages. +func UnmarshalBackupPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type BackupPolicyCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBackupPolicyCollectionNext unmarshals an instance of BackupPolicyCollectionNext from the specified map of raw messages. +func UnmarshalBackupPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyJob : BackupPolicyJob struct +type BackupPolicyJob struct { + // Indicates whether this backup policy job will be automatically deleted after it completes. At present, this is + // always `true`, but may be modifiable in the future. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // If `auto_delete` is `true`, the days after completion that this backup policy job will be deleted. This value may be + // modifiable in the future. + AutoDeleteAfter *int64 `json:"auto_delete_after" validate:"required"` + + // The backup policy plan operated this backup policy job (may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan" validate:"required"` + + // The date and time that the backup policy job was completed. + // + // If absent, the backup policy job has not yet completed. + CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` + + // The date and time that the backup policy job was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this backup policy job. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this backup policy job. + ID *string `json:"id" validate:"required"` + + // The type of backup policy job. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the + // unexpected property value was encountered. + JobType *string `json:"job_type" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The source this backup was created from (may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + Source BackupPolicyJobSourceIntf `json:"source" validate:"required"` + + // The status of the backup policy job. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []BackupPolicyJobStatusReason `json:"status_reasons" validate:"required"` + + // The snapshots operated on by this backup policy job (may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + TargetSnapshots []SnapshotReference `json:"target_snapshots" validate:"required"` +} + +// Constants associated with the BackupPolicyJob.JobType property. +// The type of backup policy job. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the +// unexpected property value was encountered. +const ( + BackupPolicyJobJobTypeCreationConst = "creation" + BackupPolicyJobJobTypeDeletionConst = "deletion" +) + +// Constants associated with the BackupPolicyJob.ResourceType property. +// The resource type. +const ( + BackupPolicyJobResourceTypeBackupPolicyJobConst = "backup_policy_job" +) + +// Constants associated with the BackupPolicyJob.Status property. +// The status of the backup policy job. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the +// unexpected property value was encountered. +const ( + BackupPolicyJobStatusFailedConst = "failed" + BackupPolicyJobStatusRunningConst = "running" + BackupPolicyJobStatusSucceededConst = "succeeded" +) + +// UnmarshalBackupPolicyJob unmarshals an instance of BackupPolicyJob from the specified map of raw messages. +func UnmarshalBackupPolicyJob(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJob) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_after", &obj.AutoDeleteAfter) + if err != nil { + return + } + err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "job_type", &obj.JobType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalBackupPolicyJobSource) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBackupPolicyJobStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target_snapshots", &obj.TargetSnapshots, UnmarshalSnapshotReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyJobCollection : BackupPolicyJobCollection struct +type BackupPolicyJobCollection struct { + // A link to the first page of resources. + First *BackupPolicyJobCollectionFirst `json:"first" validate:"required"` + + // Collection of backup policy jobs. + Jobs []BackupPolicyJob `json:"jobs" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *BackupPolicyJobCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalBackupPolicyJobCollection unmarshals an instance of BackupPolicyJobCollection from the specified map of raw messages. +func UnmarshalBackupPolicyJobCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyJobCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "jobs", &obj.Jobs, UnmarshalBackupPolicyJob) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyJobCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BackupPolicyJobCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// BackupPolicyJobCollectionFirst : A link to the first page of resources. +type BackupPolicyJobCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBackupPolicyJobCollectionFirst unmarshals an instance of BackupPolicyJobCollectionFirst from the specified map of raw messages. +func UnmarshalBackupPolicyJobCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyJobCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type BackupPolicyJobCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBackupPolicyJobCollectionNext unmarshals an instance of BackupPolicyJobCollectionNext from the specified map of raw messages. +func UnmarshalBackupPolicyJobCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyJobSource : The source this backup was created from (may be +// [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). +// Models which "extend" this model: +// - BackupPolicyJobSourceVolumeReference +type BackupPolicyJobSource struct { + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` + + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The name for this volume. The name is unique across all volumes in the region. + Name *string `json:"name,omitempty"` + + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *VolumeRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the BackupPolicyJobSource.ResourceType property. +// The resource type. +const ( + BackupPolicyJobSourceResourceTypeVolumeConst = "volume" +) + +func (*BackupPolicyJobSource) isaBackupPolicyJobSource() bool { + return true +} + +type BackupPolicyJobSourceIntf interface { + isaBackupPolicyJobSource() bool +} + +// UnmarshalBackupPolicyJobSource unmarshals an instance of BackupPolicyJobSource from the specified map of raw messages. +func UnmarshalBackupPolicyJobSource(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobSource) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyJobStatusReason : BackupPolicyJobStatusReason struct +type BackupPolicyJobStatusReason struct { + // A snake case string succinctly identifying the status reason: + // - `internal_error`: Internal error (contact IBM support) + // - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state + // - `snapshot_volume_limit`: The snapshot limit for the source volume has been reached + // - `source_volume_busy`: The source volume has `busy` set (after multiple retries). + Code *string `json:"code" validate:"required"` + + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the BackupPolicyJobStatusReason.Code property. +// A snake case string succinctly identifying the status reason: +// - `internal_error`: Internal error (contact IBM support) +// - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state +// - `snapshot_volume_limit`: The snapshot limit for the source volume has been reached +// - `source_volume_busy`: The source volume has `busy` set (after multiple retries). +const ( + BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" + BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" + BackupPolicyJobStatusReasonCodeSnapshotVolumeLimitConst = "snapshot_volume_limit" + BackupPolicyJobStatusReasonCodeSourceVolumeBusyConst = "source_volume_busy" +) + +// UnmarshalBackupPolicyJobStatusReason unmarshals an instance of BackupPolicyJobStatusReason from the specified map of raw messages. +func UnmarshalBackupPolicyJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPatch : BackupPolicyPatch struct +type BackupPolicyPatch struct { + // The user tags this backup policy applies to (replacing any existing tags). Resources that have both a matching user + // tag and a matching type will be subject to the backup policy. + MatchUserTags []string `json:"match_user_tags,omitempty"` + + // The name for this backup policy. The name must not be used by another backup policy in the region. + Name *string `json:"name,omitempty"` +} + +// UnmarshalBackupPolicyPatch unmarshals an instance of BackupPolicyPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPatch) + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the BackupPolicyPatch +func (backupPolicyPatch *BackupPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(backupPolicyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// BackupPolicyPlan : BackupPolicyPlan struct +type BackupPolicyPlan struct { + // Indicates whether the plan is active. + Active *bool `json:"active" validate:"required"` + + // The user tags to attach to backups (snapshots) created by this plan. + AttachUserTags []string `json:"attach_user_tags" validate:"required"` + + ClonePolicy *BackupPolicyPlanClonePolicy `json:"clone_policy" validate:"required"` + + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags" validate:"required"` + + // The date and time that the backup policy plan was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The cron specification for the backup schedule. The backup policy jobs + // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes + // after this time. + // + // All backup schedules for plans in the same policy must be at least an hour apart. + CronSpec *string `json:"cron_spec" validate:"required"` + + DeletionTrigger *BackupPolicyPlanDeletionTrigger `json:"deletion_trigger" validate:"required"` + + // The URL for this backup policy plan. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this backup policy plan. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of this backup policy plan. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this backup policy plan. The name is unique across all plans in the backup policy. + Name *string `json:"name" validate:"required"` + + // The policies for additional backups in remote regions. + RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicy `json:"remote_region_policies" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyPlan.LifecycleState property. +// The lifecycle state of this backup policy plan. +const ( + BackupPolicyPlanLifecycleStateDeletingConst = "deleting" + BackupPolicyPlanLifecycleStateFailedConst = "failed" + BackupPolicyPlanLifecycleStatePendingConst = "pending" + BackupPolicyPlanLifecycleStateStableConst = "stable" + BackupPolicyPlanLifecycleStateSuspendedConst = "suspended" + BackupPolicyPlanLifecycleStateUpdatingConst = "updating" + BackupPolicyPlanLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BackupPolicyPlan.ResourceType property. +// The resource type. +const ( + BackupPolicyPlanResourceTypeBackupPolicyPlanConst = "backup_policy_plan" +) + +// UnmarshalBackupPolicyPlan unmarshals an instance of BackupPolicyPlan from the specified map of raw messages. +func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlan) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTrigger) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanClonePolicy : BackupPolicyPlanClonePolicy struct +type BackupPolicyPlanClonePolicy struct { + // The maximum number of recent snapshots (per source) that will keep clones. + MaxSnapshots *int64 `json:"max_snapshots" validate:"required"` + + // The zone this backup policy plan will create snapshot clones in. + Zones []ZoneReference `json:"zones" validate:"required"` +} + +// UnmarshalBackupPolicyPlanClonePolicy unmarshals an instance of BackupPolicyPlanClonePolicy from the specified map of raw messages. +func UnmarshalBackupPolicyPlanClonePolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanClonePolicy) + err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanClonePolicyPatch : BackupPolicyPlanClonePolicyPatch struct +type BackupPolicyPlanClonePolicyPatch struct { + // The maximum number of recent snapshots (per source) that will keep clones. + MaxSnapshots *int64 `json:"max_snapshots,omitempty"` + + // The zones this backup policy plan will create snapshot clones in. Updating this value does not change the clones for + // snapshots that have already been created by this plan. + Zones []ZoneIdentityIntf `json:"zones,omitempty"` +} + +// UnmarshalBackupPolicyPlanClonePolicyPatch unmarshals an instance of BackupPolicyPlanClonePolicyPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPlanClonePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanClonePolicyPatch) + err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanClonePolicyPrototype : BackupPolicyPlanClonePolicyPrototype struct +type BackupPolicyPlanClonePolicyPrototype struct { + // The maximum number of recent snapshots (per source) that will keep clones. + MaxSnapshots *int64 `json:"max_snapshots,omitempty"` + + // The zone this backup policy plan will create snapshot clones in. + Zones []ZoneIdentityIntf `json:"zones" validate:"required"` +} + +// NewBackupPolicyPlanClonePolicyPrototype : Instantiate BackupPolicyPlanClonePolicyPrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPlanClonePolicyPrototype(zones []ZoneIdentityIntf) (_model *BackupPolicyPlanClonePolicyPrototype, err error) { + _model = &BackupPolicyPlanClonePolicyPrototype{ + Zones: zones, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalBackupPolicyPlanClonePolicyPrototype unmarshals an instance of BackupPolicyPlanClonePolicyPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPlanClonePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanClonePolicyPrototype) + err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanCollection : BackupPolicyPlanCollection struct +type BackupPolicyPlanCollection struct { + // Collection of backup policy plans. + Plans []BackupPolicyPlan `json:"plans" validate:"required"` +} + +// UnmarshalBackupPolicyPlanCollection unmarshals an instance of BackupPolicyPlanCollection from the specified map of raw messages. +func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanCollection) + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanDeletionTrigger : BackupPolicyPlanDeletionTrigger struct +type BackupPolicyPlanDeletionTrigger struct { + // The maximum number of days to keep each backup after creation. + DeleteAfter *int64 `json:"delete_after" validate:"required"` + + // The maximum number of recent backups to keep. If absent, there is no maximum. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` +} + +// UnmarshalBackupPolicyPlanDeletionTrigger unmarshals an instance of BackupPolicyPlanDeletionTrigger from the specified map of raw messages. +func UnmarshalBackupPolicyPlanDeletionTrigger(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanDeletionTrigger) + err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanDeletionTriggerPatch : BackupPolicyPlanDeletionTriggerPatch struct +type BackupPolicyPlanDeletionTriggerPatch struct { + // The maximum number of days to keep each backup after creation. + DeleteAfter *int64 `json:"delete_after,omitempty"` + + // The maximum number of recent backups to keep. Specify `null` to remove any existing maximum. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` +} + +// UnmarshalBackupPolicyPlanDeletionTriggerPatch unmarshals an instance of BackupPolicyPlanDeletionTriggerPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPlanDeletionTriggerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanDeletionTriggerPatch) + err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanDeletionTriggerPrototype : BackupPolicyPlanDeletionTriggerPrototype struct +type BackupPolicyPlanDeletionTriggerPrototype struct { + // The maximum number of days to keep each backup after creation. + DeleteAfter *int64 `json:"delete_after,omitempty"` + + // The maximum number of recent backups to keep. If unspecified, there will be no maximum. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` +} + +// UnmarshalBackupPolicyPlanDeletionTriggerPrototype unmarshals an instance of BackupPolicyPlanDeletionTriggerPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPlanDeletionTriggerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanDeletionTriggerPrototype) + err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanPatch : BackupPolicyPlanPatch struct +type BackupPolicyPlanPatch struct { + // Indicates whether the plan is active. + Active *bool `json:"active,omitempty"` + + // The user tags to attach to backups (snapshots) created by this plan. Updating this value does not change the user + // tags for backups that have already been created by this plan. + AttachUserTags []string `json:"attach_user_tags,omitempty"` + + ClonePolicy *BackupPolicyPlanClonePolicyPatch `json:"clone_policy,omitempty"` + + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags,omitempty"` + + // The cron specification for the backup schedule. The backup policy jobs + // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes + // after this time. + // + // All backup schedules for plans in the same policy must be at least an hour apart. + CronSpec *string `json:"cron_spec,omitempty"` + + DeletionTrigger *BackupPolicyPlanDeletionTriggerPatch `json:"deletion_trigger,omitempty"` + + // The name for this backup policy plan. The name must not be used by another plan for the backup policy. + Name *string `json:"name,omitempty"` + + // The policies for additional backups in remote regions (replacing any existing policies). + RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` +} + +// UnmarshalBackupPolicyPlanPatch unmarshals an instance of BackupPolicyPlanPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanPatch) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the BackupPolicyPlanPatch +func (backupPolicyPlanPatch *BackupPolicyPlanPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(backupPolicyPlanPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// BackupPolicyPlanPrototype : BackupPolicyPlanPrototype struct +type BackupPolicyPlanPrototype struct { + // Indicates whether the plan is active. + Active *bool `json:"active,omitempty"` + + // User tags to attach to each backup (snapshot) created by this plan. If unspecified, no user tags will be attached. + AttachUserTags []string `json:"attach_user_tags,omitempty"` + + ClonePolicy *BackupPolicyPlanClonePolicyPrototype `json:"clone_policy,omitempty"` + + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags,omitempty"` + + // The cron specification for the backup schedule. The backup policy jobs + // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes + // after this time. + // + // All backup schedules for plans in the same policy must be at least an hour apart. + CronSpec *string `json:"cron_spec" validate:"required"` + + DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` + + // The name for this backup policy plan. The name must not be used by another plan for the backup policy. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The policies for additional backups in remote regions. + RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` +} + +// NewBackupPolicyPlanPrototype : Instantiate BackupPolicyPlanPrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPlanPrototype(cronSpec string) (_model *BackupPolicyPlanPrototype, err error) { + _model = &BackupPolicyPlanPrototype{ + CronSpec: core.StringPtr(cronSpec), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalBackupPolicyPlanPrototype unmarshals an instance of BackupPolicyPlanPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanPrototype) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanReference : BackupPolicyPlanReference struct +type BackupPolicyPlanReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BackupPolicyPlanReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this backup policy plan. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this backup policy plan. + ID *string `json:"id" validate:"required"` + + // The name for this backup policy plan. The name is unique across all plans in the backup policy. + Name *string `json:"name" validate:"required"` + + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *BackupPolicyPlanRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyPlanReference.ResourceType property. +// The resource type. +const ( + BackupPolicyPlanReferenceResourceTypeBackupPolicyPlanConst = "backup_policy_plan" +) + +// UnmarshalBackupPolicyPlanReference unmarshals an instance of BackupPolicyPlanReference from the specified map of raw messages. +func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBackupPolicyPlanReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalBackupPolicyPlanRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BackupPolicyPlanReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBackupPolicyPlanReferenceDeleted unmarshals an instance of BackupPolicyPlanReferenceDeleted from the specified map of raw messages. +func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type BackupPolicyPlanRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalBackupPolicyPlanRemote unmarshals an instance of BackupPolicyPlanRemote from the specified map of raw messages. +func UnmarshalBackupPolicyPlanRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanRemote) + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanRemoteRegionPolicy : BackupPolicyPlanRemoteRegionPolicy struct +type BackupPolicyPlanRemoteRegionPolicy struct { + // The region this backup policy plan will create backups in. + DeleteOverCount *int64 `json:"delete_over_count" validate:"required"` + + // The root key used to rewrap the data encryption key for the backup (snapshot). + EncryptionKey *EncryptionKeyReference `json:"encryption_key" validate:"required"` + + // The region this backup policy plan will create backups in. + Region *RegionReference `json:"region" validate:"required"` +} + +// UnmarshalBackupPolicyPlanRemoteRegionPolicy unmarshals an instance of BackupPolicyPlanRemoteRegionPolicy from the specified map of raw messages. +func UnmarshalBackupPolicyPlanRemoteRegionPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanRemoteRegionPolicy) + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanRemoteRegionPolicyPrototype : BackupPolicyPlanRemoteRegionPolicyPrototype struct +type BackupPolicyPlanRemoteRegionPolicyPrototype struct { + // The region this backup policy plan will create backups in. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` + + // The root key to use to rewrap the data encryption key for the backup (snapshot). + // + // If unspecified, the source's `encryption_key` will be used. + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The region this backup policy plan will create backups in. + Region RegionIdentityIntf `json:"region" validate:"required"` +} + +// NewBackupPolicyPlanRemoteRegionPolicyPrototype : Instantiate BackupPolicyPlanRemoteRegionPolicyPrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPlanRemoteRegionPolicyPrototype(region RegionIdentityIntf) (_model *BackupPolicyPlanRemoteRegionPolicyPrototype, err error) { + _model = &BackupPolicyPlanRemoteRegionPolicyPrototype{ + Region: region, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype unmarshals an instance of BackupPolicyPlanRemoteRegionPolicyPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanRemoteRegionPolicyPrototype) + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServer : BareMetalServer struct +type BareMetalServer struct { + // The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // The possible resource types for this property are expected to expand in the future. + BootTarget BareMetalServerBootTargetIntf `json:"boot_target" validate:"required"` + + // The bare metal server CPU configuration. + Cpu *BareMetalServerCpu `json:"cpu" validate:"required"` + + // The date and time that the bare metal server was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this bare metal server. + CRN *string `json:"crn" validate:"required"` + + // The disks for this bare metal server, including any disks that are associated with the + // `boot_target`. + Disks []BareMetalServerDisk `json:"disks" validate:"required"` + + // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to + // boot. + EnableSecureBoot *bool `json:"enable_secure_boot" validate:"required"` + + // The URL for this bare metal server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server. + ID *string `json:"id" validate:"required"` + + // The reasons for the current `lifecycle_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []BareMetalServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the bare metal server. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The amount of memory, truncated to whole gibibytes. + Memory *int64 `json:"memory" validate:"required"` + + // The name for this bare metal server. The name is unique across all bare metal servers in the region. + Name *string `json:"name" validate:"required"` + + // The network attachments for this bare metal server, including the primary network attachment. + NetworkAttachments []BareMetalServerNetworkAttachmentReference `json:"network_attachments,omitempty"` + + // The network interfaces for this bare metal server, including the primary network interface. + // Deprecated: this field is deprecated and may be removed in a future release. + NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces,omitempty"` + + // The primary network attachment. + PrimaryNetworkAttachment *BareMetalServerNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterface `json:"primary_network_interface,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) + // for this bare metal server. + Profile *BareMetalServerProfileReference `json:"profile" validate:"required"` + + // The resource group for this bare metal server. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the bare metal server. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []BareMetalServerStatusReason `json:"status_reasons" validate:"required"` + + TrustedPlatformModule *BareMetalServerTrustedPlatformModule `json:"trusted_platform_module" validate:"required"` + + // The VPC this bare metal server resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this bare metal server resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the BareMetalServer.LifecycleState property. +// The lifecycle state of the bare metal server. +const ( + BareMetalServerLifecycleStateDeletingConst = "deleting" + BareMetalServerLifecycleStateFailedConst = "failed" + BareMetalServerLifecycleStatePendingConst = "pending" + BareMetalServerLifecycleStateStableConst = "stable" + BareMetalServerLifecycleStateSuspendedConst = "suspended" + BareMetalServerLifecycleStateUpdatingConst = "updating" + BareMetalServerLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BareMetalServer.ResourceType property. +// The resource type. +const ( + BareMetalServerResourceTypeBareMetalServerConst = "bare_metal_server" +) + +// Constants associated with the BareMetalServer.Status property. +// The status of the bare metal server. +const ( + BareMetalServerStatusDeletingConst = "deleting" + BareMetalServerStatusFailedConst = "failed" + BareMetalServerStatusMaintenanceConst = "maintenance" + BareMetalServerStatusPendingConst = "pending" + BareMetalServerStatusRestartingConst = "restarting" + BareMetalServerStatusRunningConst = "running" + BareMetalServerStatusStartingConst = "starting" + BareMetalServerStatusStoppedConst = "stopped" + BareMetalServerStatusStoppingConst = "stopping" +) + +// UnmarshalBareMetalServer unmarshals an instance of BareMetalServer from the specified map of raw messages. +func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServer) + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_target", &obj.BootTarget, UnmarshalBareMetalServerBootTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu", &obj.Cpu, UnmarshalBareMetalServerCpu) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalBareMetalServerLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerNetworkAttachmentReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBareMetalServerStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerBootTarget : The possible resource types for this property are expected to expand in the future. +// Models which "extend" this model: +// - BareMetalServerBootTargetBareMetalServerDiskReference +type BareMetalServerBootTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this bare metal server disk. + Href *string `json:"href,omitempty"` + + // The unique identifier for this bare metal server disk. + ID *string `json:"id,omitempty"` + + // The name for this bare metal server disk. The name is unique across all disks on the bare metal server. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the BareMetalServerBootTarget.ResourceType property. +// The resource type. +const ( + BareMetalServerBootTargetResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" +) + +func (*BareMetalServerBootTarget) isaBareMetalServerBootTarget() bool { + return true +} + +type BareMetalServerBootTargetIntf interface { + isaBareMetalServerBootTarget() bool +} + +// UnmarshalBareMetalServerBootTarget unmarshals an instance of BareMetalServerBootTarget from the specified map of raw messages. +func UnmarshalBareMetalServerBootTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerBootTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerCpu : The bare metal server CPU configuration. +type BareMetalServerCpu struct { + // The CPU architecture. + Architecture *string `json:"architecture" validate:"required"` + + // The total number of cores. + CoreCount *int64 `json:"core_count" validate:"required"` + + // The total number of CPU sockets. + SocketCount *int64 `json:"socket_count" validate:"required"` + + // The total number of hardware threads per core. + ThreadsPerCore *int64 `json:"threads_per_core" validate:"required"` +} + +// UnmarshalBareMetalServerCpu unmarshals an instance of BareMetalServerCpu from the specified map of raw messages. +func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerCpu) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "core_count", &obj.CoreCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "threads_per_core", &obj.ThreadsPerCore) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerCollection : BareMetalServerCollection struct +type BareMetalServerCollection struct { + // Collection of bare metal servers. + BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` + + // A link to the first page of resources. + First *BareMetalServerCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *BareMetalServerCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalBareMetalServerCollection unmarshals an instance of BareMetalServerCollection from the specified map of raw messages. +func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerCollection) + err = core.UnmarshalModel(m, "bare_metal_servers", &obj.BareMetalServers, UnmarshalBareMetalServer) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BareMetalServerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// BareMetalServerCollectionFirst : A link to the first page of resources. +type BareMetalServerCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBareMetalServerCollectionFirst unmarshals an instance of BareMetalServerCollectionFirst from the specified map of raw messages. +func UnmarshalBareMetalServerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type BareMetalServerCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBareMetalServerCollectionNext unmarshals an instance of BareMetalServerCollectionNext from the specified map of raw messages. +func UnmarshalBareMetalServerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerConsoleAccessToken : The bare metal server console access token information. +type BareMetalServerConsoleAccessToken struct { + // A URL safe single-use token used to access the console WebSocket. + AccessToken *string `json:"access_token" validate:"required"` + + // The bare metal server console type for which this token may be used. + ConsoleType *string `json:"console_type" validate:"required"` + + // The date and time that the access token was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The date and time that the access token will expire. + ExpiresAt *strfmt.DateTime `json:"expires_at" validate:"required"` + + // Indicates whether to disconnect an existing serial console session as the serial console cannot be shared. This has + // no effect on VNC consoles. + Force *bool `json:"force" validate:"required"` + + // The URL to access this bare metal server console. + Href *string `json:"href" validate:"required"` +} + +// Constants associated with the BareMetalServerConsoleAccessToken.ConsoleType property. +// The bare metal server console type for which this token may be used. +const ( + BareMetalServerConsoleAccessTokenConsoleTypeSerialConst = "serial" + BareMetalServerConsoleAccessTokenConsoleTypeVncConst = "vnc" +) + +// UnmarshalBareMetalServerConsoleAccessToken unmarshals an instance of BareMetalServerConsoleAccessToken from the specified map of raw messages. +func UnmarshalBareMetalServerConsoleAccessToken(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerConsoleAccessToken) + err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "force", &obj.Force) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerDisk : BareMetalServerDisk struct +type BareMetalServerDisk struct { + // The date and time that the disk was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this bare metal server disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server disk. + ID *string `json:"id" validate:"required"` + + // The disk interface used for attaching the disk. + // + // - `fcp`: Attached using Fiber Channel Protocol + // - `sata`: Attached using Serial Advanced Technology Attachment + // - `nvme`: Attached using Non-Volatile Memory Express + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The name for this bare metal server disk. The name is unique across all disks on the bare metal server. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *int64 `json:"size" validate:"required"` +} + +// Constants associated with the BareMetalServerDisk.InterfaceType property. +// The disk interface used for attaching the disk. +// +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerDiskInterfaceTypeFcpConst = "fcp" + BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" + BareMetalServerDiskInterfaceTypeSataConst = "sata" +) + +// Constants associated with the BareMetalServerDisk.ResourceType property. +// The resource type. +const ( + BareMetalServerDiskResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" +) + +// UnmarshalBareMetalServerDisk unmarshals an instance of BareMetalServerDisk from the specified map of raw messages. +func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDisk) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerDiskCollection : BareMetalServerDiskCollection struct +type BareMetalServerDiskCollection struct { + // Collection of the bare metal server's disks. + Disks []BareMetalServerDisk `json:"disks" validate:"required"` +} + +// UnmarshalBareMetalServerDiskCollection unmarshals an instance of BareMetalServerDiskCollection from the specified map of raw messages. +func UnmarshalBareMetalServerDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDiskCollection) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerDiskPatch : BareMetalServerDiskPatch struct +type BareMetalServerDiskPatch struct { + // The name for this bare metal server disk. The name must not be used by another disk on the bare metal server. + Name *string `json:"name,omitempty"` +} + +// UnmarshalBareMetalServerDiskPatch unmarshals an instance of BareMetalServerDiskPatch from the specified map of raw messages. +func UnmarshalBareMetalServerDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDiskPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the BareMetalServerDiskPatch +func (bareMetalServerDiskPatch *BareMetalServerDiskPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(bareMetalServerDiskPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// BareMetalServerDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerDiskReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerDiskReferenceDeleted unmarshals an instance of BareMetalServerDiskReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDiskReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerInitialization : BareMetalServerInitialization struct +type BareMetalServerInitialization struct { + // The image the bare metal server was provisioned from. + Image *ImageReference `json:"image" validate:"required"` + + // The public SSH keys used at initialization. + Keys []KeyReference `json:"keys" validate:"required"` + + // The user accounts that are created at initialization. There can be multiple account types distinguished by the + // `resource_type` property. + UserAccounts []BareMetalServerInitializationUserAccountIntf `json:"user_accounts" validate:"required"` +} + +// UnmarshalBareMetalServerInitialization unmarshals an instance of BareMetalServerInitialization from the specified map of raw messages. +func UnmarshalBareMetalServerInitialization(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitialization) + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerInitializationPrototype : BareMetalServerInitializationPrototype struct +type BareMetalServerInitializationPrototype struct { + // The image to be used when provisioning the bare metal server. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The public SSH keys to install on the bare metal server. Keys will be made available to the bare metal server as + // cloud-init vendor data. For cloud-init enabled images, these keys will also be added as SSH authorized keys for the + // administrative user. + // + // For Windows images, at least one key must be specified, and one will be chosen to encrypt the administrator + // password. Keys are optional for other images, but if no keys are specified, the instance will be inaccessible unless + // the specified image provides another means of access. + Keys []KeyIdentityIntf `json:"keys" validate:"required"` + + // User data to be made available when initializing the bare metal server. + UserData *string `json:"user_data,omitempty"` +} + +// NewBareMetalServerInitializationPrototype : Instantiate BareMetalServerInitializationPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerInitializationPrototype(image ImageIdentityIntf, keys []KeyIdentityIntf) (_model *BareMetalServerInitializationPrototype, err error) { + _model = &BareMetalServerInitializationPrototype{ + Image: image, + Keys: keys, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalBareMetalServerInitializationPrototype unmarshals an instance of BareMetalServerInitializationPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerInitializationPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitializationPrototype) + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerInitializationUserAccount : BareMetalServerInitializationUserAccount struct +// Models which "extend" this model: +// - BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount +type BareMetalServerInitializationUserAccount struct { + // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + EncryptedPassword *[]byte `json:"encrypted_password,omitempty"` + + // The public SSH key used to encrypt the password. + EncryptionKey *KeyReference `json:"encryption_key,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The username for the account created at initialization. + Username *string `json:"username,omitempty"` +} + +// Constants associated with the BareMetalServerInitializationUserAccount.ResourceType property. +// The resource type. +const ( + BareMetalServerInitializationUserAccountResourceTypeHostUserAccountConst = "host_user_account" +) + +func (*BareMetalServerInitializationUserAccount) isaBareMetalServerInitializationUserAccount() bool { + return true +} + +type BareMetalServerInitializationUserAccountIntf interface { + isaBareMetalServerInitializationUserAccount() bool +} + +// UnmarshalBareMetalServerInitializationUserAccount unmarshals an instance of BareMetalServerInitializationUserAccount from the specified map of raw messages. +func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitializationUserAccount) + err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerLifecycleReason : BareMetalServerLifecycleReason struct +type BareMetalServerLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + Code *string `json:"code" validate:"required"` + + // An explanation of the reason for this lifecycle state. + Message *string `json:"message" validate:"required"` + + // Link to documentation about the reason for this lifecycle state. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the BareMetalServerLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + BareMetalServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalBareMetalServerLifecycleReason unmarshals an instance of BareMetalServerLifecycleReason from the specified map of raw messages. +func UnmarshalBareMetalServerLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachment : BareMetalServerNetworkAttachment struct +// Models which "extend" this model: +// - BareMetalServerNetworkAttachmentByHiperSocket +// - BareMetalServerNetworkAttachmentByPci +// - BareMetalServerNetworkAttachmentByVlan +type BareMetalServerNetworkAttachment struct { + // The date and time that the network attachment was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network attachment. + ID *string `json:"id" validate:"required"` + + // The network attachment's interface type: + // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity + // within a `s390x` based system + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI attachment + // - Cannot directly use an IEEE 802.1q VLAN tag. + // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its + // array of `allowed_vlans`. + // - Must use an IEEE 802.1q tag. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The lifecycle state of the network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + Name *string `json:"name" validate:"required"` + + // The port speed for this network attachment in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IP address of the virtual network interface for the 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 network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // This bare metal server network attachment's interface type. + Type *string `json:"type" validate:"required"` + + // The virtual network interface for this network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` + + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // Indicates if the network attachment can automatically float to any other server within the same `resource_group`. + // The network attachment will float automatically if the network detects a GARP or RARP on another bare metal server + // in the resource group. Applies only to network attachments with `vlan` interface type. + AllowToFloat *bool `json:"allow_to_float,omitempty"` + + // Indicates the 802.1Q VLAN ID tag 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: +// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// within a `s390x` based system +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI attachment +// - Cannot directly use an IEEE 802.1q VLAN tag. +// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its +// array of `allowed_vlans`. +// - Must use an IEEE 802.1q tag. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerNetworkAttachmentInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkAttachmentInterfaceTypePciConst = "pci" + BareMetalServerNetworkAttachmentInterfaceTypeVlanConst = "vlan" +) + +// Constants associated with the BareMetalServerNetworkAttachment.LifecycleState property. +// The lifecycle state of the 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. +// This bare metal server network attachment's interface type. +const ( + BareMetalServerNetworkAttachmentTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentTypeSecondaryConst = "secondary" +) + +func (*BareMetalServerNetworkAttachment) isaBareMetalServerNetworkAttachment() bool { + return true +} + +type BareMetalServerNetworkAttachmentIntf interface { + isaBareMetalServerNetworkAttachment() bool +} + +// UnmarshalBareMetalServerNetworkAttachment unmarshals an instance of BareMetalServerNetworkAttachment from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "interface_type", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + return + } + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkAttachmentByHiperSocket) + } else if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkAttachmentByPci) + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkAttachmentByVlan) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + } + return +} + +// BareMetalServerNetworkAttachmentCollection : BareMetalServerNetworkAttachmentCollection struct +type BareMetalServerNetworkAttachmentCollection struct { + // A link to the first page of resources. + First *BareMetalServerNetworkAttachmentCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of network attachments. + NetworkAttachments []BareMetalServerNetworkAttachmentIntf `json:"network_attachments" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *BareMetalServerNetworkAttachmentCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkAttachmentCollection unmarshals an instance of BareMetalServerNetworkAttachmentCollection from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerNetworkAttachmentCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkAttachmentCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BareMetalServerNetworkAttachmentCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// BareMetalServerNetworkAttachmentCollectionFirst : A link to the first page of resources. +type BareMetalServerNetworkAttachmentCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkAttachmentCollectionFirst unmarshals an instance of BareMetalServerNetworkAttachmentCollectionFirst from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type BareMetalServerNetworkAttachmentCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkAttachmentCollectionNext unmarshals an instance of BareMetalServerNetworkAttachmentCollectionNext from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPatch : BareMetalServerNetworkAttachmentPatch struct +type BareMetalServerNetworkAttachmentPatch struct { + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // The name for this network attachment. The name must not be used by another network attachment for the bare metal + // server. + Name *string `json:"name,omitempty"` +} + +// UnmarshalBareMetalServerNetworkAttachmentPatch unmarshals an instance of BareMetalServerNetworkAttachmentPatch from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPatch) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the BareMetalServerNetworkAttachmentPatch +func (bareMetalServerNetworkAttachmentPatch *BareMetalServerNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(bareMetalServerNetworkAttachmentPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// BareMetalServerNetworkAttachmentPrototype : BareMetalServerNetworkAttachmentPrototype struct +// Models which "extend" this model: +// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype +// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype +// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype +type BareMetalServerNetworkAttachmentPrototype struct { + // The network attachment's interface type: + // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity + // within a `s390x` based system + // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI attachment + // - Cannot directly use an IEEE 802.1q VLAN tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x` + // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its + // array of `allowed_vlans`. + // - Must use an IEEE 802.1q tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The name for this 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 network attachment. This can be specified using an + // existing virtual network interface, or a prototype object for a new virtual network + // interface. + VirtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // Indicates if the network attachment can automatically float to any other server within the same `resource_group`. + // The network attachment will float automatically if the network detects a GARP or RARP on another bare metal server + // in the resource group. Applies only to network attachments with `vlan` interface type. + AllowToFloat *bool `json:"allow_to_float,omitempty"` + + // Indicates the 802.1Q VLAN ID tag 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: +// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// within a `s390x` based system +// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI attachment +// - Cannot directly use an IEEE 802.1q VLAN tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x` +// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its +// array of `allowed_vlans`. +// - Must use an IEEE 802.1q tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerNetworkAttachmentPrototypeInterfaceTypeHipersocketConst = "hipersocket" + 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) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "interface_type", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + return + } + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype) + } else if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + } + return +} + +// BareMetalServerNetworkAttachmentReference : BareMetalServerNetworkAttachmentReference struct +type BareMetalServerNetworkAttachmentReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network attachment. + ID *string `json:"id" validate:"required"` + + Name *string `json:"name" validate:"required"` + + // The primary IP address of the virtual network interface for the 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 network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkAttachmentReference.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkAttachmentReferenceResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" +) + +// UnmarshalBareMetalServerNetworkAttachmentReference unmarshals an instance of BareMetalServerNetworkAttachmentReference from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkAttachmentReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted unmarshals an instance of BareMetalServerNetworkAttachmentReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted unmarshals an instance of BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct +// Models which "extend" this model: +// - BareMetalServerNetworkInterfaceByHiperSocket +// - BareMetalServerNetworkInterfaceByPci +// - BareMetalServerNetworkInterfaceByVlan +type BareMetalServerNetworkInterface struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // The date and time that the network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The floating IPs associated with this network interface. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The network interface type: + // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity + // within a `s390x` based system + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI interface + // - Cannot directly use an IEEE 802.1q VLAN tag. + // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its + // array of `allowed_vlans`. + // - Must use an IEEE 802.1q tag. + // - Has its own security groups and does not inherit those of the PCI device through + // which traffic flows. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The MAC address of the interface. If absent, the value is not known. + MacAddress *string `json:"mac_address" validate:"required"` + + // The name for this network interface. + Name *string `json:"name" validate:"required"` + + // The network interface port speed in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups targeting this network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the network interface. + Status *string `json:"status" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The type of this bare metal server network interface. + Type *string `json:"type" validate:"required"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // Indicates if the interface can float to any other server within the same + // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal + // server in the resource group. Applies only to `vlan` type interfaces. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + + // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + Vlan *int64 `json:"vlan,omitempty"` +} + +// Constants associated with the BareMetalServerNetworkInterface.InterfaceType property. +// The network interface type: +// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// within a `s390x` based system +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI interface +// - Cannot directly use an IEEE 802.1q VLAN tag. +// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its +// array of `allowed_vlans`. +// - Must use an IEEE 802.1q tag. +// - Has its own security groups and does not inherit those of the PCI device through +// which traffic flows. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerNetworkInterfaceInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan" +) + +// Constants associated with the BareMetalServerNetworkInterface.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterface.Status property. +// The status of the network interface. +const ( + BareMetalServerNetworkInterfaceStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterface.Type property. +// The type of this bare metal server network interface. +const ( + BareMetalServerNetworkInterfaceTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceTypeSecondaryConst = "secondary" +) + +func (*BareMetalServerNetworkInterface) isaBareMetalServerNetworkInterface() bool { + return true +} + +type BareMetalServerNetworkInterfaceIntf interface { + isaBareMetalServerNetworkInterface() bool +} + +// UnmarshalBareMetalServerNetworkInterface unmarshals an instance of BareMetalServerNetworkInterface from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "interface_type", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + return + } + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByHiperSocket) + } else if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci) + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + } + return +} + +// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct +type BareMetalServerNetworkInterfaceCollection struct { + // A link to the first page of resources. + First *BareMetalServerNetworkInterfaceCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of network interfaces. + NetworkInterfaces []BareMetalServerNetworkInterfaceIntf `json:"network_interfaces" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *BareMetalServerNetworkInterfaceCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceCollection unmarshals an instance of BareMetalServerNetworkInterfaceCollection from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerNetworkInterfaceCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// BareMetalServerNetworkInterfaceCollectionFirst : A link to the first page of resources. +type BareMetalServerNetworkInterfaceCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceCollectionFirst unmarshals an instance of BareMetalServerNetworkInterfaceCollectionFirst from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type BareMetalServerNetworkInterfaceCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceCollectionNext unmarshals an instance of BareMetalServerNetworkInterfaceCollectionNext from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct +type BareMetalServerNetworkInterfacePatch struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The name for this network interface. The name must not be used by another network interface on the bare metal + // server. + Name *string `json:"name,omitempty"` +} + +// UnmarshalBareMetalServerNetworkInterfacePatch unmarshals an instance of BareMetalServerNetworkInterfacePatch from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the BareMetalServerNetworkInterfacePatch +func (bareMetalServerNetworkInterfacePatch *BareMetalServerNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(bareMetalServerNetworkInterfacePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct +// Models which "extend" this model: +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype +type BareMetalServerNetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The network interface type: + // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity + // within a `s390x` based system + // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI interface + // - Cannot directly use an IEEE 802.1q VLAN tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x` + // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its + // array of `allowed_vlans`. + // - Must use an IEEE 802.1q tag. + // - Has its own security groups and does not inherit those of the PCI device through + // which traffic flows. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The name for this network interface. The name must not be used by another network interface on the bare metal + // server. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the network interface. This can be specified using + // an existing reserved IP, or a prototype object for a new reserved IP. + // + // If an existing reserved IP or a prototype object with an address is specified, it must + // be available on the network interface's subnet. Otherwise, an available address on the + // subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // Indicates if the interface can float to any other server within the same + // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal + // server in the resource group. Applies only to `vlan` type interfaces. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + + // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + Vlan *int64 `json:"vlan,omitempty"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototype.InterfaceType property. +// The network interface type: +// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// within a `s390x` based system +// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI interface +// - Cannot directly use an IEEE 802.1q VLAN tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x` +// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its +// array of `allowed_vlans`. +// - Must use an IEEE 802.1q tag. +// - Has its own security groups and does not inherit those of the PCI device through +// which traffic flows. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfacePrototypeInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfacePrototypeInterfaceTypeVlanConst = "vlan" +) + +func (*BareMetalServerNetworkInterfacePrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +type BareMetalServerNetworkInterfacePrototypeIntf interface { + isaBareMetalServerNetworkInterfacePrototype() bool +} + +// UnmarshalBareMetalServerNetworkInterfacePrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "interface_type", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + return + } + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + } else if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + } + return +} + +// BareMetalServerPatch : BareMetalServerPatch struct +type BareMetalServerPatch struct { + // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the bare metal server + // will fail to boot. + // + // For `enable_secure_boot` to be changed, the bare metal server `status` must be + // `stopped`. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + + // The name for this bare metal server. The name must not be used by another bare metal server in the region. Changing + // the name will not affect the system hostname. + Name *string `json:"name,omitempty"` + + TrustedPlatformModule *BareMetalServerTrustedPlatformModulePatch `json:"trusted_platform_module,omitempty"` +} + +// UnmarshalBareMetalServerPatch unmarshals an instance of BareMetalServerPatch from the specified map of raw messages. +func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPatch) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the BareMetalServerPatch +func (bareMetalServerPatch *BareMetalServerPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(bareMetalServerPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// BareMetalServerPrimaryNetworkAttachmentPrototype : BareMetalServerPrimaryNetworkAttachmentPrototype struct +type BareMetalServerPrimaryNetworkAttachmentPrototype struct { + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // The network attachment's interface type: + // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity + // within a `s390x` based system + // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI attachment + // - Cannot directly use an IEEE 802.1q VLAN tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x` + // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its + // array of `allowed_vlans`. + // - Must use an IEEE 802.1q tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The name for this 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 network attachment. This can be specified using an + // existing virtual network interface, or a prototype object for a new virtual network + // interface. + VirtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` +} + +// Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototype.InterfaceType property. +// The network attachment's interface type: +// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// within a `s390x` based system +// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI attachment +// - Cannot directly use an IEEE 802.1q VLAN tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x` +// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its +// array of `allowed_vlans`. +// - Must use an IEEE 802.1q tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" + BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypeVlanConst = "vlan" +) + +// NewBareMetalServerPrimaryNetworkAttachmentPrototype : Instantiate BareMetalServerPrimaryNetworkAttachmentPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototype(interfaceType string, virtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf) (_model *BareMetalServerPrimaryNetworkAttachmentPrototype, err error) { + _model = &BareMetalServerPrimaryNetworkAttachmentPrototype{ + InterfaceType: core.StringPtr(interfaceType), + VirtualNetworkInterface: virtualNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// 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, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrimaryNetworkInterface : Primary network interface. +type BareMetalServerPrimaryNetworkInterface struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The name for this network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the BareMetalServerPrimaryNetworkInterface.ResourceType property. +// The resource type. +const ( + BareMetalServerPrimaryNetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// UnmarshalBareMetalServerPrimaryNetworkInterface unmarshals an instance of BareMetalServerPrimaryNetworkInterface from the specified map of raw messages. +func UnmarshalBareMetalServerPrimaryNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrimaryNetworkInterface) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct +type BareMetalServerPrimaryNetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The network interface type: + // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity + // within a `s390x` based system. + // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI interface + // - Cannot directly use an IEEE 802.1q VLAN tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type,omitempty"` + + // The name for this network interface. The name must not be used by another network interface on the bare metal + // server. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the network interface. This can be specified using + // an existing reserved IP, or a prototype object for a new reserved IP. + // + // If an existing reserved IP or a prototype object with an address is specified, it must + // be available on the network interface's subnet. Otherwise, an available address on the + // subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` +} + +// Constants associated with the BareMetalServerPrimaryNetworkInterfacePrototype.InterfaceType property. +// The network interface type: +// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// within a `s390x` based system. +// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI interface +// - Cannot directly use an IEEE 802.1q VLAN tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerPrimaryNetworkInterfacePrototype : Instantiate BareMetalServerPrimaryNetworkInterfacePrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrimaryNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *BareMetalServerPrimaryNetworkInterfacePrototype, err error) { + _model = &BareMetalServerPrimaryNetworkInterfacePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype unmarshals an instance of BareMetalServerPrimaryNetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrimaryNetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfile : BareMetalServerProfile struct +type BareMetalServerProfile struct { + Bandwidth BareMetalServerProfileBandwidthIntf `json:"bandwidth" validate:"required"` + + // The console type configuration for a bare metal server with this profile. + ConsoleTypes *BareMetalServerProfileConsoleTypes `json:"console_types" validate:"required"` + + CpuArchitecture *BareMetalServerProfileCpuArchitecture `json:"cpu_architecture" validate:"required"` + + CpuCoreCount BareMetalServerProfileCpuCoreCountIntf `json:"cpu_core_count" validate:"required"` + + CpuSocketCount BareMetalServerProfileCpuSocketCountIntf `json:"cpu_socket_count" validate:"required"` + + // Collection of the bare metal server profile's disks. + Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"` + + // The product family this bare metal server profile belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this bare metal server profile. + Href *string `json:"href" validate:"required"` + + Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` + + // The name for this bare metal server profile. + Name *string `json:"name" validate:"required"` + + NetworkAttachmentCount BareMetalServerProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"` + + NetworkInterfaceCount BareMetalServerProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` + + OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The supported trusted platform module modes for this bare metal server profile. + SupportedTrustedPlatformModuleModes *BareMetalServerProfileSupportedTrustedPlatformModuleModes `json:"supported_trusted_platform_module_modes" validate:"required"` + + // Indicates whether this profile supports virtual network interfaces. + VirtualNetworkInterfacesSupported *BareMetalServerProfileVirtualNetworkInterfacesSupported `json:"virtual_network_interfaces_supported" validate:"required"` +} + +// Constants associated with the BareMetalServerProfile.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// UnmarshalBareMetalServerProfile unmarshals an instance of BareMetalServerProfile from the specified map of raw messages. +func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfile) + err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalBareMetalServerProfileBandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "console_types", &obj.ConsoleTypes, UnmarshalBareMetalServerProfileConsoleTypes) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_core_count", &obj.CpuCoreCount, UnmarshalBareMetalServerProfileCpuCoreCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalBareMetalServerProfileNetworkAttachmentCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interfaces_supported", &obj.VirtualNetworkInterfacesSupported, UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidth : BareMetalServerProfileBandwidth struct +// Models which "extend" this model: +// - BareMetalServerProfileBandwidthFixed +// - BareMetalServerProfileBandwidthRange +// - BareMetalServerProfileBandwidthEnum +// - BareMetalServerProfileBandwidthDependent +type BareMetalServerProfileBandwidth struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the BareMetalServerProfileBandwidth.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileBandwidth) isaBareMetalServerProfileBandwidth() bool { + return true +} + +type BareMetalServerProfileBandwidthIntf interface { + isaBareMetalServerProfileBandwidth() bool +} + +// UnmarshalBareMetalServerProfileBandwidth unmarshals an instance of BareMetalServerProfileBandwidth from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidth) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuArchitecture : BareMetalServerProfileCpuArchitecture struct +type BareMetalServerProfileCpuArchitecture struct { + // The default CPU architecture for a bare metal server with this profile. + Default *string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The CPU architecture for a bare metal server with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuArchitecture.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuArchitectureTypeFixedConst = "fixed" +) + +// UnmarshalBareMetalServerProfileCpuArchitecture unmarshals an instance of BareMetalServerProfileCpuArchitecture from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCount : BareMetalServerProfileCpuCoreCount struct +// Models which "extend" this model: +// - BareMetalServerProfileCpuCoreCountFixed +// - BareMetalServerProfileCpuCoreCountRange +// - BareMetalServerProfileCpuCoreCountEnum +// - BareMetalServerProfileCpuCoreCountDependent +type BareMetalServerProfileCpuCoreCount struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the BareMetalServerProfileCpuCoreCount.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuCoreCountTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileCpuCoreCount) isaBareMetalServerProfileCpuCoreCount() bool { + return true +} + +type BareMetalServerProfileCpuCoreCountIntf interface { + isaBareMetalServerProfileCpuCoreCount() bool +} + +// UnmarshalBareMetalServerProfileCpuCoreCount unmarshals an instance of BareMetalServerProfileCpuCoreCount from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCount) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuSocketCount : BareMetalServerProfileCpuSocketCount struct +// Models which "extend" this model: +// - BareMetalServerProfileCpuSocketCountFixed +// - BareMetalServerProfileCpuSocketCountRange +// - BareMetalServerProfileCpuSocketCountEnum +// - BareMetalServerProfileCpuSocketCountDependent +type BareMetalServerProfileCpuSocketCount struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the BareMetalServerProfileCpuSocketCount.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileCpuSocketCount) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +type BareMetalServerProfileCpuSocketCountIntf interface { + isaBareMetalServerProfileCpuSocketCount() bool +} + +// UnmarshalBareMetalServerProfileCpuSocketCount unmarshals an instance of BareMetalServerProfileCpuSocketCount from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCount) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct +type BareMetalServerProfileCollection struct { + // A link to the first page of resources. + First *BareMetalServerProfileCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *BareMetalServerProfileCollectionNext `json:"next,omitempty"` + + // Collection of bare metal server profiles. + Profiles []BareMetalServerProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalBareMetalServerProfileCollection unmarshals an instance of BareMetalServerProfileCollection from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerProfileCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// BareMetalServerProfileCollectionFirst : A link to the first page of resources. +type BareMetalServerProfileCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBareMetalServerProfileCollectionFirst unmarshals an instance of BareMetalServerProfileCollectionFirst from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type BareMetalServerProfileCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBareMetalServerProfileCollectionNext unmarshals an instance of BareMetalServerProfileCollectionNext from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileConsoleTypes : The console type configuration for a bare metal server with this profile. +type BareMetalServerProfileConsoleTypes struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The console types for a bare metal server with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileConsoleTypes.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileConsoleTypesTypeEnumConst = "enum" +) + +// Constants associated with the BareMetalServerProfileConsoleTypes.Values property. +// A console type. +const ( + BareMetalServerProfileConsoleTypesValuesSerialConst = "serial" + BareMetalServerProfileConsoleTypesValuesVncConst = "vnc" +) + +// UnmarshalBareMetalServerProfileConsoleTypes unmarshals an instance of BareMetalServerProfileConsoleTypes from the specified map of raw messages. +func UnmarshalBareMetalServerProfileConsoleTypes(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileConsoleTypes) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDisk : Disks provided by this profile. +type BareMetalServerProfileDisk struct { + Quantity BareMetalServerProfileDiskQuantityIntf `json:"quantity" validate:"required"` + + Size BareMetalServerProfileDiskSizeIntf `json:"size" validate:"required"` + + SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` +} + +// UnmarshalBareMetalServerProfileDisk unmarshals an instance of BareMetalServerProfileDisk from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDisk) + err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalBareMetalServerProfileDiskQuantity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskQuantity : BareMetalServerProfileDiskQuantity struct +// Models which "extend" this model: +// - BareMetalServerProfileDiskQuantityFixed +// - BareMetalServerProfileDiskQuantityRange +// - BareMetalServerProfileDiskQuantityEnum +// - BareMetalServerProfileDiskQuantityDependent +type BareMetalServerProfileDiskQuantity struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the BareMetalServerProfileDiskQuantity.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileDiskQuantity) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +type BareMetalServerProfileDiskQuantityIntf interface { + isaBareMetalServerProfileDiskQuantity() bool +} + +// UnmarshalBareMetalServerProfileDiskQuantity unmarshals an instance of BareMetalServerProfileDiskQuantity from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSize : BareMetalServerProfileDiskSize struct +// Models which "extend" this model: +// - BareMetalServerProfileDiskSizeFixed +// - BareMetalServerProfileDiskSizeRange +// - BareMetalServerProfileDiskSizeEnum +// - BareMetalServerProfileDiskSizeDependent +type BareMetalServerProfileDiskSize struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the BareMetalServerProfileDiskSize.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { + return true +} + +type BareMetalServerProfileDiskSizeIntf interface { + isaBareMetalServerProfileDiskSize() bool +} + +// UnmarshalBareMetalServerProfileDiskSize unmarshals an instance of BareMetalServerProfileDiskSize from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSize) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct +type BareMetalServerProfileDiskSupportedInterfaces struct { + // The disk interface used for attaching the disk. + // + // - `fcp`: Attached using Fiber Channel Protocol + // - `sata`: Attached using Serial Advanced Technology Attachment + // - `nvme`: Attached using Non-Volatile Memory Express + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Default *string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported disk interfaces used for attaching the disk. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. +// The disk interface used for attaching the disk. +// +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp" + BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" + BareMetalServerProfileDiskSupportedInterfacesDefaultSataConst = "sata" +) + +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSupportedInterfacesTypeEnumConst = "enum" +) + +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Values property. +// The disk interface used for attaching the disk. +// +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerProfileDiskSupportedInterfacesValuesFcpConst = "fcp" + BareMetalServerProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" + BareMetalServerProfileDiskSupportedInterfacesValuesSataConst = "sata" +) + +// UnmarshalBareMetalServerProfileDiskSupportedInterfaces unmarshals an instance of BareMetalServerProfileDiskSupportedInterfaces from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileIdentity : Identifies a bare metal server profile by a unique property. +// Models which "extend" this model: +// - BareMetalServerProfileIdentityByName +// - BareMetalServerProfileIdentityByHref +type BareMetalServerProfileIdentity struct { + // The name for this bare metal server profile. + Name *string `json:"name,omitempty"` + + // The URL for this bare metal server profile. + Href *string `json:"href,omitempty"` +} + +func (*BareMetalServerProfileIdentity) isaBareMetalServerProfileIdentity() bool { + return true +} + +type BareMetalServerProfileIdentityIntf interface { + isaBareMetalServerProfileIdentity() bool +} + +// UnmarshalBareMetalServerProfileIdentity unmarshals an instance of BareMetalServerProfileIdentity from the specified map of raw messages. +func UnmarshalBareMetalServerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileMemory : BareMetalServerProfileMemory struct +// Models which "extend" this model: +// - BareMetalServerProfileMemoryFixed +// - BareMetalServerProfileMemoryRange +// - BareMetalServerProfileMemoryEnum +// - BareMetalServerProfileMemoryDependent +type BareMetalServerProfileMemory struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the BareMetalServerProfileMemory.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileMemory) isaBareMetalServerProfileMemory() bool { + return true +} + +type BareMetalServerProfileMemoryIntf interface { + isaBareMetalServerProfileMemory() bool +} + +// UnmarshalBareMetalServerProfileMemory unmarshals an instance of BareMetalServerProfileMemory from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileNetworkAttachmentCount : BareMetalServerProfileNetworkAttachmentCount struct +// Models which "extend" this model: +// - BareMetalServerProfileNetworkAttachmentCountRange +// - BareMetalServerProfileNetworkAttachmentCountDependent +type BareMetalServerProfileNetworkAttachmentCount struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` +} + +// Constants associated with the BareMetalServerProfileNetworkAttachmentCount.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkAttachmentCountTypeRangeConst = "range" +) + +func (*BareMetalServerProfileNetworkAttachmentCount) isaBareMetalServerProfileNetworkAttachmentCount() bool { + return true +} + +type BareMetalServerProfileNetworkAttachmentCountIntf interface { + isaBareMetalServerProfileNetworkAttachmentCount() bool +} + +// UnmarshalBareMetalServerProfileNetworkAttachmentCount unmarshals an instance of BareMetalServerProfileNetworkAttachmentCount from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkAttachmentCount) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileNetworkInterfaceCount : BareMetalServerProfileNetworkInterfaceCount struct +// Models which "extend" this model: +// - BareMetalServerProfileNetworkInterfaceCountRange +// - BareMetalServerProfileNetworkInterfaceCountDependent +type BareMetalServerProfileNetworkInterfaceCount struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` +} + +// Constants associated with the BareMetalServerProfileNetworkInterfaceCount.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkInterfaceCountTypeRangeConst = "range" +) + +func (*BareMetalServerProfileNetworkInterfaceCount) isaBareMetalServerProfileNetworkInterfaceCount() bool { + return true +} + +type BareMetalServerProfileNetworkInterfaceCountIntf interface { + isaBareMetalServerProfileNetworkInterfaceCount() bool +} + +// UnmarshalBareMetalServerProfileNetworkInterfaceCount unmarshals an instance of BareMetalServerProfileNetworkInterfaceCount from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkInterfaceCount) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileOsArchitecture : BareMetalServerProfileOsArchitecture struct +type BareMetalServerProfileOsArchitecture struct { + // The default OS architecture for a bare metal server with this profile. + Default *string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported OS architecture(s) for a bare metal server with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileOsArchitecture.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileOsArchitectureTypeEnumConst = "enum" +) + +// UnmarshalBareMetalServerProfileOsArchitecture unmarshals an instance of BareMetalServerProfileOsArchitecture from the specified map of raw messages. +func UnmarshalBareMetalServerProfileOsArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileOsArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileReference : BareMetalServerProfileReference struct +type BareMetalServerProfileReference struct { + // The URL for this bare metal server profile. + Href *string `json:"href" validate:"required"` + + // The name for this bare metal server profile. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileReference.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// UnmarshalBareMetalServerProfileReference unmarshals an instance of BareMetalServerProfileReference from the specified map of raw messages. +func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module modes for this bare metal server profile. +type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported trusted platform module modes. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileSupportedTrustedPlatformModuleModesTypeEnumConst = "enum" +) + +// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Values property. +// The trusted platform module (TPM) mode: +// - `disabled`: No TPM functionality +// - `tpm_2`: TPM 2.0 +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" +) + +// UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes unmarshals an instance of BareMetalServerProfileSupportedTrustedPlatformModuleModes from the specified map of raw messages. +func UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileSupportedTrustedPlatformModuleModes) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileVirtualNetworkInterfacesSupported : Indicates whether this profile supports virtual network interfaces. +type BareMetalServerProfileVirtualNetworkInterfacesSupported struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *bool `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileVirtualNetworkInterfacesSupported.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileVirtualNetworkInterfacesSupportedTypeFixedConst = "fixed" +) + +// UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported unmarshals an instance of BareMetalServerProfileVirtualNetworkInterfacesSupported from the specified map of raw messages. +func UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileVirtualNetworkInterfacesSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototype : BareMetalServerPrototype struct +// Models which "extend" this model: +// - BareMetalServerPrototypeBareMetalServerByNetworkAttachment +// - BareMetalServerPrototypeBareMetalServerByNetworkInterface +type BareMetalServerPrototype struct { + // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to + // boot. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + + Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` + + // The name for this bare metal server. The name must not be used by another bare metal server in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) + // to use for this bare metal server. + Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` + + // The VPC this bare metal server will reside in. + // + // If specified, it must match the VPC for the subnets of the server's network + // interfaces. + 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 *BareMetalServerPrimaryNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional network interfaces to create for the bare metal server. + NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the bare metal server. + PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*BareMetalServerPrototype) isaBareMetalServerPrototype() bool { + return true +} + +type BareMetalServerPrototypeIntf interface { + isaBareMetalServerPrototype() bool +} + +// UnmarshalBareMetalServerPrototype unmarshals an instance of BareMetalServerPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototype) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerStatusReason : BareMetalServerStatusReason struct +type BareMetalServerStatusReason struct { + // The status reason code: + // - `cannot_start`: Failed to start due to an internal error + // - `cannot_start_capacity`: Insufficient capacity within the selected zone + // - `cannot_start_compute`: An error occurred while allocating compute resources + // - `cannot_start_ip_address`: An error occurred while allocating an IP address + // - `cannot_start_network`: An error occurred while allocating network resources. + Code *string `json:"code" validate:"required"` + + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the BareMetalServerStatusReason.Code property. +// The status reason code: +// - `cannot_start`: Failed to start due to an internal error +// - `cannot_start_capacity`: Insufficient capacity within the selected zone +// - `cannot_start_compute`: An error occurred while allocating compute resources +// - `cannot_start_ip_address`: An error occurred while allocating an IP address +// - `cannot_start_network`: An error occurred while allocating network resources. +const ( + BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" + BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" + BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" + BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" + BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" +) + +// UnmarshalBareMetalServerStatusReason unmarshals an instance of BareMetalServerStatusReason from the specified map of raw messages. +func UnmarshalBareMetalServerStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerTrustedPlatformModule : BareMetalServerTrustedPlatformModule struct +type BareMetalServerTrustedPlatformModule struct { + // Indicates whether the trusted platform module is enabled. + Enabled *bool `json:"enabled" validate:"required"` + + // The trusted platform module (TPM) mode: + // - `disabled`: No TPM functionality + // - `tpm_2`: TPM 2.0 + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Mode *string `json:"mode" validate:"required"` + + // The supported trusted platform module modes. + SupportedModes []string `json:"supported_modes" validate:"required"` +} + +// Constants associated with the BareMetalServerTrustedPlatformModule.Mode property. +// The trusted platform module (TPM) mode: +// - `disabled`: No TPM functionality +// - `tpm_2`: TPM 2.0 +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerTrustedPlatformModuleModeDisabledConst = "disabled" + BareMetalServerTrustedPlatformModuleModeTpm2Const = "tpm_2" +) + +// Constants associated with the BareMetalServerTrustedPlatformModule.SupportedModes property. +// The trusted platform module (TPM) mode: +// - `disabled`: No TPM functionality +// - `tpm_2`: TPM 2.0 +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerTrustedPlatformModuleSupportedModesDisabledConst = "disabled" + BareMetalServerTrustedPlatformModuleSupportedModesTpm2Const = "tpm_2" +) + +// UnmarshalBareMetalServerTrustedPlatformModule unmarshals an instance of BareMetalServerTrustedPlatformModule from the specified map of raw messages. +func UnmarshalBareMetalServerTrustedPlatformModule(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerTrustedPlatformModule) + err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerTrustedPlatformModulePatch : BareMetalServerTrustedPlatformModulePatch struct +type BareMetalServerTrustedPlatformModulePatch struct { + // The trusted platform module mode to use. The specified value must be listed in the bare metal server's + // `supported_modes`. + // + // For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the BareMetalServerTrustedPlatformModulePatch.Mode property. +// The trusted platform module mode to use. The specified value must be listed in the bare metal server's +// `supported_modes`. +// +// For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`. +const ( + BareMetalServerTrustedPlatformModulePatchModeDisabledConst = "disabled" + BareMetalServerTrustedPlatformModulePatchModeTpm2Const = "tpm_2" +) + +// UnmarshalBareMetalServerTrustedPlatformModulePatch unmarshals an instance of BareMetalServerTrustedPlatformModulePatch from the specified map of raw messages. +func UnmarshalBareMetalServerTrustedPlatformModulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerTrustedPlatformModulePatch) + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerTrustedPlatformModulePrototype : BareMetalServerTrustedPlatformModulePrototype struct +type BareMetalServerTrustedPlatformModulePrototype struct { + // The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's + // `supported_trusted_platform_module_modes`. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the BareMetalServerTrustedPlatformModulePrototype.Mode property. +// The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's +// `supported_trusted_platform_module_modes`. +const ( + BareMetalServerTrustedPlatformModulePrototypeModeDisabledConst = "disabled" + BareMetalServerTrustedPlatformModulePrototypeModeTpm2Const = "tpm_2" +) + +// UnmarshalBareMetalServerTrustedPlatformModulePrototype unmarshals an instance of BareMetalServerTrustedPlatformModulePrototype from the specified map of raw messages. +func UnmarshalBareMetalServerTrustedPlatformModulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerTrustedPlatformModulePrototype) + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingIdentity : Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique +// property. +// Models which "extend" this model: +// - CatalogOfferingIdentityCatalogOfferingByCRN +type CatalogOfferingIdentity struct { + // The CRN for this + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. + CRN *string `json:"crn,omitempty"` +} + +func (*CatalogOfferingIdentity) isaCatalogOfferingIdentity() bool { + return true +} + +type CatalogOfferingIdentityIntf interface { + isaCatalogOfferingIdentity() bool +} + +// UnmarshalCatalogOfferingIdentity unmarshals an instance of CatalogOfferingIdentity from the specified map of raw messages. +func UnmarshalCatalogOfferingIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingVersionIdentity : Identifies a version of a +// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique property. +// Models which "extend" this model: +// - CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN +type CatalogOfferingVersionIdentity struct { + // The CRN for this version of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. + CRN *string `json:"crn,omitempty"` +} + +func (*CatalogOfferingVersionIdentity) isaCatalogOfferingVersionIdentity() bool { + return true +} + +type CatalogOfferingVersionIdentityIntf interface { + isaCatalogOfferingVersionIdentity() bool +} + +// UnmarshalCatalogOfferingVersionIdentity unmarshals an instance of CatalogOfferingVersionIdentity from the specified map of raw messages. +func UnmarshalCatalogOfferingVersionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingVersionIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingVersionReference : CatalogOfferingVersionReference struct +type CatalogOfferingVersionReference struct { + // The CRN for this version of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalCatalogOfferingVersionReference unmarshals an instance of CatalogOfferingVersionReference from the specified map of raw messages. +func UnmarshalCatalogOfferingVersionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingVersionReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CertificateInstanceIdentity : Identifies a certificate instance by a unique property. +// Models which "extend" this model: +// - CertificateInstanceIdentityByCRN +type CertificateInstanceIdentity struct { + // The CRN for this certificate instance. + CRN *string `json:"crn,omitempty"` +} + +func (*CertificateInstanceIdentity) isaCertificateInstanceIdentity() bool { + return true +} + +type CertificateInstanceIdentityIntf interface { + isaCertificateInstanceIdentity() bool +} + +// UnmarshalCertificateInstanceIdentity unmarshals an instance of CertificateInstanceIdentity from the specified map of raw messages. +func UnmarshalCertificateInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CertificateInstanceIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CertificateInstanceReference : CertificateInstanceReference struct +type CertificateInstanceReference struct { + // The CRN for this certificate instance. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalCertificateInstanceReference unmarshals an instance of CertificateInstanceReference from the specified map of raw messages. +func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CertificateInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CheckVPNGatewayConnectionLocalCIDROptions : The CheckVPNGatewayConnectionLocalCIDR options. +type CheckVPNGatewayConnectionLocalCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // The address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCheckVPNGatewayConnectionLocalCIDROptions : Instantiate CheckVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { + return &CheckVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionLocalCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetID(id string) *CheckVPNGatewayConnectionLocalCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionLocalCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CheckVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionLocalCIDROptions { + options.Headers = param + return options +} + +// CheckVPNGatewayConnectionPeerCIDROptions : The CheckVPNGatewayConnectionPeerCIDR options. +type CheckVPNGatewayConnectionPeerCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // The address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCheckVPNGatewayConnectionPeerCIDROptions : Instantiate CheckVPNGatewayConnectionPeerCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { + return &CheckVPNGatewayConnectionPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionPeerCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetID(id string) *CheckVPNGatewayConnectionPeerCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionPeerCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CheckVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionPeerCIDROptions { + options.Headers = param + return options +} + +// CloudObjectStorageBucketIdentity : Identifies a Cloud Object Storage bucket by a unique property. +// Models which "extend" this model: +// - CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName +// - CloudObjectStorageBucketIdentityByCRN +type CloudObjectStorageBucketIdentity struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name,omitempty"` + + // The CRN of this Cloud Object Storage bucket. + CRN *string `json:"crn,omitempty"` +} + +func (*CloudObjectStorageBucketIdentity) isaCloudObjectStorageBucketIdentity() bool { + return true +} + +type CloudObjectStorageBucketIdentityIntf interface { + isaCloudObjectStorageBucketIdentity() bool +} + +// UnmarshalCloudObjectStorageBucketIdentity unmarshals an instance of CloudObjectStorageBucketIdentity from the specified map of raw messages. +func UnmarshalCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageBucketIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CloudObjectStorageBucketReference : CloudObjectStorageBucketReference struct +type CloudObjectStorageBucketReference struct { + // The CRN of this Cloud Object Storage bucket. + CRN *string `json:"crn" validate:"required"` + + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalCloudObjectStorageBucketReference unmarshals an instance of CloudObjectStorageBucketReference from the specified map of raw messages. +func UnmarshalCloudObjectStorageBucketReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageBucketReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CloudObjectStorageObjectReference : CloudObjectStorageObjectReference struct +type CloudObjectStorageObjectReference struct { + // The name of this Cloud Object Storage object. Names are unique within a Cloud Object Storage bucket. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalCloudObjectStorageObjectReference unmarshals an instance of CloudObjectStorageObjectReference from the specified map of raw messages. +func UnmarshalCloudObjectStorageObjectReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageObjectReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CreateBackupPolicyOptions : The CreateBackupPolicy options. +type CreateBackupPolicyOptions struct { + // The user tags this backup policy 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"` + + // A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will + // be subject to the backup policy. + MatchResourceTypes []string `json:"match_resource_types,omitempty"` + + // The name for this backup policy. The name must not be used by another backup policy in the region. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The prototype objects for backup plans to be created for this backup policy. + Plans []BackupPolicyPlanPrototype `json:"plans,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateBackupPolicyOptions.MatchResourceTypes property. +// The resource type. +const ( + CreateBackupPolicyOptionsMatchResourceTypesVolumeConst = "volume" +) + +// NewCreateBackupPolicyOptions : Instantiate CreateBackupPolicyOptions +func (*VpcV1) NewCreateBackupPolicyOptions(matchUserTags []string) *CreateBackupPolicyOptions { + return &CreateBackupPolicyOptions{ + MatchUserTags: matchUserTags, + } +} + +// SetMatchUserTags : Allow user to set MatchUserTags +func (_options *CreateBackupPolicyOptions) SetMatchUserTags(matchUserTags []string) *CreateBackupPolicyOptions { + _options.MatchUserTags = matchUserTags + return _options +} + +// SetMatchResourceTypes : Allow user to set MatchResourceTypes +func (_options *CreateBackupPolicyOptions) SetMatchResourceTypes(matchResourceTypes []string) *CreateBackupPolicyOptions { + _options.MatchResourceTypes = matchResourceTypes + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateBackupPolicyOptions) SetName(name string) *CreateBackupPolicyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPlans : Allow user to set Plans +func (_options *CreateBackupPolicyOptions) SetPlans(plans []BackupPolicyPlanPrototype) *CreateBackupPolicyOptions { + _options.Plans = plans + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateBackupPolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateBackupPolicyOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBackupPolicyOptions) SetHeaders(param map[string]string) *CreateBackupPolicyOptions { + options.Headers = param + return options +} + +// CreateBackupPolicyPlanOptions : The CreateBackupPolicyPlan options. +type CreateBackupPolicyPlanOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // The cron specification for the backup schedule. The backup policy jobs + // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes + // after this time. + // + // All backup schedules for plans in the same policy must be at least an hour apart. + CronSpec *string `json:"cron_spec" validate:"required"` + + // Indicates whether the plan is active. + Active *bool `json:"active,omitempty"` + + // User tags to attach to each backup (snapshot) created by this plan. If unspecified, no user tags will be attached. + AttachUserTags []string `json:"attach_user_tags,omitempty"` + + ClonePolicy *BackupPolicyPlanClonePolicyPrototype `json:"clone_policy,omitempty"` + + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags,omitempty"` + + DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` + + // The name for this backup policy plan. The name must not be used by another plan for the backup policy. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The policies for additional backups in remote regions. + RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateBackupPolicyPlanOptions : Instantiate CreateBackupPolicyPlanOptions +func (*VpcV1) NewCreateBackupPolicyPlanOptions(backupPolicyID string, cronSpec string) *CreateBackupPolicyPlanOptions { + return &CreateBackupPolicyPlanOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + CronSpec: core.StringPtr(cronSpec), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *CreateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *CreateBackupPolicyPlanOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetCronSpec : Allow user to set CronSpec +func (_options *CreateBackupPolicyPlanOptions) SetCronSpec(cronSpec string) *CreateBackupPolicyPlanOptions { + _options.CronSpec = core.StringPtr(cronSpec) + return _options +} + +// SetActive : Allow user to set Active +func (_options *CreateBackupPolicyPlanOptions) SetActive(active bool) *CreateBackupPolicyPlanOptions { + _options.Active = core.BoolPtr(active) + return _options +} + +// SetAttachUserTags : Allow user to set AttachUserTags +func (_options *CreateBackupPolicyPlanOptions) SetAttachUserTags(attachUserTags []string) *CreateBackupPolicyPlanOptions { + _options.AttachUserTags = attachUserTags + return _options +} + +// SetClonePolicy : Allow user to set ClonePolicy +func (_options *CreateBackupPolicyPlanOptions) SetClonePolicy(clonePolicy *BackupPolicyPlanClonePolicyPrototype) *CreateBackupPolicyPlanOptions { + _options.ClonePolicy = clonePolicy + return _options +} + +// SetCopyUserTags : Allow user to set CopyUserTags +func (_options *CreateBackupPolicyPlanOptions) SetCopyUserTags(copyUserTags bool) *CreateBackupPolicyPlanOptions { + _options.CopyUserTags = core.BoolPtr(copyUserTags) + return _options +} + +// SetDeletionTrigger : Allow user to set DeletionTrigger +func (_options *CreateBackupPolicyPlanOptions) SetDeletionTrigger(deletionTrigger *BackupPolicyPlanDeletionTriggerPrototype) *CreateBackupPolicyPlanOptions { + _options.DeletionTrigger = deletionTrigger + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateBackupPolicyPlanOptions) SetName(name string) *CreateBackupPolicyPlanOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetRemoteRegionPolicies : Allow user to set RemoteRegionPolicies +func (_options *CreateBackupPolicyPlanOptions) SetRemoteRegionPolicies(remoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype) *CreateBackupPolicyPlanOptions { + _options.RemoteRegionPolicies = remoteRegionPolicies + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *CreateBackupPolicyPlanOptions { + options.Headers = param + return options +} + +// CreateBareMetalServerConsoleAccessTokenOptions : The CreateBareMetalServerConsoleAccessToken options. +type CreateBareMetalServerConsoleAccessTokenOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server console type for which this token may be used + // + // Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. + ConsoleType *string `json:"console_type" validate:"required"` + + // Indicates whether to disconnect an existing serial console session as the serial console cannot be shared. This has + // no effect on VNC consoles. + Force *bool `json:"force,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateBareMetalServerConsoleAccessTokenOptions.ConsoleType property. +// The bare metal server console type for which this token may be used +// +// Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. +const ( + CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeSerialConst = "serial" + CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeVncConst = "vnc" +) + +// NewCreateBareMetalServerConsoleAccessTokenOptions : Instantiate CreateBareMetalServerConsoleAccessTokenOptions +func (*VpcV1) NewCreateBareMetalServerConsoleAccessTokenOptions(bareMetalServerID string, consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { + return &CreateBareMetalServerConsoleAccessTokenOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ConsoleType: core.StringPtr(consoleType), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerConsoleAccessTokenOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetConsoleType : Allow user to set ConsoleType +func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetConsoleType(consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { + _options.ConsoleType = core.StringPtr(consoleType) + return _options +} + +// SetForce : Allow user to set Force +func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetForce(force bool) *CreateBareMetalServerConsoleAccessTokenOptions { + _options.Force = core.BoolPtr(force) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerConsoleAccessTokenOptions) SetHeaders(param map[string]string) *CreateBareMetalServerConsoleAccessTokenOptions { + options.Headers = param + return options +} + +// 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 network interface prototype object. + BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateBareMetalServerNetworkInterfaceOptions : Instantiate CreateBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { + return &CreateBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + BareMetalServerNetworkInterfacePrototype: bareMetalServerNetworkInterfacePrototype, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetBareMetalServerNetworkInterfacePrototype : Allow user to set BareMetalServerNetworkInterfacePrototype +func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options +} + +// CreateBareMetalServerOptions : The CreateBareMetalServer options. +type CreateBareMetalServerOptions struct { + // The bare metal server prototype object. + BareMetalServerPrototype BareMetalServerPrototypeIntf `json:"BareMetalServerPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateBareMetalServerOptions : Instantiate CreateBareMetalServerOptions +func (*VpcV1) NewCreateBareMetalServerOptions(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions { + return &CreateBareMetalServerOptions{ + BareMetalServerPrototype: bareMetalServerPrototype, + } +} + +// SetBareMetalServerPrototype : Allow user to set BareMetalServerPrototype +func (_options *CreateBareMetalServerOptions) SetBareMetalServerPrototype(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions { + _options.BareMetalServerPrototype = bareMetalServerPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerOptions) SetHeaders(param map[string]string) *CreateBareMetalServerOptions { + options.Headers = param + return options +} + +// CreateDedicatedHostGroupOptions : The CreateDedicatedHostGroup options. +type CreateDedicatedHostGroupOptions struct { + // The dedicated host profile class for hosts in this group. + Class *string `json:"class" validate:"required"` + + // The dedicated host profile family for hosts in this group. + Family *string `json:"family" validate:"required"` + + // The zone this dedicated host group will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateDedicatedHostGroupOptions.Family property. +// The dedicated host profile family for hosts in this group. +const ( + CreateDedicatedHostGroupOptionsFamilyBalancedConst = "balanced" + CreateDedicatedHostGroupOptionsFamilyComputeConst = "compute" + CreateDedicatedHostGroupOptionsFamilyMemoryConst = "memory" +) + +// NewCreateDedicatedHostGroupOptions : Instantiate CreateDedicatedHostGroupOptions +func (*VpcV1) NewCreateDedicatedHostGroupOptions(class string, family string, zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions { + return &CreateDedicatedHostGroupOptions{ + Class: core.StringPtr(class), + Family: core.StringPtr(family), + Zone: zone, + } +} + +// SetClass : Allow user to set Class +func (_options *CreateDedicatedHostGroupOptions) SetClass(class string) *CreateDedicatedHostGroupOptions { + _options.Class = core.StringPtr(class) + return _options +} + +// SetFamily : Allow user to set Family +func (_options *CreateDedicatedHostGroupOptions) SetFamily(family string) *CreateDedicatedHostGroupOptions { + _options.Family = core.StringPtr(family) + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateDedicatedHostGroupOptions) SetZone(zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions { + _options.Zone = zone + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateDedicatedHostGroupOptions) SetName(name string) *CreateDedicatedHostGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateDedicatedHostGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateDedicatedHostGroupOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateDedicatedHostGroupOptions) SetHeaders(param map[string]string) *CreateDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// CreateDedicatedHostOptions : The CreateDedicatedHost options. +type CreateDedicatedHostOptions struct { + // The dedicated host prototype object. + DedicatedHostPrototype DedicatedHostPrototypeIntf `json:"DedicatedHostPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateDedicatedHostOptions : Instantiate CreateDedicatedHostOptions +func (*VpcV1) NewCreateDedicatedHostOptions(dedicatedHostPrototype DedicatedHostPrototypeIntf) *CreateDedicatedHostOptions { + return &CreateDedicatedHostOptions{ + DedicatedHostPrototype: dedicatedHostPrototype, + } +} + +// SetDedicatedHostPrototype : Allow user to set DedicatedHostPrototype +func (_options *CreateDedicatedHostOptions) SetDedicatedHostPrototype(dedicatedHostPrototype DedicatedHostPrototypeIntf) *CreateDedicatedHostOptions { + _options.DedicatedHostPrototype = dedicatedHostPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateDedicatedHostOptions) SetHeaders(param map[string]string) *CreateDedicatedHostOptions { + options.Headers = param + return options +} + +// CreateEndpointGatewayOptions : The CreateEndpointGateway options. +type CreateEndpointGatewayOptions struct { + // The target to use for this endpoint gateway. Must not already be the target of another + // endpoint gateway in the VPC. + Target EndpointGatewayTargetPrototypeIntf `json:"target" validate:"required"` + + // The VPC this endpoint gateway will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this endpoint gateway. If unspecified, the VPC's default security group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateEndpointGatewayOptions : Instantiate CreateEndpointGatewayOptions +func (*VpcV1) NewCreateEndpointGatewayOptions(target EndpointGatewayTargetPrototypeIntf, vpc VPCIdentityIntf) *CreateEndpointGatewayOptions { + return &CreateEndpointGatewayOptions{ + Target: target, + VPC: vpc, + } +} + +// SetTarget : Allow user to set Target +func (_options *CreateEndpointGatewayOptions) SetTarget(target EndpointGatewayTargetPrototypeIntf) *CreateEndpointGatewayOptions { + _options.Target = target + return _options +} + +// SetVPC : Allow user to set VPC +func (_options *CreateEndpointGatewayOptions) SetVPC(vpc VPCIdentityIntf) *CreateEndpointGatewayOptions { + _options.VPC = vpc + return _options +} + +// SetIps : Allow user to set Ips +func (_options *CreateEndpointGatewayOptions) SetIps(ips []EndpointGatewayReservedIPIntf) *CreateEndpointGatewayOptions { + _options.Ips = ips + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateEndpointGatewayOptions) SetName(name string) *CreateEndpointGatewayOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateEndpointGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateEndpointGatewayOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateEndpointGatewayOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateEndpointGatewayOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateEndpointGatewayOptions) SetHeaders(param map[string]string) *CreateEndpointGatewayOptions { + options.Headers = param + return options +} + +// CreateFloatingIPOptions : The CreateFloatingIP options. +type CreateFloatingIPOptions struct { + // The floating IP prototype object. + FloatingIPPrototype FloatingIPPrototypeIntf `json:"FloatingIPPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateFloatingIPOptions : Instantiate CreateFloatingIPOptions +func (*VpcV1) NewCreateFloatingIPOptions(floatingIPPrototype FloatingIPPrototypeIntf) *CreateFloatingIPOptions { + return &CreateFloatingIPOptions{ + FloatingIPPrototype: floatingIPPrototype, + } +} + +// SetFloatingIPPrototype : Allow user to set FloatingIPPrototype +func (_options *CreateFloatingIPOptions) SetFloatingIPPrototype(floatingIPPrototype FloatingIPPrototypeIntf) *CreateFloatingIPOptions { + _options.FloatingIPPrototype = floatingIPPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateFloatingIPOptions) SetHeaders(param map[string]string) *CreateFloatingIPOptions { + options.Headers = param + return options +} + +// CreateFlowLogCollectorOptions : The CreateFlowLogCollector options. +type CreateFlowLogCollectorOptions struct { + // The Cloud Object Storage bucket where the collected flows will be logged. + // The bucket must exist and an IAM service authorization must grant + // `IBM Cloud Flow Logs` resources of `VPC Infrastructure Services` writer + // access to the bucket. + StorageBucket LegacyCloudObjectStorageBucketIdentityIntf `json:"storage_bucket" validate:"required"` + + // The target this collector will collect flow logs for. If the target is an instance, + // subnet, or VPC, flow logs will not be collected for any network interfaces within the + // target that are themselves the target of a more specific flow log collector. + Target FlowLogCollectorTargetPrototypeIntf `json:"target" validate:"required"` + + // Indicates whether this collector will be active upon creation. + Active *bool `json:"active,omitempty"` + + // The 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateFlowLogCollectorOptions : Instantiate CreateFlowLogCollectorOptions +func (*VpcV1) NewCreateFlowLogCollectorOptions(storageBucket LegacyCloudObjectStorageBucketIdentityIntf, target FlowLogCollectorTargetPrototypeIntf) *CreateFlowLogCollectorOptions { + return &CreateFlowLogCollectorOptions{ + StorageBucket: storageBucket, + Target: target, + } +} + +// SetStorageBucket : Allow user to set StorageBucket +func (_options *CreateFlowLogCollectorOptions) SetStorageBucket(storageBucket LegacyCloudObjectStorageBucketIdentityIntf) *CreateFlowLogCollectorOptions { + _options.StorageBucket = storageBucket + return _options +} + +// SetTarget : Allow user to set Target +func (_options *CreateFlowLogCollectorOptions) SetTarget(target FlowLogCollectorTargetPrototypeIntf) *CreateFlowLogCollectorOptions { + _options.Target = target + return _options +} + +// SetActive : Allow user to set Active +func (_options *CreateFlowLogCollectorOptions) SetActive(active bool) *CreateFlowLogCollectorOptions { + _options.Active = core.BoolPtr(active) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateFlowLogCollectorOptions) SetName(name string) *CreateFlowLogCollectorOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateFlowLogCollectorOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateFlowLogCollectorOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateFlowLogCollectorOptions) SetHeaders(param map[string]string) *CreateFlowLogCollectorOptions { + options.Headers = param + return options +} + +// CreateIkePolicyOptions : The CreateIkePolicy options. +type CreateIkePolicyOptions struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // The Diffie-Hellman group. + DhGroup *int64 `json:"dh_group" validate:"required"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // The IKE protocol version. + IkeVersion *int64 `json:"ike_version" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateIkePolicyOptions.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceGroupOptions : Instantiate CreateInstanceGroupOptions +func (*VpcV1) NewCreateInstanceGroupOptions(instanceTemplate InstanceTemplateIdentityIntf, subnets []SubnetIdentityIntf) *CreateInstanceGroupOptions { + return &CreateInstanceGroupOptions{ + InstanceTemplate: instanceTemplate, + Subnets: subnets, + } +} + +// SetInstanceTemplate : Allow user to set InstanceTemplate +func (_options *CreateInstanceGroupOptions) SetInstanceTemplate(instanceTemplate InstanceTemplateIdentityIntf) *CreateInstanceGroupOptions { + _options.InstanceTemplate = instanceTemplate + return _options +} + +// SetSubnets : Allow user to set Subnets +func (_options *CreateInstanceGroupOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateInstanceGroupOptions { + _options.Subnets = subnets + return _options +} + +// SetApplicationPort : Allow user to set ApplicationPort +func (_options *CreateInstanceGroupOptions) SetApplicationPort(applicationPort int64) *CreateInstanceGroupOptions { + _options.ApplicationPort = core.Int64Ptr(applicationPort) + return _options +} + +// SetLoadBalancer : Allow user to set LoadBalancer +func (_options *CreateInstanceGroupOptions) SetLoadBalancer(loadBalancer LoadBalancerIdentityIntf) *CreateInstanceGroupOptions { + _options.LoadBalancer = loadBalancer + return _options +} + +// SetLoadBalancerPool : Allow user to set LoadBalancerPool +func (_options *CreateInstanceGroupOptions) SetLoadBalancerPool(loadBalancerPool LoadBalancerPoolIdentityIntf) *CreateInstanceGroupOptions { + _options.LoadBalancerPool = loadBalancerPool + return _options +} + +// SetMembershipCount : Allow user to set MembershipCount +func (_options *CreateInstanceGroupOptions) SetMembershipCount(membershipCount int64) *CreateInstanceGroupOptions { + _options.MembershipCount = core.Int64Ptr(membershipCount) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateInstanceGroupOptions) SetName(name string) *CreateInstanceGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateInstanceGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateInstanceGroupOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceGroupOptions) SetHeaders(param map[string]string) *CreateInstanceGroupOptions { + options.Headers = param + return options +} + +// 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 network attachment. This can be specified using an + // existing virtual network interface, or a prototype object for a new virtual network + // interface. + VirtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf `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 VirtualNetworkInterfacePrototypeAttachmentContextIntf) *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 VirtualNetworkInterfacePrototypeAttachmentContextIntf) *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 interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // The name for network interface. The name must not be used by another network interface on the virtual server + // instance. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the network interface. This can be specified using + // an existing reserved IP, or a prototype object for a new reserved IP. + // + // If an existing reserved IP or a prototype object with an address is specified, it must + // be available on the network interface's subnet. Otherwise, an available address on the + // subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceNetworkInterfaceOptions : Instantiate CreateInstanceNetworkInterfaceOptions +func (*VpcV1) NewCreateInstanceNetworkInterfaceOptions(instanceID string, subnet SubnetIdentityIntf) *CreateInstanceNetworkInterfaceOptions { + return &CreateInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + Subnet: subnet, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *CreateInstanceNetworkInterfaceOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetSubnet : Allow user to set Subnet +func (_options *CreateInstanceNetworkInterfaceOptions) SetSubnet(subnet SubnetIdentityIntf) *CreateInstanceNetworkInterfaceOptions { + _options.Subnet = subnet + return _options +} + +// SetAllowIPSpoofing : Allow user to set AllowIPSpoofing +func (_options *CreateInstanceNetworkInterfaceOptions) SetAllowIPSpoofing(allowIPSpoofing bool) *CreateInstanceNetworkInterfaceOptions { + _options.AllowIPSpoofing = core.BoolPtr(allowIPSpoofing) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateInstanceNetworkInterfaceOptions) SetName(name string) *CreateInstanceNetworkInterfaceOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPrimaryIP : Allow user to set PrimaryIP +func (_options *CreateInstanceNetworkInterfaceOptions) SetPrimaryIP(primaryIP NetworkInterfaceIPPrototypeIntf) *CreateInstanceNetworkInterfaceOptions { + _options.PrimaryIP = primaryIP + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateInstanceNetworkInterfaceOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateInstanceNetworkInterfaceOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// CreateInstanceOptions : The CreateInstance options. +type CreateInstanceOptions struct { + // The instance prototype object. + InstancePrototype InstancePrototypeIntf `json:"InstancePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceOptions : Instantiate CreateInstanceOptions +func (*VpcV1) NewCreateInstanceOptions(instancePrototype InstancePrototypeIntf) *CreateInstanceOptions { + return &CreateInstanceOptions{ + InstancePrototype: instancePrototype, + } +} + +// SetInstancePrototype : Allow user to set InstancePrototype +func (_options *CreateInstanceOptions) SetInstancePrototype(instancePrototype InstancePrototypeIntf) *CreateInstanceOptions { + _options.InstancePrototype = instancePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceOptions) SetHeaders(param map[string]string) *CreateInstanceOptions { + options.Headers = param + return options +} + +// CreateInstanceTemplateOptions : The CreateInstanceTemplate options. +type CreateInstanceTemplateOptions struct { + // The instance template prototype object. + InstanceTemplatePrototype InstanceTemplatePrototypeIntf `json:"InstanceTemplatePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceTemplateOptions : Instantiate CreateInstanceTemplateOptions +func (*VpcV1) NewCreateInstanceTemplateOptions(instanceTemplatePrototype InstanceTemplatePrototypeIntf) *CreateInstanceTemplateOptions { + return &CreateInstanceTemplateOptions{ + InstanceTemplatePrototype: instanceTemplatePrototype, + } +} + +// SetInstanceTemplatePrototype : Allow user to set InstanceTemplatePrototype +func (_options *CreateInstanceTemplateOptions) SetInstanceTemplatePrototype(instanceTemplatePrototype InstanceTemplatePrototypeIntf) *CreateInstanceTemplateOptions { + _options.InstanceTemplatePrototype = instanceTemplatePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceTemplateOptions) SetHeaders(param map[string]string) *CreateInstanceTemplateOptions { + options.Headers = param + return options +} + +// CreateInstanceVolumeAttachmentOptions : The CreateInstanceVolumeAttachment options. +type CreateInstanceVolumeAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // An existing volume to attach to the instance, or a prototype object for a new volume. + Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"` + + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceVolumeAttachmentOptions : Instantiate CreateInstanceVolumeAttachmentOptions +func (*VpcV1) NewCreateInstanceVolumeAttachmentOptions(instanceID string, volume VolumeAttachmentPrototypeVolumeIntf) *CreateInstanceVolumeAttachmentOptions { + return &CreateInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + Volume: volume, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *CreateInstanceVolumeAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetVolume : Allow user to set Volume +func (_options *CreateInstanceVolumeAttachmentOptions) SetVolume(volume VolumeAttachmentPrototypeVolumeIntf) *CreateInstanceVolumeAttachmentOptions { + _options.Volume = volume + return _options +} + +// SetDeleteVolumeOnInstanceDelete : Allow user to set DeleteVolumeOnInstanceDelete +func (_options *CreateInstanceVolumeAttachmentOptions) SetDeleteVolumeOnInstanceDelete(deleteVolumeOnInstanceDelete bool) *CreateInstanceVolumeAttachmentOptions { + _options.DeleteVolumeOnInstanceDelete = core.BoolPtr(deleteVolumeOnInstanceDelete) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateInstanceVolumeAttachmentOptions) SetName(name string) *CreateInstanceVolumeAttachmentOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *CreateInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// CreateIpsecPolicyOptions : The CreateIpsecPolicy options. +type CreateIpsecPolicyOptions struct { + // The authentication algorithm + // + // Must be `disabled` if and only if the `encryption_algorithm` is + // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // The encryption algorithm + // + // The `authentication_algorithm` must be `disabled` if and only if + // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or + // `aes256gcm16`. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // Perfect Forward Secrecy. + Pfs *string `json:"pfs" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The name for this IPsec policy. The name must not be used by another IPsec policies in the region. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateIpsecPolicyOptions.AuthenticationAlgorithm property. +// The authentication algorithm +// +// Must be `disabled` if and only if the `encryption_algorithm` is +// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. +const ( + CreateIpsecPolicyOptionsAuthenticationAlgorithmDisabledConst = "disabled" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha384Const = "sha384" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the CreateIpsecPolicyOptions.EncryptionAlgorithm property. +// The encryption algorithm +// +// The `authentication_algorithm` must be `disabled` if and only if +// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or +// `aes256gcm16`. +const ( + CreateIpsecPolicyOptionsEncryptionAlgorithmAes128Const = "aes128" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes192Const = "aes192" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes256Const = "aes256" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" +) + +// Constants associated with the CreateIpsecPolicyOptions.Pfs property. +// Perfect Forward Secrecy. +const ( + CreateIpsecPolicyOptionsPfsDisabledConst = "disabled" + CreateIpsecPolicyOptionsPfsGroup14Const = "group_14" + CreateIpsecPolicyOptionsPfsGroup15Const = "group_15" + CreateIpsecPolicyOptionsPfsGroup16Const = "group_16" + CreateIpsecPolicyOptionsPfsGroup17Const = "group_17" + CreateIpsecPolicyOptionsPfsGroup18Const = "group_18" + CreateIpsecPolicyOptionsPfsGroup19Const = "group_19" + CreateIpsecPolicyOptionsPfsGroup20Const = "group_20" + CreateIpsecPolicyOptionsPfsGroup21Const = "group_21" + CreateIpsecPolicyOptionsPfsGroup22Const = "group_22" + CreateIpsecPolicyOptionsPfsGroup23Const = "group_23" + CreateIpsecPolicyOptionsPfsGroup24Const = "group_24" + CreateIpsecPolicyOptionsPfsGroup31Const = "group_31" +) + +// NewCreateIpsecPolicyOptions : Instantiate CreateIpsecPolicyOptions +func (*VpcV1) NewCreateIpsecPolicyOptions(authenticationAlgorithm string, encryptionAlgorithm string, pfs string) *CreateIpsecPolicyOptions { + return &CreateIpsecPolicyOptions{ + AuthenticationAlgorithm: core.StringPtr(authenticationAlgorithm), + EncryptionAlgorithm: core.StringPtr(encryptionAlgorithm), + Pfs: core.StringPtr(pfs), + } +} + +// SetAuthenticationAlgorithm : Allow user to set AuthenticationAlgorithm +func (_options *CreateIpsecPolicyOptions) SetAuthenticationAlgorithm(authenticationAlgorithm string) *CreateIpsecPolicyOptions { + _options.AuthenticationAlgorithm = core.StringPtr(authenticationAlgorithm) + return _options +} + +// SetEncryptionAlgorithm : Allow user to set EncryptionAlgorithm +func (_options *CreateIpsecPolicyOptions) SetEncryptionAlgorithm(encryptionAlgorithm string) *CreateIpsecPolicyOptions { + _options.EncryptionAlgorithm = core.StringPtr(encryptionAlgorithm) + return _options +} + +// SetPfs : Allow user to set Pfs +func (_options *CreateIpsecPolicyOptions) SetPfs(pfs string) *CreateIpsecPolicyOptions { + _options.Pfs = core.StringPtr(pfs) + return _options +} + +// SetKeyLifetime : Allow user to set KeyLifetime +func (_options *CreateIpsecPolicyOptions) SetKeyLifetime(keyLifetime int64) *CreateIpsecPolicyOptions { + _options.KeyLifetime = core.Int64Ptr(keyLifetime) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateIpsecPolicyOptions) SetName(name string) *CreateIpsecPolicyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateIpsecPolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateIpsecPolicyOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateIpsecPolicyOptions) SetHeaders(param map[string]string) *CreateIpsecPolicyOptions { + options.Headers = param + return options +} + +// CreateKeyOptions : The CreateKey options. +type CreateKeyOptions struct { + // A unique public SSH key to import, in OpenSSH format (consisting of three space-separated fields: the algorithm + // name, base64-encoded key, and a comment). The algorithm and comment fields may be omitted, as only the key field is + // imported. + // + // Keys of type `rsa` may be 2048 or 4096 bits in length, however 4096 is recommended. Keys of type `ed25519` are 256 + // bits in length. + PublicKey *string `json:"public_key" validate:"required"` + + // The name for this key. The name must not be used by another key in the region. If unspecified, the name will be a + // hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The crypto-system used by this key. + Type *string `json:"type,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateKeyOptions.Type property. +// The crypto-system used by this key. +const ( + CreateKeyOptionsTypeEd25519Const = "ed25519" + CreateKeyOptionsTypeRsaConst = "rsa" +) + +// NewCreateKeyOptions : Instantiate CreateKeyOptions +func (*VpcV1) NewCreateKeyOptions(publicKey string) *CreateKeyOptions { + return &CreateKeyOptions{ + PublicKey: core.StringPtr(publicKey), + } +} + +// SetPublicKey : Allow user to set PublicKey +func (_options *CreateKeyOptions) SetPublicKey(publicKey string) *CreateKeyOptions { + _options.PublicKey = core.StringPtr(publicKey) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateKeyOptions) SetName(name string) *CreateKeyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateKeyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateKeyOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetType : Allow user to set Type +func (_options *CreateKeyOptions) SetType(typeVar string) *CreateKeyOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateKeyOptions) SetHeaders(param map[string]string) *CreateKeyOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerListenerOptions : The CreateLoadBalancerListener options. +type CreateLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. + // + // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http` and + // `https`. + // + // Additional restrictions: + // - If `default_pool` is set, the pool's protocol must match, or be compatible with + // the listener's protocol. At present, the compatible protocols are `http` and + // `https`. + // - If `https_redirect` is set, the protocol must be `http`. + Protocol *string `json:"protocol" validate:"required"` + + // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in + // the `application` family (otherwise always `false`). Additional restrictions: + // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must + // match the `accept_proxy_protocol` value of the `https_redirect` listener. + // - If this listener is the target of another listener's `https_redirect`, its + // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. + AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` + + // The certificate instance to use for SSL termination. The listener must have a + // `protocol` of `https`. + CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The default pool for this listener. If specified, the pool must: + // - Belong to this load balancer. + // - Have the same `protocol` as this listener, or have a compatible protocol. + // At present, the compatible protocols are `http` and `https`. + // - Not already be the `default_pool` for another listener. + // + // If unspecified, this listener will be created with no default pool, but one may be + // subsequently set. + DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` + + // The target listener that requests will be redirected to. This listener must have a + // `protocol` of `http`, and the target listener must have a `protocol` of `https`. + HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPrototype `json:"https_redirect,omitempty"` + + // The idle connection timeout of the listener in seconds. Supported for load balancers in the `application` family. + IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` + + // The policy prototype objects for this listener. The load balancer must be in the + // `application` family. + Policies []LoadBalancerListenerPolicyPrototype `json:"policies,omitempty"` + + // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must + // have a unique `port` and `protocol` combination. + // + // Not supported for load balancers operating with route mode enabled. + Port *int64 `json:"port,omitempty"` + + // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `65535` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `1` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMin *int64 `json:"port_min,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerListenerOptions.Protocol property. +// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. +// +// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http` and +// `https`. +// +// Additional restrictions: +// - If `default_pool` is set, the pool's protocol must match, or be compatible with +// the listener's protocol. At present, the compatible protocols are `http` and +// `https`. +// - If `https_redirect` is set, the protocol must be `http`. +const ( + CreateLoadBalancerListenerOptionsProtocolHTTPConst = "http" + CreateLoadBalancerListenerOptionsProtocolHTTPSConst = "https" + CreateLoadBalancerListenerOptionsProtocolTCPConst = "tcp" + CreateLoadBalancerListenerOptionsProtocolUDPConst = "udp" +) + +// NewCreateLoadBalancerListenerOptions : Instantiate CreateLoadBalancerListenerOptions +func (*VpcV1) NewCreateLoadBalancerListenerOptions(loadBalancerID string, protocol string) *CreateLoadBalancerListenerOptions { + return &CreateLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + Protocol: core.StringPtr(protocol), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetProtocol : Allow user to set Protocol +func (_options *CreateLoadBalancerListenerOptions) SetProtocol(protocol string) *CreateLoadBalancerListenerOptions { + _options.Protocol = core.StringPtr(protocol) + return _options +} + +// SetAcceptProxyProtocol : Allow user to set AcceptProxyProtocol +func (_options *CreateLoadBalancerListenerOptions) SetAcceptProxyProtocol(acceptProxyProtocol bool) *CreateLoadBalancerListenerOptions { + _options.AcceptProxyProtocol = core.BoolPtr(acceptProxyProtocol) + return _options +} + +// SetCertificateInstance : Allow user to set CertificateInstance +func (_options *CreateLoadBalancerListenerOptions) SetCertificateInstance(certificateInstance CertificateInstanceIdentityIntf) *CreateLoadBalancerListenerOptions { + _options.CertificateInstance = certificateInstance + return _options +} + +// SetConnectionLimit : Allow user to set ConnectionLimit +func (_options *CreateLoadBalancerListenerOptions) SetConnectionLimit(connectionLimit int64) *CreateLoadBalancerListenerOptions { + _options.ConnectionLimit = core.Int64Ptr(connectionLimit) + return _options +} + +// SetDefaultPool : Allow user to set DefaultPool +func (_options *CreateLoadBalancerListenerOptions) SetDefaultPool(defaultPool LoadBalancerPoolIdentityIntf) *CreateLoadBalancerListenerOptions { + _options.DefaultPool = defaultPool + return _options +} + +// SetHTTPSRedirect : Allow user to set HTTPSRedirect +func (_options *CreateLoadBalancerListenerOptions) SetHTTPSRedirect(httpsRedirect *LoadBalancerListenerHTTPSRedirectPrototype) *CreateLoadBalancerListenerOptions { + _options.HTTPSRedirect = httpsRedirect + return _options +} + +// SetIdleConnectionTimeout : Allow user to set IdleConnectionTimeout +func (_options *CreateLoadBalancerListenerOptions) SetIdleConnectionTimeout(idleConnectionTimeout int64) *CreateLoadBalancerListenerOptions { + _options.IdleConnectionTimeout = core.Int64Ptr(idleConnectionTimeout) + return _options +} + +// SetPolicies : Allow user to set Policies +func (_options *CreateLoadBalancerListenerOptions) SetPolicies(policies []LoadBalancerListenerPolicyPrototype) *CreateLoadBalancerListenerOptions { + _options.Policies = policies + return _options +} + +// SetPort : Allow user to set Port +func (_options *CreateLoadBalancerListenerOptions) SetPort(port int64) *CreateLoadBalancerListenerOptions { + _options.Port = core.Int64Ptr(port) + return _options +} + +// SetPortMax : Allow user to set PortMax +func (_options *CreateLoadBalancerListenerOptions) SetPortMax(portMax int64) *CreateLoadBalancerListenerOptions { + _options.PortMax = core.Int64Ptr(portMax) + return _options +} + +// SetPortMin : Allow user to set PortMin +func (_options *CreateLoadBalancerListenerOptions) SetPortMin(portMin int64) *CreateLoadBalancerListenerOptions { + _options.PortMin = core.Int64Ptr(portMin) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerListenerOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerListenerPolicyOptions : The CreateLoadBalancerListenerPolicy options. +type CreateLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy action. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the + // unexpected property value was encountered. + Action *string `json:"action" validate:"required"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority" validate:"required"` + + // The name for this policy. The name must not be used by another policy for the load balancer listener. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The rule prototype objects for this policy. + Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` + + // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. + // - If `action` is `https_redirect`, specify a + // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerListenerPolicyOptions.Action property. +// The policy action. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the +// unexpected property value was encountered. +const ( + CreateLoadBalancerListenerPolicyOptionsActionForwardConst = "forward" + CreateLoadBalancerListenerPolicyOptionsActionHTTPSRedirectConst = "https_redirect" + CreateLoadBalancerListenerPolicyOptionsActionRedirectConst = "redirect" + CreateLoadBalancerListenerPolicyOptionsActionRejectConst = "reject" +) + +// NewCreateLoadBalancerListenerPolicyOptions : Instantiate CreateLoadBalancerListenerPolicyOptions +func (*VpcV1) NewCreateLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, action string, priority int64) *CreateLoadBalancerListenerPolicyOptions { + return &CreateLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + Action: core.StringPtr(action), + Priority: core.Int64Ptr(priority), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerPolicyOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *CreateLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *CreateLoadBalancerListenerPolicyOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetAction : Allow user to set Action +func (_options *CreateLoadBalancerListenerPolicyOptions) SetAction(action string) *CreateLoadBalancerListenerPolicyOptions { + _options.Action = core.StringPtr(action) + return _options +} + +// SetPriority : Allow user to set Priority +func (_options *CreateLoadBalancerListenerPolicyOptions) SetPriority(priority int64) *CreateLoadBalancerListenerPolicyOptions { + _options.Priority = core.Int64Ptr(priority) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateLoadBalancerListenerPolicyOptions) SetName(name string) *CreateLoadBalancerListenerPolicyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetRules : Allow user to set Rules +func (_options *CreateLoadBalancerListenerPolicyOptions) SetRules(rules []LoadBalancerListenerPolicyRulePrototype) *CreateLoadBalancerListenerPolicyOptions { + _options.Rules = rules + return _options +} + +// SetTarget : Allow user to set Target +func (_options *CreateLoadBalancerListenerPolicyOptions) SetTarget(target LoadBalancerListenerPolicyTargetPrototypeIntf) *CreateLoadBalancerListenerPolicyOptions { + _options.Target = target + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerListenerPolicyRuleOptions : The CreateLoadBalancerListenerPolicyRule options. +type CreateLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // The condition of the rule. + Condition *string `json:"condition" validate:"required"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type" validate:"required"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value" validate:"required"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this property is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Condition property. +// The condition of the rule. +const ( + CreateLoadBalancerListenerPolicyRuleOptionsConditionContainsConst = "contains" + CreateLoadBalancerListenerPolicyRuleOptionsConditionEqualsConst = "equals" + CreateLoadBalancerListenerPolicyRuleOptionsConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + CreateLoadBalancerListenerPolicyRuleOptionsTypeBodyConst = "body" + CreateLoadBalancerListenerPolicyRuleOptionsTypeHeaderConst = "header" + CreateLoadBalancerListenerPolicyRuleOptionsTypeHostnameConst = "hostname" + CreateLoadBalancerListenerPolicyRuleOptionsTypePathConst = "path" + CreateLoadBalancerListenerPolicyRuleOptionsTypeQueryConst = "query" +) + +// NewCreateLoadBalancerListenerPolicyRuleOptions : Instantiate CreateLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewCreateLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, condition string, typeVar string, value string) *CreateLoadBalancerListenerPolicyRuleOptions { + return &CreateLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + Condition: core.StringPtr(condition), + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetCondition : Allow user to set Condition +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetCondition(condition string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.Condition = core.StringPtr(condition) + return _options +} + +// SetType : Allow user to set Type +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetType(typeVar string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetValue : Allow user to set Value +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetValue(value string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.Value = core.StringPtr(value) + return _options +} + +// SetField : Allow user to set Field +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetField(field string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.Field = core.StringPtr(field) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerOptions : The CreateLoadBalancer options. +type CreateLoadBalancerOptions struct { + // Indicates whether this load balancer is public. + // + // At present, if route mode is enabled, the load balancer must not be public. + IsPublic *bool `json:"is_public" validate:"required"` + + // The subnets to provision this load balancer in. The subnets must be in the same VPC. The load balancer's + // availability will depend on the availability of the zones that the subnets reside in. + // + // Load balancers in the `network` family allow only one subnet to be specified. + Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` + + // The datapath logging configuration for this load balancer. + Datapath *LoadBalancerLoggingDatapathPrototype `json:"datapath,omitempty"` + + // The DNS configuration for this load balancer. + // + // If unspecified, DNS `A` records for this load balancer's `hostname` property will be added + // to the public DNS zone `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be + // added to the specified `zone`. + Dns *LoadBalancerDnsPrototype `json:"dns,omitempty"` + + // The listeners of this load balancer. + Listeners []LoadBalancerListenerPrototypeLoadBalancerContext `json:"listeners,omitempty"` + + // The logging configuration to use for this load balancer. See [VPC Datapath + // Logging](https://cloud.ibm.com/docs/vpc?topic=vpc-datapath-logging) on the logging + // format, fields and permitted values. + // + // To activate logging, the load balancer profile must support the specified logging type. + Logging *LoadBalancerLoggingPrototype `json:"logging,omitempty"` + + // The name for this load balancer. The name must not be used by another load balancer in the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The pools of this load balancer. + Pools []LoadBalancerPoolPrototype `json:"pools,omitempty"` + + // The profile to use for this load balancer. + // + // If unspecified, `application` will be used. + Profile LoadBalancerProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Indicates whether route mode is enabled for this load balancer. + // + // At present, public load balancers are not supported with route mode enabled. + RouteMode *bool `json:"route_mode,omitempty"` + + // The security groups to use for this load balancer. If unspecified, the VPC's default security group is used. + // + // The load balancer profile must support security groups. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateLoadBalancerOptions : Instantiate CreateLoadBalancerOptions +func (*VpcV1) NewCreateLoadBalancerOptions(isPublic bool, subnets []SubnetIdentityIntf) *CreateLoadBalancerOptions { + return &CreateLoadBalancerOptions{ + IsPublic: core.BoolPtr(isPublic), + Subnets: subnets, + } +} + +// SetIsPublic : Allow user to set IsPublic +func (_options *CreateLoadBalancerOptions) SetIsPublic(isPublic bool) *CreateLoadBalancerOptions { + _options.IsPublic = core.BoolPtr(isPublic) + return _options +} + +// SetSubnets : Allow user to set Subnets +func (_options *CreateLoadBalancerOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateLoadBalancerOptions { + _options.Subnets = subnets + return _options +} + +// SetDatapath : Allow user to set Datapath +func (_options *CreateLoadBalancerOptions) SetDatapath(datapath *LoadBalancerLoggingDatapathPrototype) *CreateLoadBalancerOptions { + _options.Datapath = datapath + return _options +} + +// SetDns : Allow user to set Dns +func (_options *CreateLoadBalancerOptions) SetDns(dns *LoadBalancerDnsPrototype) *CreateLoadBalancerOptions { + _options.Dns = dns + return _options +} + +// SetListeners : Allow user to set Listeners +func (_options *CreateLoadBalancerOptions) SetListeners(listeners []LoadBalancerListenerPrototypeLoadBalancerContext) *CreateLoadBalancerOptions { + _options.Listeners = listeners + return _options +} + +// SetLogging : Allow user to set Logging +func (_options *CreateLoadBalancerOptions) SetLogging(logging *LoadBalancerLoggingPrototype) *CreateLoadBalancerOptions { + _options.Logging = logging + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateLoadBalancerOptions) SetName(name string) *CreateLoadBalancerOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPools : Allow user to set Pools +func (_options *CreateLoadBalancerOptions) SetPools(pools []LoadBalancerPoolPrototype) *CreateLoadBalancerOptions { + _options.Pools = pools + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *CreateLoadBalancerOptions) SetProfile(profile LoadBalancerProfileIdentityIntf) *CreateLoadBalancerOptions { + _options.Profile = profile + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateLoadBalancerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateLoadBalancerOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetRouteMode : Allow user to set RouteMode +func (_options *CreateLoadBalancerOptions) SetRouteMode(routeMode bool) *CreateLoadBalancerOptions { + _options.RouteMode = core.BoolPtr(routeMode) + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateLoadBalancerOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateLoadBalancerOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerOptions) SetHeaders(param map[string]string) *CreateLoadBalancerOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerPoolMemberOptions : The CreateLoadBalancerPoolMember options. +type CreateLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a + // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive + // the traffic on the same port the listener received it on.) + // + // This port will also be used for health checks unless the `port` property of + // `health_monitor` property is specified. + // + // The port must be unique across all members for all pools associated with this pool's listener. + Port *int64 `json:"port" validate:"required"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateLoadBalancerPoolMemberOptions : Instantiate CreateLoadBalancerPoolMemberOptions +func (*VpcV1) NewCreateLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, port int64, target LoadBalancerPoolMemberTargetPrototypeIntf) *CreateLoadBalancerPoolMemberOptions { + return &CreateLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + Port: core.Int64Ptr(port), + Target: target, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerPoolMemberOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *CreateLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *CreateLoadBalancerPoolMemberOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetPort : Allow user to set Port +func (_options *CreateLoadBalancerPoolMemberOptions) SetPort(port int64) *CreateLoadBalancerPoolMemberOptions { + _options.Port = core.Int64Ptr(port) + return _options +} + +// SetTarget : Allow user to set Target +func (_options *CreateLoadBalancerPoolMemberOptions) SetTarget(target LoadBalancerPoolMemberTargetPrototypeIntf) *CreateLoadBalancerPoolMemberOptions { + _options.Target = target + return _options +} + +// SetWeight : Allow user to set Weight +func (_options *CreateLoadBalancerPoolMemberOptions) SetWeight(weight int64) *CreateLoadBalancerPoolMemberOptions { + _options.Weight = core.Int64Ptr(weight) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *CreateLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerPoolOptions : The CreateLoadBalancerPool options. +type CreateLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The load balancing algorithm. + Algorithm *string `json:"algorithm" validate:"required"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitorPrototype `json:"health_monitor" validate:"required"` + + // The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if + // `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http`, and `https`. + Protocol *string `json:"protocol" validate:"required"` + + // The members for this load balancer pool. For load balancers in the `network` family, the same `port` and `target` + // tuple cannot be shared by a pool member of any other load balancer in the same VPC. + Members []LoadBalancerPoolMemberPrototype `json:"members,omitempty"` + + // The name for this load balancer pool. The name must not be used by another pool for the load balancer. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol,omitempty"` + + // The session persistence of this pool. + SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerPoolOptions.Algorithm property. +// The load balancing algorithm. +const ( + CreateLoadBalancerPoolOptionsAlgorithmLeastConnectionsConst = "least_connections" + CreateLoadBalancerPoolOptionsAlgorithmRoundRobinConst = "round_robin" + CreateLoadBalancerPoolOptionsAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the CreateLoadBalancerPoolOptions.Protocol property. +// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if +// `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http`, and `https`. +const ( + CreateLoadBalancerPoolOptionsProtocolHTTPConst = "http" + CreateLoadBalancerPoolOptionsProtocolHTTPSConst = "https" + CreateLoadBalancerPoolOptionsProtocolTCPConst = "tcp" + CreateLoadBalancerPoolOptionsProtocolUDPConst = "udp" +) + +// Constants associated with the CreateLoadBalancerPoolOptions.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + CreateLoadBalancerPoolOptionsProxyProtocolDisabledConst = "disabled" + CreateLoadBalancerPoolOptionsProxyProtocolV1Const = "v1" + CreateLoadBalancerPoolOptionsProxyProtocolV2Const = "v2" +) + +// NewCreateLoadBalancerPoolOptions : Instantiate CreateLoadBalancerPoolOptions +func (*VpcV1) NewCreateLoadBalancerPoolOptions(loadBalancerID string, algorithm string, healthMonitor *LoadBalancerPoolHealthMonitorPrototype, protocol string) *CreateLoadBalancerPoolOptions { + return &CreateLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + Algorithm: core.StringPtr(algorithm), + HealthMonitor: healthMonitor, + Protocol: core.StringPtr(protocol), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerPoolOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetAlgorithm : Allow user to set Algorithm +func (_options *CreateLoadBalancerPoolOptions) SetAlgorithm(algorithm string) *CreateLoadBalancerPoolOptions { + _options.Algorithm = core.StringPtr(algorithm) + return _options +} + +// SetHealthMonitor : Allow user to set HealthMonitor +func (_options *CreateLoadBalancerPoolOptions) SetHealthMonitor(healthMonitor *LoadBalancerPoolHealthMonitorPrototype) *CreateLoadBalancerPoolOptions { + _options.HealthMonitor = healthMonitor + return _options +} + +// SetProtocol : Allow user to set Protocol +func (_options *CreateLoadBalancerPoolOptions) SetProtocol(protocol string) *CreateLoadBalancerPoolOptions { + _options.Protocol = core.StringPtr(protocol) + return _options +} + +// SetMembers : Allow user to set Members +func (_options *CreateLoadBalancerPoolOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *CreateLoadBalancerPoolOptions { + _options.Members = members + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateLoadBalancerPoolOptions) SetName(name string) *CreateLoadBalancerPoolOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetProxyProtocol : Allow user to set ProxyProtocol +func (_options *CreateLoadBalancerPoolOptions) SetProxyProtocol(proxyProtocol string) *CreateLoadBalancerPoolOptions { + _options.ProxyProtocol = core.StringPtr(proxyProtocol) + return _options +} + +// SetSessionPersistence : Allow user to set SessionPersistence +func (_options *CreateLoadBalancerPoolOptions) SetSessionPersistence(sessionPersistence *LoadBalancerPoolSessionPersistencePrototype) *CreateLoadBalancerPoolOptions { + _options.SessionPersistence = sessionPersistence + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerPoolOptions) SetHeaders(param map[string]string) *CreateLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// CreateNetworkACLOptions : The CreateNetworkACL options. +type CreateNetworkACLOptions struct { + // The network ACL prototype object. + NetworkACLPrototype NetworkACLPrototypeIntf `json:"NetworkACLPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateNetworkACLOptions : Instantiate CreateNetworkACLOptions +func (*VpcV1) NewCreateNetworkACLOptions(networkACLPrototype NetworkACLPrototypeIntf) *CreateNetworkACLOptions { + return &CreateNetworkACLOptions{ + NetworkACLPrototype: networkACLPrototype, + } +} + +// SetNetworkACLPrototype : Allow user to set NetworkACLPrototype +func (_options *CreateNetworkACLOptions) SetNetworkACLPrototype(networkACLPrototype NetworkACLPrototypeIntf) *CreateNetworkACLOptions { + _options.NetworkACLPrototype = networkACLPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateNetworkACLOptions) SetHeaders(param map[string]string) *CreateNetworkACLOptions { + options.Headers = param + return options +} + +// CreateNetworkACLRuleOptions : The CreateNetworkACLRule options. +type CreateNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` + + // The network ACL rule prototype object. + NetworkACLRulePrototype NetworkACLRulePrototypeIntf `json:"NetworkACLRulePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateNetworkACLRuleOptions : Instantiate CreateNetworkACLRuleOptions +func (*VpcV1) NewCreateNetworkACLRuleOptions(networkACLID string, networkACLRulePrototype NetworkACLRulePrototypeIntf) *CreateNetworkACLRuleOptions { + return &CreateNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + NetworkACLRulePrototype: networkACLRulePrototype, + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *CreateNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *CreateNetworkACLRuleOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetNetworkACLRulePrototype : Allow user to set NetworkACLRulePrototype +func (_options *CreateNetworkACLRuleOptions) SetNetworkACLRulePrototype(networkACLRulePrototype NetworkACLRulePrototypeIntf) *CreateNetworkACLRuleOptions { + _options.NetworkACLRulePrototype = networkACLRulePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateNetworkACLRuleOptions) SetHeaders(param map[string]string) *CreateNetworkACLRuleOptions { + options.Headers = param + return options +} + +// CreatePlacementGroupOptions : The CreatePlacementGroup options. +type CreatePlacementGroupOptions struct { + // The strategy for this placement group + // - `host_spread`: place on different compute hosts + // - `power_spread`: place on compute hosts that use different power sources + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the + // unexpected strategy was encountered. + Strategy *string `json:"strategy" validate:"required"` + + // The name for this placement group. The name must not be used by another placement group in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreatePlacementGroupOptions.Strategy property. +// The strategy for this placement group +// - `host_spread`: place on different compute hosts +// - `power_spread`: place on compute hosts that use different power sources +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the +// unexpected strategy was encountered. +const ( + CreatePlacementGroupOptionsStrategyHostSpreadConst = "host_spread" + CreatePlacementGroupOptionsStrategyPowerSpreadConst = "power_spread" +) + +// NewCreatePlacementGroupOptions : Instantiate CreatePlacementGroupOptions +func (*VpcV1) NewCreatePlacementGroupOptions(strategy string) *CreatePlacementGroupOptions { + return &CreatePlacementGroupOptions{ + Strategy: core.StringPtr(strategy), + } +} + +// SetStrategy : Allow user to set Strategy +func (_options *CreatePlacementGroupOptions) SetStrategy(strategy string) *CreatePlacementGroupOptions { + _options.Strategy = core.StringPtr(strategy) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreatePlacementGroupOptions) SetName(name string) *CreatePlacementGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreatePlacementGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePlacementGroupOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreatePlacementGroupOptions) SetHeaders(param map[string]string) *CreatePlacementGroupOptions { + options.Headers = param + return options +} + +// CreatePublicGatewayOptions : The CreatePublicGateway options. +type CreatePublicGatewayOptions struct { + // The VPC this public gateway will 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreatePublicGatewayOptions : Instantiate CreatePublicGatewayOptions +func (*VpcV1) NewCreatePublicGatewayOptions(vpc VPCIdentityIntf, zone ZoneIdentityIntf) *CreatePublicGatewayOptions { + return &CreatePublicGatewayOptions{ + VPC: vpc, + Zone: zone, + } +} + +// SetVPC : Allow user to set VPC +func (_options *CreatePublicGatewayOptions) SetVPC(vpc VPCIdentityIntf) *CreatePublicGatewayOptions { + _options.VPC = vpc + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreatePublicGatewayOptions) SetZone(zone ZoneIdentityIntf) *CreatePublicGatewayOptions { + _options.Zone = zone + return _options +} + +// SetFloatingIP : Allow user to set FloatingIP +func (_options *CreatePublicGatewayOptions) SetFloatingIP(floatingIP PublicGatewayFloatingIPPrototypeIntf) *CreatePublicGatewayOptions { + _options.FloatingIP = floatingIP + return _options +} + +// SetName : Allow user to set Name +func (_options *CreatePublicGatewayOptions) SetName(name string) *CreatePublicGatewayOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreatePublicGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePublicGatewayOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreatePublicGatewayOptions) SetHeaders(param map[string]string) *CreatePublicGatewayOptions { + options.Headers = param + return options +} + +// CreateSecurityGroupOptions : The CreateSecurityGroup options. +type CreateSecurityGroupOptions struct { + // The VPC this security group 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The prototype objects for rules to be created for this security group. If unspecified, no rules will be created, + // resulting in all traffic being denied. + Rules []SecurityGroupRulePrototypeIntf `json:"rules,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSecurityGroupOptions : Instantiate CreateSecurityGroupOptions +func (*VpcV1) NewCreateSecurityGroupOptions(vpc VPCIdentityIntf) *CreateSecurityGroupOptions { + return &CreateSecurityGroupOptions{ + VPC: vpc, + } +} + +// SetVPC : Allow user to set VPC +func (_options *CreateSecurityGroupOptions) SetVPC(vpc VPCIdentityIntf) *CreateSecurityGroupOptions { + _options.VPC = vpc + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateSecurityGroupOptions) SetName(name string) *CreateSecurityGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateSecurityGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateSecurityGroupOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetRules : Allow user to set Rules +func (_options *CreateSecurityGroupOptions) SetRules(rules []SecurityGroupRulePrototypeIntf) *CreateSecurityGroupOptions { + _options.Rules = rules + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSecurityGroupOptions) SetHeaders(param map[string]string) *CreateSecurityGroupOptions { + options.Headers = param + return options +} + +// CreateSecurityGroupRuleOptions : The CreateSecurityGroupRule options. +type CreateSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The properties of the security group rule to be created. + SecurityGroupRulePrototype SecurityGroupRulePrototypeIntf `json:"SecurityGroupRulePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSecurityGroupRuleOptions : Instantiate CreateSecurityGroupRuleOptions +func (*VpcV1) NewCreateSecurityGroupRuleOptions(securityGroupID string, securityGroupRulePrototype SecurityGroupRulePrototypeIntf) *CreateSecurityGroupRuleOptions { + return &CreateSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + SecurityGroupRulePrototype: securityGroupRulePrototype, + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *CreateSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *CreateSecurityGroupRuleOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetSecurityGroupRulePrototype : Allow user to set SecurityGroupRulePrototype +func (_options *CreateSecurityGroupRuleOptions) SetSecurityGroupRulePrototype(securityGroupRulePrototype SecurityGroupRulePrototypeIntf) *CreateSecurityGroupRuleOptions { + _options.SecurityGroupRulePrototype = securityGroupRulePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSecurityGroupRuleOptions) SetHeaders(param map[string]string) *CreateSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// CreateSecurityGroupTargetBindingOptions : The CreateSecurityGroupTargetBinding options. +type CreateSecurityGroupTargetBindingOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The security group target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSecurityGroupTargetBindingOptions : Instantiate CreateSecurityGroupTargetBindingOptions +func (*VpcV1) NewCreateSecurityGroupTargetBindingOptions(securityGroupID string, id string) *CreateSecurityGroupTargetBindingOptions { + return &CreateSecurityGroupTargetBindingOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *CreateSecurityGroupTargetBindingOptions) SetSecurityGroupID(securityGroupID string) *CreateSecurityGroupTargetBindingOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *CreateSecurityGroupTargetBindingOptions) SetID(id string) *CreateSecurityGroupTargetBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSecurityGroupTargetBindingOptions) SetHeaders(param map[string]string) *CreateSecurityGroupTargetBindingOptions { + options.Headers = param + return options +} + +// CreateShareMountTargetOptions : The CreateShareMountTarget options. +type CreateShareMountTargetOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share mount target prototype object. + ShareMountTargetPrototype ShareMountTargetPrototypeIntf `json:"ShareMountTargetPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateShareMountTargetOptions : Instantiate CreateShareMountTargetOptions +func (*VpcV1) NewCreateShareMountTargetOptions(shareID string, shareMountTargetPrototype ShareMountTargetPrototypeIntf) *CreateShareMountTargetOptions { + return &CreateShareMountTargetOptions{ + ShareID: core.StringPtr(shareID), + ShareMountTargetPrototype: shareMountTargetPrototype, + } +} + +// SetShareID : Allow user to set ShareID +func (_options *CreateShareMountTargetOptions) SetShareID(shareID string) *CreateShareMountTargetOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetShareMountTargetPrototype : Allow user to set ShareMountTargetPrototype +func (_options *CreateShareMountTargetOptions) SetShareMountTargetPrototype(shareMountTargetPrototype ShareMountTargetPrototypeIntf) *CreateShareMountTargetOptions { + _options.ShareMountTargetPrototype = shareMountTargetPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateShareMountTargetOptions) SetHeaders(param map[string]string) *CreateShareMountTargetOptions { + options.Headers = param + return options +} + +// CreateShareOptions : The CreateShare options. +type CreateShareOptions struct { + // The file share prototype object. + SharePrototype SharePrototypeIntf `json:"SharePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateShareOptions : Instantiate CreateShareOptions +func (*VpcV1) NewCreateShareOptions(sharePrototype SharePrototypeIntf) *CreateShareOptions { + return &CreateShareOptions{ + SharePrototype: sharePrototype, + } +} + +// SetSharePrototype : Allow user to set SharePrototype +func (_options *CreateShareOptions) SetSharePrototype(sharePrototype SharePrototypeIntf) *CreateShareOptions { + _options.SharePrototype = sharePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateShareOptions) SetHeaders(param map[string]string) *CreateShareOptions { + options.Headers = param + return options +} + +// CreateSnapshotCloneOptions : The CreateSnapshotClone options. +type CreateSnapshotCloneOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // The zone name. + ZoneName *string `json:"zone_name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSnapshotCloneOptions : Instantiate CreateSnapshotCloneOptions +func (*VpcV1) NewCreateSnapshotCloneOptions(id string, zoneName string) *CreateSnapshotCloneOptions { + return &CreateSnapshotCloneOptions{ + ID: core.StringPtr(id), + ZoneName: core.StringPtr(zoneName), + } +} + +// SetID : Allow user to set ID +func (_options *CreateSnapshotCloneOptions) SetID(id string) *CreateSnapshotCloneOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *CreateSnapshotCloneOptions) SetZoneName(zoneName string) *CreateSnapshotCloneOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSnapshotCloneOptions) SetHeaders(param map[string]string) *CreateSnapshotCloneOptions { + options.Headers = param + return options +} + +// CreateSnapshotOptions : The CreateSnapshot options. +type CreateSnapshotOptions struct { + // The snapshot prototype object. + SnapshotPrototype SnapshotPrototypeIntf `json:"SnapshotPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSnapshotOptions : Instantiate CreateSnapshotOptions +func (*VpcV1) NewCreateSnapshotOptions(snapshotPrototype SnapshotPrototypeIntf) *CreateSnapshotOptions { + return &CreateSnapshotOptions{ + SnapshotPrototype: snapshotPrototype, + } +} + +// SetSnapshotPrototype : Allow user to set SnapshotPrototype +func (_options *CreateSnapshotOptions) SetSnapshotPrototype(snapshotPrototype SnapshotPrototypeIntf) *CreateSnapshotOptions { + _options.SnapshotPrototype = snapshotPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSnapshotOptions) SetHeaders(param map[string]string) *CreateSnapshotOptions { + options.Headers = param + return options +} + +// CreateSubnetOptions : The CreateSubnet options. +type CreateSubnetOptions struct { + // The subnet prototype object. + SubnetPrototype SubnetPrototypeIntf `json:"SubnetPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSubnetOptions : Instantiate CreateSubnetOptions +func (*VpcV1) NewCreateSubnetOptions(subnetPrototype SubnetPrototypeIntf) *CreateSubnetOptions { + return &CreateSubnetOptions{ + SubnetPrototype: subnetPrototype, + } +} + +// SetSubnetPrototype : Allow user to set SubnetPrototype +func (_options *CreateSubnetOptions) SetSubnetPrototype(subnetPrototype SubnetPrototypeIntf) *CreateSubnetOptions { + _options.SubnetPrototype = subnetPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSubnetOptions) SetHeaders(param map[string]string) *CreateSubnetOptions { + options.Headers = param + return options +} + +// CreateSubnetReservedIPOptions : The CreateSubnetReservedIP options. +type CreateSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `json:"subnet_id" validate:"required,ne="` + + // The IP address to reserve, which must not already be reserved on the subnet. + // + // If unspecified, an available address on the subnet will automatically be selected. + Address *string `json:"address,omitempty"` + + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with + // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated + // list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The target to bind this reserved IP to. The target must be in the same VPC. + // + // The following targets are supported: + // - An endpoint gateway not already bound to a reserved IP in the subnet's zone. + // - A virtual network interface. + // + // If unspecified, the reserved IP will be created unbound. + Target ReservedIPTargetPrototypeIntf `json:"target,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSubnetReservedIPOptions : Instantiate CreateSubnetReservedIPOptions +func (*VpcV1) NewCreateSubnetReservedIPOptions(subnetID string) *CreateSubnetReservedIPOptions { + return &CreateSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (_options *CreateSubnetReservedIPOptions) SetSubnetID(subnetID string) *CreateSubnetReservedIPOptions { + _options.SubnetID = core.StringPtr(subnetID) + return _options +} + +// SetAddress : Allow user to set Address +func (_options *CreateSubnetReservedIPOptions) SetAddress(address string) *CreateSubnetReservedIPOptions { + _options.Address = core.StringPtr(address) + return _options +} + +// SetAutoDelete : Allow user to set AutoDelete +func (_options *CreateSubnetReservedIPOptions) SetAutoDelete(autoDelete bool) *CreateSubnetReservedIPOptions { + _options.AutoDelete = core.BoolPtr(autoDelete) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateSubnetReservedIPOptions) SetName(name string) *CreateSubnetReservedIPOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetTarget : Allow user to set Target +func (_options *CreateSubnetReservedIPOptions) SetTarget(target ReservedIPTargetPrototypeIntf) *CreateSubnetReservedIPOptions { + _options.Target = target + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSubnetReservedIPOptions) SetHeaders(param map[string]string) *CreateSubnetReservedIPOptions { + options.Headers = param + return options +} + +// CreateVirtualNetworkInterfaceOptions : The CreateVirtualNetworkInterface options. +type CreateVirtualNetworkInterfaceOptions struct { + // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on + // this interface. If `true`, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. Must be `false` if the virtual network interface is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 + // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // same subnet as the primary IP. + // + // 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 []VirtualNetworkInterfaceIPsReservedIPPrototypeIntf `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 VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup VirtualNetworkInterfacePrototypeResourceGroupIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP and + // `primary_ip.address` is not specified. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVirtualNetworkInterfaceOptions : Instantiate CreateVirtualNetworkInterfaceOptions +func (*VpcV1) NewCreateVirtualNetworkInterfaceOptions() *CreateVirtualNetworkInterfaceOptions { + return &CreateVirtualNetworkInterfaceOptions{} +} + +// SetAllowIPSpoofing : Allow user to set AllowIPSpoofing +func (_options *CreateVirtualNetworkInterfaceOptions) SetAllowIPSpoofing(allowIPSpoofing bool) *CreateVirtualNetworkInterfaceOptions { + _options.AllowIPSpoofing = core.BoolPtr(allowIPSpoofing) + return _options +} + +// SetAutoDelete : Allow user to set AutoDelete +func (_options *CreateVirtualNetworkInterfaceOptions) SetAutoDelete(autoDelete bool) *CreateVirtualNetworkInterfaceOptions { + _options.AutoDelete = core.BoolPtr(autoDelete) + return _options +} + +// SetEnableInfrastructureNat : Allow user to set EnableInfrastructureNat +func (_options *CreateVirtualNetworkInterfaceOptions) SetEnableInfrastructureNat(enableInfrastructureNat bool) *CreateVirtualNetworkInterfaceOptions { + _options.EnableInfrastructureNat = core.BoolPtr(enableInfrastructureNat) + return _options +} + +// SetIps : Allow user to set Ips +func (_options *CreateVirtualNetworkInterfaceOptions) SetIps(ips []VirtualNetworkInterfaceIPsReservedIPPrototypeIntf) *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 VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { + _options.PrimaryIP = primaryIP + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateVirtualNetworkInterfaceOptions) SetResourceGroup(resourceGroup VirtualNetworkInterfacePrototypeResourceGroupIntf) *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 +} + +// CreateVPCOptions : The CreateVPC options. +type CreateVPCOptions struct { + // Indicates whether a [default address prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes) + // will be automatically created for each zone in this VPC. If `manual`, this VPC will be created with no default + // address prefixes. + // + // Since address prefixes are managed identically regardless of whether they were automatically created, the value is + // not preserved as a VPC property. + AddressPrefixManagement *string `json:"address_prefix_management,omitempty"` + + // Indicates whether this VPC will be connected to Classic Infrastructure. If true, this VPC's resources will have + // private network connectivity to the account's Classic Infrastructure resources. Only one VPC, per region, may be + // connected in this way. This value is set at creation and subsequently immutable. + ClassicAccess *bool `json:"classic_access,omitempty"` + + // The name for this VPC. The name must not be used by another VPC in the region. If unspecified, the name will be a + // hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPCOptions.AddressPrefixManagement property. +// Indicates whether a [default address prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes) +// will be automatically created for each zone in this VPC. If `manual`, this VPC will be created with no default +// address prefixes. +// +// Since address prefixes are managed identically regardless of whether they were automatically created, the value is +// not preserved as a VPC property. +const ( + CreateVPCOptionsAddressPrefixManagementAutoConst = "auto" + CreateVPCOptionsAddressPrefixManagementManualConst = "manual" +) + +// NewCreateVPCOptions : Instantiate CreateVPCOptions +func (*VpcV1) NewCreateVPCOptions() *CreateVPCOptions { + return &CreateVPCOptions{} +} + +// SetAddressPrefixManagement : Allow user to set AddressPrefixManagement +func (_options *CreateVPCOptions) SetAddressPrefixManagement(addressPrefixManagement string) *CreateVPCOptions { + _options.AddressPrefixManagement = core.StringPtr(addressPrefixManagement) + return _options +} + +// SetClassicAccess : Allow user to set ClassicAccess +func (_options *CreateVPCOptions) SetClassicAccess(classicAccess bool) *CreateVPCOptions { + _options.ClassicAccess = core.BoolPtr(classicAccess) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCOptions) SetName(name string) *CreateVPCOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateVPCOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVPCOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCOptions) SetHeaders(param map[string]string) *CreateVPCOptions { + options.Headers = param + return options +} + +// CreateVPCRouteOptions : The CreateVPCRoute options. +type CreateVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The destination of the route. At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Destination *string `json:"destination" validate:"required"` + + // The zone to apply the route to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The action to perform with a packet matching the route: + // - `delegate`: delegate to system-provided routes + // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes + // - `deliver`: deliver the packet to the specified `next_hop` + // - `drop`: drop the packet. + Action *string `json:"action,omitempty"` + + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, it must be omitted or specified as `0.0.0.0`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. + NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + + // The priority of this route. Smaller values have higher priority. + // + // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest + // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is + // distributed between them. + Priority *int64 `json:"priority,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPCRouteOptions.Action property. +// The action to perform with a packet matching the route: +// - `delegate`: delegate to system-provided routes +// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes +// - `deliver`: deliver the packet to the specified `next_hop` +// - `drop`: drop the packet. +const ( + CreateVPCRouteOptionsActionDelegateConst = "delegate" + CreateVPCRouteOptionsActionDelegateVPCConst = "delegate_vpc" + CreateVPCRouteOptionsActionDeliverConst = "deliver" + CreateVPCRouteOptionsActionDropConst = "drop" +) + +// NewCreateVPCRouteOptions : Instantiate CreateVPCRouteOptions +func (*VpcV1) NewCreateVPCRouteOptions(vpcID string, destination string, zone ZoneIdentityIntf) *CreateVPCRouteOptions { + return &CreateVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + Destination: core.StringPtr(destination), + Zone: zone, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCRouteOptions) SetVPCID(vpcID string) *CreateVPCRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetDestination : Allow user to set Destination +func (_options *CreateVPCRouteOptions) SetDestination(destination string) *CreateVPCRouteOptions { + _options.Destination = core.StringPtr(destination) + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateVPCRouteOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCRouteOptions { + _options.Zone = zone + return _options +} + +// SetAction : Allow user to set Action +func (_options *CreateVPCRouteOptions) SetAction(action string) *CreateVPCRouteOptions { + _options.Action = core.StringPtr(action) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCRouteOptions) SetName(name string) *CreateVPCRouteOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetNextHop : Allow user to set NextHop +func (_options *CreateVPCRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRouteOptions { + _options.NextHop = nextHop + return _options +} + +// SetPriority : Allow user to set Priority +func (_options *CreateVPCRouteOptions) SetPriority(priority int64) *CreateVPCRouteOptions { + _options.Priority = core.Int64Ptr(priority) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCRouteOptions) SetHeaders(param map[string]string) *CreateVPCRouteOptions { + options.Headers = param + return options +} + +// CreateVPCRoutingTableOptions : The CreateVPCRoutingTable options. +type CreateVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The filters specifying the resources that may create routes in this routing table. + // + // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` + + // The 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 bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + // + // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled + // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing + // table. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` + + // If set to `true`, this routing table will be used to route traffic that originates from the internet. For this to + // succeed, the VPC must not already have a routing table with this property set to `true`. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be + // subject to routes in this routing table. + // - Routes with an action of deliver are treated as drop unless the `next_hop` is an + // IP address bound to a network interface on a subnet in the route's `zone`. + // Therefore, if an incoming packet matches a route with a `next_hop` of an + // internet-bound IP address or a VPN gateway connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"` + + // If set to `true`, this routing table will be used to route traffic that originates from [Transit + // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. The VPC must not already have a routing table with + // this property set to `true`. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` + + // If set to `true`, this routing table will be used to route traffic that originates from subnets in other zones in + // this VPC. The VPC must not already have a routing table with this property set to `true`. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` + + // The prototype objects for routes to create for this routing table. If unspecified, the routing table will be created + // with no routes. + Routes []RoutePrototype `json:"routes,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPCRoutingTableOptions : Instantiate CreateVPCRoutingTableOptions +func (*VpcV1) NewCreateVPCRoutingTableOptions(vpcID string) *CreateVPCRoutingTableOptions { + return &CreateVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCRoutingTableOptions) SetVPCID(vpcID string) *CreateVPCRoutingTableOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetAcceptRoutesFrom : Allow user to set AcceptRoutesFrom +func (_options *CreateVPCRoutingTableOptions) SetAcceptRoutesFrom(acceptRoutesFrom []ResourceFilter) *CreateVPCRoutingTableOptions { + _options.AcceptRoutesFrom = acceptRoutesFrom + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCRoutingTableOptions) SetName(name string) *CreateVPCRoutingTableOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetRouteDirectLinkIngress : Allow user to set RouteDirectLinkIngress +func (_options *CreateVPCRoutingTableOptions) SetRouteDirectLinkIngress(routeDirectLinkIngress bool) *CreateVPCRoutingTableOptions { + _options.RouteDirectLinkIngress = core.BoolPtr(routeDirectLinkIngress) + return _options +} + +// 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 of the route. At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Destination *string `json:"destination" validate:"required"` + + // The zone to apply the route to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The action to perform with a packet matching the route: + // - `delegate`: delegate to system-provided routes + // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes + // - `deliver`: deliver the packet to the specified `next_hop` + // - `drop`: drop the packet. + Action *string `json:"action,omitempty"` + + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, it must be omitted or specified as `0.0.0.0`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. + NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + + // The priority of this route. Smaller values have higher priority. + // + // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest + // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is + // distributed between them. + Priority *int64 `json:"priority,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPCRoutingTableRouteOptions.Action property. +// The action to perform with a packet matching the route: +// - `delegate`: delegate to system-provided routes +// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes +// - `deliver`: deliver the packet to the specified `next_hop` +// - `drop`: drop the packet. +const ( + CreateVPCRoutingTableRouteOptionsActionDelegateConst = "delegate" + CreateVPCRoutingTableRouteOptionsActionDelegateVPCConst = "delegate_vpc" + CreateVPCRoutingTableRouteOptionsActionDeliverConst = "deliver" + CreateVPCRoutingTableRouteOptionsActionDropConst = "drop" +) + +// NewCreateVPCRoutingTableRouteOptions : Instantiate CreateVPCRoutingTableRouteOptions +func (*VpcV1) NewCreateVPCRoutingTableRouteOptions(vpcID string, routingTableID string, destination string, zone ZoneIdentityIntf) *CreateVPCRoutingTableRouteOptions { + return &CreateVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + Destination: core.StringPtr(destination), + Zone: zone, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *CreateVPCRoutingTableRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *CreateVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *CreateVPCRoutingTableRouteOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetDestination : Allow user to set Destination +func (_options *CreateVPCRoutingTableRouteOptions) SetDestination(destination string) *CreateVPCRoutingTableRouteOptions { + _options.Destination = core.StringPtr(destination) + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateVPCRoutingTableRouteOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCRoutingTableRouteOptions { + _options.Zone = zone + return _options +} + +// SetAction : Allow user to set Action +func (_options *CreateVPCRoutingTableRouteOptions) SetAction(action string) *CreateVPCRoutingTableRouteOptions { + _options.Action = core.StringPtr(action) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCRoutingTableRouteOptions) SetName(name string) *CreateVPCRoutingTableRouteOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetNextHop : Allow user to set NextHop +func (_options *CreateVPCRoutingTableRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRoutingTableRouteOptions { + _options.NextHop = nextHop + return _options +} + +// SetPriority : Allow user to set Priority +func (_options *CreateVPCRoutingTableRouteOptions) SetPriority(priority int64) *CreateVPCRoutingTableRouteOptions { + _options.Priority = core.Int64Ptr(priority) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *CreateVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// CreateVPNGatewayConnectionOptions : The CreateVPNGatewayConnection options. +type CreateVPNGatewayConnectionOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection prototype object. + VPNGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf `json:"VPNGatewayConnectionPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPNGatewayConnectionOptions : Instantiate CreateVPNGatewayConnectionOptions +func (*VpcV1) NewCreateVPNGatewayConnectionOptions(vpnGatewayID string, vpnGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf) *CreateVPNGatewayConnectionOptions { + return &CreateVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + VPNGatewayConnectionPrototype: vpnGatewayConnectionPrototype, + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *CreateVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *CreateVPNGatewayConnectionOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetVPNGatewayConnectionPrototype : Allow user to set VPNGatewayConnectionPrototype +func (_options *CreateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPrototype(vpnGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf) *CreateVPNGatewayConnectionOptions { + _options.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *CreateVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// CreateVPNGatewayOptions : The CreateVPNGateway options. +type CreateVPNGatewayOptions struct { + // The VPN gateway prototype object. + VPNGatewayPrototype VPNGatewayPrototypeIntf `json:"VPNGatewayPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPNGatewayOptions : Instantiate CreateVPNGatewayOptions +func (*VpcV1) NewCreateVPNGatewayOptions(vpnGatewayPrototype VPNGatewayPrototypeIntf) *CreateVPNGatewayOptions { + return &CreateVPNGatewayOptions{ + VPNGatewayPrototype: vpnGatewayPrototype, + } +} + +// SetVPNGatewayPrototype : Allow user to set VPNGatewayPrototype +func (_options *CreateVPNGatewayOptions) SetVPNGatewayPrototype(vpnGatewayPrototype VPNGatewayPrototypeIntf) *CreateVPNGatewayOptions { + _options.VPNGatewayPrototype = vpnGatewayPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNGatewayOptions) SetHeaders(param map[string]string) *CreateVPNGatewayOptions { + options.Headers = param + return options +} + +// CreateVPNServerOptions : The CreateVPNServer options. +type CreateVPNServerOptions struct { + // The certificate instance for this VPN server. + Certificate CertificateInstanceIdentityIntf `json:"certificate" validate:"required"` + + // The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all specified + // methods. + ClientAuthentication []VPNServerAuthenticationPrototypeIntf `json:"client_authentication" validate:"required"` + + // The VPN client IPv4 address pool, expressed in CIDR format. The request must not overlap with any existing address + // prefixes in the VPC or any of the following reserved address ranges: + // - `127.0.0.0/8` (IPv4 loopback addresses) + // - `161.26.0.0/16` (IBM services) + // - `166.8.0.0/14` (Cloud Service Endpoints) + // - `169.254.0.0/16` (IPv4 link-local addresses) + // - `224.0.0.0/4` (IPv4 multicast addresses) + // + // The prefix length of the client IP address pool's CIDR must be between + // `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that contains twice the number of IP addresses + // that are required to enable the maximum number of concurrent connections is recommended. + ClientIPPool *string `json:"client_ip_pool" validate:"required"` + + // The subnets to provision this VPN server in. Use subnets in different zones for high availability. + Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` + + // The DNS server addresses that will be provided to VPN clients connected to this VPN server. + ClientDnsServerIps []IP `json:"client_dns_server_ips,omitempty"` + + // The seconds a VPN client can be idle before this VPN server will disconnect it. Specify `0` to prevent the server + // from disconnecting idle clients. + ClientIdleTimeout *int64 `json:"client_idle_timeout,omitempty"` + + // Indicates whether the split tunneling is enabled on this VPN server. + EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` + + // The name for this VPN server. The name must not be used by another VPN server in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The port number to use for this VPN server. + Port *int64 `json:"port,omitempty"` + + // The transport protocol to use for this VPN server. + Protocol *string `json:"protocol,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this VPN server. If unspecified, the VPC's default security group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPNServerOptions.Protocol property. +// The transport protocol to use for this VPN server. +const ( + CreateVPNServerOptionsProtocolTCPConst = "tcp" + CreateVPNServerOptionsProtocolUDPConst = "udp" +) + +// NewCreateVPNServerOptions : Instantiate CreateVPNServerOptions +func (*VpcV1) NewCreateVPNServerOptions(certificate CertificateInstanceIdentityIntf, clientAuthentication []VPNServerAuthenticationPrototypeIntf, clientIPPool string, subnets []SubnetIdentityIntf) *CreateVPNServerOptions { + return &CreateVPNServerOptions{ + Certificate: certificate, + ClientAuthentication: clientAuthentication, + ClientIPPool: core.StringPtr(clientIPPool), + Subnets: subnets, + } +} + +// SetCertificate : Allow user to set Certificate +func (_options *CreateVPNServerOptions) SetCertificate(certificate CertificateInstanceIdentityIntf) *CreateVPNServerOptions { + _options.Certificate = certificate + return _options +} + +// SetClientAuthentication : Allow user to set ClientAuthentication +func (_options *CreateVPNServerOptions) SetClientAuthentication(clientAuthentication []VPNServerAuthenticationPrototypeIntf) *CreateVPNServerOptions { + _options.ClientAuthentication = clientAuthentication + return _options +} + +// SetClientIPPool : Allow user to set ClientIPPool +func (_options *CreateVPNServerOptions) SetClientIPPool(clientIPPool string) *CreateVPNServerOptions { + _options.ClientIPPool = core.StringPtr(clientIPPool) + return _options +} + +// SetSubnets : Allow user to set Subnets +func (_options *CreateVPNServerOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateVPNServerOptions { + _options.Subnets = subnets + return _options +} + +// SetClientDnsServerIps : Allow user to set ClientDnsServerIps +func (_options *CreateVPNServerOptions) SetClientDnsServerIps(clientDnsServerIps []IP) *CreateVPNServerOptions { + _options.ClientDnsServerIps = clientDnsServerIps + return _options +} + +// SetClientIdleTimeout : Allow user to set ClientIdleTimeout +func (_options *CreateVPNServerOptions) SetClientIdleTimeout(clientIdleTimeout int64) *CreateVPNServerOptions { + _options.ClientIdleTimeout = core.Int64Ptr(clientIdleTimeout) + return _options +} + +// SetEnableSplitTunneling : Allow user to set EnableSplitTunneling +func (_options *CreateVPNServerOptions) SetEnableSplitTunneling(enableSplitTunneling bool) *CreateVPNServerOptions { + _options.EnableSplitTunneling = core.BoolPtr(enableSplitTunneling) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPNServerOptions) SetName(name string) *CreateVPNServerOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPort : Allow user to set Port +func (_options *CreateVPNServerOptions) SetPort(port int64) *CreateVPNServerOptions { + _options.Port = core.Int64Ptr(port) + return _options +} + +// SetProtocol : Allow user to set Protocol +func (_options *CreateVPNServerOptions) SetProtocol(protocol string) *CreateVPNServerOptions { + _options.Protocol = core.StringPtr(protocol) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateVPNServerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVPNServerOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateVPNServerOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateVPNServerOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNServerOptions) SetHeaders(param map[string]string) *CreateVPNServerOptions { + options.Headers = param + return options +} + +// CreateVPNServerRouteOptions : The CreateVPNServerRoute options. +type CreateVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The destination to use for this VPN route in the VPN server. Must be unique within the VPN server. If an incoming + // packet does not match any destination, it will be dropped. + Destination *string `json:"destination" validate:"required"` + + // The action to perform with a packet matching the VPN route: + // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver + // the packet to target. + // - `deliver`: deliver the packet to the target. + // - `drop`: drop the packet + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the + // unexpected property value was encountered. + Action *string `json:"action,omitempty"` + + // The name for this VPN server route. The name must not be used by another route for the VPN server. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPNServerRouteOptions.Action property. +// The action to perform with a packet matching the VPN route: +// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver the +// packet to target. +// - `deliver`: deliver the packet to the target. +// - `drop`: drop the packet +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the +// unexpected property value was encountered. +const ( + CreateVPNServerRouteOptionsActionDeliverConst = "deliver" + CreateVPNServerRouteOptionsActionDropConst = "drop" + CreateVPNServerRouteOptionsActionTranslateConst = "translate" +) + +// NewCreateVPNServerRouteOptions : Instantiate CreateVPNServerRouteOptions +func (*VpcV1) NewCreateVPNServerRouteOptions(vpnServerID string, destination string) *CreateVPNServerRouteOptions { + return &CreateVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + Destination: core.StringPtr(destination), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *CreateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *CreateVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetDestination : Allow user to set Destination +func (_options *CreateVPNServerRouteOptions) SetDestination(destination string) *CreateVPNServerRouteOptions { + _options.Destination = core.StringPtr(destination) + return _options +} + +// SetAction : Allow user to set Action +func (_options *CreateVPNServerRouteOptions) SetAction(action string) *CreateVPNServerRouteOptions { + _options.Action = core.StringPtr(action) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPNServerRouteOptions) SetName(name string) *CreateVPNServerRouteOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNServerRouteOptions) SetHeaders(param map[string]string) *CreateVPNServerRouteOptions { + options.Headers = param + return options +} + +// DnsInstanceIdentity : Identifies a DNS instance by a unique property. +// Models which "extend" this model: +// - DnsInstanceIdentityByCRN +type DnsInstanceIdentity struct { + // The CRN for this DNS instance. + CRN *string `json:"crn,omitempty"` +} + +func (*DnsInstanceIdentity) isaDnsInstanceIdentity() bool { + return true +} + +type DnsInstanceIdentityIntf interface { + isaDnsInstanceIdentity() bool +} + +// UnmarshalDnsInstanceIdentity unmarshals an instance of DnsInstanceIdentity from the specified map of raw messages. +func UnmarshalDnsInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsInstanceIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsInstanceReference : DnsInstanceReference struct +type DnsInstanceReference struct { + // The CRN for this DNS instance. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalDnsInstanceReference unmarshals an instance of DnsInstanceReference from the specified map of raw messages. +func UnmarshalDnsInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsZoneIdentity : Identifies a DNS zone by a unique property. +// Models which "extend" this model: +// - DnsZoneIdentityByID +type DnsZoneIdentity struct { + ID *string `json:"id,omitempty"` +} + +func (*DnsZoneIdentity) isaDnsZoneIdentity() bool { + return true +} + +type DnsZoneIdentityIntf interface { + isaDnsZoneIdentity() bool +} + +// UnmarshalDnsZoneIdentity unmarshals an instance of DnsZoneIdentity from the specified map of raw messages. +func UnmarshalDnsZoneIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsZoneIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsZoneReference : DnsZoneReference struct +type DnsZoneReference struct { + ID *string `json:"id" validate:"required"` +} + +// UnmarshalDnsZoneReference unmarshals an instance of DnsZoneReference from the specified map of raw messages. +func UnmarshalDnsZoneReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsZoneReference) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHost : DedicatedHost struct +type DedicatedHost struct { + // The amount of memory in gibibytes that is currently available for instances. + AvailableMemory *int64 `json:"available_memory" validate:"required"` + + // The available VCPU for the dedicated host. + AvailableVcpu *Vcpu `json:"available_vcpu" validate:"required"` + + // The date and time that the dedicated host was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` + + // Collection of the dedicated host's disks. + Disks []DedicatedHostDisk `json:"disks" validate:"required"` + + // The dedicated host group this dedicated host is in. + Group *DedicatedHostGroupReference `json:"group" validate:"required"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` + + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled" validate:"required"` + + // The instances that are allocated to this dedicated host. + Instances []InstanceReference `json:"instances" validate:"required"` + + // The lifecycle state of the dedicated host. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The total amount of memory in gibibytes for this host. + Memory *int64 `json:"memory" validate:"required"` + + // The name for this dedicated host. The name is unique across all dedicated hosts in the region. + Name *string `json:"name" validate:"required"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) for this + // dedicated host. + Profile *DedicatedHostProfileReference `json:"profile" validate:"required"` + + // Indicates whether this dedicated host is available for instance creation. + Provisionable *bool `json:"provisionable" validate:"required"` + + // The resource group for this dedicated host. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The total number of sockets for this host. + SocketCount *int64 `json:"socket_count" validate:"required"` + + // The administrative state of the dedicated host. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which + // the unexpected property value was encountered. + State *string `json:"state" validate:"required"` + + // The instance profiles usable by instances placed on this dedicated host. + SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` + + // The total VCPU of the dedicated host. + Vcpu *Vcpu `json:"vcpu" validate:"required"` + + // The zone this dedicated host resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the DedicatedHost.LifecycleState property. +// The lifecycle state of the dedicated host. +const ( + DedicatedHostLifecycleStateDeletingConst = "deleting" + DedicatedHostLifecycleStateFailedConst = "failed" + DedicatedHostLifecycleStatePendingConst = "pending" + DedicatedHostLifecycleStateStableConst = "stable" + DedicatedHostLifecycleStateSuspendedConst = "suspended" + DedicatedHostLifecycleStateUpdatingConst = "updating" + DedicatedHostLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the DedicatedHost.ResourceType property. +// The resource type. +const ( + DedicatedHostResourceTypeDedicatedHostConst = "dedicated_host" +) + +// Constants associated with the DedicatedHost.State property. +// The administrative state of the dedicated host. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which +// the unexpected property value was encountered. +const ( + DedicatedHostStateAvailableConst = "available" + DedicatedHostStateDegradedConst = "degraded" + DedicatedHostStateMigratingConst = "migrating" + DedicatedHostStateUnavailableConst = "unavailable" +) + +// UnmarshalDedicatedHost unmarshals an instance of DedicatedHost from the specified map of raw messages. +func UnmarshalDedicatedHost(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHost) + err = core.UnmarshalPrimitive(m, "available_memory", &obj.AvailableMemory) + if err != nil { + return + } + err = core.UnmarshalModel(m, "available_vcpu", &obj.AvailableVcpu, UnmarshalVcpu) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalVcpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostCollection : DedicatedHostCollection struct +type DedicatedHostCollection struct { + // Collection of dedicated hosts. + DedicatedHosts []DedicatedHost `json:"dedicated_hosts" validate:"required"` + + // A link to the first page of resources. + First *DedicatedHostCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *DedicatedHostCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalDedicatedHostCollection unmarshals an instance of DedicatedHostCollection from the specified map of raw messages. +func UnmarshalDedicatedHostCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostCollection) + err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHost) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *DedicatedHostCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// DedicatedHostCollectionFirst : A link to the first page of resources. +type DedicatedHostCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalDedicatedHostCollectionFirst unmarshals an instance of DedicatedHostCollectionFirst from the specified map of raw messages. +func UnmarshalDedicatedHostCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type DedicatedHostCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalDedicatedHostCollectionNext unmarshals an instance of DedicatedHostCollectionNext from the specified map of raw messages. +func UnmarshalDedicatedHostCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostDisk : DedicatedHostDisk struct +type DedicatedHostDisk struct { + // The remaining space left for instance placement in GB (gigabytes). + Available *int64 `json:"available" validate:"required"` + + // The date and time that the disk was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this disk. + ID *string `json:"id" validate:"required"` + + // Instance disks that are on this dedicated host disk. + InstanceDisks []InstanceDiskReference `json:"instance_disks" validate:"required"` + + // The disk interface used for attaching the disk + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The lifecycle state of this dedicated host disk. + LifecycleState *string `json:"lifecycle_state,omitempty"` + + // The name for this dedicated host disk. The name is unique across all disks on the dedicated host. + Name *string `json:"name" validate:"required"` + + // Indicates whether this dedicated host disk is available for instance disk creation. + Provisionable *bool `json:"provisionable" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *int64 `json:"size" validate:"required"` + + // The instance disk interfaces supported for this dedicated host disk. + SupportedInstanceInterfaceTypes []string `json:"supported_instance_interface_types" validate:"required"` +} + +// Constants associated with the DedicatedHostDisk.InterfaceType property. +// The disk interface used for attaching the disk +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostDiskInterfaceTypeNvmeConst = "nvme" +) + +// Constants associated with the DedicatedHostDisk.LifecycleState property. +// The lifecycle state of this dedicated host disk. +const ( + DedicatedHostDiskLifecycleStateDeletingConst = "deleting" + DedicatedHostDiskLifecycleStateFailedConst = "failed" + DedicatedHostDiskLifecycleStatePendingConst = "pending" + DedicatedHostDiskLifecycleStateStableConst = "stable" + DedicatedHostDiskLifecycleStateSuspendedConst = "suspended" + DedicatedHostDiskLifecycleStateUpdatingConst = "updating" + DedicatedHostDiskLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the DedicatedHostDisk.ResourceType property. +// The resource type. +const ( + DedicatedHostDiskResourceTypeDedicatedHostDiskConst = "dedicated_host_disk" +) + +// Constants associated with the DedicatedHostDisk.SupportedInstanceInterfaceTypes property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostDiskSupportedInstanceInterfaceTypesNvmeConst = "nvme" + DedicatedHostDiskSupportedInstanceInterfaceTypesVirtioBlkConst = "virtio_blk" +) + +// UnmarshalDedicatedHostDisk unmarshals an instance of DedicatedHostDisk from the specified map of raw messages. +func UnmarshalDedicatedHostDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostDisk) + err = core.UnmarshalPrimitive(m, "available", &obj.Available) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_disks", &obj.InstanceDisks, UnmarshalInstanceDiskReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostDiskCollection : DedicatedHostDiskCollection struct +type DedicatedHostDiskCollection struct { + // Collection of the dedicated host's disks. + Disks []DedicatedHostDisk `json:"disks" validate:"required"` +} + +// UnmarshalDedicatedHostDiskCollection unmarshals an instance of DedicatedHostDiskCollection from the specified map of raw messages. +func UnmarshalDedicatedHostDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostDiskCollection) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostDiskPatch : DedicatedHostDiskPatch struct +type DedicatedHostDiskPatch struct { + // The name for this dedicated host disk. The name must not be used by another disk on the dedicated host. + Name *string `json:"name,omitempty"` +} + +// UnmarshalDedicatedHostDiskPatch unmarshals an instance of DedicatedHostDiskPatch from the specified map of raw messages. +func UnmarshalDedicatedHostDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostDiskPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the DedicatedHostDiskPatch +func (dedicatedHostDiskPatch *DedicatedHostDiskPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(dedicatedHostDiskPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// DedicatedHostGroup : DedicatedHostGroup struct +type DedicatedHostGroup struct { + // The dedicated host profile class for hosts in this group. + Class *string `json:"class" validate:"required"` + + // The date and time that the dedicated host group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` + + // The dedicated hosts that are in this dedicated host group. + DedicatedHosts []DedicatedHostReference `json:"dedicated_hosts" validate:"required"` + + // The dedicated host profile family for hosts in this group. + Family *string `json:"family" validate:"required"` + + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` + + // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. + Name *string `json:"name" validate:"required"` + + // The resource group for this dedicated host group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The instance profiles usable by instances placed on this dedicated host group. + SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` + + // The zone this dedicated host group resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the DedicatedHostGroup.Family property. +// The dedicated host profile family for hosts in this group. +const ( + DedicatedHostGroupFamilyBalancedConst = "balanced" + DedicatedHostGroupFamilyComputeConst = "compute" + DedicatedHostGroupFamilyMemoryConst = "memory" +) + +// Constants associated with the DedicatedHostGroup.ResourceType property. +// The resource type. +const ( + DedicatedHostGroupResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +// UnmarshalDedicatedHostGroup unmarshals an instance of DedicatedHostGroup from the specified map of raw messages. +func UnmarshalDedicatedHostGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroup) + err = core.UnmarshalPrimitive(m, "class", &obj.Class) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHostReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupCollection : DedicatedHostGroupCollection struct +type DedicatedHostGroupCollection struct { + // A link to the first page of resources. + First *DedicatedHostGroupCollectionFirst `json:"first" validate:"required"` + + // Collection of dedicated host groups. + Groups []DedicatedHostGroup `json:"groups" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *DedicatedHostGroupCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalDedicatedHostGroupCollection unmarshals an instance of DedicatedHostGroupCollection from the specified map of raw messages. +func UnmarshalDedicatedHostGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostGroupCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "groups", &obj.Groups, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *DedicatedHostGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// DedicatedHostGroupCollectionFirst : A link to the first page of resources. +type DedicatedHostGroupCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalDedicatedHostGroupCollectionFirst unmarshals an instance of DedicatedHostGroupCollectionFirst from the specified map of raw messages. +func UnmarshalDedicatedHostGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type DedicatedHostGroupCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalDedicatedHostGroupCollectionNext unmarshals an instance of DedicatedHostGroupCollectionNext from the specified map of raw messages. +func UnmarshalDedicatedHostGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. +// Models which "extend" this model: +// - DedicatedHostGroupIdentityByID +// - DedicatedHostGroupIdentityByCRN +// - DedicatedHostGroupIdentityByHref +type DedicatedHostGroupIdentity struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href,omitempty"` +} + +func (*DedicatedHostGroupIdentity) isaDedicatedHostGroupIdentity() bool { + return true +} + +type DedicatedHostGroupIdentityIntf interface { + isaDedicatedHostGroupIdentity() bool +} + +// UnmarshalDedicatedHostGroupIdentity unmarshals an instance of DedicatedHostGroupIdentity from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupPatch : DedicatedHostGroupPatch struct +type DedicatedHostGroupPatch struct { + // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. + Name *string `json:"name,omitempty"` +} + +// UnmarshalDedicatedHostGroupPatch unmarshals an instance of DedicatedHostGroupPatch from the specified map of raw messages. +func UnmarshalDedicatedHostGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the DedicatedHostGroupPatch +func (dedicatedHostGroupPatch *DedicatedHostGroupPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(dedicatedHostGroupPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// DedicatedHostGroupPrototypeDedicatedHostByZoneContext : DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct +type DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct { + // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the host's resource group is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` +} + +// UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext unmarshals an instance of DedicatedHostGroupPrototypeDedicatedHostByZoneContext from the specified map of raw messages. +func UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupPrototypeDedicatedHostByZoneContext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupReference : DedicatedHostGroupReference struct +type DedicatedHostGroupReference struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` + + // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the DedicatedHostGroupReference.ResourceType property. +// The resource type. +const ( + DedicatedHostGroupReferenceResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +// UnmarshalDedicatedHostGroupReference unmarshals an instance of DedicatedHostGroupReference from the specified map of raw messages. +func UnmarshalDedicatedHostGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type DedicatedHostGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalDedicatedHostGroupReferenceDeleted unmarshals an instance of DedicatedHostGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalDedicatedHostGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPatch : DedicatedHostPatch struct +type DedicatedHostPatch struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The name for this dedicated host. The name must not be used by another dedicated host in the region. + Name *string `json:"name,omitempty"` +} + +// UnmarshalDedicatedHostPatch unmarshals an instance of DedicatedHostPatch from the specified map of raw messages. +func UnmarshalDedicatedHostPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPatch) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the DedicatedHostPatch +func (dedicatedHostPatch *DedicatedHostPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(dedicatedHostPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// DedicatedHostProfile : DedicatedHostProfile struct +type DedicatedHostProfile struct { + // The product class this dedicated host profile belongs to. + Class *string `json:"class" validate:"required"` + + // Collection of the dedicated host profile's disks. + Disks []DedicatedHostProfileDisk `json:"disks" validate:"required"` + + // The product family this dedicated host profile belongs to + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Family *string `json:"family" validate:"required"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + Memory DedicatedHostProfileMemoryIntf `json:"memory" validate:"required"` + + // The globally unique name for this dedicated host profile. + Name *string `json:"name" validate:"required"` + + SocketCount DedicatedHostProfileSocketIntf `json:"socket_count" validate:"required"` + + // The instance profiles usable by instances placed on dedicated hosts with this profile. + SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` + + VcpuArchitecture *DedicatedHostProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` + + VcpuCount DedicatedHostProfileVcpuIntf `json:"vcpu_count" validate:"required"` + + VcpuManufacturer *DedicatedHostProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"` +} + +// Constants associated with the DedicatedHostProfile.Family property. +// The product family this dedicated host profile belongs to +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileFamilyBalancedConst = "balanced" + DedicatedHostProfileFamilyComputeConst = "compute" + DedicatedHostProfileFamilyMemoryConst = "memory" +) + +// UnmarshalDedicatedHostProfile unmarshals an instance of DedicatedHostProfile from the specified map of raw messages. +func UnmarshalDedicatedHostProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfile) + err = core.UnmarshalPrimitive(m, "class", &obj.Class) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalDedicatedHostProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "socket_count", &obj.SocketCount, UnmarshalDedicatedHostProfileSocket) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalDedicatedHostProfileVcpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalDedicatedHostProfileVcpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalDedicatedHostProfileVcpuManufacturer) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileCollection : DedicatedHostProfileCollection struct +type DedicatedHostProfileCollection struct { + // A link to the first page of resources. + First *DedicatedHostProfileCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *DedicatedHostProfileCollectionNext `json:"next,omitempty"` + + // Collection of dedicated host profiles. + Profiles []DedicatedHostProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalDedicatedHostProfileCollection unmarshals an instance of DedicatedHostProfileCollection from the specified map of raw messages. +func UnmarshalDedicatedHostProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostProfileCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalDedicatedHostProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *DedicatedHostProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// DedicatedHostProfileCollectionFirst : A link to the first page of resources. +type DedicatedHostProfileCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalDedicatedHostProfileCollectionFirst unmarshals an instance of DedicatedHostProfileCollectionFirst from the specified map of raw messages. +func UnmarshalDedicatedHostProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type DedicatedHostProfileCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalDedicatedHostProfileCollectionNext unmarshals an instance of DedicatedHostProfileCollectionNext from the specified map of raw messages. +func UnmarshalDedicatedHostProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDisk : Disks provided by this profile. +type DedicatedHostProfileDisk struct { + InterfaceType *DedicatedHostProfileDiskInterface `json:"interface_type" validate:"required"` + + // The number of disks of this type for a dedicated host with this profile. + Quantity *DedicatedHostProfileDiskQuantity `json:"quantity" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *DedicatedHostProfileDiskSize `json:"size" validate:"required"` + + SupportedInstanceInterfaceTypes *DedicatedHostProfileDiskSupportedInterfaces `json:"supported_instance_interface_types" validate:"required"` +} + +// UnmarshalDedicatedHostProfileDisk unmarshals an instance of DedicatedHostProfileDisk from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDisk) + err = core.UnmarshalModel(m, "interface_type", &obj.InterfaceType, UnmarshalDedicatedHostProfileDiskInterface) + if err != nil { + return + } + err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalDedicatedHostProfileDiskQuantity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalDedicatedHostProfileDiskSize) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes, UnmarshalDedicatedHostProfileDiskSupportedInterfaces) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskInterface : DedicatedHostProfileDiskInterface struct +type DedicatedHostProfileDiskInterface struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The interface of the disk for a dedicated host with this profile + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskInterface.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskInterfaceTypeFixedConst = "fixed" +) + +// Constants associated with the DedicatedHostProfileDiskInterface.Value property. +// The interface of the disk for a dedicated host with this profile +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileDiskInterfaceValueNvmeConst = "nvme" +) + +// UnmarshalDedicatedHostProfileDiskInterface unmarshals an instance of DedicatedHostProfileDiskInterface from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskInterface) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskQuantity : The number of disks of this type for a dedicated host with this profile. +type DedicatedHostProfileDiskQuantity struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskQuantity.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskQuantityTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileDiskQuantity unmarshals an instance of DedicatedHostProfileDiskQuantity from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskQuantity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskSize : The size of the disk in GB (gigabytes). +type DedicatedHostProfileDiskSize struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskSize.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskSizeTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileDiskSize unmarshals an instance of DedicatedHostProfileDiskSize from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskSize) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskSupportedInterfaces : DedicatedHostProfileDiskSupportedInterfaces struct +type DedicatedHostProfileDiskSupportedInterfaces struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The instance disk interfaces supported for a dedicated host with this profile. + Value []string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskSupportedInterfacesTypeFixedConst = "fixed" +) + +// Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Value property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileDiskSupportedInterfacesValueNvmeConst = "nvme" + DedicatedHostProfileDiskSupportedInterfacesValueVirtioBlkConst = "virtio_blk" +) + +// UnmarshalDedicatedHostProfileDiskSupportedInterfaces unmarshals an instance of DedicatedHostProfileDiskSupportedInterfaces from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileIdentity : Identifies a dedicated host profile by a unique property. +// Models which "extend" this model: +// - DedicatedHostProfileIdentityByName +// - DedicatedHostProfileIdentityByHref +type DedicatedHostProfileIdentity struct { + // The globally unique name for this dedicated host profile. + Name *string `json:"name,omitempty"` + + // The URL for this dedicated host profile. + Href *string `json:"href,omitempty"` +} + +func (*DedicatedHostProfileIdentity) isaDedicatedHostProfileIdentity() bool { + return true +} + +type DedicatedHostProfileIdentityIntf interface { + isaDedicatedHostProfileIdentity() bool +} + +// UnmarshalDedicatedHostProfileIdentity unmarshals an instance of DedicatedHostProfileIdentity from the specified map of raw messages. +func UnmarshalDedicatedHostProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemory : DedicatedHostProfileMemory struct +// Models which "extend" this model: +// - DedicatedHostProfileMemoryFixed +// - DedicatedHostProfileMemoryRange +// - DedicatedHostProfileMemoryEnum +// - DedicatedHostProfileMemoryDependent +type DedicatedHostProfileMemory struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the DedicatedHostProfileMemory.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileMemory) isaDedicatedHostProfileMemory() bool { + return true +} + +type DedicatedHostProfileMemoryIntf interface { + isaDedicatedHostProfileMemory() bool +} + +// UnmarshalDedicatedHostProfileMemory unmarshals an instance of DedicatedHostProfileMemory from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileReference : DedicatedHostProfileReference struct +type DedicatedHostProfileReference struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this dedicated host profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalDedicatedHostProfileReference unmarshals an instance of DedicatedHostProfileReference from the specified map of raw messages. +func UnmarshalDedicatedHostProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocket : DedicatedHostProfileSocket struct +// Models which "extend" this model: +// - DedicatedHostProfileSocketFixed +// - DedicatedHostProfileSocketRange +// - DedicatedHostProfileSocketEnum +// - DedicatedHostProfileSocketDependent +type DedicatedHostProfileSocket struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the DedicatedHostProfileSocket.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileSocket) isaDedicatedHostProfileSocket() bool { + return true +} + +type DedicatedHostProfileSocketIntf interface { + isaDedicatedHostProfileSocket() bool +} + +// UnmarshalDedicatedHostProfileSocket unmarshals an instance of DedicatedHostProfileSocket from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocket(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocket) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpu : DedicatedHostProfileVcpu struct +// Models which "extend" this model: +// - DedicatedHostProfileVcpuFixed +// - DedicatedHostProfileVcpuRange +// - DedicatedHostProfileVcpuEnum +// - DedicatedHostProfileVcpuDependent +type DedicatedHostProfileVcpu struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the DedicatedHostProfileVcpu.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileVcpu) isaDedicatedHostProfileVcpu() bool { + return true +} + +type DedicatedHostProfileVcpuIntf interface { + isaDedicatedHostProfileVcpu() bool +} + +// UnmarshalDedicatedHostProfileVcpu unmarshals an instance of DedicatedHostProfileVcpu from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpu) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuArchitecture : DedicatedHostProfileVcpuArchitecture struct +type DedicatedHostProfileVcpuArchitecture struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU architecture for a dedicated host with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuArchitecture.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuArchitectureTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileVcpuArchitecture unmarshals an instance of DedicatedHostProfileVcpuArchitecture from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuArchitecture) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuManufacturer : DedicatedHostProfileVcpuManufacturer struct +type DedicatedHostProfileVcpuManufacturer struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU manufacturer for a dedicated host with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuManufacturer.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuManufacturerTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileVcpuManufacturer unmarshals an instance of DedicatedHostProfileVcpuManufacturer from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuManufacturer) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPrototype : DedicatedHostPrototype struct +// Models which "extend" this model: +// - DedicatedHostPrototypeDedicatedHostByGroup +// - DedicatedHostPrototypeDedicatedHostByZone +type DedicatedHostPrototype struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this + // dedicated host. + Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The dedicated host group for this dedicated host. + Group DedicatedHostGroupIdentityIntf `json:"group,omitempty"` + + // The zone this dedicated host will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +func (*DedicatedHostPrototype) isaDedicatedHostPrototype() bool { + return true +} + +type DedicatedHostPrototypeIntf interface { + isaDedicatedHostPrototype() bool +} + +// UnmarshalDedicatedHostPrototype unmarshals an instance of DedicatedHostPrototype from the specified map of raw messages. +func UnmarshalDedicatedHostPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPrototype) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostReference : DedicatedHostReference struct +type DedicatedHostReference struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` + + // The name for this dedicated host. The name is unique across all dedicated hosts in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the DedicatedHostReference.ResourceType property. +// The resource type. +const ( + DedicatedHostReferenceResourceTypeDedicatedHostConst = "dedicated_host" +) + +// UnmarshalDedicatedHostReference unmarshals an instance of DedicatedHostReference from the specified map of raw messages. +func UnmarshalDedicatedHostReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type DedicatedHostReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalDedicatedHostReferenceDeleted unmarshals an instance of DedicatedHostReferenceDeleted from the specified map of raw messages. +func UnmarshalDedicatedHostReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DefaultNetworkACL : DefaultNetworkACL struct +type DefaultNetworkACL struct { + // The date and time that the network ACL was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` + + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` + + // The name of the default network ACL created for a VPC. The name will be a hyphenated list of randomly-selected words + // at creation, but may be changed. + Name *string `json:"name" validate:"required"` + + // The resource group for the default network ACL for a VPC. Set to the VPC's + // resource group at creation. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The ordered rules for the default network ACL for a VPC. Defaults to two rules which allow all inbound and outbound + // traffic, respectively. Rules for the default network ACL may be changed, added, or removed. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + + // The subnets to which this network ACL is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The VPC this network ACL resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalDefaultNetworkACL unmarshals an instance of DefaultNetworkACL from the specified map of raw messages. +func UnmarshalDefaultNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DefaultNetworkACL) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DefaultRoutingTable : DefaultRoutingTable struct +type DefaultRoutingTable struct { + // The filters specifying the resources that may create routes in this routing table. + // + // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` + + // The date and time that this routing table was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this routing table. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` + + // Indicates whether this is the default routing table for this VPC. + IsDefault *bool `json:"is_default" validate:"required"` + + // The lifecycle state of the routing table. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name of the default routing table created for this VPC. The name will be a hyphenated list of randomly-selected + // words at creation, but may be changed. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from the internet. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be + // subject to routes in this routing table. + // - Routes with an action of deliver are treated as drop unless the `next_hop` is an + // IP address bound to a network interface on a subnet in the route's `zone`. + // Therefore, if an incoming packet matches a route with a `next_hop` of an + // internet-bound IP address or a VPN gateway connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from from [Transit + // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` + + // The routes for the default routing table for this VPC. The table is created with no routes, but routes may be added, + // changed, or removed with a subsequent request. + Routes []RouteReference `json:"routes" validate:"required"` + + // The subnets to which this routing table is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` +} + +// Constants associated with the DefaultRoutingTable.LifecycleState property. +// The lifecycle state of the routing table. +const ( + DefaultRoutingTableLifecycleStateDeletingConst = "deleting" + DefaultRoutingTableLifecycleStateFailedConst = "failed" + DefaultRoutingTableLifecycleStatePendingConst = "pending" + DefaultRoutingTableLifecycleStateStableConst = "stable" + DefaultRoutingTableLifecycleStateSuspendedConst = "suspended" + DefaultRoutingTableLifecycleStateUpdatingConst = "updating" + DefaultRoutingTableLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the DefaultRoutingTable.ResourceType property. +// The resource type. +const ( + DefaultRoutingTableResourceTypeRoutingTableConst = "routing_table" +) + +// UnmarshalDefaultRoutingTable unmarshals an instance of DefaultRoutingTable from the specified map of raw messages. +func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DefaultRoutingTable) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DefaultSecurityGroup : DefaultSecurityGroup struct +type DefaultSecurityGroup struct { + // The date and time that this security group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The name for the default security group for a VPC. The name will be a hyphenated list of randomly-selected words at + // creation, but may changed. + Name *string `json:"name" validate:"required"` + + // The resource group for this security group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The rules for the default security group for a VPC. Defaults to allowing all outbound traffic, and allowing all + // inbound traffic from other interfaces in the VPC's default security group. Rules for the default security group may + // be changed, added or removed. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` + + // The targets for this security group. + Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` + + // The VPC this security group resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalDefaultSecurityGroup unmarshals an instance of DefaultSecurityGroup from the specified map of raw messages. +func UnmarshalDefaultSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DefaultSecurityGroup) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DeleteBackupPolicyOptions : The DeleteBackupPolicy options. +type DeleteBackupPolicyOptions struct { + // The backup policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteBackupPolicyOptions : Instantiate DeleteBackupPolicyOptions +func (*VpcV1) NewDeleteBackupPolicyOptions(id string) *DeleteBackupPolicyOptions { + return &DeleteBackupPolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteBackupPolicyOptions) SetID(id string) *DeleteBackupPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteBackupPolicyOptions) SetIfMatch(ifMatch string) *DeleteBackupPolicyOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBackupPolicyOptions) SetHeaders(param map[string]string) *DeleteBackupPolicyOptions { + options.Headers = param + return options +} + +// DeleteBackupPolicyPlanOptions : The DeleteBackupPolicyPlan options. +type DeleteBackupPolicyPlanOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // The backup policy plan identifier. + ID *string `json:"id" validate:"required,ne="` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteBackupPolicyPlanOptions : Instantiate DeleteBackupPolicyPlanOptions +func (*VpcV1) NewDeleteBackupPolicyPlanOptions(backupPolicyID string, id string) *DeleteBackupPolicyPlanOptions { + return &DeleteBackupPolicyPlanOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + ID: core.StringPtr(id), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *DeleteBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *DeleteBackupPolicyPlanOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteBackupPolicyPlanOptions) SetID(id string) *DeleteBackupPolicyPlanOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteBackupPolicyPlanOptions) SetIfMatch(ifMatch string) *DeleteBackupPolicyPlanOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBackupPolicyPlanOptions) SetHeaders(param map[string]string) *DeleteBackupPolicyPlanOptions { + options.Headers = param + return options +} + +// DeleteBareMetalServerNetworkAttachmentOptions : The DeleteBareMetalServerNetworkAttachment options. +type DeleteBareMetalServerNetworkAttachmentOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The 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 network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteBareMetalServerNetworkInterfaceOptions : Instantiate DeleteBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewDeleteBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string) *DeleteBareMetalServerNetworkInterfaceOptions { + return &DeleteBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *DeleteBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *DeleteBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteBareMetalServerNetworkInterfaceOptions) SetID(id string) *DeleteBareMetalServerNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options +} + +// DeleteBareMetalServerOptions : The DeleteBareMetalServer options. +type DeleteBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteBareMetalServerOptions : Instantiate DeleteBareMetalServerOptions +func (*VpcV1) NewDeleteBareMetalServerOptions(id string) *DeleteBareMetalServerOptions { + return &DeleteBareMetalServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteBareMetalServerOptions) SetID(id string) *DeleteBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBareMetalServerOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerOptions { + options.Headers = param + return options +} + +// DeleteDedicatedHostGroupOptions : The DeleteDedicatedHostGroup options. +type DeleteDedicatedHostGroupOptions struct { + // The dedicated host group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteDedicatedHostGroupOptions : Instantiate DeleteDedicatedHostGroupOptions +func (*VpcV1) NewDeleteDedicatedHostGroupOptions(id string) *DeleteDedicatedHostGroupOptions { + return &DeleteDedicatedHostGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteDedicatedHostGroupOptions) SetID(id string) *DeleteDedicatedHostGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteDedicatedHostGroupOptions) SetHeaders(param map[string]string) *DeleteDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// DeleteDedicatedHostOptions : The DeleteDedicatedHost options. +type DeleteDedicatedHostOptions struct { + // The dedicated host identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteDedicatedHostOptions : Instantiate DeleteDedicatedHostOptions +func (*VpcV1) NewDeleteDedicatedHostOptions(id string) *DeleteDedicatedHostOptions { + return &DeleteDedicatedHostOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteDedicatedHostOptions) SetID(id string) *DeleteDedicatedHostOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteDedicatedHostOptions) SetHeaders(param map[string]string) *DeleteDedicatedHostOptions { + options.Headers = param + return options +} + +// DeleteEndpointGatewayOptions : The DeleteEndpointGateway options. +type DeleteEndpointGatewayOptions struct { + // The endpoint gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteEndpointGatewayOptions : Instantiate DeleteEndpointGatewayOptions +func (*VpcV1) NewDeleteEndpointGatewayOptions(id string) *DeleteEndpointGatewayOptions { + return &DeleteEndpointGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteEndpointGatewayOptions) SetID(id string) *DeleteEndpointGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteEndpointGatewayOptions) SetHeaders(param map[string]string) *DeleteEndpointGatewayOptions { + options.Headers = param + return options +} + +// DeleteFloatingIPOptions : The DeleteFloatingIP options. +type DeleteFloatingIPOptions struct { + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteFloatingIPOptions : Instantiate DeleteFloatingIPOptions +func (*VpcV1) NewDeleteFloatingIPOptions(id string) *DeleteFloatingIPOptions { + return &DeleteFloatingIPOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteFloatingIPOptions) SetID(id string) *DeleteFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteFloatingIPOptions) SetHeaders(param map[string]string) *DeleteFloatingIPOptions { + options.Headers = param + return options +} + +// DeleteFlowLogCollectorOptions : The DeleteFlowLogCollector options. +type DeleteFlowLogCollectorOptions struct { + // The flow log collector identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteFlowLogCollectorOptions : Instantiate DeleteFlowLogCollectorOptions +func (*VpcV1) NewDeleteFlowLogCollectorOptions(id string) *DeleteFlowLogCollectorOptions { + return &DeleteFlowLogCollectorOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteFlowLogCollectorOptions) SetID(id string) *DeleteFlowLogCollectorOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteFlowLogCollectorOptions) SetHeaders(param map[string]string) *DeleteFlowLogCollectorOptions { + options.Headers = param + return options +} + +// DeleteIkePolicyOptions : The DeleteIkePolicy options. +type DeleteIkePolicyOptions struct { + // The IKE policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteIkePolicyOptions : Instantiate DeleteIkePolicyOptions +func (*VpcV1) NewDeleteIkePolicyOptions(id string) *DeleteIkePolicyOptions { + return &DeleteIkePolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteIkePolicyOptions) SetID(id string) *DeleteIkePolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteIkePolicyOptions) SetHeaders(param map[string]string) *DeleteIkePolicyOptions { + options.Headers = param + return options +} + +// DeleteImageExportJobOptions : The DeleteImageExportJob options. +type DeleteImageExportJobOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // The image export job identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteImageExportJobOptions : Instantiate DeleteImageExportJobOptions +func (*VpcV1) NewDeleteImageExportJobOptions(imageID string, id string) *DeleteImageExportJobOptions { + return &DeleteImageExportJobOptions{ + ImageID: core.StringPtr(imageID), + ID: core.StringPtr(id), + } +} + +// SetImageID : Allow user to set ImageID +func (_options *DeleteImageExportJobOptions) SetImageID(imageID string) *DeleteImageExportJobOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteImageExportJobOptions) SetID(id string) *DeleteImageExportJobOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteImageExportJobOptions) SetHeaders(param map[string]string) *DeleteImageExportJobOptions { + options.Headers = param + return options +} + +// DeleteImageOptions : The DeleteImage options. +type DeleteImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteImageOptions : Instantiate DeleteImageOptions +func (*VpcV1) NewDeleteImageOptions(id string) *DeleteImageOptions { + return &DeleteImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteImageOptions) SetID(id string) *DeleteImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteImageOptions) SetHeaders(param map[string]string) *DeleteImageOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupLoadBalancerOptions : The DeleteInstanceGroupLoadBalancer options. +type DeleteInstanceGroupLoadBalancerOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupLoadBalancerOptions : Instantiate DeleteInstanceGroupLoadBalancerOptions +func (*VpcV1) NewDeleteInstanceGroupLoadBalancerOptions(instanceGroupID string) *DeleteInstanceGroupLoadBalancerOptions { + return &DeleteInstanceGroupLoadBalancerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupLoadBalancerOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupLoadBalancerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupLoadBalancerOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupLoadBalancerOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupManagerActionOptions : The DeleteInstanceGroupManagerAction options. +type DeleteInstanceGroupManagerActionOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager action identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupManagerActionOptions : Instantiate DeleteInstanceGroupManagerActionOptions +func (*VpcV1) NewDeleteInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string) *DeleteInstanceGroupManagerActionOptions { + return &DeleteInstanceGroupManagerActionOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerActionOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *DeleteInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *DeleteInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupManagerActionOptions) SetID(id string) *DeleteInstanceGroupManagerActionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerActionOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupManagerOptions : The DeleteInstanceGroupManager options. +type DeleteInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupManagerOptions : Instantiate DeleteInstanceGroupManagerOptions +func (*VpcV1) NewDeleteInstanceGroupManagerOptions(instanceGroupID string, id string) *DeleteInstanceGroupManagerOptions { + return &DeleteInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupManagerOptions) SetID(id string) *DeleteInstanceGroupManagerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupManagerOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupManagerPolicyOptions : The DeleteInstanceGroupManagerPolicy options. +type DeleteInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupManagerPolicyOptions : Instantiate DeleteInstanceGroupManagerPolicyOptions +func (*VpcV1) NewDeleteInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string) *DeleteInstanceGroupManagerPolicyOptions { + return &DeleteInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerPolicyOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *DeleteInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *DeleteInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupManagerPolicyOptions) SetID(id string) *DeleteInstanceGroupManagerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupMembershipOptions : The DeleteInstanceGroupMembership options. +type DeleteInstanceGroupMembershipOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group membership identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupMembershipOptions : Instantiate DeleteInstanceGroupMembershipOptions +func (*VpcV1) NewDeleteInstanceGroupMembershipOptions(instanceGroupID string, id string) *DeleteInstanceGroupMembershipOptions { + return &DeleteInstanceGroupMembershipOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupMembershipOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupMembershipOptions) SetID(id string) *DeleteInstanceGroupMembershipOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupMembershipOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupMembershipsOptions : The DeleteInstanceGroupMemberships options. +type DeleteInstanceGroupMembershipsOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupMembershipsOptions : Instantiate DeleteInstanceGroupMembershipsOptions +func (*VpcV1) NewDeleteInstanceGroupMembershipsOptions(instanceGroupID string) *DeleteInstanceGroupMembershipsOptions { + return &DeleteInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupMembershipsOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupMembershipsOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupMembershipsOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupMembershipsOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupOptions : The DeleteInstanceGroup options. +type DeleteInstanceGroupOptions struct { + // The instance group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupOptions : Instantiate DeleteInstanceGroupOptions +func (*VpcV1) NewDeleteInstanceGroupOptions(id string) *DeleteInstanceGroupOptions { + return &DeleteInstanceGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupOptions) SetID(id string) *DeleteInstanceGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupOptions { + options.Headers = param + return options +} + +// DeleteInstanceNetworkAttachmentOptions : The DeleteInstanceNetworkAttachment options. +type DeleteInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceNetworkAttachmentOptions : Instantiate DeleteInstanceNetworkAttachmentOptions +func (*VpcV1) NewDeleteInstanceNetworkAttachmentOptions(instanceID string, id string) *DeleteInstanceNetworkAttachmentOptions { + return &DeleteInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *DeleteInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceNetworkAttachmentOptions) SetID(id string) *DeleteInstanceNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + +// DeleteInstanceNetworkInterfaceOptions : The DeleteInstanceNetworkInterface options. +type DeleteInstanceNetworkInterfaceOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The 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="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceOptions : Instantiate DeleteInstanceOptions +func (*VpcV1) NewDeleteInstanceOptions(id string) *DeleteInstanceOptions { + return &DeleteInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceOptions) SetID(id string) *DeleteInstanceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceOptions) SetHeaders(param map[string]string) *DeleteInstanceOptions { + options.Headers = param + return options +} + +// DeleteInstanceTemplateOptions : The DeleteInstanceTemplate options. +type DeleteInstanceTemplateOptions struct { + // The instance template identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceTemplateOptions : Instantiate DeleteInstanceTemplateOptions +func (*VpcV1) NewDeleteInstanceTemplateOptions(id string) *DeleteInstanceTemplateOptions { + return &DeleteInstanceTemplateOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceTemplateOptions) SetID(id string) *DeleteInstanceTemplateOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceTemplateOptions) SetHeaders(param map[string]string) *DeleteInstanceTemplateOptions { + options.Headers = param + return options +} + +// DeleteInstanceVolumeAttachmentOptions : The DeleteInstanceVolumeAttachment options. +type DeleteInstanceVolumeAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The volume attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceVolumeAttachmentOptions : Instantiate DeleteInstanceVolumeAttachmentOptions +func (*VpcV1) NewDeleteInstanceVolumeAttachmentOptions(instanceID string, id string) *DeleteInstanceVolumeAttachmentOptions { + return &DeleteInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *DeleteInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceVolumeAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceVolumeAttachmentOptions) SetID(id string) *DeleteInstanceVolumeAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// DeleteIpsecPolicyOptions : The DeleteIpsecPolicy options. +type DeleteIpsecPolicyOptions struct { + // The IPsec policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteIpsecPolicyOptions : Instantiate DeleteIpsecPolicyOptions +func (*VpcV1) NewDeleteIpsecPolicyOptions(id string) *DeleteIpsecPolicyOptions { + return &DeleteIpsecPolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteIpsecPolicyOptions) SetID(id string) *DeleteIpsecPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteIpsecPolicyOptions) SetHeaders(param map[string]string) *DeleteIpsecPolicyOptions { + options.Headers = param + return options +} + +// DeleteKeyOptions : The DeleteKey options. +type DeleteKeyOptions struct { + // The key identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteKeyOptions : Instantiate DeleteKeyOptions +func (*VpcV1) NewDeleteKeyOptions(id string) *DeleteKeyOptions { + return &DeleteKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteKeyOptions) SetID(id string) *DeleteKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteKeyOptions) SetHeaders(param map[string]string) *DeleteKeyOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerListenerOptions : The DeleteLoadBalancerListener options. +type DeleteLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerListenerOptions : Instantiate DeleteLoadBalancerListenerOptions +func (*VpcV1) NewDeleteLoadBalancerListenerOptions(loadBalancerID string, id string) *DeleteLoadBalancerListenerOptions { + return &DeleteLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerListenerOptions) SetID(id string) *DeleteLoadBalancerListenerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerListenerOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerListenerPolicyOptions : The DeleteLoadBalancerListenerPolicy options. +type DeleteLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerListenerPolicyOptions : Instantiate DeleteLoadBalancerListenerPolicyOptions +func (*VpcV1) NewDeleteLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string) *DeleteLoadBalancerListenerPolicyOptions { + return &DeleteLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerPolicyOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *DeleteLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *DeleteLoadBalancerListenerPolicyOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerListenerPolicyOptions) SetID(id string) *DeleteLoadBalancerListenerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerListenerPolicyRuleOptions : The DeleteLoadBalancerListenerPolicyRule options. +type DeleteLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerListenerPolicyRuleOptions : Instantiate DeleteLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewDeleteLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string) *DeleteLoadBalancerListenerPolicyRuleOptions { + return &DeleteLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *DeleteLoadBalancerListenerPolicyRuleOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *DeleteLoadBalancerListenerPolicyRuleOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetID(id string) *DeleteLoadBalancerListenerPolicyRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerOptions : The DeleteLoadBalancer options. +type DeleteLoadBalancerOptions struct { + // The load balancer identifier. + ID *string `json:"id" validate:"required,ne="` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerOptions : Instantiate DeleteLoadBalancerOptions +func (*VpcV1) NewDeleteLoadBalancerOptions(id string) *DeleteLoadBalancerOptions { + return &DeleteLoadBalancerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerOptions) SetID(id string) *DeleteLoadBalancerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteLoadBalancerOptions) SetIfMatch(ifMatch string) *DeleteLoadBalancerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerPoolMemberOptions : The DeleteLoadBalancerPoolMember options. +type DeleteLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The member identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerPoolMemberOptions : Instantiate DeleteLoadBalancerPoolMemberOptions +func (*VpcV1) NewDeleteLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string) *DeleteLoadBalancerPoolMemberOptions { + return &DeleteLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerPoolMemberOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *DeleteLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *DeleteLoadBalancerPoolMemberOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerPoolMemberOptions) SetID(id string) *DeleteLoadBalancerPoolMemberOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerPoolOptions : The DeleteLoadBalancerPool options. +type DeleteLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerPoolOptions : Instantiate DeleteLoadBalancerPoolOptions +func (*VpcV1) NewDeleteLoadBalancerPoolOptions(loadBalancerID string, id string) *DeleteLoadBalancerPoolOptions { + return &DeleteLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerPoolOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerPoolOptions) SetID(id string) *DeleteLoadBalancerPoolOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerPoolOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// DeleteNetworkACLOptions : The DeleteNetworkACL options. +type DeleteNetworkACLOptions struct { + // The network ACL identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteNetworkACLOptions : Instantiate DeleteNetworkACLOptions +func (*VpcV1) NewDeleteNetworkACLOptions(id string) *DeleteNetworkACLOptions { + return &DeleteNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteNetworkACLOptions) SetID(id string) *DeleteNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteNetworkACLOptions) SetHeaders(param map[string]string) *DeleteNetworkACLOptions { + options.Headers = param + return options +} + +// DeleteNetworkACLRuleOptions : The DeleteNetworkACLRule options. +type DeleteNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteNetworkACLRuleOptions : Instantiate DeleteNetworkACLRuleOptions +func (*VpcV1) NewDeleteNetworkACLRuleOptions(networkACLID string, id string) *DeleteNetworkACLRuleOptions { + return &DeleteNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + ID: core.StringPtr(id), + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *DeleteNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *DeleteNetworkACLRuleOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteNetworkACLRuleOptions) SetID(id string) *DeleteNetworkACLRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteNetworkACLRuleOptions) SetHeaders(param map[string]string) *DeleteNetworkACLRuleOptions { + options.Headers = param + return options +} + +// DeletePlacementGroupOptions : The DeletePlacementGroup options. +type DeletePlacementGroupOptions struct { + // The placement group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeletePlacementGroupOptions : Instantiate DeletePlacementGroupOptions +func (*VpcV1) NewDeletePlacementGroupOptions(id string) *DeletePlacementGroupOptions { + return &DeletePlacementGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeletePlacementGroupOptions) SetID(id string) *DeletePlacementGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeletePlacementGroupOptions) SetHeaders(param map[string]string) *DeletePlacementGroupOptions { + options.Headers = param + return options +} + +// DeletePublicGatewayOptions : The DeletePublicGateway options. +type DeletePublicGatewayOptions struct { + // The public gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeletePublicGatewayOptions : Instantiate DeletePublicGatewayOptions +func (*VpcV1) NewDeletePublicGatewayOptions(id string) *DeletePublicGatewayOptions { + return &DeletePublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeletePublicGatewayOptions) SetID(id string) *DeletePublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeletePublicGatewayOptions) SetHeaders(param map[string]string) *DeletePublicGatewayOptions { + options.Headers = param + return options +} + +// DeleteSecurityGroupOptions : The DeleteSecurityGroup options. +type DeleteSecurityGroupOptions struct { + // The security group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSecurityGroupOptions : Instantiate DeleteSecurityGroupOptions +func (*VpcV1) NewDeleteSecurityGroupOptions(id string) *DeleteSecurityGroupOptions { + return &DeleteSecurityGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteSecurityGroupOptions) SetID(id string) *DeleteSecurityGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSecurityGroupOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupOptions { + options.Headers = param + return options +} + +// DeleteSecurityGroupRuleOptions : The DeleteSecurityGroupRule options. +type DeleteSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSecurityGroupRuleOptions : Instantiate DeleteSecurityGroupRuleOptions +func (*VpcV1) NewDeleteSecurityGroupRuleOptions(securityGroupID string, id string) *DeleteSecurityGroupRuleOptions { + return &DeleteSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *DeleteSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *DeleteSecurityGroupRuleOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteSecurityGroupRuleOptions) SetID(id string) *DeleteSecurityGroupRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSecurityGroupRuleOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// DeleteSecurityGroupTargetBindingOptions : The DeleteSecurityGroupTargetBinding options. +type DeleteSecurityGroupTargetBindingOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The security group target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSecurityGroupTargetBindingOptions : Instantiate DeleteSecurityGroupTargetBindingOptions +func (*VpcV1) NewDeleteSecurityGroupTargetBindingOptions(securityGroupID string, id string) *DeleteSecurityGroupTargetBindingOptions { + return &DeleteSecurityGroupTargetBindingOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *DeleteSecurityGroupTargetBindingOptions) SetSecurityGroupID(securityGroupID string) *DeleteSecurityGroupTargetBindingOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteSecurityGroupTargetBindingOptions) SetID(id string) *DeleteSecurityGroupTargetBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSecurityGroupTargetBindingOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupTargetBindingOptions { + options.Headers = param + return options +} + +// DeleteShareMountTargetOptions : The DeleteShareMountTarget options. +type DeleteShareMountTargetOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share mount target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteShareMountTargetOptions : Instantiate DeleteShareMountTargetOptions +func (*VpcV1) NewDeleteShareMountTargetOptions(shareID string, id string) *DeleteShareMountTargetOptions { + return &DeleteShareMountTargetOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *DeleteShareMountTargetOptions) SetShareID(shareID string) *DeleteShareMountTargetOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteShareMountTargetOptions) SetID(id string) *DeleteShareMountTargetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteShareMountTargetOptions) SetHeaders(param map[string]string) *DeleteShareMountTargetOptions { + options.Headers = param + return options +} + +// DeleteShareOptions : The DeleteShare options. +type DeleteShareOptions struct { + // The file share identifier. + ID *string `json:"id" validate:"required,ne="` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteShareOptions : Instantiate DeleteShareOptions +func (*VpcV1) NewDeleteShareOptions(id string) *DeleteShareOptions { + return &DeleteShareOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteShareOptions) SetID(id string) *DeleteShareOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteShareOptions) SetIfMatch(ifMatch string) *DeleteShareOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteShareOptions) SetHeaders(param map[string]string) *DeleteShareOptions { + options.Headers = param + return options +} + +// DeleteShareSourceOptions : The DeleteShareSource options. +type DeleteShareSourceOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteShareSourceOptions : Instantiate DeleteShareSourceOptions +func (*VpcV1) NewDeleteShareSourceOptions(shareID string) *DeleteShareSourceOptions { + return &DeleteShareSourceOptions{ + ShareID: core.StringPtr(shareID), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *DeleteShareSourceOptions) SetShareID(shareID string) *DeleteShareSourceOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteShareSourceOptions) SetHeaders(param map[string]string) *DeleteShareSourceOptions { + options.Headers = param + return options +} + +// DeleteSnapshotCloneOptions : The DeleteSnapshotClone options. +type DeleteSnapshotCloneOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // The zone name. + ZoneName *string `json:"zone_name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSnapshotCloneOptions : Instantiate DeleteSnapshotCloneOptions +func (*VpcV1) NewDeleteSnapshotCloneOptions(id string, zoneName string) *DeleteSnapshotCloneOptions { + return &DeleteSnapshotCloneOptions{ + ID: core.StringPtr(id), + ZoneName: core.StringPtr(zoneName), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteSnapshotCloneOptions) SetID(id string) *DeleteSnapshotCloneOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *DeleteSnapshotCloneOptions) SetZoneName(zoneName string) *DeleteSnapshotCloneOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSnapshotCloneOptions) SetHeaders(param map[string]string) *DeleteSnapshotCloneOptions { + options.Headers = param + return options +} + +// 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 +} + +// DeleteVPCOptions : The DeleteVPC options. +type DeleteVPCOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCOptions : Instantiate DeleteVPCOptions +func (*VpcV1) NewDeleteVPCOptions(id string) *DeleteVPCOptions { + return &DeleteVPCOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCOptions) SetID(id string) *DeleteVPCOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCOptions) SetHeaders(param map[string]string) *DeleteVPCOptions { + options.Headers = param + return options +} + +// DeleteVPCRouteOptions : The DeleteVPCRoute options. +type DeleteVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCRouteOptions : Instantiate DeleteVPCRouteOptions +func (*VpcV1) NewDeleteVPCRouteOptions(vpcID string, id string) *DeleteVPCRouteOptions { + return &DeleteVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCRouteOptions) SetVPCID(vpcID string) *DeleteVPCRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCRouteOptions) SetID(id string) *DeleteVPCRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCRouteOptions) SetHeaders(param map[string]string) *DeleteVPCRouteOptions { + options.Headers = param + return options +} + +// DeleteVPCRoutingTableOptions : The DeleteVPCRoutingTable options. +type DeleteVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + ID *string `json:"id" validate:"required,ne="` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCRoutingTableOptions : Instantiate DeleteVPCRoutingTableOptions +func (*VpcV1) NewDeleteVPCRoutingTableOptions(vpcID string, id string) *DeleteVPCRoutingTableOptions { + return &DeleteVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCRoutingTableOptions) SetVPCID(vpcID string) *DeleteVPCRoutingTableOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCRoutingTableOptions) SetID(id string) *DeleteVPCRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVPCRoutingTableOptions) SetIfMatch(ifMatch string) *DeleteVPCRoutingTableOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCRoutingTableOptions) SetHeaders(param map[string]string) *DeleteVPCRoutingTableOptions { + options.Headers = param + return options +} + +// DeleteVPCRoutingTableRouteOptions : The DeleteVPCRoutingTableRoute options. +type DeleteVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` + + // The VPC routing table route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCRoutingTableRouteOptions : Instantiate DeleteVPCRoutingTableRouteOptions +func (*VpcV1) NewDeleteVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string) *DeleteVPCRoutingTableRouteOptions { + return &DeleteVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *DeleteVPCRoutingTableRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *DeleteVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *DeleteVPCRoutingTableRouteOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCRoutingTableRouteOptions) SetID(id string) *DeleteVPCRoutingTableRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *DeleteVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// DeleteVPNGatewayConnectionOptions : The DeleteVPNGatewayConnection options. +type DeleteVPNGatewayConnectionOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNGatewayConnectionOptions : Instantiate DeleteVPNGatewayConnectionOptions +func (*VpcV1) NewDeleteVPNGatewayConnectionOptions(vpnGatewayID string, id string) *DeleteVPNGatewayConnectionOptions { + return &DeleteVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *DeleteVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *DeleteVPNGatewayConnectionOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNGatewayConnectionOptions) SetID(id string) *DeleteVPNGatewayConnectionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// DeleteVPNGatewayOptions : The DeleteVPNGateway options. +type DeleteVPNGatewayOptions struct { + // The VPN gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNGatewayOptions : Instantiate DeleteVPNGatewayOptions +func (*VpcV1) NewDeleteVPNGatewayOptions(id string) *DeleteVPNGatewayOptions { + return &DeleteVPNGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNGatewayOptions) SetID(id string) *DeleteVPNGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNGatewayOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayOptions { + options.Headers = param + return options +} + +// DeleteVPNServerClientOptions : The DeleteVPNServerClient options. +type DeleteVPNServerClientOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN client identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNServerClientOptions : Instantiate DeleteVPNServerClientOptions +func (*VpcV1) NewDeleteVPNServerClientOptions(vpnServerID string, id string) *DeleteVPNServerClientOptions { + return &DeleteVPNServerClientOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *DeleteVPNServerClientOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerClientOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNServerClientOptions) SetID(id string) *DeleteVPNServerClientOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNServerClientOptions) SetHeaders(param map[string]string) *DeleteVPNServerClientOptions { + options.Headers = param + return options +} + +// DeleteVPNServerOptions : The DeleteVPNServer options. +type DeleteVPNServerOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNServerOptions : Instantiate DeleteVPNServerOptions +func (*VpcV1) NewDeleteVPNServerOptions(id string) *DeleteVPNServerOptions { + return &DeleteVPNServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNServerOptions) SetID(id string) *DeleteVPNServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVPNServerOptions) SetIfMatch(ifMatch string) *DeleteVPNServerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNServerOptions) SetHeaders(param map[string]string) *DeleteVPNServerOptions { + options.Headers = param + return options +} + +// DeleteVPNServerRouteOptions : The DeleteVPNServerRoute options. +type DeleteVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNServerRouteOptions : Instantiate DeleteVPNServerRouteOptions +func (*VpcV1) NewDeleteVPNServerRouteOptions(vpnServerID string, id string) *DeleteVPNServerRouteOptions { + return &DeleteVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *DeleteVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNServerRouteOptions) SetID(id string) *DeleteVPNServerRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNServerRouteOptions) SetHeaders(param map[string]string) *DeleteVPNServerRouteOptions { + options.Headers = param + return options +} + +// DisconnectVPNClientOptions : The DisconnectVPNClient options. +type DisconnectVPNClientOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN client identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDisconnectVPNClientOptions : Instantiate DisconnectVPNClientOptions +func (*VpcV1) NewDisconnectVPNClientOptions(vpnServerID string, id string) *DisconnectVPNClientOptions { + return &DisconnectVPNClientOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *DisconnectVPNClientOptions) SetVPNServerID(vpnServerID string) *DisconnectVPNClientOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DisconnectVPNClientOptions) SetID(id string) *DisconnectVPNClientOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DisconnectVPNClientOptions) SetHeaders(param map[string]string) *DisconnectVPNClientOptions { + options.Headers = param + return options +} + +// EncryptionKeyIdentity : Identifies an encryption key by a unique property. +// Models which "extend" this model: +// - EncryptionKeyIdentityByCRN +type EncryptionKeyIdentity struct { + // The CRN of the [Key Protect Root + // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto + // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. + CRN *string `json:"crn,omitempty"` +} + +func (*EncryptionKeyIdentity) isaEncryptionKeyIdentity() bool { + return true +} + +type EncryptionKeyIdentityIntf interface { + isaEncryptionKeyIdentity() bool +} + +// UnmarshalEncryptionKeyIdentity unmarshals an instance of EncryptionKeyIdentity from the specified map of raw messages. +func UnmarshalEncryptionKeyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EncryptionKeyIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EncryptionKeyReference : EncryptionKeyReference struct +type EncryptionKeyReference struct { + // The CRN of the [Key Protect Root + // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto + // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalEncryptionKeyReference unmarshals an instance of EncryptionKeyReference from the specified map of raw messages. +func UnmarshalEncryptionKeyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EncryptionKeyReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGateway : EndpointGateway struct +type EndpointGateway struct { + // The date and time that the endpoint gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` + + // The health of this resource. + // - `ok`: No abnormal behavior detected + // - `degraded`: Experiencing compromised performance, capacity, or connectivity + // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated + // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a + // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also + // have this state. + HealthState *string `json:"health_state" validate:"required"` + + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The reserved IPs bound to this endpoint gateway. + Ips []ReservedIPReference `json:"ips" validate:"required"` + + // The lifecycle state of the endpoint gateway. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this endpoint gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups targeting this endpoint gateway. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The fully qualified domain name for the target service. + // Deprecated: this field is deprecated and may be removed in a future release. + ServiceEndpoint *string `json:"service_endpoint,omitempty"` + + // The fully qualified domain names for the target service. + ServiceEndpoints []string `json:"service_endpoints" validate:"required"` + + // The target for this endpoint gateway. + Target EndpointGatewayTargetIntf `json:"target" validate:"required"` + + // The VPC this endpoint gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the EndpointGateway.HealthState property. +// The health of this resource. +// - `ok`: No abnormal behavior detected +// - `degraded`: Experiencing compromised performance, capacity, or connectivity +// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated +// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle +// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this +// state. +const ( + EndpointGatewayHealthStateDegradedConst = "degraded" + EndpointGatewayHealthStateFaultedConst = "faulted" + EndpointGatewayHealthStateInapplicableConst = "inapplicable" + EndpointGatewayHealthStateOkConst = "ok" +) + +// Constants associated with the EndpointGateway.LifecycleState property. +// The lifecycle state of the endpoint gateway. +const ( + EndpointGatewayLifecycleStateDeletingConst = "deleting" + EndpointGatewayLifecycleStateFailedConst = "failed" + EndpointGatewayLifecycleStatePendingConst = "pending" + EndpointGatewayLifecycleStateStableConst = "stable" + EndpointGatewayLifecycleStateSuspendedConst = "suspended" + EndpointGatewayLifecycleStateUpdatingConst = "updating" + EndpointGatewayLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the EndpointGateway.ResourceType property. +// The resource type. +const ( + EndpointGatewayResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +// UnmarshalEndpointGateway unmarshals an instance of EndpointGateway from the specified map of raw messages. +func UnmarshalEndpointGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGateway) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_endpoint", &obj.ServiceEndpoint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_endpoints", &obj.ServiceEndpoints) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalEndpointGatewayTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayCollection : EndpointGatewayCollection struct +type EndpointGatewayCollection struct { + // Collection of endpoint gateways. + EndpointGateways []EndpointGateway `json:"endpoint_gateways" validate:"required"` + + // A link to the first page of resources. + First *EndpointGatewayCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *EndpointGatewayCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalEndpointGatewayCollection unmarshals an instance of EndpointGatewayCollection from the specified map of raw messages. +func UnmarshalEndpointGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayCollection) + err = core.UnmarshalModel(m, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGateway) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalEndpointGatewayCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalEndpointGatewayCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *EndpointGatewayCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// EndpointGatewayCollectionFirst : A link to the first page of resources. +type EndpointGatewayCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalEndpointGatewayCollectionFirst unmarshals an instance of EndpointGatewayCollectionFirst from the specified map of raw messages. +func UnmarshalEndpointGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type EndpointGatewayCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalEndpointGatewayCollectionNext unmarshals an instance of EndpointGatewayCollectionNext from the specified map of raw messages. +func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayPatch : EndpointGatewayPatch struct +type EndpointGatewayPatch struct { + // The 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, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the EndpointGatewayPatch +func (endpointGatewayPatch *EndpointGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(endpointGatewayPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// EndpointGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type EndpointGatewayReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalEndpointGatewayReferenceDeleted unmarshals an instance of EndpointGatewayReferenceDeleted from the specified map of raw messages. +func UnmarshalEndpointGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIP : A reserved IP to bind to the endpoint gateway. This can be specified using an existing reserved IP, or a prototype +// object for a new reserved IP. The reserved IP will be bound to the endpoint gateway to function as a virtual private +// endpoint for the service. +// Models which "extend" this model: +// - EndpointGatewayReservedIPReservedIPIdentity +// - EndpointGatewayReservedIPReservedIPPrototypeTargetContext +type EndpointGatewayReservedIP struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` + + // The IP address to reserve, which must not already be reserved on the subnet. + // + // If unspecified, an available address on the subnet will automatically be selected. + Address *string `json:"address,omitempty"` + + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with + // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated + // list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The subnet in which to create this reserved IP. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +} + +func (*EndpointGatewayReservedIP) isaEndpointGatewayReservedIP() bool { + return true +} + +type EndpointGatewayReservedIPIntf interface { + isaEndpointGatewayReservedIP() bool +} + +// UnmarshalEndpointGatewayReservedIP unmarshals an instance of EndpointGatewayReservedIP from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIP) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTarget : The target for this endpoint gateway. +// Models which "extend" this model: +// - EndpointGatewayTargetProviderCloudServiceReference +// - EndpointGatewayTargetProviderInfrastructureServiceReference +type EndpointGatewayTarget struct { + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn,omitempty"` + + // The type of target. + ResourceType *string `json:"resource_type,omitempty"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the EndpointGatewayTarget.ResourceType property. +// The type of target. +const ( + EndpointGatewayTargetResourceTypeProviderCloudServiceConst = "provider_cloud_service" +) + +func (*EndpointGatewayTarget) isaEndpointGatewayTarget() bool { + return true +} + +type EndpointGatewayTargetIntf interface { + isaEndpointGatewayTarget() bool +} + +// UnmarshalEndpointGatewayTarget unmarshals an instance of EndpointGatewayTarget from the specified map of raw messages. +func UnmarshalEndpointGatewayTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototype : The target to use for this endpoint gateway. Must not already be the target of another endpoint gateway in the VPC. +// Models which "extend" this model: +// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentity +// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity +type EndpointGatewayTargetPrototype struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn,omitempty"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the EndpointGatewayTargetPrototype.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetPrototype) isaEndpointGatewayTargetPrototype() bool { + return true +} + +type EndpointGatewayTargetPrototypeIntf interface { + isaEndpointGatewayTargetPrototype() bool +} + +// UnmarshalEndpointGatewayTargetPrototype unmarshals an instance of EndpointGatewayTargetPrototype from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "resource_type", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'resource_type': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'resource_type' not found in JSON object") + return + } + if discValue == "provider_cloud_service" { + err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity) + } else if discValue == "provider_infrastructure_service" { + err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'resource_type': %s", discValue) + } + return +} + +// FailoverShareOptions : The FailoverShare options. +type FailoverShareOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The action to take if the failover request is accepted but cannot be performed or times out: + // - `fail`: Fail the operation, resulting in the replication relationship being unchanged. + // - `split`: Split the replica from its source, resulting in two individual read-write + // file shares. Because the final sync was not completed, the replica may be + // out-of-date. This is useful in disaster recovery scenarios where the source is known + // to be unreachable. + FallbackPolicy *string `json:"fallback_policy,omitempty"` + + // The failover timeout in seconds. + // + // If the timeout is reached, the `fallback_policy` will be triggered. + Timeout *int64 `json:"timeout,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the FailoverShareOptions.FallbackPolicy property. +// The action to take if the failover request is accepted but cannot be performed or times out: +// - `fail`: Fail the operation, resulting in the replication relationship being unchanged. +// - `split`: Split the replica from its source, resulting in two individual read-write +// file shares. Because the final sync was not completed, the replica may be +// out-of-date. This is useful in disaster recovery scenarios where the source is known +// to be unreachable. +const ( + FailoverShareOptionsFallbackPolicyFailConst = "fail" + FailoverShareOptionsFallbackPolicySplitConst = "split" +) + +// NewFailoverShareOptions : Instantiate FailoverShareOptions +func (*VpcV1) NewFailoverShareOptions(shareID string) *FailoverShareOptions { + return &FailoverShareOptions{ + ShareID: core.StringPtr(shareID), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *FailoverShareOptions) SetShareID(shareID string) *FailoverShareOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetFallbackPolicy : Allow user to set FallbackPolicy +func (_options *FailoverShareOptions) SetFallbackPolicy(fallbackPolicy string) *FailoverShareOptions { + _options.FallbackPolicy = core.StringPtr(fallbackPolicy) + return _options +} + +// SetTimeout : Allow user to set Timeout +func (_options *FailoverShareOptions) SetTimeout(timeout int64) *FailoverShareOptions { + _options.Timeout = core.Int64Ptr(timeout) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *FailoverShareOptions) SetHeaders(param map[string]string) *FailoverShareOptions { + options.Headers = param + return options +} + +// FloatingIP : FloatingIP struct +type FloatingIP struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` + + // The date and time that the floating IP was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` + + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` + + // The name for this floating IP. The name is unique across all floating IPs in the region. + Name *string `json:"name" validate:"required"` + + // The resource group for this floating IP. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The status of the floating IP. + Status *string `json:"status" validate:"required"` + + // The target of this floating IP. + Target FloatingIPTargetIntf `json:"target,omitempty"` + + // The zone this floating IP resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the FloatingIP.Status property. +// The status of the floating IP. +const ( + FloatingIPStatusAvailableConst = "available" + FloatingIPStatusDeletingConst = "deleting" + FloatingIPStatusFailedConst = "failed" + FloatingIPStatusPendingConst = "pending" +) + +// UnmarshalFloatingIP unmarshals an instance of FloatingIP from the specified map of raw messages. +func UnmarshalFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPCollection : FloatingIPCollection struct +type FloatingIPCollection struct { + // A link to the first page of resources. + First *FloatingIPCollectionFirst `json:"first" validate:"required"` + + // Collection of floating IPs. + FloatingIps []FloatingIP `json:"floating_ips" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *FloatingIPCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalFloatingIPCollection unmarshals an instance of FloatingIPCollection from the specified map of raw messages. +func UnmarshalFloatingIPCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFloatingIPCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFloatingIPCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *FloatingIPCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// FloatingIPCollectionFirst : A link to the first page of resources. +type FloatingIPCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalFloatingIPCollectionFirst unmarshals an instance of FloatingIPCollectionFirst from the specified map of raw messages. +func UnmarshalFloatingIPCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type FloatingIPCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalFloatingIPCollectionNext unmarshals an instance of FloatingIPCollectionNext from the specified map of raw messages. +func UnmarshalFloatingIPCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPCollectionVirtualNetworkInterfaceContext : FloatingIPCollectionVirtualNetworkInterfaceContext struct +type FloatingIPCollectionVirtualNetworkInterfaceContext struct { + // A link to the first page of resources. + First *FloatingIPCollectionVirtualNetworkInterfaceContextFirst `json:"first" validate:"required"` + + // Collection of floating IPs bound to the virtual network interface specified by the identifier in the URL. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *FloatingIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext unmarshals an instance of FloatingIPCollectionVirtualNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPCollectionVirtualNetworkInterfaceContext) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *FloatingIPCollectionVirtualNetworkInterfaceContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// FloatingIPCollectionVirtualNetworkInterfaceContextFirst : A link to the first page of resources. +type FloatingIPCollectionVirtualNetworkInterfaceContextFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst unmarshals an instance of FloatingIPCollectionVirtualNetworkInterfaceContextFirst from the specified map of raw messages. +func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPCollectionVirtualNetworkInterfaceContextFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPCollectionVirtualNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. +type FloatingIPCollectionVirtualNetworkInterfaceContextNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext unmarshals an instance of FloatingIPCollectionVirtualNetworkInterfaceContextNext from the specified map of raw messages. +func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPCollectionVirtualNetworkInterfaceContextNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPatch : FloatingIPPatch struct +type FloatingIPPatch struct { + // The name for this floating IP. The name must not be used by another floating IP in the region. + Name *string `json:"name,omitempty"` + + // The target resource to bind this floating IP to, replacing any existing binding. + // The floating IP must not be required by another resource, such as a public gateway. + // + // The target resource must not already have a floating IP bound to it if the target + // resource is: + // + // - an instance network interface + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` + // - a virtual network interface with `enable_infrastructure_nat` set to `true` + // + // Specify `null` to remove an existing binding. + Target FloatingIPTargetPatchIntf `json:"target,omitempty"` +} + +// UnmarshalFloatingIPPatch unmarshals an instance of FloatingIPPatch from the specified map of raw messages. +func UnmarshalFloatingIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the FloatingIPPatch +func (floatingIPPatch *FloatingIPPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(floatingIPPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// FloatingIPPrototype : FloatingIPPrototype struct +// Models which "extend" this model: +// - FloatingIPPrototypeFloatingIPByZone +// - FloatingIPPrototypeFloatingIPByTarget +type FloatingIPPrototype struct { + // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The zone this floating IP will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // The target resource to bind this floating IP to. + // + // The target resource must not already have a floating IP bound to it if the target + // resource is: + // + // - an instance network interface + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` + // - a virtual network interface with `enable_infrastructure_nat` set to `true`. + Target FloatingIPTargetPrototypeIntf `json:"target,omitempty"` +} + +func (*FloatingIPPrototype) isaFloatingIPPrototype() bool { + return true +} + +type FloatingIPPrototypeIntf interface { + isaFloatingIPPrototype() bool +} + +// UnmarshalFloatingIPPrototype unmarshals an instance of FloatingIPPrototype from the specified map of raw messages. +func UnmarshalFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPReference : FloatingIPReference struct +type FloatingIPReference struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` + + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` + + // The name for this floating IP. The name is unique across all floating IPs in the region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalFloatingIPReference unmarshals an instance of FloatingIPReference from the specified map of raw messages. +func UnmarshalFloatingIPReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPReference) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type FloatingIPReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalFloatingIPReferenceDeleted unmarshals an instance of FloatingIPReferenceDeleted from the specified map of raw messages. +func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTarget : The target of this floating IP. +// Models which "extend" this model: +// - FloatingIPTargetNetworkInterfaceReference +// - FloatingIPTargetPublicGatewayReference +// - FloatingIPTargetVirtualNetworkInterfaceReference +type FloatingIPTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The name for this network interface. + Name *string `json:"name,omitempty"` + + PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The CRN for this public gateway. + CRN *string `json:"crn,omitempty"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet,omitempty"` +} + +// Constants associated with the FloatingIPTarget.ResourceType property. +// The resource type. +const ( + FloatingIPTargetResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FloatingIPTarget) isaFloatingIPTarget() bool { + return true +} + +type FloatingIPTargetIntf interface { + isaFloatingIPTarget() bool +} + +// UnmarshalFloatingIPTarget unmarshals an instance of FloatingIPTarget from the specified map of raw messages. +func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatch : The target resource to bind this floating IP to, replacing any existing binding. The floating IP must not be required +// by another resource, such as a public gateway. +// +// The target resource must not already have a floating IP bound to it if the target resource is: +// +// - an instance network interface +// - a bare metal server network interface with `enable_infrastructure_nat` set to `true` +// - a virtual network interface with `enable_infrastructure_nat` set to `true` +// +// Specify `null` to remove an existing binding. +// Models which "extend" this model: +// - FloatingIPTargetPatchNetworkInterfaceIdentity +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatch struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*FloatingIPTargetPatch) isaFloatingIPTargetPatch() bool { + return true +} + +type FloatingIPTargetPatchIntf interface { + isaFloatingIPTargetPatch() bool +} + +// UnmarshalFloatingIPTargetPatch unmarshals an instance of FloatingIPTargetPatch from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototype : The target resource to bind this floating IP to. +// +// The target resource must not already have a floating IP bound to it if the target resource is: +// +// - an instance network interface +// - a bare metal server network interface with `enable_infrastructure_nat` set to `true` +// - a virtual network interface with `enable_infrastructure_nat` set to `true`. +// Models which "extend" this model: +// - FloatingIPTargetPrototypeNetworkInterfaceIdentity +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototype struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*FloatingIPTargetPrototype) isaFloatingIPTargetPrototype() bool { + return true +} + +type FloatingIPTargetPrototypeIntf interface { + isaFloatingIPTargetPrototype() bool +} + +// UnmarshalFloatingIPTargetPrototype unmarshals an instance of FloatingIPTargetPrototype from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPUnpaginatedCollection : FloatingIPUnpaginatedCollection struct +type FloatingIPUnpaginatedCollection struct { + // Collection of floating IPs. + FloatingIps []FloatingIP `json:"floating_ips" validate:"required"` +} + +// UnmarshalFloatingIPUnpaginatedCollection unmarshals an instance of FloatingIPUnpaginatedCollection from the specified map of raw messages. +func UnmarshalFloatingIPUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPUnpaginatedCollection) + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollector : FlowLogCollector struct +type FlowLogCollector struct { + // Indicates whether this collector is active. + Active *bool `json:"active" validate:"required"` + + // Indicates whether this flow log collector will be automatically deleted when `target` is deleted. At present, this + // is always `true`, but may be modifiable in the future. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // The date and time that the flow log collector was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this flow log collector. + CRN *string `json:"crn" validate:"required"` + + // The URL for this flow log collector. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this flow log collector. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the flow log collector. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this flow log collector. The name is unique across all flow log collectors in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this flow log collector. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The Cloud Object Storage bucket where the collected flows are logged. + StorageBucket *LegacyCloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` + + // The target this collector is collecting flow logs for. + // - If the target is an instance network attachment, flow logs will be collected + // for that instance network attachment. + // - If the target is an instance network interface, flow logs will be collected + // for that instance network interface. + // - If the target is a virtual network interface, flow logs will be collected for the + // the virtual network interface's `target` resource if the resource is: + // - an instance network attachment + // - If the target is a virtual server instance, flow logs will be collected + // for all network 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 network interfaces within the target that are themselves the target of + // a more specific flow log collector. + Target FlowLogCollectorTargetIntf `json:"target" validate:"required"` + + // The VPC this flow log collector resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the FlowLogCollector.LifecycleState property. +// The lifecycle state of the flow log collector. +const ( + FlowLogCollectorLifecycleStateDeletingConst = "deleting" + FlowLogCollectorLifecycleStateFailedConst = "failed" + FlowLogCollectorLifecycleStatePendingConst = "pending" + FlowLogCollectorLifecycleStateStableConst = "stable" + FlowLogCollectorLifecycleStateSuspendedConst = "suspended" + FlowLogCollectorLifecycleStateUpdatingConst = "updating" + FlowLogCollectorLifecycleStateWaitingConst = "waiting" +) + +// UnmarshalFlowLogCollector unmarshals an instance of FlowLogCollector from the specified map of raw messages. +func UnmarshalFlowLogCollector(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollector) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalLegacyCloudObjectStorageBucketReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFlowLogCollectorTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorCollection : FlowLogCollectorCollection struct +type FlowLogCollectorCollection struct { + // A link to the first page of resources. + First *FlowLogCollectorCollectionFirst `json:"first" validate:"required"` + + // Collection of flow log collectors. + FlowLogCollectors []FlowLogCollector `json:"flow_log_collectors" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *FlowLogCollectorCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalFlowLogCollectorCollection unmarshals an instance of FlowLogCollectorCollection from the specified map of raw messages. +func UnmarshalFlowLogCollectorCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFlowLogCollectorCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "flow_log_collectors", &obj.FlowLogCollectors, UnmarshalFlowLogCollector) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFlowLogCollectorCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *FlowLogCollectorCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// FlowLogCollectorCollectionFirst : A link to the first page of resources. +type FlowLogCollectorCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalFlowLogCollectorCollectionFirst unmarshals an instance of FlowLogCollectorCollectionFirst from the specified map of raw messages. +func UnmarshalFlowLogCollectorCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type FlowLogCollectorCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalFlowLogCollectorCollectionNext unmarshals an instance of FlowLogCollectorCollectionNext from the specified map of raw messages. +func UnmarshalFlowLogCollectorCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorPatch : FlowLogCollectorPatch struct +type FlowLogCollectorPatch struct { + // Indicates whether this collector is active. Updating to false deactivates the collector and updating to true + // activates the collector. + Active *bool `json:"active,omitempty"` + + // The name for this flow log collector. The name must not be used by another flow log collector in the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalFlowLogCollectorPatch unmarshals an instance of FlowLogCollectorPatch from the specified map of raw messages. +func UnmarshalFlowLogCollectorPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorPatch) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the FlowLogCollectorPatch +func (flowLogCollectorPatch *FlowLogCollectorPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(flowLogCollectorPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// FlowLogCollectorTarget : The target this collector is collecting flow logs for. +// - If the target is an instance network attachment, flow logs will be collected +// for that instance network attachment. +// - If the target is an instance network interface, flow logs will be collected +// for that instance network interface. +// - If the target is a virtual network interface, flow logs will be collected for the +// the virtual network interface's `target` resource if the resource is: +// - an instance network attachment +// - If the target is a virtual server instance, flow logs will be collected +// for all network 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 network interfaces within the target that are themselves the +// target of a more specific flow log collector. +// Models which "extend" this model: +// - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext +// - FlowLogCollectorTargetInstanceReference +// - FlowLogCollectorTargetSubnetReference +// - FlowLogCollectorTargetVPCReference +// - FlowLogCollectorTargetInstanceNetworkAttachmentReference +// - FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext +type FlowLogCollectorTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The name for this network interface. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The primary IP address of the virtual network interface for the network attachment. + PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` + + // The subnet of the virtual network interface for the network attachment. + Subnet *SubnetReference `json:"subnet,omitempty"` +} + +// Constants associated with the FlowLogCollectorTarget.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FlowLogCollectorTarget) isaFlowLogCollectorTarget() bool { + return true +} + +type FlowLogCollectorTargetIntf interface { + isaFlowLogCollectorTarget() bool +} + +// UnmarshalFlowLogCollectorTarget unmarshals an instance of FlowLogCollectorTarget from the specified map of raw messages. +func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototype : The target this collector will collect flow logs for. If the target is an instance, subnet, or VPC, flow logs will +// not be collected for any network interfaces within the target that are themselves the target of a more specific flow +// log collector. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity +// - FlowLogCollectorTargetPrototypeInstanceIdentity +// - FlowLogCollectorTargetPrototypeSubnetIdentity +// - FlowLogCollectorTargetPrototypeVPCIdentity +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity +type FlowLogCollectorTargetPrototype struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` +} + +func (*FlowLogCollectorTargetPrototype) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +type FlowLogCollectorTargetPrototypeIntf interface { + isaFlowLogCollectorTargetPrototype() bool +} + +// UnmarshalFlowLogCollectorTargetPrototype unmarshals an instance of FlowLogCollectorTargetPrototype from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// GenericResourceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type GenericResourceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalGenericResourceReferenceDeleted unmarshals an instance of GenericResourceReferenceDeleted from the specified map of raw messages. +func UnmarshalGenericResourceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(GenericResourceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 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 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 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 network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerNetworkInterfaceOptions : Instantiate GetBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewGetBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string) *GetBareMetalServerNetworkInterfaceOptions { + return &GetBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *GetBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerNetworkInterfaceOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options +} + +// GetBareMetalServerOptions : The GetBareMetalServer options. +type GetBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerOptions : Instantiate GetBareMetalServerOptions +func (*VpcV1) NewGetBareMetalServerOptions(id string) *GetBareMetalServerOptions { + return &GetBareMetalServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerOptions) SetID(id string) *GetBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerOptions) SetHeaders(param map[string]string) *GetBareMetalServerOptions { + options.Headers = param + return options +} + +// GetBareMetalServerProfileOptions : The GetBareMetalServerProfile options. +type GetBareMetalServerProfileOptions struct { + // The bare metal server profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerProfileOptions : Instantiate GetBareMetalServerProfileOptions +func (*VpcV1) NewGetBareMetalServerProfileOptions(name string) *GetBareMetalServerProfileOptions { + return &GetBareMetalServerProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetBareMetalServerProfileOptions) SetName(name string) *GetBareMetalServerProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerProfileOptions) SetHeaders(param map[string]string) *GetBareMetalServerProfileOptions { + options.Headers = param + return options +} + +// GetDedicatedHostDiskOptions : The GetDedicatedHostDisk options. +type GetDedicatedHostDiskOptions struct { + // The dedicated host identifier. + DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="` + + // The dedicated host disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostDiskOptions : Instantiate GetDedicatedHostDiskOptions +func (*VpcV1) NewGetDedicatedHostDiskOptions(dedicatedHostID string, id string) *GetDedicatedHostDiskOptions { + return &GetDedicatedHostDiskOptions{ + DedicatedHostID: core.StringPtr(dedicatedHostID), + ID: core.StringPtr(id), + } +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (_options *GetDedicatedHostDiskOptions) SetDedicatedHostID(dedicatedHostID string) *GetDedicatedHostDiskOptions { + _options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetDedicatedHostDiskOptions) SetID(id string) *GetDedicatedHostDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostDiskOptions) SetHeaders(param map[string]string) *GetDedicatedHostDiskOptions { + options.Headers = param + return options +} + +// GetDedicatedHostGroupOptions : The GetDedicatedHostGroup options. +type GetDedicatedHostGroupOptions struct { + // The dedicated host group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostGroupOptions : Instantiate GetDedicatedHostGroupOptions +func (*VpcV1) NewGetDedicatedHostGroupOptions(id string) *GetDedicatedHostGroupOptions { + return &GetDedicatedHostGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetDedicatedHostGroupOptions) SetID(id string) *GetDedicatedHostGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostGroupOptions) SetHeaders(param map[string]string) *GetDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// GetDedicatedHostOptions : The GetDedicatedHost options. +type GetDedicatedHostOptions struct { + // The dedicated host identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostOptions : Instantiate GetDedicatedHostOptions +func (*VpcV1) NewGetDedicatedHostOptions(id string) *GetDedicatedHostOptions { + return &GetDedicatedHostOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetDedicatedHostOptions) SetID(id string) *GetDedicatedHostOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostOptions) SetHeaders(param map[string]string) *GetDedicatedHostOptions { + options.Headers = param + return options +} + +// GetDedicatedHostProfileOptions : The GetDedicatedHostProfile options. +type GetDedicatedHostProfileOptions struct { + // The dedicated host profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostProfileOptions : Instantiate GetDedicatedHostProfileOptions +func (*VpcV1) NewGetDedicatedHostProfileOptions(name string) *GetDedicatedHostProfileOptions { + return &GetDedicatedHostProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetDedicatedHostProfileOptions) SetName(name string) *GetDedicatedHostProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostProfileOptions) SetHeaders(param map[string]string) *GetDedicatedHostProfileOptions { + options.Headers = param + return options +} + +// GetEndpointGatewayIPOptions : The GetEndpointGatewayIP options. +type GetEndpointGatewayIPOptions struct { + // The endpoint gateway identifier. + EndpointGatewayID *string `json:"endpoint_gateway_id" validate:"required,ne="` + + // The reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetEndpointGatewayIPOptions : Instantiate GetEndpointGatewayIPOptions +func (*VpcV1) NewGetEndpointGatewayIPOptions(endpointGatewayID string, id string) *GetEndpointGatewayIPOptions { + return &GetEndpointGatewayIPOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + ID: core.StringPtr(id), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (_options *GetEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *GetEndpointGatewayIPOptions { + _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetEndpointGatewayIPOptions) SetID(id string) *GetEndpointGatewayIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetEndpointGatewayIPOptions) SetHeaders(param map[string]string) *GetEndpointGatewayIPOptions { + options.Headers = param + return options +} + +// GetEndpointGatewayOptions : The GetEndpointGateway options. +type GetEndpointGatewayOptions struct { + // The endpoint gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetEndpointGatewayOptions : Instantiate GetEndpointGatewayOptions +func (*VpcV1) NewGetEndpointGatewayOptions(id string) *GetEndpointGatewayOptions { + return &GetEndpointGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetEndpointGatewayOptions) SetID(id string) *GetEndpointGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetEndpointGatewayOptions) SetHeaders(param map[string]string) *GetEndpointGatewayOptions { + options.Headers = param + return options +} + +// GetFloatingIPOptions : The GetFloatingIP options. +type GetFloatingIPOptions struct { + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetFloatingIPOptions : Instantiate GetFloatingIPOptions +func (*VpcV1) NewGetFloatingIPOptions(id string) *GetFloatingIPOptions { + return &GetFloatingIPOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetFloatingIPOptions) SetID(id string) *GetFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetFloatingIPOptions) SetHeaders(param map[string]string) *GetFloatingIPOptions { + options.Headers = param + return options +} + +// GetFlowLogCollectorOptions : The GetFlowLogCollector options. +type GetFlowLogCollectorOptions struct { + // The flow log collector identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetFlowLogCollectorOptions : Instantiate GetFlowLogCollectorOptions +func (*VpcV1) NewGetFlowLogCollectorOptions(id string) *GetFlowLogCollectorOptions { + return &GetFlowLogCollectorOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetFlowLogCollectorOptions) SetID(id string) *GetFlowLogCollectorOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetFlowLogCollectorOptions) SetHeaders(param map[string]string) *GetFlowLogCollectorOptions { + options.Headers = param + return options +} + +// GetIkePolicyOptions : The GetIkePolicy options. +type GetIkePolicyOptions struct { + // The IKE policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetIkePolicyOptions : Instantiate GetIkePolicyOptions +func (*VpcV1) NewGetIkePolicyOptions(id string) *GetIkePolicyOptions { + return &GetIkePolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetIkePolicyOptions) SetID(id string) *GetIkePolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetIkePolicyOptions) SetHeaders(param map[string]string) *GetIkePolicyOptions { + options.Headers = param + return options +} + +// GetImageExportJobOptions : The GetImageExportJob options. +type GetImageExportJobOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // The image export job identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetImageExportJobOptions : Instantiate GetImageExportJobOptions +func (*VpcV1) NewGetImageExportJobOptions(imageID string, id string) *GetImageExportJobOptions { + return &GetImageExportJobOptions{ + ImageID: core.StringPtr(imageID), + ID: core.StringPtr(id), + } +} + +// SetImageID : Allow user to set ImageID +func (_options *GetImageExportJobOptions) SetImageID(imageID string) *GetImageExportJobOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetImageExportJobOptions) SetID(id string) *GetImageExportJobOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetImageExportJobOptions) SetHeaders(param map[string]string) *GetImageExportJobOptions { + options.Headers = param + return options +} + +// GetImageOptions : The GetImage options. +type GetImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetImageOptions : Instantiate GetImageOptions +func (*VpcV1) NewGetImageOptions(id string) *GetImageOptions { + return &GetImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetImageOptions) SetID(id string) *GetImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetImageOptions) SetHeaders(param map[string]string) *GetImageOptions { + options.Headers = param + return options +} + +// GetInstanceDiskOptions : The GetInstanceDisk options. +type GetInstanceDiskOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceDiskOptions : Instantiate GetInstanceDiskOptions +func (*VpcV1) NewGetInstanceDiskOptions(instanceID string, id string) *GetInstanceDiskOptions { + return &GetInstanceDiskOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceDiskOptions) SetInstanceID(instanceID string) *GetInstanceDiskOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceDiskOptions) SetID(id string) *GetInstanceDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceDiskOptions) SetHeaders(param map[string]string) *GetInstanceDiskOptions { + options.Headers = param + return options +} + +// GetInstanceGroupManagerActionOptions : The GetInstanceGroupManagerAction options. +type GetInstanceGroupManagerActionOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager action identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupManagerActionOptions : Instantiate GetInstanceGroupManagerActionOptions +func (*VpcV1) NewGetInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string) *GetInstanceGroupManagerActionOptions { + return &GetInstanceGroupManagerActionOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *GetInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerActionOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *GetInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *GetInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupManagerActionOptions) SetID(id string) *GetInstanceGroupManagerActionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerActionOptions { + options.Headers = param + return options +} + +// GetInstanceGroupManagerOptions : The GetInstanceGroupManager options. +type GetInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupManagerOptions : Instantiate GetInstanceGroupManagerOptions +func (*VpcV1) NewGetInstanceGroupManagerOptions(instanceGroupID string, id string) *GetInstanceGroupManagerOptions { + return &GetInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *GetInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupManagerOptions) SetID(id string) *GetInstanceGroupManagerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupManagerOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// GetInstanceGroupManagerPolicyOptions : The GetInstanceGroupManagerPolicy options. +type GetInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupManagerPolicyOptions : Instantiate GetInstanceGroupManagerPolicyOptions +func (*VpcV1) NewGetInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string) *GetInstanceGroupManagerPolicyOptions { + return &GetInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *GetInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerPolicyOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *GetInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *GetInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupManagerPolicyOptions) SetID(id string) *GetInstanceGroupManagerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// GetInstanceGroupMembershipOptions : The GetInstanceGroupMembership options. +type GetInstanceGroupMembershipOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group membership identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupMembershipOptions : Instantiate GetInstanceGroupMembershipOptions +func (*VpcV1) NewGetInstanceGroupMembershipOptions(instanceGroupID string, id string) *GetInstanceGroupMembershipOptions { + return &GetInstanceGroupMembershipOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *GetInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupMembershipOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupMembershipOptions) SetID(id string) *GetInstanceGroupMembershipOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *GetInstanceGroupMembershipOptions { + options.Headers = param + return options +} + +// GetInstanceGroupOptions : The GetInstanceGroup options. +type GetInstanceGroupOptions struct { + // The instance group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupOptions : Instantiate GetInstanceGroupOptions +func (*VpcV1) NewGetInstanceGroupOptions(id string) *GetInstanceGroupOptions { + return &GetInstanceGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupOptions) SetID(id string) *GetInstanceGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupOptions) SetHeaders(param map[string]string) *GetInstanceGroupOptions { + options.Headers = param + return options +} + +// GetInstanceInitializationOptions : The GetInstanceInitialization options. +type GetInstanceInitializationOptions struct { + // The instance identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceInitializationOptions : Instantiate GetInstanceInitializationOptions +func (*VpcV1) NewGetInstanceInitializationOptions(id string) *GetInstanceInitializationOptions { + return &GetInstanceInitializationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetInstanceInitializationOptions) SetID(id string) *GetInstanceInitializationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceInitializationOptions) SetHeaders(param map[string]string) *GetInstanceInitializationOptions { + options.Headers = param + return options +} + +// GetInstanceNetworkAttachmentOptions : The GetInstanceNetworkAttachment options. +type GetInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceNetworkAttachmentOptions : Instantiate GetInstanceNetworkAttachmentOptions +func (*VpcV1) NewGetInstanceNetworkAttachmentOptions(instanceID string, id string) *GetInstanceNetworkAttachmentOptions { + return &GetInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceNetworkAttachmentOptions) SetID(id string) *GetInstanceNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + +// GetInstanceNetworkInterfaceFloatingIPOptions : The GetInstanceNetworkInterfaceFloatingIP options. +type GetInstanceNetworkInterfaceFloatingIPOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The 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 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 network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceNetworkInterfaceOptions : Instantiate GetInstanceNetworkInterfaceOptions +func (*VpcV1) NewGetInstanceNetworkInterfaceOptions(instanceID string, id string) *GetInstanceNetworkInterfaceOptions { + return &GetInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceNetworkInterfaceOptions) SetID(id string) *GetInstanceNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// GetInstanceOptions : The GetInstance options. +type GetInstanceOptions struct { + // The virtual server instance identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceOptions : Instantiate GetInstanceOptions +func (*VpcV1) NewGetInstanceOptions(id string) *GetInstanceOptions { + return &GetInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetInstanceOptions) SetID(id string) *GetInstanceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceOptions) SetHeaders(param map[string]string) *GetInstanceOptions { + options.Headers = param + return options +} + +// GetInstanceProfileOptions : The GetInstanceProfile options. +type GetInstanceProfileOptions struct { + // The instance profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceProfileOptions : Instantiate GetInstanceProfileOptions +func (*VpcV1) NewGetInstanceProfileOptions(name string) *GetInstanceProfileOptions { + return &GetInstanceProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetInstanceProfileOptions) SetName(name string) *GetInstanceProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceProfileOptions) SetHeaders(param map[string]string) *GetInstanceProfileOptions { + options.Headers = param + return options +} + +// GetInstanceTemplateOptions : The GetInstanceTemplate options. +type GetInstanceTemplateOptions struct { + // The instance template identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceTemplateOptions : Instantiate GetInstanceTemplateOptions +func (*VpcV1) NewGetInstanceTemplateOptions(id string) *GetInstanceTemplateOptions { + return &GetInstanceTemplateOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetInstanceTemplateOptions) SetID(id string) *GetInstanceTemplateOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceTemplateOptions) SetHeaders(param map[string]string) *GetInstanceTemplateOptions { + options.Headers = param + return options +} + +// GetInstanceVolumeAttachmentOptions : The GetInstanceVolumeAttachment options. +type GetInstanceVolumeAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The volume attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceVolumeAttachmentOptions : Instantiate GetInstanceVolumeAttachmentOptions +func (*VpcV1) NewGetInstanceVolumeAttachmentOptions(instanceID string, id string) *GetInstanceVolumeAttachmentOptions { + return &GetInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceVolumeAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceVolumeAttachmentOptions) SetID(id string) *GetInstanceVolumeAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// GetIpsecPolicyOptions : The GetIpsecPolicy options. +type GetIpsecPolicyOptions struct { + // The IPsec policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetIpsecPolicyOptions : Instantiate GetIpsecPolicyOptions +func (*VpcV1) NewGetIpsecPolicyOptions(id string) *GetIpsecPolicyOptions { + return &GetIpsecPolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetIpsecPolicyOptions) SetID(id string) *GetIpsecPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetIpsecPolicyOptions) SetHeaders(param map[string]string) *GetIpsecPolicyOptions { + options.Headers = param + return options +} + +// GetKeyOptions : The GetKey options. +type GetKeyOptions struct { + // The key identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetKeyOptions : Instantiate GetKeyOptions +func (*VpcV1) NewGetKeyOptions(id string) *GetKeyOptions { + return &GetKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetKeyOptions) SetID(id string) *GetKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetKeyOptions) SetHeaders(param map[string]string) *GetKeyOptions { + options.Headers = param + return options +} + +// GetLoadBalancerListenerOptions : The GetLoadBalancerListener options. +type GetLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerListenerOptions : Instantiate GetLoadBalancerListenerOptions +func (*VpcV1) NewGetLoadBalancerListenerOptions(loadBalancerID string, id string) *GetLoadBalancerListenerOptions { + return &GetLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerListenerOptions) SetID(id string) *GetLoadBalancerListenerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerListenerOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// GetLoadBalancerListenerPolicyOptions : The GetLoadBalancerListenerPolicy options. +type GetLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerListenerPolicyOptions : Instantiate GetLoadBalancerListenerPolicyOptions +func (*VpcV1) NewGetLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string) *GetLoadBalancerListenerPolicyOptions { + return &GetLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerPolicyOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *GetLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *GetLoadBalancerListenerPolicyOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerListenerPolicyOptions) SetID(id string) *GetLoadBalancerListenerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// GetLoadBalancerListenerPolicyRuleOptions : The GetLoadBalancerListenerPolicyRule options. +type GetLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerListenerPolicyRuleOptions : Instantiate GetLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewGetLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string) *GetLoadBalancerListenerPolicyRuleOptions { + return &GetLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *GetLoadBalancerListenerPolicyRuleOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *GetLoadBalancerListenerPolicyRuleOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetID(id string) *GetLoadBalancerListenerPolicyRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// GetLoadBalancerOptions : The GetLoadBalancer options. +type GetLoadBalancerOptions struct { + // The load balancer identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerOptions : Instantiate GetLoadBalancerOptions +func (*VpcV1) NewGetLoadBalancerOptions(id string) *GetLoadBalancerOptions { + return &GetLoadBalancerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerOptions) SetID(id string) *GetLoadBalancerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerOptions) SetHeaders(param map[string]string) *GetLoadBalancerOptions { + options.Headers = param + return options +} + +// GetLoadBalancerPoolMemberOptions : The GetLoadBalancerPoolMember options. +type GetLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The member identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerPoolMemberOptions : Instantiate GetLoadBalancerPoolMemberOptions +func (*VpcV1) NewGetLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string) *GetLoadBalancerPoolMemberOptions { + return &GetLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerPoolMemberOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *GetLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *GetLoadBalancerPoolMemberOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerPoolMemberOptions) SetID(id string) *GetLoadBalancerPoolMemberOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *GetLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// GetLoadBalancerPoolOptions : The GetLoadBalancerPool options. +type GetLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerPoolOptions : Instantiate GetLoadBalancerPoolOptions +func (*VpcV1) NewGetLoadBalancerPoolOptions(loadBalancerID string, id string) *GetLoadBalancerPoolOptions { + return &GetLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerPoolOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerPoolOptions) SetID(id string) *GetLoadBalancerPoolOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerPoolOptions) SetHeaders(param map[string]string) *GetLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// GetLoadBalancerProfileOptions : The GetLoadBalancerProfile options. +type GetLoadBalancerProfileOptions struct { + // The load balancer profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerProfileOptions : Instantiate GetLoadBalancerProfileOptions +func (*VpcV1) NewGetLoadBalancerProfileOptions(name string) *GetLoadBalancerProfileOptions { + return &GetLoadBalancerProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetLoadBalancerProfileOptions) SetName(name string) *GetLoadBalancerProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerProfileOptions) SetHeaders(param map[string]string) *GetLoadBalancerProfileOptions { + options.Headers = param + return options +} + +// GetLoadBalancerStatisticsOptions : The GetLoadBalancerStatistics options. +type GetLoadBalancerStatisticsOptions struct { + // The load balancer identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerStatisticsOptions : Instantiate GetLoadBalancerStatisticsOptions +func (*VpcV1) NewGetLoadBalancerStatisticsOptions(id string) *GetLoadBalancerStatisticsOptions { + return &GetLoadBalancerStatisticsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerStatisticsOptions) SetID(id string) *GetLoadBalancerStatisticsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerStatisticsOptions) SetHeaders(param map[string]string) *GetLoadBalancerStatisticsOptions { + options.Headers = param + return options +} + +// GetNetworkACLOptions : The GetNetworkACL options. +type GetNetworkACLOptions struct { + // The network ACL identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetNetworkACLOptions : Instantiate GetNetworkACLOptions +func (*VpcV1) NewGetNetworkACLOptions(id string) *GetNetworkACLOptions { + return &GetNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetNetworkACLOptions) SetID(id string) *GetNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetNetworkACLOptions) SetHeaders(param map[string]string) *GetNetworkACLOptions { + options.Headers = param + return options +} + +// GetNetworkACLRuleOptions : The GetNetworkACLRule options. +type GetNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetNetworkACLRuleOptions : Instantiate GetNetworkACLRuleOptions +func (*VpcV1) NewGetNetworkACLRuleOptions(networkACLID string, id string) *GetNetworkACLRuleOptions { + return &GetNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + ID: core.StringPtr(id), + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *GetNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *GetNetworkACLRuleOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetNetworkACLRuleOptions) SetID(id string) *GetNetworkACLRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetNetworkACLRuleOptions) SetHeaders(param map[string]string) *GetNetworkACLRuleOptions { + options.Headers = param + return options +} + +// GetNetworkInterfaceFloatingIPOptions : The GetNetworkInterfaceFloatingIP options. +type GetNetworkInterfaceFloatingIPOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` + + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetNetworkInterfaceFloatingIPOptions : Instantiate GetNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewGetNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *GetNetworkInterfaceFloatingIPOptions { + return &GetNetworkInterfaceFloatingIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *GetNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetNetworkInterfaceFloatingIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetNetworkInterfaceFloatingIPOptions) SetID(id string) *GetNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// GetOperatingSystemOptions : The GetOperatingSystem options. +type GetOperatingSystemOptions struct { + // The operating system name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetOperatingSystemOptions : Instantiate GetOperatingSystemOptions +func (*VpcV1) NewGetOperatingSystemOptions(name string) *GetOperatingSystemOptions { + return &GetOperatingSystemOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetOperatingSystemOptions) SetName(name string) *GetOperatingSystemOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetOperatingSystemOptions) SetHeaders(param map[string]string) *GetOperatingSystemOptions { + options.Headers = param + return options +} + +// GetPlacementGroupOptions : The GetPlacementGroup options. +type GetPlacementGroupOptions struct { + // The placement group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetPlacementGroupOptions : Instantiate GetPlacementGroupOptions +func (*VpcV1) NewGetPlacementGroupOptions(id string) *GetPlacementGroupOptions { + return &GetPlacementGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetPlacementGroupOptions) SetID(id string) *GetPlacementGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPlacementGroupOptions) SetHeaders(param map[string]string) *GetPlacementGroupOptions { + options.Headers = param + return options +} + +// GetPublicGatewayOptions : The GetPublicGateway options. +type GetPublicGatewayOptions struct { + // The public gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetPublicGatewayOptions : Instantiate GetPublicGatewayOptions +func (*VpcV1) NewGetPublicGatewayOptions(id string) *GetPublicGatewayOptions { + return &GetPublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetPublicGatewayOptions) SetID(id string) *GetPublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPublicGatewayOptions) SetHeaders(param map[string]string) *GetPublicGatewayOptions { + options.Headers = param + return options +} + +// GetRegionOptions : The GetRegion options. +type GetRegionOptions struct { + // The region name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetRegionOptions : Instantiate GetRegionOptions +func (*VpcV1) NewGetRegionOptions(name string) *GetRegionOptions { + return &GetRegionOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetRegionOptions) SetName(name string) *GetRegionOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetRegionOptions) SetHeaders(param map[string]string) *GetRegionOptions { + options.Headers = param + return options +} + +// GetRegionZoneOptions : The GetRegionZone options. +type GetRegionZoneOptions struct { + // The region name. + RegionName *string `json:"region_name" validate:"required,ne="` + + // The zone name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetRegionZoneOptions : Instantiate GetRegionZoneOptions +func (*VpcV1) NewGetRegionZoneOptions(regionName string, name string) *GetRegionZoneOptions { + return &GetRegionZoneOptions{ + RegionName: core.StringPtr(regionName), + Name: core.StringPtr(name), + } +} + +// SetRegionName : Allow user to set RegionName +func (_options *GetRegionZoneOptions) SetRegionName(regionName string) *GetRegionZoneOptions { + _options.RegionName = core.StringPtr(regionName) + return _options +} + +// SetName : Allow user to set Name +func (_options *GetRegionZoneOptions) SetName(name string) *GetRegionZoneOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetRegionZoneOptions) SetHeaders(param map[string]string) *GetRegionZoneOptions { + options.Headers = param + return options +} + +// GetSecurityGroupOptions : The GetSecurityGroup options. +type GetSecurityGroupOptions struct { + // The security group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSecurityGroupOptions : Instantiate GetSecurityGroupOptions +func (*VpcV1) NewGetSecurityGroupOptions(id string) *GetSecurityGroupOptions { + return &GetSecurityGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSecurityGroupOptions) SetID(id string) *GetSecurityGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSecurityGroupOptions) SetHeaders(param map[string]string) *GetSecurityGroupOptions { + options.Headers = param + return options +} + +// GetSecurityGroupRuleOptions : The GetSecurityGroupRule options. +type GetSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSecurityGroupRuleOptions : Instantiate GetSecurityGroupRuleOptions +func (*VpcV1) NewGetSecurityGroupRuleOptions(securityGroupID string, id string) *GetSecurityGroupRuleOptions { + return &GetSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *GetSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *GetSecurityGroupRuleOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetSecurityGroupRuleOptions) SetID(id string) *GetSecurityGroupRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSecurityGroupRuleOptions) SetHeaders(param map[string]string) *GetSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// GetSecurityGroupTargetOptions : The GetSecurityGroupTarget options. +type GetSecurityGroupTargetOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The security group target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSecurityGroupTargetOptions : Instantiate GetSecurityGroupTargetOptions +func (*VpcV1) NewGetSecurityGroupTargetOptions(securityGroupID string, id string) *GetSecurityGroupTargetOptions { + return &GetSecurityGroupTargetOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *GetSecurityGroupTargetOptions) SetSecurityGroupID(securityGroupID string) *GetSecurityGroupTargetOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetSecurityGroupTargetOptions) SetID(id string) *GetSecurityGroupTargetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSecurityGroupTargetOptions) SetHeaders(param map[string]string) *GetSecurityGroupTargetOptions { + options.Headers = param + return options +} + +// GetShareMountTargetOptions : The GetShareMountTarget options. +type GetShareMountTargetOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share mount target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetShareMountTargetOptions : Instantiate GetShareMountTargetOptions +func (*VpcV1) NewGetShareMountTargetOptions(shareID string, id string) *GetShareMountTargetOptions { + return &GetShareMountTargetOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *GetShareMountTargetOptions) SetShareID(shareID string) *GetShareMountTargetOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetShareMountTargetOptions) SetID(id string) *GetShareMountTargetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareMountTargetOptions) SetHeaders(param map[string]string) *GetShareMountTargetOptions { + options.Headers = param + return options +} + +// GetShareOptions : The GetShare options. +type GetShareOptions struct { + // The file share identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetShareOptions : Instantiate GetShareOptions +func (*VpcV1) NewGetShareOptions(id string) *GetShareOptions { + return &GetShareOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetShareOptions) SetID(id string) *GetShareOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareOptions) SetHeaders(param map[string]string) *GetShareOptions { + options.Headers = param + return options +} + +// GetShareProfileOptions : The GetShareProfile options. +type GetShareProfileOptions struct { + // The file share profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetShareProfileOptions : Instantiate GetShareProfileOptions +func (*VpcV1) NewGetShareProfileOptions(name string) *GetShareProfileOptions { + return &GetShareProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetShareProfileOptions) SetName(name string) *GetShareProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareProfileOptions) SetHeaders(param map[string]string) *GetShareProfileOptions { + options.Headers = param + return options +} + +// GetShareSourceOptions : The GetShareSource options. +type GetShareSourceOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetShareSourceOptions : Instantiate GetShareSourceOptions +func (*VpcV1) NewGetShareSourceOptions(shareID string) *GetShareSourceOptions { + return &GetShareSourceOptions{ + ShareID: core.StringPtr(shareID), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *GetShareSourceOptions) SetShareID(shareID string) *GetShareSourceOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareSourceOptions) SetHeaders(param map[string]string) *GetShareSourceOptions { + options.Headers = param + return options +} + +// GetSnapshotCloneOptions : The GetSnapshotClone options. +type GetSnapshotCloneOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // The zone name. + ZoneName *string `json:"zone_name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSnapshotCloneOptions : Instantiate GetSnapshotCloneOptions +func (*VpcV1) NewGetSnapshotCloneOptions(id string, zoneName string) *GetSnapshotCloneOptions { + return &GetSnapshotCloneOptions{ + ID: core.StringPtr(id), + ZoneName: core.StringPtr(zoneName), + } +} + +// SetID : Allow user to set ID +func (_options *GetSnapshotCloneOptions) SetID(id string) *GetSnapshotCloneOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *GetSnapshotCloneOptions) SetZoneName(zoneName string) *GetSnapshotCloneOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSnapshotCloneOptions) SetHeaders(param map[string]string) *GetSnapshotCloneOptions { + options.Headers = param + return options +} + +// GetSnapshotOptions : The GetSnapshot options. +type GetSnapshotOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSnapshotOptions : Instantiate GetSnapshotOptions +func (*VpcV1) NewGetSnapshotOptions(id string) *GetSnapshotOptions { + return &GetSnapshotOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSnapshotOptions) SetID(id string) *GetSnapshotOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSnapshotOptions) SetHeaders(param map[string]string) *GetSnapshotOptions { + options.Headers = param + return options +} + +// GetSubnetNetworkACLOptions : The GetSubnetNetworkACL options. +type GetSubnetNetworkACLOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetNetworkACLOptions : Instantiate GetSubnetNetworkACLOptions +func (*VpcV1) NewGetSubnetNetworkACLOptions(id string) *GetSubnetNetworkACLOptions { + return &GetSubnetNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSubnetNetworkACLOptions) SetID(id string) *GetSubnetNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetNetworkACLOptions) SetHeaders(param map[string]string) *GetSubnetNetworkACLOptions { + options.Headers = param + return options +} + +// GetSubnetOptions : The GetSubnet options. +type GetSubnetOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetOptions : Instantiate GetSubnetOptions +func (*VpcV1) NewGetSubnetOptions(id string) *GetSubnetOptions { + return &GetSubnetOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSubnetOptions) SetID(id string) *GetSubnetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetOptions) SetHeaders(param map[string]string) *GetSubnetOptions { + options.Headers = param + return options +} + +// GetSubnetPublicGatewayOptions : The GetSubnetPublicGateway options. +type GetSubnetPublicGatewayOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetPublicGatewayOptions : Instantiate GetSubnetPublicGatewayOptions +func (*VpcV1) NewGetSubnetPublicGatewayOptions(id string) *GetSubnetPublicGatewayOptions { + return &GetSubnetPublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSubnetPublicGatewayOptions) SetID(id string) *GetSubnetPublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *GetSubnetPublicGatewayOptions { + options.Headers = param + return options +} + +// GetSubnetReservedIPOptions : The GetSubnetReservedIP options. +type GetSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `json:"subnet_id" validate:"required,ne="` + + // The reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetReservedIPOptions : Instantiate GetSubnetReservedIPOptions +func (*VpcV1) NewGetSubnetReservedIPOptions(subnetID string, id string) *GetSubnetReservedIPOptions { + return &GetSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + ID: core.StringPtr(id), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (_options *GetSubnetReservedIPOptions) SetSubnetID(subnetID string) *GetSubnetReservedIPOptions { + _options.SubnetID = core.StringPtr(subnetID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetSubnetReservedIPOptions) SetID(id string) *GetSubnetReservedIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetReservedIPOptions) SetHeaders(param map[string]string) *GetSubnetReservedIPOptions { + options.Headers = param + return options +} + +// GetSubnetRoutingTableOptions : The GetSubnetRoutingTable options. +type GetSubnetRoutingTableOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetRoutingTableOptions : Instantiate GetSubnetRoutingTableOptions +func (*VpcV1) NewGetSubnetRoutingTableOptions(id string) *GetSubnetRoutingTableOptions { + return &GetSubnetRoutingTableOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSubnetRoutingTableOptions) SetID(id string) *GetSubnetRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetRoutingTableOptions) SetHeaders(param map[string]string) *GetSubnetRoutingTableOptions { + options.Headers = param + return options +} + +// GetVirtualNetworkInterfaceIPOptions : The GetVirtualNetworkInterfaceIP options. +type GetVirtualNetworkInterfaceIPOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` + + // The reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVirtualNetworkInterfaceIPOptions : Instantiate GetVirtualNetworkInterfaceIPOptions +func (*VpcV1) NewGetVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *GetVirtualNetworkInterfaceIPOptions { + return &GetVirtualNetworkInterfaceIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *GetVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetVirtualNetworkInterfaceIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVirtualNetworkInterfaceIPOptions) SetID(id string) *GetVirtualNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetVirtualNetworkInterfaceIPOptions { + options.Headers = param + return options +} + +// GetVirtualNetworkInterfaceOptions : The GetVirtualNetworkInterface options. +type GetVirtualNetworkInterfaceOptions struct { + // The virtual network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVirtualNetworkInterfaceOptions : Instantiate GetVirtualNetworkInterfaceOptions +func (*VpcV1) NewGetVirtualNetworkInterfaceOptions(id string) *GetVirtualNetworkInterfaceOptions { + return &GetVirtualNetworkInterfaceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVirtualNetworkInterfaceOptions) SetID(id string) *GetVirtualNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetVirtualNetworkInterfaceOptions { + options.Headers = param + return options +} + +// GetVolumeOptions : The GetVolume options. +type GetVolumeOptions struct { + // The volume identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVolumeOptions : Instantiate GetVolumeOptions +func (*VpcV1) NewGetVolumeOptions(id string) *GetVolumeOptions { + return &GetVolumeOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVolumeOptions) SetID(id string) *GetVolumeOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVolumeOptions) SetHeaders(param map[string]string) *GetVolumeOptions { + options.Headers = param + return options +} + +// GetVolumeProfileOptions : The GetVolumeProfile options. +type GetVolumeProfileOptions struct { + // The volume profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVolumeProfileOptions : Instantiate GetVolumeProfileOptions +func (*VpcV1) NewGetVolumeProfileOptions(name string) *GetVolumeProfileOptions { + return &GetVolumeProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetVolumeProfileOptions) SetName(name string) *GetVolumeProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVolumeProfileOptions) SetHeaders(param map[string]string) *GetVolumeProfileOptions { + options.Headers = param + return options +} + +// GetVPCAddressPrefixOptions : The GetVPCAddressPrefix options. +type GetVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The prefix identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCAddressPrefixOptions : Instantiate GetVPCAddressPrefixOptions +func (*VpcV1) NewGetVPCAddressPrefixOptions(vpcID string, id string) *GetVPCAddressPrefixOptions { + return &GetVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCAddressPrefixOptions) SetVPCID(vpcID string) *GetVPCAddressPrefixOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCAddressPrefixOptions) SetID(id string) *GetVPCAddressPrefixOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCAddressPrefixOptions) SetHeaders(param map[string]string) *GetVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// GetVPCDefaultNetworkACLOptions : The GetVPCDefaultNetworkACL options. +type GetVPCDefaultNetworkACLOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDefaultNetworkACLOptions : Instantiate GetVPCDefaultNetworkACLOptions +func (*VpcV1) NewGetVPCDefaultNetworkACLOptions(id string) *GetVPCDefaultNetworkACLOptions { + return &GetVPCDefaultNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPCDefaultNetworkACLOptions) SetID(id string) *GetVPCDefaultNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDefaultNetworkACLOptions) SetHeaders(param map[string]string) *GetVPCDefaultNetworkACLOptions { + options.Headers = param + return options +} + +// GetVPCDefaultRoutingTableOptions : The GetVPCDefaultRoutingTable options. +type GetVPCDefaultRoutingTableOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDefaultRoutingTableOptions : Instantiate GetVPCDefaultRoutingTableOptions +func (*VpcV1) NewGetVPCDefaultRoutingTableOptions(id string) *GetVPCDefaultRoutingTableOptions { + return &GetVPCDefaultRoutingTableOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPCDefaultRoutingTableOptions) SetID(id string) *GetVPCDefaultRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDefaultRoutingTableOptions) SetHeaders(param map[string]string) *GetVPCDefaultRoutingTableOptions { + options.Headers = param + return options +} + +// GetVPCDefaultSecurityGroupOptions : The GetVPCDefaultSecurityGroup options. +type GetVPCDefaultSecurityGroupOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDefaultSecurityGroupOptions : Instantiate GetVPCDefaultSecurityGroupOptions +func (*VpcV1) NewGetVPCDefaultSecurityGroupOptions(id string) *GetVPCDefaultSecurityGroupOptions { + return &GetVPCDefaultSecurityGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPCDefaultSecurityGroupOptions) SetID(id string) *GetVPCDefaultSecurityGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDefaultSecurityGroupOptions) SetHeaders(param map[string]string) *GetVPCDefaultSecurityGroupOptions { + options.Headers = param + return options +} + +// GetVPCOptions : The GetVPC options. +type GetVPCOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCOptions : Instantiate GetVPCOptions +func (*VpcV1) NewGetVPCOptions(id string) *GetVPCOptions { + return &GetVPCOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPCOptions) SetID(id string) *GetVPCOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCOptions) SetHeaders(param map[string]string) *GetVPCOptions { + options.Headers = param + return options +} + +// GetVPCRouteOptions : The GetVPCRoute options. +type GetVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCRouteOptions : Instantiate GetVPCRouteOptions +func (*VpcV1) NewGetVPCRouteOptions(vpcID string, id string) *GetVPCRouteOptions { + return &GetVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCRouteOptions) SetVPCID(vpcID string) *GetVPCRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCRouteOptions) SetID(id string) *GetVPCRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCRouteOptions) SetHeaders(param map[string]string) *GetVPCRouteOptions { + options.Headers = param + return options +} + +// GetVPCRoutingTableOptions : The GetVPCRoutingTable options. +type GetVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCRoutingTableOptions : Instantiate GetVPCRoutingTableOptions +func (*VpcV1) NewGetVPCRoutingTableOptions(vpcID string, id string) *GetVPCRoutingTableOptions { + return &GetVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCRoutingTableOptions) SetVPCID(vpcID string) *GetVPCRoutingTableOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCRoutingTableOptions) SetID(id string) *GetVPCRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCRoutingTableOptions) SetHeaders(param map[string]string) *GetVPCRoutingTableOptions { + options.Headers = param + return options +} + +// GetVPCRoutingTableRouteOptions : The GetVPCRoutingTableRoute options. +type GetVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` + + // The VPC routing table route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCRoutingTableRouteOptions : Instantiate GetVPCRoutingTableRouteOptions +func (*VpcV1) NewGetVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string) *GetVPCRoutingTableRouteOptions { + return &GetVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *GetVPCRoutingTableRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *GetVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *GetVPCRoutingTableRouteOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCRoutingTableRouteOptions) SetID(id string) *GetVPCRoutingTableRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *GetVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// GetVPNGatewayConnectionOptions : The GetVPNGatewayConnection options. +type GetVPNGatewayConnectionOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNGatewayConnectionOptions : Instantiate GetVPNGatewayConnectionOptions +func (*VpcV1) NewGetVPNGatewayConnectionOptions(vpnGatewayID string, id string) *GetVPNGatewayConnectionOptions { + return &GetVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *GetVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *GetVPNGatewayConnectionOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPNGatewayConnectionOptions) SetID(id string) *GetVPNGatewayConnectionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *GetVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// GetVPNGatewayOptions : The GetVPNGateway options. +type GetVPNGatewayOptions struct { + // The VPN gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNGatewayOptions : Instantiate GetVPNGatewayOptions +func (*VpcV1) NewGetVPNGatewayOptions(id string) *GetVPNGatewayOptions { + return &GetVPNGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPNGatewayOptions) SetID(id string) *GetVPNGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNGatewayOptions) SetHeaders(param map[string]string) *GetVPNGatewayOptions { + options.Headers = param + return options +} + +// GetVPNServerClientConfigurationOptions : The GetVPNServerClientConfiguration options. +type GetVPNServerClientConfigurationOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerClientConfigurationOptions : Instantiate GetVPNServerClientConfigurationOptions +func (*VpcV1) NewGetVPNServerClientConfigurationOptions(id string) *GetVPNServerClientConfigurationOptions { + return &GetVPNServerClientConfigurationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerClientConfigurationOptions) SetID(id string) *GetVPNServerClientConfigurationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerClientConfigurationOptions) SetHeaders(param map[string]string) *GetVPNServerClientConfigurationOptions { + options.Headers = param + return options +} + +// GetVPNServerClientOptions : The GetVPNServerClient options. +type GetVPNServerClientOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN client identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerClientOptions : Instantiate GetVPNServerClientOptions +func (*VpcV1) NewGetVPNServerClientOptions(vpnServerID string, id string) *GetVPNServerClientOptions { + return &GetVPNServerClientOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *GetVPNServerClientOptions) SetVPNServerID(vpnServerID string) *GetVPNServerClientOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerClientOptions) SetID(id string) *GetVPNServerClientOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerClientOptions) SetHeaders(param map[string]string) *GetVPNServerClientOptions { + options.Headers = param + return options +} + +// GetVPNServerOptions : The GetVPNServer options. +type GetVPNServerOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerOptions : Instantiate GetVPNServerOptions +func (*VpcV1) NewGetVPNServerOptions(id string) *GetVPNServerOptions { + return &GetVPNServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerOptions) SetID(id string) *GetVPNServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerOptions) SetHeaders(param map[string]string) *GetVPNServerOptions { + options.Headers = param + return options +} + +// GetVPNServerRouteOptions : The GetVPNServerRoute options. +type GetVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerRouteOptions : Instantiate GetVPNServerRouteOptions +func (*VpcV1) NewGetVPNServerRouteOptions(vpnServerID string, id string) *GetVPNServerRouteOptions { + return &GetVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *GetVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *GetVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerRouteOptions) SetID(id string) *GetVPNServerRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerRouteOptions) SetHeaders(param map[string]string) *GetVPNServerRouteOptions { + options.Headers = param + return options +} + +// IkePolicy : IkePolicy struct +type IkePolicy struct { + // The authentication algorithm + // + // The `md5` and `sha1` algorithms have been deprecated. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // The VPN gateway connections that use this IKE policy. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this IKE policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The Diffie-Hellman group + // + // Groups `2` and `5` have been deprecated. + DhGroup *int64 `json:"dh_group" validate:"required"` + + // The encryption algorithm + // + // The `triple_des` algorithm has been deprecated. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` + + // The IKE protocol version. + IkeVersion *int64 `json:"ike_version" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime" validate:"required"` + + // The name for this IKE policy. The name is unique across all IKE policies in the region. + Name *string `json:"name" validate:"required"` + + // The IKE negotiation mode. Only `main` is supported. + NegotiationMode *string `json:"negotiation_mode" validate:"required"` + + // The resource group for this IKE policy. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the IkePolicy.AuthenticationAlgorithm property. +// The authentication algorithm +// +// The `md5` and `sha1` algorithms have been deprecated. +const ( + IkePolicyAuthenticationAlgorithmMd5Const = "md5" + IkePolicyAuthenticationAlgorithmSha1Const = "sha1" + IkePolicyAuthenticationAlgorithmSha256Const = "sha256" + IkePolicyAuthenticationAlgorithmSha384Const = "sha384" + IkePolicyAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IkePolicy.EncryptionAlgorithm property. +// The encryption algorithm +// +// The `triple_des` algorithm has been deprecated. +const ( + IkePolicyEncryptionAlgorithmAes128Const = "aes128" + IkePolicyEncryptionAlgorithmAes192Const = "aes192" + IkePolicyEncryptionAlgorithmAes256Const = "aes256" + IkePolicyEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the IkePolicy.NegotiationMode property. +// The IKE negotiation mode. Only `main` is supported. +const ( + IkePolicyNegotiationModeMainConst = "main" +) + +// Constants associated with the IkePolicy.ResourceType property. +// The resource type. +const ( + IkePolicyResourceTypeIkePolicyConst = "ike_policy" +) + +// UnmarshalIkePolicy unmarshals an instance of IkePolicy from the specified map of raw messages. +func UnmarshalIkePolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicy) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "negotiation_mode", &obj.NegotiationMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyCollection : IkePolicyCollection struct +type IkePolicyCollection struct { + // A link to the first page of resources. + First *IkePolicyCollectionFirst `json:"first" validate:"required"` + + // Collection of IKE policies. + IkePolicies []IkePolicy `json:"ike_policies" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *IkePolicyCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalIkePolicyCollection unmarshals an instance of IkePolicyCollection from the specified map of raw messages. +func UnmarshalIkePolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIkePolicyCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policies", &obj.IkePolicies, UnmarshalIkePolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIkePolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *IkePolicyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// IkePolicyPatch : IkePolicyPatch struct +type IkePolicyPatch struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` + + // The Diffie-Hellman group. + DhGroup *int64 `json:"dh_group,omitempty"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` + + // The IKE protocol version. + IkeVersion *int64 `json:"ike_version,omitempty"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The name for this IKE policy. The name must not be used by another IKE policy in the region. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the IkePolicyPatch.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + IkePolicyPatchAuthenticationAlgorithmSha256Const = "sha256" + IkePolicyPatchAuthenticationAlgorithmSha384Const = "sha384" + IkePolicyPatchAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IkePolicyPatch.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + IkePolicyPatchEncryptionAlgorithmAes128Const = "aes128" + IkePolicyPatchEncryptionAlgorithmAes192Const = "aes192" + IkePolicyPatchEncryptionAlgorithmAes256Const = "aes256" +) + +// UnmarshalIkePolicyPatch unmarshals an instance of IkePolicyPatch from the specified map of raw messages. +func UnmarshalIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyPatch) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the IkePolicyPatch +func (ikePolicyPatch *IkePolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(ikePolicyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// IkePolicyReference : IkePolicyReference struct +type IkePolicyReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *IkePolicyReferenceDeleted `json:"deleted,omitempty"` + + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` + + // The name for this IKE policy. The name is unique across all IKE policies in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the IkePolicyReference.ResourceType property. +// The resource type. +const ( + IkePolicyReferenceResourceTypeIkePolicyConst = "ike_policy" +) + +// UnmarshalIkePolicyReference unmarshals an instance of IkePolicyReference from the specified map of raw messages. +func UnmarshalIkePolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIkePolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IP : IP struct +type IP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewIP : Instantiate IP (Generic Model Constructor) +func (*VpcV1) NewIP(address string) (_model *IP, err error) { + _model = &IP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalIP unmarshals an instance of IP from the specified map of raw messages. +func UnmarshalIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicy : IPsecPolicy struct +type IPsecPolicy struct { + // The authentication algorithm + // + // The `md5` and `sha1` algorithms have been deprecated + // + // Must be `disabled` if and only if the `encryption_algorithm` is + // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // The VPN gateway connections that use this IPsec policy. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this IPsec policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The encapsulation mode used. Only `tunnel` is supported. + EncapsulationMode *string `json:"encapsulation_mode" validate:"required"` + + // The encryption algorithm + // + // The `triple_des` algorithm has been deprecated + // + // The `authentication_algorithm` must be `disabled` if and only if + // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or + // `aes256gcm16`. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime" validate:"required"` + + // The name for this IPsec policy. The name is unique across all IPsec policies in the region. + Name *string `json:"name" validate:"required"` + + // Perfect Forward Secrecy + // + // Groups `group_2` and `group_5` have been deprecated. + Pfs *string `json:"pfs" validate:"required"` + + // The resource group for this IPsec policy. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The transform protocol used. Only `esp` is supported. + TransformProtocol *string `json:"transform_protocol" validate:"required"` +} + +// Constants associated with the IPsecPolicy.AuthenticationAlgorithm property. +// The authentication algorithm +// +// # The `md5` and `sha1` algorithms have been deprecated +// +// Must be `disabled` if and only if the `encryption_algorithm` is +// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. +const ( + IPsecPolicyAuthenticationAlgorithmDisabledConst = "disabled" + IPsecPolicyAuthenticationAlgorithmMd5Const = "md5" + IPsecPolicyAuthenticationAlgorithmSha1Const = "sha1" + IPsecPolicyAuthenticationAlgorithmSha256Const = "sha256" + IPsecPolicyAuthenticationAlgorithmSha384Const = "sha384" + IPsecPolicyAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IPsecPolicy.EncapsulationMode property. +// The encapsulation mode used. Only `tunnel` is supported. +const ( + IPsecPolicyEncapsulationModeTunnelConst = "tunnel" +) + +// Constants associated with the IPsecPolicy.EncryptionAlgorithm property. +// The encryption algorithm +// +// The `triple_des` algorithm has been deprecated +// +// The `authentication_algorithm` must be `disabled` if and only if +// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or +// `aes256gcm16`. +const ( + IPsecPolicyEncryptionAlgorithmAes128Const = "aes128" + IPsecPolicyEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" + IPsecPolicyEncryptionAlgorithmAes192Const = "aes192" + IPsecPolicyEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" + IPsecPolicyEncryptionAlgorithmAes256Const = "aes256" + IPsecPolicyEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" + IPsecPolicyEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the IPsecPolicy.Pfs property. +// Perfect Forward Secrecy +// +// Groups `group_2` and `group_5` have been deprecated. +const ( + IPsecPolicyPfsDisabledConst = "disabled" + IPsecPolicyPfsGroup14Const = "group_14" + IPsecPolicyPfsGroup15Const = "group_15" + IPsecPolicyPfsGroup16Const = "group_16" + IPsecPolicyPfsGroup17Const = "group_17" + IPsecPolicyPfsGroup18Const = "group_18" + IPsecPolicyPfsGroup19Const = "group_19" + IPsecPolicyPfsGroup2Const = "group_2" + IPsecPolicyPfsGroup20Const = "group_20" + IPsecPolicyPfsGroup21Const = "group_21" + IPsecPolicyPfsGroup22Const = "group_22" + IPsecPolicyPfsGroup23Const = "group_23" + IPsecPolicyPfsGroup24Const = "group_24" + IPsecPolicyPfsGroup31Const = "group_31" + IPsecPolicyPfsGroup5Const = "group_5" +) + +// Constants associated with the IPsecPolicy.ResourceType property. +// The resource type. +const ( + IPsecPolicyResourceTypeIpsecPolicyConst = "ipsec_policy" +) + +// Constants associated with the IPsecPolicy.TransformProtocol property. +// The transform protocol used. Only `esp` is supported. +const ( + IPsecPolicyTransformProtocolEspConst = "esp" +) + +// UnmarshalIPsecPolicy unmarshals an instance of IPsecPolicy from the specified map of raw messages. +func UnmarshalIPsecPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicy) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encapsulation_mode", &obj.EncapsulationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pfs", &obj.Pfs) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transform_protocol", &obj.TransformProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyCollection : IPsecPolicyCollection struct +type IPsecPolicyCollection struct { + // A link to the first page of resources. + First *IPsecPolicyCollectionFirst `json:"first" validate:"required"` + + // Collection of IPsec policies. + IpsecPolicies []IPsecPolicy `json:"ipsec_policies" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *IPsecPolicyCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalIPsecPolicyCollection unmarshals an instance of IPsecPolicyCollection from the specified map of raw messages. +func UnmarshalIPsecPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIPsecPolicyCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policies", &obj.IpsecPolicies, UnmarshalIPsecPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIPsecPolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *IPsecPolicyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// IPsecPolicyCollectionFirst : A link to the first page of resources. +type IPsecPolicyCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalIPsecPolicyCollectionFirst unmarshals an instance of IPsecPolicyCollectionFirst from the specified map of raw messages. +func UnmarshalIPsecPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type IPsecPolicyCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalIPsecPolicyCollectionNext unmarshals an instance of IPsecPolicyCollectionNext from the specified map of raw messages. +func UnmarshalIPsecPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyPatch : IPsecPolicyPatch struct +type IPsecPolicyPatch struct { + // The authentication algorithm + // + // Must be `disabled` if and only if the `encryption_algorithm` is + // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. + AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` + + // The encryption algorithm + // + // The `authentication_algorithm` must be `disabled` if and only if + // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or + // `aes256gcm16`. + EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The name for this IPsec policy. The name must not be used by another IPsec policy in the region. + Name *string `json:"name,omitempty"` + + // Perfect Forward Secrecy. + Pfs *string `json:"pfs,omitempty"` +} + +// Constants associated with the IPsecPolicyPatch.AuthenticationAlgorithm property. +// The authentication algorithm +// +// Must be `disabled` if and only if the `encryption_algorithm` is +// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. +const ( + IPsecPolicyPatchAuthenticationAlgorithmDisabledConst = "disabled" + IPsecPolicyPatchAuthenticationAlgorithmSha256Const = "sha256" + IPsecPolicyPatchAuthenticationAlgorithmSha384Const = "sha384" + IPsecPolicyPatchAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IPsecPolicyPatch.EncryptionAlgorithm property. +// The encryption algorithm +// +// The `authentication_algorithm` must be `disabled` if and only if +// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or +// `aes256gcm16`. +const ( + IPsecPolicyPatchEncryptionAlgorithmAes128Const = "aes128" + IPsecPolicyPatchEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" + IPsecPolicyPatchEncryptionAlgorithmAes192Const = "aes192" + IPsecPolicyPatchEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" + IPsecPolicyPatchEncryptionAlgorithmAes256Const = "aes256" + IPsecPolicyPatchEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" +) + +// Constants associated with the IPsecPolicyPatch.Pfs property. +// Perfect Forward Secrecy. +const ( + IPsecPolicyPatchPfsDisabledConst = "disabled" + IPsecPolicyPatchPfsGroup14Const = "group_14" + IPsecPolicyPatchPfsGroup15Const = "group_15" + IPsecPolicyPatchPfsGroup16Const = "group_16" + IPsecPolicyPatchPfsGroup17Const = "group_17" + IPsecPolicyPatchPfsGroup18Const = "group_18" + IPsecPolicyPatchPfsGroup19Const = "group_19" + IPsecPolicyPatchPfsGroup20Const = "group_20" + IPsecPolicyPatchPfsGroup21Const = "group_21" + IPsecPolicyPatchPfsGroup22Const = "group_22" + IPsecPolicyPatchPfsGroup23Const = "group_23" + IPsecPolicyPatchPfsGroup24Const = "group_24" + IPsecPolicyPatchPfsGroup31Const = "group_31" +) + +// UnmarshalIPsecPolicyPatch unmarshals an instance of IPsecPolicyPatch from the specified map of raw messages. +func UnmarshalIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyPatch) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pfs", &obj.Pfs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the IPsecPolicyPatch +func (iPsecPolicyPatch *IPsecPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(iPsecPolicyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// IPsecPolicyReference : IPsecPolicyReference struct +type IPsecPolicyReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *IPsecPolicyReferenceDeleted `json:"deleted,omitempty"` + + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` + + // The name for this IPsec policy. The name is unique across all IPsec policies in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the IPsecPolicyReference.ResourceType property. +// The resource type. +const ( + IPsecPolicyReferenceResourceTypeIpsecPolicyConst = "ipsec_policy" +) + +// UnmarshalIPsecPolicyReference unmarshals an instance of IPsecPolicyReference from the specified map of raw messages. +func UnmarshalIPsecPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIPsecPolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type IPsecPolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalIPsecPolicyReferenceDeleted unmarshals an instance of IPsecPolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalIPsecPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyCollectionFirst : A link to the first page of resources. +type IkePolicyCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalIkePolicyCollectionFirst unmarshals an instance of IkePolicyCollectionFirst from the specified map of raw messages. +func UnmarshalIkePolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type IkePolicyCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalIkePolicyCollectionNext unmarshals an instance of IkePolicyCollectionNext from the specified map of raw messages. +func UnmarshalIkePolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type IkePolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalIkePolicyReferenceDeleted unmarshals an instance of IkePolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalIkePolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Image : Image struct +type Image struct { + CatalogOffering *ImageCatalogOffering `json:"catalog_offering" validate:"required"` + + // The date and time that the image was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this image. + CRN *string `json:"crn" validate:"required"` + + // The 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 operating system included in this image. + OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` + + // The resource group for this image. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The volume used to create this image (this may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + // If absent, this image was not created from a volume. + SourceVolume *VolumeReference `json:"source_volume,omitempty"` + + // The status of this image + // - available: image can be used (provisionable) + // - deleting: image is being deleted, and can no longer be used to provision new + // resources + // - deprecated: image is administratively slated to be deleted + // - failed: image is corrupt or did not pass validation + // - pending: image is being imported and is not yet `available` + // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any): + // - `encrypted_data_key_invalid`: image cannot be decrypted with the specified + // `encryption_key` + // - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted + // - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled + // - `image_data_corrupted`: image data is corrupt, or is not in the specified format + // - `image_provisioned_size_unsupported`: image requires a boot volume size greater + // than the maximum supported value + // - `image_request_in_progress`: image operation is in progress (such as an import from + // Cloud Object Storage) + // - `image_request_queued`: image request has been accepted but the requested + // operation has not started + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []ImageStatusReason `json:"status_reasons" validate:"required"` + + // The visibility of this image. + // - `private`: Visible only to this account + // - `public`: Visible to all accounts. + Visibility *string `json:"visibility" validate:"required"` +} + +// Constants associated with the Image.Encryption property. +// The type of encryption used on the image. +const ( + ImageEncryptionNoneConst = "none" + ImageEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Image.ResourceType property. +// The resource type. +const ( + ImageResourceTypeImageConst = "image" +) + +// Constants associated with the Image.Status property. +// The status of this image +// - available: image can be used (provisionable) +// - deleting: image is being deleted, and can no longer be used to provision new +// resources +// - deprecated: image is administratively slated to be deleted +// - failed: image is corrupt or did not pass validation +// - pending: image is being imported and is not yet `available` +// - unusable: image cannot be used (see `status_reasons[]` for possible remediation) +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the +// unexpected property value was encountered. +const ( + ImageStatusAvailableConst = "available" + ImageStatusDeletingConst = "deleting" + ImageStatusDeprecatedConst = "deprecated" + ImageStatusFailedConst = "failed" + ImageStatusPendingConst = "pending" + ImageStatusUnusableConst = "unusable" +) + +// Constants associated with the Image.Visibility property. +// The visibility of this image. +// - `private`: Visible only to this account +// - `public`: Visible to all accounts. +const ( + ImageVisibilityPrivateConst = "private" + ImageVisibilityPublicConst = "public" +) + +// UnmarshalImage unmarshals an instance of Image from the specified map of raw messages. +func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Image) + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalImageCatalogOffering) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "minimum_provisioned_size", &obj.MinimumProvisionedSize) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalImageStatusReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "visibility", &obj.Visibility) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageCatalogOffering : ImageCatalogOffering struct +type ImageCatalogOffering struct { + // Indicates whether this image is managed as part of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. If an image is managed, + // accounts in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise) with access to that catalog can + // specify the image's catalog offering version CRN to provision virtual server instances using the image. + Managed *bool `json:"managed" validate:"required"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version associated with this image. + // + // If absent, this image is not associated with a cloud catalog offering. + Version *CatalogOfferingVersionReference `json:"version,omitempty"` +} + +// UnmarshalImageCatalogOffering unmarshals an instance of ImageCatalogOffering from the specified map of raw messages. +func UnmarshalImageCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageCatalogOffering) + err = core.UnmarshalPrimitive(m, "managed", &obj.Managed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageCollection : ImageCollection struct +type ImageCollection struct { + // A link to the first page of resources. + First *ImageCollectionFirst `json:"first" validate:"required"` + + // Collection of images. + Images []Image `json:"images" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ImageCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalImageCollection unmarshals an instance of ImageCollection from the specified map of raw messages. +func UnmarshalImageCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalImageCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImage) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalImageCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ImageCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// ImageCollectionFirst : A link to the first page of resources. +type ImageCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalImageCollectionFirst unmarshals an instance of ImageCollectionFirst from the specified map of raw messages. +func UnmarshalImageCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type ImageCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalImageCollectionNext unmarshals an instance of ImageCollectionNext from the specified map of raw messages. +func UnmarshalImageCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageExportJob : ImageExportJob struct +type ImageExportJob struct { + // The date and time that the image export job was completed. + // + // If absent, the export job has not yet completed. + CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` + + // The date and time that the image export job was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // A base64-encoded, encrypted representation of the key that was used to encrypt the data for the exported image. This + // key can be unwrapped with the image's `encryption_key` root key using either Key Protect or Hyper Protect Crypto + // Services. + // + // If absent, the export job is for an unencrypted image. + EncryptedDataKey *[]byte `json:"encrypted_data_key,omitempty"` + + // The format of the exported image. + Format *string `json:"format" validate:"required"` + + // The URL for this image export job. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this image export job. + ID *string `json:"id" validate:"required"` + + // The name for this image export job. The name must not be used by another export job for the image. Changing the name + // will not affect the exported image name, + // `storage_object.name`, or `storage_href` values. + Name *string `json:"name" validate:"required"` + + // The type of resource referenced. + ResourceType *string `json:"resource_type" validate:"required"` + + // The date and time that the image export job started running. + // + // If absent, the export job has not yet started. + StartedAt *strfmt.DateTime `json:"started_at,omitempty"` + + // The status of this image export job: + // - `deleting`: Export job is being deleted + // - `failed`: Export job could not be completed successfully + // - `queued`: Export job is queued + // - `running`: Export job is in progress + // - `succeeded`: Export job was completed successfully + // + // The exported image object is automatically deleted for `failed` jobs. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []ImageExportJobStatusReason `json:"status_reasons" validate:"required"` + + // The Cloud Object Storage bucket of the exported image object. + StorageBucket *CloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` + + // The Cloud Object Storage location of the exported image object. The object at this location will not exist until the + // job completes successfully. The exported image object is not managed by the IBM VPC service, and may be removed or + // replaced with a different object by any user or service with IAM authorization to the storage bucket. + StorageHref *string `json:"storage_href" validate:"required"` + + // The Cloud Object Storage object for the exported image. This object will not exist until + // the job completes successfully. The exported image object is not managed by the IBM VPC + // service, and may be removed or replaced with a different object by any user or service + // with IAM authorization to the storage bucket. + StorageObject *CloudObjectStorageObjectReference `json:"storage_object" validate:"required"` +} + +// Constants associated with the ImageExportJob.Format property. +// The format of the exported image. +const ( + ImageExportJobFormatQcow2Const = "qcow2" + ImageExportJobFormatVhdConst = "vhd" +) + +// Constants associated with the ImageExportJob.ResourceType property. +// The type of resource referenced. +const ( + ImageExportJobResourceTypeImageExportJobConst = "image_export_job" +) + +// Constants associated with the ImageExportJob.Status property. +// The status of this image export job: +// - `deleting`: Export job is being deleted +// - `failed`: Export job could not be completed successfully +// - `queued`: Export job is queued +// - `running`: Export job is in progress +// - `succeeded`: Export job was completed successfully +// +// The exported image object is automatically deleted for `failed` jobs. +const ( + ImageExportJobStatusDeletingConst = "deleting" + ImageExportJobStatusFailedConst = "failed" + ImageExportJobStatusQueuedConst = "queued" + ImageExportJobStatusRunningConst = "running" + ImageExportJobStatusSucceededConst = "succeeded" +) + +// UnmarshalImageExportJob unmarshals an instance of ImageExportJob from the specified map of raw messages. +func UnmarshalImageExportJob(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageExportJob) + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "format", &obj.Format) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalImageExportJobStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalCloudObjectStorageBucketReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "storage_href", &obj.StorageHref) + if err != nil { + return + } + err = core.UnmarshalModel(m, "storage_object", &obj.StorageObject, UnmarshalCloudObjectStorageObjectReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageExportJobPatch : ImageExportJobPatch struct +type ImageExportJobPatch struct { + // The name for this image export job. The name must not be used by another export job for the image. Changing the name + // will not affect the exported image name, + // `storage_object.name`, or `storage_href` values. + Name *string `json:"name,omitempty"` +} + +// UnmarshalImageExportJobPatch unmarshals an instance of ImageExportJobPatch from the specified map of raw messages. +func UnmarshalImageExportJobPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageExportJobPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the ImageExportJobPatch +func (imageExportJobPatch *ImageExportJobPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(imageExportJobPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// ImageExportJobStatusReason : ImageExportJobStatusReason struct +type ImageExportJobStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` + + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the ImageExportJobStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ImageExportJobStatusReasonCodeCannotAccessStorageBucketConst = "cannot_access_storage_bucket" + ImageExportJobStatusReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalImageExportJobStatusReason unmarshals an instance of ImageExportJobStatusReason from the specified map of raw messages. +func UnmarshalImageExportJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageExportJobStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageExportJobUnpaginatedCollection : ImageExportJobUnpaginatedCollection struct +type ImageExportJobUnpaginatedCollection struct { + // Collection of image export jobs. + ExportJobs []ImageExportJob `json:"export_jobs" validate:"required"` +} + +// UnmarshalImageExportJobUnpaginatedCollection unmarshals an instance of ImageExportJobUnpaginatedCollection from the specified map of raw messages. +func UnmarshalImageExportJobUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageExportJobUnpaginatedCollection) + err = core.UnmarshalModel(m, "export_jobs", &obj.ExportJobs, UnmarshalImageExportJob) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageFile : ImageFile struct +type ImageFile struct { + // Checksums for this image file. + // + // This property may be absent if the associated image has a `status` of `pending` or + // `failed`. + Checksums *ImageFileChecksums `json:"checksums,omitempty"` + + // The size of the stored image file rounded up to the next gigabyte. + // + // This property may be absent if the associated image has a `status` of `pending` or + // `failed`. + Size *int64 `json:"size,omitempty"` +} + +// UnmarshalImageFile unmarshals an instance of ImageFile from the specified map of raw messages. +func UnmarshalImageFile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageFile) + err = core.UnmarshalModel(m, "checksums", &obj.Checksums, UnmarshalImageFileChecksums) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageFileChecksums : ImageFileChecksums struct +type ImageFileChecksums struct { + // The SHA256 fingerprint of the image file. + Sha256 *string `json:"sha256,omitempty"` +} + +// UnmarshalImageFileChecksums unmarshals an instance of ImageFileChecksums from the specified map of raw messages. +func UnmarshalImageFileChecksums(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageFileChecksums) + err = core.UnmarshalPrimitive(m, "sha256", &obj.Sha256) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageFilePrototype : ImageFilePrototype struct +type ImageFilePrototype struct { + // The Cloud Object Storage location of the image file. + // + // The image file format is specified by the file's extension, which must be either + // `qcow2` or `vhd`. + Href *string `json:"href" validate:"required"` +} + +// NewImageFilePrototype : Instantiate ImageFilePrototype (Generic Model Constructor) +func (*VpcV1) NewImageFilePrototype(href string) (_model *ImageFilePrototype, err error) { + _model = &ImageFilePrototype{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalImageFilePrototype unmarshals an instance of ImageFilePrototype from the specified map of raw messages. +func UnmarshalImageFilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageFilePrototype) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentity : Identifies an image by a unique property. +// Models which "extend" this model: +// - ImageIdentityByID +// - ImageIdentityByCRN +// - ImageIdentityByHref +type ImageIdentity struct { + // The unique identifier for this image. + ID *string `json:"id,omitempty"` + + // The CRN for this image. + CRN *string `json:"crn,omitempty"` + + // The URL for this image. + Href *string `json:"href,omitempty"` +} + +func (*ImageIdentity) isaImageIdentity() bool { + return true +} + +type ImageIdentityIntf interface { + isaImageIdentity() bool +} + +// UnmarshalImageIdentity unmarshals an instance of ImageIdentity from the specified map of raw messages. +func UnmarshalImageIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImagePatch : ImagePatch struct +type ImagePatch struct { + // The 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"` +} + +// UnmarshalImagePatch unmarshals an instance of ImagePatch from the specified map of raw messages. +func UnmarshalImagePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the ImagePatch +func (imagePatch *ImagePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(imagePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// ImagePrototype : ImagePrototype struct +// Models which "extend" this model: +// - ImagePrototypeImageByFile +// - ImagePrototypeImageBySourceVolume +type ImagePrototype struct { + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are + // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. + // + // That representation is created by wrapping the key's value with the `encryption_key` root key (which must also be + // specified), using either [Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the + // [Hyper Protect Crypto Services](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). + // + // If unspecified, the imported image is treated as unencrypted. + EncryptedDataKey *string `json:"encrypted_data_key,omitempty"` + + // The root key that was used to wrap the data key (which is ultimately represented as + // `encrypted_data_key`). Additionally, the root key will be used to encrypt volumes + // created from this image (unless an alternate `encryption_key` is specified at volume + // creation). + // + // If unspecified, the imported image is treated as unencrypted. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The file from which to create the image. + File *ImageFilePrototype `json:"file,omitempty"` + + // The [supported operating + // system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included in this + // image. + OperatingSystem OperatingSystemIdentityIntf `json:"operating_system,omitempty"` + + // The volume from which to create the image. The specified volume must: + // - 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, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageReference : ImageReference struct +type ImageReference struct { + // The CRN for this image. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ImageReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this image. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this image. + ID *string `json:"id" validate:"required"` + + // The name for this image. The name is unique across all images in the region. + Name *string `json:"name" validate:"required"` + + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *ImageRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ImageReference.ResourceType property. +// The resource type. +const ( + ImageReferenceResourceTypeImageConst = "image" +) + +// UnmarshalImageReference unmarshals an instance of ImageReference from the specified map of raw messages. +func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalImageReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalImageRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type ImageReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalImageReferenceDeleted unmarshals an instance of ImageReferenceDeleted from the specified map of raw messages. +func UnmarshalImageReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type ImageRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // account, and identifies the owning account. + Account *AccountReference `json:"account,omitempty"` + + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalImageRemote unmarshals an instance of ImageRemote from the specified map of raw messages. +func UnmarshalImageRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageRemote) + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageStatusReason : ImageStatusReason struct +type ImageStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` + + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the ImageStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ImageStatusReasonCodeEncryptedDataKeyInvalidConst = "encrypted_data_key_invalid" + ImageStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" + ImageStatusReasonCodeEncryptionKeyDisabledConst = "encryption_key_disabled" + ImageStatusReasonCodeImageDataCorruptedConst = "image_data_corrupted" + ImageStatusReasonCodeImageProvisionedSizeUnsupportedConst = "image_provisioned_size_unsupported" + ImageStatusReasonCodeImageRequestInProgressConst = "image_request_in_progress" + ImageStatusReasonCodeImageRequestQueuedConst = "image_request_queued" +) + +// UnmarshalImageStatusReason unmarshals an instance of ImageStatusReason from the specified map of raw messages. +func UnmarshalImageStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Instance : Instance struct +type Instance struct { + // The availability policy for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicy `json:"availability_policy" validate:"required"` + + // The total bandwidth (in megabits per second) shared across the virtual server instance's network interfaces and + // storage volumes. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // Boot volume attachment. + BootVolumeAttachment *VolumeAttachmentReferenceInstanceContext `json:"boot_volume_attachment" validate:"required"` + + // If present, this virtual server instance was provisioned from a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user). + CatalogOffering *InstanceCatalogOffering `json:"catalog_offering,omitempty"` + + // The date and time that the virtual server instance was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, the dedicated host this virtual server instance has been placed on. + DedicatedHost *DedicatedHostReference `json:"dedicated_host,omitempty"` + + // The instance disks for this virtual server instance. + Disks []InstanceDisk `json:"disks" validate:"required"` + + // The virtual server instance GPU configuration. + Gpu *InstanceGpu `json:"gpu,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The image the virtual server instance was provisioned from. + Image *ImageReference `json:"image,omitempty"` + + // The reasons for the current `lifecycle_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []InstanceLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the virtual server instance. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The amount of memory, truncated to whole gibibytes. + Memory *int64 `json:"memory" validate:"required"` + + // The metadata service configuration. + MetadataService *InstanceMetadataService `json:"metadata_service" validate:"required"` + + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. + Name *string `json:"name" validate:"required"` + + // The network attachments for this virtual server instance, including the primary network attachment. + NetworkAttachments []InstanceNetworkAttachmentReference `json:"network_attachments" validate:"required"` + + // The network interfaces for this virtual server instance, including the primary network interface. + // Deprecated: this field is deprecated and may be removed in a future release. + NetworkInterfaces []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"` + + // 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"` + + // Primary 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 resource group for this instance. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether the state of the virtual server instance permits a start request. + Startable *bool `json:"startable" validate:"required"` + + // The status of the virtual server instance. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the instance on which the unexpected + // property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []InstanceStatusReason `json:"status_reasons" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance network interfaces. + TotalNetworkBandwidth *int64 `json:"total_network_bandwidth" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth" validate:"required"` + + // The virtual server instance VCPU configuration. + Vcpu *InstanceVcpu `json:"vcpu" validate:"required"` + + // The volume attachments for this virtual server instance, including the boot volume attachment. + VolumeAttachments []VolumeAttachmentReferenceInstanceContext `json:"volume_attachments" validate:"required"` + + // The VPC this virtual server instance resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this virtual server instance resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Instance.LifecycleState property. +// The lifecycle state of the virtual server instance. +const ( + InstanceLifecycleStateDeletingConst = "deleting" + InstanceLifecycleStateFailedConst = "failed" + InstanceLifecycleStatePendingConst = "pending" + InstanceLifecycleStateStableConst = "stable" + InstanceLifecycleStateSuspendedConst = "suspended" + InstanceLifecycleStateUpdatingConst = "updating" + InstanceLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Instance.ResourceType property. +// The resource type. +const ( + InstanceResourceTypeInstanceConst = "instance" +) + +// Constants associated with the Instance.Status property. +// The status of the virtual server instance. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the instance on which the unexpected +// property value was encountered. +const ( + InstanceStatusDeletingConst = "deleting" + InstanceStatusFailedConst = "failed" + InstanceStatusPendingConst = "pending" + InstanceStatusRestartingConst = "restarting" + InstanceStatusRunningConst = "running" + InstanceStatusStartingConst = "starting" + InstanceStatusStoppedConst = "stopped" + InstanceStatusStoppingConst = "stopping" +) + +// UnmarshalInstance unmarshals an instance of Instance from the specified map of raw messages. +func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Instance) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentReferenceInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOffering) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dedicated_host", &obj.DedicatedHost, UnmarshalDedicatedHostReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu", &obj.Gpu, UnmarshalInstanceGpu) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataService) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceInstanceContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceInstanceContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "startable", &obj.Startable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalInstanceStatusReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_network_bandwidth", &obj.TotalNetworkBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalInstanceVcpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceAction : InstanceAction struct +type InstanceAction struct { + // The date and time that the action was completed. + // Deprecated: this field is deprecated and may be removed in a future release. + CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` + + // The date and time that the action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If set to true, the action will be forced immediately, and all queued actions deleted. Ignored for the start action. + Force *bool `json:"force,omitempty"` + + // The URL for this instance action. + // Deprecated: this field is deprecated and may be removed in a future release. + Href *string `json:"href" validate:"required"` + + // The identifier for this instance action. + // Deprecated: this field is deprecated and may be removed in a future release. + ID *string `json:"id" validate:"required"` + + // The date and time that the action was started. + // Deprecated: this field is deprecated and may be removed in a future release. + StartedAt *strfmt.DateTime `json:"started_at,omitempty"` + + // The current status of this action. + // Deprecated: this field is deprecated and may be removed in a future release. + Status *string `json:"status" validate:"required"` + + // The type of action. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceAction.Status property. +// The current status of this action. +const ( + InstanceActionStatusCompletedConst = "completed" + InstanceActionStatusFailedConst = "failed" + InstanceActionStatusPendingConst = "pending" + InstanceActionStatusRunningConst = "running" +) + +// Constants associated with the InstanceAction.Type property. +// The type of action. +const ( + InstanceActionTypeRebootConst = "reboot" + InstanceActionTypeStartConst = "start" + InstanceActionTypeStopConst = "stop" +) + +// UnmarshalInstanceAction unmarshals an instance of InstanceAction from the specified map of raw messages. +func UnmarshalInstanceAction(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAction) + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "force", &obj.Force) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceAvailabilityPolicy : InstanceAvailabilityPolicy struct +type InstanceAvailabilityPolicy struct { + // The action to perform if the compute host experiences a failure. + // - `restart`: Automatically restart the virtual server instance after host failure + // - `stop`: Leave the virtual server instance stopped after host failure + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the + // unexpected property value was encountered. + HostFailure *string `json:"host_failure" validate:"required"` +} + +// Constants associated with the InstanceAvailabilityPolicy.HostFailure property. +// The action to perform if the compute host experiences a failure. +// - `restart`: Automatically restart the virtual server instance after host failure +// - `stop`: Leave the virtual server instance stopped after host failure +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the +// unexpected property value was encountered. +const ( + InstanceAvailabilityPolicyHostFailureRestartConst = "restart" + InstanceAvailabilityPolicyHostFailureStopConst = "stop" +) + +// UnmarshalInstanceAvailabilityPolicy unmarshals an instance of InstanceAvailabilityPolicy from the specified map of raw messages. +func UnmarshalInstanceAvailabilityPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAvailabilityPolicy) + err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceAvailabilityPolicyPatch : InstanceAvailabilityPolicyPatch struct +type InstanceAvailabilityPolicyPatch struct { + // The action to perform if the compute host experiences a failure. + // - `restart`: Automatically restart the virtual server instance after host failure + // - `stop`: Leave the virtual server instance stopped after host failure. + HostFailure *string `json:"host_failure,omitempty"` +} + +// Constants associated with the InstanceAvailabilityPolicyPatch.HostFailure property. +// The action to perform if the compute host experiences a failure. +// - `restart`: Automatically restart the virtual server instance after host failure +// - `stop`: Leave the virtual server instance stopped after host failure. +const ( + InstanceAvailabilityPolicyPatchHostFailureRestartConst = "restart" + InstanceAvailabilityPolicyPatchHostFailureStopConst = "stop" +) + +// UnmarshalInstanceAvailabilityPolicyPatch unmarshals an instance of InstanceAvailabilityPolicyPatch from the specified map of raw messages. +func UnmarshalInstanceAvailabilityPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAvailabilityPolicyPatch) + err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceAvailabilityPolicyPrototype : InstanceAvailabilityPolicyPrototype struct +type InstanceAvailabilityPolicyPrototype struct { + // The action to perform if the compute host experiences a failure. + // - `restart`: Automatically restart the virtual server instance after host failure + // - `stop`: Leave the virtual server instance stopped after host failure. + HostFailure *string `json:"host_failure,omitempty"` +} + +// Constants associated with the InstanceAvailabilityPolicyPrototype.HostFailure property. +// The action to perform if the compute host experiences a failure. +// - `restart`: Automatically restart the virtual server instance after host failure +// - `stop`: Leave the virtual server instance stopped after host failure. +const ( + InstanceAvailabilityPolicyPrototypeHostFailureRestartConst = "restart" + InstanceAvailabilityPolicyPrototypeHostFailureStopConst = "stop" +) + +// UnmarshalInstanceAvailabilityPolicyPrototype unmarshals an instance of InstanceAvailabilityPolicyPrototype from the specified map of raw messages. +func UnmarshalInstanceAvailabilityPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAvailabilityPolicyPrototype) + err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCatalogOffering : InstanceCatalogOffering struct +type InstanceCatalogOffering struct { + // The catalog offering version this virtual server instance was provisioned from. + // + // The catalog offering version is not managed by the IBM VPC service, and may no longer + // exist, or may refer to a different image CRN than the `image.crn` for this virtual + // server instance. However, all images associated with a catalog offering version will + // have the same checksum, and therefore will have the same data. + Version *CatalogOfferingVersionReference `json:"version" validate:"required"` +} + +// UnmarshalInstanceCatalogOffering unmarshals an instance of InstanceCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCatalogOffering) + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCatalogOfferingPrototype : The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering or offering version to use +// when provisioning this virtual server instance. +// +// If an offering is specified, the latest version of that offering will be used. +// +// The specified offering or offering version may be in a different account in the same +// [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject to IAM policies. +// Models which "extend" this model: +// - InstanceCatalogOfferingPrototypeCatalogOfferingByOffering +// - InstanceCatalogOfferingPrototypeCatalogOfferingByVersion +type InstanceCatalogOfferingPrototype struct { + // Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering by a unique property. + Offering CatalogOfferingIdentityIntf `json:"offering,omitempty"` + + // Identifies a version of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a + // unique property. + Version CatalogOfferingVersionIdentityIntf `json:"version,omitempty"` +} + +func (*InstanceCatalogOfferingPrototype) isaInstanceCatalogOfferingPrototype() bool { + return true +} + +type InstanceCatalogOfferingPrototypeIntf interface { + isaInstanceCatalogOfferingPrototype() bool +} + +// UnmarshalInstanceCatalogOfferingPrototype unmarshals an instance of InstanceCatalogOfferingPrototype from the specified map of raw messages. +func UnmarshalInstanceCatalogOfferingPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCatalogOfferingPrototype) + err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCollection : InstanceCollection struct +type InstanceCollection struct { + // A link to the first page of resources. + First *InstanceCollectionFirst `json:"first" validate:"required"` + + // Collection of virtual server instances. + Instances []Instance `json:"instances" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceCollection unmarshals an instance of InstanceCollection from the specified map of raw messages. +func UnmarshalInstanceCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstance) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *InstanceCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// InstanceCollectionFirst : A link to the first page of resources. +type InstanceCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceCollectionFirst unmarshals an instance of InstanceCollectionFirst from the specified map of raw messages. +func UnmarshalInstanceCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type InstanceCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceCollectionNext unmarshals an instance of InstanceCollectionNext from the specified map of raw messages. +func UnmarshalInstanceCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceConsoleAccessToken : The instance console access token information. +type InstanceConsoleAccessToken struct { + // A URL safe single-use token used to access the console WebSocket. + AccessToken *string `json:"access_token" validate:"required"` + + // The instance console type for which this token may be used. + ConsoleType *string `json:"console_type" validate:"required"` + + // The date and time that the access token was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The date and time that the access token will expire. + ExpiresAt *strfmt.DateTime `json:"expires_at" validate:"required"` + + // Indicates whether to disconnect an existing serial console session as the serial console cannot be shared. This has + // no effect on VNC consoles. + Force *bool `json:"force" validate:"required"` + + // The URL to access this instance console. + Href *string `json:"href" validate:"required"` +} + +// Constants associated with the InstanceConsoleAccessToken.ConsoleType property. +// The instance console type for which this token may be used. +const ( + InstanceConsoleAccessTokenConsoleTypeSerialConst = "serial" + InstanceConsoleAccessTokenConsoleTypeVncConst = "vnc" +) + +// UnmarshalInstanceConsoleAccessToken unmarshals an instance of InstanceConsoleAccessToken from the specified map of raw messages. +func UnmarshalInstanceConsoleAccessToken(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceConsoleAccessToken) + err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "force", &obj.Force) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDefaultTrustedProfilePrototype : InstanceDefaultTrustedProfilePrototype struct +type InstanceDefaultTrustedProfilePrototype struct { + // If set to `true`, the system will create a link to the specified `target` trusted profile during instance creation. + // Regardless of whether a link is created by the system or manually using the IAM Identity service, it will be + // automatically deleted when the instance is deleted. + AutoLink *bool `json:"auto_link,omitempty"` + + // The default IAM trusted profile to use for this virtual server instance. + Target TrustedProfileIdentityIntf `json:"target" validate:"required"` +} + +// NewInstanceDefaultTrustedProfilePrototype : Instantiate InstanceDefaultTrustedProfilePrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceDefaultTrustedProfilePrototype(target TrustedProfileIdentityIntf) (_model *InstanceDefaultTrustedProfilePrototype, err error) { + _model = &InstanceDefaultTrustedProfilePrototype{ + Target: target, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalInstanceDefaultTrustedProfilePrototype unmarshals an instance of InstanceDefaultTrustedProfilePrototype from the specified map of raw messages. +func UnmarshalInstanceDefaultTrustedProfilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDefaultTrustedProfilePrototype) + err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDisk : InstanceDisk struct +type InstanceDisk struct { + // The date and time that the disk was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance disk. + ID *string `json:"id" validate:"required"` + + // The disk interface used for attaching the disk. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The name for this instance disk. The name is unique across all disks on the instance. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *int64 `json:"size" validate:"required"` +} + +// Constants associated with the InstanceDisk.InterfaceType property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + InstanceDiskInterfaceTypeNvmeConst = "nvme" + InstanceDiskInterfaceTypeVirtioBlkConst = "virtio_blk" +) + +// Constants associated with the InstanceDisk.ResourceType property. +// The resource type. +const ( + InstanceDiskResourceTypeInstanceDiskConst = "instance_disk" +) + +// UnmarshalInstanceDisk unmarshals an instance of InstanceDisk from the specified map of raw messages. +func UnmarshalInstanceDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDisk) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDiskCollection : InstanceDiskCollection struct +type InstanceDiskCollection struct { + // Collection of the instance's disks. + Disks []InstanceDisk `json:"disks" validate:"required"` +} + +// UnmarshalInstanceDiskCollection unmarshals an instance of InstanceDiskCollection from the specified map of raw messages. +func UnmarshalInstanceDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskCollection) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDiskPatch : InstanceDiskPatch struct +type InstanceDiskPatch struct { + // The name for this instance disk. The name must not be used by another disk on the instance. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceDiskPatch unmarshals an instance of InstanceDiskPatch from the specified map of raw messages. +func UnmarshalInstanceDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceDiskPatch +func (instanceDiskPatch *InstanceDiskPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceDiskPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// InstanceDiskReference : InstanceDiskReference struct +type InstanceDiskReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceDiskReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance disk. + ID *string `json:"id" validate:"required"` + + // The name for this instance disk. The name is unique across all disks on the instance. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstanceDiskReference.ResourceType property. +// The resource type. +const ( + InstanceDiskReferenceResourceTypeInstanceDiskConst = "instance_disk" +) + +// UnmarshalInstanceDiskReference unmarshals an instance of InstanceDiskReference from the specified map of raw messages. +func UnmarshalInstanceDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceDiskReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceDiskReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceDiskReferenceDeleted unmarshals an instance of InstanceDiskReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGpu : The virtual server instance GPU configuration. +type InstanceGpu struct { + // The number of GPUs assigned to the instance. + Count *int64 `json:"count" validate:"required"` + + // The GPU manufacturer. + Manufacturer *string `json:"manufacturer" validate:"required"` + + // The overall amount of GPU memory in GiB (gibibytes). + Memory *int64 `json:"memory" validate:"required"` + + // The GPU model. + Model *string `json:"model" validate:"required"` +} + +// UnmarshalInstanceGpu unmarshals an instance of InstanceGpu from the specified map of raw messages. +func UnmarshalInstanceGpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGpu) + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "model", &obj.Model) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroup : InstanceGroup struct +type InstanceGroup struct { + // The port used for new load balancer pool members created by this instance group. + // + // This property will be present if and only if `load_balancer_pool` is present. + ApplicationPort *int64 `json:"application_port,omitempty"` + + // The date and time that the instance group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance group. + CRN *string `json:"crn" validate:"required"` + + // The URL for this instance group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group. + ID *string `json:"id" validate:"required"` + + // The template used to create new instances for this group. + InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` + + // If present, the load balancer pool this instance group manages. A pool member will + // be created for each instance created by this group. + LoadBalancerPool *LoadBalancerPoolReference `json:"load_balancer_pool,omitempty"` + + // The managers for the instance group. + Managers []InstanceGroupManagerReference `json:"managers" validate:"required"` + + // The number of instances in the instance group. + MembershipCount *int64 `json:"membership_count" validate:"required"` + + // The name for this instance group. The name is unique across all instance groups in the region. + Name *string `json:"name" validate:"required"` + + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The status of the instance group + // - `deleting`: Group is being deleted + // - `healthy`: Group has `membership_count` instances + // - `scaling`: Instances in the group are being created or deleted to reach + // `membership_count` + // - `unhealthy`: Group is unable to reach `membership_count` instances. + Status *string `json:"status" validate:"required"` + + // The subnets to use when creating new instances. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The date and time that the instance group was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The VPC the instance group resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the InstanceGroup.Status property. +// The status of the instance group +// - `deleting`: Group is being deleted +// - `healthy`: Group has `membership_count` instances +// - `scaling`: Instances in the group are being created or deleted to reach +// `membership_count` +// - `unhealthy`: Group is unable to reach `membership_count` instances. +const ( + InstanceGroupStatusDeletingConst = "deleting" + InstanceGroupStatusHealthyConst = "healthy" + InstanceGroupStatusScalingConst = "scaling" + InstanceGroupStatusUnhealthyConst = "unhealthy" +) + +// UnmarshalInstanceGroup unmarshals an instance of InstanceGroup from the specified map of raw messages. +func UnmarshalInstanceGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroup) + err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManagerReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupCollection : InstanceGroupCollection struct +type InstanceGroupCollection struct { + // A link to the first page of resources. + First *InstanceGroupCollectionFirst `json:"first" validate:"required"` + + // Collection of instance groups. + InstanceGroups []InstanceGroup `json:"instance_groups" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceGroupCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceGroupCollection unmarshals an instance of InstanceGroupCollection from the specified map of raw messages. +func UnmarshalInstanceGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_groups", &obj.InstanceGroups, UnmarshalInstanceGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *InstanceGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// InstanceGroupCollectionFirst : A link to the first page of resources. +type InstanceGroupCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupCollectionFirst unmarshals an instance of InstanceGroupCollectionFirst from the specified map of raw messages. +func UnmarshalInstanceGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type InstanceGroupCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupCollectionNext unmarshals an instance of InstanceGroupCollectionNext from the specified map of raw messages. +func UnmarshalInstanceGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManager : InstanceGroupManager struct +// Models which "extend" this model: +// - InstanceGroupManagerAutoScale +// - InstanceGroupManagerScheduled +type InstanceGroupManager struct { + // The date and time that the instance group manager was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled" validate:"required"` + + // The name for this instance group manager. The name is unique across all managers for the instance group. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type,omitempty"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The policies of the instance group manager. + Policies []InstanceGroupManagerPolicyReference `json:"policies,omitempty"` + + // The actions of the instance group manager. + Actions []InstanceGroupManagerActionReference `json:"actions,omitempty"` +} + +// Constants associated with the InstanceGroupManager.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerManagerTypeAutoscaleConst = "autoscale" +) + +func (*InstanceGroupManager) isaInstanceGroupManager() bool { + return true +} + +type InstanceGroupManagerIntf interface { + isaInstanceGroupManager() bool +} + +// UnmarshalInstanceGroupManager unmarshals an instance of InstanceGroupManager from the specified map of raw messages. +func UnmarshalInstanceGroupManager(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManager) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerAction : InstanceGroupManagerAction struct +// Models which "extend" this model: +// - InstanceGroupManagerActionScheduledAction +type InstanceGroupManagerAction struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. At present, this is always + // `true`, but may be modifiable in the future. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroup `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager,omitempty"` +} + +// Constants associated with the InstanceGroupManagerAction.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerAction.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionStatusActiveConst = "active" + InstanceGroupManagerActionStatusCompletedConst = "completed" + InstanceGroupManagerActionStatusFailedConst = "failed" + InstanceGroupManagerActionStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerAction.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerAction) isaInstanceGroupManagerAction() bool { + return true +} + +type InstanceGroupManagerActionIntf interface { + isaInstanceGroupManagerAction() bool +} + +// UnmarshalInstanceGroupManagerAction unmarshals an instance of InstanceGroupManagerAction from the specified map of raw messages. +func UnmarshalInstanceGroupManagerAction(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerAction) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionGroupPatch : InstanceGroupManagerActionGroupPatch struct +type InstanceGroupManagerActionGroupPatch struct { + // The desired number of instance group members at the scheduled time. + MembershipCount *int64 `json:"membership_count,omitempty"` +} + +// UnmarshalInstanceGroupManagerActionGroupPatch unmarshals an instance of InstanceGroupManagerActionGroupPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionGroupPatch) + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionManagerPatch : InstanceGroupManagerActionManagerPatch struct +type InstanceGroupManagerActionManagerPatch struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +// UnmarshalInstanceGroupManagerActionManagerPatch unmarshals an instance of InstanceGroupManagerActionManagerPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionManagerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionManagerPatch) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPatch : InstanceGroupManagerActionPatch struct +type InstanceGroupManagerActionPatch struct { + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + Group *InstanceGroupManagerActionGroupPatch `json:"group,omitempty"` + + Manager *InstanceGroupManagerActionManagerPatch `json:"manager,omitempty"` + + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` +} + +// UnmarshalInstanceGroupManagerActionPatch unmarshals an instance of InstanceGroupManagerActionPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPatch) + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerActionGroupPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerActionManagerPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceGroupManagerActionPatch +func (instanceGroupManagerActionPatch *InstanceGroupManagerActionPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceGroupManagerActionPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// InstanceGroupManagerActionPrototype : InstanceGroupManagerActionPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerActionPrototypeScheduledActionPrototype +type InstanceGroupManagerActionPrototype struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` +} + +func (*InstanceGroupManagerActionPrototype) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +type InstanceGroupManagerActionPrototypeIntf interface { + isaInstanceGroupManagerActionPrototype() bool +} + +// UnmarshalInstanceGroupManagerActionPrototype unmarshals an instance of InstanceGroupManagerActionPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionReference : InstanceGroupManagerActionReference struct +type InstanceGroupManagerActionReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerActionReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerActionReference.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionReferenceResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// UnmarshalInstanceGroupManagerActionReference unmarshals an instance of InstanceGroupManagerActionReference from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerActionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceGroupManagerActionReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupManagerActionReferenceDeleted unmarshals an instance of InstanceGroupManagerActionReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionsCollection : InstanceGroupManagerActionsCollection struct +type InstanceGroupManagerActionsCollection struct { + // Collection of instance group manager actions. + Actions []InstanceGroupManagerActionIntf `json:"actions" validate:"required"` + + // A link to the first page of resources. + First *InstanceGroupManagerActionsCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceGroupManagerActionsCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceGroupManagerActionsCollection unmarshals an instance of InstanceGroupManagerActionsCollection from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionsCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionsCollection) + err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerAction) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerActionsCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerActionsCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *InstanceGroupManagerActionsCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// InstanceGroupManagerActionsCollectionFirst : A link to the first page of resources. +type InstanceGroupManagerActionsCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupManagerActionsCollectionFirst unmarshals an instance of InstanceGroupManagerActionsCollectionFirst from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionsCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionsCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionsCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type InstanceGroupManagerActionsCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupManagerActionsCollectionNext unmarshals an instance of InstanceGroupManagerActionsCollectionNext from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionsCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionsCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerCollection : InstanceGroupManagerCollection struct +type InstanceGroupManagerCollection struct { + // A link to the first page of resources. + First *InstanceGroupManagerCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of instance group managers. + Managers []InstanceGroupManagerIntf `json:"managers" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceGroupManagerCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceGroupManagerCollection unmarshals an instance of InstanceGroupManagerCollection from the specified map of raw messages. +func UnmarshalInstanceGroupManagerCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManager) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *InstanceGroupManagerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// InstanceGroupManagerCollectionFirst : A link to the first page of resources. +type InstanceGroupManagerCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupManagerCollectionFirst unmarshals an instance of InstanceGroupManagerCollectionFirst from the specified map of raw messages. +func UnmarshalInstanceGroupManagerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type InstanceGroupManagerCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupManagerCollectionNext unmarshals an instance of InstanceGroupManagerCollectionNext from the specified map of raw messages. +func UnmarshalInstanceGroupManagerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPatch : InstanceGroupManagerPatch struct +type InstanceGroupManagerPatch struct { + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The name for this instance group manager. The name must not be used by another manager for the instance group. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceGroupManagerPatch unmarshals an instance of InstanceGroupManagerPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPatch) + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceGroupManagerPatch +func (instanceGroupManagerPatch *InstanceGroupManagerPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceGroupManagerPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// InstanceGroupManagerPolicy : InstanceGroupManagerPolicy struct +// Models which "extend" this model: +// - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy +type InstanceGroupManagerPolicy struct { + // The date and time that the instance group manager policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager policy. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager policy. The name is unique across all policies for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager policy was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type,omitempty"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value,omitempty"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPolicy.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicy.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyPolicyTypeTargetConst = "target" +) + +func (*InstanceGroupManagerPolicy) isaInstanceGroupManagerPolicy() bool { + return true +} + +type InstanceGroupManagerPolicyIntf interface { + isaInstanceGroupManagerPolicy() bool +} + +// UnmarshalInstanceGroupManagerPolicy unmarshals an instance of InstanceGroupManagerPolicy from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicy) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyCollection : InstanceGroupManagerPolicyCollection struct +type InstanceGroupManagerPolicyCollection struct { + // A link to the first page of resources. + First *InstanceGroupManagerPolicyCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceGroupManagerPolicyCollectionNext `json:"next,omitempty"` + + // Collection of instance group manager policies. + Policies []InstanceGroupManagerPolicyIntf `json:"policies" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyCollection unmarshals an instance of InstanceGroupManagerPolicyCollection from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerPolicyCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerPolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *InstanceGroupManagerPolicyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// InstanceGroupManagerPolicyCollectionFirst : A link to the first page of resources. +type InstanceGroupManagerPolicyCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyCollectionFirst unmarshals an instance of InstanceGroupManagerPolicyCollectionFirst from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type InstanceGroupManagerPolicyCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyCollectionNext unmarshals an instance of InstanceGroupManagerPolicyCollectionNext from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyPatch : InstanceGroupManagerPolicyPatch struct +type InstanceGroupManagerPolicyPatch struct { + // The type of metric to be evaluated. + MetricType *string `json:"metric_type,omitempty"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value,omitempty"` + + // The name for this instance group manager policy. The name must not be used by another policy for the instance group + // manager. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPolicyPatch.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyPatchMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyPatchMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyPatchMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyPatchMetricTypeNetworkOutConst = "network_out" +) + +// UnmarshalInstanceGroupManagerPolicyPatch unmarshals an instance of InstanceGroupManagerPolicyPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyPatch) + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceGroupManagerPolicyPatch +func (instanceGroupManagerPolicyPatch *InstanceGroupManagerPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceGroupManagerPolicyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// InstanceGroupManagerPolicyPrototype : InstanceGroupManagerPolicyPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype +type InstanceGroupManagerPolicyPrototype struct { + // The name for this instance group manager policy. The name must not be used by another policy for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type,omitempty"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value,omitempty"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPolicyPrototype.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyPrototypeMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyPrototypeMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyPrototypeMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyPrototypeMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicyPrototype.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyPrototypePolicyTypeTargetConst = "target" +) + +func (*InstanceGroupManagerPolicyPrototype) isaInstanceGroupManagerPolicyPrototype() bool { + return true +} + +type InstanceGroupManagerPolicyPrototypeIntf interface { + isaInstanceGroupManagerPolicyPrototype() bool +} + +// UnmarshalInstanceGroupManagerPolicyPrototype unmarshals an instance of InstanceGroupManagerPolicyPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyReference : InstanceGroupManagerPolicyReference struct +type InstanceGroupManagerPolicyReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerPolicyReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager policy. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager policy. The name is unique across all policies for the instance group + // manager. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyReference unmarshals an instance of InstanceGroupManagerPolicyReference from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerPolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceGroupManagerPolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyReferenceDeleted unmarshals an instance of InstanceGroupManagerPolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPrototype : InstanceGroupManagerPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype +// - InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype +type InstanceGroupManagerPrototype struct { + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The name for this instance group manager. The name must not be used by another manager for the instance group. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type,omitempty"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPrototype.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerPrototypeManagerTypeAutoscaleConst = "autoscale" +) + +func (*InstanceGroupManagerPrototype) isaInstanceGroupManagerPrototype() bool { + return true +} + +type InstanceGroupManagerPrototypeIntf interface { + isaInstanceGroupManagerPrototype() bool +} + +// UnmarshalInstanceGroupManagerPrototype unmarshals an instance of InstanceGroupManagerPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPrototype) + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerReference : InstanceGroupManagerReference struct +type InstanceGroupManagerReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager. The name is unique across all managers for the instance group. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceGroupManagerReference unmarshals an instance of InstanceGroupManagerReference from the specified map of raw messages. +func UnmarshalInstanceGroupManagerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceGroupManagerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupManagerReferenceDeleted unmarshals an instance of InstanceGroupManagerReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupManagerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionGroup : InstanceGroupManagerScheduledActionGroup struct +type InstanceGroupManagerScheduledActionGroup struct { + // The desired number of instance group members at the scheduled time. + MembershipCount *int64 `json:"membership_count" validate:"required"` +} + +// UnmarshalInstanceGroupManagerScheduledActionGroup unmarshals an instance of InstanceGroupManagerScheduledActionGroup from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionGroup) + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionGroupPrototype : InstanceGroupManagerScheduledActionGroupPrototype struct +type InstanceGroupManagerScheduledActionGroupPrototype struct { + // The desired number of instance group members at the scheduled time. + MembershipCount *int64 `json:"membership_count" validate:"required"` +} + +// NewInstanceGroupManagerScheduledActionGroupPrototype : Instantiate InstanceGroupManagerScheduledActionGroupPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerScheduledActionGroupPrototype(membershipCount int64) (_model *InstanceGroupManagerScheduledActionGroupPrototype, err error) { + _model = &InstanceGroupManagerScheduledActionGroupPrototype{ + MembershipCount: core.Int64Ptr(membershipCount), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalInstanceGroupManagerScheduledActionGroupPrototype unmarshals an instance of InstanceGroupManagerScheduledActionGroupPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionGroupPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionGroupPrototype) + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManager : InstanceGroupManagerScheduledActionManager struct +// Models which "extend" this model: +// - InstanceGroupManagerScheduledActionManagerAutoScale +type InstanceGroupManagerScheduledActionManager struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id,omitempty"` + + // The name for this instance group manager. The name is unique across all managers for the instance group. + Name *string `json:"name,omitempty"` + + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +func (*InstanceGroupManagerScheduledActionManager) isaInstanceGroupManagerScheduledActionManager() bool { + return true +} + +type InstanceGroupManagerScheduledActionManagerIntf interface { + isaInstanceGroupManagerScheduledActionManager() bool +} + +// UnmarshalInstanceGroupManagerScheduledActionManager unmarshals an instance of InstanceGroupManagerScheduledActionManager from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManager(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManager) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototype : InstanceGroupManagerScheduledActionManagerPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype +type InstanceGroupManagerScheduledActionManagerPrototype struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href,omitempty"` +} + +func (*InstanceGroupManagerScheduledActionManagerPrototype) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +type InstanceGroupManagerScheduledActionManagerPrototypeIntf interface { + isaInstanceGroupManagerScheduledActionManagerPrototype() bool +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototype unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototype) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembership : InstanceGroupMembership struct +type InstanceGroupMembership struct { + // The date and time that the instance group manager policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If set to true, when deleting the membership the instance will also be deleted. + DeleteInstanceOnMembershipDelete *bool `json:"delete_instance_on_membership_delete" validate:"required"` + + // The URL for this instance group membership. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group membership. + ID *string `json:"id" validate:"required"` + + Instance *InstanceReference `json:"instance" validate:"required"` + + InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` + + // The name for this instance group membership. The name is unique across all memberships for the instance group. + Name *string `json:"name" validate:"required"` + + PoolMember *LoadBalancerPoolMemberReference `json:"pool_member,omitempty"` + + // The status of the instance group membership + // - `deleting`: Membership is deleting dependent resources + // - `failed`: Membership was unable to maintain dependent resources + // - `healthy`: Membership is active and serving in the group + // - `pending`: Membership is waiting for dependent resources + // - `unhealthy`: Membership has unhealthy dependent resources. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group membership was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` +} + +// Constants associated with the InstanceGroupMembership.Status property. +// The status of the instance group membership +// - `deleting`: Membership is deleting dependent resources +// - `failed`: Membership was unable to maintain dependent resources +// - `healthy`: Membership is active and serving in the group +// - `pending`: Membership is waiting for dependent resources +// - `unhealthy`: Membership has unhealthy dependent resources. +const ( + InstanceGroupMembershipStatusDeletingConst = "deleting" + InstanceGroupMembershipStatusFailedConst = "failed" + InstanceGroupMembershipStatusHealthyConst = "healthy" + InstanceGroupMembershipStatusPendingConst = "pending" + InstanceGroupMembershipStatusUnhealthyConst = "unhealthy" +) + +// UnmarshalInstanceGroupMembership unmarshals an instance of InstanceGroupMembership from the specified map of raw messages. +func UnmarshalInstanceGroupMembership(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembership) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_instance_on_membership_delete", &obj.DeleteInstanceOnMembershipDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalInstanceReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pool_member", &obj.PoolMember, UnmarshalLoadBalancerPoolMemberReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembershipCollection : InstanceGroupMembershipCollection struct +type InstanceGroupMembershipCollection struct { + // A link to the first page of resources. + First *InstanceGroupMembershipCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of instance group memberships. + Memberships []InstanceGroupMembership `json:"memberships" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceGroupMembershipCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceGroupMembershipCollection unmarshals an instance of InstanceGroupMembershipCollection from the specified map of raw messages. +func UnmarshalInstanceGroupMembershipCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembershipCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupMembershipCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memberships", &obj.Memberships, UnmarshalInstanceGroupMembership) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupMembershipCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *InstanceGroupMembershipCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// InstanceGroupMembershipCollectionFirst : A link to the first page of resources. +type InstanceGroupMembershipCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupMembershipCollectionFirst unmarshals an instance of InstanceGroupMembershipCollectionFirst from the specified map of raw messages. +func UnmarshalInstanceGroupMembershipCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembershipCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembershipCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type InstanceGroupMembershipCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupMembershipCollectionNext unmarshals an instance of InstanceGroupMembershipCollectionNext from the specified map of raw messages. +func UnmarshalInstanceGroupMembershipCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembershipCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembershipPatch : InstanceGroupMembershipPatch struct +type InstanceGroupMembershipPatch struct { + // The name for this instance group membership. The name must not be used by another membership for the instance group + // manager. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceGroupMembershipPatch unmarshals an instance of InstanceGroupMembershipPatch from the specified map of raw messages. +func UnmarshalInstanceGroupMembershipPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembershipPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceGroupMembershipPatch +func (instanceGroupMembershipPatch *InstanceGroupMembershipPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceGroupMembershipPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// InstanceGroupPatch : To add or update load balancer specification for an instance group the `membership_count` must first be set to 0. +type InstanceGroupPatch struct { + // The port to use for new load balancer pool members created by this instance group. + // + // This property must be set if and only if `load_balancer_pool` has been set. + ApplicationPort *int64 `json:"application_port,omitempty"` + + // Instance template to use when creating new instances. + // + // Instance groups are not compatible with instance templates that specify `true` for + // `default_trusted_profile.auto_link`. + InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template,omitempty"` + + // The load balancer associated with `load_balancer_pool`. + // The load balancer must have `instance_groups_supported` set to `true`. + // + // This property must be set if and only if `load_balancer_pool` has been set. + LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` + + // If specified, this instance group will manage the load balancer pool. A pool member + // will be created for each instance created by this group. The specified load + // balancer pool must not be used by another instance group in the VPC. + // + // If set, `load_balancer` and `application_port` must also be set. + LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` + + // The number of instances in the instance group. + MembershipCount *int64 `json:"membership_count,omitempty"` + + // The name for this instance group. The name must not be used by another instance group in the region. + Name *string `json:"name,omitempty"` + + // The subnets to use when creating new instances. + Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` +} + +// UnmarshalInstanceGroupPatch unmarshals an instance of InstanceGroupPatch from the specified map of raw messages. +func UnmarshalInstanceGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupPatch) + err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancer", &obj.LoadBalancer, UnmarshalLoadBalancerIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceGroupPatch +func (instanceGroupPatch *InstanceGroupPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceGroupPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// InstanceGroupReference : InstanceGroupReference struct +type InstanceGroupReference struct { + // The CRN for this instance group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group. + ID *string `json:"id" validate:"required"` + + // The name for this instance group. The name is unique across all instance groups in the region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceGroupReference unmarshals an instance of InstanceGroupReference from the specified map of raw messages. +func UnmarshalInstanceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupReferenceDeleted unmarshals an instance of InstanceGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceInitialization : InstanceInitialization struct +type InstanceInitialization struct { + // The default trusted profile configuration specified at virtual server instance + // creation. If absent, no default trusted profile was specified. + DefaultTrustedProfile *InstanceInitializationDefaultTrustedProfile `json:"default_trusted_profile,omitempty"` + + // The public SSH keys used at instance initialization. + Keys []KeyReference `json:"keys" validate:"required"` + + Password *InstanceInitializationPassword `json:"password,omitempty"` +} + +// UnmarshalInstanceInitialization unmarshals an instance of InstanceInitialization from the specified map of raw messages. +func UnmarshalInstanceInitialization(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceInitialization) + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceInitializationDefaultTrustedProfile) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "password", &obj.Password, UnmarshalInstanceInitializationPassword) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceInitializationDefaultTrustedProfile : InstanceInitializationDefaultTrustedProfile struct +type InstanceInitializationDefaultTrustedProfile struct { + // If set to `true`, the system created a link to the specified `target` trusted profile during instance creation. + // Regardless of whether a link was created by the system or manually using the IAM Identity service, it will be + // automatically deleted when the instance is deleted. + AutoLink *bool `json:"auto_link" validate:"required"` + + // The default IAM trusted profile to use for this virtual server instance. + Target *TrustedProfileReference `json:"target" validate:"required"` +} + +// UnmarshalInstanceInitializationDefaultTrustedProfile unmarshals an instance of InstanceInitializationDefaultTrustedProfile from the specified map of raw messages. +func UnmarshalInstanceInitializationDefaultTrustedProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceInitializationDefaultTrustedProfile) + err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceInitializationPassword : InstanceInitializationPassword struct +type InstanceInitializationPassword struct { + // The administrator password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + EncryptedPassword *[]byte `json:"encrypted_password" validate:"required"` + + // The public SSH key used to encrypt the administrator password. + EncryptionKey *KeyIdentityByFingerprint `json:"encryption_key" validate:"required"` +} + +// UnmarshalInstanceInitializationPassword unmarshals an instance of InstanceInitializationPassword from the specified map of raw messages. +func UnmarshalInstanceInitializationPassword(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceInitializationPassword) + err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyIdentityByFingerprint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceLifecycleReason : InstanceLifecycleReason struct +type InstanceLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + Code *string `json:"code" validate:"required"` + + // An explanation of the reason for this lifecycle state. + Message *string `json:"message" validate:"required"` + + // Link to documentation about the reason for this lifecycle state. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the InstanceLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + InstanceLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalInstanceLifecycleReason unmarshals an instance of InstanceLifecycleReason from the specified map of raw messages. +func UnmarshalInstanceLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceMetadataService : The metadata service configuration. +type InstanceMetadataService struct { + // Indicates whether the metadata service endpoint is available to the virtual server instance. + Enabled *bool `json:"enabled" validate:"required"` + + // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is + // enabled. + // - `http`: HTTP protocol (unencrypted) + // - `https`: HTTP Secure protocol. + Protocol *string `json:"protocol" validate:"required"` + + // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata + // service is enabled. + ResponseHopLimit *int64 `json:"response_hop_limit" validate:"required"` +} + +// Constants associated with the InstanceMetadataService.Protocol property. +// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is +// enabled. +// - `http`: HTTP protocol (unencrypted) +// - `https`: HTTP Secure protocol. +const ( + InstanceMetadataServiceProtocolHTTPConst = "http" + InstanceMetadataServiceProtocolHTTPSConst = "https" +) + +// UnmarshalInstanceMetadataService unmarshals an instance of InstanceMetadataService from the specified map of raw messages. +func UnmarshalInstanceMetadataService(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceMetadataService) + err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceMetadataServicePatch : The metadata service configuration. +type InstanceMetadataServicePatch struct { + // Indicates whether the metadata service endpoint will be available to the virtual server instance. + Enabled *bool `json:"enabled,omitempty"` + + // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is + // enabled. + // - `http`: HTTP protocol (unencrypted) + // - `https`: HTTP Secure protocol. + Protocol *string `json:"protocol,omitempty"` + + // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata + // service is enabled. + ResponseHopLimit *int64 `json:"response_hop_limit,omitempty"` +} + +// Constants associated with the InstanceMetadataServicePatch.Protocol property. +// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is +// enabled. +// - `http`: HTTP protocol (unencrypted) +// - `https`: HTTP Secure protocol. +const ( + InstanceMetadataServicePatchProtocolHTTPConst = "http" + InstanceMetadataServicePatchProtocolHTTPSConst = "https" +) + +// UnmarshalInstanceMetadataServicePatch unmarshals an instance of InstanceMetadataServicePatch from the specified map of raw messages. +func UnmarshalInstanceMetadataServicePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceMetadataServicePatch) + err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceMetadataServicePrototype : The metadata service configuration. +type InstanceMetadataServicePrototype struct { + // Indicates whether the metadata service endpoint will be available to the virtual server instance. + Enabled *bool `json:"enabled,omitempty"` + + // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is + // enabled. + // - `http`: HTTP protocol (unencrypted) + // - `https`: HTTP Secure protocol. + Protocol *string `json:"protocol,omitempty"` + + // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata + // service is enabled. + ResponseHopLimit *int64 `json:"response_hop_limit,omitempty"` +} + +// Constants associated with the InstanceMetadataServicePrototype.Protocol property. +// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is +// enabled. +// - `http`: HTTP protocol (unencrypted) +// - `https`: HTTP Secure protocol. +const ( + InstanceMetadataServicePrototypeProtocolHTTPConst = "http" + InstanceMetadataServicePrototypeProtocolHTTPSConst = "https" +) + +// UnmarshalInstanceMetadataServicePrototype unmarshals an instance of InstanceMetadataServicePrototype from the specified map of raw messages. +func UnmarshalInstanceMetadataServicePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceMetadataServicePrototype) + err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachment : InstanceNetworkAttachment struct +type InstanceNetworkAttachment struct { + // The date and time that the network attachment was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network attachment. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + Name *string `json:"name" validate:"required"` + + // The port speed for this network attachment in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IP address of the virtual network interface for the 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 network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The network attachment type. + Type *string `json:"type" validate:"required"` + + // The virtual network interface for this network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` +} + +// Constants associated with the InstanceNetworkAttachment.LifecycleState property. +// The lifecycle state of the 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 network attachment type. +const ( + InstanceNetworkAttachmentTypePrimaryConst = "primary" + InstanceNetworkAttachmentTypeSecondaryConst = "secondary" +) + +// UnmarshalInstanceNetworkAttachment unmarshals an instance of InstanceNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachment) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentCollection : InstanceNetworkAttachmentCollection struct +type InstanceNetworkAttachmentCollection struct { + // Collection of network attachments. + NetworkAttachments []NetworkAttachment `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, UnmarshalNetworkAttachment) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPatch : InstanceNetworkAttachmentPatch struct +type InstanceNetworkAttachmentPatch struct { + // The name for this network attachment. The name must not be used by another network attachment for the instance. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceNetworkAttachmentPatch unmarshals an instance of InstanceNetworkAttachmentPatch from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceNetworkAttachmentPatch +func (instanceNetworkAttachmentPatch *InstanceNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceNetworkAttachmentPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// InstanceNetworkAttachmentPrototype : InstanceNetworkAttachmentPrototype struct +type InstanceNetworkAttachmentPrototype struct { + // The name for this network attachment. Names must be unique within the instance the network attachment resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // A virtual network interface for the network attachment. This can be specified using an + // existing virtual network interface, or a prototype object for a new virtual network + // interface. + VirtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototype : Instantiate InstanceNetworkAttachmentPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf) (_model *InstanceNetworkAttachmentPrototype, err error) { + _model = &InstanceNetworkAttachmentPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalInstanceNetworkAttachmentPrototype unmarshals an instance of InstanceNetworkAttachmentPrototype from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentReference : InstanceNetworkAttachmentReference struct +type InstanceNetworkAttachmentReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network attachment. + ID *string `json:"id" validate:"required"` + + Name *string `json:"name" validate:"required"` + + // The primary IP address of the virtual network interface for the 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 network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the InstanceNetworkAttachmentReference.ResourceType property. +// The resource type. +const ( + InstanceNetworkAttachmentReferenceResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +// UnmarshalInstanceNetworkAttachmentReference unmarshals an instance of InstanceNetworkAttachmentReference from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceNetworkAttachmentReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceNetworkAttachmentReferenceDeleted unmarshals an instance of InstanceNetworkAttachmentReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted unmarshals an instance of InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePatch : InstancePatch struct +type InstancePatch struct { + // The availability policy for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPatch `json:"availability_policy,omitempty"` + + // The metadata service configuration. + MetadataService *InstanceMetadataServicePatch `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. Changing the name will not affect the system hostname. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. For the placement + // restrictions to be changed, the instance `status` must be `stopping` or `stopped`. + PlacementTarget InstancePlacementTargetPatchIntf `json:"placement_target,omitempty"` + + // The profile to use for this virtual server instance. For the profile to be changed, + // the instance `status` must be `stopping` or `stopped`. In addition, the requested + // profile must: + // - Have matching instance disk support. Any disks associated with the current profile + // will be deleted, and any disks associated with the requested profile will be + // created. + // - Be compatible with any `placement_target` constraints. For example, if the + // instance is placed on a dedicated host, the requested profile `family` must be + // the same as the dedicated host `family`. + // - Have the same `vcpu.architecture`. + // - Support the number of network interfaces currently attached to the instance. + Profile InstancePatchProfileIntf `json:"profile,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` +} + +// UnmarshalInstancePatch unmarshals an instance of InstancePatch from the specified map of raw messages. +func UnmarshalInstancePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatch) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstancePatchProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstancePatch +func (instancePatch *InstancePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instancePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// InstancePatchProfile : The profile to use for this virtual server instance. For the profile to be changed, the instance `status` must be +// `stopping` or `stopped`. In addition, the requested profile must: +// - Have matching instance disk support. Any disks associated with the current profile +// will be deleted, and any disks associated with the requested profile will be +// created. +// - Be compatible with any `placement_target` constraints. For example, if the +// instance is placed on a dedicated host, the requested profile `family` must be +// the same as the dedicated host `family`. +// - Have the same `vcpu.architecture`. +// - Support the number of network interfaces currently attached to the instance. +// +// Models which "extend" this model: +// - InstancePatchProfileInstanceProfileIdentityByName +// - InstancePatchProfileInstanceProfileIdentityByHref +type InstancePatchProfile struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name,omitempty"` + + // The URL for this virtual server instance profile. + Href *string `json:"href,omitempty"` +} + +func (*InstancePatchProfile) isaInstancePatchProfile() bool { + return true +} + +type InstancePatchProfileIntf interface { + isaInstancePatchProfile() bool +} + +// UnmarshalInstancePatchProfile unmarshals an instance of InstancePatchProfile from the specified map of raw messages. +func UnmarshalInstancePatchProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatchProfile) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTarget : InstancePlacementTarget struct +// Models which "extend" this model: +// - InstancePlacementTargetDedicatedHostGroupReference +// - InstancePlacementTargetDedicatedHostReference +// - InstancePlacementTargetPlacementGroupReference +type InstancePlacementTarget struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href,omitempty"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id,omitempty"` + + // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the InstancePlacementTarget.ResourceType property. +// The resource type. +const ( + InstancePlacementTargetResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +func (*InstancePlacementTarget) isaInstancePlacementTarget() bool { + return true +} + +type InstancePlacementTargetIntf interface { + isaInstancePlacementTarget() bool +} + +// UnmarshalInstancePlacementTarget unmarshals an instance of InstancePlacementTarget from the specified map of raw messages. +func UnmarshalInstancePlacementTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatch : InstancePlacementTargetPatch struct +// Models which "extend" this model: +// - InstancePlacementTargetPatchDedicatedHostIdentity +// - InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatch struct { + // The unique identifier for this dedicated host. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPatch) isaInstancePlacementTargetPatch() bool { + return true +} + +type InstancePlacementTargetPatchIntf interface { + isaInstancePlacementTargetPatch() bool +} + +// UnmarshalInstancePlacementTargetPatch unmarshals an instance of InstancePlacementTargetPatch from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototype : InstancePlacementTargetPrototype struct +// Models which "extend" this model: +// - InstancePlacementTargetPrototypeDedicatedHostIdentity +// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +// - InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototype struct { + // The unique identifier for this dedicated host. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPrototype) isaInstancePlacementTargetPrototype() bool { + return true +} + +type InstancePlacementTargetPrototypeIntf interface { + isaInstancePlacementTargetPrototype() bool +} + +// UnmarshalInstancePlacementTargetPrototype unmarshals an instance of InstancePlacementTargetPrototype from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfile : InstanceProfile struct +type InstanceProfile struct { + Bandwidth InstanceProfileBandwidthIntf `json:"bandwidth" validate:"required"` + + // Collection of the instance profile's disks. + Disks []InstanceProfileDisk `json:"disks" validate:"required"` + + // The product family this virtual server instance profile belongs to. + Family *string `json:"family" validate:"required"` + + GpuCount InstanceProfileGpuIntf `json:"gpu_count,omitempty"` + + GpuManufacturer *InstanceProfileGpuManufacturer `json:"gpu_manufacturer,omitempty"` + + GpuMemory InstanceProfileGpuMemoryIntf `json:"gpu_memory,omitempty"` + + GpuModel *InstanceProfileGpuModel `json:"gpu_model,omitempty"` + + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` + + Memory InstanceProfileMemoryIntf `json:"memory" validate:"required"` + + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` + + NetworkAttachmentCount InstanceProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"` + + NetworkInterfaceCount InstanceProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` + + OsArchitecture *InstanceProfileOsArchitecture `json:"os_architecture" validate:"required"` + + PortSpeed InstanceProfilePortSpeedIntf `json:"port_speed" validate:"required"` + + TotalVolumeBandwidth InstanceProfileVolumeBandwidthIntf `json:"total_volume_bandwidth" validate:"required"` + + VcpuArchitecture *InstanceProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` + + VcpuCount InstanceProfileVcpuIntf `json:"vcpu_count" validate:"required"` + + VcpuManufacturer *InstanceProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"` +} + +// UnmarshalInstanceProfile unmarshals an instance of InstanceProfile from the specified map of raw messages. +func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfile) + err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalInstanceProfileBandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu_count", &obj.GpuCount, UnmarshalInstanceProfileGpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu_manufacturer", &obj.GpuManufacturer, UnmarshalInstanceProfileGpuManufacturer) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu_memory", &obj.GpuMemory, UnmarshalInstanceProfileGpuMemory) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu_model", &obj.GpuModel, UnmarshalInstanceProfileGpuModel) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalInstanceProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalInstanceProfileNetworkAttachmentCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalInstanceProfileNetworkInterfaceCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalInstanceProfileOsArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "port_speed", &obj.PortSpeed, UnmarshalInstanceProfilePortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth, UnmarshalInstanceProfileVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalInstanceProfileVcpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalInstanceProfileVcpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalInstanceProfileVcpuManufacturer) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidth : InstanceProfileBandwidth struct +// Models which "extend" this model: +// - InstanceProfileBandwidthFixed +// - InstanceProfileBandwidthRange +// - InstanceProfileBandwidthEnum +// - InstanceProfileBandwidthDependent +type InstanceProfileBandwidth struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the InstanceProfileBandwidth.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthTypeFixedConst = "fixed" +) + +func (*InstanceProfileBandwidth) isaInstanceProfileBandwidth() bool { + return true +} + +type InstanceProfileBandwidthIntf interface { + isaInstanceProfileBandwidth() bool +} + +// UnmarshalInstanceProfileBandwidth unmarshals an instance of InstanceProfileBandwidth from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidth) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileCollection : InstanceProfileCollection struct +type InstanceProfileCollection struct { + // Collection of virtual server instance profiles. + Profiles []InstanceProfile `json:"profiles" validate:"required"` +} + +// UnmarshalInstanceProfileCollection unmarshals an instance of InstanceProfileCollection from the specified map of raw messages. +func UnmarshalInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileCollection) + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalInstanceProfile) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDisk : Disks provided by this profile. +type InstanceProfileDisk struct { + Quantity InstanceProfileDiskQuantityIntf `json:"quantity" validate:"required"` + + Size InstanceProfileDiskSizeIntf `json:"size" validate:"required"` + + SupportedInterfaceTypes *InstanceProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` +} + +// UnmarshalInstanceProfileDisk unmarshals an instance of InstanceProfileDisk from the specified map of raw messages. +func UnmarshalInstanceProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDisk) + err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalInstanceProfileDiskQuantity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalInstanceProfileDiskSize) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalInstanceProfileDiskSupportedInterfaces) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantity : InstanceProfileDiskQuantity struct +// Models which "extend" this model: +// - InstanceProfileDiskQuantityFixed +// - InstanceProfileDiskQuantityRange +// - InstanceProfileDiskQuantityEnum +// - InstanceProfileDiskQuantityDependent +type InstanceProfileDiskQuantity struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the InstanceProfileDiskQuantity.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskQuantity) isaInstanceProfileDiskQuantity() bool { + return true +} + +type InstanceProfileDiskQuantityIntf interface { + isaInstanceProfileDiskQuantity() bool +} + +// UnmarshalInstanceProfileDiskQuantity unmarshals an instance of InstanceProfileDiskQuantity from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSize : InstanceProfileDiskSize struct +// Models which "extend" this model: +// - InstanceProfileDiskSizeFixed +// - InstanceProfileDiskSizeRange +// - InstanceProfileDiskSizeEnum +// - InstanceProfileDiskSizeDependent +type InstanceProfileDiskSize struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the InstanceProfileDiskSize.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskSize) isaInstanceProfileDiskSize() bool { + return true +} + +type InstanceProfileDiskSizeIntf interface { + isaInstanceProfileDiskSize() bool +} + +// UnmarshalInstanceProfileDiskSize unmarshals an instance of InstanceProfileDiskSize from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSize) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSupportedInterfaces : InstanceProfileDiskSupportedInterfaces struct +type InstanceProfileDiskSupportedInterfaces struct { + // The disk interface used for attaching the disk. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Default *string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported disk interfaces used for attaching the disk. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSupportedInterfaces.Default property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + InstanceProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" + InstanceProfileDiskSupportedInterfacesDefaultVirtioBlkConst = "virtio_blk" +) + +// Constants associated with the InstanceProfileDiskSupportedInterfaces.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSupportedInterfacesTypeEnumConst = "enum" +) + +// Constants associated with the InstanceProfileDiskSupportedInterfaces.Values property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + InstanceProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" + InstanceProfileDiskSupportedInterfacesValuesVirtioBlkConst = "virtio_blk" +) + +// UnmarshalInstanceProfileDiskSupportedInterfaces unmarshals an instance of InstanceProfileDiskSupportedInterfaces from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpu : InstanceProfileGpu struct +// Models which "extend" this model: +// - InstanceProfileGpuFixed +// - InstanceProfileGpuRange +// - InstanceProfileGpuEnum +// - InstanceProfileGpuDependent +type InstanceProfileGpu struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the InstanceProfileGpu.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuTypeFixedConst = "fixed" +) + +func (*InstanceProfileGpu) isaInstanceProfileGpu() bool { + return true +} + +type InstanceProfileGpuIntf interface { + isaInstanceProfileGpu() bool +} + +// UnmarshalInstanceProfileGpu unmarshals an instance of InstanceProfileGpu from the specified map of raw messages. +func UnmarshalInstanceProfileGpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpu) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuManufacturer : InstanceProfileGpuManufacturer struct +type InstanceProfileGpuManufacturer struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The possible GPU manufacturer(s) for an instance with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuManufacturer.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuManufacturerTypeEnumConst = "enum" +) + +// UnmarshalInstanceProfileGpuManufacturer unmarshals an instance of InstanceProfileGpuManufacturer from the specified map of raw messages. +func UnmarshalInstanceProfileGpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuManufacturer) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemory : InstanceProfileGpuMemory struct +// Models which "extend" this model: +// - InstanceProfileGpuMemoryFixed +// - InstanceProfileGpuMemoryRange +// - InstanceProfileGpuMemoryEnum +// - InstanceProfileGpuMemoryDependent +type InstanceProfileGpuMemory struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the InstanceProfileGpuMemory.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryTypeFixedConst = "fixed" +) + +func (*InstanceProfileGpuMemory) isaInstanceProfileGpuMemory() bool { + return true +} + +type InstanceProfileGpuMemoryIntf interface { + isaInstanceProfileGpuMemory() bool +} + +// UnmarshalInstanceProfileGpuMemory unmarshals an instance of InstanceProfileGpuMemory from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuModel : InstanceProfileGpuModel struct +type InstanceProfileGpuModel struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The possible GPU model(s) for an instance with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuModel.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuModelTypeEnumConst = "enum" +) + +// UnmarshalInstanceProfileGpuModel unmarshals an instance of InstanceProfileGpuModel from the specified map of raw messages. +func UnmarshalInstanceProfileGpuModel(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuModel) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileIdentity : Identifies an instance profile by a unique property. +// Models which "extend" this model: +// - InstanceProfileIdentityByName +// - InstanceProfileIdentityByHref +type InstanceProfileIdentity struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name,omitempty"` + + // The URL for this virtual server instance profile. + Href *string `json:"href,omitempty"` +} + +func (*InstanceProfileIdentity) isaInstanceProfileIdentity() bool { + return true +} + +type InstanceProfileIdentityIntf interface { + isaInstanceProfileIdentity() bool +} + +// UnmarshalInstanceProfileIdentity unmarshals an instance of InstanceProfileIdentity from the specified map of raw messages. +func UnmarshalInstanceProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemory : InstanceProfileMemory struct +// Models which "extend" this model: +// - InstanceProfileMemoryFixed +// - InstanceProfileMemoryRange +// - InstanceProfileMemoryEnum +// - InstanceProfileMemoryDependent +type InstanceProfileMemory struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the InstanceProfileMemory.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryTypeFixedConst = "fixed" +) + +func (*InstanceProfileMemory) isaInstanceProfileMemory() bool { + return true +} + +type InstanceProfileMemoryIntf interface { + isaInstanceProfileMemory() bool +} + +// UnmarshalInstanceProfileMemory unmarshals an instance of InstanceProfileMemory from the specified map of raw messages. +func UnmarshalInstanceProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkAttachmentCount : InstanceProfileNetworkAttachmentCount struct +// Models which "extend" this model: +// - InstanceProfileNetworkAttachmentCountRange +// - InstanceProfileNetworkAttachmentCountDependent +type InstanceProfileNetworkAttachmentCount struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` +} + +// Constants associated with the InstanceProfileNetworkAttachmentCount.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkAttachmentCountTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkAttachmentCount) isaInstanceProfileNetworkAttachmentCount() bool { + return true +} + +type InstanceProfileNetworkAttachmentCountIntf interface { + isaInstanceProfileNetworkAttachmentCount() bool +} + +// UnmarshalInstanceProfileNetworkAttachmentCount unmarshals an instance of InstanceProfileNetworkAttachmentCount from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkAttachmentCount) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkInterfaceCount : InstanceProfileNetworkInterfaceCount struct +// Models which "extend" this model: +// - InstanceProfileNetworkInterfaceCountRange +// - InstanceProfileNetworkInterfaceCountDependent +type InstanceProfileNetworkInterfaceCount struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` +} + +// Constants associated with the InstanceProfileNetworkInterfaceCount.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkInterfaceCountTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkInterfaceCount) isaInstanceProfileNetworkInterfaceCount() bool { + return true +} + +type InstanceProfileNetworkInterfaceCountIntf interface { + isaInstanceProfileNetworkInterfaceCount() bool +} + +// UnmarshalInstanceProfileNetworkInterfaceCount unmarshals an instance of InstanceProfileNetworkInterfaceCount from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkInterfaceCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkInterfaceCount) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileOsArchitecture : InstanceProfileOsArchitecture struct +type InstanceProfileOsArchitecture struct { + // The default OS architecture for an instance with this profile. + Default *string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported OS architecture(s) for an instance with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileOsArchitecture.Type property. +// The type for this profile field. +const ( + InstanceProfileOsArchitectureTypeEnumConst = "enum" +) + +// UnmarshalInstanceProfileOsArchitecture unmarshals an instance of InstanceProfileOsArchitecture from the specified map of raw messages. +func UnmarshalInstanceProfileOsArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileOsArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfilePortSpeed : InstanceProfilePortSpeed struct +// Models which "extend" this model: +// - InstanceProfilePortSpeedFixed +// - InstanceProfilePortSpeedDependent +type InstanceProfilePortSpeed struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` +} + +// Constants associated with the InstanceProfilePortSpeed.Type property. +// The type for this profile field. +const ( + InstanceProfilePortSpeedTypeFixedConst = "fixed" +) + +func (*InstanceProfilePortSpeed) isaInstanceProfilePortSpeed() bool { + return true +} + +type InstanceProfilePortSpeedIntf interface { + isaInstanceProfilePortSpeed() bool +} + +// UnmarshalInstanceProfilePortSpeed unmarshals an instance of InstanceProfilePortSpeed from the specified map of raw messages. +func UnmarshalInstanceProfilePortSpeed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfilePortSpeed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileReference : InstanceProfileReference struct +type InstanceProfileReference struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceProfileReference unmarshals an instance of InstanceProfileReference from the specified map of raw messages. +func UnmarshalInstanceProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpu : InstanceProfileVcpu struct +// Models which "extend" this model: +// - InstanceProfileVcpuFixed +// - InstanceProfileVcpuRange +// - InstanceProfileVcpuEnum +// - InstanceProfileVcpuDependent +type InstanceProfileVcpu struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the InstanceProfileVcpu.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuTypeFixedConst = "fixed" +) + +func (*InstanceProfileVcpu) isaInstanceProfileVcpu() bool { + return true +} + +type InstanceProfileVcpuIntf interface { + isaInstanceProfileVcpu() bool +} + +// UnmarshalInstanceProfileVcpu unmarshals an instance of InstanceProfileVcpu from the specified map of raw messages. +func UnmarshalInstanceProfileVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpu) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuArchitecture : InstanceProfileVcpuArchitecture struct +type InstanceProfileVcpuArchitecture struct { + // The default VCPU architecture for an instance with this profile. + Default *string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU architecture for an instance with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuArchitecture.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuArchitectureTypeFixedConst = "fixed" +) + +// UnmarshalInstanceProfileVcpuArchitecture unmarshals an instance of InstanceProfileVcpuArchitecture from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuManufacturer : InstanceProfileVcpuManufacturer struct +type InstanceProfileVcpuManufacturer struct { + // The default VCPU manufacturer for an instance with this profile. + Default *string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU manufacturer for an instance with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuManufacturer.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuManufacturerTypeFixedConst = "fixed" +) + +// UnmarshalInstanceProfileVcpuManufacturer unmarshals an instance of InstanceProfileVcpuManufacturer from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuManufacturer) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidth : InstanceProfileVolumeBandwidth struct +// Models which "extend" this model: +// - InstanceProfileVolumeBandwidthFixed +// - InstanceProfileVolumeBandwidthRange +// - InstanceProfileVolumeBandwidthEnum +// - InstanceProfileVolumeBandwidthDependent +type InstanceProfileVolumeBandwidth struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the InstanceProfileVolumeBandwidth.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthTypeFixedConst = "fixed" +) + +func (*InstanceProfileVolumeBandwidth) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +type InstanceProfileVolumeBandwidthIntf interface { + isaInstanceProfileVolumeBandwidth() bool +} + +// UnmarshalInstanceProfileVolumeBandwidth unmarshals an instance of InstanceProfileVolumeBandwidth from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidth) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototype : InstancePrototype struct +// Models which "extend" this model: +// - InstancePrototypeInstanceByImage +// - InstancePrototypeInstanceByCatalogOffering +// - InstancePrototypeInstanceByVolume +// - InstancePrototypeInstanceBySourceSnapshot +// - InstancePrototypeInstanceBySourceTemplate +type InstancePrototype struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not + // subsequently managed. Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + // property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The metadata service configuration. + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this + // virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change + // in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance's network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *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 network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` +} + +func (*InstancePrototype) isaInstancePrototype() bool { + return true +} + +type InstancePrototypeIntf interface { + isaInstancePrototype() bool +} + +// UnmarshalInstancePrototype unmarshals an instance of InstancePrototype from the specified map of raw messages. +func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceReference : InstanceReference struct +type InstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceReference unmarshals an instance of InstanceReference from the specified map of raw messages. +func UnmarshalInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceReferenceDeleted unmarshals an instance of InstanceReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceStatusReason : InstanceStatusReason struct +type InstanceStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` + + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the InstanceStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + InstanceStatusReasonCodeCannotStartConst = "cannot_start" + InstanceStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" + InstanceStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" + InstanceStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" + InstanceStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" + InstanceStatusReasonCodeCannotStartPlacementGroupConst = "cannot_start_placement_group" + InstanceStatusReasonCodeCannotStartStorageConst = "cannot_start_storage" + InstanceStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" + InstanceStatusReasonCodeStoppedByHostFailureConst = "stopped_by_host_failure" + InstanceStatusReasonCodeStoppedForImageCreationConst = "stopped_for_image_creation" +) + +// UnmarshalInstanceStatusReason unmarshals an instance of InstanceStatusReason from the specified map of raw messages. +func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplate : InstanceTemplate struct +// Models which "extend" this model: +// - InstanceTemplateInstanceByImage +// - InstanceTemplateInstanceBySourceSnapshot +// - InstanceTemplateInstanceByCatalogOffering +type InstanceTemplate struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not + // subsequently managed. Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + // property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The metadata service configuration. + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this + // virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change + // in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance's 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 network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` +} + +func (*InstanceTemplate) isaInstanceTemplate() bool { + return true +} + +type InstanceTemplateIntf interface { + isaInstanceTemplate() bool +} + +// UnmarshalInstanceTemplate unmarshals an instance of InstanceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplate) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateCollection : InstanceTemplateCollection struct +type InstanceTemplateCollection struct { + // A link to the first page of resources. + First *InstanceTemplateCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceTemplateCollectionNext `json:"next,omitempty"` + + // Collection of instance templates. + Templates []InstanceTemplateIntf `json:"templates" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceTemplateCollection unmarshals an instance of InstanceTemplateCollection from the specified map of raw messages. +func UnmarshalInstanceTemplateCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceTemplateCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceTemplateCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "templates", &obj.Templates, UnmarshalInstanceTemplate) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateCollectionFirst : A link to the first page of resources. +type InstanceTemplateCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceTemplateCollectionFirst unmarshals an instance of InstanceTemplateCollectionFirst from the specified map of raw messages. +func UnmarshalInstanceTemplateCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type InstanceTemplateCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceTemplateCollectionNext unmarshals an instance of InstanceTemplateCollectionNext from the specified map of raw messages. +func UnmarshalInstanceTemplateCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentity : Identifies an instance template by a unique property. +// Models which "extend" this model: +// - InstanceTemplateIdentityByID +// - InstanceTemplateIdentityByHref +// - InstanceTemplateIdentityByCRN +type InstanceTemplateIdentity struct { + // The unique identifier for this instance template. + ID *string `json:"id,omitempty"` + + // The URL for this instance template. + Href *string `json:"href,omitempty"` + + // The CRN for this instance template. + CRN *string `json:"crn,omitempty"` +} + +func (*InstanceTemplateIdentity) isaInstanceTemplateIdentity() bool { + return true +} + +type InstanceTemplateIdentityIntf interface { + isaInstanceTemplateIdentity() bool +} + +// UnmarshalInstanceTemplateIdentity unmarshals an instance of InstanceTemplateIdentity from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePatch : InstanceTemplatePatch struct +type InstanceTemplatePatch struct { + // The name for this instance template. The name must not be used by another instance template in the region. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceTemplatePatch unmarshals an instance of InstanceTemplatePatch from the specified map of raw messages. +func UnmarshalInstanceTemplatePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceTemplatePatch +func (instanceTemplatePatch *InstanceTemplatePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceTemplatePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// InstanceTemplatePrototype : InstanceTemplatePrototype struct +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateByImage +// - InstanceTemplatePrototypeInstanceTemplateBySourceTemplate +// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot +// - InstanceTemplatePrototypeInstanceTemplateByCatalogOffering +type InstanceTemplatePrototype struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not + // subsequently managed. Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + // property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The metadata service configuration. + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this + // virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change + // in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance's network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *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 network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version to use when provisioning this virtual server instance. + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account, subject to + // IAM policies. + // + // If specified, `image` must not be specified, and `source_template` must not have + // `image` specified. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` +} + +func (*InstanceTemplatePrototype) isaInstanceTemplatePrototype() bool { + return true +} + +type InstanceTemplatePrototypeIntf interface { + isaInstanceTemplatePrototype() bool +} + +// UnmarshalInstanceTemplatePrototype unmarshals an instance of InstanceTemplatePrototype from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateReference : InstanceTemplateReference struct +type InstanceTemplateReference struct { + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceTemplateReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceTemplateReference unmarshals an instance of InstanceTemplateReference from the specified map of raw messages. +func UnmarshalInstanceTemplateReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceTemplateReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceTemplateReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceTemplateReferenceDeleted unmarshals an instance of InstanceTemplateReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceTemplateReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceVcpu : The virtual server instance VCPU configuration. +type InstanceVcpu struct { + // The VCPU architecture. + Architecture *string `json:"architecture" validate:"required"` + + // The number of VCPUs assigned. + Count *int64 `json:"count" validate:"required"` + + // The VCPU manufacturer. + Manufacturer *string `json:"manufacturer" validate:"required"` +} + +// UnmarshalInstanceVcpu unmarshals an instance of InstanceVcpu from the specified map of raw messages. +func UnmarshalInstanceVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceVcpu) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Key : Key struct +type Key struct { + // The date and time that the key was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this key. + CRN *string `json:"crn" validate:"required"` + + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` + + // The URL for this key. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this key. + ID *string `json:"id" validate:"required"` + + // The length of this key (in bits). + Length *int64 `json:"length" validate:"required"` + + // The name for this key. The name must not be used by another key in the region. If unspecified, the name will be a + // hyphenated list of randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The public SSH key, consisting of two space-separated fields: the algorithm name, and the base64-encoded key. + PublicKey *string `json:"public_key" validate:"required"` + + // The resource group for this key. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The crypto-system used by this key. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the Key.Type property. +// The crypto-system used by this key. +const ( + KeyTypeEd25519Const = "ed25519" + KeyTypeRsaConst = "rsa" +) + +// UnmarshalKey unmarshals an instance of Key from the specified map of raw messages. +func UnmarshalKey(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Key) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "length", &obj.Length) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "public_key", &obj.PublicKey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyCollection : KeyCollection struct +type KeyCollection struct { + // A link to the first page of resources. + First *KeyCollectionFirst `json:"first" validate:"required"` + + // Collection of keys. + Keys []Key `json:"keys" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *KeyCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalKeyCollection unmarshals an instance of KeyCollection from the specified map of raw messages. +func UnmarshalKeyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalKeyCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalKeyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *KeyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// KeyCollectionFirst : A link to the first page of resources. +type KeyCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalKeyCollectionFirst unmarshals an instance of KeyCollectionFirst from the specified map of raw messages. +func UnmarshalKeyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type KeyCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalKeyCollectionNext unmarshals an instance of KeyCollectionNext from the specified map of raw messages. +func UnmarshalKeyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentity : Identifies a key by a unique property. +// Models which "extend" this model: +// - KeyIdentityByID +// - KeyIdentityByCRN +// - KeyIdentityByHref +// - KeyIdentityByFingerprint +type KeyIdentity struct { + // The unique identifier for this key. + ID *string `json:"id,omitempty"` + + // The CRN for this key. + CRN *string `json:"crn,omitempty"` + + // The URL for this key. + Href *string `json:"href,omitempty"` + + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint,omitempty"` +} + +func (*KeyIdentity) isaKeyIdentity() bool { + return true +} + +type KeyIdentityIntf interface { + isaKeyIdentity() bool +} + +// UnmarshalKeyIdentity unmarshals an instance of KeyIdentity from the specified map of raw messages. +func UnmarshalKeyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyPatch : KeyPatch struct +type KeyPatch struct { + // The name for this key. The name must not be used by another key in the region. + Name *string `json:"name,omitempty"` +} + +// UnmarshalKeyPatch unmarshals an instance of KeyPatch from the specified map of raw messages. +func UnmarshalKeyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the KeyPatch +func (keyPatch *KeyPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(keyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// KeyReference : KeyReference struct +type KeyReference struct { + // The CRN for this key. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *KeyReferenceDeleted `json:"deleted,omitempty"` + + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` + + // The URL for this key. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this key. + ID *string `json:"id" validate:"required"` + + // The name for this key. The name is unique across all keys in the region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalKeyReference unmarshals an instance of KeyReference from the specified map of raw messages. +func UnmarshalKeyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalKeyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type KeyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalKeyReferenceDeleted unmarshals an instance of KeyReferenceDeleted from the specified map of raw messages. +func UnmarshalKeyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LegacyCloudObjectStorageBucketIdentity : Identifies a Cloud Object Storage bucket by a unique property. +// Models which "extend" this model: +// - LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName +type LegacyCloudObjectStorageBucketIdentity struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name,omitempty"` +} + +func (*LegacyCloudObjectStorageBucketIdentity) isaLegacyCloudObjectStorageBucketIdentity() bool { + return true +} + +type LegacyCloudObjectStorageBucketIdentityIntf interface { + isaLegacyCloudObjectStorageBucketIdentity() bool +} + +// UnmarshalLegacyCloudObjectStorageBucketIdentity unmarshals an instance of LegacyCloudObjectStorageBucketIdentity from the specified map of raw messages. +func UnmarshalLegacyCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LegacyCloudObjectStorageBucketIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LegacyCloudObjectStorageBucketReference : LegacyCloudObjectStorageBucketReference struct +type LegacyCloudObjectStorageBucketReference struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalLegacyCloudObjectStorageBucketReference unmarshals an instance of LegacyCloudObjectStorageBucketReference from the specified map of raw messages. +func UnmarshalLegacyCloudObjectStorageBucketReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LegacyCloudObjectStorageBucketReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ListBackupPoliciesOptions : The ListBackupPolicies options. +type ListBackupPoliciesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to resources with an item in the `tags` property matching the exact specified tag. + Tag *string `json:"tag,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBackupPoliciesOptions : Instantiate ListBackupPoliciesOptions +func (*VpcV1) NewListBackupPoliciesOptions() *ListBackupPoliciesOptions { + return &ListBackupPoliciesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListBackupPoliciesOptions) SetStart(start string) *ListBackupPoliciesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBackupPoliciesOptions) SetLimit(limit int64) *ListBackupPoliciesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListBackupPoliciesOptions) SetResourceGroupID(resourceGroupID string) *ListBackupPoliciesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListBackupPoliciesOptions) SetName(name string) *ListBackupPoliciesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetTag : Allow user to set Tag +func (_options *ListBackupPoliciesOptions) SetTag(tag string) *ListBackupPoliciesOptions { + _options.Tag = core.StringPtr(tag) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBackupPoliciesOptions) SetHeaders(param map[string]string) *ListBackupPoliciesOptions { + options.Headers = param + return options +} + +// ListBackupPolicyJobsOptions : The ListBackupPolicyJobs options. +type ListBackupPolicyJobsOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // Filters the collection to backup policy jobs with a `status` property matching the specified value. + Status *string `json:"status,omitempty"` + + // Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified + // identifier. + BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Filters the collection to backup policy jobs with a `source.id` property matching the specified identifier. + SourceID *string `json:"source.id,omitempty"` + + // Filters the collection to backup policy jobs with an item in the `target_snapshots` property with an `id` property + // matching the specified identifier. + TargetSnapshotsID *string `json:"target_snapshots[].id,omitempty"` + + // Filters the collection to backup policy jobs with an item in the `target_snapshots` property with a `crn` property + // matching the specified CRN. + TargetSnapshotsCRN *string `json:"target_snapshots[].crn,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListBackupPolicyJobsOptions.Status property. +// Filters the collection to backup policy jobs with a `status` property matching the specified value. +const ( + ListBackupPolicyJobsOptionsStatusFailedConst = "failed" + ListBackupPolicyJobsOptionsStatusRunningConst = "running" + ListBackupPolicyJobsOptionsStatusSucceededConst = "succeeded" +) + +// Constants associated with the ListBackupPolicyJobsOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListBackupPolicyJobsOptionsSortCreatedAtConst = "created_at" + ListBackupPolicyJobsOptionsSortNameConst = "name" +) + +// NewListBackupPolicyJobsOptions : Instantiate ListBackupPolicyJobsOptions +func (*VpcV1) NewListBackupPolicyJobsOptions(backupPolicyID string) *ListBackupPolicyJobsOptions { + return &ListBackupPolicyJobsOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *ListBackupPolicyJobsOptions) SetBackupPolicyID(backupPolicyID string) *ListBackupPolicyJobsOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetStatus : Allow user to set Status +func (_options *ListBackupPolicyJobsOptions) SetStatus(status string) *ListBackupPolicyJobsOptions { + _options.Status = core.StringPtr(status) + return _options +} + +// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID +func (_options *ListBackupPolicyJobsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListBackupPolicyJobsOptions { + _options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListBackupPolicyJobsOptions) SetStart(start string) *ListBackupPolicyJobsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBackupPolicyJobsOptions) SetLimit(limit int64) *ListBackupPolicyJobsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListBackupPolicyJobsOptions) SetSort(sort string) *ListBackupPolicyJobsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetSourceID : Allow user to set SourceID +func (_options *ListBackupPolicyJobsOptions) SetSourceID(sourceID string) *ListBackupPolicyJobsOptions { + _options.SourceID = core.StringPtr(sourceID) + return _options +} + +// SetTargetSnapshotsID : Allow user to set TargetSnapshotsID +func (_options *ListBackupPolicyJobsOptions) SetTargetSnapshotsID(targetSnapshotsID string) *ListBackupPolicyJobsOptions { + _options.TargetSnapshotsID = core.StringPtr(targetSnapshotsID) + return _options +} + +// SetTargetSnapshotsCRN : Allow user to set TargetSnapshotsCRN +func (_options *ListBackupPolicyJobsOptions) SetTargetSnapshotsCRN(targetSnapshotsCRN string) *ListBackupPolicyJobsOptions { + _options.TargetSnapshotsCRN = core.StringPtr(targetSnapshotsCRN) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBackupPolicyJobsOptions) SetHeaders(param map[string]string) *ListBackupPolicyJobsOptions { + options.Headers = param + return options +} + +// ListBackupPolicyPlansOptions : The ListBackupPolicyPlans options. +type ListBackupPolicyPlansOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBackupPolicyPlansOptions : Instantiate ListBackupPolicyPlansOptions +func (*VpcV1) NewListBackupPolicyPlansOptions(backupPolicyID string) *ListBackupPolicyPlansOptions { + return &ListBackupPolicyPlansOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *ListBackupPolicyPlansOptions) SetBackupPolicyID(backupPolicyID string) *ListBackupPolicyPlansOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListBackupPolicyPlansOptions) SetName(name string) *ListBackupPolicyPlansOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBackupPolicyPlansOptions) SetHeaders(param map[string]string) *ListBackupPolicyPlansOptions { + options.Headers = param + return options +} + +// ListBareMetalServerDisksOptions : The ListBareMetalServerDisks options. +type ListBareMetalServerDisksOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBareMetalServerDisksOptions : Instantiate ListBareMetalServerDisksOptions +func (*VpcV1) NewListBareMetalServerDisksOptions(bareMetalServerID string) *ListBareMetalServerDisksOptions { + return &ListBareMetalServerDisksOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerDisksOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerDisksOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerDisksOptions) SetHeaders(param map[string]string) *ListBareMetalServerDisksOptions { + options.Headers = param + return options +} + +// ListBareMetalServerNetworkAttachmentsOptions : The ListBareMetalServerNetworkAttachments options. +type ListBareMetalServerNetworkAttachmentsOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBareMetalServerNetworkAttachmentsOptions : Instantiate ListBareMetalServerNetworkAttachmentsOptions +func (*VpcV1) NewListBareMetalServerNetworkAttachmentsOptions(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions { + return &ListBareMetalServerNetworkAttachmentsOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetStart(start string) *ListBareMetalServerNetworkAttachmentsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetLimit(limit int64) *ListBareMetalServerNetworkAttachmentsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkAttachmentsOptions { + options.Headers = param + return options +} + +// ListBareMetalServerNetworkInterfaceFloatingIpsOptions : The ListBareMetalServerNetworkInterfaceFloatingIps options. +type ListBareMetalServerNetworkInterfaceFloatingIpsOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The 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 network interface identifier. + NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBareMetalServerNetworkInterfaceIpsOptions : Instantiate ListBareMetalServerNetworkInterfaceIpsOptions +func (*VpcV1) NewListBareMetalServerNetworkInterfaceIpsOptions(bareMetalServerID string, networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions { + return &ListBareMetalServerNetworkInterfaceIpsOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfaceIpsOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfaceIpsOptions { + options.Headers = param + return options +} + +// ListBareMetalServerNetworkInterfacesOptions : The ListBareMetalServerNetworkInterfaces options. +type ListBareMetalServerNetworkInterfacesOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBareMetalServerNetworkInterfacesOptions : Instantiate ListBareMetalServerNetworkInterfacesOptions +func (*VpcV1) NewListBareMetalServerNetworkInterfacesOptions(bareMetalServerID string) *ListBareMetalServerNetworkInterfacesOptions { + return &ListBareMetalServerNetworkInterfacesOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerNetworkInterfacesOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfacesOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListBareMetalServerNetworkInterfacesOptions) SetStart(start string) *ListBareMetalServerNetworkInterfacesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBareMetalServerNetworkInterfacesOptions) SetLimit(limit int64) *ListBareMetalServerNetworkInterfacesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfacesOptions { + options.Headers = param + return options +} + +// ListBareMetalServerProfilesOptions : The ListBareMetalServerProfiles options. +type ListBareMetalServerProfilesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBareMetalServerProfilesOptions : Instantiate ListBareMetalServerProfilesOptions +func (*VpcV1) NewListBareMetalServerProfilesOptions() *ListBareMetalServerProfilesOptions { + return &ListBareMetalServerProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListBareMetalServerProfilesOptions) SetStart(start string) *ListBareMetalServerProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBareMetalServerProfilesOptions) SetLimit(limit int64) *ListBareMetalServerProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerProfilesOptions) SetHeaders(param map[string]string) *ListBareMetalServerProfilesOptions { + options.Headers = param + return options +} + +// ListBareMetalServersOptions : The ListBareMetalServers options. +type ListBareMetalServersOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.id` + // property matching the specified identifier. + NetworkInterfacesSubnetID *string `json:"network_interfaces.subnet.id,omitempty"` + + // Filters the collection to resources with an item in the `network_attachments` property with a `subnet.id` property + // matching the specified identifier. + NetworkAttachmentsSubnetID *string `json:"network_attachments[].subnet.id,omitempty"` + + // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.crn` + // property matching the specified CRN. + NetworkInterfacesSubnetCRN *string `json:"network_interfaces.subnet.crn,omitempty"` + + // Filters the collection to resources with an item in the `network_attachments` property with a `subnet.crn` property + // matching the specified CRN. + NetworkAttachmentsSubnetCRN *string `json:"network_attachments[].subnet.crn,omitempty"` + + // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.name` + // property matching the exact specified name. + NetworkInterfacesSubnetName *string `json:"network_interfaces.subnet.name,omitempty"` + + // Filters the collection to resources with an item in the `network_attachments` property with a `subnet.name` property + // matching the exact specified name. + NetworkAttachmentsSubnetName *string `json:"network_attachments[].subnet.name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBareMetalServersOptions : Instantiate ListBareMetalServersOptions +func (*VpcV1) NewListBareMetalServersOptions() *ListBareMetalServersOptions { + return &ListBareMetalServersOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListBareMetalServersOptions) SetStart(start string) *ListBareMetalServersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBareMetalServersOptions) SetLimit(limit int64) *ListBareMetalServersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListBareMetalServersOptions) SetResourceGroupID(resourceGroupID string) *ListBareMetalServersOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListBareMetalServersOptions) SetName(name string) *ListBareMetalServersOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListBareMetalServersOptions) SetVPCID(vpcID string) *ListBareMetalServersOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListBareMetalServersOptions) SetVPCCRN(vpcCRN string) *ListBareMetalServersOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListBareMetalServersOptions) SetVPCName(vpcName string) *ListBareMetalServersOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetNetworkInterfacesSubnetID : Allow user to set NetworkInterfacesSubnetID +func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetID(networkInterfacesSubnetID string) *ListBareMetalServersOptions { + _options.NetworkInterfacesSubnetID = core.StringPtr(networkInterfacesSubnetID) + return _options +} + +// SetNetworkAttachmentsSubnetID : Allow user to set NetworkAttachmentsSubnetID +func (_options *ListBareMetalServersOptions) SetNetworkAttachmentsSubnetID(networkAttachmentsSubnetID string) *ListBareMetalServersOptions { + _options.NetworkAttachmentsSubnetID = core.StringPtr(networkAttachmentsSubnetID) + return _options +} + +// SetNetworkInterfacesSubnetCRN : Allow user to set NetworkInterfacesSubnetCRN +func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetCRN(networkInterfacesSubnetCRN string) *ListBareMetalServersOptions { + _options.NetworkInterfacesSubnetCRN = core.StringPtr(networkInterfacesSubnetCRN) + return _options +} + +// SetNetworkAttachmentsSubnetCRN : Allow user to set NetworkAttachmentsSubnetCRN +func (_options *ListBareMetalServersOptions) SetNetworkAttachmentsSubnetCRN(networkAttachmentsSubnetCRN string) *ListBareMetalServersOptions { + _options.NetworkAttachmentsSubnetCRN = core.StringPtr(networkAttachmentsSubnetCRN) + return _options +} + +// SetNetworkInterfacesSubnetName : Allow user to set NetworkInterfacesSubnetName +func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetName(networkInterfacesSubnetName string) *ListBareMetalServersOptions { + _options.NetworkInterfacesSubnetName = core.StringPtr(networkInterfacesSubnetName) + return _options +} + +// SetNetworkAttachmentsSubnetName : Allow user to set NetworkAttachmentsSubnetName +func (_options *ListBareMetalServersOptions) SetNetworkAttachmentsSubnetName(networkAttachmentsSubnetName string) *ListBareMetalServersOptions { + _options.NetworkAttachmentsSubnetName = core.StringPtr(networkAttachmentsSubnetName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServersOptions) SetHeaders(param map[string]string) *ListBareMetalServersOptions { + options.Headers = param + return options +} + +// ListDedicatedHostDisksOptions : The ListDedicatedHostDisks options. +type ListDedicatedHostDisksOptions struct { + // The dedicated host identifier. + DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListDedicatedHostDisksOptions : Instantiate ListDedicatedHostDisksOptions +func (*VpcV1) NewListDedicatedHostDisksOptions(dedicatedHostID string) *ListDedicatedHostDisksOptions { + return &ListDedicatedHostDisksOptions{ + DedicatedHostID: core.StringPtr(dedicatedHostID), + } +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (_options *ListDedicatedHostDisksOptions) SetDedicatedHostID(dedicatedHostID string) *ListDedicatedHostDisksOptions { + _options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostDisksOptions) SetHeaders(param map[string]string) *ListDedicatedHostDisksOptions { + options.Headers = param + return options +} + +// ListDedicatedHostGroupsOptions : The ListDedicatedHostGroups options. +type ListDedicatedHostGroupsOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with a `zone.name` property matching the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListDedicatedHostGroupsOptions : Instantiate ListDedicatedHostGroupsOptions +func (*VpcV1) NewListDedicatedHostGroupsOptions() *ListDedicatedHostGroupsOptions { + return &ListDedicatedHostGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListDedicatedHostGroupsOptions) SetStart(start string) *ListDedicatedHostGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListDedicatedHostGroupsOptions) SetLimit(limit int64) *ListDedicatedHostGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListDedicatedHostGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListDedicatedHostGroupsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListDedicatedHostGroupsOptions) SetZoneName(zoneName string) *ListDedicatedHostGroupsOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListDedicatedHostGroupsOptions) SetName(name string) *ListDedicatedHostGroupsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostGroupsOptions) SetHeaders(param map[string]string) *ListDedicatedHostGroupsOptions { + options.Headers = param + return options +} + +// ListDedicatedHostProfilesOptions : The ListDedicatedHostProfiles options. +type ListDedicatedHostProfilesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListDedicatedHostProfilesOptions : Instantiate ListDedicatedHostProfilesOptions +func (*VpcV1) NewListDedicatedHostProfilesOptions() *ListDedicatedHostProfilesOptions { + return &ListDedicatedHostProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListDedicatedHostProfilesOptions) SetStart(start string) *ListDedicatedHostProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListDedicatedHostProfilesOptions) SetLimit(limit int64) *ListDedicatedHostProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostProfilesOptions) SetHeaders(param map[string]string) *ListDedicatedHostProfilesOptions { + options.Headers = param + return options +} + +// ListDedicatedHostsOptions : The ListDedicatedHosts options. +type ListDedicatedHostsOptions struct { + // Filters the collection to dedicated hosts with a `group.id` property matching the specified identifier. + DedicatedHostGroupID *string `json:"dedicated_host_group.id,omitempty"` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with a `zone.name` property matching the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListDedicatedHostsOptions : Instantiate ListDedicatedHostsOptions +func (*VpcV1) NewListDedicatedHostsOptions() *ListDedicatedHostsOptions { + return &ListDedicatedHostsOptions{} +} + +// SetDedicatedHostGroupID : Allow user to set DedicatedHostGroupID +func (_options *ListDedicatedHostsOptions) SetDedicatedHostGroupID(dedicatedHostGroupID string) *ListDedicatedHostsOptions { + _options.DedicatedHostGroupID = core.StringPtr(dedicatedHostGroupID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListDedicatedHostsOptions) SetStart(start string) *ListDedicatedHostsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListDedicatedHostsOptions) SetLimit(limit int64) *ListDedicatedHostsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListDedicatedHostsOptions) SetResourceGroupID(resourceGroupID string) *ListDedicatedHostsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListDedicatedHostsOptions) SetZoneName(zoneName string) *ListDedicatedHostsOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListDedicatedHostsOptions) SetName(name string) *ListDedicatedHostsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostsOptions) SetHeaders(param map[string]string) *ListDedicatedHostsOptions { + options.Headers = param + return options +} + +// ListEndpointGatewayIpsOptions : The ListEndpointGatewayIps options. +type ListEndpointGatewayIpsOptions struct { + // The endpoint gateway identifier. + EndpointGatewayID *string `json:"endpoint_gateway_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListEndpointGatewayIpsOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListEndpointGatewayIpsOptionsSortAddressConst = "address" + ListEndpointGatewayIpsOptionsSortCreatedAtConst = "created_at" + ListEndpointGatewayIpsOptionsSortNameConst = "name" +) + +// NewListEndpointGatewayIpsOptions : Instantiate ListEndpointGatewayIpsOptions +func (*VpcV1) NewListEndpointGatewayIpsOptions(endpointGatewayID string) *ListEndpointGatewayIpsOptions { + return &ListEndpointGatewayIpsOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (_options *ListEndpointGatewayIpsOptions) SetEndpointGatewayID(endpointGatewayID string) *ListEndpointGatewayIpsOptions { + _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListEndpointGatewayIpsOptions) SetStart(start string) *ListEndpointGatewayIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListEndpointGatewayIpsOptions) SetLimit(limit int64) *ListEndpointGatewayIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListEndpointGatewayIpsOptions) SetSort(sort string) *ListEndpointGatewayIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListEndpointGatewayIpsOptions) SetHeaders(param map[string]string) *ListEndpointGatewayIpsOptions { + options.Headers = param + return options +} + +// ListEndpointGatewaysOptions : The ListEndpointGateways options. +type ListEndpointGatewaysOptions struct { + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListEndpointGatewaysOptions : Instantiate ListEndpointGatewaysOptions +func (*VpcV1) NewListEndpointGatewaysOptions() *ListEndpointGatewaysOptions { + return &ListEndpointGatewaysOptions{} +} + +// SetName : Allow user to set Name +func (_options *ListEndpointGatewaysOptions) SetName(name string) *ListEndpointGatewaysOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListEndpointGatewaysOptions) SetStart(start string) *ListEndpointGatewaysOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListEndpointGatewaysOptions) SetLimit(limit int64) *ListEndpointGatewaysOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListEndpointGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListEndpointGatewaysOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListEndpointGatewaysOptions) SetHeaders(param map[string]string) *ListEndpointGatewaysOptions { + options.Headers = param + return options +} + +// ListFloatingIpsOptions : The ListFloatingIps options. +type ListFloatingIpsOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Filters the collection to resources with a `target.id` property matching the specified identifier. + TargetID *string `json:"target.id,omitempty"` + + // Filters the collection to resources with a `target.crn` property matching the specified CRN. + TargetCRN *string `json:"target.crn,omitempty"` + + // Filters the collection to resources with a `target.name` property matching the exact specified name. + TargetName *string `json:"target.name,omitempty"` + + // Filters the collection to resources with a `target.resource_type` property matching the specified value. + TargetResourceType *string `json:"target.resource_type,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListFloatingIpsOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListFloatingIpsOptionsSortCreatedAtConst = "created_at" + ListFloatingIpsOptionsSortNameConst = "name" +) + +// NewListFloatingIpsOptions : Instantiate ListFloatingIpsOptions +func (*VpcV1) NewListFloatingIpsOptions() *ListFloatingIpsOptions { + return &ListFloatingIpsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListFloatingIpsOptions) SetStart(start string) *ListFloatingIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListFloatingIpsOptions) SetLimit(limit int64) *ListFloatingIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListFloatingIpsOptions) SetResourceGroupID(resourceGroupID string) *ListFloatingIpsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListFloatingIpsOptions) SetSort(sort string) *ListFloatingIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetTargetID : Allow user to set TargetID +func (_options *ListFloatingIpsOptions) SetTargetID(targetID string) *ListFloatingIpsOptions { + _options.TargetID = core.StringPtr(targetID) + return _options +} + +// SetTargetCRN : Allow user to set TargetCRN +func (_options *ListFloatingIpsOptions) SetTargetCRN(targetCRN string) *ListFloatingIpsOptions { + _options.TargetCRN = core.StringPtr(targetCRN) + return _options +} + +// SetTargetName : Allow user to set TargetName +func (_options *ListFloatingIpsOptions) SetTargetName(targetName string) *ListFloatingIpsOptions { + _options.TargetName = core.StringPtr(targetName) + return _options +} + +// SetTargetResourceType : Allow user to set TargetResourceType +func (_options *ListFloatingIpsOptions) SetTargetResourceType(targetResourceType string) *ListFloatingIpsOptions { + _options.TargetResourceType = core.StringPtr(targetResourceType) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListFloatingIpsOptions) SetHeaders(param map[string]string) *ListFloatingIpsOptions { + options.Headers = param + return options +} + +// ListFlowLogCollectorsOptions : The ListFlowLogCollectors options. +type ListFlowLogCollectorsOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to resources with a `target.id` property matching the specified identifier. + TargetID *string `json:"target.id,omitempty"` + + // Filters the collection to resources with a `target.resource_type` property matching the specified value. + TargetResourceType *string `json:"target.resource_type,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListFlowLogCollectorsOptions : Instantiate ListFlowLogCollectorsOptions +func (*VpcV1) NewListFlowLogCollectorsOptions() *ListFlowLogCollectorsOptions { + return &ListFlowLogCollectorsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListFlowLogCollectorsOptions) SetStart(start string) *ListFlowLogCollectorsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListFlowLogCollectorsOptions) SetLimit(limit int64) *ListFlowLogCollectorsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListFlowLogCollectorsOptions) SetResourceGroupID(resourceGroupID string) *ListFlowLogCollectorsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListFlowLogCollectorsOptions) SetName(name string) *ListFlowLogCollectorsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListFlowLogCollectorsOptions) SetVPCID(vpcID string) *ListFlowLogCollectorsOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListFlowLogCollectorsOptions) SetVPCCRN(vpcCRN string) *ListFlowLogCollectorsOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListFlowLogCollectorsOptions) SetVPCName(vpcName string) *ListFlowLogCollectorsOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetTargetID : Allow user to set TargetID +func (_options *ListFlowLogCollectorsOptions) SetTargetID(targetID string) *ListFlowLogCollectorsOptions { + _options.TargetID = core.StringPtr(targetID) + return _options +} + +// SetTargetResourceType : Allow user to set TargetResourceType +func (_options *ListFlowLogCollectorsOptions) SetTargetResourceType(targetResourceType string) *ListFlowLogCollectorsOptions { + _options.TargetResourceType = core.StringPtr(targetResourceType) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListFlowLogCollectorsOptions) SetHeaders(param map[string]string) *ListFlowLogCollectorsOptions { + options.Headers = param + return options +} + +// ListIkePoliciesOptions : The ListIkePolicies options. +type ListIkePoliciesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListIkePoliciesOptions : Instantiate ListIkePoliciesOptions +func (*VpcV1) NewListIkePoliciesOptions() *ListIkePoliciesOptions { + return &ListIkePoliciesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListIkePoliciesOptions) SetStart(start string) *ListIkePoliciesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListIkePoliciesOptions) SetLimit(limit int64) *ListIkePoliciesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIkePoliciesOptions) SetHeaders(param map[string]string) *ListIkePoliciesOptions { + options.Headers = param + return options +} + +// ListIkePolicyConnectionsOptions : The ListIkePolicyConnections options. +type ListIkePolicyConnectionsOptions struct { + // The IKE policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListIkePolicyConnectionsOptions : Instantiate ListIkePolicyConnectionsOptions +func (*VpcV1) NewListIkePolicyConnectionsOptions(id string) *ListIkePolicyConnectionsOptions { + return &ListIkePolicyConnectionsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListIkePolicyConnectionsOptions) SetID(id string) *ListIkePolicyConnectionsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIkePolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIkePolicyConnectionsOptions { + options.Headers = param + return options +} + +// ListImageExportJobsOptions : The ListImageExportJobs options. +type ListImageExportJobsOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListImageExportJobsOptions : Instantiate ListImageExportJobsOptions +func (*VpcV1) NewListImageExportJobsOptions(imageID string) *ListImageExportJobsOptions { + return &ListImageExportJobsOptions{ + ImageID: core.StringPtr(imageID), + } +} + +// SetImageID : Allow user to set ImageID +func (_options *ListImageExportJobsOptions) SetImageID(imageID string) *ListImageExportJobsOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListImageExportJobsOptions) SetName(name string) *ListImageExportJobsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListImageExportJobsOptions) SetHeaders(param map[string]string) *ListImageExportJobsOptions { + options.Headers = param + return options +} + +// ListImagesOptions : The ListImages options. +type ListImagesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to images with a `visibility` property matching the specified value. + Visibility *string `json:"visibility,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListImagesOptions.Visibility property. +// Filters the collection to images with a `visibility` property matching the specified value. +const ( + ListImagesOptionsVisibilityPrivateConst = "private" + ListImagesOptionsVisibilityPublicConst = "public" +) + +// NewListImagesOptions : Instantiate ListImagesOptions +func (*VpcV1) NewListImagesOptions() *ListImagesOptions { + return &ListImagesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListImagesOptions) SetStart(start string) *ListImagesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListImagesOptions) SetLimit(limit int64) *ListImagesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListImagesOptions) SetResourceGroupID(resourceGroupID string) *ListImagesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListImagesOptions) SetName(name string) *ListImagesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVisibility : Allow user to set Visibility +func (_options *ListImagesOptions) SetVisibility(visibility string) *ListImagesOptions { + _options.Visibility = core.StringPtr(visibility) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListImagesOptions) SetHeaders(param map[string]string) *ListImagesOptions { + options.Headers = param + return options +} + +// ListInstanceDisksOptions : The ListInstanceDisks options. +type ListInstanceDisksOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceDisksOptions : Instantiate ListInstanceDisksOptions +func (*VpcV1) NewListInstanceDisksOptions(instanceID string) *ListInstanceDisksOptions { + return &ListInstanceDisksOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceDisksOptions) SetInstanceID(instanceID string) *ListInstanceDisksOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceDisksOptions) SetHeaders(param map[string]string) *ListInstanceDisksOptions { + options.Headers = param + return options +} + +// ListInstanceGroupManagerActionsOptions : The ListInstanceGroupManagerActions options. +type ListInstanceGroupManagerActionsOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceGroupManagerActionsOptions : Instantiate ListInstanceGroupManagerActionsOptions +func (*VpcV1) NewListInstanceGroupManagerActionsOptions(instanceGroupID string, instanceGroupManagerID string) *ListInstanceGroupManagerActionsOptions { + return &ListInstanceGroupManagerActionsOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *ListInstanceGroupManagerActionsOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagerActionsOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *ListInstanceGroupManagerActionsOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *ListInstanceGroupManagerActionsOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupManagerActionsOptions) SetStart(start string) *ListInstanceGroupManagerActionsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupManagerActionsOptions) SetLimit(limit int64) *ListInstanceGroupManagerActionsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupManagerActionsOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagerActionsOptions { + options.Headers = param + return options +} + +// ListInstanceGroupManagerPoliciesOptions : The ListInstanceGroupManagerPolicies options. +type ListInstanceGroupManagerPoliciesOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceGroupManagerPoliciesOptions : Instantiate ListInstanceGroupManagerPoliciesOptions +func (*VpcV1) NewListInstanceGroupManagerPoliciesOptions(instanceGroupID string, instanceGroupManagerID string) *ListInstanceGroupManagerPoliciesOptions { + return &ListInstanceGroupManagerPoliciesOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *ListInstanceGroupManagerPoliciesOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagerPoliciesOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *ListInstanceGroupManagerPoliciesOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *ListInstanceGroupManagerPoliciesOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupManagerPoliciesOptions) SetStart(start string) *ListInstanceGroupManagerPoliciesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupManagerPoliciesOptions) SetLimit(limit int64) *ListInstanceGroupManagerPoliciesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupManagerPoliciesOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagerPoliciesOptions { + options.Headers = param + return options +} + +// ListInstanceGroupManagersOptions : The ListInstanceGroupManagers options. +type ListInstanceGroupManagersOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceGroupManagersOptions : Instantiate ListInstanceGroupManagersOptions +func (*VpcV1) NewListInstanceGroupManagersOptions(instanceGroupID string) *ListInstanceGroupManagersOptions { + return &ListInstanceGroupManagersOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *ListInstanceGroupManagersOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagersOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupManagersOptions) SetStart(start string) *ListInstanceGroupManagersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupManagersOptions) SetLimit(limit int64) *ListInstanceGroupManagersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupManagersOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagersOptions { + options.Headers = param + return options +} + +// ListInstanceGroupMembershipsOptions : The ListInstanceGroupMemberships options. +type ListInstanceGroupMembershipsOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceGroupMembershipsOptions : Instantiate ListInstanceGroupMembershipsOptions +func (*VpcV1) NewListInstanceGroupMembershipsOptions(instanceGroupID string) *ListInstanceGroupMembershipsOptions { + return &ListInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *ListInstanceGroupMembershipsOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupMembershipsOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupMembershipsOptions) SetStart(start string) *ListInstanceGroupMembershipsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupMembershipsOptions) SetLimit(limit int64) *ListInstanceGroupMembershipsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupMembershipsOptions) SetHeaders(param map[string]string) *ListInstanceGroupMembershipsOptions { + options.Headers = param + return options +} + +// ListInstanceGroupsOptions : The ListInstanceGroups options. +type ListInstanceGroupsOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceGroupsOptions : Instantiate ListInstanceGroupsOptions +func (*VpcV1) NewListInstanceGroupsOptions() *ListInstanceGroupsOptions { + return &ListInstanceGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupsOptions) SetStart(start string) *ListInstanceGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupsOptions) SetLimit(limit int64) *ListInstanceGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupsOptions) SetHeaders(param map[string]string) *ListInstanceGroupsOptions { + options.Headers = param + return options +} + +// ListInstanceNetworkAttachmentsOptions : The ListInstanceNetworkAttachments options. +type ListInstanceNetworkAttachmentsOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceNetworkAttachmentsOptions : Instantiate ListInstanceNetworkAttachmentsOptions +func (*VpcV1) NewListInstanceNetworkAttachmentsOptions(instanceID string) *ListInstanceNetworkAttachmentsOptions { + return &ListInstanceNetworkAttachmentsOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceNetworkAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkAttachmentsOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkAttachmentsOptions { + options.Headers = param + return options +} + +// ListInstanceNetworkInterfaceFloatingIpsOptions : The ListInstanceNetworkInterfaceFloatingIps options. +type ListInstanceNetworkInterfaceFloatingIpsOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The 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 network interface identifier. + NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceNetworkInterfaceIpsOptions : Instantiate ListInstanceNetworkInterfaceIpsOptions +func (*VpcV1) NewListInstanceNetworkInterfaceIpsOptions(instanceID string, networkInterfaceID string) *ListInstanceNetworkInterfaceIpsOptions { + return &ListInstanceNetworkInterfaceIpsOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceNetworkInterfaceIpsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfaceIpsOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *ListInstanceNetworkInterfaceIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListInstanceNetworkInterfaceIpsOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceNetworkInterfaceIpsOptions) SetStart(start string) *ListInstanceNetworkInterfaceIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceNetworkInterfaceIpsOptions) SetLimit(limit int64) *ListInstanceNetworkInterfaceIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfaceIpsOptions { + options.Headers = param + return options +} + +// ListInstanceNetworkInterfacesOptions : The ListInstanceNetworkInterfaces options. +type ListInstanceNetworkInterfacesOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceNetworkInterfacesOptions : Instantiate ListInstanceNetworkInterfacesOptions +func (*VpcV1) NewListInstanceNetworkInterfacesOptions(instanceID string) *ListInstanceNetworkInterfacesOptions { + return &ListInstanceNetworkInterfacesOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceNetworkInterfacesOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfacesOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfacesOptions { + options.Headers = param + return options +} + +// ListInstanceProfilesOptions : The ListInstanceProfiles options. +type ListInstanceProfilesOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceProfilesOptions : Instantiate ListInstanceProfilesOptions +func (*VpcV1) NewListInstanceProfilesOptions() *ListInstanceProfilesOptions { + return &ListInstanceProfilesOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceProfilesOptions) SetHeaders(param map[string]string) *ListInstanceProfilesOptions { + options.Headers = param + return options +} + +// ListInstanceTemplatesOptions : The ListInstanceTemplates options. +type ListInstanceTemplatesOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceTemplatesOptions : Instantiate ListInstanceTemplatesOptions +func (*VpcV1) NewListInstanceTemplatesOptions() *ListInstanceTemplatesOptions { + return &ListInstanceTemplatesOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceTemplatesOptions) SetHeaders(param map[string]string) *ListInstanceTemplatesOptions { + options.Headers = param + return options +} + +// ListInstanceVolumeAttachmentsOptions : The ListInstanceVolumeAttachments options. +type ListInstanceVolumeAttachmentsOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceVolumeAttachmentsOptions : Instantiate ListInstanceVolumeAttachmentsOptions +func (*VpcV1) NewListInstanceVolumeAttachmentsOptions(instanceID string) *ListInstanceVolumeAttachmentsOptions { + return &ListInstanceVolumeAttachmentsOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceVolumeAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceVolumeAttachmentsOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceVolumeAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceVolumeAttachmentsOptions { + options.Headers = param + return options +} + +// ListInstancesOptions : The ListInstances options. +type ListInstancesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to resources with an item in the `network_attachments` property with a `subnet.id` property + // matching the specified identifier. + NetworkAttachmentsSubnetID *string `json:"network_attachments[].subnet.id,omitempty"` + + // Filters the collection to resources with an item in the `network_attachments` property with a `subnet.crn` property + // matching the specified CRN. + NetworkAttachmentsSubnetCRN *string `json:"network_attachments[].subnet.crn,omitempty"` + + // Filters the collection to resources with an item in the `network_attachments` property with a `subnet.name` property + // matching the exact specified name. + NetworkAttachmentsSubnetName *string `json:"network_attachments[].subnet.name,omitempty"` + + // Filters the collection to instances with a `dedicated_host.id` property matching the specified identifier. + DedicatedHostID *string `json:"dedicated_host.id,omitempty"` + + // Filters the collection to instances with a `dedicated_host.crn` property matching the specified CRN. + DedicatedHostCRN *string `json:"dedicated_host.crn,omitempty"` + + // Filters the collection to instances with a `dedicated_host.name` property matching the exact specified name. + DedicatedHostName *string `json:"dedicated_host.name,omitempty"` + + // Filters the collection to instances with a `placement_target.id` property matching the specified placement group + // identifier. + PlacementGroupID *string `json:"placement_group.id,omitempty"` + + // Filters the collection to instances with a `placement_target.crn` property matching the specified placement group + // CRN. + PlacementGroupCRN *string `json:"placement_group.crn,omitempty"` + + // Filters the collection to instances with a `placement_target.name` property matching the exact specified placement + // group name. + PlacementGroupName *string `json:"placement_group.name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstancesOptions : Instantiate ListInstancesOptions +func (*VpcV1) NewListInstancesOptions() *ListInstancesOptions { + return &ListInstancesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListInstancesOptions) SetStart(start string) *ListInstancesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstancesOptions) SetLimit(limit int64) *ListInstancesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListInstancesOptions) SetResourceGroupID(resourceGroupID string) *ListInstancesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListInstancesOptions) SetName(name string) *ListInstancesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListInstancesOptions) SetVPCID(vpcID string) *ListInstancesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListInstancesOptions) SetVPCCRN(vpcCRN string) *ListInstancesOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListInstancesOptions) SetVPCName(vpcName string) *ListInstancesOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetNetworkAttachmentsSubnetID : Allow user to set NetworkAttachmentsSubnetID +func (_options *ListInstancesOptions) SetNetworkAttachmentsSubnetID(networkAttachmentsSubnetID string) *ListInstancesOptions { + _options.NetworkAttachmentsSubnetID = core.StringPtr(networkAttachmentsSubnetID) + return _options +} + +// SetNetworkAttachmentsSubnetCRN : Allow user to set NetworkAttachmentsSubnetCRN +func (_options *ListInstancesOptions) SetNetworkAttachmentsSubnetCRN(networkAttachmentsSubnetCRN string) *ListInstancesOptions { + _options.NetworkAttachmentsSubnetCRN = core.StringPtr(networkAttachmentsSubnetCRN) + return _options +} + +// SetNetworkAttachmentsSubnetName : Allow user to set NetworkAttachmentsSubnetName +func (_options *ListInstancesOptions) SetNetworkAttachmentsSubnetName(networkAttachmentsSubnetName string) *ListInstancesOptions { + _options.NetworkAttachmentsSubnetName = core.StringPtr(networkAttachmentsSubnetName) + return _options +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (_options *ListInstancesOptions) SetDedicatedHostID(dedicatedHostID string) *ListInstancesOptions { + _options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return _options +} + +// SetDedicatedHostCRN : Allow user to set DedicatedHostCRN +func (_options *ListInstancesOptions) SetDedicatedHostCRN(dedicatedHostCRN string) *ListInstancesOptions { + _options.DedicatedHostCRN = core.StringPtr(dedicatedHostCRN) + return _options +} + +// SetDedicatedHostName : Allow user to set DedicatedHostName +func (_options *ListInstancesOptions) SetDedicatedHostName(dedicatedHostName string) *ListInstancesOptions { + _options.DedicatedHostName = core.StringPtr(dedicatedHostName) + return _options +} + +// SetPlacementGroupID : Allow user to set PlacementGroupID +func (_options *ListInstancesOptions) SetPlacementGroupID(placementGroupID string) *ListInstancesOptions { + _options.PlacementGroupID = core.StringPtr(placementGroupID) + return _options +} + +// SetPlacementGroupCRN : Allow user to set PlacementGroupCRN +func (_options *ListInstancesOptions) SetPlacementGroupCRN(placementGroupCRN string) *ListInstancesOptions { + _options.PlacementGroupCRN = core.StringPtr(placementGroupCRN) + return _options +} + +// SetPlacementGroupName : Allow user to set PlacementGroupName +func (_options *ListInstancesOptions) SetPlacementGroupName(placementGroupName string) *ListInstancesOptions { + _options.PlacementGroupName = core.StringPtr(placementGroupName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstancesOptions) SetHeaders(param map[string]string) *ListInstancesOptions { + options.Headers = param + return options +} + +// ListIpsecPoliciesOptions : The ListIpsecPolicies options. +type ListIpsecPoliciesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListIpsecPoliciesOptions : Instantiate ListIpsecPoliciesOptions +func (*VpcV1) NewListIpsecPoliciesOptions() *ListIpsecPoliciesOptions { + return &ListIpsecPoliciesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListIpsecPoliciesOptions) SetStart(start string) *ListIpsecPoliciesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListIpsecPoliciesOptions) SetLimit(limit int64) *ListIpsecPoliciesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIpsecPoliciesOptions) SetHeaders(param map[string]string) *ListIpsecPoliciesOptions { + options.Headers = param + return options +} + +// ListIpsecPolicyConnectionsOptions : The ListIpsecPolicyConnections options. +type ListIpsecPolicyConnectionsOptions struct { + // The IPsec policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListIpsecPolicyConnectionsOptions : Instantiate ListIpsecPolicyConnectionsOptions +func (*VpcV1) NewListIpsecPolicyConnectionsOptions(id string) *ListIpsecPolicyConnectionsOptions { + return &ListIpsecPolicyConnectionsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListIpsecPolicyConnectionsOptions) SetID(id string) *ListIpsecPolicyConnectionsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIpsecPolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIpsecPolicyConnectionsOptions { + options.Headers = param + return options +} + +// ListKeysOptions : The ListKeys options. +type ListKeysOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListKeysOptions : Instantiate ListKeysOptions +func (*VpcV1) NewListKeysOptions() *ListKeysOptions { + return &ListKeysOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListKeysOptions) SetStart(start string) *ListKeysOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListKeysOptions) SetLimit(limit int64) *ListKeysOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListKeysOptions) SetHeaders(param map[string]string) *ListKeysOptions { + options.Headers = param + return options +} + +// ListLoadBalancerListenerPoliciesOptions : The ListLoadBalancerListenerPolicies options. +type ListLoadBalancerListenerPoliciesOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerListenerPoliciesOptions : Instantiate ListLoadBalancerListenerPoliciesOptions +func (*VpcV1) NewListLoadBalancerListenerPoliciesOptions(loadBalancerID string, listenerID string) *ListLoadBalancerListenerPoliciesOptions { + return &ListLoadBalancerListenerPoliciesOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerListenerPoliciesOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenerPoliciesOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *ListLoadBalancerListenerPoliciesOptions) SetListenerID(listenerID string) *ListLoadBalancerListenerPoliciesOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerListenerPoliciesOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenerPoliciesOptions { + options.Headers = param + return options +} + +// ListLoadBalancerListenerPolicyRulesOptions : The ListLoadBalancerListenerPolicyRules options. +type ListLoadBalancerListenerPolicyRulesOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerListenerPolicyRulesOptions : Instantiate ListLoadBalancerListenerPolicyRulesOptions +func (*VpcV1) NewListLoadBalancerListenerPolicyRulesOptions(loadBalancerID string, listenerID string, policyID string) *ListLoadBalancerListenerPolicyRulesOptions { + return &ListLoadBalancerListenerPolicyRulesOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenerPolicyRulesOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetListenerID(listenerID string) *ListLoadBalancerListenerPolicyRulesOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetPolicyID(policyID string) *ListLoadBalancerListenerPolicyRulesOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerListenerPolicyRulesOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenerPolicyRulesOptions { + options.Headers = param + return options +} + +// ListLoadBalancerListenersOptions : The ListLoadBalancerListeners options. +type ListLoadBalancerListenersOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerListenersOptions : Instantiate ListLoadBalancerListenersOptions +func (*VpcV1) NewListLoadBalancerListenersOptions(loadBalancerID string) *ListLoadBalancerListenersOptions { + return &ListLoadBalancerListenersOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerListenersOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenersOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerListenersOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenersOptions { + options.Headers = param + return options +} + +// ListLoadBalancerPoolMembersOptions : The ListLoadBalancerPoolMembers options. +type ListLoadBalancerPoolMembersOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerPoolMembersOptions : Instantiate ListLoadBalancerPoolMembersOptions +func (*VpcV1) NewListLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string) *ListLoadBalancerPoolMembersOptions { + return &ListLoadBalancerPoolMembersOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerPoolMembersOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *ListLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ListLoadBalancerPoolMembersOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ListLoadBalancerPoolMembersOptions { + options.Headers = param + return options +} + +// ListLoadBalancerPoolsOptions : The ListLoadBalancerPools options. +type ListLoadBalancerPoolsOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerPoolsOptions : Instantiate ListLoadBalancerPoolsOptions +func (*VpcV1) NewListLoadBalancerPoolsOptions(loadBalancerID string) *ListLoadBalancerPoolsOptions { + return &ListLoadBalancerPoolsOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerPoolsOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerPoolsOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerPoolsOptions) SetHeaders(param map[string]string) *ListLoadBalancerPoolsOptions { + options.Headers = param + return options +} + +// ListLoadBalancerProfilesOptions : The ListLoadBalancerProfiles options. +type ListLoadBalancerProfilesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerProfilesOptions : Instantiate ListLoadBalancerProfilesOptions +func (*VpcV1) NewListLoadBalancerProfilesOptions() *ListLoadBalancerProfilesOptions { + return &ListLoadBalancerProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListLoadBalancerProfilesOptions) SetStart(start string) *ListLoadBalancerProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListLoadBalancerProfilesOptions) SetLimit(limit int64) *ListLoadBalancerProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerProfilesOptions) SetHeaders(param map[string]string) *ListLoadBalancerProfilesOptions { + options.Headers = param + return options +} + +// ListLoadBalancersOptions : The ListLoadBalancers options. +type ListLoadBalancersOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancersOptions : Instantiate ListLoadBalancersOptions +func (*VpcV1) NewListLoadBalancersOptions() *ListLoadBalancersOptions { + return &ListLoadBalancersOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListLoadBalancersOptions) SetStart(start string) *ListLoadBalancersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListLoadBalancersOptions) SetLimit(limit int64) *ListLoadBalancersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancersOptions) SetHeaders(param map[string]string) *ListLoadBalancersOptions { + options.Headers = param + return options +} + +// ListNetworkACLRulesOptions : The ListNetworkACLRules options. +type ListNetworkACLRulesOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to rules with a `direction` property matching the specified value. + Direction *string `json:"direction,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListNetworkACLRulesOptions.Direction property. +// Filters the collection to rules with a `direction` property matching the specified value. +const ( + ListNetworkACLRulesOptionsDirectionInboundConst = "inbound" + ListNetworkACLRulesOptionsDirectionOutboundConst = "outbound" +) + +// NewListNetworkACLRulesOptions : Instantiate ListNetworkACLRulesOptions +func (*VpcV1) NewListNetworkACLRulesOptions(networkACLID string) *ListNetworkACLRulesOptions { + return &ListNetworkACLRulesOptions{ + NetworkACLID: core.StringPtr(networkACLID), + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *ListNetworkACLRulesOptions) SetNetworkACLID(networkACLID string) *ListNetworkACLRulesOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListNetworkACLRulesOptions) SetStart(start string) *ListNetworkACLRulesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListNetworkACLRulesOptions) SetLimit(limit int64) *ListNetworkACLRulesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetDirection : Allow user to set Direction +func (_options *ListNetworkACLRulesOptions) SetDirection(direction string) *ListNetworkACLRulesOptions { + _options.Direction = core.StringPtr(direction) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListNetworkACLRulesOptions) SetHeaders(param map[string]string) *ListNetworkACLRulesOptions { + options.Headers = param + return options +} + +// ListNetworkAclsOptions : The ListNetworkAcls options. +type ListNetworkAclsOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListNetworkAclsOptions : Instantiate ListNetworkAclsOptions +func (*VpcV1) NewListNetworkAclsOptions() *ListNetworkAclsOptions { + return &ListNetworkAclsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListNetworkAclsOptions) SetStart(start string) *ListNetworkAclsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListNetworkAclsOptions) SetLimit(limit int64) *ListNetworkAclsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListNetworkAclsOptions) SetResourceGroupID(resourceGroupID string) *ListNetworkAclsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListNetworkAclsOptions) SetHeaders(param map[string]string) *ListNetworkAclsOptions { + options.Headers = param + return options +} + +// ListNetworkInterfaceFloatingIpsOptions : The ListNetworkInterfaceFloatingIps options. +type ListNetworkInterfaceFloatingIpsOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value + // `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` + // property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListNetworkInterfaceFloatingIpsOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value +// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` +// property in ascending order. +const ( + ListNetworkInterfaceFloatingIpsOptionsSortAddressConst = "address" + ListNetworkInterfaceFloatingIpsOptionsSortNameConst = "name" +) + +// NewListNetworkInterfaceFloatingIpsOptions : Instantiate ListNetworkInterfaceFloatingIpsOptions +func (*VpcV1) NewListNetworkInterfaceFloatingIpsOptions(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions { + return &ListNetworkInterfaceFloatingIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetStart(start string) *ListNetworkInterfaceFloatingIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetLimit(limit int64) *ListNetworkInterfaceFloatingIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetSort(sort string) *ListNetworkInterfaceFloatingIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListNetworkInterfaceFloatingIpsOptions { + options.Headers = param + return options +} + +// ListOperatingSystemsOptions : The ListOperatingSystems options. +type ListOperatingSystemsOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListOperatingSystemsOptions : Instantiate ListOperatingSystemsOptions +func (*VpcV1) NewListOperatingSystemsOptions() *ListOperatingSystemsOptions { + return &ListOperatingSystemsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListOperatingSystemsOptions) SetStart(start string) *ListOperatingSystemsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListOperatingSystemsOptions) SetLimit(limit int64) *ListOperatingSystemsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListOperatingSystemsOptions) SetHeaders(param map[string]string) *ListOperatingSystemsOptions { + options.Headers = param + return options +} + +// ListPlacementGroupsOptions : The ListPlacementGroups options. +type ListPlacementGroupsOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListPlacementGroupsOptions : Instantiate ListPlacementGroupsOptions +func (*VpcV1) NewListPlacementGroupsOptions() *ListPlacementGroupsOptions { + return &ListPlacementGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListPlacementGroupsOptions) SetStart(start string) *ListPlacementGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListPlacementGroupsOptions) SetLimit(limit int64) *ListPlacementGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListPlacementGroupsOptions) SetHeaders(param map[string]string) *ListPlacementGroupsOptions { + options.Headers = param + return options +} + +// ListPublicGatewaysOptions : The ListPublicGateways options. +type ListPublicGatewaysOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListPublicGatewaysOptions : Instantiate ListPublicGatewaysOptions +func (*VpcV1) NewListPublicGatewaysOptions() *ListPublicGatewaysOptions { + return &ListPublicGatewaysOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListPublicGatewaysOptions) SetStart(start string) *ListPublicGatewaysOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListPublicGatewaysOptions) SetLimit(limit int64) *ListPublicGatewaysOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListPublicGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListPublicGatewaysOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListPublicGatewaysOptions) SetHeaders(param map[string]string) *ListPublicGatewaysOptions { + options.Headers = param + return options +} + +// ListRegionZonesOptions : The ListRegionZones options. +type ListRegionZonesOptions struct { + // The region name. + RegionName *string `json:"region_name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListRegionZonesOptions : Instantiate ListRegionZonesOptions +func (*VpcV1) NewListRegionZonesOptions(regionName string) *ListRegionZonesOptions { + return &ListRegionZonesOptions{ + RegionName: core.StringPtr(regionName), + } +} + +// SetRegionName : Allow user to set RegionName +func (_options *ListRegionZonesOptions) SetRegionName(regionName string) *ListRegionZonesOptions { + _options.RegionName = core.StringPtr(regionName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListRegionZonesOptions) SetHeaders(param map[string]string) *ListRegionZonesOptions { + options.Headers = param + return options +} + +// ListRegionsOptions : The ListRegions options. +type ListRegionsOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListRegionsOptions : Instantiate ListRegionsOptions +func (*VpcV1) NewListRegionsOptions() *ListRegionsOptions { + return &ListRegionsOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListRegionsOptions) SetHeaders(param map[string]string) *ListRegionsOptions { + options.Headers = param + return options +} + +// ListSecurityGroupRulesOptions : The ListSecurityGroupRules options. +type ListSecurityGroupRulesOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSecurityGroupRulesOptions : Instantiate ListSecurityGroupRulesOptions +func (*VpcV1) NewListSecurityGroupRulesOptions(securityGroupID string) *ListSecurityGroupRulesOptions { + return &ListSecurityGroupRulesOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *ListSecurityGroupRulesOptions) SetSecurityGroupID(securityGroupID string) *ListSecurityGroupRulesOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSecurityGroupRulesOptions) SetHeaders(param map[string]string) *ListSecurityGroupRulesOptions { + options.Headers = param + return options +} + +// ListSecurityGroupTargetsOptions : The ListSecurityGroupTargets options. +type ListSecurityGroupTargetsOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSecurityGroupTargetsOptions : Instantiate ListSecurityGroupTargetsOptions +func (*VpcV1) NewListSecurityGroupTargetsOptions(securityGroupID string) *ListSecurityGroupTargetsOptions { + return &ListSecurityGroupTargetsOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *ListSecurityGroupTargetsOptions) SetSecurityGroupID(securityGroupID string) *ListSecurityGroupTargetsOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListSecurityGroupTargetsOptions) SetStart(start string) *ListSecurityGroupTargetsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSecurityGroupTargetsOptions) SetLimit(limit int64) *ListSecurityGroupTargetsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSecurityGroupTargetsOptions) SetHeaders(param map[string]string) *ListSecurityGroupTargetsOptions { + options.Headers = param + return options +} + +// ListSecurityGroupsOptions : The ListSecurityGroups options. +type ListSecurityGroupsOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSecurityGroupsOptions : Instantiate ListSecurityGroupsOptions +func (*VpcV1) NewListSecurityGroupsOptions() *ListSecurityGroupsOptions { + return &ListSecurityGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListSecurityGroupsOptions) SetStart(start string) *ListSecurityGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSecurityGroupsOptions) SetLimit(limit int64) *ListSecurityGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListSecurityGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListSecurityGroupsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListSecurityGroupsOptions) SetVPCID(vpcID string) *ListSecurityGroupsOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListSecurityGroupsOptions) SetVPCCRN(vpcCRN string) *ListSecurityGroupsOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListSecurityGroupsOptions) SetVPCName(vpcName string) *ListSecurityGroupsOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSecurityGroupsOptions) SetHeaders(param map[string]string) *ListSecurityGroupsOptions { + options.Headers = param + return options +} + +// ListShareMountTargetsOptions : The ListShareMountTargets options. +type ListShareMountTargetsOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // 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 +} + +// SetHeaders : Allow user to set Headers +func (options *ListShareMountTargetsOptions) SetHeaders(param map[string]string) *ListShareMountTargetsOptions { + options.Headers = param + return options +} + +// ListShareProfilesOptions : The ListShareProfiles options. +type ListShareProfilesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListShareProfilesOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListShareProfilesOptionsSortCreatedAtConst = "created_at" + ListShareProfilesOptionsSortNameConst = "name" +) + +// NewListShareProfilesOptions : Instantiate ListShareProfilesOptions +func (*VpcV1) NewListShareProfilesOptions() *ListShareProfilesOptions { + return &ListShareProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListShareProfilesOptions) SetStart(start string) *ListShareProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListShareProfilesOptions) SetLimit(limit int64) *ListShareProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListShareProfilesOptions) SetSort(sort string) *ListShareProfilesOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListShareProfilesOptions) SetHeaders(param map[string]string) *ListShareProfilesOptions { + options.Headers = param + return options +} + +// ListSharesOptions : The ListShares options. +type ListSharesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Filters the collection to file shares with a `replication_role` property matching the specified value. + ReplicationRole *string `json:"replication_role,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListSharesOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListSharesOptionsSortCreatedAtConst = "created_at" + ListSharesOptionsSortNameConst = "name" +) + +// Constants associated with the ListSharesOptions.ReplicationRole property. +// Filters the collection to file shares with a `replication_role` property matching the specified value. +const ( + ListSharesOptionsReplicationRoleNoneConst = "none" + ListSharesOptionsReplicationRoleReplicaConst = "replica" + ListSharesOptionsReplicationRoleSourceConst = "source" +) + +// NewListSharesOptions : Instantiate ListSharesOptions +func (*VpcV1) NewListSharesOptions() *ListSharesOptions { + return &ListSharesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListSharesOptions) SetStart(start string) *ListSharesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSharesOptions) SetLimit(limit int64) *ListSharesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListSharesOptions) SetResourceGroupID(resourceGroupID string) *ListSharesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListSharesOptions) SetName(name string) *ListSharesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListSharesOptions) SetSort(sort string) *ListSharesOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetReplicationRole : Allow user to set ReplicationRole +func (_options *ListSharesOptions) SetReplicationRole(replicationRole string) *ListSharesOptions { + _options.ReplicationRole = core.StringPtr(replicationRole) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSharesOptions) SetHeaders(param map[string]string) *ListSharesOptions { + options.Headers = param + return options +} + +// ListSnapshotClonesOptions : The ListSnapshotClones options. +type ListSnapshotClonesOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSnapshotClonesOptions : Instantiate ListSnapshotClonesOptions +func (*VpcV1) NewListSnapshotClonesOptions(id string) *ListSnapshotClonesOptions { + return &ListSnapshotClonesOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListSnapshotClonesOptions) SetID(id string) *ListSnapshotClonesOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSnapshotClonesOptions) SetHeaders(param map[string]string) *ListSnapshotClonesOptions { + options.Headers = param + return options +} + +// ListSnapshotsOptions : The ListSnapshots options. +type ListSnapshotsOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with an item in the `tags` property matching the exact specified tag. + Tag *string `json:"tag,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to resources with a `source_volume.id` property matching the specified identifier. + SourceVolumeID *string `json:"source_volume.id,omitempty"` + + // Filters the collection to resources with a `source_volume.crn` property matching the specified CRN. + SourceVolumeCRN *string `json:"source_volume.crn,omitempty"` + + // Filters the collection to resources with a `source_image.id` property matching the specified identifier. + // + // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no + // source image or any existent source image, respectively. + SourceImageID *string `json:"source_image.id,omitempty"` + + // Filters the collection to resources with a `source_image.crn` property matching the specified CRN. + // + // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no + // source image or any existent source image, respectively. + SourceImageCRN *string `json:"source_image.crn,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified + // identifier. + BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` + + // Filters the collection to snapshots with an item in the `copies` property with an `id` property matching the + // specified identifier. + CopiesID *string `json:"copies[].id,omitempty"` + + // Filters the collection to snapshots with an item in the `copies` property with a `name` property matching the exact + // specified name. + CopiesName *string `json:"copies[].name,omitempty"` + + // Filters the collection to snapshots with an item in the `copies` property with an `id` property matching the + // specified CRN. + CopiesCRN *string `json:"copies[].crn,omitempty"` + + // Filters the collection to snapshots with an item in the `copies` property with a + // `remote.region.name` property matching the exact specified name. + CopiesRemoteRegionName *string `json:"copies[].remote.region.name,omitempty"` + + // Filters the collection to resources with a `source_snapshot.id` property matching the specified identifier. + SourceSnapshotID *string `json:"source_snapshot.id,omitempty"` + + // Filters the collection to resources with a `source_snapshot.remote.region.name` property matching the exact + // specified name. + SourceSnapshotRemoteRegionName *string `json:"source_snapshot.remote.region.name,omitempty"` + + // Filters the collection to resources with a `source_volume.remote.region.name` property matching the exact specified + // name. + SourceVolumeRemoteRegionName *string `json:"source_volume.remote.region.name,omitempty"` + + // Filters the collection to resources with a `source_image.remote.region.name` property matching the exact specified + // name. + SourceImageRemoteRegionName *string `json:"source_image.remote.region.name,omitempty"` + + // Filters the collection to snapshots with an item in the `clones` property with a `zone.name` property matching the + // exact specified name. + ClonesZoneName *string `json:"clones[].zone.name,omitempty"` + + // 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 +} + +// 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 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 +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *ListSubnetsOptions) SetRoutingTableID(routingTableID string) *ListSubnetsOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetRoutingTableName : Allow user to set RoutingTableName +func (_options *ListSubnetsOptions) SetRoutingTableName(routingTableName string) *ListSubnetsOptions { + _options.RoutingTableName = core.StringPtr(routingTableName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSubnetsOptions) SetHeaders(param map[string]string) *ListSubnetsOptions { + options.Headers = param + return options +} + +// ListVirtualNetworkInterfaceIpsOptions : The ListVirtualNetworkInterfaceIps options. +type ListVirtualNetworkInterfaceIpsOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value + // `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` + // property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVirtualNetworkInterfaceIpsOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value +// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` +// property in ascending order. +const ( + ListVirtualNetworkInterfaceIpsOptionsSortAddressConst = "address" + ListVirtualNetworkInterfaceIpsOptionsSortNameConst = "name" +) + +// NewListVirtualNetworkInterfaceIpsOptions : Instantiate ListVirtualNetworkInterfaceIpsOptions +func (*VpcV1) NewListVirtualNetworkInterfaceIpsOptions(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions { + return &ListVirtualNetworkInterfaceIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetStart(start string) *ListVirtualNetworkInterfaceIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetLimit(limit int64) *ListVirtualNetworkInterfaceIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetSort(sort string) *ListVirtualNetworkInterfaceIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVirtualNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListVirtualNetworkInterfaceIpsOptions { + options.Headers = param + return options +} + +// ListVirtualNetworkInterfacesOptions : The ListVirtualNetworkInterfaces options. +type ListVirtualNetworkInterfacesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVirtualNetworkInterfacesOptions : Instantiate ListVirtualNetworkInterfacesOptions +func (*VpcV1) NewListVirtualNetworkInterfacesOptions() *ListVirtualNetworkInterfacesOptions { + return &ListVirtualNetworkInterfacesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVirtualNetworkInterfacesOptions) SetStart(start string) *ListVirtualNetworkInterfacesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVirtualNetworkInterfacesOptions) SetLimit(limit int64) *ListVirtualNetworkInterfacesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListVirtualNetworkInterfacesOptions) SetResourceGroupID(resourceGroupID string) *ListVirtualNetworkInterfacesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVirtualNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListVirtualNetworkInterfacesOptions { + options.Headers = param + return options +} + +// ListVolumeProfilesOptions : The ListVolumeProfiles options. +type ListVolumeProfilesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVolumeProfilesOptions : Instantiate ListVolumeProfilesOptions +func (*VpcV1) NewListVolumeProfilesOptions() *ListVolumeProfilesOptions { + return &ListVolumeProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVolumeProfilesOptions) SetStart(start string) *ListVolumeProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVolumeProfilesOptions) SetLimit(limit int64) *ListVolumeProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVolumeProfilesOptions) SetHeaders(param map[string]string) *ListVolumeProfilesOptions { + options.Headers = param + return options +} + +// ListVolumesOptions : The ListVolumes options. +type ListVolumesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to volumes with an `attachment_state` property matching the specified value. + AttachmentState *string `json:"attachment_state,omitempty"` + + // Filters the collection to resources with an `encryption` property matching the specified value. + Encryption *string `json:"encryption,omitempty"` + + // Filters the collection to resources with an `operating_system.family` property matching the specified operating + // system family. + // + // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no + // operating system or any operating system, respectively. + OperatingSystemFamily *string `json:"operating_system.family,omitempty"` + + // Filters the collection to resources with an `operating_system.architecture` property matching the specified + // operating system architecture. + // + // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no + // operating system or any operating system, respectively. + OperatingSystemArchitecture *string `json:"operating_system.architecture,omitempty"` + + // Filters the collection to resources with a `zone.name` property matching the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVolumesOptions.AttachmentState property. +// Filters the collection to volumes with an `attachment_state` property matching the specified value. +const ( + ListVolumesOptionsAttachmentStateAttachedConst = "attached" + ListVolumesOptionsAttachmentStateUnattachedConst = "unattached" + ListVolumesOptionsAttachmentStateUnusableConst = "unusable" +) + +// Constants associated with the ListVolumesOptions.Encryption property. +// Filters the collection to resources with an `encryption` property matching the specified value. +const ( + ListVolumesOptionsEncryptionProviderManagedConst = "provider_managed" + ListVolumesOptionsEncryptionUserManagedConst = "user_managed" +) + +// NewListVolumesOptions : Instantiate ListVolumesOptions +func (*VpcV1) NewListVolumesOptions() *ListVolumesOptions { + return &ListVolumesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVolumesOptions) SetStart(start string) *ListVolumesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVolumesOptions) SetLimit(limit int64) *ListVolumesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListVolumesOptions) SetName(name string) *ListVolumesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetAttachmentState : Allow user to set AttachmentState +func (_options *ListVolumesOptions) SetAttachmentState(attachmentState string) *ListVolumesOptions { + _options.AttachmentState = core.StringPtr(attachmentState) + return _options +} + +// SetEncryption : Allow user to set Encryption +func (_options *ListVolumesOptions) SetEncryption(encryption string) *ListVolumesOptions { + _options.Encryption = core.StringPtr(encryption) + return _options +} + +// SetOperatingSystemFamily : Allow user to set OperatingSystemFamily +func (_options *ListVolumesOptions) SetOperatingSystemFamily(operatingSystemFamily string) *ListVolumesOptions { + _options.OperatingSystemFamily = core.StringPtr(operatingSystemFamily) + return _options +} + +// SetOperatingSystemArchitecture : Allow user to set OperatingSystemArchitecture +func (_options *ListVolumesOptions) SetOperatingSystemArchitecture(operatingSystemArchitecture string) *ListVolumesOptions { + _options.OperatingSystemArchitecture = core.StringPtr(operatingSystemArchitecture) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListVolumesOptions) SetZoneName(zoneName string) *ListVolumesOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVolumesOptions) SetHeaders(param map[string]string) *ListVolumesOptions { + options.Headers = param + return options +} + +// ListVPCAddressPrefixesOptions : The ListVPCAddressPrefixes options. +type ListVPCAddressPrefixesOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPCAddressPrefixesOptions : Instantiate ListVPCAddressPrefixesOptions +func (*VpcV1) NewListVPCAddressPrefixesOptions(vpcID string) *ListVPCAddressPrefixesOptions { + return &ListVPCAddressPrefixesOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListVPCAddressPrefixesOptions) SetVPCID(vpcID string) *ListVPCAddressPrefixesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPCAddressPrefixesOptions) SetStart(start string) *ListVPCAddressPrefixesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPCAddressPrefixesOptions) SetLimit(limit int64) *ListVPCAddressPrefixesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCAddressPrefixesOptions) SetHeaders(param map[string]string) *ListVPCAddressPrefixesOptions { + options.Headers = param + return options +} + +// ListVPCRoutesOptions : The ListVPCRoutes options. +type ListVPCRoutesOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // Filters the collection to resources 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 +} + +// ListVPNGatewayConnectionLocalCIDRsOptions : The ListVPNGatewayConnectionLocalCIDRs options. +type ListVPNGatewayConnectionLocalCIDRsOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPNGatewayConnectionLocalCIDRsOptions : Instantiate ListVPNGatewayConnectionLocalCIDRsOptions +func (*VpcV1) NewListVPNGatewayConnectionLocalCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionLocalCIDRsOptions { + return &ListVPNGatewayConnectionLocalCIDRsOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *ListVPNGatewayConnectionLocalCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionLocalCIDRsOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *ListVPNGatewayConnectionLocalCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionLocalCIDRsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewayConnectionLocalCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionLocalCIDRsOptions { + options.Headers = param + return options +} + +// ListVPNGatewayConnectionPeerCIDRsOptions : The ListVPNGatewayConnectionPeerCIDRs options. +type ListVPNGatewayConnectionPeerCIDRsOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPNGatewayConnectionPeerCIDRsOptions : Instantiate ListVPNGatewayConnectionPeerCIDRsOptions +func (*VpcV1) NewListVPNGatewayConnectionPeerCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionPeerCIDRsOptions { + return &ListVPNGatewayConnectionPeerCIDRsOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *ListVPNGatewayConnectionPeerCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionPeerCIDRsOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *ListVPNGatewayConnectionPeerCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionPeerCIDRsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewayConnectionPeerCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionPeerCIDRsOptions { + options.Headers = param + return options +} + +// ListVPNGatewayConnectionsOptions : The ListVPNGatewayConnections options. +type ListVPNGatewayConnectionsOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // Filters the collection to VPN gateway connections with a `status` property matching the specified value. + Status *string `json:"status,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPNGatewayConnectionsOptions.Status property. +// Filters the collection to VPN gateway connections with a `status` property matching the specified value. +const ( + ListVPNGatewayConnectionsOptionsStatusDownConst = "down" + ListVPNGatewayConnectionsOptionsStatusUpConst = "up" +) + +// NewListVPNGatewayConnectionsOptions : Instantiate ListVPNGatewayConnectionsOptions +func (*VpcV1) NewListVPNGatewayConnectionsOptions(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { + return &ListVPNGatewayConnectionsOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *ListVPNGatewayConnectionsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetStatus : Allow user to set Status +func (_options *ListVPNGatewayConnectionsOptions) SetStatus(status string) *ListVPNGatewayConnectionsOptions { + _options.Status = core.StringPtr(status) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewayConnectionsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsOptions { + options.Headers = param + return options +} + +// ListVPNGatewaysOptions : The ListVPNGateways options. +type ListVPNGatewaysOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Filters the collection to VPN gateways with a `mode` property matching the specified value. + Mode *string `json:"mode,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPNGatewaysOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListVPNGatewaysOptionsSortCreatedAtConst = "created_at" + ListVPNGatewaysOptionsSortNameConst = "name" +) + +// Constants associated with the ListVPNGatewaysOptions.Mode property. +// Filters the collection to VPN gateways with a `mode` property matching the specified value. +const ( + ListVPNGatewaysOptionsModePolicyConst = "policy" + ListVPNGatewaysOptionsModeRouteConst = "route" +) + +// NewListVPNGatewaysOptions : Instantiate ListVPNGatewaysOptions +func (*VpcV1) NewListVPNGatewaysOptions() *ListVPNGatewaysOptions { + return &ListVPNGatewaysOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVPNGatewaysOptions) SetStart(start string) *ListVPNGatewaysOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNGatewaysOptions) SetLimit(limit int64) *ListVPNGatewaysOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListVPNGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListVPNGatewaysOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNGatewaysOptions) SetSort(sort string) *ListVPNGatewaysOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetMode : Allow user to set Mode +func (_options *ListVPNGatewaysOptions) SetMode(mode string) *ListVPNGatewaysOptions { + _options.Mode = core.StringPtr(mode) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewaysOptions) SetHeaders(param map[string]string) *ListVPNGatewaysOptions { + options.Headers = param + return options +} + +// ListVPNServerClientsOptions : The ListVPNServerClients options. +type ListVPNServerClientsOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPNServerClientsOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order. +const ( + ListVPNServerClientsOptionsSortCreatedAtConst = "created_at" +) + +// NewListVPNServerClientsOptions : Instantiate ListVPNServerClientsOptions +func (*VpcV1) NewListVPNServerClientsOptions(vpnServerID string) *ListVPNServerClientsOptions { + return &ListVPNServerClientsOptions{ + VPNServerID: core.StringPtr(vpnServerID), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *ListVPNServerClientsOptions) SetVPNServerID(vpnServerID string) *ListVPNServerClientsOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPNServerClientsOptions) SetStart(start string) *ListVPNServerClientsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNServerClientsOptions) SetLimit(limit int64) *ListVPNServerClientsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNServerClientsOptions) SetSort(sort string) *ListVPNServerClientsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNServerClientsOptions) SetHeaders(param map[string]string) *ListVPNServerClientsOptions { + options.Headers = param + return options +} + +// ListVPNServerRoutesOptions : The ListVPNServerRoutes options. +type ListVPNServerRoutesOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPNServerRoutesOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListVPNServerRoutesOptionsSortCreatedAtConst = "created_at" + ListVPNServerRoutesOptionsSortNameConst = "name" +) + +// NewListVPNServerRoutesOptions : Instantiate ListVPNServerRoutesOptions +func (*VpcV1) NewListVPNServerRoutesOptions(vpnServerID string) *ListVPNServerRoutesOptions { + return &ListVPNServerRoutesOptions{ + VPNServerID: core.StringPtr(vpnServerID), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *ListVPNServerRoutesOptions) SetVPNServerID(vpnServerID string) *ListVPNServerRoutesOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPNServerRoutesOptions) SetStart(start string) *ListVPNServerRoutesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNServerRoutesOptions) SetLimit(limit int64) *ListVPNServerRoutesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNServerRoutesOptions) SetSort(sort string) *ListVPNServerRoutesOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNServerRoutesOptions) SetHeaders(param map[string]string) *ListVPNServerRoutesOptions { + options.Headers = param + return options +} + +// ListVPNServersOptions : The ListVPNServers options. +type ListVPNServersOptions struct { + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPNServersOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListVPNServersOptionsSortCreatedAtConst = "created_at" + ListVPNServersOptionsSortNameConst = "name" +) + +// NewListVPNServersOptions : Instantiate ListVPNServersOptions +func (*VpcV1) NewListVPNServersOptions() *ListVPNServersOptions { + return &ListVPNServersOptions{} +} + +// SetName : Allow user to set Name +func (_options *ListVPNServersOptions) SetName(name string) *ListVPNServersOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPNServersOptions) SetStart(start string) *ListVPNServersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNServersOptions) SetLimit(limit int64) *ListVPNServersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListVPNServersOptions) SetResourceGroupID(resourceGroupID string) *ListVPNServersOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNServersOptions) SetSort(sort string) *ListVPNServersOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNServersOptions) SetHeaders(param map[string]string) *ListVPNServersOptions { + options.Headers = param + return options +} + +// LoadBalancer : LoadBalancer struct +type LoadBalancer struct { + // The date and time that this load balancer was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` + + // The DNS configuration for this load balancer. + // + // If absent, DNS `A` records for this load balancer's `hostname` property will be added to + // the public DNS zone `lb.appdomain.cloud`. + Dns *LoadBalancerDns `json:"dns,omitempty"` + + // Fully qualified domain name assigned to this load balancer. + Hostname *string `json:"hostname" validate:"required"` + + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` + + // Indicates whether this load balancer supports instance groups. + InstanceGroupsSupported *bool `json:"instance_groups_supported" validate:"required"` + + // The type of this load balancer, public or private. + IsPublic *bool `json:"is_public" validate:"required"` + + // The listeners of this load balancer. + Listeners []LoadBalancerListenerReference `json:"listeners" validate:"required"` + + // The logging configuration for this load balancer. + Logging *LoadBalancerLogging `json:"logging" validate:"required"` + + // The name for this load balancer. The name is unique across all load balancers in the VPC. + Name *string `json:"name" validate:"required"` + + // The operating status of this load balancer. + OperatingStatus *string `json:"operating_status" validate:"required"` + + // The pools of this load balancer. + Pools []LoadBalancerPoolReference `json:"pools" validate:"required"` + + // The private IP addresses assigned to this load balancer. + PrivateIps []LoadBalancerPrivateIpsItem `json:"private_ips" validate:"required"` + + // The profile for this load balancer. + Profile *LoadBalancerProfileReference `json:"profile" validate:"required"` + + // The provisioning status of this load balancer: + // + // - `active`: The load balancer is running. + // - `create_pending`: The load balancer is being created. + // - `delete_pending`: The load balancer is being deleted. + // - `maintenance_pending`: The load balancer is unavailable due to an internal + // error (contact IBM support). + // - `migrate_pending`: The load balancer is migrating to the requested configuration. + // Performance may be degraded. + // - `update_pending`: The load balancer is being updated + // to the requested configuration. + // + // The enumerated values for this property are expected to expand in the future. When + // processing this property, check for and log unknown values. Optionally halt + // processing and surface the error, or bypass the load balancer on which the + // unexpected property value was encountered. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The public IP addresses assigned to this load balancer. + // + // Applicable only for public load balancers. + PublicIps []IP `json:"public_ips" validate:"required"` + + // The resource group for this load balancer. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether route mode is enabled for this load balancer. + // + // At present, public load balancers are not supported with route mode enabled. + RouteMode *bool `json:"route_mode" validate:"required"` + + // The security groups targeting this load balancer. + // + // Applicable only for load balancers that support security groups. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // Indicates whether this load balancer supports security groups. + SecurityGroupsSupported *bool `json:"security_groups_supported" validate:"required"` + + // The subnets this load balancer is provisioned in. The load balancer's availability depends on the availability of + // the zones that the subnets reside in. + // + // All subnets will be in the same VPC. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // Indicates whether this load balancer supports UDP. + UDPSupported *bool `json:"udp_supported" validate:"required"` +} + +// Constants associated with the LoadBalancer.OperatingStatus property. +// The operating status of this load balancer. +const ( + LoadBalancerOperatingStatusOfflineConst = "offline" + LoadBalancerOperatingStatusOnlineConst = "online" +) + +// Constants associated with the LoadBalancer.ProvisioningStatus property. +// The provisioning status of this load balancer: +// +// - `active`: The load balancer is running. +// +// - `create_pending`: The load balancer is being created. +// +// - `delete_pending`: The load balancer is being deleted. +// +// - `maintenance_pending`: The load balancer is unavailable due to an internal +// error (contact IBM support). +// +// - `migrate_pending`: The load balancer is migrating to the requested configuration. +// Performance may be degraded. +// +// - `update_pending`: The load balancer is being updated +// to the requested configuration. +// +// The enumerated values for this property are expected to expand in the future. When +// processing this property, check for and log unknown values. Optionally halt +// processing and surface the error, or bypass the load balancer on which the +// unexpected property value was encountered. +const ( + LoadBalancerProvisioningStatusActiveConst = "active" + LoadBalancerProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerProvisioningStatusFailedConst = "failed" + LoadBalancerProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerProvisioningStatusMigratePendingConst = "migrate_pending" + LoadBalancerProvisioningStatusUpdatePendingConst = "update_pending" +) + +// Constants associated with the LoadBalancer.ResourceType property. +// The resource type. +const ( + LoadBalancerResourceTypeLoadBalancerConst = "load_balancer" +) + +// UnmarshalLoadBalancer unmarshals an instance of LoadBalancer from the specified map of raw messages. +func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancer) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalLoadBalancerDns) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instance_groups_supported", &obj.InstanceGroupsSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_public", &obj.IsPublic) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListenerReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLogging) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "operating_status", &obj.OperatingStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPoolReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalLoadBalancerPrivateIpsItem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalLoadBalancerProfileReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_ips", &obj.PublicIps, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_mode", &obj.RouteMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "security_groups_supported", &obj.SecurityGroupsSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "udp_supported", &obj.UDPSupported) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerCollection : LoadBalancerCollection struct +type LoadBalancerCollection struct { + // A link to the first page of resources. + First *LoadBalancerCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of load balancers. + LoadBalancers []LoadBalancer `json:"load_balancers" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *LoadBalancerCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalLoadBalancerCollection unmarshals an instance of LoadBalancerCollection from the specified map of raw messages. +func UnmarshalLoadBalancerCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalLoadBalancerCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancers", &obj.LoadBalancers, UnmarshalLoadBalancer) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *LoadBalancerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// LoadBalancerCollectionFirst : A link to the first page of resources. +type LoadBalancerCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalLoadBalancerCollectionFirst unmarshals an instance of LoadBalancerCollectionFirst from the specified map of raw messages. +func UnmarshalLoadBalancerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type LoadBalancerCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalLoadBalancerCollectionNext unmarshals an instance of LoadBalancerCollectionNext from the specified map of raw messages. +func UnmarshalLoadBalancerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerDns : The DNS configuration for this load balancer. +// +// If absent, DNS `A` records for this load balancer's `hostname` property will be added to the public DNS zone +// `lb.appdomain.cloud`. +type LoadBalancerDns struct { + // The DNS instance associated with this load balancer. + Instance *DnsInstanceReference `json:"instance" validate:"required"` + + // The DNS zone associated with this load balancer. + Zone *DnsZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalLoadBalancerDns unmarshals an instance of LoadBalancerDns from the specified map of raw messages. +func UnmarshalLoadBalancerDns(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerDns) + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerDnsPatch : The DNS configuration for this load balancer. +// +// Specify `null` to remove the existing DNS configuration, which will remove all DNS `A` records for this load balancer +// that had been added to `zone`, and add equivalent `A` records to the public DNS zone `lb.appdomain.cloud`. +type LoadBalancerDnsPatch struct { + // The DNS instance to associate with this load balancer. + // + // The specified instance may be in a different region or account, subject to IAM + // policies. + Instance DnsInstanceIdentityIntf `json:"instance,omitempty"` + + // The DNS zone to associate with this load balancer. + // + // The specified zone may be in a different region or account, subject to IAM policies. + Zone DnsZoneIdentityIntf `json:"zone,omitempty"` +} + +// UnmarshalLoadBalancerDnsPatch unmarshals an instance of LoadBalancerDnsPatch from the specified map of raw messages. +func UnmarshalLoadBalancerDnsPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerDnsPatch) + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerDnsPrototype : The DNS configuration for this load balancer. +// +// If unspecified, DNS `A` records for this load balancer's `hostname` property will be added to the public DNS zone +// `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be added to the specified `zone`. +type LoadBalancerDnsPrototype struct { + // The DNS instance to associate with this load balancer. + // + // The specified instance may be in a different region or account, subject to IAM + // policies. + Instance DnsInstanceIdentityIntf `json:"instance" validate:"required"` + + // The DNS zone to associate with this load balancer. + // + // The specified zone may be in a different region or account, subject to IAM policies. + Zone DnsZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewLoadBalancerDnsPrototype : Instantiate LoadBalancerDnsPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerDnsPrototype(instance DnsInstanceIdentityIntf, zone DnsZoneIdentityIntf) (_model *LoadBalancerDnsPrototype, err error) { + _model = &LoadBalancerDnsPrototype{ + Instance: instance, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerDnsPrototype unmarshals an instance of LoadBalancerDnsPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerDnsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerDnsPrototype) + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentity : Identifies a load balancer by a unique property. +// Models which "extend" this model: +// - LoadBalancerIdentityByID +// - LoadBalancerIdentityByCRN +// - LoadBalancerIdentityByHref +type LoadBalancerIdentity struct { + // The unique identifier for this load balancer. + ID *string `json:"id,omitempty"` + + // The load balancer's CRN. + CRN *string `json:"crn,omitempty"` + + // The load balancer's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerIdentity) isaLoadBalancerIdentity() bool { + return true +} + +type LoadBalancerIdentityIntf interface { + isaLoadBalancerIdentity() bool +} + +// UnmarshalLoadBalancerIdentity unmarshals an instance of LoadBalancerIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListener : LoadBalancerListener struct +type LoadBalancerListener struct { + // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in + // the `application` family (otherwise always `false`). Additional restrictions: + // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must + // match the `accept_proxy_protocol` value of the `https_redirect` listener. + // - If this listener is the target of another listener's `https_redirect`, its + // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. + AcceptProxyProtocol *bool `json:"accept_proxy_protocol" validate:"required"` + + // The certificate instance used for SSL termination. + // + // If absent, this listener is not using a certificate instance. + CertificateInstance *CertificateInstanceReference `json:"certificate_instance,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The date and time that this listener was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The default pool for this listener. If absent, this listener has no default pool. + DefaultPool *LoadBalancerPoolReference `json:"default_pool,omitempty"` + + // The listener's canonical URL. + Href *string `json:"href" validate:"required"` + + // If present, the target listener that requests are redirected to. + HTTPSRedirect *LoadBalancerListenerHTTPSRedirect `json:"https_redirect,omitempty"` + + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` + + // The idle connection timeout of the listener in seconds. This property will be present for load balancers in the + // `application` family. + IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` + + // The policies for this listener. + Policies []LoadBalancerListenerPolicyReference `json:"policies,omitempty"` + + // The listener port number, or the inclusive lower bound of the port range. + Port *int64 `json:"port" validate:"required"` + + // The inclusive upper bound of the range of ports used by this listener. + // + // At present, only load balancers in the `network` family support more than one port per listener. + PortMax *int64 `json:"port_max" validate:"required"` + + // The inclusive lower bound of the range of ports used by this listener. + // + // At present, only load balancers in the `network` family support more than one port per listener. + PortMin *int64 `json:"port_min" validate:"required"` + + // The listener protocol. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the + // unexpected property value was encountered. + Protocol *string `json:"protocol" validate:"required"` + + // The provisioning status of this listener + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the + // unexpected property value was encountered. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` +} + +// Constants associated with the LoadBalancerListener.Protocol property. +// The listener protocol. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerProtocolHTTPConst = "http" + LoadBalancerListenerProtocolHTTPSConst = "https" + LoadBalancerListenerProtocolTCPConst = "tcp" + LoadBalancerListenerProtocolUDPConst = "udp" +) + +// Constants associated with the LoadBalancerListener.ProvisioningStatus property. +// The provisioning status of this listener +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerProvisioningStatusActiveConst = "active" + LoadBalancerListenerProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerProvisioningStatusFailedConst = "failed" + LoadBalancerListenerProvisioningStatusUpdatePendingConst = "update_pending" +) + +// UnmarshalLoadBalancerListener unmarshals an instance of LoadBalancerListener from the specified map of raw messages. +func UnmarshalLoadBalancerListener(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListener) + err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirect) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerCollection : LoadBalancerListenerCollection struct +type LoadBalancerListenerCollection struct { + // Collection of listeners. + Listeners []LoadBalancerListener `json:"listeners" validate:"required"` +} + +// UnmarshalLoadBalancerListenerCollection unmarshals an instance of LoadBalancerListenerCollection from the specified map of raw messages. +func UnmarshalLoadBalancerListenerCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerCollection) + err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListener) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerHTTPSRedirect : LoadBalancerListenerHTTPSRedirect struct +type LoadBalancerListenerHTTPSRedirect struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + Listener *LoadBalancerListenerReference `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +// UnmarshalLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerHTTPSRedirect from the specified map of raw messages. +func UnmarshalLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerHTTPSRedirect) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerHTTPSRedirectPatch struct +type LoadBalancerListenerHTTPSRedirectPatch struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +// UnmarshalLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerHTTPSRedirectPatch) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerHTTPSRedirectPrototype struct +type LoadBalancerListenerHTTPSRedirectPrototype struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +// NewLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerHTTPSRedirectPrototype, err error) { + _model = &LoadBalancerListenerHTTPSRedirectPrototype{ + HTTPStatusCode: core.Int64Ptr(httpStatusCode), + Listener: listener, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerHTTPSRedirectPrototype) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerIdentity : Identifies a load balancer listener by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerIdentityByID +// - LoadBalancerListenerIdentityByHref +type LoadBalancerListenerIdentity struct { + // The unique identifier for this load balancer listener. + ID *string `json:"id,omitempty"` + + // The listener's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerIdentity) isaLoadBalancerListenerIdentity() bool { + return true +} + +type LoadBalancerListenerIdentityIntf interface { + isaLoadBalancerListenerIdentity() bool +} + +// UnmarshalLoadBalancerListenerIdentity unmarshals an instance of LoadBalancerListenerIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPatch : LoadBalancerListenerPatch struct +type LoadBalancerListenerPatch struct { + // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in + // the `application` family (otherwise always `false`). Additional restrictions: + // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must + // match the `accept_proxy_protocol` value of the `https_redirect` listener. + // - If this listener is the target of another listener's `https_redirect`, its + // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. + AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` + + // The certificate instance to use for SSL termination. The listener must have a + // `protocol` of `https`. + CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The default pool for this listener. The specified pool must: + // + // - Belong to this load balancer + // - Have the same `protocol` as this listener, or have a compatible protocol. + // At present, the compatible protocols are `http` and `https`. + // - Not already be the `default_pool` for another listener + // + // Specify `null` to remove an existing default pool. + DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` + + // The target listener that requests will be redirected to. This listener must have a + // `protocol` of `http`, and the target listener must have a `protocol` of `https`. + // + // Specify `null` to remove any existing https redirect. + HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPatch `json:"https_redirect,omitempty"` + + // The idle connection timeout of the listener in seconds. Supported for load balancers in the `application` family. + IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` + + // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must + // have a unique `port` and `protocol` combination. + // + // Not supported for load balancers operating with route mode enabled. + Port *int64 `json:"port,omitempty"` + + // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `65535` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `1` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMin *int64 `json:"port_min,omitempty"` + + // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. + // + // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http` and + // `https`. + // + // Additional restrictions: + // - If `default_pool` is set, the protocol cannot be changed. + // - If `https_redirect` is set, the protocol must be `http`. + // - If another listener's `https_redirect` targets this listener, the protocol must be + // `https`. + Protocol *string `json:"protocol,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPatch.Protocol property. +// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. +// +// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http` and +// `https`. +// +// Additional restrictions: +// - If `default_pool` is set, the protocol cannot be changed. +// - If `https_redirect` is set, the protocol must be `http`. +// - If another listener's `https_redirect` targets this listener, the protocol must be +// `https`. +const ( + LoadBalancerListenerPatchProtocolHTTPConst = "http" + LoadBalancerListenerPatchProtocolHTTPSConst = "https" + LoadBalancerListenerPatchProtocolTCPConst = "tcp" + LoadBalancerListenerPatchProtocolUDPConst = "udp" +) + +// UnmarshalLoadBalancerListenerPatch unmarshals an instance of LoadBalancerListenerPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPatch) + err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the LoadBalancerListenerPatch +func (loadBalancerListenerPatch *LoadBalancerListenerPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(loadBalancerListenerPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// LoadBalancerListenerPolicy : LoadBalancerListenerPolicy struct +type LoadBalancerListenerPolicy struct { + // The policy action. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the + // unexpected property value was encountered. + Action *string `json:"action" validate:"required"` + + // The date and time that this policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The listener policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The policy's unique identifier. + ID *string `json:"id" validate:"required"` + + // The name for this load balancer listener policy. The name is unique across all policies for the load balancer + // listener. + Name *string `json:"name" validate:"required"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority" validate:"required"` + + // The provisioning status of this policy + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the + // unexpected property value was encountered. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The rules for this policy. + Rules []LoadBalancerListenerPolicyRuleReference `json:"rules" validate:"required"` + + // - If `action` is `forward`, the response is a `LoadBalancerPoolReference` + // - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` + // - If `action` is `https_redirect`, the response is a `LoadBalancerListenerHTTPSRedirect`. + Target LoadBalancerListenerPolicyTargetIntf `json:"target,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPolicy.Action property. +// The policy action. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerPolicyActionForwardConst = "forward" + LoadBalancerListenerPolicyActionHTTPSRedirectConst = "https_redirect" + LoadBalancerListenerPolicyActionRedirectConst = "redirect" + LoadBalancerListenerPolicyActionRejectConst = "reject" +) + +// Constants associated with the LoadBalancerListenerPolicy.ProvisioningStatus property. +// The provisioning status of this policy +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerPolicyProvisioningStatusActiveConst = "active" + LoadBalancerListenerPolicyProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerPolicyProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerPolicyProvisioningStatusFailedConst = "failed" + LoadBalancerListenerPolicyProvisioningStatusUpdatePendingConst = "update_pending" +) + +// UnmarshalLoadBalancerListenerPolicy unmarshals an instance of LoadBalancerListenerPolicy from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicy) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRuleReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTarget) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyCollection : LoadBalancerListenerPolicyCollection struct +type LoadBalancerListenerPolicyCollection struct { + // Collection of policies. + Policies []LoadBalancerListenerPolicy `json:"policies" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyCollection unmarshals an instance of LoadBalancerListenerPolicyCollection from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyCollection) + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyPatch : LoadBalancerListenerPolicyPatch struct +type LoadBalancerListenerPolicyPatch struct { + // The name for this policy. The name must not be used by another policy for the load balancer listener. + Name *string `json:"name,omitempty"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority,omitempty"` + + // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. + // - If `action` is `https_redirect`, specify a + // `LoadBalancerListenerPolicyHTTPSRedirectPatch`. + Target LoadBalancerListenerPolicyTargetPatchIntf `json:"target,omitempty"` +} + +// UnmarshalLoadBalancerListenerPolicyPatch unmarshals an instance of LoadBalancerListenerPolicyPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the LoadBalancerListenerPolicyPatch +func (loadBalancerListenerPolicyPatch *LoadBalancerListenerPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(loadBalancerListenerPolicyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// LoadBalancerListenerPolicyPrototype : LoadBalancerListenerPolicyPrototype struct +type LoadBalancerListenerPolicyPrototype struct { + // The policy action. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the + // unexpected property value was encountered. + Action *string `json:"action" validate:"required"` + + // The name for this policy. The name must not be used by another policy for the load balancer listener. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority" validate:"required"` + + // The rule prototype objects for this policy. + Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` + + // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. + // - If `action` is `https_redirect`, specify a + // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPolicyPrototype.Action property. +// The policy action. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerPolicyPrototypeActionForwardConst = "forward" + LoadBalancerListenerPolicyPrototypeActionHTTPSRedirectConst = "https_redirect" + LoadBalancerListenerPolicyPrototypeActionRedirectConst = "redirect" + LoadBalancerListenerPolicyPrototypeActionRejectConst = "reject" +) + +// NewLoadBalancerListenerPolicyPrototype : Instantiate LoadBalancerListenerPolicyPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyPrototype(action string, priority int64) (_model *LoadBalancerListenerPolicyPrototype, err error) { + _model = &LoadBalancerListenerPolicyPrototype{ + Action: core.StringPtr(action), + Priority: core.Int64Ptr(priority), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerPolicyPrototype unmarshals an instance of LoadBalancerListenerPolicyPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyReference : LoadBalancerListenerPolicyReference struct +type LoadBalancerListenerPolicyReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerListenerPolicyReferenceDeleted `json:"deleted,omitempty"` + + // The listener policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The policy's unique identifier. + ID *string `json:"id" validate:"required"` + + Name interface{} `json:"name" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyReference unmarshals an instance of LoadBalancerListenerPolicyReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerListenerPolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRule : LoadBalancerListenerPolicyRule struct +type LoadBalancerListenerPolicyRule struct { + // The condition of the rule. + Condition *string `json:"condition" validate:"required"` + + // The date and time that this rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this property is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // The rule's canonical URL. + Href *string `json:"href" validate:"required"` + + // The rule's unique identifier. + ID *string `json:"id" validate:"required"` + + // The provisioning status of this rule + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the rule on which the + // unexpected property value was encountered. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type" validate:"required"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerListenerPolicyRule.Condition property. +// The condition of the rule. +const ( + LoadBalancerListenerPolicyRuleConditionContainsConst = "contains" + LoadBalancerListenerPolicyRuleConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRuleConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRule.ProvisioningStatus property. +// The provisioning status of this rule +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the rule on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerPolicyRuleProvisioningStatusActiveConst = "active" + LoadBalancerListenerPolicyRuleProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerPolicyRuleProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerPolicyRuleProvisioningStatusFailedConst = "failed" + LoadBalancerListenerPolicyRuleProvisioningStatusUpdatePendingConst = "update_pending" +) + +// Constants associated with the LoadBalancerListenerPolicyRule.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + LoadBalancerListenerPolicyRuleTypeBodyConst = "body" + LoadBalancerListenerPolicyRuleTypeHeaderConst = "header" + LoadBalancerListenerPolicyRuleTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRuleTypePathConst = "path" + LoadBalancerListenerPolicyRuleTypeQueryConst = "query" +) + +// UnmarshalLoadBalancerListenerPolicyRule unmarshals an instance of LoadBalancerListenerPolicyRule from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRule(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRule) + err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "field", &obj.Field) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRuleCollection : LoadBalancerListenerPolicyRuleCollection struct +type LoadBalancerListenerPolicyRuleCollection struct { + // Collection of rules. + Rules []LoadBalancerListenerPolicyRule `json:"rules" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyRuleCollection unmarshals an instance of LoadBalancerListenerPolicyRuleCollection from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRuleCollection) + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRulePatch : LoadBalancerListenerPolicyRulePatch struct +type LoadBalancerListenerPolicyRulePatch struct { + // The condition of the rule. + Condition *string `json:"condition,omitempty"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this property is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type,omitempty"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPolicyRulePatch.Condition property. +// The condition of the rule. +const ( + LoadBalancerListenerPolicyRulePatchConditionContainsConst = "contains" + LoadBalancerListenerPolicyRulePatchConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRulePatchConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRulePatch.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + LoadBalancerListenerPolicyRulePatchTypeBodyConst = "body" + LoadBalancerListenerPolicyRulePatchTypeHeaderConst = "header" + LoadBalancerListenerPolicyRulePatchTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRulePatchTypePathConst = "path" + LoadBalancerListenerPolicyRulePatchTypeQueryConst = "query" +) + +// UnmarshalLoadBalancerListenerPolicyRulePatch unmarshals an instance of LoadBalancerListenerPolicyRulePatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRulePatch) + err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "field", &obj.Field) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the LoadBalancerListenerPolicyRulePatch +func (loadBalancerListenerPolicyRulePatch *LoadBalancerListenerPolicyRulePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(loadBalancerListenerPolicyRulePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// LoadBalancerListenerPolicyRulePrototype : LoadBalancerListenerPolicyRulePrototype struct +type LoadBalancerListenerPolicyRulePrototype struct { + // The condition of the rule. + Condition *string `json:"condition" validate:"required"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this property is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type" validate:"required"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Condition property. +// The condition of the rule. +const ( + LoadBalancerListenerPolicyRulePrototypeConditionContainsConst = "contains" + LoadBalancerListenerPolicyRulePrototypeConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRulePrototypeConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + LoadBalancerListenerPolicyRulePrototypeTypeBodyConst = "body" + LoadBalancerListenerPolicyRulePrototypeTypeHeaderConst = "header" + LoadBalancerListenerPolicyRulePrototypeTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRulePrototypeTypePathConst = "path" + LoadBalancerListenerPolicyRulePrototypeTypeQueryConst = "query" +) + +// NewLoadBalancerListenerPolicyRulePrototype : Instantiate LoadBalancerListenerPolicyRulePrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyRulePrototype(condition string, typeVar string, value string) (_model *LoadBalancerListenerPolicyRulePrototype, err error) { + _model = &LoadBalancerListenerPolicyRulePrototype{ + Condition: core.StringPtr(condition), + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerPolicyRulePrototype unmarshals an instance of LoadBalancerListenerPolicyRulePrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRulePrototype) + err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "field", &obj.Field) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRuleReference : LoadBalancerListenerPolicyRuleReference struct +type LoadBalancerListenerPolicyRuleReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerListenerPolicyRuleReferenceDeleted `json:"deleted,omitempty"` + + // The rule's canonical URL. + Href *string `json:"href" validate:"required"` + + // The rule's unique identifier. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyRuleReference unmarshals an instance of LoadBalancerListenerPolicyRuleReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRuleReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerListenerPolicyRuleReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyRuleReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRuleReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTarget : - If `action` is `forward`, the response is a `LoadBalancerPoolReference` +// - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` +// - If `action` is `https_redirect`, the response is a `LoadBalancerListenerHTTPSRedirect`. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetLoadBalancerPoolReference +// - LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL +// - LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect +type LoadBalancerListenerPolicyTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The name for this load balancer pool. The name is unique across all pools for the load balancer. + Name *string `json:"name,omitempty"` + + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` + + Listener *LoadBalancerListenerReference `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTarget) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +type LoadBalancerListenerPolicyTargetIntf interface { + isaLoadBalancerListenerPolicyTarget() bool +} + +// UnmarshalLoadBalancerListenerPolicyTarget unmarshals an instance of LoadBalancerListenerPolicyTarget from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatch : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. +// - If `action` is `https_redirect`, specify a +// `LoadBalancerListenerPolicyHTTPSRedirectPatch`. +// +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch +type LoadBalancerListenerPolicyTargetPatch struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` + + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPatchIntf interface { + isaLoadBalancerListenerPolicyTargetPatch() bool +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototype : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. +// - If `action` is `https_redirect`, specify a +// `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. +// +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype +type LoadBalancerListenerPolicyTargetPrototype struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` + + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPrototypeIntf interface { + isaLoadBalancerListenerPolicyTargetPrototype() bool +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPrototypeLoadBalancerContext : LoadBalancerListenerPrototypeLoadBalancerContext struct +type LoadBalancerListenerPrototypeLoadBalancerContext struct { + // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in + // the `application` family (otherwise always `false`). Additional restrictions: + // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must + // match the `accept_proxy_protocol` value of the `https_redirect` listener. + // - If this listener is the target of another listener's `https_redirect`, its + // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. + AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` + + // The certificate instance to use for SSL termination. The listener must have a + // `protocol` of `https`. + CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The default pool for this listener. If specified, the pool must: + // - Belong to this load balancer. + // - Have the same `protocol` as this listener, or have a compatible protocol. + // At present, the compatible protocols are `http` and `https`. + // - Not already be the `default_pool` for another listener. + // + // If unspecified, this listener will be created with no default pool, but one may be + // subsequently set. + DefaultPool *LoadBalancerPoolIdentityByName `json:"default_pool,omitempty"` + + // The target listener that requests will be redirected to. This listener must have a + // `protocol` of `http`, and the target listener must have a `protocol` of `https`. + HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPrototype `json:"https_redirect,omitempty"` + + // The idle connection timeout of the listener in seconds. Supported for load balancers in the `application` family. + IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` + + // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must + // have a unique `port` and `protocol` combination. + // + // Not supported for load balancers operating with route mode enabled. + Port *int64 `json:"port,omitempty"` + + // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `65535` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `1` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMin *int64 `json:"port_min,omitempty"` + + // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. + // + // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http` and + // `https`. + // + // Additional restrictions: + // - If `default_pool` is set, the pool's protocol must match, or be compatible with + // the listener's protocol. At present, the compatible protocols are `http` and + // `https`. + // - If `https_redirect` is set, the protocol must be `http`. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the LoadBalancerListenerPrototypeLoadBalancerContext.Protocol property. +// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. +// +// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http` and +// `https`. +// +// Additional restrictions: +// - If `default_pool` is set, the pool's protocol must match, or be compatible with +// the listener's protocol. At present, the compatible protocols are `http` and +// `https`. +// - If `https_redirect` is set, the protocol must be `http`. +const ( + LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPConst = "http" + LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPSConst = "https" + LoadBalancerListenerPrototypeLoadBalancerContextProtocolTCPConst = "tcp" + LoadBalancerListenerPrototypeLoadBalancerContextProtocolUDPConst = "udp" +) + +// NewLoadBalancerListenerPrototypeLoadBalancerContext : Instantiate LoadBalancerListenerPrototypeLoadBalancerContext (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPrototypeLoadBalancerContext(protocol string) (_model *LoadBalancerListenerPrototypeLoadBalancerContext, err error) { + _model = &LoadBalancerListenerPrototypeLoadBalancerContext{ + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext unmarshals an instance of LoadBalancerListenerPrototypeLoadBalancerContext from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPrototypeLoadBalancerContext) + err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentityByName) + if err != nil { + return + } + err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerReference : LoadBalancerListenerReference struct +type LoadBalancerListenerReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerListenerReferenceDeleted `json:"deleted,omitempty"` + + // The listener's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerListenerReference unmarshals an instance of LoadBalancerListenerReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerListenerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerListenerReferenceDeleted unmarshals an instance of LoadBalancerListenerReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerListenerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLogging : LoadBalancerLogging struct +type LoadBalancerLogging struct { + // The datapath logging configuration for this load balancer. + Datapath *LoadBalancerLoggingDatapath `json:"datapath" validate:"required"` +} + +// UnmarshalLoadBalancerLogging unmarshals an instance of LoadBalancerLogging from the specified map of raw messages. +func UnmarshalLoadBalancerLogging(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLogging) + err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingDatapath : The datapath logging configuration for this load balancer. +type LoadBalancerLoggingDatapath struct { + // Indicates whether datapath logging is active for this load balancer. + Active *bool `json:"active" validate:"required"` +} + +// UnmarshalLoadBalancerLoggingDatapath unmarshals an instance of LoadBalancerLoggingDatapath from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingDatapath(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingDatapath) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingDatapathPatch : The datapath logging configuration for this load balancer. +type LoadBalancerLoggingDatapathPatch struct { + // Indicates whether datapath logging will be active for this load balancer. + Active *bool `json:"active,omitempty"` +} + +// UnmarshalLoadBalancerLoggingDatapathPatch unmarshals an instance of LoadBalancerLoggingDatapathPatch from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingDatapathPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingDatapathPatch) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingDatapathPrototype : The datapath logging configuration for this load balancer. +type LoadBalancerLoggingDatapathPrototype struct { + // Indicates whether datapath logging will be active for this load balancer. + Active *bool `json:"active,omitempty"` +} + +// UnmarshalLoadBalancerLoggingDatapathPrototype unmarshals an instance of LoadBalancerLoggingDatapathPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingDatapathPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingDatapathPrototype) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingPatch : LoadBalancerLoggingPatch struct +type LoadBalancerLoggingPatch struct { + // The datapath logging configuration for this load balancer. + Datapath *LoadBalancerLoggingDatapathPatch `json:"datapath,omitempty"` +} + +// UnmarshalLoadBalancerLoggingPatch unmarshals an instance of LoadBalancerLoggingPatch from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingPatch) + err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingPrototype : LoadBalancerLoggingPrototype struct +type LoadBalancerLoggingPrototype struct { + // The datapath logging configuration for this load balancer. + Datapath *LoadBalancerLoggingDatapathPrototype `json:"datapath,omitempty"` +} + +// UnmarshalLoadBalancerLoggingPrototype unmarshals an instance of LoadBalancerLoggingPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingPrototype) + err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPatch : LoadBalancerPatch struct +type LoadBalancerPatch struct { + // The DNS configuration for this load balancer. + // + // Specify `null` to remove the existing DNS configuration, which will remove all DNS `A` + // records for this load balancer that had been added to `zone`, and add equivalent `A` + // records to the public DNS zone `lb.appdomain.cloud`. + Dns *LoadBalancerDnsPatch `json:"dns,omitempty"` + + // The logging configuration to use for this load balancer. + // + // To activate logging, the load balancer profile must support the specified logging type. + Logging *LoadBalancerLoggingPatch `json:"logging,omitempty"` + + // The name for this load balancer. The name must not be used by another load balancer in the VPC. + Name *string `json:"name,omitempty"` + + // The subnets to provision this load balancer in. The load balancer's availability will depend on the availability of + // the zones that the subnets reside in. + // + // The specified subnets must be in the same VPC as the existing subnets, and will completely replace the existing + // subnets. + // + // The load balancer must be in the `application` family. + Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` +} + +// UnmarshalLoadBalancerPatch unmarshals an instance of LoadBalancerPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPatch) + err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalLoadBalancerDnsPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLoggingPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the LoadBalancerPatch +func (loadBalancerPatch *LoadBalancerPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(loadBalancerPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// LoadBalancerPool : LoadBalancerPool struct +type LoadBalancerPool struct { + // The load balancing algorithm. + Algorithm *string `json:"algorithm" validate:"required"` + + // The date and time that this pool was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitor `json:"health_monitor" validate:"required"` + + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` + + // The instance group that is managing this pool. + InstanceGroup *InstanceGroupReference `json:"instance_group,omitempty"` + + // The backend server members of the pool. + Members []LoadBalancerPoolMemberReference `json:"members,omitempty"` + + // The name for this load balancer pool. The name is unique across all pools for the load balancer. + Name *string `json:"name" validate:"required"` + + // The protocol for this load balancer pool. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the + // unexpected property value was encountered. + Protocol *string `json:"protocol" validate:"required"` + + // The provisioning status of this pool + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the + // unexpected property value was encountered. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol" validate:"required"` + + // The session persistence of this pool. + // + // The enumerated values for this property are expected to expand in the future. When + // processing this property, check for and log unknown values. Optionally halt + // processing and surface the error, or bypass the pool on which the unexpected + // property value was encountered. + SessionPersistence *LoadBalancerPoolSessionPersistence `json:"session_persistence,omitempty"` +} + +// Constants associated with the LoadBalancerPool.Algorithm property. +// The load balancing algorithm. +const ( + LoadBalancerPoolAlgorithmLeastConnectionsConst = "least_connections" + LoadBalancerPoolAlgorithmRoundRobinConst = "round_robin" + LoadBalancerPoolAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the LoadBalancerPool.Protocol property. +// The protocol for this load balancer pool. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the +// unexpected property value was encountered. +const ( + LoadBalancerPoolProtocolHTTPConst = "http" + LoadBalancerPoolProtocolHTTPSConst = "https" + LoadBalancerPoolProtocolTCPConst = "tcp" + LoadBalancerPoolProtocolUDPConst = "udp" +) + +// Constants associated with the LoadBalancerPool.ProvisioningStatus property. +// The provisioning status of this pool +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the +// unexpected property value was encountered. +const ( + LoadBalancerPoolProvisioningStatusActiveConst = "active" + LoadBalancerPoolProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerPoolProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerPoolProvisioningStatusFailedConst = "failed" + LoadBalancerPoolProvisioningStatusUpdatePendingConst = "update_pending" +) + +// Constants associated with the LoadBalancerPool.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + LoadBalancerPoolProxyProtocolDisabledConst = "disabled" + LoadBalancerPoolProxyProtocolV1Const = "v1" + LoadBalancerPoolProxyProtocolV2Const = "v2" +) + +// UnmarshalLoadBalancerPool unmarshals an instance of LoadBalancerPool from the specified map of raw messages. +func UnmarshalLoadBalancerPool(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPool) + err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitor) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_group", &obj.InstanceGroup, UnmarshalInstanceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistence) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolCollection : LoadBalancerPoolCollection struct +type LoadBalancerPoolCollection struct { + // Collection of pools. + Pools []LoadBalancerPool `json:"pools" validate:"required"` +} + +// UnmarshalLoadBalancerPoolCollection unmarshals an instance of LoadBalancerPoolCollection from the specified map of raw messages. +func UnmarshalLoadBalancerPoolCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolCollection) + err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPool) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolHealthMonitor : LoadBalancerPoolHealthMonitor struct +type LoadBalancerPoolHealthMonitor struct { + // The seconds to wait between health checks. + Delay *int64 `json:"delay" validate:"required"` + + // The health check max retries. + MaxRetries *int64 `json:"max_retries" validate:"required"` + + // The health check port. + // + // If present, this overrides the pool member port values. + Port *int64 `json:"port,omitempty"` + + // The seconds to wait for a response to a health check. + Timeout *int64 `json:"timeout" validate:"required"` + + // The protocol type to use for health checks. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which + // the unexpected property value was encountered. + Type *string `json:"type" validate:"required"` + + // The health check URL path. Applicable when `type` is `http` or `https`. + // + // Must be in the format of an [origin-form request target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + URLPath *string `json:"url_path,omitempty"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitor.Type property. +// The protocol type to use for health checks. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which +// the unexpected property value was encountered. +const ( + LoadBalancerPoolHealthMonitorTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorTypeHTTPSConst = "https" + LoadBalancerPoolHealthMonitorTypeTCPConst = "tcp" +) + +// UnmarshalLoadBalancerPoolHealthMonitor unmarshals an instance of LoadBalancerPoolHealthMonitor from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitor(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitor) + err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolHealthMonitorPatch : LoadBalancerPoolHealthMonitorPatch struct +type LoadBalancerPoolHealthMonitorPatch struct { + // The seconds to wait between health checks. Must be greater than `timeout`. + Delay *int64 `json:"delay" validate:"required"` + + // The health check max retries. + MaxRetries *int64 `json:"max_retries" validate:"required"` + + // The health check port. + // + // If set, this overrides the pool member port values. + // + // Specify `null` to remove an existing health check port. + Port *int64 `json:"port,omitempty"` + + // The seconds to wait for a response to a health check. Must be less than `delay`. + Timeout *int64 `json:"timeout" validate:"required"` + + // The protocol type to use for health checks. + Type *string `json:"type" validate:"required"` + + // The health check URL path. Applicable when `type` is `http` or `https`. + // + // Must be in the format of an [origin-form request target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + URLPath *string `json:"url_path,omitempty"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitorPatch.Type property. +// The protocol type to use for health checks. +const ( + LoadBalancerPoolHealthMonitorPatchTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorPatchTypeHTTPSConst = "https" + LoadBalancerPoolHealthMonitorPatchTypeTCPConst = "tcp" +) + +// NewLoadBalancerPoolHealthMonitorPatch : Instantiate LoadBalancerPoolHealthMonitorPatch (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolHealthMonitorPatch(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPatch, err error) { + _model = &LoadBalancerPoolHealthMonitorPatch{ + Delay: core.Int64Ptr(delay), + MaxRetries: core.Int64Ptr(maxRetries), + Timeout: core.Int64Ptr(timeout), + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolHealthMonitorPatch unmarshals an instance of LoadBalancerPoolHealthMonitorPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitorPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitorPatch) + err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolHealthMonitorPrototype : LoadBalancerPoolHealthMonitorPrototype struct +type LoadBalancerPoolHealthMonitorPrototype struct { + // The seconds to wait between health checks. Must be greater than `timeout`. + Delay *int64 `json:"delay" validate:"required"` + + // The health check max retries. + MaxRetries *int64 `json:"max_retries" validate:"required"` + + // The health check port. + // + // If specified, this overrides the pool member port values. + Port *int64 `json:"port,omitempty"` + + // The seconds to wait for a response to a health check. Must be less than `delay`. + Timeout *int64 `json:"timeout" validate:"required"` + + // The protocol type to use for health checks. + Type *string `json:"type" validate:"required"` + + // The health check URL path. Applicable when `type` is `http` or `https`. + // + // Must be in the format of an [origin-form request target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + URLPath *string `json:"url_path,omitempty"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitorPrototype.Type property. +// The protocol type to use for health checks. +const ( + LoadBalancerPoolHealthMonitorPrototypeTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorPrototypeTypeHTTPSConst = "https" + LoadBalancerPoolHealthMonitorPrototypeTypeTCPConst = "tcp" +) + +// NewLoadBalancerPoolHealthMonitorPrototype : Instantiate LoadBalancerPoolHealthMonitorPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolHealthMonitorPrototype(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPrototype, err error) { + _model = &LoadBalancerPoolHealthMonitorPrototype{ + Delay: core.Int64Ptr(delay), + MaxRetries: core.Int64Ptr(maxRetries), + Timeout: core.Int64Ptr(timeout), + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolHealthMonitorPrototype unmarshals an instance of LoadBalancerPoolHealthMonitorPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitorPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitorPrototype) + err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerPoolIdentityByID +// - LoadBalancerPoolIdentityByHref +type LoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerPoolIdentity) isaLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerPoolIdentityIntf interface { + isaLoadBalancerPoolIdentity() bool +} + +// UnmarshalLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityByName : LoadBalancerPoolIdentityByName struct +type LoadBalancerPoolIdentityByName struct { + // The name for this load balancer pool. The name is unique across all pools for the load balancer. + Name *string `json:"name" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByName : Instantiate LoadBalancerPoolIdentityByName (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByName(name string) (_model *LoadBalancerPoolIdentityByName, err error) { + _model = &LoadBalancerPoolIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolIdentityByName unmarshals an instance of LoadBalancerPoolIdentityByName from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMember : LoadBalancerPoolMember struct +type LoadBalancerPoolMember struct { + // The date and time that this member was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // Health of the server member in the pool. + Health *string `json:"health" validate:"required"` + + // The member's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool member. + ID *string `json:"id" validate:"required"` + + // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a + // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive + // the traffic on the same port the listener received it on.) + // + // This port will also be used for health checks unless the `port` property of + // `health_monitor` property is specified. + Port *int64 `json:"port" validate:"required"` + + // The provisioning status of this member + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool member on which the + // unexpected property value was encountered. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. + Target LoadBalancerPoolMemberTargetIntf `json:"target" validate:"required"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` +} + +// Constants associated with the LoadBalancerPoolMember.Health property. +// Health of the server member in the pool. +const ( + LoadBalancerPoolMemberHealthFaultedConst = "faulted" + LoadBalancerPoolMemberHealthOkConst = "ok" + LoadBalancerPoolMemberHealthUnknownConst = "unknown" +) + +// Constants associated with the LoadBalancerPoolMember.ProvisioningStatus property. +// The provisioning status of this member +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool member on which the +// unexpected property value was encountered. +const ( + LoadBalancerPoolMemberProvisioningStatusActiveConst = "active" + LoadBalancerPoolMemberProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerPoolMemberProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerPoolMemberProvisioningStatusFailedConst = "failed" + LoadBalancerPoolMemberProvisioningStatusUpdatePendingConst = "update_pending" +) + +// UnmarshalLoadBalancerPoolMember unmarshals an instance of LoadBalancerPoolMember from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMember(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMember) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health", &obj.Health) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTarget) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberCollection : LoadBalancerPoolMemberCollection struct +type LoadBalancerPoolMemberCollection struct { + // Collection of members. + Members []LoadBalancerPoolMember `json:"members" validate:"required"` +} + +// UnmarshalLoadBalancerPoolMemberCollection unmarshals an instance of LoadBalancerPoolMemberCollection from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberCollection) + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberPatch : LoadBalancerPoolMemberPatch struct +type LoadBalancerPoolMemberPatch struct { + // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a + // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive + // the traffic on the same port the listener received it on.) + // + // This port will also be used for health checks unless the `port` property of + // `health_monitor` property is specified. + // + // The port must be unique across all members for all pools associated with this pool's listener. + Port *int64 `json:"port,omitempty"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target,omitempty"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` +} + +// UnmarshalLoadBalancerPoolMemberPatch unmarshals an instance of LoadBalancerPoolMemberPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberPatch) + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the LoadBalancerPoolMemberPatch +func (loadBalancerPoolMemberPatch *LoadBalancerPoolMemberPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(loadBalancerPoolMemberPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// LoadBalancerPoolMemberPrototype : LoadBalancerPoolMemberPrototype struct +type LoadBalancerPoolMemberPrototype struct { + // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a + // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive + // the traffic on the same port the listener received it on.) + // + // This port will also be used for health checks unless the `port` property of + // `health_monitor` property is specified. + // + // The port must be unique across all members for all pools associated with this pool's listener. + Port *int64 `json:"port" validate:"required"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` +} + +// NewLoadBalancerPoolMemberPrototype : Instantiate LoadBalancerPoolMemberPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberPrototype(port int64, target LoadBalancerPoolMemberTargetPrototypeIntf) (_model *LoadBalancerPoolMemberPrototype, err error) { + _model = &LoadBalancerPoolMemberPrototype{ + Port: core.Int64Ptr(port), + Target: target, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolMemberPrototype unmarshals an instance of LoadBalancerPoolMemberPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberPrototype) + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberReference : LoadBalancerPoolMemberReference struct +type LoadBalancerPoolMemberReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerPoolMemberReferenceDeleted `json:"deleted,omitempty"` + + // The member's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool member. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerPoolMemberReference unmarshals an instance of LoadBalancerPoolMemberReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolMemberReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerPoolMemberReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerPoolMemberReferenceDeleted unmarshals an instance of LoadBalancerPoolMemberReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTarget : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in +// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a +// zone the load balancer has a subnet in. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetInstanceReference +// - LoadBalancerPoolMemberTargetIP +type LoadBalancerPoolMemberTarget struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. + Name *string `json:"name,omitempty"` + + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` +} + +func (*LoadBalancerPoolMemberTarget) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +type LoadBalancerPoolMemberTargetIntf interface { + isaLoadBalancerPoolMemberTarget() bool +} + +// UnmarshalLoadBalancerPoolMemberTarget unmarshals an instance of LoadBalancerPoolMemberTarget from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototype : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in +// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a +// zone the load balancer has a subnet in. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +// - LoadBalancerPoolMemberTargetPrototypeIP +type LoadBalancerPoolMemberTargetPrototype struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` + + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` +} + +func (*LoadBalancerPoolMemberTargetPrototype) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +type LoadBalancerPoolMemberTargetPrototypeIntf interface { + isaLoadBalancerPoolMemberTargetPrototype() bool +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototype unmarshals an instance of LoadBalancerPoolMemberTargetPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolPatch : LoadBalancerPoolPatch struct +type LoadBalancerPoolPatch struct { + // The load balancing algorithm. + Algorithm *string `json:"algorithm,omitempty"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitorPatch `json:"health_monitor,omitempty"` + + // The name for this load balancer pool. The name must not be used by another pool for the load balancer. + Name *string `json:"name,omitempty"` + + // The protocol for this load balancer pool. + // + // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http` and + // `https`. + // + // If this pool is associated with a load balancer listener, the specified protocol must match, or be compatible with + // the listener's protocol. At present, the compatible protocols are `http` and `https`. + Protocol *string `json:"protocol,omitempty"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol,omitempty"` + + // The session persistence of this pool. + SessionPersistence *LoadBalancerPoolSessionPersistencePatch `json:"session_persistence,omitempty"` +} + +// Constants associated with the LoadBalancerPoolPatch.Algorithm property. +// The load balancing algorithm. +const ( + LoadBalancerPoolPatchAlgorithmLeastConnectionsConst = "least_connections" + LoadBalancerPoolPatchAlgorithmRoundRobinConst = "round_robin" + LoadBalancerPoolPatchAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the LoadBalancerPoolPatch.Protocol property. +// The protocol for this load balancer pool. +// +// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http` and +// `https`. +// +// If this pool is associated with a load balancer listener, the specified protocol must match, or be compatible with +// the listener's protocol. At present, the compatible protocols are `http` and `https`. +const ( + LoadBalancerPoolPatchProtocolHTTPConst = "http" + LoadBalancerPoolPatchProtocolHTTPSConst = "https" + LoadBalancerPoolPatchProtocolTCPConst = "tcp" + LoadBalancerPoolPatchProtocolUDPConst = "udp" +) + +// Constants associated with the LoadBalancerPoolPatch.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + LoadBalancerPoolPatchProxyProtocolDisabledConst = "disabled" + LoadBalancerPoolPatchProxyProtocolV1Const = "v1" + LoadBalancerPoolPatchProxyProtocolV2Const = "v2" +) + +// UnmarshalLoadBalancerPoolPatch unmarshals an instance of LoadBalancerPoolPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolPatch) + err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the LoadBalancerPoolPatch +func (loadBalancerPoolPatch *LoadBalancerPoolPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(loadBalancerPoolPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// LoadBalancerPoolPrototype : LoadBalancerPoolPrototype struct +type LoadBalancerPoolPrototype struct { + // The load balancing algorithm. + Algorithm *string `json:"algorithm" validate:"required"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitorPrototype `json:"health_monitor" validate:"required"` + + // The members for this load balancer pool. For load balancers in the `network` family, the same `port` and `target` + // tuple cannot be shared by a pool member of any other load balancer in the same VPC. + Members []LoadBalancerPoolMemberPrototype `json:"members,omitempty"` + + // The name for this load balancer pool. The name must not be used by another pool for the load balancer. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if + // `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http`, and `https`. + Protocol *string `json:"protocol" validate:"required"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol,omitempty"` + + // The session persistence of this pool. + SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` +} + +// Constants associated with the LoadBalancerPoolPrototype.Algorithm property. +// The load balancing algorithm. +const ( + LoadBalancerPoolPrototypeAlgorithmLeastConnectionsConst = "least_connections" + LoadBalancerPoolPrototypeAlgorithmRoundRobinConst = "round_robin" + LoadBalancerPoolPrototypeAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the LoadBalancerPoolPrototype.Protocol property. +// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if +// `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http`, and `https`. +const ( + LoadBalancerPoolPrototypeProtocolHTTPConst = "http" + LoadBalancerPoolPrototypeProtocolHTTPSConst = "https" + LoadBalancerPoolPrototypeProtocolTCPConst = "tcp" + LoadBalancerPoolPrototypeProtocolUDPConst = "udp" +) + +// Constants associated with the LoadBalancerPoolPrototype.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + LoadBalancerPoolPrototypeProxyProtocolDisabledConst = "disabled" + LoadBalancerPoolPrototypeProxyProtocolV1Const = "v1" + LoadBalancerPoolPrototypeProxyProtocolV2Const = "v2" +) + +// NewLoadBalancerPoolPrototype : Instantiate LoadBalancerPoolPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolPrototype(algorithm string, healthMonitor *LoadBalancerPoolHealthMonitorPrototype, protocol string) (_model *LoadBalancerPoolPrototype, err error) { + _model = &LoadBalancerPoolPrototype{ + Algorithm: core.StringPtr(algorithm), + HealthMonitor: healthMonitor, + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolPrototype unmarshals an instance of LoadBalancerPoolPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolPrototype) + err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolReference : LoadBalancerPoolReference struct +type LoadBalancerPoolReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` + + // The name for this load balancer pool. The name is unique across all pools for the load balancer. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalLoadBalancerPoolReference unmarshals an instance of LoadBalancerPoolReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerPoolReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerPoolReferenceDeleted unmarshals an instance of LoadBalancerPoolReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerPoolReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolSessionPersistence : LoadBalancerPoolSessionPersistence struct +type LoadBalancerPoolSessionPersistence struct { + // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not + // allowed. + CookieName *string `json:"cookie_name,omitempty"` + + // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` + // protocols. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistence.Type property. +// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` +// protocols. +const ( + LoadBalancerPoolSessionPersistenceTypeAppCookieConst = "app_cookie" + LoadBalancerPoolSessionPersistenceTypeHTTPCookieConst = "http_cookie" + LoadBalancerPoolSessionPersistenceTypeSourceIPConst = "source_ip" +) + +// UnmarshalLoadBalancerPoolSessionPersistence unmarshals an instance of LoadBalancerPoolSessionPersistence from the specified map of raw messages. +func UnmarshalLoadBalancerPoolSessionPersistence(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolSessionPersistence) + err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolSessionPersistencePatch : The session persistence configuration. Specify `null` to remove any existing session persistence configuration. +type LoadBalancerPoolSessionPersistencePatch struct { + // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not + // allowed. + CookieName *string `json:"cookie_name,omitempty"` + + // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` + // protocols. + Type *string `json:"type,omitempty"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistencePatch.Type property. +// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` +// protocols. +const ( + LoadBalancerPoolSessionPersistencePatchTypeAppCookieConst = "app_cookie" + LoadBalancerPoolSessionPersistencePatchTypeHTTPCookieConst = "http_cookie" + LoadBalancerPoolSessionPersistencePatchTypeSourceIPConst = "source_ip" +) + +// UnmarshalLoadBalancerPoolSessionPersistencePatch unmarshals an instance of LoadBalancerPoolSessionPersistencePatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolSessionPersistencePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolSessionPersistencePatch) + err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolSessionPersistencePrototype : LoadBalancerPoolSessionPersistencePrototype struct +type LoadBalancerPoolSessionPersistencePrototype struct { + // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not + // allowed. + CookieName *string `json:"cookie_name,omitempty"` + + // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` + // protocols. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistencePrototype.Type property. +// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` +// protocols. +const ( + LoadBalancerPoolSessionPersistencePrototypeTypeAppCookieConst = "app_cookie" + LoadBalancerPoolSessionPersistencePrototypeTypeHTTPCookieConst = "http_cookie" + LoadBalancerPoolSessionPersistencePrototypeTypeSourceIPConst = "source_ip" +) + +// NewLoadBalancerPoolSessionPersistencePrototype : Instantiate LoadBalancerPoolSessionPersistencePrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolSessionPersistencePrototype(typeVar string) (_model *LoadBalancerPoolSessionPersistencePrototype, err error) { + _model = &LoadBalancerPoolSessionPersistencePrototype{ + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolSessionPersistencePrototype unmarshals an instance of LoadBalancerPoolSessionPersistencePrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolSessionPersistencePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolSessionPersistencePrototype) + err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPrivateIpsItem : LoadBalancerPrivateIpsItem struct +type LoadBalancerPrivateIpsItem struct { + // The IP address. + // + // If the address has not yet been selected, the value will be `0.0.0.0`. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` + + // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the LoadBalancerPrivateIpsItem.ResourceType property. +// The resource type. +const ( + LoadBalancerPrivateIpsItemResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" +) + +// UnmarshalLoadBalancerPrivateIpsItem unmarshals an instance of LoadBalancerPrivateIpsItem from the specified map of raw messages. +func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPrivateIpsItem) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfile : LoadBalancerProfile struct +type LoadBalancerProfile struct { + // The product family this load balancer profile belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` + + InstanceGroupsSupported LoadBalancerProfileInstanceGroupsSupportedIntf `json:"instance_groups_supported" validate:"required"` + + // Indicates which logging type(s) are supported for a load balancer with this profile. + LoggingSupported *LoadBalancerProfileLoggingSupported `json:"logging_supported" validate:"required"` + + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` + + RouteModeSupported LoadBalancerProfileRouteModeSupportedIntf `json:"route_mode_supported" validate:"required"` + + SecurityGroupsSupported LoadBalancerProfileSecurityGroupsSupportedIntf `json:"security_groups_supported" validate:"required"` + + UDPSupported LoadBalancerProfileUDPSupportedIntf `json:"udp_supported" validate:"required"` +} + +// UnmarshalLoadBalancerProfile unmarshals an instance of LoadBalancerProfile from the specified map of raw messages. +func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfile) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_groups_supported", &obj.InstanceGroupsSupported, UnmarshalLoadBalancerProfileInstanceGroupsSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "logging_supported", &obj.LoggingSupported, UnmarshalLoadBalancerProfileLoggingSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "route_mode_supported", &obj.RouteModeSupported, UnmarshalLoadBalancerProfileRouteModeSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups_supported", &obj.SecurityGroupsSupported, UnmarshalLoadBalancerProfileSecurityGroupsSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "udp_supported", &obj.UDPSupported, UnmarshalLoadBalancerProfileUDPSupported) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileCollection : LoadBalancerProfileCollection struct +type LoadBalancerProfileCollection struct { + // A link to the first page of resources. + First *LoadBalancerProfileCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *LoadBalancerProfileCollectionNext `json:"next,omitempty"` + + // Collection of load balancer profiles. + Profiles []LoadBalancerProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalLoadBalancerProfileCollection unmarshals an instance of LoadBalancerProfileCollection from the specified map of raw messages. +func UnmarshalLoadBalancerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalLoadBalancerProfileCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalLoadBalancerProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *LoadBalancerProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// LoadBalancerProfileCollectionFirst : A link to the first page of resources. +type LoadBalancerProfileCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalLoadBalancerProfileCollectionFirst unmarshals an instance of LoadBalancerProfileCollectionFirst from the specified map of raw messages. +func UnmarshalLoadBalancerProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type LoadBalancerProfileCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalLoadBalancerProfileCollectionNext unmarshals an instance of LoadBalancerProfileCollectionNext from the specified map of raw messages. +func UnmarshalLoadBalancerProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileIdentity : Identifies a load balancer profile by a unique property. +// Models which "extend" this model: +// - LoadBalancerProfileIdentityByName +// - LoadBalancerProfileIdentityByHref +type LoadBalancerProfileIdentity struct { + // The globally unique name for this load balancer profile. + Name *string `json:"name,omitempty"` + + // The URL for this load balancer profile. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerProfileIdentity) isaLoadBalancerProfileIdentity() bool { + return true +} + +type LoadBalancerProfileIdentityIntf interface { + isaLoadBalancerProfileIdentity() bool +} + +// UnmarshalLoadBalancerProfileIdentity unmarshals an instance of LoadBalancerProfileIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileInstanceGroupsSupported : LoadBalancerProfileInstanceGroupsSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileInstanceGroupsSupportedFixed +// - LoadBalancerProfileInstanceGroupsSupportedDependent +type LoadBalancerProfileInstanceGroupsSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileInstanceGroupsSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileInstanceGroupsSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileInstanceGroupsSupported) isaLoadBalancerProfileInstanceGroupsSupported() bool { + return true +} + +type LoadBalancerProfileInstanceGroupsSupportedIntf interface { + isaLoadBalancerProfileInstanceGroupsSupported() bool +} + +// UnmarshalLoadBalancerProfileInstanceGroupsSupported unmarshals an instance of LoadBalancerProfileInstanceGroupsSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileInstanceGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileInstanceGroupsSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileLoggingSupported : Indicates which logging type(s) are supported for a load balancer with this profile. +type LoadBalancerProfileLoggingSupported struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported logging type(s) for a load balancer with this profile. + Value []string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileLoggingSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileLoggingSupportedTypeFixedConst = "fixed" +) + +// UnmarshalLoadBalancerProfileLoggingSupported unmarshals an instance of LoadBalancerProfileLoggingSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileLoggingSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileReference : LoadBalancerProfileReference struct +type LoadBalancerProfileReference struct { + // The product family this load balancer profile belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalLoadBalancerProfileReference unmarshals an instance of LoadBalancerProfileReference from the specified map of raw messages. +func UnmarshalLoadBalancerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileReference) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileRouteModeSupported : LoadBalancerProfileRouteModeSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileRouteModeSupportedFixed +// - LoadBalancerProfileRouteModeSupportedDependent +type LoadBalancerProfileRouteModeSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileRouteModeSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileRouteModeSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileRouteModeSupported) isaLoadBalancerProfileRouteModeSupported() bool { + return true +} + +type LoadBalancerProfileRouteModeSupportedIntf interface { + isaLoadBalancerProfileRouteModeSupported() bool +} + +// UnmarshalLoadBalancerProfileRouteModeSupported unmarshals an instance of LoadBalancerProfileRouteModeSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileRouteModeSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileRouteModeSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileSecurityGroupsSupported : LoadBalancerProfileSecurityGroupsSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileSecurityGroupsSupportedFixed +// - LoadBalancerProfileSecurityGroupsSupportedDependent +type LoadBalancerProfileSecurityGroupsSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileSecurityGroupsSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileSecurityGroupsSupported) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +type LoadBalancerProfileSecurityGroupsSupportedIntf interface { + isaLoadBalancerProfileSecurityGroupsSupported() bool +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupported unmarshals an instance of LoadBalancerProfileSecurityGroupsSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileUDPSupported : LoadBalancerProfileUDPSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileUDPSupportedFixed +// - LoadBalancerProfileUDPSupportedDependent +type LoadBalancerProfileUDPSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileUDPSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileUDPSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileUDPSupported) isaLoadBalancerProfileUDPSupported() bool { + return true +} + +type LoadBalancerProfileUDPSupportedIntf interface { + isaLoadBalancerProfileUDPSupported() bool +} + +// UnmarshalLoadBalancerProfileUDPSupported unmarshals an instance of LoadBalancerProfileUDPSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileUDPSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileUDPSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerReferenceDeleted unmarshals an instance of LoadBalancerReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerStatistics : LoadBalancerStatistics struct +type LoadBalancerStatistics struct { + // Number of active connections of this load balancer. + ActiveConnections *int64 `json:"active_connections" validate:"required"` + + // Current connection rate (connections per second) of this load balancer. + ConnectionRate *float32 `json:"connection_rate" validate:"required"` + + // Total number of data processed (bytes) of this load balancer within current calendar month. + DataProcessedThisMonth *int64 `json:"data_processed_this_month" validate:"required"` + + // Current throughput (Mbps) of this load balancer. + Throughput *float32 `json:"throughput" validate:"required"` +} + +// UnmarshalLoadBalancerStatistics unmarshals an instance of LoadBalancerStatistics from the specified map of raw messages. +func UnmarshalLoadBalancerStatistics(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerStatistics) + err = core.UnmarshalPrimitive(m, "active_connections", &obj.ActiveConnections) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_rate", &obj.ConnectionRate) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "data_processed_this_month", &obj.DataProcessedThisMonth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "throughput", &obj.Throughput) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACL : NetworkACL struct +type NetworkACL struct { + // The date and time that the network ACL was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` + + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` + + // The name for this network ACL. The name is unique across all network ACLs for the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this network ACL. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The ordered rules for this network ACL. If no rules exist, all traffic will be denied. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + + // The subnets to which this network ACL is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The VPC this network ACL resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalNetworkACL unmarshals an instance of NetworkACL from the specified map of raw messages. +func UnmarshalNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACL) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLCollection : NetworkACLCollection struct +type NetworkACLCollection struct { + // A link to the first page of resources. + First *NetworkACLCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of network ACLs. + NetworkAcls []NetworkACL `json:"network_acls" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *NetworkACLCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalNetworkACLCollection unmarshals an instance of NetworkACLCollection from the specified map of raw messages. +func UnmarshalNetworkACLCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalNetworkACLCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acls", &obj.NetworkAcls, UnmarshalNetworkACL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *NetworkACLCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// NetworkACLCollectionFirst : A link to the first page of resources. +type NetworkACLCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalNetworkACLCollectionFirst unmarshals an instance of NetworkACLCollectionFirst from the specified map of raw messages. +func UnmarshalNetworkACLCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type NetworkACLCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalNetworkACLCollectionNext unmarshals an instance of NetworkACLCollectionNext from the specified map of raw messages. +func UnmarshalNetworkACLCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentity : Identifies a network ACL by a unique property. +// Models which "extend" this model: +// - NetworkACLIdentityByID +// - NetworkACLIdentityByCRN +// - NetworkACLIdentityByHref +type NetworkACLIdentity struct { + // The unique identifier for this network ACL. + ID *string `json:"id,omitempty"` + + // The CRN for this network ACL. + CRN *string `json:"crn,omitempty"` + + // The URL for this network ACL. + Href *string `json:"href,omitempty"` +} + +func (*NetworkACLIdentity) isaNetworkACLIdentity() bool { + return true +} + +type NetworkACLIdentityIntf interface { + isaNetworkACLIdentity() bool +} + +// UnmarshalNetworkACLIdentity unmarshals an instance of NetworkACLIdentity from the specified map of raw messages. +func UnmarshalNetworkACLIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLPatch : NetworkACLPatch struct +type NetworkACLPatch struct { + // The name for this network ACL. The name must not be used by another network ACL for the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalNetworkACLPatch unmarshals an instance of NetworkACLPatch from the specified map of raw messages. +func UnmarshalNetworkACLPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the NetworkACLPatch +func (networkACLPatch *NetworkACLPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(networkACLPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// NetworkACLPrototype : NetworkACLPrototype struct +// Models which "extend" this model: +// - NetworkACLPrototypeNetworkACLByRules +// - NetworkACLPrototypeNetworkACLBySourceNetworkACL +type NetworkACLPrototype struct { + // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC this network ACL will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, + // resulting in all traffic being denied. + Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` + + // Network ACL to copy rules from. + SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl,omitempty"` +} + +func (*NetworkACLPrototype) isaNetworkACLPrototype() bool { + return true +} + +type NetworkACLPrototypeIntf interface { + isaNetworkACLPrototype() bool +} + +// UnmarshalNetworkACLPrototype unmarshals an instance of NetworkACLPrototype from the specified map of raw messages. +func UnmarshalNetworkACLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLReference : NetworkACLReference struct +type NetworkACLReference struct { + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkACLReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` + + // The name for this network ACL. The name is unique across all network ACLs for the VPC. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalNetworkACLReference unmarshals an instance of NetworkACLReference from the specified map of raw messages. +func UnmarshalNetworkACLReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkACLReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkACLReferenceDeleted unmarshals an instance of NetworkACLReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkACLReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRule : NetworkACLRule struct +// Models which "extend" this model: +// - NetworkACLRuleNetworkACLRuleProtocolTcpudp +// - NetworkACLRuleNetworkACLRuleProtocolIcmp +// - NetworkACLRuleNetworkACLRuleProtocolAll +type NetworkACLRule struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRule.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleActionAllowConst = "allow" + NetworkACLRuleActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRule.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleDirectionInboundConst = "inbound" + NetworkACLRuleDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRule.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRule.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleProtocolAllConst = "all" + NetworkACLRuleProtocolIcmpConst = "icmp" + NetworkACLRuleProtocolTCPConst = "tcp" + NetworkACLRuleProtocolUDPConst = "udp" +) + +func (*NetworkACLRule) isaNetworkACLRule() bool { + return true +} + +type NetworkACLRuleIntf interface { + isaNetworkACLRule() bool +} + +// UnmarshalNetworkACLRule unmarshals an instance of NetworkACLRule from the specified map of raw messages. +func UnmarshalNetworkACLRule(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "protocol", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRuleBeforePatch : The rule to move this rule immediately before. +// +// Specify `null` to move this rule after all existing rules. +// Models which "extend" this model: +// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID +// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref +type NetworkACLRuleBeforePatch struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id,omitempty"` + + // The URL for this network ACL rule. + Href *string `json:"href,omitempty"` +} + +func (*NetworkACLRuleBeforePatch) isaNetworkACLRuleBeforePatch() bool { + return true +} + +type NetworkACLRuleBeforePatchIntf interface { + isaNetworkACLRuleBeforePatch() bool +} + +// UnmarshalNetworkACLRuleBeforePatch unmarshals an instance of NetworkACLRuleBeforePatch from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePrototype : The rule to insert this rule immediately before. +// +// If unspecified, this rule will be inserted after all existing rules. +// Models which "extend" this model: +// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID +// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref +type NetworkACLRuleBeforePrototype struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id,omitempty"` + + // The URL for this network ACL rule. + Href *string `json:"href,omitempty"` +} + +func (*NetworkACLRuleBeforePrototype) isaNetworkACLRuleBeforePrototype() bool { + return true +} + +type NetworkACLRuleBeforePrototypeIntf interface { + isaNetworkACLRuleBeforePrototype() bool +} + +// UnmarshalNetworkACLRuleBeforePrototype unmarshals an instance of NetworkACLRuleBeforePrototype from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleCollection : NetworkACLRuleCollection struct +type NetworkACLRuleCollection struct { + // A link to the first page of resources. + First *NetworkACLRuleCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *NetworkACLRuleCollectionNext `json:"next,omitempty"` + + // Ordered collection of network ACL rules. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalNetworkACLRuleCollection unmarshals an instance of NetworkACLRuleCollection from the specified map of raw messages. +func UnmarshalNetworkACLRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalNetworkACLRuleCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLRuleCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *NetworkACLRuleCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// NetworkACLRuleCollectionFirst : A link to the first page of resources. +type NetworkACLRuleCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalNetworkACLRuleCollectionFirst unmarshals an instance of NetworkACLRuleCollectionFirst from the specified map of raw messages. +func UnmarshalNetworkACLRuleCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type NetworkACLRuleCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalNetworkACLRuleCollectionNext unmarshals an instance of NetworkACLRuleCollectionNext from the specified map of raw messages. +func UnmarshalNetworkACLRuleCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItem : NetworkACLRuleItem struct +// Models which "extend" this model: +// - NetworkACLRuleItemNetworkACLRuleProtocolTcpudp +// - NetworkACLRuleItemNetworkACLRuleProtocolIcmp +// - NetworkACLRuleItemNetworkACLRuleProtocolAll +type NetworkACLRuleItem struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always + // refers to the next item in the collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRuleItem.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemActionAllowConst = "allow" + NetworkACLRuleItemActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItem.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemDirectionInboundConst = "inbound" + NetworkACLRuleItemDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItem.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItem.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemProtocolAllConst = "all" + NetworkACLRuleItemProtocolIcmpConst = "icmp" + NetworkACLRuleItemProtocolTCPConst = "tcp" + NetworkACLRuleItemProtocolUDPConst = "udp" +) + +func (*NetworkACLRuleItem) isaNetworkACLRuleItem() bool { + return true +} + +type NetworkACLRuleItemIntf interface { + isaNetworkACLRuleItem() bool +} + +// UnmarshalNetworkACLRuleItem unmarshals an instance of NetworkACLRuleItem from the specified map of raw messages. +func UnmarshalNetworkACLRuleItem(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "protocol", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRulePatch : NetworkACLRulePatch struct +type NetworkACLRulePatch struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action,omitempty"` + + // The rule to move this rule immediately before. + // + // Specify `null` to move this rule after all existing rules. + Before NetworkACLRuleBeforePatchIntf `json:"before,omitempty"` + + // The ICMP traffic code to match. If set, `type` must also be set. + // + // Specify `null` to remove an existing ICMP traffic code. + Code *int64 `json:"code,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination,omitempty"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The direction of traffic to match. + Direction *string `json:"direction,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. + Name *string `json:"name,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic type to match. + // + // Specify `null` to remove an existing ICMP traffic type value. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePatch.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePatchActionAllowConst = "allow" + NetworkACLRulePatchActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePatch.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePatchDirectionInboundConst = "inbound" + NetworkACLRulePatchDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePatch.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePatchProtocolAllConst = "all" + NetworkACLRulePatchProtocolIcmpConst = "icmp" + NetworkACLRulePatchProtocolTCPConst = "tcp" + NetworkACLRulePatchProtocolUDPConst = "udp" +) + +// UnmarshalNetworkACLRulePatch unmarshals an instance of NetworkACLRulePatch from the specified map of raw messages. +func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePatch) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the NetworkACLRulePatch +func (networkACLRulePatch *NetworkACLRulePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(networkACLRulePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// NetworkACLRulePrototype : NetworkACLRulePrototype struct +// Models which "extend" this model: +// - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype +// - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype +// - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype +type NetworkACLRulePrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule to insert this rule immediately before. + // + // If unspecified, this rule will be inserted after all existing rules. + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeProtocolAllConst = "all" + NetworkACLRulePrototypeProtocolIcmpConst = "icmp" + NetworkACLRulePrototypeProtocolTCPConst = "tcp" + NetworkACLRulePrototypeProtocolUDPConst = "udp" +) + +func (*NetworkACLRulePrototype) isaNetworkACLRulePrototype() bool { + return true +} + +type NetworkACLRulePrototypeIntf interface { + isaNetworkACLRulePrototype() bool +} + +// UnmarshalNetworkACLRulePrototype unmarshals an instance of NetworkACLRulePrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "protocol", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRulePrototypeNetworkACLContext : NetworkACLRulePrototypeNetworkACLContext struct +// Models which "extend" this model: +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype +type NetworkACLRulePrototypeNetworkACLContext struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextProtocolAllConst = "all" + NetworkACLRulePrototypeNetworkACLContextProtocolIcmpConst = "icmp" + NetworkACLRulePrototypeNetworkACLContextProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLContextProtocolUDPConst = "udp" +) + +func (*NetworkACLRulePrototypeNetworkACLContext) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +type NetworkACLRulePrototypeNetworkACLContextIntf interface { + isaNetworkACLRulePrototypeNetworkACLContext() bool +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContext unmarshals an instance of NetworkACLRulePrototypeNetworkACLContext from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContext(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "protocol", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRuleReference : NetworkACLRuleReference struct +type NetworkACLRuleReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkACLRuleReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalNetworkACLRuleReference unmarshals an instance of NetworkACLRuleReference from the specified map of raw messages. +func UnmarshalNetworkACLRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLRuleReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkACLRuleReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkACLRuleReferenceDeleted unmarshals an instance of NetworkACLRuleReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkAttachment : NetworkAttachment struct +type NetworkAttachment struct { + // The date and time that the network attachment was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network attachment. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + Name *string `json:"name" validate:"required"` + + // The port speed for this network attachment in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IP address of the virtual network interface for the 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 network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The network attachment type. + Type *string `json:"type" validate:"required"` + + // The virtual network interface for this network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` +} + +// Constants associated with the NetworkAttachment.LifecycleState property. +// The lifecycle state of the network attachment. +const ( + NetworkAttachmentLifecycleStateDeletingConst = "deleting" + NetworkAttachmentLifecycleStateFailedConst = "failed" + NetworkAttachmentLifecycleStatePendingConst = "pending" + NetworkAttachmentLifecycleStateStableConst = "stable" + NetworkAttachmentLifecycleStateSuspendedConst = "suspended" + NetworkAttachmentLifecycleStateUpdatingConst = "updating" + NetworkAttachmentLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the NetworkAttachment.Type property. +// The network attachment type. +const ( + NetworkAttachmentTypePrimaryConst = "primary" + NetworkAttachmentTypeSecondaryConst = "secondary" +) + +// UnmarshalNetworkAttachment unmarshals an instance of NetworkAttachment from the specified map of raw messages. +func UnmarshalNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkAttachment) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterface : NetworkInterface struct +type NetworkInterface struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // The date and time that the network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The floating IPs associated with this network interface. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The name for this network interface. + Name *string `json:"name" validate:"required"` + + // The network interface port speed in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups targeting this network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the network interface. + Status *string `json:"status" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The type of this network interface as it relates to an instance. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the NetworkInterface.ResourceType property. +// The resource type. +const ( + NetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the NetworkInterface.Status property. +// The status of the network interface. +const ( + NetworkInterfaceStatusAvailableConst = "available" + NetworkInterfaceStatusDeletingConst = "deleting" + NetworkInterfaceStatusFailedConst = "failed" + NetworkInterfaceStatusPendingConst = "pending" +) + +// Constants associated with the NetworkInterface.Type property. +// The type of this network interface as it relates to an instance. +const ( + NetworkInterfaceTypePrimaryConst = "primary" + NetworkInterfaceTypeSecondaryConst = "secondary" +) + +// UnmarshalNetworkInterface unmarshals an instance of NetworkInterface from the specified map of raw messages. +func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceBareMetalServerContextReference : NetworkInterfaceBareMetalServerContextReference struct +type NetworkInterfaceBareMetalServerContextReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The name for this network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the NetworkInterfaceBareMetalServerContextReference.ResourceType property. +// The resource type. +const ( + NetworkInterfaceBareMetalServerContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// UnmarshalNetworkInterfaceBareMetalServerContextReference unmarshals an instance of NetworkInterfaceBareMetalServerContextReference from the specified map of raw messages. +func UnmarshalNetworkInterfaceBareMetalServerContextReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceBareMetalServerContextReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceBareMetalServerContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceBareMetalServerContextReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted unmarshals an instance of NetworkInterfaceBareMetalServerContextReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceBareMetalServerContextReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototype : NetworkInterfaceIPPrototype struct +// Models which "extend" this model: +// - NetworkInterfaceIPPrototypeReservedIPIdentity +// - NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext +type NetworkInterfaceIPPrototype struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` + + // The IP address to reserve, which must not already be reserved on the subnet. + // + // If unspecified, an available address on the subnet will automatically be selected. + Address *string `json:"address,omitempty"` + + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with + // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated + // list of randomly-selected words. + Name *string `json:"name,omitempty"` +} + +func (*NetworkInterfaceIPPrototype) isaNetworkInterfaceIPPrototype() bool { + return true +} + +type NetworkInterfaceIPPrototypeIntf interface { + isaNetworkInterfaceIPPrototype() bool +} + +// UnmarshalNetworkInterfaceIPPrototype unmarshals an instance of NetworkInterfaceIPPrototype from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceInstanceContextReference : NetworkInterfaceInstanceContextReference struct +type NetworkInterfaceInstanceContextReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceInstanceContextReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The name for this network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the NetworkInterfaceInstanceContextReference.ResourceType property. +// The resource type. +const ( + NetworkInterfaceInstanceContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// UnmarshalNetworkInterfaceInstanceContextReference unmarshals an instance of NetworkInterfaceInstanceContextReference from the specified map of raw messages. +func UnmarshalNetworkInterfaceInstanceContextReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceInstanceContextReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceInstanceContextReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceInstanceContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceInstanceContextReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceInstanceContextReferenceDeleted unmarshals an instance of NetworkInterfaceInstanceContextReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceInstanceContextReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfacePatch : NetworkInterfacePatch struct +type NetworkInterfacePatch struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // The name for network interface. The name must not be used by another network interface on the virtual server + // instance. + Name *string `json:"name,omitempty"` +} + +// UnmarshalNetworkInterfacePatch unmarshals an instance of NetworkInterfacePatch from the specified map of raw messages. +func UnmarshalNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the NetworkInterfacePatch +func (networkInterfacePatch *NetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(networkInterfacePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// NetworkInterfacePrototype : NetworkInterfacePrototype struct +type NetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // The name for network interface. The name must not be used by another network interface on the virtual server + // instance. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the network interface. This can be specified using + // an existing reserved IP, or a prototype object for a new reserved IP. + // + // If an existing reserved IP or a prototype object with an address is specified, it must + // be available on the network interface's subnet. Otherwise, an available address on the + // subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` +} + +// NewNetworkInterfacePrototype : Instantiate NetworkInterfacePrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *NetworkInterfacePrototype, err error) { + _model = &NetworkInterfacePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalNetworkInterfacePrototype unmarshals an instance of NetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceReferenceDeleted unmarshals an instance of NetworkInterfaceReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceReferenceTargetContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of NetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct +type NetworkInterfaceUnpaginatedCollection struct { + // Collection of network interfaces. + NetworkInterfaces []NetworkInterface `json:"network_interfaces" validate:"required"` +} + +// UnmarshalNetworkInterfaceUnpaginatedCollection unmarshals an instance of NetworkInterfaceUnpaginatedCollection from the specified map of raw messages. +func UnmarshalNetworkInterfaceUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceUnpaginatedCollection) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterface) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystem : OperatingSystem struct +type OperatingSystem struct { + // The operating system architecture. + Architecture *string `json:"architecture" validate:"required"` + + // Images with this operating system can only be used on dedicated hosts or dedicated host groups. + DedicatedHostOnly *bool `json:"dedicated_host_only" validate:"required"` + + // A unique, display-friendly name for the operating system. + DisplayName *string `json:"display_name" validate:"required"` + + // The software family for this operating system. + Family *string `json:"family" validate:"required"` + + // The URL for this operating system. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this operating system. + Name *string `json:"name" validate:"required"` + + // The vendor of the operating system. + Vendor *string `json:"vendor" validate:"required"` + + // The major release version of this operating system. + Version *string `json:"version" validate:"required"` +} + +// UnmarshalOperatingSystem unmarshals an instance of OperatingSystem from the specified map of raw messages. +func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystem) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dedicated_host_only", &obj.DedicatedHostOnly) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vendor", &obj.Vendor) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemCollection : OperatingSystemCollection struct +type OperatingSystemCollection struct { + // A link to the first page of resources. + First *OperatingSystemCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *OperatingSystemCollectionNext `json:"next,omitempty"` + + // Collection of operating systems. + OperatingSystems []OperatingSystem `json:"operating_systems" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalOperatingSystemCollection unmarshals an instance of OperatingSystemCollection from the specified map of raw messages. +func UnmarshalOperatingSystemCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalOperatingSystemCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalOperatingSystemCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_systems", &obj.OperatingSystems, UnmarshalOperatingSystem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *OperatingSystemCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// OperatingSystemCollectionFirst : A link to the first page of resources. +type OperatingSystemCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalOperatingSystemCollectionFirst unmarshals an instance of OperatingSystemCollectionFirst from the specified map of raw messages. +func UnmarshalOperatingSystemCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type OperatingSystemCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalOperatingSystemCollectionNext unmarshals an instance of OperatingSystemCollectionNext from the specified map of raw messages. +func UnmarshalOperatingSystemCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemIdentity : Identifies an operating system by a unique property. +// Models which "extend" this model: +// - OperatingSystemIdentityByName +// - OperatingSystemIdentityByHref +type OperatingSystemIdentity struct { + // The globally unique name for this operating system. + Name *string `json:"name,omitempty"` + + // The URL for this operating system. + Href *string `json:"href,omitempty"` +} + +func (*OperatingSystemIdentity) isaOperatingSystemIdentity() bool { + return true +} + +type OperatingSystemIdentityIntf interface { + isaOperatingSystemIdentity() bool +} + +// UnmarshalOperatingSystemIdentity unmarshals an instance of OperatingSystemIdentity from the specified map of raw messages. +func UnmarshalOperatingSystemIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PlacementGroup : PlacementGroup struct +type PlacementGroup struct { + // The date and time that the placement group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this placement group. + CRN *string `json:"crn" validate:"required"` + + // The URL for this placement group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this placement group. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the placement group. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this placement group. The name is unique across all placement groups in the region. + Name *string `json:"name" validate:"required"` + + // The resource group for this placement group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The strategy for this placement group + // - `host_spread`: place on different compute hosts + // - `power_spread`: place on compute hosts that use different power sources + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the + // unexpected strategy was encountered. + Strategy *string `json:"strategy" validate:"required"` +} + +// Constants associated with the PlacementGroup.LifecycleState property. +// The lifecycle state of the placement group. +const ( + PlacementGroupLifecycleStateDeletingConst = "deleting" + PlacementGroupLifecycleStateFailedConst = "failed" + PlacementGroupLifecycleStatePendingConst = "pending" + PlacementGroupLifecycleStateStableConst = "stable" + PlacementGroupLifecycleStateSuspendedConst = "suspended" + PlacementGroupLifecycleStateUpdatingConst = "updating" + PlacementGroupLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the PlacementGroup.ResourceType property. +// The resource type. +const ( + PlacementGroupResourceTypePlacementGroupConst = "placement_group" +) + +// Constants associated with the PlacementGroup.Strategy property. +// The strategy for this placement group +// - `host_spread`: place on different compute hosts +// - `power_spread`: place on compute hosts that use different power sources +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the +// unexpected strategy was encountered. +const ( + PlacementGroupStrategyHostSpreadConst = "host_spread" + PlacementGroupStrategyPowerSpreadConst = "power_spread" +) + +// UnmarshalPlacementGroup unmarshals an instance of PlacementGroup from the specified map of raw messages. +func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroup) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "strategy", &obj.Strategy) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PlacementGroupCollection : PlacementGroupCollection struct +type PlacementGroupCollection struct { + // A link to the first page of resources. + First *PlacementGroupCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PlacementGroupCollectionNext `json:"next,omitempty"` + + // Collection of placement groups. + PlacementGroups []PlacementGroup `json:"placement_groups" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalPlacementGroupCollection unmarshals an instance of PlacementGroupCollection from the specified map of raw messages. +func UnmarshalPlacementGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroupCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPlacementGroupCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPlacementGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_groups", &obj.PlacementGroups, UnmarshalPlacementGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *PlacementGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// PlacementGroupCollectionFirst : A link to the first page of resources. +type PlacementGroupCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalPlacementGroupCollectionFirst unmarshals an instance of PlacementGroupCollectionFirst from the specified map of raw messages. +func UnmarshalPlacementGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroupCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PlacementGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type PlacementGroupCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalPlacementGroupCollectionNext unmarshals an instance of PlacementGroupCollectionNext from the specified map of raw messages. +func UnmarshalPlacementGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroupCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PlacementGroupPatch : PlacementGroupPatch struct +type PlacementGroupPatch struct { + // The name for this placement group. The name must not be used by another placement group in the region. + Name *string `json:"name,omitempty"` +} + +// UnmarshalPlacementGroupPatch unmarshals an instance of PlacementGroupPatch from the specified map of raw messages. +func UnmarshalPlacementGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroupPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the PlacementGroupPatch +func (placementGroupPatch *PlacementGroupPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(placementGroupPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// PlacementGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type PlacementGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalPlacementGroupReferenceDeleted unmarshals an instance of PlacementGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalPlacementGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGateway : PublicGateway struct +type PublicGateway struct { + // The date and time that the public gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + + // The floating IP bound to this public gateway. + FloatingIP *PublicGatewayFloatingIP `json:"floating_ip" validate:"required"` + + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` + + // The name for this public gateway. The name is unique across all public gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this public gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of this public gateway. + Status *string `json:"status" validate:"required"` + + // The VPC this public gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this public gateway resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the PublicGateway.ResourceType property. +// The resource type. +const ( + PublicGatewayResourceTypePublicGatewayConst = "public_gateway" +) + +// Constants associated with the PublicGateway.Status property. +// The status of this public gateway. +const ( + PublicGatewayStatusAvailableConst = "available" + PublicGatewayStatusDeletingConst = "deleting" + PublicGatewayStatusFailedConst = "failed" + PublicGatewayStatusPendingConst = "pending" +) + +// UnmarshalPublicGateway unmarshals an instance of PublicGateway from the specified map of raw messages. +func UnmarshalPublicGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGateway) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ip", &obj.FloatingIP, UnmarshalPublicGatewayFloatingIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayCollection : PublicGatewayCollection struct +type PublicGatewayCollection struct { + // A link to the first page of resources. + First *PublicGatewayCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PublicGatewayCollectionNext `json:"next,omitempty"` + + // Collection of public gateways. + PublicGateways []PublicGateway `json:"public_gateways" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalPublicGatewayCollection unmarshals an instance of PublicGatewayCollection from the specified map of raw messages. +func UnmarshalPublicGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPublicGatewayCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPublicGatewayCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateways", &obj.PublicGateways, UnmarshalPublicGateway) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *PublicGatewayCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// PublicGatewayCollectionFirst : A link to the first page of resources. +type PublicGatewayCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalPublicGatewayCollectionFirst unmarshals an instance of PublicGatewayCollectionFirst from the specified map of raw messages. +func UnmarshalPublicGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type PublicGatewayCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalPublicGatewayCollectionNext unmarshals an instance of PublicGatewayCollectionNext from the specified map of raw messages. +func UnmarshalPublicGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIP : The floating IP bound to this public gateway. +type PublicGatewayFloatingIP struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` + + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` + + // The name for this floating IP. The name is unique across all floating IPs in the region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalPublicGatewayFloatingIP unmarshals an instance of PublicGatewayFloatingIP from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototype : PublicGatewayFloatingIPPrototype struct +// Models which "extend" this model: +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentity +// - PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext +type PublicGatewayFloatingIPPrototype struct { + // The unique identifier for this floating IP. + ID *string `json:"id,omitempty"` + + // The CRN for this floating IP. + CRN *string `json:"crn,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href,omitempty"` + + // The globally unique IP address. + Address *string `json:"address,omitempty"` + + // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` +} + +func (*PublicGatewayFloatingIPPrototype) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +type PublicGatewayFloatingIPPrototypeIntf interface { + isaPublicGatewayFloatingIPPrototype() bool +} + +// UnmarshalPublicGatewayFloatingIPPrototype unmarshals an instance of PublicGatewayFloatingIPPrototype from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentity : Identifies a public gateway by a unique property. +// Models which "extend" this model: +// - PublicGatewayIdentityPublicGatewayIdentityByID +// - PublicGatewayIdentityPublicGatewayIdentityByCRN +// - PublicGatewayIdentityPublicGatewayIdentityByHref +type PublicGatewayIdentity struct { + // The unique identifier for this public gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this public gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href,omitempty"` +} + +func (*PublicGatewayIdentity) isaPublicGatewayIdentity() bool { + return true +} + +type PublicGatewayIdentityIntf interface { + isaPublicGatewayIdentity() bool +} + +// UnmarshalPublicGatewayIdentity unmarshals an instance of PublicGatewayIdentity from the specified map of raw messages. +func UnmarshalPublicGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayPatch : PublicGatewayPatch struct +type PublicGatewayPatch struct { + // The name for this public gateway. The name must not be used by another public gateway in the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalPublicGatewayPatch unmarshals an instance of PublicGatewayPatch from the specified map of raw messages. +func UnmarshalPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the PublicGatewayPatch +func (publicGatewayPatch *PublicGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(publicGatewayPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// PublicGatewayReference : PublicGatewayReference struct +type PublicGatewayReference struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` + + // The name for this public gateway. The name is unique across all public gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the PublicGatewayReference.ResourceType property. +// The resource type. +const ( + PublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" +) + +// UnmarshalPublicGatewayReference unmarshals an instance of PublicGatewayReference from the specified map of raw messages. +func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type PublicGatewayReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalPublicGatewayReferenceDeleted unmarshals an instance of PublicGatewayReferenceDeleted from the specified map of raw messages. +func UnmarshalPublicGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Region : Region struct +type Region struct { + // The API endpoint for this region. + Endpoint *string `json:"endpoint" validate:"required"` + + // The URL for this region. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` + + // The availability status of this region. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the Region.Status property. +// The availability status of this region. +const ( + RegionStatusAvailableConst = "available" + RegionStatusUnavailableConst = "unavailable" +) + +// UnmarshalRegion unmarshals an instance of Region from the specified map of raw messages. +func UnmarshalRegion(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Region) + err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionCollection : RegionCollection struct +type RegionCollection struct { + // Collection of regions. + Regions []Region `json:"regions" validate:"required"` +} + +// UnmarshalRegionCollection unmarshals an instance of RegionCollection from the specified map of raw messages. +func UnmarshalRegionCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionCollection) + err = core.UnmarshalModel(m, "regions", &obj.Regions, UnmarshalRegion) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionIdentity : Identifies a region by a unique property. +// Models which "extend" this model: +// - RegionIdentityByName +// - RegionIdentityByHref +type RegionIdentity struct { + // The globally unique name for this region. + Name *string `json:"name,omitempty"` + + // The URL for this region. + Href *string `json:"href,omitempty"` +} + +func (*RegionIdentity) isaRegionIdentity() bool { + return true +} + +type RegionIdentityIntf interface { + isaRegionIdentity() bool +} + +// UnmarshalRegionIdentity unmarshals an instance of RegionIdentity from the specified map of raw messages. +func UnmarshalRegionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionReference : RegionReference struct +type RegionReference struct { + // The URL for this region. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalRegionReference unmarshals an instance of RegionReference from the specified map of raw messages. +func UnmarshalRegionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RemoveBareMetalServerNetworkInterfaceFloatingIPOptions : The RemoveBareMetalServerNetworkInterfaceFloatingIP options. +type RemoveBareMetalServerNetworkInterfaceFloatingIPOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The 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 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 +} + +// RemoveVPNGatewayConnectionLocalCIDROptions : The RemoveVPNGatewayConnectionLocalCIDR options. +type RemoveVPNGatewayConnectionLocalCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // The address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRemoveVPNGatewayConnectionLocalCIDROptions : Instantiate RemoveVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewRemoveVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { + return &RemoveVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionLocalCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionLocalCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionLocalCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionLocalCIDROptions { + options.Headers = param + return options +} + +// RemoveVPNGatewayConnectionPeerCIDROptions : The RemoveVPNGatewayConnectionPeerCIDR options. +type RemoveVPNGatewayConnectionPeerCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // The address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRemoveVPNGatewayConnectionPeerCIDROptions : Instantiate RemoveVPNGatewayConnectionPeerCIDROptions +func (*VpcV1) NewRemoveVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { + return &RemoveVPNGatewayConnectionPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionPeerCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionPeerCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionPeerCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionPeerCIDROptions { + options.Headers = param + return options +} + +// ReplaceLoadBalancerPoolMembersOptions : The ReplaceLoadBalancerPoolMembers options. +type ReplaceLoadBalancerPoolMembersOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The member prototype objects for this pool. + Members []LoadBalancerPoolMemberPrototype `json:"members" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceLoadBalancerPoolMembersOptions : Instantiate ReplaceLoadBalancerPoolMembersOptions +func (*VpcV1) NewReplaceLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string, members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { + return &ReplaceLoadBalancerPoolMembersOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + Members: members, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ReplaceLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ReplaceLoadBalancerPoolMembersOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *ReplaceLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ReplaceLoadBalancerPoolMembersOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetMembers : Allow user to set Members +func (_options *ReplaceLoadBalancerPoolMembersOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { + _options.Members = members + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ReplaceLoadBalancerPoolMembersOptions { + options.Headers = param + return options +} + +// ReplaceSubnetNetworkACLOptions : The ReplaceSubnetNetworkACL options. +type ReplaceSubnetNetworkACLOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network ACL identity. + NetworkACLIdentity NetworkACLIdentityIntf `json:"NetworkACLIdentity" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceSubnetNetworkACLOptions : Instantiate ReplaceSubnetNetworkACLOptions +func (*VpcV1) NewReplaceSubnetNetworkACLOptions(id string, networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { + return &ReplaceSubnetNetworkACLOptions{ + ID: core.StringPtr(id), + NetworkACLIdentity: networkACLIdentity, + } +} + +// SetID : Allow user to set ID +func (_options *ReplaceSubnetNetworkACLOptions) SetID(id string) *ReplaceSubnetNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetNetworkACLIdentity : Allow user to set NetworkACLIdentity +func (_options *ReplaceSubnetNetworkACLOptions) SetNetworkACLIdentity(networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { + _options.NetworkACLIdentity = networkACLIdentity + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceSubnetNetworkACLOptions) SetHeaders(param map[string]string) *ReplaceSubnetNetworkACLOptions { + options.Headers = param + return options +} + +// ReplaceSubnetRoutingTableOptions : The ReplaceSubnetRoutingTable options. +type ReplaceSubnetRoutingTableOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The routing table identity. + RoutingTableIdentity RoutingTableIdentityIntf `json:"RoutingTableIdentity" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceSubnetRoutingTableOptions : Instantiate ReplaceSubnetRoutingTableOptions +func (*VpcV1) NewReplaceSubnetRoutingTableOptions(id string, routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { + return &ReplaceSubnetRoutingTableOptions{ + ID: core.StringPtr(id), + RoutingTableIdentity: routingTableIdentity, + } +} + +// SetID : Allow user to set ID +func (_options *ReplaceSubnetRoutingTableOptions) SetID(id string) *ReplaceSubnetRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRoutingTableIdentity : Allow user to set RoutingTableIdentity +func (_options *ReplaceSubnetRoutingTableOptions) SetRoutingTableIdentity(routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { + _options.RoutingTableIdentity = routingTableIdentity + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceSubnetRoutingTableOptions) SetHeaders(param map[string]string) *ReplaceSubnetRoutingTableOptions { + options.Headers = param + return options +} + +// ReservedIP : ReservedIP struct +type ReservedIP struct { + // The IP address. + // + // If the address has not yet been selected, the value will be `0.0.0.0`. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // The date and time that the reserved IP was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the reserved IP. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + Name *string `json:"name" validate:"required"` + + // The owner of the reserved IP. + Owner *string `json:"owner" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The target this reserved IP is bound to. + // + // If absent, this reserved IP is provider-owned or unbound. + Target ReservedIPTargetIntf `json:"target,omitempty"` +} + +// Constants associated with the ReservedIP.LifecycleState property. +// The lifecycle state of the reserved IP. +const ( + ReservedIPLifecycleStateDeletingConst = "deleting" + ReservedIPLifecycleStateFailedConst = "failed" + ReservedIPLifecycleStatePendingConst = "pending" + ReservedIPLifecycleStateStableConst = "stable" + ReservedIPLifecycleStateSuspendedConst = "suspended" + ReservedIPLifecycleStateUpdatingConst = "updating" + ReservedIPLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the ReservedIP.Owner property. +// The owner of the reserved IP. +const ( + ReservedIPOwnerProviderConst = "provider" + ReservedIPOwnerUserConst = "user" +) + +// Constants associated with the ReservedIP.ResourceType property. +// The resource type. +const ( + ReservedIPResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" +) + +// UnmarshalReservedIP unmarshals an instance of ReservedIP from the specified map of raw messages. +func UnmarshalReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "owner", &obj.Owner) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalReservedIPTarget) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollection : ReservedIPCollection struct +type ReservedIPCollection struct { + // A link to the first page of resources. + First *ReservedIPCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ReservedIPCollectionNext `json:"next,omitempty"` + + // Collection of reserved IPs in this subnet. + ReservedIps []ReservedIP `json:"reserved_ips" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalReservedIPCollection unmarshals an instance of ReservedIPCollection from the specified map of raw messages. +func UnmarshalReservedIPCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalReservedIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ReservedIPCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// ReservedIPCollectionEndpointGatewayContext : ReservedIPCollectionEndpointGatewayContext struct +type ReservedIPCollectionEndpointGatewayContext struct { + // A link to the first page of resources. + First *ReservedIPCollectionEndpointGatewayContextFirst `json:"first" validate:"required"` + + // Collection of reserved IPs bound to an endpoint gateway. + Ips []ReservedIP `json:"ips" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ReservedIPCollectionEndpointGatewayContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalReservedIPCollectionEndpointGatewayContext unmarshals an instance of ReservedIPCollectionEndpointGatewayContext from the specified map of raw messages. +func UnmarshalReservedIPCollectionEndpointGatewayContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionEndpointGatewayContext) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionEndpointGatewayContextFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionEndpointGatewayContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ReservedIPCollectionEndpointGatewayContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// ReservedIPCollectionEndpointGatewayContextFirst : A link to the first page of resources. +type ReservedIPCollectionEndpointGatewayContextFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionEndpointGatewayContextFirst unmarshals an instance of ReservedIPCollectionEndpointGatewayContextFirst from the specified map of raw messages. +func UnmarshalReservedIPCollectionEndpointGatewayContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionEndpointGatewayContextFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionEndpointGatewayContextNext : A link to the next page of resources. This property is present for all pages except the last page. +type ReservedIPCollectionEndpointGatewayContextNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionEndpointGatewayContextNext unmarshals an instance of ReservedIPCollectionEndpointGatewayContextNext from the specified map of raw messages. +func UnmarshalReservedIPCollectionEndpointGatewayContextNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionEndpointGatewayContextNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionFirst : A link to the first page of resources. +type ReservedIPCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionFirst unmarshals an instance of ReservedIPCollectionFirst from the specified map of raw messages. +func UnmarshalReservedIPCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionNetworkInterfaceContext : ReservedIPCollectionNetworkInterfaceContext struct +type ReservedIPCollectionNetworkInterfaceContext struct { + // A link to the first page of resources. + First *ReservedIPCollectionNetworkInterfaceContextFirst `json:"first" validate:"required"` + + // Collection of reserved IPs bound to a network interface. + Ips []ReservedIP `json:"ips" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ReservedIPCollectionNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalReservedIPCollectionNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalReservedIPCollectionNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionNetworkInterfaceContext) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionNetworkInterfaceContextFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ReservedIPCollectionNetworkInterfaceContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// ReservedIPCollectionNetworkInterfaceContextFirst : A link to the first page of resources. +type ReservedIPCollectionNetworkInterfaceContextFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionNetworkInterfaceContextFirst from the specified map of raw messages. +func UnmarshalReservedIPCollectionNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionNetworkInterfaceContextFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. +type ReservedIPCollectionNetworkInterfaceContextNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionNetworkInterfaceContextNext from the specified map of raw messages. +func UnmarshalReservedIPCollectionNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionNetworkInterfaceContextNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type ReservedIPCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionNext unmarshals an instance of ReservedIPCollectionNext from the specified map of raw messages. +func UnmarshalReservedIPCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionVirtualNetworkInterfaceContext : ReservedIPCollectionVirtualNetworkInterfaceContext struct +type ReservedIPCollectionVirtualNetworkInterfaceContext struct { + // A link to the first page of resources. + First *ReservedIPCollectionVirtualNetworkInterfaceContextFirst `json:"first" validate:"required"` + + // Collection of reserved IPs bound to the virtual network interface specified by the identifier in the URL. + Ips []ReservedIPReference `json:"ips" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ReservedIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionVirtualNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionVirtualNetworkInterfaceContext) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ReservedIPCollectionVirtualNetworkInterfaceContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// ReservedIPCollectionVirtualNetworkInterfaceContextFirst : A link to the first page of resources. +type ReservedIPCollectionVirtualNetworkInterfaceContextFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionVirtualNetworkInterfaceContextFirst from the specified map of raw messages. +func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionVirtualNetworkInterfaceContextFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionVirtualNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. +type ReservedIPCollectionVirtualNetworkInterfaceContextNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionVirtualNetworkInterfaceContextNext from the specified map of raw messages. +func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionVirtualNetworkInterfaceContextNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPPatch : ReservedIPPatch struct +type ReservedIPPatch struct { + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with + // `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` +} + +// UnmarshalReservedIPPatch unmarshals an instance of ReservedIPPatch from the specified map of raw messages. +func UnmarshalReservedIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPPatch) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the ReservedIPPatch +func (reservedIPPatch *ReservedIPPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(reservedIPPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// ReservedIPReference : ReservedIPReference struct +type ReservedIPReference struct { + // The IP address. + // + // If the address has not yet been selected, the value will be `0.0.0.0`. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` + + // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPReference.ResourceType property. +// The resource type. +const ( + ReservedIPReferenceResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" +) + +// UnmarshalReservedIPReference unmarshals an instance of ReservedIPReference from the specified map of raw messages. +func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPReference) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type ReservedIPReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalReservedIPReferenceDeleted unmarshals an instance of ReservedIPReferenceDeleted from the specified map of raw messages. +func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTarget : The target this reserved IP is bound to. +// +// If absent, this reserved IP is provider-owned or unbound. +// Models which "extend" this model: +// - ReservedIPTargetEndpointGatewayReference +// - ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext +// - ReservedIPTargetNetworkInterfaceReferenceTargetContext +// - ReservedIPTargetLoadBalancerReference +// - ReservedIPTargetVPNGatewayReference +// - ReservedIPTargetVPNServerReference +// - ReservedIPTargetGenericResourceReference +type ReservedIPTarget struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the ReservedIPTarget.ResourceType property. +// The resource type. +const ( + ReservedIPTargetResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +func (*ReservedIPTarget) isaReservedIPTarget() bool { + return true +} + +type ReservedIPTargetIntf interface { + isaReservedIPTarget() bool +} + +// UnmarshalReservedIPTarget unmarshals an instance of ReservedIPTarget from the specified map of raw messages. +func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototype : The target to bind this reserved IP to. The target must be in the same VPC. +// +// The following targets are supported: +// - An endpoint gateway not already bound to a reserved IP in the subnet's zone. +// - A virtual network interface. +// +// If unspecified, the reserved IP will be created unbound. +// Models which "extend" this model: +// - ReservedIPTargetPrototypeEndpointGatewayIdentity +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototype struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` +} + +func (*ReservedIPTargetPrototype) isaReservedIPTargetPrototype() bool { + return true +} + +type ReservedIPTargetPrototypeIntf interface { + isaReservedIPTargetPrototype() bool +} + +// UnmarshalReservedIPTargetPrototype unmarshals an instance of ReservedIPTargetPrototype from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceFilter : Identifies one or more resources according to the specified filter property. +type ResourceFilter struct { + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// UnmarshalResourceFilter unmarshals an instance of ResourceFilter from the specified map of raw messages. +func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceFilter) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroupIdentity : The resource group to use. If unspecified, the account's [default resource +// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. +// Models which "extend" this model: +// - ResourceGroupIdentityByID +type ResourceGroupIdentity struct { + // The unique identifier for this resource group. + ID *string `json:"id,omitempty"` +} + +func (*ResourceGroupIdentity) isaResourceGroupIdentity() bool { + return true +} + +type ResourceGroupIdentityIntf interface { + isaResourceGroupIdentity() bool +} + +// UnmarshalResourceGroupIdentity unmarshals an instance of ResourceGroupIdentity from the specified map of raw messages. +func UnmarshalResourceGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroupReference : ResourceGroupReference struct +type ResourceGroupReference struct { + // The URL for this resource group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` + + // The name for this resource group. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalResourceGroupReference unmarshals an instance of ResourceGroupReference from the specified map of raw messages. +func UnmarshalResourceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RestartBareMetalServerOptions : The RestartBareMetalServer options. +type RestartBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRestartBareMetalServerOptions : Instantiate RestartBareMetalServerOptions +func (*VpcV1) NewRestartBareMetalServerOptions(id string) *RestartBareMetalServerOptions { + return &RestartBareMetalServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *RestartBareMetalServerOptions) SetID(id string) *RestartBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RestartBareMetalServerOptions) SetHeaders(param map[string]string) *RestartBareMetalServerOptions { + options.Headers = param + return options +} + +// Route : Route struct +type Route struct { + // The action to perform with a packet matching the route: + // - `delegate`: delegate to system-provided routes + // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes + // - `deliver`: deliver the packet to the specified `next_hop` + // - `drop`: drop the packet. + Action *string `json:"action" validate:"required"` + + // The date and time that the route was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If present, the resource that created the route. Routes with this property present cannot + // be directly deleted. All routes with an `origin` of `service` will have this property set, + // and future `origin` values may also have this property set. + Creator RouteCreatorIntf `json:"creator,omitempty"` + + // The destination of the route. + Destination *string `json:"destination" validate:"required"` + + // The URL for this route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the route. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this route. The name is unique across all routes in the routing table. + Name *string `json:"name" validate:"required"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For + // other `action` values, its `address` will be `0.0.0.0`. + NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` + + // The origin of this route: + // - `service`: route was directly created by a service + // - `user`: route was directly created by a user + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + Origin *string `json:"origin,omitempty"` + + // The priority of this route. Smaller values have higher priority. + // + // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest + // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is + // distributed between them. + Priority *int64 `json:"priority" validate:"required"` + + // The zone the route applies to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Route.Action property. +// The action to perform with a packet matching the route: +// - `delegate`: delegate to system-provided routes +// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes +// - `deliver`: deliver the packet to the specified `next_hop` +// - `drop`: drop the packet. +const ( + RouteActionDelegateConst = "delegate" + RouteActionDelegateVPCConst = "delegate_vpc" + RouteActionDeliverConst = "deliver" + RouteActionDropConst = "drop" +) + +// Constants associated with the Route.LifecycleState property. +// The lifecycle state of the route. +const ( + RouteLifecycleStateDeletingConst = "deleting" + RouteLifecycleStateFailedConst = "failed" + RouteLifecycleStatePendingConst = "pending" + RouteLifecycleStateStableConst = "stable" + RouteLifecycleStateSuspendedConst = "suspended" + RouteLifecycleStateUpdatingConst = "updating" + RouteLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Route.Origin property. +// The origin of this route: +// - `service`: route was directly created by a service +// - `user`: route was directly created by a user +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + RouteOriginServiceConst = "service" + RouteOriginUserConst = "user" +) + +// UnmarshalRoute unmarshals an instance of Route from the specified map of raw messages. +func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Route) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCollection : RouteCollection struct +type RouteCollection struct { + // A link to the first page of resources. + First *RouteCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *RouteCollectionNext `json:"next,omitempty"` + + // Collection of routes. + Routes []Route `json:"routes" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalRouteCollection unmarshals an instance of RouteCollection from the specified map of raw messages. +func UnmarshalRouteCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalRouteCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *RouteCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// RouteCollectionFirst : A link to the first page of resources. +type RouteCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalRouteCollectionFirst unmarshals an instance of RouteCollectionFirst from the specified map of raw messages. +func UnmarshalRouteCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type RouteCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalRouteCollectionNext unmarshals an instance of RouteCollectionNext from the specified map of raw messages. +func UnmarshalRouteCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCollectionVPCContext : RouteCollectionVPCContext struct +type RouteCollectionVPCContext struct { + // A link to the first page of resources. + First *RouteCollectionVPCContextFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *RouteCollectionVPCContextNext `json:"next,omitempty"` + + // Collection of routes. + Routes []RouteCollectionVPCContextRoutesItem `json:"routes" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalRouteCollectionVPCContext unmarshals an instance of RouteCollectionVPCContext from the specified map of raw messages. +func UnmarshalRouteCollectionVPCContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCollectionVPCContext) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalRouteCollectionVPCContextFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionVPCContextNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteCollectionVPCContextRoutesItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *RouteCollectionVPCContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// RouteCollectionVPCContextFirst : A link to the first page of resources. +type RouteCollectionVPCContextFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalRouteCollectionVPCContextFirst unmarshals an instance of RouteCollectionVPCContextFirst from the specified map of raw messages. +func UnmarshalRouteCollectionVPCContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCollectionVPCContextFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCollectionVPCContextNext : A link to the next page of resources. This property is present for all pages except the last page. +type RouteCollectionVPCContextNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalRouteCollectionVPCContextNext unmarshals an instance of RouteCollectionVPCContextNext from the specified map of raw messages. +func UnmarshalRouteCollectionVPCContextNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCollectionVPCContextNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCollectionVPCContextRoutesItem : RouteCollectionVPCContextRoutesItem struct +type RouteCollectionVPCContextRoutesItem struct { + // The action to perform with a packet matching the route: + // - `delegate`: delegate to system-provided routes + // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes + // - `deliver`: deliver the packet to the specified `next_hop` + // - `drop`: drop the packet. + Action *string `json:"action" validate:"required"` + + // The date and time that the route was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If present, the resource that created the route. Routes with this property present cannot + // be directly deleted. All routes with an `origin` of `service` will have this property set, + // and future `origin` values may also have this property set. + Creator RouteCreatorIntf `json:"creator,omitempty"` + + // The destination of the route. + Destination *string `json:"destination" validate:"required"` + + // The URL for this route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the route. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this route. The name is unique across all routes in the routing table. + Name *string `json:"name" validate:"required"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For + // other `action` values, its `address` will be `0.0.0.0`. + NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` + + // The origin of this route: + // - `service`: route was directly created by a service + // - `user`: route was directly created by a user + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + Origin *string `json:"origin,omitempty"` + + // The priority of this route. Smaller values have higher priority. + // + // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest + // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is + // distributed between them. + Priority *int64 `json:"priority" validate:"required"` + + // The zone the route applies to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the RouteCollectionVPCContextRoutesItem.Action property. +// The action to perform with a packet matching the route: +// - `delegate`: delegate to system-provided routes +// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes +// - `deliver`: deliver the packet to the specified `next_hop` +// - `drop`: drop the packet. +const ( + RouteCollectionVPCContextRoutesItemActionDelegateConst = "delegate" + RouteCollectionVPCContextRoutesItemActionDelegateVPCConst = "delegate_vpc" + RouteCollectionVPCContextRoutesItemActionDeliverConst = "deliver" + RouteCollectionVPCContextRoutesItemActionDropConst = "drop" +) + +// Constants associated with the RouteCollectionVPCContextRoutesItem.LifecycleState property. +// The lifecycle state of the route. +const ( + RouteCollectionVPCContextRoutesItemLifecycleStateDeletingConst = "deleting" + RouteCollectionVPCContextRoutesItemLifecycleStateFailedConst = "failed" + RouteCollectionVPCContextRoutesItemLifecycleStatePendingConst = "pending" + RouteCollectionVPCContextRoutesItemLifecycleStateStableConst = "stable" + RouteCollectionVPCContextRoutesItemLifecycleStateSuspendedConst = "suspended" + RouteCollectionVPCContextRoutesItemLifecycleStateUpdatingConst = "updating" + RouteCollectionVPCContextRoutesItemLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the RouteCollectionVPCContextRoutesItem.Origin property. +// The origin of this route: +// - `service`: route was directly created by a service +// - `user`: route was directly created by a user +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + RouteCollectionVPCContextRoutesItemOriginServiceConst = "service" + RouteCollectionVPCContextRoutesItemOriginUserConst = "user" +) + +// UnmarshalRouteCollectionVPCContextRoutesItem unmarshals an instance of RouteCollectionVPCContextRoutesItem from the specified map of raw messages. +func UnmarshalRouteCollectionVPCContextRoutesItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCollectionVPCContextRoutesItem) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCreator : If present, the resource that created the route. Routes with this property present cannot be directly deleted. All +// routes with an `origin` of `service` will have this property set, and future `origin` values may also have this +// property set. +// Models which "extend" this model: +// - RouteCreatorVPNGatewayReference +// - RouteCreatorVPNServerReference +type RouteCreator struct { + // The VPN gateway's CRN. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The VPN gateway's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id,omitempty"` + + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the RouteCreator.ResourceType property. +// The resource type. +const ( + RouteCreatorResourceTypeVPNGatewayConst = "vpn_gateway" +) + +func (*RouteCreator) isaRouteCreator() bool { + return true +} + +type RouteCreatorIntf interface { + isaRouteCreator() bool +} + +// UnmarshalRouteCreator unmarshals an instance of RouteCreator from the specified map of raw messages. +func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreator) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHop : RouteNextHop struct +// Models which "extend" this model: +// - RouteNextHopIP +// - RouteNextHopVPNGatewayConnectionReference +type RouteNextHop struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the RouteNextHop.ResourceType property. +// The resource type. +const ( + RouteNextHopResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +func (*RouteNextHop) isaRouteNextHop() bool { + return true +} + +type RouteNextHopIntf interface { + isaRouteNextHop() bool +} + +// UnmarshalRouteNextHop unmarshals an instance of RouteNextHop from the specified map of raw messages. +func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHop) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatch : If `action` is `deliver`, the next hop that packets will be delivered to. For other +// `action` values, specify `0.0.0.0` or remove it by specifying `null`. +// +// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has +// an `action` of `deliver` and `next_hop` is an IP address. +// Models which "extend" this model: +// - RouteNextHopPatchRouteNextHopIP +// - RouteNextHopPatchVPNGatewayConnectionIdentity +type RouteNextHopPatch struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RouteNextHopPatch) isaRouteNextHopPatch() bool { + return true +} + +type RouteNextHopPatchIntf interface { + isaRouteNextHopPatch() bool +} + +// UnmarshalRouteNextHopPatch unmarshals an instance of RouteNextHopPatch from the specified map of raw messages. +func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePatch : RoutePatch struct +type RoutePatch struct { + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. + Name *string `json:"name,omitempty"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, specify `0.0.0.0` or remove it by specifying `null`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. + NextHop RouteNextHopPatchIntf `json:"next_hop,omitempty"` + + // The priority of this route. Smaller values have higher priority. + // + // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest + // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is + // distributed between them. + Priority *int64 `json:"priority,omitempty"` +} + +// UnmarshalRoutePatch unmarshals an instance of RoutePatch from the specified map of raw messages. +func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHopPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the RoutePatch +func (routePatch *RoutePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(routePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// RoutePrototype : RoutePrototype struct +type RoutePrototype struct { + // The action to perform with a packet matching the route: + // - `delegate`: delegate to system-provided routes + // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes + // - `deliver`: deliver the packet to the specified `next_hop` + // - `drop`: drop the packet. + Action *string `json:"action,omitempty"` + + // The destination of the route. At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Destination *string `json:"destination" validate:"required"` + + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, it must be omitted or specified as `0.0.0.0`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. + NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + + // The priority of this route. Smaller values have higher priority. + // + // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest + // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is + // distributed between them. + Priority *int64 `json:"priority,omitempty"` + + // The zone to apply the route to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// Constants associated with the RoutePrototype.Action property. +// The action to perform with a packet matching the route: +// - `delegate`: delegate to system-provided routes +// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes +// - `deliver`: deliver the packet to the specified `next_hop` +// - `drop`: drop the packet. +const ( + RoutePrototypeActionDelegateConst = "delegate" + RoutePrototypeActionDelegateVPCConst = "delegate_vpc" + RoutePrototypeActionDeliverConst = "deliver" + RoutePrototypeActionDropConst = "drop" +) + +// NewRoutePrototype : Instantiate RoutePrototype (Generic Model Constructor) +func (*VpcV1) NewRoutePrototype(destination string, zone ZoneIdentityIntf) (_model *RoutePrototype, err error) { + _model = &RoutePrototype{ + Destination: core.StringPtr(destination), + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalRoutePrototype unmarshals an instance of RoutePrototype from the specified map of raw messages. +func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRoutePrototypeNextHop) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHop : If `action` is `deliver`, the next hop that packets will be delivered to. For other +// `action` values, it must be omitted or specified as `0.0.0.0`. +// +// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has +// an `action` of `deliver` and `next_hop` is an IP address. +// Models which "extend" this model: +// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity +type RoutePrototypeNextHop struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RoutePrototypeNextHop) isaRoutePrototypeNextHop() bool { + return true +} + +type RoutePrototypeNextHopIntf interface { + isaRoutePrototypeNextHop() bool +} + +// UnmarshalRoutePrototypeNextHop unmarshals an instance of RoutePrototypeNextHop from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHop(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHop) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteReference : RouteReference struct +type RouteReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *RouteReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` + + // The name for this route. The name is unique across all routes in the routing table. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalRouteReference unmarshals an instance of RouteReference from the specified map of raw messages. +func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRouteReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type RouteReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalRouteReferenceDeleted unmarshals an instance of RouteReferenceDeleted from the specified map of raw messages. +func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTable : RoutingTable struct +type RoutingTable struct { + // The filters specifying the resources that may create routes in this routing table. + // + // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` + + // The date and time that this routing table was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this routing table. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` + + // Indicates whether this is the default routing table for this VPC. + IsDefault *bool `json:"is_default" validate:"required"` + + // The lifecycle state of the routing table. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this routing table. The name is unique across all routing tables for the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from the internet. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be + // subject to routes in this routing table. + // - Routes with an action of deliver are treated as drop unless the `next_hop` is an + // IP address bound to a network interface on a subnet in the route's `zone`. + // Therefore, if an incoming packet matches a route with a `next_hop` of an + // internet-bound IP address or a VPN gateway connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from from [Transit + // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` + + // The routes for this routing table. + Routes []RouteReference `json:"routes" validate:"required"` + + // The subnets to which this routing table is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` +} + +// Constants associated with the RoutingTable.LifecycleState property. +// The lifecycle state of the routing table. +const ( + RoutingTableLifecycleStateDeletingConst = "deleting" + RoutingTableLifecycleStateFailedConst = "failed" + RoutingTableLifecycleStatePendingConst = "pending" + RoutingTableLifecycleStateStableConst = "stable" + RoutingTableLifecycleStateSuspendedConst = "suspended" + RoutingTableLifecycleStateUpdatingConst = "updating" + RoutingTableLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the RoutingTable.ResourceType property. +// The resource type. +const ( + RoutingTableResourceTypeRoutingTableConst = "routing_table" +) + +// UnmarshalRoutingTable unmarshals an instance of RoutingTable from the specified map of raw messages. +func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTable) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableCollection : RoutingTableCollection struct +type RoutingTableCollection struct { + // A link to the first page of resources. + First *RoutingTableCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *RoutingTableCollectionNext `json:"next,omitempty"` + + // Collection of routing tables. + RoutingTables []RoutingTable `json:"routing_tables" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalRoutingTableCollection unmarshals an instance of RoutingTableCollection from the specified map of raw messages. +func UnmarshalRoutingTableCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalRoutingTableCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRoutingTableCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_tables", &obj.RoutingTables, UnmarshalRoutingTable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *RoutingTableCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// RoutingTableCollectionFirst : A link to the first page of resources. +type RoutingTableCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalRoutingTableCollectionFirst unmarshals an instance of RoutingTableCollectionFirst from the specified map of raw messages. +func UnmarshalRoutingTableCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type RoutingTableCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalRoutingTableCollectionNext unmarshals an instance of RoutingTableCollectionNext from the specified map of raw messages. +func UnmarshalRoutingTableCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableIdentity : Identifies a routing table by a unique property. +// Models which "extend" this model: +// - RoutingTableIdentityByID +// - RoutingTableIdentityByHref +type RoutingTableIdentity struct { + // The unique identifier for this routing table. + ID *string `json:"id,omitempty"` + + // The URL for this routing table. + Href *string `json:"href,omitempty"` +} + +func (*RoutingTableIdentity) isaRoutingTableIdentity() bool { + return true +} + +type RoutingTableIdentityIntf interface { + isaRoutingTableIdentity() bool +} + +// UnmarshalRoutingTableIdentity unmarshals an instance of RoutingTableIdentity from the specified map of raw messages. +func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTablePatch : RoutingTablePatch struct +type RoutingTablePatch struct { + // The filters specifying the resources that may create routes in this routing table + // (replacing any existing filters). All routes created by resources that match a given filter will be removed when an + // existing filter is removed. Therefore, if an empty array is specified, all filters will be removed, resulting in all + // routes not directly created by the user being removed. + // + // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` + + // The 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. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` + + // Indicates whether this routing table is used to route traffic that originates from the internet. Updating to `true` + // selects this routing table, provided no other routing table in the VPC already has this property set to `true`. + // Updating to `false` deselects this routing table. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be subject + // to routes in this routing table. + // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is an + // IP address bound to a network interface on a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. Updating to + // `true` selects this routing table, provided no other routing table in the VPC already has this property set to + // `true`, and no subnets are attached to this routing table. Updating to `false` deselects this routing table. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + // + // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled + // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing + // table. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` + + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. Updating to `true` selects this routing table, provided no other routing table in the VPC already has this + // property set to `true`, and no subnets are attached to this routing table. Updating to `false` deselects this + // routing table. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` +} + +// UnmarshalRoutingTablePatch unmarshals an instance of RoutingTablePatch from the specified map of raw messages. +func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTablePatch) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the RoutingTablePatch +func (routingTablePatch *RoutingTablePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(routingTablePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// RoutingTableReference : RoutingTableReference struct +type RoutingTableReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *RoutingTableReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this routing table. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` + + // The name for this routing table. The name is unique across all routing tables for the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RoutingTableReference.ResourceType property. +// The resource type. +const ( + RoutingTableReferenceResourceTypeRoutingTableConst = "routing_table" +) + +// UnmarshalRoutingTableReference unmarshals an instance of RoutingTableReference from the specified map of raw messages. +func UnmarshalRoutingTableReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRoutingTableReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type RoutingTableReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalRoutingTableReferenceDeleted unmarshals an instance of RoutingTableReferenceDeleted from the specified map of raw messages. +func UnmarshalRoutingTableReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroup : SecurityGroup struct +type SecurityGroup struct { + // The date and time that this security group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The name for this security group. The name is unique across all security groups for the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this security group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The rules for this security group. If no rules exist, all traffic will be denied. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` + + // The targets for this security group. + Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` + + // The VPC this security group resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalSecurityGroup unmarshals an instance of SecurityGroup from the specified map of raw messages. +func UnmarshalSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroup) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupCollection : SecurityGroupCollection struct +type SecurityGroupCollection struct { + // A link to the first page of resources. + First *SecurityGroupCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *SecurityGroupCollectionNext `json:"next,omitempty"` + + // Collection of security groups. + SecurityGroups []SecurityGroup `json:"security_groups" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalSecurityGroupCollection unmarshals an instance of SecurityGroupCollection from the specified map of raw messages. +func UnmarshalSecurityGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSecurityGroupCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *SecurityGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// SecurityGroupCollectionFirst : A link to the first page of resources. +type SecurityGroupCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSecurityGroupCollectionFirst unmarshals an instance of SecurityGroupCollectionFirst from the specified map of raw messages. +func UnmarshalSecurityGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type SecurityGroupCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSecurityGroupCollectionNext unmarshals an instance of SecurityGroupCollectionNext from the specified map of raw messages. +func UnmarshalSecurityGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentity : Identifies a security group by a unique property. +// Models which "extend" this model: +// - SecurityGroupIdentityByID +// - SecurityGroupIdentityByCRN +// - SecurityGroupIdentityByHref +type SecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupIdentity) isaSecurityGroupIdentity() bool { + return true +} + +type SecurityGroupIdentityIntf interface { + isaSecurityGroupIdentity() bool +} + +// UnmarshalSecurityGroupIdentity unmarshals an instance of SecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupPatch : SecurityGroupPatch struct +type SecurityGroupPatch struct { + // The name for this security group. The name must not be used by another security group for the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalSecurityGroupPatch unmarshals an instance of SecurityGroupPatch from the specified map of raw messages. +func UnmarshalSecurityGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the SecurityGroupPatch +func (securityGroupPatch *SecurityGroupPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(securityGroupPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// SecurityGroupReference : SecurityGroupReference struct +type SecurityGroupReference struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The name for this security group. The name is unique across all security groups for the VPC. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalSecurityGroupReference unmarshals an instance of SecurityGroupReference from the specified map of raw messages. +func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type SecurityGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSecurityGroupReferenceDeleted unmarshals an instance of SecurityGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalSecurityGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRule : SecurityGroupRule struct +// Models which "extend" this model: +// - SecurityGroupRuleSecurityGroupRuleProtocolAll +// - SecurityGroupRuleSecurityGroupRuleProtocolIcmp +// - SecurityGroupRuleSecurityGroupRuleProtocolTcpudp +type SecurityGroupRule struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The IP addresses or security groups from which this rule allows traffic (or to which, for + // outbound rules). Can be specified as an IP address, a CIDR block, or a security group. A + // CIDR block of `0.0.0.0/0` allows traffic from any source (or to any destination, for + // outbound rules). + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The ICMP traffic code to allow. If absent, all codes are allowed. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to allow. If absent, all types are allowed. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of TCP/UDP destination port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + PortMin *int64 `json:"port_min,omitempty"` +} + +// Constants associated with the SecurityGroupRule.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleDirectionInboundConst = "inbound" + SecurityGroupRuleDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRule.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRule.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleProtocolAllConst = "all" + SecurityGroupRuleProtocolIcmpConst = "icmp" + SecurityGroupRuleProtocolTCPConst = "tcp" + SecurityGroupRuleProtocolUDPConst = "udp" +) + +func (*SecurityGroupRule) isaSecurityGroupRule() bool { + return true +} + +type SecurityGroupRuleIntf interface { + isaSecurityGroupRule() bool +} + +// UnmarshalSecurityGroupRule unmarshals an instance of SecurityGroupRule from the specified map of raw messages. +func UnmarshalSecurityGroupRule(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "protocol", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// SecurityGroupRuleCollection : Collection of rules in a security group. +type SecurityGroupRuleCollection struct { + // Array of rules. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` +} + +// UnmarshalSecurityGroupRuleCollection unmarshals an instance of SecurityGroupRuleCollection from the specified map of raw messages. +func UnmarshalSecurityGroupRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleCollection) + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePatch : SecurityGroupRulePatch struct +type SecurityGroupRulePatch struct { + // The ICMP traffic code to allow. If set, `type` must also be set. + // + // Specify `null` to remove an existing ICMP traffic code. + Code *int64 `json:"code,omitempty"` + + // The direction of traffic to enforce. + Direction *string `json:"direction,omitempty"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The inclusive upper bound of the protocol destination port range. If set, `port_min` must also be set, and must not + // be larger. + // + // Specify `null` to remove an existing upper bound. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the protocol destination port range. If set, `port_max` must also be set, and must not + // be smaller. + // + // Specify `null` to remove an existing lower bound. + PortMin *int64 `json:"port_min,omitempty"` + + // The IP addresses or security groups from which this rule will allow traffic (or to + // which, for outbound rules). Can be specified as an IP address, a CIDR block, or a + // security group. A CIDR block of `0.0.0.0/0` will allow traffic from any source (or to + // any destination, for outbound rules). + Remote SecurityGroupRuleRemotePatchIntf `json:"remote,omitempty"` + + // The ICMP traffic type to allow. + // + // Specify `null` to remove an existing ICMP traffic type value. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the SecurityGroupRulePatch.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePatchDirectionInboundConst = "inbound" + SecurityGroupRulePatchDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePatch.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePatchIPVersionIpv4Const = "ipv4" +) + +// UnmarshalSecurityGroupRulePatch unmarshals an instance of SecurityGroupRulePatch from the specified map of raw messages. +func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePatch) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the SecurityGroupRulePatch +func (securityGroupRulePatch *SecurityGroupRulePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(securityGroupRulePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// SecurityGroupRulePrototype : SecurityGroupRulePrototype struct +// Models which "extend" this model: +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp +type SecurityGroupRulePrototype struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The IP addresses or security groups from which this rule will allow traffic (or to which, + // for outbound rules). Can be specified as an IP address, a CIDR block, or a security group + // within the VPC. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The ICMP traffic code to allow. + // + // If specified, `type` must also be specified. If unspecified, all codes are allowed. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to allow. + // + // If unspecified, all types are allowed. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of TCP/UDP destination port range. + // + // If specified, `port_min` must also be specified, and must not be larger. If unspecified, + // `port_min` must also be unspecified, allowing traffic on all destination ports. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range + // + // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be + // unspecified, allowing traffic on all destination ports. + PortMin *int64 `json:"port_min,omitempty"` +} + +// Constants associated with the SecurityGroupRulePrototype.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePrototypeDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototype.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototype.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeProtocolAllConst = "all" + SecurityGroupRulePrototypeProtocolIcmpConst = "icmp" + SecurityGroupRulePrototypeProtocolTCPConst = "tcp" + SecurityGroupRulePrototypeProtocolUDPConst = "udp" +) + +func (*SecurityGroupRulePrototype) isaSecurityGroupRulePrototype() bool { + return true +} + +type SecurityGroupRulePrototypeIntf interface { + isaSecurityGroupRulePrototype() bool +} + +// UnmarshalSecurityGroupRulePrototype unmarshals an instance of SecurityGroupRulePrototype from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "protocol", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// SecurityGroupRuleRemote : The IP addresses or security groups from which this rule allows traffic (or to which, for outbound rules). Can be +// specified as an IP address, a CIDR block, or a security group. A CIDR block of `0.0.0.0/0` allows traffic from any +// source (or to any destination, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleRemoteIP +// - SecurityGroupRuleRemoteCIDR +// - SecurityGroupRuleRemoteSecurityGroupReference +type SecurityGroupRuleRemote struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The name for this security group. The name is unique across all security groups for the VPC. + Name *string `json:"name,omitempty"` +} + +func (*SecurityGroupRuleRemote) isaSecurityGroupRuleRemote() bool { + return true +} + +type SecurityGroupRuleRemoteIntf interface { + isaSecurityGroupRuleRemote() bool +} + +// UnmarshalSecurityGroupRuleRemote unmarshals an instance of SecurityGroupRuleRemote from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemote) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatch : The IP addresses or security groups from which this rule will allow traffic (or to which, for outbound rules). Can be +// specified as an IP address, a CIDR block, or a security group. A CIDR block of `0.0.0.0/0` will allow traffic from +// any source (or to any destination, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleRemotePatchIP +// - SecurityGroupRuleRemotePatchCIDR +// - SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatch struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePatch) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +type SecurityGroupRuleRemotePatchIntf interface { + isaSecurityGroupRuleRemotePatch() bool +} + +// UnmarshalSecurityGroupRuleRemotePatch unmarshals an instance of SecurityGroupRuleRemotePatch from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototype : The IP addresses or security groups from which this rule will allow traffic (or to which, for outbound rules). Can be +// specified as an IP address, a CIDR block, or a security group within the VPC. +// +// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source +// (or to any destination, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleRemotePrototypeIP +// - SecurityGroupRuleRemotePrototypeCIDR +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototype struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePrototype) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +type SecurityGroupRuleRemotePrototypeIntf interface { + isaSecurityGroupRuleRemotePrototype() bool +} + +// UnmarshalSecurityGroupRuleRemotePrototype unmarshals an instance of SecurityGroupRuleRemotePrototype from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototype) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetCollection : SecurityGroupTargetCollection struct +type SecurityGroupTargetCollection struct { + // A link to the first page of resources. + First *SecurityGroupTargetCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *SecurityGroupTargetCollectionNext `json:"next,omitempty"` + + // Collection of targets for this security group. + Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalSecurityGroupTargetCollection unmarshals an instance of SecurityGroupTargetCollection from the specified map of raw messages. +func UnmarshalSecurityGroupTargetCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSecurityGroupTargetCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupTargetCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *SecurityGroupTargetCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// SecurityGroupTargetCollectionFirst : A link to the first page of resources. +type SecurityGroupTargetCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSecurityGroupTargetCollectionFirst unmarshals an instance of SecurityGroupTargetCollectionFirst from the specified map of raw messages. +func UnmarshalSecurityGroupTargetCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type SecurityGroupTargetCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSecurityGroupTargetCollectionNext unmarshals an instance of SecurityGroupTargetCollectionNext from the specified map of raw messages. +func UnmarshalSecurityGroupTargetCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReference : The resource types that can be security group targets are expected to expand in the future. When iterating over +// security group targets, do not assume that every target resource will be from a known set of resource types. +// Optionally halt processing and surface an error, or bypass resources of unrecognized types. +// Models which "extend" this model: +// - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext +// - SecurityGroupTargetReferenceLoadBalancerReference +// - SecurityGroupTargetReferenceEndpointGatewayReference +// - SecurityGroupTargetReferenceVPNServerReference +// - SecurityGroupTargetReferenceVirtualNetworkInterfaceReference +type SecurityGroupTargetReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The name for this network interface. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The load balancer's CRN. + CRN *string `json:"crn,omitempty"` + + // The primary IP for this virtual network interface. + PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet,omitempty"` +} + +// Constants associated with the SecurityGroupTargetReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*SecurityGroupTargetReference) isaSecurityGroupTargetReference() bool { + return true +} + +type SecurityGroupTargetReferenceIntf interface { + isaSecurityGroupTargetReference() bool +} + +// UnmarshalSecurityGroupTargetReference unmarshals an instance of SecurityGroupTargetReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SetSubnetPublicGatewayOptions : The SetSubnetPublicGateway options. +type SetSubnetPublicGatewayOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The public gateway identity. + PublicGatewayIdentity PublicGatewayIdentityIntf `json:"PublicGatewayIdentity" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewSetSubnetPublicGatewayOptions : Instantiate SetSubnetPublicGatewayOptions +func (*VpcV1) NewSetSubnetPublicGatewayOptions(id string, publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { + return &SetSubnetPublicGatewayOptions{ + ID: core.StringPtr(id), + PublicGatewayIdentity: publicGatewayIdentity, + } +} + +// SetID : Allow user to set ID +func (_options *SetSubnetPublicGatewayOptions) SetID(id string) *SetSubnetPublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetPublicGatewayIdentity : Allow user to set PublicGatewayIdentity +func (_options *SetSubnetPublicGatewayOptions) SetPublicGatewayIdentity(publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { + _options.PublicGatewayIdentity = publicGatewayIdentity + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *SetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *SetSubnetPublicGatewayOptions { + options.Headers = param + return options +} + +// Share : Share struct +type Share struct { + // The access control mode for the share: + // + // - `security_group`: The security groups on the virtual network interface for a mount + // target control access to the mount target. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // + // The enumerated access control mode values for this property may expand in the future. When processing this property, + // check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which + // the unexpected access control mode was encountered. + AccessControlMode *string `json:"access_control_mode" validate:"required"` + + // The date and time that the file share is created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this file share. + CRN *string `json:"crn" validate:"required"` + + // The type of encryption used for this file share. + Encryption *string `json:"encryption" validate:"required"` + + // The key used to encrypt this file share. + EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + + // The URL for this file share. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this file share. + ID *string `json:"id" validate:"required"` + + // The maximum input/output operations per second (IOPS) for the file share. In addition, each host accessing the share + // will be restricted to 48000 IOPS. + // + // The maximum IOPS for a share may increase in the future. + Iops *int64 `json:"iops" validate:"required"` + + // The latest job associated with this file share. + // + // This property will be absent if no jobs have been created for this file share. + LatestJob *ShareJob `json:"latest_job,omitempty"` + + // The lifecycle state of the file share. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // Mount targets for the file share. + MountTargets []ShareMountTargetReference `json:"mount_targets" validate:"required"` + + // The name for this share. The name is unique across all shares in the region. + Name *string `json:"name" validate:"required"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) for + // this file share. + Profile *ShareProfileReference `json:"profile" validate:"required"` + + // The replica file share for this source file share. + // + // This property will be present when the `replication_role` is `source`. + ReplicaShare *ShareReference `json:"replica_share,omitempty"` + + // The cron specification for the file share replication schedule. + // + // This property will be present when the `replication_role` is `replica`. + ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` + + // The replication role of the file share. + // + // * `none`: This share is not participating in replication. + // * `replica`: This share is a replication target. + // * `source`: This share is a replication source. + ReplicationRole *string `json:"replication_role" validate:"required"` + + // The replication status of the file share. + // + // * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the + // replication schedule. + // * `failover_pending`: This share is performing a replication failover. + // * `initializing`: This share is initializing replication. + // * `none`: This share is not participating in replication. + // * `split_pending`: This share is performing a replication split. + ReplicationStatus *string `json:"replication_status" validate:"required"` + + // The reasons for the current replication status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + ReplicationStatusReasons []ShareReplicationStatusReason `json:"replication_status_reasons" validate:"required"` + + // The resource group for this file share. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the file share rounded up to the next gigabyte. + // + // The maximum size for a share may increase in the future. + Size *int64 `json:"size" validate:"required"` + + // The source file share for this replica file share. + // + // This property will be present when the `replication_role` is `replica`. + SourceShare *ShareReference `json:"source_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags" validate:"required"` + + // The zone this file share will reside in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Share.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a mount +// target control access to the mount target. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// +// The enumerated access control mode values for this property may expand in the future. When processing this property, +// check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which +// the unexpected access control mode was encountered. +const ( + ShareAccessControlModeSecurityGroupConst = "security_group" + ShareAccessControlModeVPCConst = "vpc" +) + +// Constants associated with the Share.Encryption property. +// The type of encryption used for this file share. +const ( + ShareEncryptionProviderManagedConst = "provider_managed" + ShareEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Share.LifecycleState property. +// The lifecycle state of the file share. +const ( + ShareLifecycleStateDeletingConst = "deleting" + ShareLifecycleStateFailedConst = "failed" + ShareLifecycleStatePendingConst = "pending" + ShareLifecycleStateStableConst = "stable" + ShareLifecycleStateSuspendedConst = "suspended" + ShareLifecycleStateUpdatingConst = "updating" + ShareLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Share.ReplicationRole property. +// The replication role of the file share. +// +// * `none`: This share is not participating in replication. +// * `replica`: This share is a replication target. +// * `source`: This share is a replication source. +const ( + ShareReplicationRoleNoneConst = "none" + ShareReplicationRoleReplicaConst = "replica" + ShareReplicationRoleSourceConst = "source" +) + +// Constants associated with the Share.ReplicationStatus property. +// The replication status of the file share. +// +// * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the +// replication schedule. +// * `failover_pending`: This share is performing a replication failover. +// * `initializing`: This share is initializing replication. +// * `none`: This share is not participating in replication. +// * `split_pending`: This share is performing a replication split. +const ( + ShareReplicationStatusActiveConst = "active" + ShareReplicationStatusFailoverPendingConst = "failover_pending" + ShareReplicationStatusInitializingConst = "initializing" + ShareReplicationStatusNoneConst = "none" + ShareReplicationStatusSplitPendingConst = "split_pending" +) + +// Constants associated with the Share.ResourceType property. +// The resource type. +const ( + ShareResourceTypeShareConst = "share" +) + +// UnmarshalShare unmarshals an instance of Share from the specified map of raw messages. +func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Share) + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalModel(m, "latest_job", &obj.LatestJob, UnmarshalShareJob) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalShareReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_role", &obj.ReplicationRole) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_status", &obj.ReplicationStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "replication_status_reasons", &obj.ReplicationStatusReasons, UnmarshalShareReplicationStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareCollection : ShareCollection struct +type ShareCollection struct { + // A link to the first page of resources. + First *ShareCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ShareCollectionNext `json:"next,omitempty"` + + // Collection of file shares. + Shares []Share `json:"shares" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalShareCollection unmarshals an instance of ShareCollection from the specified map of raw messages. +func UnmarshalShareCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "shares", &obj.Shares, UnmarshalShare) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ShareCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// ShareCollectionFirst : A link to the first page of resources. +type ShareCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalShareCollectionFirst unmarshals an instance of ShareCollectionFirst from the specified map of raw messages. +func UnmarshalShareCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type ShareCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalShareCollectionNext unmarshals an instance of ShareCollectionNext from the specified map of raw messages. +func UnmarshalShareCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareIdentity : Identifies a file share by a unique property. +// Models which "extend" this model: +// - ShareIdentityByID +// - ShareIdentityByCRN +// - ShareIdentityByHref +type ShareIdentity struct { + // The unique identifier for this file share. + ID *string `json:"id,omitempty"` + + // The CRN for this file share. + CRN *string `json:"crn,omitempty"` + + // The URL for this file share. + Href *string `json:"href,omitempty"` +} + +func (*ShareIdentity) isaShareIdentity() bool { + return true +} + +type ShareIdentityIntf interface { + isaShareIdentity() bool +} + +// UnmarshalShareIdentity unmarshals an instance of ShareIdentity from the specified map of raw messages. +func UnmarshalShareIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareInitialOwner : ShareInitialOwner struct +type ShareInitialOwner struct { + // The initial group identifier for the file share. + Gid *int64 `json:"gid,omitempty"` + + // The initial user identifier for the file share. + Uid *int64 `json:"uid,omitempty"` +} + +// UnmarshalShareInitialOwner unmarshals an instance of ShareInitialOwner from the specified map of raw messages. +func UnmarshalShareInitialOwner(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareInitialOwner) + err = core.UnmarshalPrimitive(m, "gid", &obj.Gid) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uid", &obj.Uid) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareJob : ShareJob struct +type ShareJob struct { + // The status of the file share job. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the + // unexpected property value was encountered. + // + // * `cancelled`: This job has been cancelled. + // * `failed`: This job has failed. + // * `queued`: This job is queued. + // * `running`: This job is running. + // * `succeeded`: This job completed successfully. + Status *string `json:"status" validate:"required"` + + // The reasons for the file share job status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []ShareJobStatusReason `json:"status_reasons" validate:"required"` + + // The type of the file share job. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the + // unexpected property value was encountered. + // + // * `replication_failover`: This is a share replication failover job. + // * `replication_init`: This is a share replication is initialization job. + // * `replication_split`: This is a share replication split job. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the ShareJob.Status property. +// The status of the file share job. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the +// unexpected property value was encountered. +// +// * `cancelled`: This job has been cancelled. +// * `failed`: This job has failed. +// * `queued`: This job is queued. +// * `running`: This job is running. +// * `succeeded`: This job completed successfully. +const ( + ShareJobStatusCancelledConst = "cancelled" + ShareJobStatusFailedConst = "failed" + ShareJobStatusQueuedConst = "queued" + ShareJobStatusRunningConst = "running" + ShareJobStatusSucceededConst = "succeeded" +) + +// Constants associated with the ShareJob.Type property. +// The type of the file share job. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the +// unexpected property value was encountered. +// +// * `replication_failover`: This is a share replication failover job. +// * `replication_init`: This is a share replication is initialization job. +// * `replication_split`: This is a share replication split job. +const ( + ShareJobTypeReplicationFailoverConst = "replication_failover" + ShareJobTypeReplicationInitConst = "replication_init" + ShareJobTypeReplicationSplitConst = "replication_split" +) + +// UnmarshalShareJob unmarshals an instance of ShareJob from the specified map of raw messages. +func UnmarshalShareJob(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareJob) + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalShareJobStatusReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareJobStatusReason : ShareJobStatusReason struct +type ShareJobStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` + + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the ShareJobStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ShareJobStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" + ShareJobStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" + ShareJobStatusReasonCodeCannotReachSourceShareConst = "cannot_reach_source_share" +) + +// UnmarshalShareJobStatusReason unmarshals an instance of ShareJobStatusReason from the specified map of raw messages. +func UnmarshalShareJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareJobStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTarget : ShareMountTarget struct +type ShareMountTarget struct { + // The access control mode for the share: + // + // - `security_group`: The security groups on the virtual network interface for a mount + // target control access to the mount target. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // + // The enumerated access control mode values for this property may expand in the future. When processing this property, + // check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which + // the unexpected access control mode was encountered. + AccessControlMode *string `json:"access_control_mode" validate:"required"` + + // The date and time that the share mount target was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this share mount target. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this share mount target. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the mount target. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The mount path for the share. The server component of the mount path may be either an IP address or a fully + // qualified domain name. + // + // This property will be absent if the `lifecycle_state` of the mount target is + // 'pending', `failed`, or `deleting`. + // + // If the share's `access_control_mode` is: + // + // - `security_group`: The IP address used in the mount path is the `primary_ip` + // address of the virtual network interface for this share mount target. + // - `vpc`: The fully-qualified domain name used in the mount path is an address that + // resolves to the share mount target. + MountPath *string `json:"mount_path,omitempty"` + + // The name for this share mount target. The name is unique across all mount targets for the file share. + Name *string `json:"name" validate:"required"` + + // The primary IP address of the virtual network interface for the share mount target. + // + // Absent if `access_control_mode` is `vpc`. + PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The subnet of the virtual network interface for the share mount target. + // + // Absent if `access_control_mode` is `vpc`. + Subnet *SubnetReference `json:"subnet,omitempty"` + + // The transit encryption mode for this share mount target: + // - `none`: Not encrypted in transit + // - `user_managed`: Encrypted in transit using an instance identity certificate + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + TransitEncryption *string `json:"transit_encryption" validate:"required"` + + // The virtual network interface for this file share mount target. + // + // This property will be present when the `access_control_mode` is `security_group`. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface,omitempty"` + + // If `access_control_mode` is: + // + // - `security_group`: The VPC for the virtual network interface for this share mount + // target + // - `vpc`: The VPC in which clients can mount the file share using this share + // mount target. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the ShareMountTarget.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a mount +// target control access to the mount target. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// +// The enumerated access control mode values for this property may expand in the future. When processing this property, +// check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which +// the unexpected access control mode was encountered. +const ( + ShareMountTargetAccessControlModeSecurityGroupConst = "security_group" + ShareMountTargetAccessControlModeVPCConst = "vpc" +) + +// Constants associated with the ShareMountTarget.LifecycleState property. +// The lifecycle state of the mount target. +const ( + ShareMountTargetLifecycleStateDeletingConst = "deleting" + ShareMountTargetLifecycleStateFailedConst = "failed" + ShareMountTargetLifecycleStatePendingConst = "pending" + ShareMountTargetLifecycleStateStableConst = "stable" + ShareMountTargetLifecycleStateSuspendedConst = "suspended" + ShareMountTargetLifecycleStateUpdatingConst = "updating" + ShareMountTargetLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the ShareMountTarget.ResourceType property. +// The resource type. +const ( + ShareMountTargetResourceTypeShareMountTargetConst = "share_mount_target" +) + +// Constants associated with the ShareMountTarget.TransitEncryption property. +// The transit encryption mode for this share mount target: +// - `none`: Not encrypted in transit +// - `user_managed`: Encrypted in transit using an instance identity certificate +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ShareMountTargetTransitEncryptionNoneConst = "none" + ShareMountTargetTransitEncryptionUserManagedConst = "user_managed" +) + +// UnmarshalShareMountTarget unmarshals an instance of ShareMountTarget from the specified map of raw messages. +func UnmarshalShareMountTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTarget) + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mount_path", &obj.MountPath) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetCollection : ShareMountTargetCollection struct +type ShareMountTargetCollection struct { + // Collection of share mount targets. + MountTargets []ShareMountTarget `json:"mount_targets" 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, "mount_targets", &obj.MountTargets, UnmarshalShareMountTarget) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetPatch : ShareMountTargetPatch struct +type ShareMountTargetPatch struct { + // The name for this share mount target. The name must not be used by another mount target for the file share. + Name *string `json:"name,omitempty"` +} + +// UnmarshalShareMountTargetPatch unmarshals an instance of ShareMountTargetPatch from the specified map of raw messages. +func UnmarshalShareMountTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the ShareMountTargetPatch +func (shareMountTargetPatch *ShareMountTargetPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(shareMountTargetPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// ShareMountTargetPrototype : ShareMountTargetPrototype struct +// Models which "extend" this model: +// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup +// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC +type ShareMountTargetPrototype struct { + // The name for this share mount target. The name must not be used by another mount target for the file share. + Name *string `json:"name,omitempty"` + + // The transit encryption mode to use for this share mount target: + // - `none`: Not encrypted in transit. + // - `user_managed`: Encrypted in transit using an instance identity certificate. The + // `access_control_mode` for the share must be `security_group`. + TransitEncryption *string `json:"transit_encryption,omitempty"` + + VirtualNetworkInterface VirtualNetworkInterfacePrototypeShareMountTargetContextIntf `json:"virtual_network_interface,omitempty"` + + // Identifies a VPC by a unique property. + VPC VPCIdentityIntf `json:"vpc,omitempty"` +} + +// Constants associated with the ShareMountTargetPrototype.TransitEncryption property. +// The transit encryption mode to use for this share mount target: +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. The +// `access_control_mode` for the share must be `security_group`. +const ( + ShareMountTargetPrototypeTransitEncryptionNoneConst = "none" + ShareMountTargetPrototypeTransitEncryptionUserManagedConst = "user_managed" +) + +func (*ShareMountTargetPrototype) isaShareMountTargetPrototype() bool { + return true +} + +type ShareMountTargetPrototypeIntf interface { + isaShareMountTargetPrototype() bool +} + +// UnmarshalShareMountTargetPrototype unmarshals an instance of ShareMountTargetPrototype from the specified map of raw messages. +func UnmarshalShareMountTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetReference : ShareMountTargetReference struct +type ShareMountTargetReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this share mount target. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this share mount target. + ID *string `json:"id" validate:"required"` + + // The name for this share mount target. The name is unique across all mount targets for the file share. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareMountTargetReference.ResourceType property. +// The resource type. +const ( + ShareMountTargetReferenceResourceTypeShareMountTargetConst = "share_mount_target" +) + +// UnmarshalShareMountTargetReference unmarshals an instance of ShareMountTargetReference from the specified map of raw messages. +func UnmarshalShareMountTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type ShareMountTargetReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalShareMountTargetReferenceDeleted unmarshals an instance of ShareMountTargetReferenceDeleted from the specified map of raw messages. +func UnmarshalShareMountTargetReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SharePatch : SharePatch struct +type SharePatch struct { + // The access control mode for the share: + // + // - `security_group`: The security groups on the virtual network interface for a + // mount target control access to the mount target. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // + // For this property to be changed, the share must have no mount targets and + // `replication_role` must be `none`. + AccessControlMode *string `json:"access_control_mode,omitempty"` + + // The maximum input/output operations per second (IOPS) for the file share. The value must be in the range supported + // by the share's size. + // + // For this property to be changed, the share `lifecycle_state` must be `stable` and the share must be in the `custom` + // or `defined_performance` profile family. + 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. + Profile ShareProfileIdentityIntf `json:"profile,omitempty"` + + // The cron specification for the file share replication schedule. + // + // Replication of a share can be scheduled to occur at most once per hour. + // + // For this property to be changed, the share `replication_role` must be `replica`. + ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` + + // The size of the file share rounded up to the next gigabyte. The value must not be less than the share's current + // size, and must not exceed the maximum supported by the share's profile and IOPS. + // + // For this property to be changed, the share `lifecycle_state` must be `stable`. + Size *int64 `json:"size,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` +} + +// Constants associated with the SharePatch.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a +// mount target control access to the mount target. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// +// For this property to be changed, the share must have no mount targets and +// `replication_role` must be `none`. +const ( + SharePatchAccessControlModeSecurityGroupConst = "security_group" + SharePatchAccessControlModeVPCConst = "vpc" +) + +// UnmarshalSharePatch unmarshals an instance of SharePatch from the specified map of raw messages. +func UnmarshalSharePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePatch) + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the SharePatch +func (sharePatch *SharePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(sharePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// ShareProfile : ShareProfile struct +type ShareProfile struct { + // The permitted capacity range (in gigabytes) for a share with this profile. + Capacity ShareProfileCapacityIntf `json:"capacity,omitempty"` + + // The product family this share profile belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this share profile. + Href *string `json:"href" validate:"required"` + + // The permitted IOPS range for a share with this profile. + Iops ShareProfileIopsIntf `json:"iops,omitempty"` + + // The globally unique name for this share profile. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareProfile.Family property. +// The product family this share profile belongs to. +const ( + 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, "capacity", &obj.Capacity, UnmarshalShareProfileCapacity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "iops", &obj.Iops, UnmarshalShareProfileIops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCapacity : ShareProfileCapacity struct +// Models which "extend" this model: +// - ShareProfileCapacityFixed +// - ShareProfileCapacityRange +// - ShareProfileCapacityEnum +// - ShareProfileCapacityDependentRange +type ShareProfileCapacity struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the ShareProfileCapacity.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityTypeFixedConst = "fixed" +) + +func (*ShareProfileCapacity) isaShareProfileCapacity() bool { + return true +} + +type ShareProfileCapacityIntf interface { + isaShareProfileCapacity() bool +} + +// UnmarshalShareProfileCapacity unmarshals an instance of ShareProfileCapacity from the specified map of raw messages. +func UnmarshalShareProfileCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCollection : ShareProfileCollection struct +type ShareProfileCollection struct { + // A link to the first page of resources. + First *ShareProfileCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ShareProfileCollectionNext `json:"next,omitempty"` + + // Collection of share profiles. + Profiles []ShareProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalShareProfileCollection unmarshals an instance of ShareProfileCollection from the specified map of raw messages. +func UnmarshalShareProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareProfileCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalShareProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ShareProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// ShareProfileCollectionFirst : A link to the first page of resources. +type ShareProfileCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalShareProfileCollectionFirst unmarshals an instance of ShareProfileCollectionFirst from the specified map of raw messages. +func UnmarshalShareProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type ShareProfileCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalShareProfileCollectionNext unmarshals an instance of ShareProfileCollectionNext from the specified map of raw messages. +func UnmarshalShareProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIops : ShareProfileIops struct +// Models which "extend" this model: +// - ShareProfileIopsFixed +// - ShareProfileIopsRange +// - ShareProfileIopsEnum +// - ShareProfileIopsDependentRange +type ShareProfileIops struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the ShareProfileIops.Type property. +// The type for this profile field. +const ( + ShareProfileIopsTypeFixedConst = "fixed" +) + +func (*ShareProfileIops) isaShareProfileIops() bool { + return true +} + +type ShareProfileIopsIntf interface { + isaShareProfileIops() bool +} + +// UnmarshalShareProfileIops unmarshals an instance of ShareProfileIops from the specified map of raw messages. +func UnmarshalShareProfileIops(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIops) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIdentity : Identifies a share profile by a unique property. +// Models which "extend" this model: +// - ShareProfileIdentityByName +// - ShareProfileIdentityByHref +type ShareProfileIdentity struct { + // The globally unique name for this share profile. + Name *string `json:"name,omitempty"` + + // The URL for this share profile. + Href *string `json:"href,omitempty"` +} + +func (*ShareProfileIdentity) isaShareProfileIdentity() bool { + return true +} + +type ShareProfileIdentityIntf interface { + isaShareProfileIdentity() bool +} + +// UnmarshalShareProfileIdentity unmarshals an instance of ShareProfileIdentity from the specified map of raw messages. +func UnmarshalShareProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileReference : ShareProfileReference struct +type ShareProfileReference struct { + // The URL for this share profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this share profile. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareProfileReference.ResourceType property. +// The resource type. +const ( + ShareProfileReferenceResourceTypeShareProfileConst = "share_profile" +) + +// UnmarshalShareProfileReference unmarshals an instance of ShareProfileReference from the specified map of raw messages. +func UnmarshalShareProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SharePrototype : SharePrototype struct +// Models which "extend" this model: +// - SharePrototypeShareBySize +// - SharePrototypeShareBySourceShare +type SharePrototype struct { + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the `custom` or + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each host accessing the share will be restricted to 48000 IOPS. + Iops *int64 `json:"iops,omitempty"` + + // The mount targets for the file share. Each mount target must be in a unique VPC. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` + + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use + // for this file share. The profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` + + // Configuration for a replica file share to create and associate with this file share. If + // unspecified, a replica may be subsequently added by creating a new file share with a + // `source_share` referencing this file share. + ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this file share will reside in. + // For a replica share, this must be a different zone in the same region as the source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The access control mode for the share: + // + // - `security_group`: The security groups on the virtual network interface for a + // mount target control access to the mount target. Mount targets for this share + // require a virtual network interface. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // Mount targets for this share require a VPC. + AccessControlMode *string `json:"access_control_mode,omitempty"` + + // The root key to use to wrap the data encryption key for the share. + // + // If unspecified, the `encryption` type for the share will be `provider_managed`. + // + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The owner assigned to the file share at creation. Subsequent changes to the owner + // must be performed by a client that has mounted the file share. + InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The size of the file share rounded up to the next gigabyte. + // + // The maximum size for a share may increase in the future. + Size *int64 `json:"size,omitempty"` + + // The cron specification for the file share replication schedule. + // + // Replication of a share can be scheduled to occur at most once per hour. + ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` + + // The source file share for this replica file share. The specified file share must not + // already have a replica, and must not be a replica. + SourceShare ShareIdentityIntf `json:"source_share,omitempty"` +} + +// Constants associated with the SharePrototype.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a +// mount target control access to the mount target. Mount targets for this share +// require a virtual network interface. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// Mount targets for this share require a VPC. +const ( + SharePrototypeAccessControlModeSecurityGroupConst = "security_group" + SharePrototypeAccessControlModeVPCConst = "vpc" +) + +func (*SharePrototype) isaSharePrototype() bool { + return true +} + +type SharePrototypeIntf interface { + isaSharePrototype() bool +} + +// UnmarshalSharePrototype unmarshals an instance of SharePrototype from the specified map of raw messages. +func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototype) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SharePrototypeShareContext : Configuration for a replica file share to create and associate with this file share. If unspecified, a replica may be +// subsequently added by creating a new file share with a +// `source_share` referencing this file share. +type SharePrototypeShareContext struct { + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the `custom` or + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each host accessing the share will be restricted to 48000 IOPS. + Iops *int64 `json:"iops,omitempty"` + + // The mount targets for this replica file share. Each mount target must be in a unique VPC. + // + // A replica's mount targets must be mounted read-only. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` + + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use + // for this file share. The profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` + + // The cron specification for the file share replication schedule. + // + // Replication of a share can be scheduled to occur at most once per hour. + ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"` + + // The resource group to use. If unspecified, the resource group from + // the source share will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this replica file share will reside in. + // + // Must be a different zone in the same region as the source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewSharePrototypeShareContext : Instantiate SharePrototypeShareContext (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareContext(profile ShareProfileIdentityIntf, replicationCronSpec string, zone ZoneIdentityIntf) (_model *SharePrototypeShareContext, err error) { + _model = &SharePrototypeShareContext{ + Profile: profile, + ReplicationCronSpec: core.StringPtr(replicationCronSpec), + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalSharePrototypeShareContext unmarshals an instance of SharePrototypeShareContext from the specified map of raw messages. +func UnmarshalSharePrototypeShareContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototypeShareContext) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareReference : ShareReference struct +type ShareReference struct { + // The CRN for this file share. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ShareReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this file share. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this file share. + ID *string `json:"id" validate:"required"` + + // The name for this share. The name is unique across all shares in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareReference.ResourceType property. +// The resource type. +const ( + ShareReferenceResourceTypeShareConst = "share" +) + +// UnmarshalShareReference unmarshals an instance of ShareReference from the specified map of raw messages. +func UnmarshalShareReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type ShareReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalShareReferenceDeleted unmarshals an instance of ShareReferenceDeleted from the specified map of raw messages. +func UnmarshalShareReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareReplicationStatusReason : ShareReplicationStatusReason struct +type ShareReplicationStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` + + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the ShareReplicationStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ShareReplicationStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" + ShareReplicationStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" + ShareReplicationStatusReasonCodeCannotReachSourceShareConst = "cannot_reach_source_share" +) + +// UnmarshalShareReplicationStatusReason unmarshals an instance of ShareReplicationStatusReason from the specified map of raw messages. +func UnmarshalShareReplicationStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareReplicationStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Snapshot : Snapshot struct +type Snapshot struct { + // If present, the backup policy plan which created this snapshot. + BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan,omitempty"` + + // Indicates if a boot volume attachment can be created with a volume created from this snapshot. + Bootable *bool `json:"bootable" validate:"required"` + + // The date and time the data capture for this snapshot was completed. + // + // If absent, this snapshot's data has not yet been captured. Additionally, this property may be absent for snapshots + // created before 1 January 2022. + CapturedAt *strfmt.DateTime `json:"captured_at,omitempty"` + + // Clones for this snapshot. + Clones []SnapshotClone `json:"clones" validate:"required"` + + // The copies of this snapshot. + Copies []SnapshotCopiesItem `json:"copies" validate:"required"` + + // The date and time that this snapshot was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN of this snapshot. + CRN *string `json:"crn" validate:"required"` + + // Indicates whether this snapshot can be deleted. This value will always be `true`. + // Deprecated: this field is deprecated and may be removed in a future release. + Deletable *bool `json:"deletable" validate:"required"` + + // The type of encryption used on the source volume. + Encryption *string `json:"encryption" validate:"required"` + + // The root key used to wrap the data encryption key for the source volume. + // + // This property will be present for volumes with an `encryption` type of + // `user_managed`. + EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + + // The URL for this snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this snapshot. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of this snapshot. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The minimum capacity of a volume created from this snapshot. When a snapshot is created, this will be set to the + // capacity of the `source_volume`. + MinimumCapacity *int64 `json:"minimum_capacity" validate:"required"` + + // The name for this snapshot. The name is unique across all snapshots in the region. + Name *string `json:"name" validate:"required"` + + // The operating system included in this image. + OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` + + // The resource group for this snapshot. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) prefixed with `is.snapshot:` associated with + // this snapshot. + ServiceTags []string `json:"service_tags" validate:"required"` + + // The size of this snapshot rounded up to the next gigabyte. + Size *int64 `json:"size" validate:"required"` + + // If present, the image from which the data on this snapshot was most directly + // provisioned. + SourceImage *ImageReference `json:"source_image,omitempty"` + + // If present, the source snapshot this snapshot was created from. + SourceSnapshot *SnapshotSourceSnapshot `json:"source_snapshot,omitempty"` + + // The source volume this snapshot was created from (may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + SourceVolume *VolumeReference `json:"source_volume" validate:"required"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags" validate:"required"` +} + +// Constants associated with the Snapshot.Encryption property. +// The type of encryption used on the source volume. +const ( + SnapshotEncryptionProviderManagedConst = "provider_managed" + SnapshotEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Snapshot.LifecycleState property. +// The lifecycle state of this snapshot. +const ( + SnapshotLifecycleStateDeletingConst = "deleting" + SnapshotLifecycleStateFailedConst = "failed" + SnapshotLifecycleStatePendingConst = "pending" + SnapshotLifecycleStateStableConst = "stable" + SnapshotLifecycleStateSuspendedConst = "suspended" + SnapshotLifecycleStateUpdatingConst = "updating" + SnapshotLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Snapshot.ResourceType property. +// The resource type. +const ( + SnapshotResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshot unmarshals an instance of Snapshot from the specified map of raw messages. +func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Snapshot) + err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "bootable", &obj.Bootable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "captured_at", &obj.CapturedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) + if err != nil { + return + } + err = core.UnmarshalModel(m, "copies", &obj.Copies, UnmarshalSnapshotCopiesItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deletable", &obj.Deletable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "minimum_capacity", &obj.MinimumCapacity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotSourceSnapshot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotClone : SnapshotClone struct +type SnapshotClone struct { + // Indicates whether this snapshot clone is available for use. + Available *bool `json:"available" validate:"required"` + + // The date and time that this snapshot clone was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The zone this snapshot clone resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalSnapshotClone unmarshals an instance of SnapshotClone from the specified map of raw messages. +func UnmarshalSnapshotClone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotClone) + err = core.UnmarshalPrimitive(m, "available", &obj.Available) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotCloneCollection : SnapshotCloneCollection struct +type SnapshotCloneCollection struct { + // Collection of snapshot clones. + Clones []SnapshotClone `json:"clones" validate:"required"` +} + +// UnmarshalSnapshotCloneCollection unmarshals an instance of SnapshotCloneCollection from the specified map of raw messages. +func UnmarshalSnapshotCloneCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotCloneCollection) + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotClonePrototype : SnapshotClonePrototype struct +type SnapshotClonePrototype struct { + // The zone this snapshot clone will reside in. Must be in the same region as the + // snapshot. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewSnapshotClonePrototype : Instantiate SnapshotClonePrototype (Generic Model Constructor) +func (*VpcV1) NewSnapshotClonePrototype(zone ZoneIdentityIntf) (_model *SnapshotClonePrototype, err error) { + _model = &SnapshotClonePrototype{ + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalSnapshotClonePrototype unmarshals an instance of SnapshotClonePrototype from the specified map of raw messages. +func UnmarshalSnapshotClonePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotClonePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotCollection : SnapshotCollection struct +type SnapshotCollection struct { + // A link to the first page of resources. + First *SnapshotCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *SnapshotCollectionNext `json:"next,omitempty"` + + // Collection of snapshots. + Snapshots []Snapshot `json:"snapshots" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalSnapshotCollection unmarshals an instance of SnapshotCollection from the specified map of raw messages. +func UnmarshalSnapshotCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSnapshotCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSnapshotCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshot) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *SnapshotCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// SnapshotCollectionFirst : A link to the first page of resources. +type SnapshotCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSnapshotCollectionFirst unmarshals an instance of SnapshotCollectionFirst from the specified map of raw messages. +func UnmarshalSnapshotCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type SnapshotCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSnapshotCollectionNext unmarshals an instance of SnapshotCollectionNext from the specified map of raw messages. +func UnmarshalSnapshotCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotCopiesItem : SnapshotCopiesItem struct +type SnapshotCopiesItem struct { + // The CRN for the copied snapshot. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + + // The URL for the copied snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for the copied snapshot. + ID *string `json:"id" validate:"required"` + + // The name for the copied snapshot. + Name *string `json:"name" validate:"required"` + + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *SnapshotRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SnapshotCopiesItem.ResourceType property. +// The resource type. +const ( + SnapshotCopiesItemResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshotCopiesItem unmarshals an instance of SnapshotCopiesItem from the specified map of raw messages. +func UnmarshalSnapshotCopiesItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotCopiesItem) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotIdentity : Identifies a snapshot by a unique property. +// Models which "extend" this model: +// - SnapshotIdentityByID +// - SnapshotIdentityByCRN +// - SnapshotIdentityByHref +type SnapshotIdentity struct { + // The unique identifier for this snapshot. + ID *string `json:"id,omitempty"` + + // The CRN of this snapshot. + CRN *string `json:"crn,omitempty"` + + // The URL for this snapshot. + Href *string `json:"href,omitempty"` +} + +func (*SnapshotIdentity) isaSnapshotIdentity() bool { + return true +} + +type SnapshotIdentityIntf interface { + isaSnapshotIdentity() bool +} + +// UnmarshalSnapshotIdentity unmarshals an instance of SnapshotIdentity from the specified map of raw messages. +func UnmarshalSnapshotIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotPatch : SnapshotPatch struct +type SnapshotPatch struct { + // The name for this snapshot. The name must not be used by another snapshot in the region. + Name *string `json:"name,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` +} + +// UnmarshalSnapshotPatch unmarshals an instance of SnapshotPatch from the specified map of raw messages. +func UnmarshalSnapshotPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the SnapshotPatch +func (snapshotPatch *SnapshotPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(snapshotPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// SnapshotPrototype : SnapshotPrototype struct +// Models which "extend" this model: +// - SnapshotPrototypeSnapshotBySourceVolume +// - SnapshotPrototypeSnapshotBySourceSnapshot +type SnapshotPrototype struct { + // Clones to create for this snapshot. + Clones []SnapshotClonePrototype `json:"clones,omitempty"` + + // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` + + // The volume to create this snapshot from. + SourceVolume VolumeIdentityIntf `json:"source_volume,omitempty"` + + // The root key to use to wrap the data encryption key for this snapshot. + // + // A key must be specified if and only if the source snapshot has an `encryption` type of + // `user_managed`. To maximize snapshot availability and sharing of snapshot data, specify + // a key in the same region as the new snapshot, and use the same encryption key for all + // snapshots using the same source volume. + // + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The source snapshot (in another region) to create this snapshot from. + // The specified snapshot must not already be the source of another snapshot in this + // region. + SourceSnapshot *SnapshotIdentityByCRN `json:"source_snapshot,omitempty"` +} + +func (*SnapshotPrototype) isaSnapshotPrototype() bool { + return true +} + +type SnapshotPrototypeIntf interface { + isaSnapshotPrototype() bool +} + +// UnmarshalSnapshotPrototype unmarshals an instance of SnapshotPrototype from the specified map of raw messages. +func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPrototype) + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotReference : SnapshotReference struct +type SnapshotReference struct { + // The CRN of this snapshot. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this snapshot. + ID *string `json:"id" validate:"required"` + + // The name for this snapshot. The name is unique across all snapshots in the region. + Name *string `json:"name" validate:"required"` + + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *SnapshotRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SnapshotReference.ResourceType property. +// The resource type. +const ( + SnapshotReferenceResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshotReference unmarshals an instance of SnapshotReference from the specified map of raw messages. +func UnmarshalSnapshotReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type SnapshotReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSnapshotReferenceDeleted unmarshals an instance of SnapshotReferenceDeleted from the specified map of raw messages. +func UnmarshalSnapshotReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type SnapshotRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalSnapshotRemote unmarshals an instance of SnapshotRemote from the specified map of raw messages. +func UnmarshalSnapshotRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotRemote) + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotSourceSnapshot : If present, the source snapshot this snapshot was created from. +type SnapshotSourceSnapshot struct { + // The CRN of the source snapshot. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + + // The URL for the source snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for the source snapshot. + ID *string `json:"id" validate:"required"` + + // The name for the source snapshot. The name is unique across all snapshots in the source snapshot's native region. + Name *string `json:"name" validate:"required"` + + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *SnapshotRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SnapshotSourceSnapshot.ResourceType property. +// The resource type. +const ( + SnapshotSourceSnapshotResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshotSourceSnapshot unmarshals an instance of SnapshotSourceSnapshot from the specified map of raw messages. +func UnmarshalSnapshotSourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotSourceSnapshot) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// StartBareMetalServerOptions : The StartBareMetalServer options. +type StartBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewStartBareMetalServerOptions : Instantiate StartBareMetalServerOptions +func (*VpcV1) NewStartBareMetalServerOptions(id string) *StartBareMetalServerOptions { + return &StartBareMetalServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *StartBareMetalServerOptions) SetID(id string) *StartBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *StartBareMetalServerOptions) SetHeaders(param map[string]string) *StartBareMetalServerOptions { + options.Headers = param + return options +} + +// StopBareMetalServerOptions : The StopBareMetalServer options. +type StopBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // The type of stop operation: + // - `soft`: signal running operating system to quiesce and shutdown cleanly + // - `hard`: immediately stop the server. + Type *string `json:"type" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the StopBareMetalServerOptions.Type property. +// The type of stop operation: +// - `soft`: signal running operating system to quiesce and shutdown cleanly +// - `hard`: immediately stop the server. +const ( + StopBareMetalServerOptionsTypeHardConst = "hard" + StopBareMetalServerOptionsTypeSoftConst = "soft" +) + +// NewStopBareMetalServerOptions : Instantiate StopBareMetalServerOptions +func (*VpcV1) NewStopBareMetalServerOptions(id string, typeVar string) *StopBareMetalServerOptions { + return &StopBareMetalServerOptions{ + ID: core.StringPtr(id), + Type: core.StringPtr(typeVar), + } +} + +// SetID : Allow user to set ID +func (_options *StopBareMetalServerOptions) SetID(id string) *StopBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetType : Allow user to set Type +func (_options *StopBareMetalServerOptions) SetType(typeVar string) *StopBareMetalServerOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *StopBareMetalServerOptions) SetHeaders(param map[string]string) *StopBareMetalServerOptions { + options.Headers = param + return options +} + +// Subnet : Subnet struct +type Subnet struct { + // The number of IPv4 addresses in this subnet that are not in-use, and have not been reserved by the user or the + // provider. + AvailableIpv4AddressCount *int64 `json:"available_ipv4_address_count" validate:"required"` + + // The date and time that the subnet was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` + + // The URL for this subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` + + // The IP version(s) supported by this subnet. + IPVersion *string `json:"ip_version" validate:"required"` + + // The IPv4 range of the subnet, expressed in CIDR format. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` + + // The name for this subnet. The name is unique across all subnets in the VPC. + Name *string `json:"name" validate:"required"` + + // The network ACL for this subnet. + NetworkACL *NetworkACLReference `json:"network_acl" validate:"required"` + + // The public gateway to use for internet-bound traffic for this subnet. + PublicGateway *PublicGatewayReference `json:"public_gateway,omitempty"` + + // The resource group for this subnet. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The routing table for this subnet. + RoutingTable *RoutingTableReference `json:"routing_table" validate:"required"` + + // The status of the subnet. + Status *string `json:"status" validate:"required"` + + // The total number of IPv4 addresses in this subnet. + // + // Note: This is calculated as 2(32 - prefix length). For example, the prefix length `/24` gives:
+ // 2(32 - 24) = 28 = 256 addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` + + // The VPC this subnet resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this subnet resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Subnet.IPVersion property. +// The IP version(s) supported by this subnet. +const ( + SubnetIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the Subnet.ResourceType property. +// The resource type. +const ( + SubnetResourceTypeSubnetConst = "subnet" +) + +// Constants associated with the Subnet.Status property. +// The status of the subnet. +const ( + SubnetStatusAvailableConst = "available" + SubnetStatusDeletingConst = "deleting" + SubnetStatusFailedConst = "failed" + SubnetStatusPendingConst = "pending" +) + +// UnmarshalSubnet unmarshals an instance of Subnet from the specified map of raw messages. +func UnmarshalSubnet(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Subnet) + err = core.UnmarshalPrimitive(m, "available_ipv4_address_count", &obj.AvailableIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetCollection : SubnetCollection struct +type SubnetCollection struct { + // A link to the first page of resources. + First *SubnetCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *SubnetCollectionNext `json:"next,omitempty"` + + // Collection of subnets. + Subnets []Subnet `json:"subnets" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalSubnetCollection unmarshals an instance of SubnetCollection from the specified map of raw messages. +func UnmarshalSubnetCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSubnetCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSubnetCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnet) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *SubnetCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// SubnetCollectionFirst : A link to the first page of resources. +type SubnetCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSubnetCollectionFirst unmarshals an instance of SubnetCollectionFirst from the specified map of raw messages. +func UnmarshalSubnetCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type SubnetCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSubnetCollectionNext unmarshals an instance of SubnetCollectionNext from the specified map of raw messages. +func UnmarshalSubnetCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentity : Identifies a subnet by a unique property. +// Models which "extend" this model: +// - SubnetIdentityByID +// - SubnetIdentityByCRN +// - SubnetIdentityByHref +type SubnetIdentity struct { + // The unique identifier for this subnet. + ID *string `json:"id,omitempty"` + + // The CRN for this subnet. + CRN *string `json:"crn,omitempty"` + + // The URL for this subnet. + Href *string `json:"href,omitempty"` +} + +func (*SubnetIdentity) isaSubnetIdentity() bool { + return true +} + +type SubnetIdentityIntf interface { + isaSubnetIdentity() bool +} + +// UnmarshalSubnetIdentity unmarshals an instance of SubnetIdentity from the specified map of raw messages. +func UnmarshalSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPatch : SubnetPatch struct +type SubnetPatch struct { + // The name for this subnet. The name must not be used by another subnet in the VPC. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to use for internet-bound traffic for this subnet. + PublicGateway SubnetPublicGatewayPatchIntf `json:"public_gateway,omitempty"` + + // The routing table to use for this subnet. The routing table properties + // `route_direct_link_ingress`, `route_internet_ingress`, + // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` +} + +// UnmarshalSubnetPatch unmarshals an instance of SubnetPatch from the specified map of raw messages. +func UnmarshalSubnetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalSubnetPublicGatewayPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the SubnetPatch +func (subnetPatch *SubnetPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(subnetPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// SubnetPrototype : SubnetPrototype struct +// Models which "extend" this model: +// - SubnetPrototypeSubnetByTotalCount +// - SubnetPrototypeSubnetByCIDR +type SubnetPrototype struct { + // The IP version(s) to support for this subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a + // hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to use for internet-bound traffic for this subnet. If + // unspecified, the subnet will not be attached to a public gateway. + PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The routing table to use for this subnet. If unspecified, the default routing table + // for the VPC is used. The routing table properties `route_direct_link_ingress`, + // `route_internet_ingress`, `route_transit_gateway_ingress`, and + // `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` + + // The VPC the subnet will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the + // specified zone, and that prefix must have a free CIDR range with at least this number of addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count,omitempty"` + + // The zone this subnet will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // The IPv4 range of the subnet, expressed in CIDR format. The prefix length of the subnet's CIDR must be between `/9` + // (8,388,608 addresses) and `/29` (8 addresses). The IPv4 range of the subnet's CIDR must fall within an existing + // address prefix in the VPC and must not overlap with any existing subnet. The subnet will be created in the zone of + // the address prefix that contains the IPv4 CIDR. If zone is specified, it must match the zone of the address prefix + // that contains the subnet's IPv4 CIDR. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block,omitempty"` +} + +// Constants associated with the SubnetPrototype.IPVersion property. +// The IP version(s) to support for this subnet. +const ( + SubnetPrototypeIPVersionIpv4Const = "ipv4" +) + +func (*SubnetPrototype) isaSubnetPrototype() bool { + return true +} + +type SubnetPrototypeIntf interface { + isaSubnetPrototype() bool +} + +// UnmarshalSubnetPrototype unmarshals an instance of SubnetPrototype from the specified map of raw messages. +func UnmarshalSubnetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPrototype) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPublicGatewayPatch : The public gateway to use for internet-bound traffic for this subnet. +// Models which "extend" this model: +// - SubnetPublicGatewayPatchPublicGatewayIdentityByID +// - SubnetPublicGatewayPatchPublicGatewayIdentityByCRN +// - SubnetPublicGatewayPatchPublicGatewayIdentityByHref +type SubnetPublicGatewayPatch struct { + // The unique identifier for this public gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this public gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href,omitempty"` +} + +func (*SubnetPublicGatewayPatch) isaSubnetPublicGatewayPatch() bool { + return true +} + +type SubnetPublicGatewayPatchIntf interface { + isaSubnetPublicGatewayPatch() bool +} + +// UnmarshalSubnetPublicGatewayPatch unmarshals an instance of SubnetPublicGatewayPatch from the specified map of raw messages. +func UnmarshalSubnetPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPublicGatewayPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetReference : SubnetReference struct +type SubnetReference struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` + + // The name for this subnet. The name is unique across all subnets in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SubnetReference.ResourceType property. +// The resource type. +const ( + SubnetReferenceResourceTypeSubnetConst = "subnet" +) + +// UnmarshalSubnetReference unmarshals an instance of SubnetReference from the specified map of raw messages. +func UnmarshalSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSubnetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type SubnetReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSubnetReferenceDeleted unmarshals an instance of SubnetReferenceDeleted from the specified map of raw messages. +func UnmarshalSubnetReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfileIdentity : Identifies a trusted profile by a unique property. +// Models which "extend" this model: +// - TrustedProfileIdentityTrustedProfileByID +// - TrustedProfileIdentityTrustedProfileByCRN +type TrustedProfileIdentity struct { + // The unique identifier for this trusted profile. + ID *string `json:"id,omitempty"` + + // The CRN for this trusted profile. + CRN *string `json:"crn,omitempty"` +} + +func (*TrustedProfileIdentity) isaTrustedProfileIdentity() bool { + return true +} + +type TrustedProfileIdentityIntf interface { + isaTrustedProfileIdentity() bool +} + +// UnmarshalTrustedProfileIdentity unmarshals an instance of TrustedProfileIdentity from the specified map of raw messages. +func UnmarshalTrustedProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TrustedProfileIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfileReference : TrustedProfileReference struct +type TrustedProfileReference struct { + // The CRN for this trusted profile. + CRN *string `json:"crn" validate:"required"` + + // The unique identifier for this trusted profile. + ID *string `json:"id" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the TrustedProfileReference.ResourceType property. +// The resource type. +const ( + TrustedProfileReferenceResourceTypeTrustedProfileConst = "trusted_profile" +) + +// UnmarshalTrustedProfileReference unmarshals an instance of TrustedProfileReference from the specified map of raw messages. +func UnmarshalTrustedProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TrustedProfileReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UnsetSubnetPublicGatewayOptions : The UnsetSubnetPublicGateway options. +type UnsetSubnetPublicGatewayOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUnsetSubnetPublicGatewayOptions : Instantiate UnsetSubnetPublicGatewayOptions +func (*VpcV1) NewUnsetSubnetPublicGatewayOptions(id string) *UnsetSubnetPublicGatewayOptions { + return &UnsetSubnetPublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *UnsetSubnetPublicGatewayOptions) SetID(id string) *UnsetSubnetPublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UnsetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *UnsetSubnetPublicGatewayOptions { + options.Headers = param + return options +} + +// UpdateBackupPolicyOptions : The UpdateBackupPolicy options. +type UpdateBackupPolicyOptions struct { + // The backup policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The backup policy patch. + BackupPolicyPatch map[string]interface{} `json:"BackupPolicy_patch" validate:"required"` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBackupPolicyOptions : Instantiate UpdateBackupPolicyOptions +func (*VpcV1) NewUpdateBackupPolicyOptions(id string, backupPolicyPatch map[string]interface{}) *UpdateBackupPolicyOptions { + return &UpdateBackupPolicyOptions{ + ID: core.StringPtr(id), + BackupPolicyPatch: backupPolicyPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateBackupPolicyOptions) SetID(id string) *UpdateBackupPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBackupPolicyPatch : Allow user to set BackupPolicyPatch +func (_options *UpdateBackupPolicyOptions) SetBackupPolicyPatch(backupPolicyPatch map[string]interface{}) *UpdateBackupPolicyOptions { + _options.BackupPolicyPatch = backupPolicyPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateBackupPolicyOptions) SetIfMatch(ifMatch string) *UpdateBackupPolicyOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBackupPolicyOptions) SetHeaders(param map[string]string) *UpdateBackupPolicyOptions { + options.Headers = param + return options +} + +// UpdateBackupPolicyPlanOptions : The UpdateBackupPolicyPlan options. +type UpdateBackupPolicyPlanOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // The backup policy plan identifier. + ID *string `json:"id" validate:"required,ne="` + + // The backup policy plan patch. + BackupPolicyPlanPatch map[string]interface{} `json:"BackupPolicyPlan_patch" validate:"required"` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBackupPolicyPlanOptions : Instantiate UpdateBackupPolicyPlanOptions +func (*VpcV1) NewUpdateBackupPolicyPlanOptions(backupPolicyID string, id string, backupPolicyPlanPatch map[string]interface{}) *UpdateBackupPolicyPlanOptions { + return &UpdateBackupPolicyPlanOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + ID: core.StringPtr(id), + BackupPolicyPlanPatch: backupPolicyPlanPatch, + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *UpdateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *UpdateBackupPolicyPlanOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateBackupPolicyPlanOptions) SetID(id string) *UpdateBackupPolicyPlanOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBackupPolicyPlanPatch : Allow user to set BackupPolicyPlanPatch +func (_options *UpdateBackupPolicyPlanOptions) SetBackupPolicyPlanPatch(backupPolicyPlanPatch map[string]interface{}) *UpdateBackupPolicyPlanOptions { + _options.BackupPolicyPlanPatch = backupPolicyPlanPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateBackupPolicyPlanOptions) SetIfMatch(ifMatch string) *UpdateBackupPolicyPlanOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *UpdateBackupPolicyPlanOptions { + options.Headers = param + return options +} + +// UpdateBareMetalServerDiskOptions : The UpdateBareMetalServerDisk options. +type UpdateBareMetalServerDiskOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // The bare metal server disk patch. + BareMetalServerDiskPatch map[string]interface{} `json:"BareMetalServerDisk_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBareMetalServerDiskOptions : Instantiate UpdateBareMetalServerDiskOptions +func (*VpcV1) NewUpdateBareMetalServerDiskOptions(bareMetalServerID string, id string, bareMetalServerDiskPatch map[string]interface{}) *UpdateBareMetalServerDiskOptions { + return &UpdateBareMetalServerDiskOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + BareMetalServerDiskPatch: bareMetalServerDiskPatch, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *UpdateBareMetalServerDiskOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerDiskOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateBareMetalServerDiskOptions) SetID(id string) *UpdateBareMetalServerDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBareMetalServerDiskPatch : Allow user to set BareMetalServerDiskPatch +func (_options *UpdateBareMetalServerDiskOptions) SetBareMetalServerDiskPatch(bareMetalServerDiskPatch map[string]interface{}) *UpdateBareMetalServerDiskOptions { + _options.BareMetalServerDiskPatch = bareMetalServerDiskPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBareMetalServerDiskOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerDiskOptions { + options.Headers = param + return options +} + +// UpdateBareMetalServerNetworkAttachmentOptions : The UpdateBareMetalServerNetworkAttachment options. +type UpdateBareMetalServerNetworkAttachmentOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The 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 network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network interface patch. + BareMetalServerNetworkInterfacePatch map[string]interface{} `json:"BareMetalServerNetworkInterface_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBareMetalServerNetworkInterfaceOptions : Instantiate UpdateBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewUpdateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string, bareMetalServerNetworkInterfacePatch map[string]interface{}) *UpdateBareMetalServerNetworkInterfaceOptions { + return &UpdateBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + BareMetalServerNetworkInterfacePatch: bareMetalServerNetworkInterfacePatch, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetID(id string) *UpdateBareMetalServerNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBareMetalServerNetworkInterfacePatch : Allow user to set BareMetalServerNetworkInterfacePatch +func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePatch(bareMetalServerNetworkInterfacePatch map[string]interface{}) *UpdateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options +} + +// UpdateBareMetalServerOptions : The UpdateBareMetalServer options. +type UpdateBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // The bare metal server patch. + BareMetalServerPatch map[string]interface{} `json:"BareMetalServer_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBareMetalServerOptions : Instantiate UpdateBareMetalServerOptions +func (*VpcV1) NewUpdateBareMetalServerOptions(id string, bareMetalServerPatch map[string]interface{}) *UpdateBareMetalServerOptions { + return &UpdateBareMetalServerOptions{ + ID: core.StringPtr(id), + BareMetalServerPatch: bareMetalServerPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateBareMetalServerOptions) SetID(id string) *UpdateBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBareMetalServerPatch : Allow user to set BareMetalServerPatch +func (_options *UpdateBareMetalServerOptions) SetBareMetalServerPatch(bareMetalServerPatch map[string]interface{}) *UpdateBareMetalServerOptions { + _options.BareMetalServerPatch = bareMetalServerPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBareMetalServerOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerOptions { + options.Headers = param + return options +} + +// UpdateDedicatedHostDiskOptions : The UpdateDedicatedHostDisk options. +type UpdateDedicatedHostDiskOptions struct { + // The dedicated host identifier. + DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="` + + // The dedicated host disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // The dedicated host disk patch. + DedicatedHostDiskPatch map[string]interface{} `json:"DedicatedHostDisk_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateDedicatedHostDiskOptions : Instantiate UpdateDedicatedHostDiskOptions +func (*VpcV1) NewUpdateDedicatedHostDiskOptions(dedicatedHostID string, id string, dedicatedHostDiskPatch map[string]interface{}) *UpdateDedicatedHostDiskOptions { + return &UpdateDedicatedHostDiskOptions{ + DedicatedHostID: core.StringPtr(dedicatedHostID), + ID: core.StringPtr(id), + DedicatedHostDiskPatch: dedicatedHostDiskPatch, + } +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (_options *UpdateDedicatedHostDiskOptions) SetDedicatedHostID(dedicatedHostID string) *UpdateDedicatedHostDiskOptions { + _options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateDedicatedHostDiskOptions) SetID(id string) *UpdateDedicatedHostDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetDedicatedHostDiskPatch : Allow user to set DedicatedHostDiskPatch +func (_options *UpdateDedicatedHostDiskOptions) SetDedicatedHostDiskPatch(dedicatedHostDiskPatch map[string]interface{}) *UpdateDedicatedHostDiskOptions { + _options.DedicatedHostDiskPatch = dedicatedHostDiskPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateDedicatedHostDiskOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostDiskOptions { + options.Headers = param + return options +} + +// UpdateDedicatedHostGroupOptions : The UpdateDedicatedHostGroup options. +type UpdateDedicatedHostGroupOptions struct { + // The dedicated host group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The dedicated host group patch. + DedicatedHostGroupPatch map[string]interface{} `json:"DedicatedHostGroup_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateDedicatedHostGroupOptions : Instantiate UpdateDedicatedHostGroupOptions +func (*VpcV1) NewUpdateDedicatedHostGroupOptions(id string, dedicatedHostGroupPatch map[string]interface{}) *UpdateDedicatedHostGroupOptions { + return &UpdateDedicatedHostGroupOptions{ + ID: core.StringPtr(id), + DedicatedHostGroupPatch: dedicatedHostGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateDedicatedHostGroupOptions) SetID(id string) *UpdateDedicatedHostGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetDedicatedHostGroupPatch : Allow user to set DedicatedHostGroupPatch +func (_options *UpdateDedicatedHostGroupOptions) SetDedicatedHostGroupPatch(dedicatedHostGroupPatch map[string]interface{}) *UpdateDedicatedHostGroupOptions { + _options.DedicatedHostGroupPatch = dedicatedHostGroupPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateDedicatedHostGroupOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// UpdateDedicatedHostOptions : The UpdateDedicatedHost options. +type UpdateDedicatedHostOptions struct { + // The dedicated host identifier. + ID *string `json:"id" validate:"required,ne="` + + // The dedicated host patch. + DedicatedHostPatch map[string]interface{} `json:"DedicatedHost_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateDedicatedHostOptions : Instantiate UpdateDedicatedHostOptions +func (*VpcV1) NewUpdateDedicatedHostOptions(id string, dedicatedHostPatch map[string]interface{}) *UpdateDedicatedHostOptions { + return &UpdateDedicatedHostOptions{ + ID: core.StringPtr(id), + DedicatedHostPatch: dedicatedHostPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateDedicatedHostOptions) SetID(id string) *UpdateDedicatedHostOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetDedicatedHostPatch : Allow user to set DedicatedHostPatch +func (_options *UpdateDedicatedHostOptions) SetDedicatedHostPatch(dedicatedHostPatch map[string]interface{}) *UpdateDedicatedHostOptions { + _options.DedicatedHostPatch = dedicatedHostPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateDedicatedHostOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostOptions { + options.Headers = param + return options +} + +// UpdateEndpointGatewayOptions : The UpdateEndpointGateway options. +type UpdateEndpointGatewayOptions struct { + // The endpoint gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // The endpoint gateway patch. + EndpointGatewayPatch map[string]interface{} `json:"EndpointGateway_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateEndpointGatewayOptions : Instantiate UpdateEndpointGatewayOptions +func (*VpcV1) NewUpdateEndpointGatewayOptions(id string, endpointGatewayPatch map[string]interface{}) *UpdateEndpointGatewayOptions { + return &UpdateEndpointGatewayOptions{ + ID: core.StringPtr(id), + EndpointGatewayPatch: endpointGatewayPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateEndpointGatewayOptions) SetID(id string) *UpdateEndpointGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetEndpointGatewayPatch : Allow user to set EndpointGatewayPatch +func (_options *UpdateEndpointGatewayOptions) SetEndpointGatewayPatch(endpointGatewayPatch map[string]interface{}) *UpdateEndpointGatewayOptions { + _options.EndpointGatewayPatch = endpointGatewayPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateEndpointGatewayOptions) SetHeaders(param map[string]string) *UpdateEndpointGatewayOptions { + options.Headers = param + return options +} + +// UpdateFloatingIPOptions : The UpdateFloatingIP options. +type UpdateFloatingIPOptions struct { + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // The floating IP patch. + FloatingIPPatch map[string]interface{} `json:"FloatingIP_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateFloatingIPOptions : Instantiate UpdateFloatingIPOptions +func (*VpcV1) NewUpdateFloatingIPOptions(id string, floatingIPPatch map[string]interface{}) *UpdateFloatingIPOptions { + return &UpdateFloatingIPOptions{ + ID: core.StringPtr(id), + FloatingIPPatch: floatingIPPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateFloatingIPOptions) SetID(id string) *UpdateFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetFloatingIPPatch : Allow user to set FloatingIPPatch +func (_options *UpdateFloatingIPOptions) SetFloatingIPPatch(floatingIPPatch map[string]interface{}) *UpdateFloatingIPOptions { + _options.FloatingIPPatch = floatingIPPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateFloatingIPOptions) SetHeaders(param map[string]string) *UpdateFloatingIPOptions { + options.Headers = param + return options +} + +// UpdateFlowLogCollectorOptions : The UpdateFlowLogCollector options. +type UpdateFlowLogCollectorOptions struct { + // The flow log collector identifier. + ID *string `json:"id" validate:"required,ne="` + + // The flow log collector patch. + FlowLogCollectorPatch map[string]interface{} `json:"FlowLogCollector_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateFlowLogCollectorOptions : Instantiate UpdateFlowLogCollectorOptions +func (*VpcV1) NewUpdateFlowLogCollectorOptions(id string, flowLogCollectorPatch map[string]interface{}) *UpdateFlowLogCollectorOptions { + return &UpdateFlowLogCollectorOptions{ + ID: core.StringPtr(id), + FlowLogCollectorPatch: flowLogCollectorPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateFlowLogCollectorOptions) SetID(id string) *UpdateFlowLogCollectorOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetFlowLogCollectorPatch : Allow user to set FlowLogCollectorPatch +func (_options *UpdateFlowLogCollectorOptions) SetFlowLogCollectorPatch(flowLogCollectorPatch map[string]interface{}) *UpdateFlowLogCollectorOptions { + _options.FlowLogCollectorPatch = flowLogCollectorPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateFlowLogCollectorOptions) SetHeaders(param map[string]string) *UpdateFlowLogCollectorOptions { + options.Headers = param + return options +} + +// UpdateIkePolicyOptions : The UpdateIkePolicy options. +type UpdateIkePolicyOptions struct { + // The IKE policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The IKE policy patch. + IkePolicyPatch map[string]interface{} `json:"IKEPolicy_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateIkePolicyOptions : Instantiate UpdateIkePolicyOptions +func (*VpcV1) NewUpdateIkePolicyOptions(id string, ikePolicyPatch map[string]interface{}) *UpdateIkePolicyOptions { + return &UpdateIkePolicyOptions{ + ID: core.StringPtr(id), + IkePolicyPatch: ikePolicyPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateIkePolicyOptions) SetID(id string) *UpdateIkePolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIkePolicyPatch : Allow user to set IkePolicyPatch +func (_options *UpdateIkePolicyOptions) SetIkePolicyPatch(ikePolicyPatch map[string]interface{}) *UpdateIkePolicyOptions { + _options.IkePolicyPatch = ikePolicyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateIkePolicyOptions) SetHeaders(param map[string]string) *UpdateIkePolicyOptions { + options.Headers = param + return options +} + +// UpdateImageExportJobOptions : The UpdateImageExportJob options. +type UpdateImageExportJobOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // The image export job identifier. + ID *string `json:"id" validate:"required,ne="` + + // The image export job patch. + ImageExportJobPatch map[string]interface{} `json:"ImageExportJob_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateImageExportJobOptions : Instantiate UpdateImageExportJobOptions +func (*VpcV1) NewUpdateImageExportJobOptions(imageID string, id string, imageExportJobPatch map[string]interface{}) *UpdateImageExportJobOptions { + return &UpdateImageExportJobOptions{ + ImageID: core.StringPtr(imageID), + ID: core.StringPtr(id), + ImageExportJobPatch: imageExportJobPatch, + } +} + +// SetImageID : Allow user to set ImageID +func (_options *UpdateImageExportJobOptions) SetImageID(imageID string) *UpdateImageExportJobOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateImageExportJobOptions) SetID(id string) *UpdateImageExportJobOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetImageExportJobPatch : Allow user to set ImageExportJobPatch +func (_options *UpdateImageExportJobOptions) SetImageExportJobPatch(imageExportJobPatch map[string]interface{}) *UpdateImageExportJobOptions { + _options.ImageExportJobPatch = imageExportJobPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateImageExportJobOptions) SetHeaders(param map[string]string) *UpdateImageExportJobOptions { + options.Headers = param + return options +} + +// UpdateImageOptions : The UpdateImage options. +type UpdateImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // The image patch. + ImagePatch map[string]interface{} `json:"Image_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateImageOptions : Instantiate UpdateImageOptions +func (*VpcV1) NewUpdateImageOptions(id string, imagePatch map[string]interface{}) *UpdateImageOptions { + return &UpdateImageOptions{ + ID: core.StringPtr(id), + ImagePatch: imagePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateImageOptions) SetID(id string) *UpdateImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetImagePatch : Allow user to set ImagePatch +func (_options *UpdateImageOptions) SetImagePatch(imagePatch map[string]interface{}) *UpdateImageOptions { + _options.ImagePatch = imagePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateImageOptions) SetHeaders(param map[string]string) *UpdateImageOptions { + options.Headers = param + return options +} + +// UpdateInstanceDiskOptions : The UpdateInstanceDisk options. +type UpdateInstanceDiskOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance disk patch. + InstanceDiskPatch map[string]interface{} `json:"InstanceDisk_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceDiskOptions : Instantiate UpdateInstanceDiskOptions +func (*VpcV1) NewUpdateInstanceDiskOptions(instanceID string, id string, instanceDiskPatch map[string]interface{}) *UpdateInstanceDiskOptions { + return &UpdateInstanceDiskOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + InstanceDiskPatch: instanceDiskPatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceDiskOptions) SetInstanceID(instanceID string) *UpdateInstanceDiskOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceDiskOptions) SetID(id string) *UpdateInstanceDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceDiskPatch : Allow user to set InstanceDiskPatch +func (_options *UpdateInstanceDiskOptions) SetInstanceDiskPatch(instanceDiskPatch map[string]interface{}) *UpdateInstanceDiskOptions { + _options.InstanceDiskPatch = instanceDiskPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceDiskOptions) SetHeaders(param map[string]string) *UpdateInstanceDiskOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupManagerActionOptions : The UpdateInstanceGroupManagerAction options. +type UpdateInstanceGroupManagerActionOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager action identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group manager action patch. + InstanceGroupManagerActionPatch map[string]interface{} `json:"InstanceGroupManagerAction_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupManagerActionOptions : Instantiate UpdateInstanceGroupManagerActionOptions +func (*VpcV1) NewUpdateInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string, instanceGroupManagerActionPatch map[string]interface{}) *UpdateInstanceGroupManagerActionOptions { + return &UpdateInstanceGroupManagerActionOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + InstanceGroupManagerActionPatch: instanceGroupManagerActionPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerActionOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *UpdateInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupManagerActionOptions) SetID(id string) *UpdateInstanceGroupManagerActionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupManagerActionPatch : Allow user to set InstanceGroupManagerActionPatch +func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupManagerActionPatch(instanceGroupManagerActionPatch map[string]interface{}) *UpdateInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerActionOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupManagerOptions : The UpdateInstanceGroupManager options. +type UpdateInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group manager patch. + InstanceGroupManagerPatch map[string]interface{} `json:"InstanceGroupManager_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupManagerOptions : Instantiate UpdateInstanceGroupManagerOptions +func (*VpcV1) NewUpdateInstanceGroupManagerOptions(instanceGroupID string, id string, instanceGroupManagerPatch map[string]interface{}) *UpdateInstanceGroupManagerOptions { + return &UpdateInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + InstanceGroupManagerPatch: instanceGroupManagerPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *UpdateInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupManagerOptions) SetID(id string) *UpdateInstanceGroupManagerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupManagerPatch : Allow user to set InstanceGroupManagerPatch +func (_options *UpdateInstanceGroupManagerOptions) SetInstanceGroupManagerPatch(instanceGroupManagerPatch map[string]interface{}) *UpdateInstanceGroupManagerOptions { + _options.InstanceGroupManagerPatch = instanceGroupManagerPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupManagerOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupManagerPolicyOptions : The UpdateInstanceGroupManagerPolicy options. +type UpdateInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group manager policy patch. + InstanceGroupManagerPolicyPatch map[string]interface{} `json:"InstanceGroupManagerPolicy_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupManagerPolicyOptions : Instantiate UpdateInstanceGroupManagerPolicyOptions +func (*VpcV1) NewUpdateInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string, instanceGroupManagerPolicyPatch map[string]interface{}) *UpdateInstanceGroupManagerPolicyOptions { + return &UpdateInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + InstanceGroupManagerPolicyPatch: instanceGroupManagerPolicyPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *UpdateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupManagerPolicyOptions) SetID(id string) *UpdateInstanceGroupManagerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupManagerPolicyPatch : Allow user to set InstanceGroupManagerPolicyPatch +func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerPolicyPatch(instanceGroupManagerPolicyPatch map[string]interface{}) *UpdateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupMembershipOptions : The UpdateInstanceGroupMembership options. +type UpdateInstanceGroupMembershipOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group membership identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group membership patch. + InstanceGroupMembershipPatch map[string]interface{} `json:"InstanceGroupMembership_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupMembershipOptions : Instantiate UpdateInstanceGroupMembershipOptions +func (*VpcV1) NewUpdateInstanceGroupMembershipOptions(instanceGroupID string, id string, instanceGroupMembershipPatch map[string]interface{}) *UpdateInstanceGroupMembershipOptions { + return &UpdateInstanceGroupMembershipOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + InstanceGroupMembershipPatch: instanceGroupMembershipPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *UpdateInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupMembershipOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupMembershipOptions) SetID(id string) *UpdateInstanceGroupMembershipOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupMembershipPatch : Allow user to set InstanceGroupMembershipPatch +func (_options *UpdateInstanceGroupMembershipOptions) SetInstanceGroupMembershipPatch(instanceGroupMembershipPatch map[string]interface{}) *UpdateInstanceGroupMembershipOptions { + _options.InstanceGroupMembershipPatch = instanceGroupMembershipPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupMembershipOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupOptions : The UpdateInstanceGroup options. +type UpdateInstanceGroupOptions struct { + // The instance group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group patch. + InstanceGroupPatch map[string]interface{} `json:"InstanceGroup_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupOptions : Instantiate UpdateInstanceGroupOptions +func (*VpcV1) NewUpdateInstanceGroupOptions(id string, instanceGroupPatch map[string]interface{}) *UpdateInstanceGroupOptions { + return &UpdateInstanceGroupOptions{ + ID: core.StringPtr(id), + InstanceGroupPatch: instanceGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupOptions) SetID(id string) *UpdateInstanceGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupPatch : Allow user to set InstanceGroupPatch +func (_options *UpdateInstanceGroupOptions) SetInstanceGroupPatch(instanceGroupPatch map[string]interface{}) *UpdateInstanceGroupOptions { + _options.InstanceGroupPatch = instanceGroupPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupOptions { + options.Headers = param + return options +} + +// UpdateInstanceNetworkAttachmentOptions : The UpdateInstanceNetworkAttachment options. +type UpdateInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance network attachment patch. + InstanceNetworkAttachmentPatch map[string]interface{} `json:"InstanceNetworkAttachment_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceNetworkAttachmentOptions : Instantiate UpdateInstanceNetworkAttachmentOptions +func (*VpcV1) NewUpdateInstanceNetworkAttachmentOptions(instanceID string, id string, instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions { + return &UpdateInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + InstanceNetworkAttachmentPatch: instanceNetworkAttachmentPatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceNetworkAttachmentOptions) SetID(id string) *UpdateInstanceNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceNetworkAttachmentPatch : Allow user to set InstanceNetworkAttachmentPatch +func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceNetworkAttachmentPatch(instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions { + _options.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + +// UpdateInstanceNetworkInterfaceOptions : The UpdateInstanceNetworkInterface options. +type UpdateInstanceNetworkInterfaceOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network interface patch. + NetworkInterfacePatch map[string]interface{} `json:"NetworkInterface_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceNetworkInterfaceOptions : Instantiate UpdateInstanceNetworkInterfaceOptions +func (*VpcV1) NewUpdateInstanceNetworkInterfaceOptions(instanceID string, id string, networkInterfacePatch map[string]interface{}) *UpdateInstanceNetworkInterfaceOptions { + return &UpdateInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + NetworkInterfacePatch: networkInterfacePatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *UpdateInstanceNetworkInterfaceOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceNetworkInterfaceOptions) SetID(id string) *UpdateInstanceNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetNetworkInterfacePatch : Allow user to set NetworkInterfacePatch +func (_options *UpdateInstanceNetworkInterfaceOptions) SetNetworkInterfacePatch(networkInterfacePatch map[string]interface{}) *UpdateInstanceNetworkInterfaceOptions { + _options.NetworkInterfacePatch = networkInterfacePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// UpdateInstanceOptions : The UpdateInstance options. +type UpdateInstanceOptions struct { + // The virtual server instance identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance patch. + InstancePatch map[string]interface{} `json:"Instance_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceOptions : Instantiate UpdateInstanceOptions +func (*VpcV1) NewUpdateInstanceOptions(id string, instancePatch map[string]interface{}) *UpdateInstanceOptions { + return &UpdateInstanceOptions{ + ID: core.StringPtr(id), + InstancePatch: instancePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceOptions) SetID(id string) *UpdateInstanceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstancePatch : Allow user to set InstancePatch +func (_options *UpdateInstanceOptions) SetInstancePatch(instancePatch map[string]interface{}) *UpdateInstanceOptions { + _options.InstancePatch = instancePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceOptions) SetHeaders(param map[string]string) *UpdateInstanceOptions { + options.Headers = param + return options +} + +// UpdateInstanceTemplateOptions : The UpdateInstanceTemplate options. +type UpdateInstanceTemplateOptions struct { + // The instance template identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance template patch. + InstanceTemplatePatch map[string]interface{} `json:"InstanceTemplate_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceTemplateOptions : Instantiate UpdateInstanceTemplateOptions +func (*VpcV1) NewUpdateInstanceTemplateOptions(id string, instanceTemplatePatch map[string]interface{}) *UpdateInstanceTemplateOptions { + return &UpdateInstanceTemplateOptions{ + ID: core.StringPtr(id), + InstanceTemplatePatch: instanceTemplatePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceTemplateOptions) SetID(id string) *UpdateInstanceTemplateOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceTemplatePatch : Allow user to set InstanceTemplatePatch +func (_options *UpdateInstanceTemplateOptions) SetInstanceTemplatePatch(instanceTemplatePatch map[string]interface{}) *UpdateInstanceTemplateOptions { + _options.InstanceTemplatePatch = instanceTemplatePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceTemplateOptions) SetHeaders(param map[string]string) *UpdateInstanceTemplateOptions { + options.Headers = param + return options +} + +// UpdateInstanceVolumeAttachmentOptions : The UpdateInstanceVolumeAttachment options. +type UpdateInstanceVolumeAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The volume attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // The volume attachment patch. + VolumeAttachmentPatch map[string]interface{} `json:"VolumeAttachment_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceVolumeAttachmentOptions : Instantiate UpdateInstanceVolumeAttachmentOptions +func (*VpcV1) NewUpdateInstanceVolumeAttachmentOptions(instanceID string, id string, volumeAttachmentPatch map[string]interface{}) *UpdateInstanceVolumeAttachmentOptions { + return &UpdateInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + VolumeAttachmentPatch: volumeAttachmentPatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceVolumeAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceVolumeAttachmentOptions) SetID(id string) *UpdateInstanceVolumeAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVolumeAttachmentPatch : Allow user to set VolumeAttachmentPatch +func (_options *UpdateInstanceVolumeAttachmentOptions) SetVolumeAttachmentPatch(volumeAttachmentPatch map[string]interface{}) *UpdateInstanceVolumeAttachmentOptions { + _options.VolumeAttachmentPatch = volumeAttachmentPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// UpdateIpsecPolicyOptions : The UpdateIpsecPolicy options. +type UpdateIpsecPolicyOptions struct { + // The IPsec policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The IPsec policy patch. + IPsecPolicyPatch map[string]interface{} `json:"IPsecPolicy_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateIpsecPolicyOptions : Instantiate UpdateIpsecPolicyOptions +func (*VpcV1) NewUpdateIpsecPolicyOptions(id string, iPsecPolicyPatch map[string]interface{}) *UpdateIpsecPolicyOptions { + return &UpdateIpsecPolicyOptions{ + ID: core.StringPtr(id), + IPsecPolicyPatch: iPsecPolicyPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateIpsecPolicyOptions) SetID(id string) *UpdateIpsecPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIPsecPolicyPatch : Allow user to set IPsecPolicyPatch +func (_options *UpdateIpsecPolicyOptions) SetIPsecPolicyPatch(iPsecPolicyPatch map[string]interface{}) *UpdateIpsecPolicyOptions { + _options.IPsecPolicyPatch = iPsecPolicyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateIpsecPolicyOptions) SetHeaders(param map[string]string) *UpdateIpsecPolicyOptions { + options.Headers = param + return options +} + +// UpdateKeyOptions : The UpdateKey options. +type UpdateKeyOptions struct { + // The key identifier. + ID *string `json:"id" validate:"required,ne="` + + // The key patch. + KeyPatch map[string]interface{} `json:"Key_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateKeyOptions : Instantiate UpdateKeyOptions +func (*VpcV1) NewUpdateKeyOptions(id string, keyPatch map[string]interface{}) *UpdateKeyOptions { + return &UpdateKeyOptions{ + ID: core.StringPtr(id), + KeyPatch: keyPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateKeyOptions) SetID(id string) *UpdateKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetKeyPatch : Allow user to set KeyPatch +func (_options *UpdateKeyOptions) SetKeyPatch(keyPatch map[string]interface{}) *UpdateKeyOptions { + _options.KeyPatch = keyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateKeyOptions) SetHeaders(param map[string]string) *UpdateKeyOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerListenerOptions : The UpdateLoadBalancerListener options. +type UpdateLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ID *string `json:"id" validate:"required,ne="` + + // The load balancer listener patch. + LoadBalancerListenerPatch map[string]interface{} `json:"LoadBalancerListener_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerListenerOptions : Instantiate UpdateLoadBalancerListenerOptions +func (*VpcV1) NewUpdateLoadBalancerListenerOptions(loadBalancerID string, id string, loadBalancerListenerPatch map[string]interface{}) *UpdateLoadBalancerListenerOptions { + return &UpdateLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + LoadBalancerListenerPatch: loadBalancerListenerPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerListenerOptions) SetID(id string) *UpdateLoadBalancerListenerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerListenerPatch : Allow user to set LoadBalancerListenerPatch +func (_options *UpdateLoadBalancerListenerOptions) SetLoadBalancerListenerPatch(loadBalancerListenerPatch map[string]interface{}) *UpdateLoadBalancerListenerOptions { + _options.LoadBalancerListenerPatch = loadBalancerListenerPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerListenerOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerListenerPolicyOptions : The UpdateLoadBalancerListenerPolicy options. +type UpdateLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The listener policy patch. + LoadBalancerListenerPolicyPatch map[string]interface{} `json:"LoadBalancerListenerPolicy_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerListenerPolicyOptions : Instantiate UpdateLoadBalancerListenerPolicyOptions +func (*VpcV1) NewUpdateLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string, loadBalancerListenerPolicyPatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyOptions { + return &UpdateLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + ID: core.StringPtr(id), + LoadBalancerListenerPolicyPatch: loadBalancerListenerPolicyPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerPolicyOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *UpdateLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *UpdateLoadBalancerListenerPolicyOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerListenerPolicyOptions) SetID(id string) *UpdateLoadBalancerListenerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerListenerPolicyPatch : Allow user to set LoadBalancerListenerPolicyPatch +func (_options *UpdateLoadBalancerListenerPolicyOptions) SetLoadBalancerListenerPolicyPatch(loadBalancerListenerPolicyPatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyOptions { + _options.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerListenerPolicyRuleOptions : The UpdateLoadBalancerListenerPolicyRule options. +type UpdateLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // The listener policy rule patch. + LoadBalancerListenerPolicyRulePatch map[string]interface{} `json:"LoadBalancerListenerPolicyRule_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerListenerPolicyRuleOptions : Instantiate UpdateLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewUpdateLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string, loadBalancerListenerPolicyRulePatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyRuleOptions { + return &UpdateLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + ID: core.StringPtr(id), + LoadBalancerListenerPolicyRulePatch: loadBalancerListenerPolicyRulePatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetID(id string) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerListenerPolicyRulePatch : Allow user to set LoadBalancerListenerPolicyRulePatch +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerListenerPolicyRulePatch(loadBalancerListenerPolicyRulePatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerOptions : The UpdateLoadBalancer options. +type UpdateLoadBalancerOptions struct { + // The load balancer identifier. + ID *string `json:"id" validate:"required,ne="` + + // The load balancer patch. + LoadBalancerPatch map[string]interface{} `json:"LoadBalancer_patch" validate:"required"` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerOptions : Instantiate UpdateLoadBalancerOptions +func (*VpcV1) NewUpdateLoadBalancerOptions(id string, loadBalancerPatch map[string]interface{}) *UpdateLoadBalancerOptions { + return &UpdateLoadBalancerOptions{ + ID: core.StringPtr(id), + LoadBalancerPatch: loadBalancerPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerOptions) SetID(id string) *UpdateLoadBalancerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerPatch : Allow user to set LoadBalancerPatch +func (_options *UpdateLoadBalancerOptions) SetLoadBalancerPatch(loadBalancerPatch map[string]interface{}) *UpdateLoadBalancerOptions { + _options.LoadBalancerPatch = loadBalancerPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateLoadBalancerOptions) SetIfMatch(ifMatch string) *UpdateLoadBalancerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerPoolMemberOptions : The UpdateLoadBalancerPoolMember options. +type UpdateLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The member identifier. + ID *string `json:"id" validate:"required,ne="` + + // The load balancer pool member patch. + LoadBalancerPoolMemberPatch map[string]interface{} `json:"LoadBalancerPoolMember_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerPoolMemberOptions : Instantiate UpdateLoadBalancerPoolMemberOptions +func (*VpcV1) NewUpdateLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string, loadBalancerPoolMemberPatch map[string]interface{}) *UpdateLoadBalancerPoolMemberOptions { + return &UpdateLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + ID: core.StringPtr(id), + LoadBalancerPoolMemberPatch: loadBalancerPoolMemberPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerPoolMemberOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *UpdateLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *UpdateLoadBalancerPoolMemberOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerPoolMemberOptions) SetID(id string) *UpdateLoadBalancerPoolMemberOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerPoolMemberPatch : Allow user to set LoadBalancerPoolMemberPatch +func (_options *UpdateLoadBalancerPoolMemberOptions) SetLoadBalancerPoolMemberPatch(loadBalancerPoolMemberPatch map[string]interface{}) *UpdateLoadBalancerPoolMemberOptions { + _options.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerPoolOptions : The UpdateLoadBalancerPool options. +type UpdateLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + ID *string `json:"id" validate:"required,ne="` + + // The load balancer pool patch. + LoadBalancerPoolPatch map[string]interface{} `json:"LoadBalancerPool_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerPoolOptions : Instantiate UpdateLoadBalancerPoolOptions +func (*VpcV1) NewUpdateLoadBalancerPoolOptions(loadBalancerID string, id string, loadBalancerPoolPatch map[string]interface{}) *UpdateLoadBalancerPoolOptions { + return &UpdateLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + LoadBalancerPoolPatch: loadBalancerPoolPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerPoolOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerPoolOptions) SetID(id string) *UpdateLoadBalancerPoolOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerPoolPatch : Allow user to set LoadBalancerPoolPatch +func (_options *UpdateLoadBalancerPoolOptions) SetLoadBalancerPoolPatch(loadBalancerPoolPatch map[string]interface{}) *UpdateLoadBalancerPoolOptions { + _options.LoadBalancerPoolPatch = loadBalancerPoolPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerPoolOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// UpdateNetworkACLOptions : The UpdateNetworkACL options. +type UpdateNetworkACLOptions struct { + // The network ACL identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network ACL patch. + NetworkACLPatch map[string]interface{} `json:"NetworkACL_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateNetworkACLOptions : Instantiate UpdateNetworkACLOptions +func (*VpcV1) NewUpdateNetworkACLOptions(id string, networkACLPatch map[string]interface{}) *UpdateNetworkACLOptions { + return &UpdateNetworkACLOptions{ + ID: core.StringPtr(id), + NetworkACLPatch: networkACLPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateNetworkACLOptions) SetID(id string) *UpdateNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetNetworkACLPatch : Allow user to set NetworkACLPatch +func (_options *UpdateNetworkACLOptions) SetNetworkACLPatch(networkACLPatch map[string]interface{}) *UpdateNetworkACLOptions { + _options.NetworkACLPatch = networkACLPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateNetworkACLOptions) SetHeaders(param map[string]string) *UpdateNetworkACLOptions { + options.Headers = param + return options +} + +// UpdateNetworkACLRuleOptions : The UpdateNetworkACLRule options. +type UpdateNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network ACL rule patch. + NetworkACLRulePatch map[string]interface{} `json:"NetworkACLRule_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateNetworkACLRuleOptions : Instantiate UpdateNetworkACLRuleOptions +func (*VpcV1) NewUpdateNetworkACLRuleOptions(networkACLID string, id string, networkACLRulePatch map[string]interface{}) *UpdateNetworkACLRuleOptions { + return &UpdateNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + ID: core.StringPtr(id), + NetworkACLRulePatch: networkACLRulePatch, + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *UpdateNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *UpdateNetworkACLRuleOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateNetworkACLRuleOptions) SetID(id string) *UpdateNetworkACLRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetNetworkACLRulePatch : Allow user to set NetworkACLRulePatch +func (_options *UpdateNetworkACLRuleOptions) SetNetworkACLRulePatch(networkACLRulePatch map[string]interface{}) *UpdateNetworkACLRuleOptions { + _options.NetworkACLRulePatch = networkACLRulePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateNetworkACLRuleOptions) SetHeaders(param map[string]string) *UpdateNetworkACLRuleOptions { + options.Headers = param + return options +} + +// UpdatePlacementGroupOptions : The UpdatePlacementGroup options. +type UpdatePlacementGroupOptions struct { + // The placement group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The placement group patch. + PlacementGroupPatch map[string]interface{} `json:"PlacementGroup_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdatePlacementGroupOptions : Instantiate UpdatePlacementGroupOptions +func (*VpcV1) NewUpdatePlacementGroupOptions(id string, placementGroupPatch map[string]interface{}) *UpdatePlacementGroupOptions { + return &UpdatePlacementGroupOptions{ + ID: core.StringPtr(id), + PlacementGroupPatch: placementGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdatePlacementGroupOptions) SetID(id string) *UpdatePlacementGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetPlacementGroupPatch : Allow user to set PlacementGroupPatch +func (_options *UpdatePlacementGroupOptions) SetPlacementGroupPatch(placementGroupPatch map[string]interface{}) *UpdatePlacementGroupOptions { + _options.PlacementGroupPatch = placementGroupPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdatePlacementGroupOptions) SetHeaders(param map[string]string) *UpdatePlacementGroupOptions { + options.Headers = param + return options +} + +// UpdatePublicGatewayOptions : The UpdatePublicGateway options. +type UpdatePublicGatewayOptions struct { + // The public gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // The public gateway patch. + PublicGatewayPatch map[string]interface{} `json:"PublicGateway_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdatePublicGatewayOptions : Instantiate UpdatePublicGatewayOptions +func (*VpcV1) NewUpdatePublicGatewayOptions(id string, publicGatewayPatch map[string]interface{}) *UpdatePublicGatewayOptions { + return &UpdatePublicGatewayOptions{ + ID: core.StringPtr(id), + PublicGatewayPatch: publicGatewayPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdatePublicGatewayOptions) SetID(id string) *UpdatePublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetPublicGatewayPatch : Allow user to set PublicGatewayPatch +func (_options *UpdatePublicGatewayOptions) SetPublicGatewayPatch(publicGatewayPatch map[string]interface{}) *UpdatePublicGatewayOptions { + _options.PublicGatewayPatch = publicGatewayPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdatePublicGatewayOptions) SetHeaders(param map[string]string) *UpdatePublicGatewayOptions { + options.Headers = param + return options +} + +// UpdateSecurityGroupOptions : The UpdateSecurityGroup options. +type UpdateSecurityGroupOptions struct { + // The security group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The security group patch. + SecurityGroupPatch map[string]interface{} `json:"SecurityGroup_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSecurityGroupOptions : Instantiate UpdateSecurityGroupOptions +func (*VpcV1) NewUpdateSecurityGroupOptions(id string, securityGroupPatch map[string]interface{}) *UpdateSecurityGroupOptions { + return &UpdateSecurityGroupOptions{ + ID: core.StringPtr(id), + SecurityGroupPatch: securityGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateSecurityGroupOptions) SetID(id string) *UpdateSecurityGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSecurityGroupPatch : Allow user to set SecurityGroupPatch +func (_options *UpdateSecurityGroupOptions) SetSecurityGroupPatch(securityGroupPatch map[string]interface{}) *UpdateSecurityGroupOptions { + _options.SecurityGroupPatch = securityGroupPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSecurityGroupOptions) SetHeaders(param map[string]string) *UpdateSecurityGroupOptions { + options.Headers = param + return options +} + +// UpdateSecurityGroupRuleOptions : The UpdateSecurityGroupRule options. +type UpdateSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // The security group rule patch. + SecurityGroupRulePatch map[string]interface{} `json:"SecurityGroupRule_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSecurityGroupRuleOptions : Instantiate UpdateSecurityGroupRuleOptions +func (*VpcV1) NewUpdateSecurityGroupRuleOptions(securityGroupID string, id string, securityGroupRulePatch map[string]interface{}) *UpdateSecurityGroupRuleOptions { + return &UpdateSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + SecurityGroupRulePatch: securityGroupRulePatch, + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *UpdateSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *UpdateSecurityGroupRuleOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateSecurityGroupRuleOptions) SetID(id string) *UpdateSecurityGroupRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSecurityGroupRulePatch : Allow user to set SecurityGroupRulePatch +func (_options *UpdateSecurityGroupRuleOptions) SetSecurityGroupRulePatch(securityGroupRulePatch map[string]interface{}) *UpdateSecurityGroupRuleOptions { + _options.SecurityGroupRulePatch = securityGroupRulePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSecurityGroupRuleOptions) SetHeaders(param map[string]string) *UpdateSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// UpdateShareMountTargetOptions : The UpdateShareMountTarget options. +type UpdateShareMountTargetOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share mount target identifier. + ID *string `json:"id" validate:"required,ne="` + + // The share mount target patch. + ShareMountTargetPatch map[string]interface{} `json:"ShareMountTarget_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateShareMountTargetOptions : Instantiate UpdateShareMountTargetOptions +func (*VpcV1) NewUpdateShareMountTargetOptions(shareID string, id string, shareMountTargetPatch map[string]interface{}) *UpdateShareMountTargetOptions { + return &UpdateShareMountTargetOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + ShareMountTargetPatch: shareMountTargetPatch, + } +} + +// SetShareID : Allow user to set ShareID +func (_options *UpdateShareMountTargetOptions) SetShareID(shareID string) *UpdateShareMountTargetOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateShareMountTargetOptions) SetID(id string) *UpdateShareMountTargetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetShareMountTargetPatch : Allow user to set ShareMountTargetPatch +func (_options *UpdateShareMountTargetOptions) SetShareMountTargetPatch(shareMountTargetPatch map[string]interface{}) *UpdateShareMountTargetOptions { + _options.ShareMountTargetPatch = shareMountTargetPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateShareMountTargetOptions) SetHeaders(param map[string]string) *UpdateShareMountTargetOptions { + options.Headers = param + return options +} + +// UpdateShareOptions : The UpdateShare options. +type UpdateShareOptions struct { + // The file share identifier. + ID *string `json:"id" validate:"required,ne="` + + // The file share patch. + SharePatch map[string]interface{} `json:"Share_patch" validate:"required"` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateShareOptions : Instantiate UpdateShareOptions +func (*VpcV1) NewUpdateShareOptions(id string, sharePatch map[string]interface{}) *UpdateShareOptions { + return &UpdateShareOptions{ + ID: core.StringPtr(id), + SharePatch: sharePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateShareOptions) SetID(id string) *UpdateShareOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSharePatch : Allow user to set SharePatch +func (_options *UpdateShareOptions) SetSharePatch(sharePatch map[string]interface{}) *UpdateShareOptions { + _options.SharePatch = sharePatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateShareOptions) SetIfMatch(ifMatch string) *UpdateShareOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateShareOptions) SetHeaders(param map[string]string) *UpdateShareOptions { + options.Headers = param + return options +} + +// UpdateSnapshotOptions : The UpdateSnapshot options. +type UpdateSnapshotOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // The snapshot patch. + SnapshotPatch map[string]interface{} `json:"Snapshot_patch" validate:"required"` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSnapshotOptions : Instantiate UpdateSnapshotOptions +func (*VpcV1) NewUpdateSnapshotOptions(id string, snapshotPatch map[string]interface{}) *UpdateSnapshotOptions { + return &UpdateSnapshotOptions{ + ID: core.StringPtr(id), + SnapshotPatch: snapshotPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateSnapshotOptions) SetID(id string) *UpdateSnapshotOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSnapshotPatch : Allow user to set SnapshotPatch +func (_options *UpdateSnapshotOptions) SetSnapshotPatch(snapshotPatch map[string]interface{}) *UpdateSnapshotOptions { + _options.SnapshotPatch = snapshotPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateSnapshotOptions) SetIfMatch(ifMatch string) *UpdateSnapshotOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSnapshotOptions) SetHeaders(param map[string]string) *UpdateSnapshotOptions { + options.Headers = param + return options +} + +// UpdateSubnetOptions : The UpdateSubnet options. +type UpdateSubnetOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The subnet patch. + SubnetPatch map[string]interface{} `json:"Subnet_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSubnetOptions : Instantiate UpdateSubnetOptions +func (*VpcV1) NewUpdateSubnetOptions(id string, subnetPatch map[string]interface{}) *UpdateSubnetOptions { + return &UpdateSubnetOptions{ + ID: core.StringPtr(id), + SubnetPatch: subnetPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateSubnetOptions) SetID(id string) *UpdateSubnetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSubnetPatch : Allow user to set SubnetPatch +func (_options *UpdateSubnetOptions) SetSubnetPatch(subnetPatch map[string]interface{}) *UpdateSubnetOptions { + _options.SubnetPatch = subnetPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSubnetOptions) SetHeaders(param map[string]string) *UpdateSubnetOptions { + options.Headers = param + return options +} + +// UpdateSubnetReservedIPOptions : The UpdateSubnetReservedIP options. +type UpdateSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `json:"subnet_id" validate:"required,ne="` + + // The reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // The reserved IP patch. + ReservedIPPatch map[string]interface{} `json:"ReservedIP_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSubnetReservedIPOptions : Instantiate UpdateSubnetReservedIPOptions +func (*VpcV1) NewUpdateSubnetReservedIPOptions(subnetID string, id string, reservedIPPatch map[string]interface{}) *UpdateSubnetReservedIPOptions { + return &UpdateSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + ID: core.StringPtr(id), + ReservedIPPatch: reservedIPPatch, + } +} + +// SetSubnetID : Allow user to set SubnetID +func (_options *UpdateSubnetReservedIPOptions) SetSubnetID(subnetID string) *UpdateSubnetReservedIPOptions { + _options.SubnetID = core.StringPtr(subnetID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateSubnetReservedIPOptions) SetID(id string) *UpdateSubnetReservedIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetReservedIPPatch : Allow user to set ReservedIPPatch +func (_options *UpdateSubnetReservedIPOptions) SetReservedIPPatch(reservedIPPatch map[string]interface{}) *UpdateSubnetReservedIPOptions { + _options.ReservedIPPatch = reservedIPPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSubnetReservedIPOptions) SetHeaders(param map[string]string) *UpdateSubnetReservedIPOptions { + options.Headers = param + return options +} + +// UpdateVirtualNetworkInterfaceOptions : The UpdateVirtualNetworkInterface options. +type UpdateVirtualNetworkInterfaceOptions struct { + // The virtual network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // The virtual network interface patch. + VirtualNetworkInterfacePatch map[string]interface{} `json:"VirtualNetworkInterface_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVirtualNetworkInterfaceOptions : Instantiate UpdateVirtualNetworkInterfaceOptions +func (*VpcV1) NewUpdateVirtualNetworkInterfaceOptions(id string, virtualNetworkInterfacePatch map[string]interface{}) *UpdateVirtualNetworkInterfaceOptions { + return &UpdateVirtualNetworkInterfaceOptions{ + ID: core.StringPtr(id), + VirtualNetworkInterfacePatch: virtualNetworkInterfacePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVirtualNetworkInterfaceOptions) SetID(id string) *UpdateVirtualNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVirtualNetworkInterfacePatch : Allow user to set VirtualNetworkInterfacePatch +func (_options *UpdateVirtualNetworkInterfaceOptions) SetVirtualNetworkInterfacePatch(virtualNetworkInterfacePatch map[string]interface{}) *UpdateVirtualNetworkInterfaceOptions { + _options.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateVirtualNetworkInterfaceOptions { + options.Headers = param + return options +} + +// UpdateVolumeOptions : The UpdateVolume options. +type UpdateVolumeOptions struct { + // The volume identifier. + ID *string `json:"id" validate:"required,ne="` + + // The volume patch. + VolumePatch map[string]interface{} `json:"Volume_patch" validate:"required"` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVolumeOptions : Instantiate UpdateVolumeOptions +func (*VpcV1) NewUpdateVolumeOptions(id string, volumePatch map[string]interface{}) *UpdateVolumeOptions { + return &UpdateVolumeOptions{ + ID: core.StringPtr(id), + VolumePatch: volumePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVolumeOptions) SetID(id string) *UpdateVolumeOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVolumePatch : Allow user to set VolumePatch +func (_options *UpdateVolumeOptions) SetVolumePatch(volumePatch map[string]interface{}) *UpdateVolumeOptions { + _options.VolumePatch = volumePatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVolumeOptions) SetIfMatch(ifMatch string) *UpdateVolumeOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVolumeOptions) SetHeaders(param map[string]string) *UpdateVolumeOptions { + options.Headers = param + return options +} + +// UpdateVPCAddressPrefixOptions : The UpdateVPCAddressPrefix options. +type UpdateVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The prefix identifier. + ID *string `json:"id" validate:"required,ne="` + + // The prefix patch. + AddressPrefixPatch map[string]interface{} `json:"AddressPrefix_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCAddressPrefixOptions : Instantiate UpdateVPCAddressPrefixOptions +func (*VpcV1) NewUpdateVPCAddressPrefixOptions(vpcID string, id string, addressPrefixPatch map[string]interface{}) *UpdateVPCAddressPrefixOptions { + return &UpdateVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + AddressPrefixPatch: addressPrefixPatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCAddressPrefixOptions) SetVPCID(vpcID string) *UpdateVPCAddressPrefixOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCAddressPrefixOptions) SetID(id string) *UpdateVPCAddressPrefixOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetAddressPrefixPatch : Allow user to set AddressPrefixPatch +func (_options *UpdateVPCAddressPrefixOptions) SetAddressPrefixPatch(addressPrefixPatch map[string]interface{}) *UpdateVPCAddressPrefixOptions { + _options.AddressPrefixPatch = addressPrefixPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCAddressPrefixOptions) SetHeaders(param map[string]string) *UpdateVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// UpdateVPCOptions : The UpdateVPC options. +type UpdateVPCOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPC patch. + VPCPatch map[string]interface{} `json:"VPC_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCOptions : Instantiate UpdateVPCOptions +func (*VpcV1) NewUpdateVPCOptions(id string, vpcPatch map[string]interface{}) *UpdateVPCOptions { + return &UpdateVPCOptions{ + ID: core.StringPtr(id), + VPCPatch: vpcPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCOptions) SetID(id string) *UpdateVPCOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPCPatch : Allow user to set VPCPatch +func (_options *UpdateVPCOptions) SetVPCPatch(vpcPatch map[string]interface{}) *UpdateVPCOptions { + _options.VPCPatch = vpcPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCOptions) SetHeaders(param map[string]string) *UpdateVPCOptions { + options.Headers = param + return options +} + +// UpdateVPCRouteOptions : The UpdateVPCRoute options. +type UpdateVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The route identifier. + ID *string `json:"id" validate:"required,ne="` + + // The route patch. + RoutePatch map[string]interface{} `json:"Route_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCRouteOptions : Instantiate UpdateVPCRouteOptions +func (*VpcV1) NewUpdateVPCRouteOptions(vpcID string, id string, routePatch map[string]interface{}) *UpdateVPCRouteOptions { + return &UpdateVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + RoutePatch: routePatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCRouteOptions) SetVPCID(vpcID string) *UpdateVPCRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCRouteOptions) SetID(id string) *UpdateVPCRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRoutePatch : Allow user to set RoutePatch +func (_options *UpdateVPCRouteOptions) SetRoutePatch(routePatch map[string]interface{}) *UpdateVPCRouteOptions { + _options.RoutePatch = routePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCRouteOptions) SetHeaders(param map[string]string) *UpdateVPCRouteOptions { + options.Headers = param + return options +} + +// UpdateVPCRoutingTableOptions : The UpdateVPCRoutingTable options. +type UpdateVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + ID *string `json:"id" validate:"required,ne="` + + // The routing table patch. + RoutingTablePatch map[string]interface{} `json:"RoutingTable_patch" validate:"required"` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCRoutingTableOptions : Instantiate UpdateVPCRoutingTableOptions +func (*VpcV1) NewUpdateVPCRoutingTableOptions(vpcID string, id string, routingTablePatch map[string]interface{}) *UpdateVPCRoutingTableOptions { + return &UpdateVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + RoutingTablePatch: routingTablePatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCRoutingTableOptions) SetVPCID(vpcID string) *UpdateVPCRoutingTableOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCRoutingTableOptions) SetID(id string) *UpdateVPCRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRoutingTablePatch : Allow user to set RoutingTablePatch +func (_options *UpdateVPCRoutingTableOptions) SetRoutingTablePatch(routingTablePatch map[string]interface{}) *UpdateVPCRoutingTableOptions { + _options.RoutingTablePatch = routingTablePatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVPCRoutingTableOptions) SetIfMatch(ifMatch string) *UpdateVPCRoutingTableOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCRoutingTableOptions) SetHeaders(param map[string]string) *UpdateVPCRoutingTableOptions { + options.Headers = param + return options +} + +// UpdateVPCRoutingTableRouteOptions : The UpdateVPCRoutingTableRoute options. +type UpdateVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` + + // The VPC routing table route identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPC route patch. + RoutePatch map[string]interface{} `json:"Route_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCRoutingTableRouteOptions : Instantiate UpdateVPCRoutingTableRouteOptions +func (*VpcV1) NewUpdateVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string, routePatch map[string]interface{}) *UpdateVPCRoutingTableRouteOptions { + return &UpdateVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + ID: core.StringPtr(id), + RoutePatch: routePatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *UpdateVPCRoutingTableRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *UpdateVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *UpdateVPCRoutingTableRouteOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCRoutingTableRouteOptions) SetID(id string) *UpdateVPCRoutingTableRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRoutePatch : Allow user to set RoutePatch +func (_options *UpdateVPCRoutingTableRouteOptions) SetRoutePatch(routePatch map[string]interface{}) *UpdateVPCRoutingTableRouteOptions { + _options.RoutePatch = routePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *UpdateVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// UpdateVPNGatewayConnectionOptions : The UpdateVPNGatewayConnection options. +type UpdateVPNGatewayConnectionOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPN gateway connection patch. + VPNGatewayConnectionPatch map[string]interface{} `json:"VPNGatewayConnection_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNGatewayConnectionOptions : Instantiate UpdateVPNGatewayConnectionOptions +func (*VpcV1) NewUpdateVPNGatewayConnectionOptions(vpnGatewayID string, id string, vpnGatewayConnectionPatch map[string]interface{}) *UpdateVPNGatewayConnectionOptions { + return &UpdateVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + VPNGatewayConnectionPatch: vpnGatewayConnectionPatch, + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *UpdateVPNGatewayConnectionOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNGatewayConnectionOptions) SetID(id string) *UpdateVPNGatewayConnectionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNGatewayConnectionPatch : Allow user to set VPNGatewayConnectionPatch +func (_options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPatch(vpnGatewayConnectionPatch map[string]interface{}) *UpdateVPNGatewayConnectionOptions { + _options.VPNGatewayConnectionPatch = vpnGatewayConnectionPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// UpdateVPNGatewayOptions : The UpdateVPNGateway options. +type UpdateVPNGatewayOptions struct { + // The VPN gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPN gateway patch. + VPNGatewayPatch map[string]interface{} `json:"VPNGateway_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNGatewayOptions : Instantiate UpdateVPNGatewayOptions +func (*VpcV1) NewUpdateVPNGatewayOptions(id string, vpnGatewayPatch map[string]interface{}) *UpdateVPNGatewayOptions { + return &UpdateVPNGatewayOptions{ + ID: core.StringPtr(id), + VPNGatewayPatch: vpnGatewayPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNGatewayOptions) SetID(id string) *UpdateVPNGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNGatewayPatch : Allow user to set VPNGatewayPatch +func (_options *UpdateVPNGatewayOptions) SetVPNGatewayPatch(vpnGatewayPatch map[string]interface{}) *UpdateVPNGatewayOptions { + _options.VPNGatewayPatch = vpnGatewayPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNGatewayOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayOptions { + options.Headers = param + return options +} + +// UpdateVPNServerOptions : The UpdateVPNServer options. +type UpdateVPNServerOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPN server patch. + VPNServerPatch map[string]interface{} `json:"VPNServer_patch" validate:"required"` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNServerOptions : Instantiate UpdateVPNServerOptions +func (*VpcV1) NewUpdateVPNServerOptions(id string, vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions { + return &UpdateVPNServerOptions{ + ID: core.StringPtr(id), + VPNServerPatch: vpnServerPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNServerOptions) SetID(id string) *UpdateVPNServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNServerPatch : Allow user to set VPNServerPatch +func (_options *UpdateVPNServerOptions) SetVPNServerPatch(vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions { + _options.VPNServerPatch = vpnServerPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVPNServerOptions) SetIfMatch(ifMatch string) *UpdateVPNServerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNServerOptions) SetHeaders(param map[string]string) *UpdateVPNServerOptions { + options.Headers = param + return options +} + +// UpdateVPNServerRouteOptions : The UpdateVPNServerRoute options. +type UpdateVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN route identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPN route patch. + VPNServerRoutePatch map[string]interface{} `json:"VPNServerRoute_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNServerRouteOptions : Instantiate UpdateVPNServerRouteOptions +func (*VpcV1) NewUpdateVPNServerRouteOptions(vpnServerID string, id string, vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions { + return &UpdateVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + VPNServerRoutePatch: vpnServerRoutePatch, + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *UpdateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *UpdateVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNServerRouteOptions) SetID(id string) *UpdateVPNServerRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNServerRoutePatch : Allow user to set VPNServerRoutePatch +func (_options *UpdateVPNServerRouteOptions) SetVPNServerRoutePatch(vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions { + _options.VPNServerRoutePatch = vpnServerRoutePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNServerRouteOptions) SetHeaders(param map[string]string) *UpdateVPNServerRouteOptions { + options.Headers = param + return options +} + +// Vcpu : The VCPU configuration. +type Vcpu struct { + // The VCPU architecture. + Architecture *string `json:"architecture" validate:"required"` + + // The number of VCPUs assigned. + Count *int64 `json:"count" validate:"required"` + + // The VCPU manufacturer. + Manufacturer *string `json:"manufacturer" validate:"required"` +} + +// UnmarshalVcpu unmarshals an instance of Vcpu from the specified map of raw messages. +func UnmarshalVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Vcpu) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPC : VPC struct +type VPC struct { + // Indicates whether this VPC is connected to Classic Infrastructure. If true, this VPC's resources have private + // network connectivity to the account's Classic Infrastructure resources. Only one VPC, per region, may be connected + // in this way. This value is set at creation and subsequently immutable. + ClassicAccess *bool `json:"classic_access" validate:"required"` + + // The date and time that the VPC was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // The CSE ([Cloud Service Endpoint](https://cloud.ibm.com/docs/resources?topic=resources-service-endpoints)) source IP + // addresses for the VPC. The VPC will have one CSE source IP address per zone. + CseSourceIps []VpccseSourceIP `json:"cse_source_ips,omitempty"` + + // The default network ACL to use for subnets created in this VPC. + DefaultNetworkACL *NetworkACLReference `json:"default_network_acl" validate:"required"` + + // The default routing table to use for subnets created in this VPC. + DefaultRoutingTable *RoutingTableReference `json:"default_routing_table" validate:"required"` + + // The default security group for this VPC. Resources created in this VPC that allow + // a security group to be optionally specified will use this security group by + // default. + DefaultSecurityGroup *SecurityGroupReference `json:"default_security_group" validate:"required"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The name for this VPC. The name is unique across all VPCs in the region. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPC. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of this VPC. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the VPC.ResourceType property. +// The resource type. +const ( + VPCResourceTypeVPCConst = "vpc" +) + +// Constants associated with the VPC.Status property. +// The status of this VPC. +const ( + VPCStatusAvailableConst = "available" + VPCStatusDeletingConst = "deleting" + VPCStatusFailedConst = "failed" + VPCStatusPendingConst = "pending" +) + +// UnmarshalVPC unmarshals an instance of VPC from the specified map of raw messages. +func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPC) + err = core.UnmarshalPrimitive(m, "classic_access", &obj.ClassicAccess) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cse_source_ips", &obj.CseSourceIps, UnmarshalVpccseSourceIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_network_acl", &obj.DefaultNetworkACL, UnmarshalNetworkACLReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_routing_table", &obj.DefaultRoutingTable, UnmarshalRoutingTableReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_security_group", &obj.DefaultSecurityGroup, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpccseSourceIP : VpccseSourceIP struct +type VpccseSourceIP struct { + // The cloud service endpoint source IP address for this zone. + IP *IP `json:"ip" validate:"required"` + + // The zone this cloud service endpoint source IP resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalVpccseSourceIP unmarshals an instance of VpccseSourceIP from the specified map of raw messages. +func UnmarshalVpccseSourceIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpccseSourceIP) + err = core.UnmarshalModel(m, "ip", &obj.IP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCCollection : VPCCollection struct +type VPCCollection struct { + // A link to the first page of resources. + First *VPCCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VPCCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of VPCs. + Vpcs []VPC `json:"vpcs" validate:"required"` +} + +// UnmarshalVPCCollection unmarshals an instance of VPCCollection from the specified map of raw messages. +func UnmarshalVPCCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPCCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPCCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpcs", &obj.Vpcs, UnmarshalVPC) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VPCCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// VPCCollectionFirst : A link to the first page of resources. +type VPCCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPCCollectionFirst unmarshals an instance of VPCCollectionFirst from the specified map of raw messages. +func UnmarshalVPCCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VPCCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPCCollectionNext unmarshals an instance of VPCCollectionNext from the specified map of raw messages. +func UnmarshalVPCCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentity : Identifies a VPC by a unique property. +// Models which "extend" this model: +// - VPCIdentityByID +// - VPCIdentityByCRN +// - VPCIdentityByHref +type VPCIdentity struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*VPCIdentity) isaVPCIdentity() bool { + return true +} + +type VPCIdentityIntf interface { + isaVPCIdentity() bool +} + +// UnmarshalVPCIdentity unmarshals an instance of VPCIdentity from the specified map of raw messages. +func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCPatch : VPCPatch struct +type VPCPatch struct { + // The 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.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VPCPatch +func (vpcPatch *VPCPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpcPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// VPCReference : VPCReference struct +type VPCReference struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The name for this VPC. The name is unique across all VPCs in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPCReference.ResourceType property. +// The resource type. +const ( + VPCReferenceResourceTypeVPCConst = "vpc" +) + +// UnmarshalVPCReference unmarshals an instance of VPCReference from the specified map of raw messages. +func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPCReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPCReferenceDeleted unmarshals an instance of VPCReferenceDeleted from the specified map of raw messages. +func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGateway : VPNGateway struct +// Models which "extend" this model: +// - VPNGatewayRouteMode +// - VPNGatewayPolicyMode +type VPNGateway struct { + // Connections for this VPN gateway. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The 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"` + + // The status of the VPN gateway. + Status *string `json:"status" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The VPC this VPN gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGateway.ResourceType property. +// The resource type. +const ( + VPNGatewayResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGateway.Status property. +// The status of the VPN gateway. +const ( + VPNGatewayStatusAvailableConst = "available" + VPNGatewayStatusDeletingConst = "deleting" + VPNGatewayStatusFailedConst = "failed" + VPNGatewayStatusPendingConst = "pending" +) + +// Constants associated with the VPNGateway.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayModeRouteConst = "route" +) + +func (*VPNGateway) isaVPNGateway() bool { + return true +} + +type VPNGatewayIntf interface { + isaVPNGateway() bool +} + +// UnmarshalVPNGateway unmarshals an instance of VPNGateway from the specified map of raw messages. +func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGateway) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayCollection : VPNGatewayCollection struct +type VPNGatewayCollection struct { + // A link to the first page of resources. + First *VPNGatewayCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VPNGatewayCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of VPN gateways. + VPNGateways []VPNGatewayIntf `json:"vpn_gateways" validate:"required"` +} + +// UnmarshalVPNGatewayCollection unmarshals an instance of VPNGatewayCollection from the specified map of raw messages. +func UnmarshalVPNGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNGatewayCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNGatewayCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpn_gateways", &obj.VPNGateways, UnmarshalVPNGateway) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VPNGatewayCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// VPNGatewayCollectionFirst : A link to the first page of resources. +type VPNGatewayCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNGatewayCollectionFirst unmarshals an instance of VPNGatewayCollectionFirst from the specified map of raw messages. +func UnmarshalVPNGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VPNGatewayCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNGatewayCollectionNext unmarshals an instance of VPNGatewayCollectionNext from the specified map of raw messages. +func UnmarshalVPNGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnection : VPNGatewayConnection struct +// Models which "extend" this model: +// - VPNGatewayConnectionStaticRouteMode +// - VPNGatewayConnectionPolicyMode +type VPNGatewayConnection struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` + + // The VPN tunnel configuration for this VPN gateway connection (in static route mode). + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels,omitempty"` + + // The local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs,omitempty"` + + // The peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs,omitempty"` +} + +// Constants associated with the VPNGatewayConnection.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnection.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionModePolicyConst = "policy" + VPNGatewayConnectionModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnection.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnection.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionStatusDownConst = "down" + VPNGatewayConnectionStatusUpConst = "up" +) + +// Constants associated with the VPNGatewayConnection.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnection) isaVPNGatewayConnection() bool { + return true +} + +type VPNGatewayConnectionIntf interface { + isaVPNGatewayConnection() bool +} + +// UnmarshalVPNGatewayConnection unmarshals an instance of VPNGatewayConnection from the specified map of raw messages. +func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnection) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionCollection : Collection of VPN gateway connections in a VPN gateway. +type VPNGatewayConnectionCollection struct { + // Array of VPN gateway connections. + Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionCollection unmarshals an instance of VPNGatewayConnectionCollection from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionCollection) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpd : The Dead Peer Detection settings. +type VPNGatewayConnectionDpd struct { + // Dead Peer Detection actions. + Action *string `json:"action" validate:"required"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval" validate:"required"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionDpd.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdActionClearConst = "clear" + VPNGatewayConnectionDpdActionHoldConst = "hold" + VPNGatewayConnectionDpdActionNoneConst = "none" + VPNGatewayConnectionDpdActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpd unmarshals an instance of VPNGatewayConnectionDpd from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpd(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpd) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpdPatch : The Dead Peer Detection settings. +type VPNGatewayConnectionDpdPatch struct { + // Dead Peer Detection actions. + Action *string `json:"action,omitempty"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval,omitempty"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionDpdPatch.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdPatchActionClearConst = "clear" + VPNGatewayConnectionDpdPatchActionHoldConst = "hold" + VPNGatewayConnectionDpdPatchActionNoneConst = "none" + VPNGatewayConnectionDpdPatchActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpdPatch unmarshals an instance of VPNGatewayConnectionDpdPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpdPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpdPatch) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpdPrototype : The Dead Peer Detection settings. +type VPNGatewayConnectionDpdPrototype struct { + // Dead Peer Detection actions. + Action *string `json:"action,omitempty"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval,omitempty"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionDpdPrototype.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdPrototypeActionClearConst = "clear" + VPNGatewayConnectionDpdPrototypeActionHoldConst = "hold" + VPNGatewayConnectionDpdPrototypeActionNoneConst = "none" + VPNGatewayConnectionDpdPrototypeActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpdPrototype unmarshals an instance of VPNGatewayConnectionDpdPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpdPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPatch : The IKE policy to use. Specify `null` to remove any existing policy, [resulting in +// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). +// Models which "extend" this model: +// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID +// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref +type VPNGatewayConnectionIkePolicyPatch struct { + // The unique identifier for this IKE policy. + ID *string `json:"id,omitempty"` + + // The IKE policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIkePolicyPatch) isaVPNGatewayConnectionIkePolicyPatch() bool { + return true +} + +type VPNGatewayConnectionIkePolicyPatchIntf interface { + isaVPNGatewayConnectionIkePolicyPatch() bool +} + +// UnmarshalVPNGatewayConnectionIkePolicyPatch unmarshals an instance of VPNGatewayConnectionIkePolicyPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPrototype : The IKE policy to use. If unspecified, [auto-negotiation will be +// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). +// Models which "extend" this model: +// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID +// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref +type VPNGatewayConnectionIkePolicyPrototype struct { + // The unique identifier for this IKE policy. + ID *string `json:"id,omitempty"` + + // The IKE policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIkePolicyPrototype) isaVPNGatewayConnectionIkePolicyPrototype() bool { + return true +} + +type VPNGatewayConnectionIkePolicyPrototypeIntf interface { + isaVPNGatewayConnectionIkePolicyPrototype() bool +} + +// UnmarshalVPNGatewayConnectionIkePolicyPrototype unmarshals an instance of VPNGatewayConnectionIkePolicyPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPatch : The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in +// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). +// Models which "extend" this model: +// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID +// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref +type VPNGatewayConnectionIPsecPolicyPatch struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id,omitempty"` + + // The IPsec policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIPsecPolicyPatch) isaVPNGatewayConnectionIPsecPolicyPatch() bool { + return true +} + +type VPNGatewayConnectionIPsecPolicyPatchIntf interface { + isaVPNGatewayConnectionIPsecPolicyPatch() bool +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPatch unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPrototype : The IPsec policy to use. If unspecified, [auto-negotiation will be +// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). +// Models which "extend" this model: +// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID +// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref +type VPNGatewayConnectionIPsecPolicyPrototype struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id,omitempty"` + + // The IPsec policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIPsecPolicyPrototype) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { + return true +} + +type VPNGatewayConnectionIPsecPolicyPrototypeIntf interface { + isaVPNGatewayConnectionIPsecPolicyPrototype() bool +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPrototype unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionLocalCIDRs : VPNGatewayConnectionLocalCIDRs struct +type VPNGatewayConnectionLocalCIDRs struct { + // The local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs,omitempty"` +} + +// UnmarshalVPNGatewayConnectionLocalCIDRs unmarshals an instance of VPNGatewayConnectionLocalCIDRs from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionLocalCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionLocalCIDRs) + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPatch : VPNGatewayConnectionPatch struct +// Models which "extend" this model: +// - VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch +type VPNGatewayConnectionPatch struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"` + + // The IKE policy to use. Specify `null` to remove any existing policy, [resulting in + // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy VPNGatewayConnectionIkePolicyPatchIntf `json:"ike_policy,omitempty"` + + // The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in + // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"` + + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address,omitempty"` + + // The preshared key. + Psk *string `json:"psk,omitempty"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPatch.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPatchRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionPatch) isaVPNGatewayConnectionPatch() bool { + return true +} + +type VPNGatewayConnectionPatchIntf interface { + isaVPNGatewayConnectionPatch() bool +} + +// UnmarshalVPNGatewayConnectionPatch unmarshals an instance of VPNGatewayConnectionPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPatch) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VPNGatewayConnectionPatch +func (vpnGatewayConnectionPatch *VPNGatewayConnectionPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpnGatewayConnectionPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// VPNGatewayConnectionPeerCIDRs : VPNGatewayConnectionPeerCIDRs struct +type VPNGatewayConnectionPeerCIDRs struct { + // The peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs,omitempty"` +} + +// UnmarshalVPNGatewayConnectionPeerCIDRs unmarshals an instance of VPNGatewayConnectionPeerCIDRs from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerCIDRs) + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPrototype : VPNGatewayConnectionPrototype struct +// Models which "extend" this model: +// - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype +// - VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype +type VPNGatewayConnectionPrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + // The IKE policy to use. If unspecified, [auto-negotiation will be + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` + + // The IPsec policy to use. If unspecified, [auto-negotiation will be + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` + + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` + + // The local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs,omitempty"` + + // The peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPrototype.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPrototypeRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionPrototype) isaVPNGatewayConnectionPrototype() bool { + return true +} + +type VPNGatewayConnectionPrototypeIntf interface { + isaVPNGatewayConnectionPrototype() bool +} + +// UnmarshalVPNGatewayConnectionPrototype unmarshals an instance of VPNGatewayConnectionPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionReference : VPNGatewayConnectionReference struct +type VPNGatewayConnectionReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionReference.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// UnmarshalVPNGatewayConnectionReference unmarshals an instance of VPNGatewayConnectionReference from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPNGatewayConnectionReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionReferenceDeleted unmarshals an instance of VPNGatewayConnectionReferenceDeleted from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModeTunnel : VPNGatewayConnectionStaticRouteModeTunnel struct +type VPNGatewayConnectionStaticRouteModeTunnel struct { + // The IP address of the VPN gateway member in which the tunnel resides. + PublicIP *IP `json:"public_ip" validate:"required"` + + // The status of the VPN Tunnel. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteModeTunnel.Status property. +// The status of the VPN Tunnel. +const ( + VPNGatewayConnectionStaticRouteModeTunnelStatusDownConst = "down" + VPNGatewayConnectionStaticRouteModeTunnelStatusUpConst = "up" +) + +// UnmarshalVPNGatewayConnectionStaticRouteModeTunnel unmarshals an instance of VPNGatewayConnectionStaticRouteModeTunnel from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModeTunnel) + err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayMember : VPNGatewayMember struct +type VPNGatewayMember struct { + // The reserved IP address assigned to the VPN gateway member. + // + // This property will be present only when the VPN gateway status is `available`. + PrivateIP *ReservedIPReference `json:"private_ip" validate:"required"` + + // The public IP address assigned to the VPN gateway member. + PublicIP *IP `json:"public_ip" validate:"required"` + + // The high availability role assigned to the VPN gateway member. + Role *string `json:"role" validate:"required"` + + // The status of the VPN gateway member. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the VPNGatewayMember.Role property. +// The high availability role assigned to the VPN gateway member. +const ( + VPNGatewayMemberRoleActiveConst = "active" + VPNGatewayMemberRoleStandbyConst = "standby" +) + +// Constants associated with the VPNGatewayMember.Status property. +// The status of the VPN gateway member. +const ( + VPNGatewayMemberStatusAvailableConst = "available" + VPNGatewayMemberStatusDeletingConst = "deleting" + VPNGatewayMemberStatusFailedConst = "failed" + VPNGatewayMemberStatusPendingConst = "pending" +) + +// UnmarshalVPNGatewayMember unmarshals an instance of VPNGatewayMember from the specified map of raw messages. +func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayMember) + err = core.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "role", &obj.Role) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPatch : VPNGatewayPatch struct +type VPNGatewayPatch struct { + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVPNGatewayPatch unmarshals an instance of VPNGatewayPatch from the specified map of raw messages. +func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VPNGatewayPatch +func (vpnGatewayPatch *VPNGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpnGatewayPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// VPNGatewayPrototype : VPNGatewayPrototype struct +// Models which "extend" this model: +// - VPNGatewayPrototypeVPNGatewayRouteModePrototype +// - VPNGatewayPrototypeVPNGatewayPolicyModePrototype +type VPNGatewayPrototype struct { + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Identifies a subnet by a unique property. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototype.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayPrototypeModeRouteConst = "route" +) + +func (*VPNGatewayPrototype) isaVPNGatewayPrototype() bool { + return true +} + +type VPNGatewayPrototypeIntf interface { + isaVPNGatewayPrototype() bool +} + +// UnmarshalVPNGatewayPrototype unmarshals an instance of VPNGatewayPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPNGatewayReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPNGatewayReferenceDeleted unmarshals an instance of VPNGatewayReferenceDeleted from the specified map of raw messages. +func UnmarshalVPNGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServer : VPNServer struct +type VPNServer struct { + // The certificate instance for this VPN server. + Certificate *CertificateInstanceReference `json:"certificate" validate:"required"` + + // The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all specified + // methods. + ClientAuthentication []VPNServerAuthenticationIntf `json:"client_authentication" validate:"required"` + + // Indicates whether disconnected VPN clients will be automatically deleted after + // `client_auto_delete_timeout` hours have passed. At present, this is always `true`, but may be modifiable in the + // future. + ClientAutoDelete *bool `json:"client_auto_delete" validate:"required"` + + // If `client_auto_delete` is `true`, the hours after which disconnected VPN clients will be automatically deleted. If + // the value is `0`, disconnected VPN clients will be deleted immediately. This value may be modifiable in the future. + ClientAutoDeleteTimeout *int64 `json:"client_auto_delete_timeout" validate:"required"` + + // The DNS server addresses that will be provided to VPN clients that are connected to this VPN server. + ClientDnsServerIps []IP `json:"client_dns_server_ips" validate:"required"` + + // The seconds a VPN client can be idle before this VPN server will disconnect it. If `0`, the server will not + // disconnect idle clients. + ClientIdleTimeout *int64 `json:"client_idle_timeout" validate:"required"` + + // The VPN client IPv4 address pool, expressed in CIDR format. + ClientIPPool *string `json:"client_ip_pool" validate:"required"` + + // The date and time that the VPN server was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // Indicates whether the split tunneling is enabled on this VPN server. + EnableSplitTunneling *bool `json:"enable_split_tunneling" validate:"required"` + + // The health of this resource. + // - `ok`: No abnormal behavior detected + // - `degraded`: Experiencing compromised performance, capacity, or connectivity + // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated + // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a + // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also + // have this state. + HealthState *string `json:"health_state" validate:"required"` + + // Fully qualified domain name assigned to this VPN server. + Hostname *string `json:"hostname" validate:"required"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the VPN server. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this VPN server. The name is unique across all VPN servers in the VPC. + Name *string `json:"name" validate:"required"` + + // The port number used by this VPN server. + Port *int64 `json:"port" validate:"required"` + + // The reserved IPs bound to this VPN server. + PrivateIps []ReservedIPReference `json:"private_ips" validate:"required"` + + // The transport protocol used by this VPN server. + Protocol *string `json:"protocol" validate:"required"` + + // The resource group for this VPN server. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups targeting this VPN server. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The subnets this VPN server is provisioned in. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The VPC this VPN server resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the VPNServer.HealthState property. +// The health of this resource. +// - `ok`: No abnormal behavior detected +// - `degraded`: Experiencing compromised performance, capacity, or connectivity +// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated +// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle +// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this +// state. +const ( + VPNServerHealthStateDegradedConst = "degraded" + VPNServerHealthStateFaultedConst = "faulted" + VPNServerHealthStateInapplicableConst = "inapplicable" + VPNServerHealthStateOkConst = "ok" +) + +// Constants associated with the VPNServer.LifecycleState property. +// The lifecycle state of the VPN server. +const ( + VPNServerLifecycleStateDeletingConst = "deleting" + VPNServerLifecycleStateFailedConst = "failed" + VPNServerLifecycleStatePendingConst = "pending" + VPNServerLifecycleStateStableConst = "stable" + VPNServerLifecycleStateSuspendedConst = "suspended" + VPNServerLifecycleStateUpdatingConst = "updating" + VPNServerLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNServer.Protocol property. +// The transport protocol used by this VPN server. +const ( + VPNServerProtocolTCPConst = "tcp" + VPNServerProtocolUDPConst = "udp" +) + +// Constants associated with the VPNServer.ResourceType property. +// The resource type. +const ( + VPNServerResourceTypeVPNServerConst = "vpn_server" +) + +// UnmarshalVPNServer unmarshals an instance of VPNServer from the specified map of raw messages. +func UnmarshalVPNServer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServer) + err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthentication) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_auto_delete", &obj.ClientAutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_auto_delete_timeout", &obj.ClientAutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthentication : An authentication method for this VPN server. +// Models which "extend" this model: +// - VPNServerAuthenticationByUsername +// - VPNServerAuthenticationByCertificate +type VPNServerAuthentication struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider,omitempty"` + + // The certificate instance used for the VPN client certificate authority (CA). + ClientCa *CertificateInstanceReference `json:"client_ca,omitempty"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthentication.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationMethodCertificateConst = "certificate" + VPNServerAuthenticationMethodUsernameConst = "username" +) + +func (*VPNServerAuthentication) isaVPNServerAuthentication() bool { + return true +} + +type VPNServerAuthenticationIntf interface { + isaVPNServerAuthentication() bool +} + +// UnmarshalVPNServerAuthentication unmarshals an instance of VPNServerAuthentication from the specified map of raw messages. +func UnmarshalVPNServerAuthentication(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthentication) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByUsernameIDProvider : The type of identity provider to be used by VPN client. +// Models which "extend" this model: +// - VPNServerAuthenticationByUsernameIDProviderByIam +type VPNServerAuthenticationByUsernameIDProvider struct { + // The type of identity provider to be used by the VPN client. + // - `iam`: IBM identity and access management + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + ProviderType *string `json:"provider_type,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationByUsernameIDProvider.ProviderType property. +// The type of identity provider to be used by the VPN client. +// - `iam`: IBM identity and access management +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + VPNServerAuthenticationByUsernameIDProviderProviderTypeIamConst = "iam" +) + +func (*VPNServerAuthenticationByUsernameIDProvider) isaVPNServerAuthenticationByUsernameIDProvider() bool { + return true +} + +type VPNServerAuthenticationByUsernameIDProviderIntf interface { + isaVPNServerAuthenticationByUsernameIDProvider() bool +} + +// UnmarshalVPNServerAuthenticationByUsernameIDProvider unmarshals an instance of VPNServerAuthenticationByUsernameIDProvider from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByUsernameIDProvider(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByUsernameIDProvider) + err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationPrototype : An authentication method for this VPN server. +// Models which "extend" this model: +// - VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype +// - VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype +type VPNServerAuthenticationPrototype struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider,omitempty"` + + // The certificate instance to use for the VPN client certificate authority (CA). + ClientCa CertificateInstanceIdentityIntf `json:"client_ca,omitempty"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationPrototype.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationPrototypeMethodCertificateConst = "certificate" + VPNServerAuthenticationPrototypeMethodUsernameConst = "username" +) + +func (*VPNServerAuthenticationPrototype) isaVPNServerAuthenticationPrototype() bool { + return true +} + +type VPNServerAuthenticationPrototypeIntf interface { + isaVPNServerAuthenticationPrototype() bool +} + +// UnmarshalVPNServerAuthenticationPrototype unmarshals an instance of VPNServerAuthenticationPrototype from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "method", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'method': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'method' not found in JSON object") + return + } + if discValue == "certificate" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) + } else if discValue == "username" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'method': %s", discValue) + } + return +} + +// VPNServerClient : VPNServerClient struct +type VPNServerClient struct { + // The IP address assigned to this VPN client from `client_ip_pool`. + ClientIP *IP `json:"client_ip" validate:"required"` + + // The common name of client certificate that the VPN client provided when connecting to the server. + // + // This property will be present only when the `certificate` client authentication method is enabled on the VPN server. + CommonName *string `json:"common_name,omitempty"` + + // The date and time that the VPN client was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The date and time that the VPN client was disconnected. + // + // This property will be present only when the client `status` is `disconnected`. + DisconnectedAt *strfmt.DateTime `json:"disconnected_at,omitempty"` + + // The URL for this VPN client. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN client. + ID *string `json:"id" validate:"required"` + + // The remote IP address of this VPN client. + RemoteIP *IP `json:"remote_ip" validate:"required"` + + // The remote port of this VPN client. + RemotePort *int64 `json:"remote_port" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the VPN client: + // - `connected`: the VPN client is `connected` to this VPN server. + // - `disconnected`: the VPN client is `disconnected` from this VPN server. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + + // The username that this VPN client provided when connecting to the VPN server. + // + // This property will be present only when the `username` client authentication method is enabled on the VPN server. + Username *string `json:"username,omitempty"` +} + +// Constants associated with the VPNServerClient.ResourceType property. +// The resource type. +const ( + VPNServerClientResourceTypeVPNServerClientConst = "vpn_server_client" +) + +// Constants associated with the VPNServerClient.Status property. +// The status of the VPN client: +// - `connected`: the VPN client is `connected` to this VPN server. +// - `disconnected`: the VPN client is `disconnected` from this VPN server. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the +// unexpected property value was encountered. +const ( + VPNServerClientStatusConnectedConst = "connected" + VPNServerClientStatusDisconnectedConst = "disconnected" +) + +// UnmarshalVPNServerClient unmarshals an instance of VPNServerClient from the specified map of raw messages. +func UnmarshalVPNServerClient(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerClient) + err = core.UnmarshalModel(m, "client_ip", &obj.ClientIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "common_name", &obj.CommonName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "disconnected_at", &obj.DisconnectedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote_ip", &obj.RemoteIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "remote_port", &obj.RemotePort) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerClientCollection : VPNServerClientCollection struct +type VPNServerClientCollection struct { + // Collection of VPN clients. + Clients []VPNServerClient `json:"clients" validate:"required"` + + // A link to the first page of resources. + First *VPNServerClientCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VPNServerClientCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalVPNServerClientCollection unmarshals an instance of VPNServerClientCollection from the specified map of raw messages. +func UnmarshalVPNServerClientCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerClientCollection) + err = core.UnmarshalModel(m, "clients", &obj.Clients, UnmarshalVPNServerClient) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerClientCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerClientCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VPNServerClientCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// VPNServerClientCollectionFirst : A link to the first page of resources. +type VPNServerClientCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNServerClientCollectionFirst unmarshals an instance of VPNServerClientCollectionFirst from the specified map of raw messages. +func UnmarshalVPNServerClientCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerClientCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerClientCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VPNServerClientCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNServerClientCollectionNext unmarshals an instance of VPNServerClientCollectionNext from the specified map of raw messages. +func UnmarshalVPNServerClientCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerClientCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerCollection : VPNServerCollection struct +type VPNServerCollection struct { + // A link to the first page of resources. + First *VPNServerCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VPNServerCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of VPN servers. + VPNServers []VPNServer `json:"vpn_servers" validate:"required"` +} + +// UnmarshalVPNServerCollection unmarshals an instance of VPNServerCollection from the specified map of raw messages. +func UnmarshalVPNServerCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpn_servers", &obj.VPNServers, UnmarshalVPNServer) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VPNServerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// VPNServerCollectionFirst : A link to the first page of resources. +type VPNServerCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNServerCollectionFirst unmarshals an instance of VPNServerCollectionFirst from the specified map of raw messages. +func UnmarshalVPNServerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VPNServerCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNServerCollectionNext unmarshals an instance of VPNServerCollectionNext from the specified map of raw messages. +func UnmarshalVPNServerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerPatch : VPNServerPatch struct +type VPNServerPatch struct { + // The certificate instance for this VPN server. + Certificate CertificateInstanceIdentityIntf `json:"certificate,omitempty"` + + // The authentication methods to use to authenticate VPN client on this VPN server + // (replacing any existing methods). + ClientAuthentication []VPNServerAuthenticationPrototypeIntf `json:"client_authentication,omitempty"` + + // The DNS server addresses that will be provided to VPN clients connected to this VPN server (replacing any existing + // addresses). + ClientDnsServerIps []IP `json:"client_dns_server_ips,omitempty"` + + // The seconds a VPN client can be idle before this VPN server will disconnect it. If `0`, the server will not + // disconnect idle clients. + ClientIdleTimeout *int64 `json:"client_idle_timeout,omitempty"` + + // The VPN client IPv4 address pool, expressed in CIDR format. The request must not overlap with any existing address + // prefixes in the VPC or any of the following reserved address ranges: + // - `127.0.0.0/8` (IPv4 loopback addresses) + // - `161.26.0.0/16` (IBM services) + // - `166.8.0.0/14` (Cloud Service Endpoints) + // - `169.254.0.0/16` (IPv4 link-local addresses) + // - `224.0.0.0/4` (IPv4 multicast addresses) + // + // The prefix length of the client IP address pool's CIDR must be between + // `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that contains twice the number of IP addresses + // that are required to enable the maximum number of concurrent connections is recommended. + ClientIPPool *string `json:"client_ip_pool,omitempty"` + + // Indicates whether the split tunneling is enabled on this VPN server. + EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` + + // The name for this VPN server. The name must not be used by another VPN server in the VPC. + Name *string `json:"name,omitempty"` + + // The port number used by this VPN server. + Port *int64 `json:"port,omitempty"` + + // The transport protocol used by this VPN server. + Protocol *string `json:"protocol,omitempty"` + + // The subnets to provision this VPN server in (replacing the existing subnets). + Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` +} + +// Constants associated with the VPNServerPatch.Protocol property. +// The transport protocol used by this VPN server. +const ( + VPNServerPatchProtocolTCPConst = "tcp" + VPNServerPatchProtocolUDPConst = "udp" +) + +// UnmarshalVPNServerPatch unmarshals an instance of VPNServerPatch from the specified map of raw messages. +func UnmarshalVPNServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerPatch) + err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthenticationPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VPNServerPatch +func (vpnServerPatch *VPNServerPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpnServerPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// VPNServerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPNServerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPNServerReferenceDeleted unmarshals an instance of VPNServerReferenceDeleted from the specified map of raw messages. +func UnmarshalVPNServerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRoute : VPNServerRoute struct +type VPNServerRoute struct { + // The action to perform with a packet matching the VPN route: + // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. + // - `deliver`: deliver the packet into the VPC. + // - `drop`: drop the packet + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the + // unexpected property value was encountered. + Action *string `json:"action" validate:"required"` + + // The date and time that the VPN route was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination for this VPN route in the VPN server. If an incoming packet does not match any destination, it will + // be dropped. + Destination *string `json:"destination" validate:"required"` + + // The URL for this VPN route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN route. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the VPN route. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this VPN route. The name is unique across all routes for a VPN server. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPNServerRoute.Action property. +// The action to perform with a packet matching the VPN route: +// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. +// - `deliver`: deliver the packet into the VPC. +// - `drop`: drop the packet +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the +// unexpected property value was encountered. +const ( + VPNServerRouteActionDeliverConst = "deliver" + VPNServerRouteActionDropConst = "drop" + VPNServerRouteActionTranslateConst = "translate" +) + +// Constants associated with the VPNServerRoute.LifecycleState property. +// The lifecycle state of the VPN route. +const ( + VPNServerRouteLifecycleStateDeletingConst = "deleting" + VPNServerRouteLifecycleStateFailedConst = "failed" + VPNServerRouteLifecycleStatePendingConst = "pending" + VPNServerRouteLifecycleStateStableConst = "stable" + VPNServerRouteLifecycleStateSuspendedConst = "suspended" + VPNServerRouteLifecycleStateUpdatingConst = "updating" + VPNServerRouteLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNServerRoute.ResourceType property. +// The resource type. +const ( + VPNServerRouteResourceTypeVPNServerRouteConst = "vpn_server_route" +) + +// UnmarshalVPNServerRoute unmarshals an instance of VPNServerRoute from the specified map of raw messages. +func UnmarshalVPNServerRoute(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRoute) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRouteCollection : VPNServerRouteCollection struct +type VPNServerRouteCollection struct { + // A link to the first page of resources. + First *VPNServerRouteCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VPNServerRouteCollectionNext `json:"next,omitempty"` + + // Collection of VPN routes. + Routes []VPNServerRoute `json:"routes" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalVPNServerRouteCollection unmarshals an instance of VPNServerRouteCollection from the specified map of raw messages. +func UnmarshalVPNServerRouteCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRouteCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerRouteCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerRouteCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalVPNServerRoute) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VPNServerRouteCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// VPNServerRouteCollectionFirst : A link to the first page of resources. +type VPNServerRouteCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNServerRouteCollectionFirst unmarshals an instance of VPNServerRouteCollectionFirst from the specified map of raw messages. +func UnmarshalVPNServerRouteCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRouteCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRouteCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VPNServerRouteCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNServerRouteCollectionNext unmarshals an instance of VPNServerRouteCollectionNext from the specified map of raw messages. +func UnmarshalVPNServerRouteCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRouteCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRoutePatch : VPNServerRoutePatch struct +type VPNServerRoutePatch struct { + // The name for this VPN server route. The name must not be used by another route for the VPN server. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVPNServerRoutePatch unmarshals an instance of VPNServerRoutePatch from the specified map of raw messages. +func UnmarshalVPNServerRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRoutePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VPNServerRoutePatch +func (vpnServerRoutePatch *VPNServerRoutePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpnServerRoutePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// VirtualNetworkInterface : VirtualNetworkInterface struct +type VirtualNetworkInterface struct { + // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on + // this interface. If `true`, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // The date and time that the virtual network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 interface. Absent when the interface is not attached to a target. + MacAddress *string `json:"mac_address,omitempty"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The reserved IP for this virtual network interface. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource group for this virtual network interface. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups for this virtual network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The target of this virtual network interface. + // + // If absent, this virtual network interface is not attached to a target. + Target VirtualNetworkInterfaceTargetIntf `json:"target,omitempty"` + + // The VPC this virtual network interface resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this virtual network interface resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the VirtualNetworkInterface.LifecycleState property. +// The lifecycle state of the virtual network interface. +const ( + VirtualNetworkInterfaceLifecycleStateDeletingConst = "deleting" + VirtualNetworkInterfaceLifecycleStateFailedConst = "failed" + VirtualNetworkInterfaceLifecycleStatePendingConst = "pending" + VirtualNetworkInterfaceLifecycleStateStableConst = "stable" + VirtualNetworkInterfaceLifecycleStateSuspendedConst = "suspended" + VirtualNetworkInterfaceLifecycleStateUpdatingConst = "updating" + VirtualNetworkInterfaceLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VirtualNetworkInterface.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +// UnmarshalVirtualNetworkInterface unmarshals an instance of VirtualNetworkInterface from the specified map of raw messages. +func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalVirtualNetworkInterfaceTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceCollection : VirtualNetworkInterfaceCollection struct +type VirtualNetworkInterfaceCollection struct { + // A link to the first page of resources. + First *VirtualNetworkInterfaceCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VirtualNetworkInterfaceCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of virtual network interfaces. + VirtualNetworkInterfaces []VirtualNetworkInterface `json:"virtual_network_interfaces" validate:"required"` +} + +// UnmarshalVirtualNetworkInterfaceCollection unmarshals an instance of VirtualNetworkInterfaceCollection from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVirtualNetworkInterfaceCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVirtualNetworkInterfaceCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interfaces", &obj.VirtualNetworkInterfaces, UnmarshalVirtualNetworkInterface) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VirtualNetworkInterfaceCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// VirtualNetworkInterfaceCollectionFirst : A link to the first page of resources. +type VirtualNetworkInterfaceCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVirtualNetworkInterfaceCollectionFirst unmarshals an instance of VirtualNetworkInterfaceCollectionFirst from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VirtualNetworkInterfaceCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVirtualNetworkInterfaceCollectionNext unmarshals an instance of VirtualNetworkInterfaceCollectionNext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPsReservedIPPrototype : VirtualNetworkInterfaceIPsReservedIPPrototype struct +// Models which "extend" this model: +// - VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +// - VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPsReservedIPPrototype 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 (*VirtualNetworkInterfaceIPsReservedIPPrototype) isaVirtualNetworkInterfaceIPsReservedIPPrototype() bool { + return true +} + +type VirtualNetworkInterfaceIPsReservedIPPrototypeIntf interface { + isaVirtualNetworkInterfaceIPsReservedIPPrototype() bool +} + +// UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototype unmarshals an instance of VirtualNetworkInterfaceIPsReservedIPPrototype from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPsReservedIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePatch : VirtualNetworkInterfacePatch struct +type VirtualNetworkInterfacePatch struct { + // Indicates whether source IP spoofing is allowed on this interface. 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 network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // region. Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVirtualNetworkInterfacePatch unmarshals an instance of VirtualNetworkInterfacePatch from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VirtualNetworkInterfacePatch +func (virtualNetworkInterfacePatch *VirtualNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(virtualNetworkInterfacePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// VirtualNetworkInterfacePrimaryIPReservedIPPrototype : VirtualNetworkInterfacePrimaryIPReservedIPPrototype struct +// Models which "extend" this model: +// - VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext +// - VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext +type VirtualNetworkInterfacePrimaryIPReservedIPPrototype 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 (*VirtualNetworkInterfacePrimaryIPReservedIPPrototype) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototype() bool { + return true +} + +type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf interface { + isaVirtualNetworkInterfacePrimaryIPReservedIPPrototype() bool +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototype unmarshals an instance of VirtualNetworkInterfacePrimaryIPReservedIPPrototype from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPReservedIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeAttachmentContext : A virtual network interface for the network attachment. This can be specified using an existing virtual network +// interface, or a prototype object for a new virtual network interface. +// Models which "extend" this model: +// - VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext +// - VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeAttachmentContext 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 network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 + // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // same subnet as the primary IP. + // + // 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 []VirtualNetworkInterfaceIPsReservedIPPrototypeIntf `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 VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup VirtualNetworkInterfacePrototypeTargetContextResourceGroupIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP and + // `primary_ip.address` is not specified. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` + + // 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 (*VirtualNetworkInterfacePrototypeAttachmentContext) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { + return true +} + +type VirtualNetworkInterfacePrototypeAttachmentContextIntf interface { + isaVirtualNetworkInterfacePrototypeAttachmentContext() bool +} + +// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeAttachmentContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalVirtualNetworkInterfacePrototypeTargetContextResourceGroup) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup : The resource group to use. If unspecified, the account's [default resource +// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. +// Models which "extend" this model: +// - VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID +type VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup struct { + // The unique identifier for this resource group. + ID *string `json:"id,omitempty"` +} + +func (*VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup) isaVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup() bool { + return true +} + +type VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupIntf interface { + isaVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup() bool +} + +// UnmarshalVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup unmarshals an instance of VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeResourceGroup : The resource group to use. If unspecified, the account's [default resource +// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. +// Models which "extend" this model: +// - VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID +type VirtualNetworkInterfacePrototypeResourceGroup struct { + // The unique identifier for this resource group. + ID *string `json:"id,omitempty"` +} + +func (*VirtualNetworkInterfacePrototypeResourceGroup) isaVirtualNetworkInterfacePrototypeResourceGroup() bool { + return true +} + +type VirtualNetworkInterfacePrototypeResourceGroupIntf interface { + isaVirtualNetworkInterfacePrototypeResourceGroup() bool +} + +// UnmarshalVirtualNetworkInterfacePrototypeResourceGroup unmarshals an instance of VirtualNetworkInterfacePrototypeResourceGroup from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeResourceGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeResourceGroup) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeShareMountTargetContext : VirtualNetworkInterfacePrototypeShareMountTargetContext struct +// Models which "extend" this model: +// - VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext +// - VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeShareMountTargetContext 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 network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 + // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // same subnet as the primary IP. + // + // 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 []VirtualNetworkInterfaceIPsReservedIPPrototypeIntf `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 VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP and + // `primary_ip.address` is not specified. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` + + // 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 (*VirtualNetworkInterfacePrototypeShareMountTargetContext) isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool { + return true +} + +type VirtualNetworkInterfacePrototypeShareMountTargetContextIntf interface { + isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool +} + +// UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContext unmarshals an instance of VirtualNetworkInterfacePrototypeShareMountTargetContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeShareMountTargetContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeTargetContextResourceGroup : The resource group to use. If unspecified, the account's [default resource +// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. +// Models which "extend" this model: +// - VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID +type VirtualNetworkInterfacePrototypeTargetContextResourceGroup struct { + // The unique identifier for this resource group. + ID *string `json:"id,omitempty"` +} + +func (*VirtualNetworkInterfacePrototypeTargetContextResourceGroup) isaVirtualNetworkInterfacePrototypeTargetContextResourceGroup() bool { + return true +} + +type VirtualNetworkInterfacePrototypeTargetContextResourceGroupIntf interface { + isaVirtualNetworkInterfacePrototypeTargetContextResourceGroup() bool +} + +// UnmarshalVirtualNetworkInterfacePrototypeTargetContextResourceGroup unmarshals an instance of VirtualNetworkInterfacePrototypeTargetContextResourceGroup from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeTargetContextResourceGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeTargetContextResourceGroup) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceReferenceAttachmentContext : VirtualNetworkInterfaceReferenceAttachmentContext struct +type VirtualNetworkInterfaceReferenceAttachmentContext struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VirtualNetworkInterfaceReferenceAttachmentContextDeleted `json:"deleted,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VirtualNetworkInterfaceReferenceAttachmentContext.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceReferenceAttachmentContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +// UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext unmarshals an instance of VirtualNetworkInterfaceReferenceAttachmentContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceReferenceAttachmentContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceReferenceAttachmentContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VirtualNetworkInterfaceReferenceAttachmentContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceAttachmentContextDeleted from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceReferenceAttachmentContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VirtualNetworkInterfaceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVirtualNetworkInterfaceReferenceDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceDeleted from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceTarget : A virtual network interface target. +// +// The resource types that can be virtual network interface targets are expected to expand in the future. When iterating +// over virtual network interface targets, do not assume that every target resource will be from a known set of resource +// types. Optionally halt processing and surface an error, or bypass resources of unrecognized types. +// Models which "extend" this model: +// - VirtualNetworkInterfaceTargetShareMountTargetReference +// - VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext +// - VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext +type VirtualNetworkInterfaceTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this share mount target. + Href *string `json:"href,omitempty"` + + // The unique identifier for this share mount target. + ID *string `json:"id,omitempty"` + + // The name for this share mount target. The name is unique across all mount targets for the file share. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the VirtualNetworkInterfaceTarget.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceTargetResourceTypeShareMountTargetConst = "share_mount_target" +) + +func (*VirtualNetworkInterfaceTarget) isaVirtualNetworkInterfaceTarget() bool { + return true +} + +type VirtualNetworkInterfaceTargetIntf interface { + isaVirtualNetworkInterfaceTarget() bool +} + +// UnmarshalVirtualNetworkInterfaceTarget unmarshals an instance of VirtualNetworkInterfaceTarget from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Volume : Volume struct +type Volume struct { + // Indicates whether a running virtual server instance has an attachment to this volume. + Active *bool `json:"active" validate:"required"` + + // The attachment state of the volume + // - `unattached`: Not attached to any virtual server instances + // - `attached`: Attached to a virtual server instance (even if the instance is stopped) + // - `unusable`: Not able to be attached to any virtual server instances. + AttachmentState *string `json:"attachment_state" validate:"required"` + + // The maximum bandwidth (in megabits per second) for the volume. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // Indicates whether this volume is performing an operation that must be serialized. This must be `false` to perform an + // operation that is specified to require serialization. + Busy *bool `json:"busy" validate:"required"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity" validate:"required"` + + // The date and time that the volume was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // The type of encryption used on the volume. + Encryption *string `json:"encryption" validate:"required"` + + // The root key used to wrap the data encryption key for the volume. + // + // This property will be present for volumes with an `encryption` type of + // `user_managed`. + EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + + // The reasons for the current `health_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VolumeHealthReason `json:"health_reasons" validate:"required"` + + // The health of this resource. + // - `ok`: No abnormal behavior detected + // - `degraded`: Experiencing compromised performance, capacity, or connectivity + // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated + // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a + // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also + // have this state. + HealthState *string `json:"health_state" validate:"required"` + + // The URL for this volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The maximum I/O operations per second (IOPS) for this volume. + Iops *int64 `json:"iops" validate:"required"` + + // The name for this volume. The name is unique across all volumes in the region. + Name *string `json:"name" validate:"required"` + + // The operating system associated with this volume. If absent, this volume was not + // created from an image, or the image did not include an operating system. + OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) for + // this volume. + Profile *VolumeProfileReference `json:"profile" validate:"required"` + + // The resource group for this volume. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The image from which this volume was created (this may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + // If absent, this volume was not created from an image. + SourceImage *ImageReference `json:"source_image,omitempty"` + + // The snapshot from which this volume was cloned. + SourceSnapshot *SnapshotReference `json:"source_snapshot,omitempty"` + + // The status of the volume. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected + // property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VolumeStatusReason `json:"status_reasons" validate:"required"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags" validate:"required"` + + // The volume attachments for this volume. + VolumeAttachments []VolumeAttachmentReferenceVolumeContext `json:"volume_attachments" validate:"required"` + + // The zone this volume resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Volume.AttachmentState property. +// The attachment state of the volume +// - `unattached`: Not attached to any virtual server instances +// - `attached`: Attached to a virtual server instance (even if the instance is stopped) +// - `unusable`: Not able to be attached to any virtual server instances. +const ( + VolumeAttachmentStateAttachedConst = "attached" + VolumeAttachmentStateUnattachedConst = "unattached" + VolumeAttachmentStateUnusableConst = "unusable" +) + +// Constants associated with the Volume.Encryption property. +// The type of encryption used on the volume. +const ( + VolumeEncryptionProviderManagedConst = "provider_managed" + VolumeEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Volume.HealthState property. +// The health of this resource. +// - `ok`: No abnormal behavior detected +// - `degraded`: Experiencing compromised performance, capacity, or connectivity +// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated +// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle +// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this +// state. +const ( + VolumeHealthStateDegradedConst = "degraded" + VolumeHealthStateFaultedConst = "faulted" + VolumeHealthStateInapplicableConst = "inapplicable" + VolumeHealthStateOkConst = "ok" +) + +// Constants associated with the Volume.ResourceType property. +// The resource type. +const ( + VolumeResourceTypeVolumeConst = "volume" +) + +// Constants associated with the Volume.Status property. +// The status of the volume. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected +// property value was encountered. +const ( + VolumeStatusAvailableConst = "available" + VolumeStatusFailedConst = "failed" + VolumeStatusPendingConst = "pending" + VolumeStatusPendingDeletionConst = "pending_deletion" + VolumeStatusUnusableConst = "unusable" + VolumeStatusUpdatingConst = "updating" +) + +// UnmarshalVolume unmarshals an instance of Volume from the specified map of raw messages. +func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Volume) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "attachment_state", &obj.AttachmentState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "busy", &obj.Busy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVolumeHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVolumeStatusReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachment : VolumeAttachment struct +type VolumeAttachment struct { + // The maximum bandwidth (in megabits per second) for the volume when attached to this instance. This may be lower than + // the volume bandwidth depending on the configuration of the instance. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // The date and time that the volume was attached. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete" validate:"required"` + + // Information about how the volume is exposed to the instance operating system. + // + // This property may be absent if the volume attachment's `status` is not `attached`. + Device *VolumeAttachmentDevice `json:"device,omitempty"` + + // The URL for this volume attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume attachment. + ID *string `json:"id" validate:"required"` + + // The name for this volume attachment. The name is unique across all volume attachments on the instance. + Name *string `json:"name" validate:"required"` + + // The status of this volume attachment. + Status *string `json:"status" validate:"required"` + + // The type of volume attachment. + Type *string `json:"type" validate:"required"` + + // The attached volume. + // + // This property will be absent if the volume has not yet been provisioned. + Volume *VolumeReferenceVolumeAttachmentContext `json:"volume,omitempty"` +} + +// Constants associated with the VolumeAttachment.Status property. +// The status of this volume attachment. +const ( + VolumeAttachmentStatusAttachedConst = "attached" + VolumeAttachmentStatusAttachingConst = "attaching" + VolumeAttachmentStatusDeletingConst = "deleting" + VolumeAttachmentStatusDetachingConst = "detaching" +) + +// Constants associated with the VolumeAttachment.Type property. +// The type of volume attachment. +const ( + VolumeAttachmentTypeBootConst = "boot" + VolumeAttachmentTypeDataConst = "data" +) + +// UnmarshalVolumeAttachment unmarshals an instance of VolumeAttachment from the specified map of raw messages. +func UnmarshalVolumeAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachment) + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentCollection : VolumeAttachmentCollection struct +type VolumeAttachmentCollection struct { + // Collection of volume attachments. + VolumeAttachments []VolumeAttachment `json:"volume_attachments" validate:"required"` +} + +// UnmarshalVolumeAttachmentCollection unmarshals an instance of VolumeAttachmentCollection from the specified map of raw messages. +func UnmarshalVolumeAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentCollection) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachment) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentDevice : VolumeAttachmentDevice struct +type VolumeAttachmentDevice struct { + // A unique identifier for the device which is exposed to the instance operating system. + ID *string `json:"id,omitempty"` +} + +// UnmarshalVolumeAttachmentDevice unmarshals an instance of VolumeAttachmentDevice from the specified map of raw messages. +func UnmarshalVolumeAttachmentDevice(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentDevice) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPatch : VolumeAttachmentPatch struct +type VolumeAttachmentPatch struct { + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVolumeAttachmentPatch unmarshals an instance of VolumeAttachmentPatch from the specified map of raw messages. +func UnmarshalVolumeAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPatch) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VolumeAttachmentPatch +func (volumeAttachmentPatch *VolumeAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(volumeAttachmentPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// VolumeAttachmentPrototype : VolumeAttachmentPrototype struct +type VolumeAttachmentPrototype struct { + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // An existing volume to attach to the instance, or a prototype object for a new volume. + Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototype : Instantiate VolumeAttachmentPrototype (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototype(volume VolumeAttachmentPrototypeVolumeIntf) (_model *VolumeAttachmentPrototype, err error) { + _model = &VolumeAttachmentPrototype{ + Volume: volume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototype unmarshals an instance of VolumeAttachmentPrototype from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototype) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeAttachmentPrototypeVolume) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeInstanceByImageContext : VolumeAttachmentPrototypeInstanceByImageContext struct +type VolumeAttachmentPrototypeInstanceByImageContext struct { + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // A prototype object for a new volume. + Volume *VolumePrototypeInstanceByImageContext `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototypeInstanceByImageContext : Instantiate VolumeAttachmentPrototypeInstanceByImageContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByImageContext(volume *VolumePrototypeInstanceByImageContext) (_model *VolumeAttachmentPrototypeInstanceByImageContext, err error) { + _model = &VolumeAttachmentPrototypeInstanceByImageContext{ + Volume: volume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototypeInstanceByImageContext unmarshals an instance of VolumeAttachmentPrototypeInstanceByImageContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceByImageContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceByImageContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeInstanceBySourceSnapshotContext : VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct +type VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct { + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // A prototype object for a new volume from a snapshot. + Volume *VolumePrototypeInstanceBySourceSnapshotContext `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext : Instantiate VolumeAttachmentPrototypeInstanceBySourceSnapshotContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(volume *VolumePrototypeInstanceBySourceSnapshotContext) (_model *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, err error) { + _model = &VolumeAttachmentPrototypeInstanceBySourceSnapshotContext{ + Volume: volume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext unmarshals an instance of VolumeAttachmentPrototypeInstanceBySourceSnapshotContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeInstanceByVolumeContext : VolumeAttachmentPrototypeInstanceByVolumeContext struct +type VolumeAttachmentPrototypeInstanceByVolumeContext struct { + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // An existing volume to attach. + Volume VolumeIdentityIntf `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototypeInstanceByVolumeContext : Instantiate VolumeAttachmentPrototypeInstanceByVolumeContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByVolumeContext(volume VolumeIdentityIntf) (_model *VolumeAttachmentPrototypeInstanceByVolumeContext, err error) { + _model = &VolumeAttachmentPrototypeInstanceByVolumeContext{ + Volume: volume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext unmarshals an instance of VolumeAttachmentPrototypeInstanceByVolumeContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceByVolumeContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolume : An existing volume to attach to the instance, or a prototype object for a new volume. +// Models which "extend" this model: +// - VolumeAttachmentPrototypeVolumeVolumeIdentity +// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext +type VolumeAttachmentPrototypeVolume struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group to use for this volume. If unspecified, the instance's resource group + // will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` +} + +func (*VolumeAttachmentPrototypeVolume) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +type VolumeAttachmentPrototypeVolumeIntf interface { + isaVolumeAttachmentPrototypeVolume() bool +} + +// UnmarshalVolumeAttachmentPrototypeVolume unmarshals an instance of VolumeAttachmentPrototypeVolume from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolume) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceInstanceContext : VolumeAttachmentReferenceInstanceContext struct +type VolumeAttachmentReferenceInstanceContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeAttachmentReferenceInstanceContextDeleted `json:"deleted,omitempty"` + + // Information about how the volume is exposed to the instance operating system. + // + // This property may be absent if the volume attachment's `status` is not `attached`. + Device *VolumeAttachmentDevice `json:"device,omitempty"` + + // The URL for this volume attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume attachment. + ID *string `json:"id" validate:"required"` + + // The name for this volume attachment. The name is unique across all volume attachments on the instance. + Name *string `json:"name" validate:"required"` + + // The attached volume. + // + // This property will be absent if the volume has not yet been provisioned. + Volume *VolumeReferenceVolumeAttachmentContext `json:"volume,omitempty"` +} + +// UnmarshalVolumeAttachmentReferenceInstanceContext unmarshals an instance of VolumeAttachmentReferenceInstanceContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceInstanceContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceInstanceContextDeleted) + if err != nil { + return + } + err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceInstanceContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VolumeAttachmentReferenceInstanceContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeAttachmentReferenceInstanceContextDeleted unmarshals an instance of VolumeAttachmentReferenceInstanceContextDeleted from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceInstanceContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceInstanceContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceVolumeContext : VolumeAttachmentReferenceVolumeContext struct +type VolumeAttachmentReferenceVolumeContext struct { + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeAttachmentReferenceVolumeContextDeleted `json:"deleted,omitempty"` + + // Information about how the volume is exposed to the instance operating system. + // + // This property may be absent if the volume attachment's `status` is not `attached`. + Device *VolumeAttachmentDevice `json:"device,omitempty"` + + // The URL for this volume attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume attachment. + ID *string `json:"id" validate:"required"` + + // The attached instance. + Instance *InstanceReference `json:"instance" validate:"required"` + + // The name for this volume attachment. The name is unique across all volume attachments on the instance. + Name *string `json:"name" validate:"required"` + + // The type of volume attachment. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VolumeAttachmentReferenceVolumeContext.Type property. +// The type of volume attachment. +const ( + VolumeAttachmentReferenceVolumeContextTypeBootConst = "boot" + VolumeAttachmentReferenceVolumeContextTypeDataConst = "data" +) + +// UnmarshalVolumeAttachmentReferenceVolumeContext unmarshals an instance of VolumeAttachmentReferenceVolumeContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceVolumeContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceVolumeContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceVolumeContextDeleted) + if err != nil { + return + } + err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceVolumeContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VolumeAttachmentReferenceVolumeContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeAttachmentReferenceVolumeContextDeleted unmarshals an instance of VolumeAttachmentReferenceVolumeContextDeleted from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceVolumeContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceVolumeContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeCollection : VolumeCollection struct +type VolumeCollection struct { + // A link to the first page of resources. + First *VolumeCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VolumeCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of volumes. + Volumes []Volume `json:"volumes" validate:"required"` +} + +// UnmarshalVolumeCollection unmarshals an instance of VolumeCollection from the specified map of raw messages. +func UnmarshalVolumeCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVolumeCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVolumeCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volumes", &obj.Volumes, UnmarshalVolume) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VolumeCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// VolumeCollectionFirst : A link to the first page of resources. +type VolumeCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVolumeCollectionFirst unmarshals an instance of VolumeCollectionFirst from the specified map of raw messages. +func UnmarshalVolumeCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VolumeCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVolumeCollectionNext unmarshals an instance of VolumeCollectionNext from the specified map of raw messages. +func UnmarshalVolumeCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeHealthReason : VolumeHealthReason struct +type VolumeHealthReason struct { + // A snake case string succinctly identifying the reason for this health state. + Code *string `json:"code" validate:"required"` + + // An explanation of the reason for this health state. + Message *string `json:"message" validate:"required"` + + // Link to documentation about the reason for this health state. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the VolumeHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VolumeHealthReasonCodeInitializingFromSnapshotConst = "initializing_from_snapshot" +) + +// UnmarshalVolumeHealthReason unmarshals an instance of VolumeHealthReason from the specified map of raw messages. +func UnmarshalVolumeHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentity : Identifies a volume by a unique property. +// Models which "extend" this model: +// - VolumeIdentityByID +// - VolumeIdentityByCRN +// - VolumeIdentityByHref +type VolumeIdentity struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` +} + +func (*VolumeIdentity) isaVolumeIdentity() bool { + return true +} + +type VolumeIdentityIntf interface { + isaVolumeIdentity() bool +} + +// UnmarshalVolumeIdentity unmarshals an instance of VolumeIdentity from the specified map of raw messages. +func UnmarshalVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePatch : VolumePatch struct +type VolumePatch struct { + // The capacity to use for the volume (in gigabytes). The volume must be attached to a running virtual server instance, + // and the specified value must not be less than the current capacity. Additionally, if the volume is attached as a + // boot volume, the maximum value is 250 gigabytes. + // + // The minimum and maximum capacity limits for creating or updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. The volume must be attached as a data volume to a running virtual server instance. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. The requested profile must be in the same + // `family` as the current profile. The volume must be attached as a data volume to + // a running virtual server instance, and must have a `capacity` within the range + // supported by the specified profile. + Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` +} + +// UnmarshalVolumePatch unmarshals an instance of VolumePatch from the specified map of raw messages. +func UnmarshalVolumePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePatch) + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VolumePatch +func (volumePatch *VolumePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(volumePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// VolumeProfile : VolumeProfile struct +type VolumeProfile struct { + // The product family this volume profile belongs to. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the volume profile on which the + // unexpected property value was encountered. + Family *string `json:"family" validate:"required"` + + // The URL for this volume profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this volume profile. + Name *string `json:"name" validate:"required"` +} + +// Constants associated with the VolumeProfile.Family property. +// The product family this volume profile belongs to. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the volume profile on which the +// unexpected property value was encountered. +const ( + VolumeProfileFamilyCustomConst = "custom" + VolumeProfileFamilyTieredConst = "tiered" +) + +// UnmarshalVolumeProfile unmarshals an instance of VolumeProfile from the specified map of raw messages. +func UnmarshalVolumeProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfile) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileCollection : VolumeProfileCollection struct +type VolumeProfileCollection struct { + // A link to the first page of resources. + First *VolumeProfileCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VolumeProfileCollectionNext `json:"next,omitempty"` + + // Collection of volume profiles. + Profiles []VolumeProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalVolumeProfileCollection unmarshals an instance of VolumeProfileCollection from the specified map of raw messages. +func UnmarshalVolumeProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVolumeProfileCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVolumeProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalVolumeProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VolumeProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// VolumeProfileCollectionFirst : A link to the first page of resources. +type VolumeProfileCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVolumeProfileCollectionFirst unmarshals an instance of VolumeProfileCollectionFirst from the specified map of raw messages. +func UnmarshalVolumeProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VolumeProfileCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVolumeProfileCollectionNext unmarshals an instance of VolumeProfileCollectionNext from the specified map of raw messages. +func UnmarshalVolumeProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileIdentity : Identifies a volume profile by a unique property. +// Models which "extend" this model: +// - VolumeProfileIdentityByName +// - VolumeProfileIdentityByHref +type VolumeProfileIdentity struct { + // The globally unique name for this volume profile. + Name *string `json:"name,omitempty"` + + // The URL for this volume profile. + Href *string `json:"href,omitempty"` +} + +func (*VolumeProfileIdentity) isaVolumeProfileIdentity() bool { + return true +} + +type VolumeProfileIdentityIntf interface { + isaVolumeProfileIdentity() bool +} + +// UnmarshalVolumeProfileIdentity unmarshals an instance of VolumeProfileIdentity from the specified map of raw messages. +func UnmarshalVolumeProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileReference : VolumeProfileReference struct +type VolumeProfileReference struct { + // The URL for this volume profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this volume profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalVolumeProfileReference unmarshals an instance of VolumeProfileReference from the specified map of raw messages. +func UnmarshalVolumeProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototype : VolumePrototype struct +// Models which "extend" this model: +// - VolumePrototypeVolumeByCapacity +// - VolumePrototypeVolumeBySourceSnapshot +type VolumePrototype struct { + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use for this volume. If unspecified, default 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 zone this volume will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` +} + +func (*VolumePrototype) isaVolumePrototype() bool { + return true +} + +type VolumePrototypeIntf interface { + isaVolumePrototype() bool +} + +// UnmarshalVolumePrototype unmarshals an instance of VolumePrototype from the specified map of raw messages. +func UnmarshalVolumePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototype) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeInstanceByImageContext : VolumePrototypeInstanceByImageContext struct +type VolumePrototypeInstanceByImageContext struct { + // The capacity to use for the volume (in gigabytes). Must be at least the image's + // `minimum_provisioned_size`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the image's `minimum_provisioned_size`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use for this volume. If unspecified, the instance's resource group + // will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` +} + +// NewVolumePrototypeInstanceByImageContext : Instantiate VolumePrototypeInstanceByImageContext (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeInstanceByImageContext(profile VolumeProfileIdentityIntf) (_model *VolumePrototypeInstanceByImageContext, err error) { + _model = &VolumePrototypeInstanceByImageContext{ + Profile: profile, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumePrototypeInstanceByImageContext unmarshals an instance of VolumePrototypeInstanceByImageContext from the specified map of raw messages. +func UnmarshalVolumePrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeInstanceByImageContext) + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeInstanceBySourceSnapshotContext : VolumePrototypeInstanceBySourceSnapshotContext struct +type VolumePrototypeInstanceBySourceSnapshotContext struct { + // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's + // `minimum_capacity`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use for this volume. If unspecified, the instance's resource group + // will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` +} + +// NewVolumePrototypeInstanceBySourceSnapshotContext : Instantiate VolumePrototypeInstanceBySourceSnapshotContext (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeInstanceBySourceSnapshotContext(profile VolumeProfileIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumePrototypeInstanceBySourceSnapshotContext, err error) { + _model = &VolumePrototypeInstanceBySourceSnapshotContext{ + Profile: profile, + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumePrototypeInstanceBySourceSnapshotContext unmarshals an instance of VolumePrototypeInstanceBySourceSnapshotContext from the specified map of raw messages. +func UnmarshalVolumePrototypeInstanceBySourceSnapshotContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeReference : VolumeReference struct +type VolumeReference struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The name for this volume. The name is unique across all volumes in the region. + Name *string `json:"name" validate:"required"` + + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *VolumeRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VolumeReference.ResourceType property. +// The resource type. +const ( + VolumeReferenceResourceTypeVolumeConst = "volume" +) + +// UnmarshalVolumeReference unmarshals an instance of VolumeReference from the specified map of raw messages. +func UnmarshalVolumeReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VolumeReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeReferenceDeleted unmarshals an instance of VolumeReferenceDeleted from the specified map of raw messages. +func UnmarshalVolumeReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeReferenceVolumeAttachmentContext : VolumeReferenceVolumeAttachmentContext struct +type VolumeReferenceVolumeAttachmentContext struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeReferenceVolumeAttachmentContextDeleted `json:"deleted,omitempty"` + + // The URL for this volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The name for this volume. The name is unique across all volumes in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VolumeReferenceVolumeAttachmentContext.ResourceType property. +// The resource type. +const ( + VolumeReferenceVolumeAttachmentContextResourceTypeVolumeConst = "volume" +) + +// UnmarshalVolumeReferenceVolumeAttachmentContext unmarshals an instance of VolumeReferenceVolumeAttachmentContext from the specified map of raw messages. +func UnmarshalVolumeReferenceVolumeAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReferenceVolumeAttachmentContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceVolumeAttachmentContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeReferenceVolumeAttachmentContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VolumeReferenceVolumeAttachmentContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeReferenceVolumeAttachmentContextDeleted unmarshals an instance of VolumeReferenceVolumeAttachmentContextDeleted from the specified map of raw messages. +func UnmarshalVolumeReferenceVolumeAttachmentContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReferenceVolumeAttachmentContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type VolumeRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalVolumeRemote unmarshals an instance of VolumeRemote from the specified map of raw messages. +func UnmarshalVolumeRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeRemote) + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeStatusReason : VolumeStatusReason struct +type VolumeStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` + + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the VolumeStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + VolumeStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" +) + +// UnmarshalVolumeStatusReason unmarshals an instance of VolumeStatusReason from the specified map of raw messages. +func UnmarshalVolumeStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Zone : Zone struct +type Zone struct { + // The URL for this zone. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this zone. + Name *string `json:"name" validate:"required"` + + // The region this zone resides in. + Region *RegionReference `json:"region" validate:"required"` + + // The availability status of this zone. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the Zone.Status property. +// The availability status of this zone. +const ( + ZoneStatusAvailableConst = "available" + ZoneStatusImpairedConst = "impaired" + ZoneStatusUnavailableConst = "unavailable" +) + +// UnmarshalZone unmarshals an instance of Zone from the specified map of raw messages. +func UnmarshalZone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Zone) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneCollection : ZoneCollection struct +type ZoneCollection struct { + // Collection of zones. + Zones []Zone `json:"zones" validate:"required"` +} + +// UnmarshalZoneCollection unmarshals an instance of ZoneCollection from the specified map of raw messages. +func UnmarshalZoneCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneCollection) + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZone) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneIdentity : Identifies a zone by a unique property. +// Models which "extend" this model: +// - ZoneIdentityByName +// - ZoneIdentityByHref +type ZoneIdentity struct { + // The globally unique name for this zone. + Name *string `json:"name,omitempty"` + + // The URL for this zone. + Href *string `json:"href,omitempty"` +} + +func (*ZoneIdentity) isaZoneIdentity() bool { + return true +} + +type ZoneIdentityIntf interface { + isaZoneIdentity() bool +} + +// UnmarshalZoneIdentity unmarshals an instance of ZoneIdentity from the specified map of raw messages. +func UnmarshalZoneIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneReference : ZoneReference struct +type ZoneReference struct { + // The URL for this zone. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this zone. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalZoneReference unmarshals an instance of ZoneReference from the specified map of raw messages. +func UnmarshalZoneReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyJobSourceVolumeReference : BackupPolicyJobSourceVolumeReference struct +// This model "extends" BackupPolicyJobSource +type BackupPolicyJobSourceVolumeReference struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The name for this volume. The name is unique across all volumes in the region. + Name *string `json:"name" validate:"required"` + + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *VolumeRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyJobSourceVolumeReference.ResourceType property. +// The resource type. +const ( + BackupPolicyJobSourceVolumeReferenceResourceTypeVolumeConst = "volume" +) + +func (*BackupPolicyJobSourceVolumeReference) isaBackupPolicyJobSource() bool { + return true +} + +// UnmarshalBackupPolicyJobSourceVolumeReference unmarshals an instance of BackupPolicyJobSourceVolumeReference from the specified map of raw messages. +func UnmarshalBackupPolicyJobSourceVolumeReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobSourceVolumeReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerBootTargetBareMetalServerDiskReference : BareMetalServerBootTargetBareMetalServerDiskReference struct +// This model "extends" BareMetalServerBootTarget +type BareMetalServerBootTargetBareMetalServerDiskReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this bare metal server disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server disk. + ID *string `json:"id" validate:"required"` + + // The name for this bare metal server disk. The name is unique across all disks on the bare metal server. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BareMetalServerBootTargetBareMetalServerDiskReference.ResourceType property. +// The resource type. +const ( + BareMetalServerBootTargetBareMetalServerDiskReferenceResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" +) + +func (*BareMetalServerBootTargetBareMetalServerDiskReference) isaBareMetalServerBootTarget() bool { + return true +} + +// UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference unmarshals an instance of BareMetalServerBootTargetBareMetalServerDiskReference from the specified map of raw messages. +func UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerBootTargetBareMetalServerDiskReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount : BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct +// This model "extends" BareMetalServerInitializationUserAccount +type BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct { + // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + EncryptedPassword *[]byte `json:"encrypted_password" validate:"required"` + + // The public SSH key used to encrypt the password. + EncryptionKey *KeyReference `json:"encryption_key" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The username for the account created at initialization. + Username *string `json:"username" validate:"required"` +} + +// Constants associated with the BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount.ResourceType property. +// The resource type. +const ( + BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccountResourceTypeHostUserAccountConst = "host_user_account" +) + +func (*BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) isaBareMetalServerInitializationUserAccount() bool { + return true +} + +// UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount unmarshals an instance of BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount from the specified map of raw messages. +func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) + err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentByHiperSocket : BareMetalServerNetworkAttachmentByHiperSocket struct +// This model "extends" BareMetalServerNetworkAttachment +type BareMetalServerNetworkAttachmentByHiperSocket struct { + // The date and time that the network attachment was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network attachment. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + Name *string `json:"name" validate:"required"` + + // The port speed for this network attachment in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IP address of the virtual network interface for the 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 network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // This bare metal server network attachment's interface type. + Type *string `json:"type" validate:"required"` + + // The virtual network interface for this network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" 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 BareMetalServerNetworkAttachmentByHiperSocket.LifecycleState property. +// The lifecycle state of the network attachment. +const ( + BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateDeletingConst = "deleting" + BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateFailedConst = "failed" + BareMetalServerNetworkAttachmentByHiperSocketLifecycleStatePendingConst = "pending" + BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateStableConst = "stable" + BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateSuspendedConst = "suspended" + BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateUpdatingConst = "updating" + BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BareMetalServerNetworkAttachmentByHiperSocket.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkAttachmentByHiperSocketResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" +) + +// Constants associated with the BareMetalServerNetworkAttachmentByHiperSocket.Type property. +// This bare metal server network attachment's interface type. +const ( + BareMetalServerNetworkAttachmentByHiperSocketTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentByHiperSocketTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkAttachmentByHiperSocket.InterfaceType property. +// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// within a `s390x` based system. +const ( + BareMetalServerNetworkAttachmentByHiperSocketInterfaceTypeHipersocketConst = "hipersocket" +) + +func (*BareMetalServerNetworkAttachmentByHiperSocket) isaBareMetalServerNetworkAttachment() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentByHiperSocket unmarshals an instance of BareMetalServerNetworkAttachmentByHiperSocket from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentByHiperSocket(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentByHiperSocket) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentByPci : BareMetalServerNetworkAttachmentByPci struct +// This model "extends" BareMetalServerNetworkAttachment +type BareMetalServerNetworkAttachmentByPci struct { + // The date and time that the network attachment was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network attachment. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + Name *string `json:"name" validate:"required"` + + // The port speed for this network attachment in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IP address of the virtual network interface for the 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 network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // This bare metal server network attachment's interface type. + Type *string `json:"type" validate:"required"` + + // The virtual network interface for this network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` + + 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 VLAN tag. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkAttachmentByPci.LifecycleState property. +// The lifecycle state of the 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. +// This bare metal server network attachment's interface type. +const ( + BareMetalServerNetworkAttachmentByPciTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentByPciTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkAttachmentByPci.InterfaceType property. +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI attachment +// - Cannot directly use an IEEE 802.1q VLAN tag. +const ( + BareMetalServerNetworkAttachmentByPciInterfaceTypePciConst = "pci" +) + +func (*BareMetalServerNetworkAttachmentByPci) isaBareMetalServerNetworkAttachment() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentByPci unmarshals an instance of BareMetalServerNetworkAttachmentByPci from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentByPci(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentByPci) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentByVlan : BareMetalServerNetworkAttachmentByVlan struct +// This model "extends" BareMetalServerNetworkAttachment +type BareMetalServerNetworkAttachmentByVlan struct { + // The date and time that the network attachment was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network attachment. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + Name *string `json:"name" validate:"required"` + + // The port speed for this network attachment in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IP address of the virtual network interface for the 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 network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // This bare metal server network attachment's interface type. + Type *string `json:"type" validate:"required"` + + // The virtual network interface for this network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` + + // Indicates if the network attachment can automatically float to any other server within the same `resource_group`. + // The network attachment will float automatically if the network detects a GARP or RARP on another bare metal server + // in the resource group. Applies only to network attachments with `vlan` interface type. + 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"` + + // Indicates the 802.1Q VLAN ID tag 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 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. +// This bare metal server network attachment's interface type. +const ( + BareMetalServerNetworkAttachmentByVlanTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentByVlanTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkAttachmentByVlan.InterfaceType property. +// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array +// of `allowed_vlans`. +// - Must use an IEEE 802.1q tag. +const ( + BareMetalServerNetworkAttachmentByVlanInterfaceTypeVlanConst = "vlan" +) + +func (*BareMetalServerNetworkAttachmentByVlan) isaBareMetalServerNetworkAttachment() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentByVlan unmarshals an instance of BareMetalServerNetworkAttachmentByVlan from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentByVlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentByVlan) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype struct +// This model "extends" BareMetalServerNetworkAttachmentPrototype +type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype struct { + // The name for this 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 VirtualNetworkInterfacePrototypeAttachmentContextIntf `json:"virtual_network_interface" 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 BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype.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 ( + BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototypeInterfaceTypeHipersocketConst = "hipersocket" +) + +// NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct +// This model "extends" BareMetalServerNetworkAttachmentPrototype +type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct { + // The name for this 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 VirtualNetworkInterfacePrototypeAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) 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 VLAN tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the 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 VLAN 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 VirtualNetworkInterfacePrototypeAttachmentContextIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct +// This model "extends" BareMetalServerNetworkAttachmentPrototype +type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct { + // The name for this 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 VirtualNetworkInterfacePrototypeAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + + // Indicates if the network attachment can automatically float to any other server within the same `resource_group`. + // The network attachment will float automatically if the network detects a GARP or RARP on another bare metal server + // in the resource group. Applies only to network attachments with `vlan` interface type. + 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. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` + + // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this 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. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototypeInterfaceTypeVlanConst = "vlan" +) + +// NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + InterfaceType: core.StringPtr(interfaceType), + Vlan: core.Int64Ptr(vlan), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceByHiperSocket : BareMetalServerNetworkInterfaceByHiperSocket struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByHiperSocket struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // The date and time that the network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The floating IPs associated with this network interface. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The MAC address of the interface. If absent, the value is not known. + MacAddress *string `json:"mac_address" validate:"required"` + + // The name for this network interface. + Name *string `json:"name" validate:"required"` + + // The network interface port speed in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups targeting this network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the network interface. + Status *string `json:"status" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The type of this bare metal server network interface. + Type *string `json:"type" validate:"required"` + + // - `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 network interface. +const ( + BareMetalServerNetworkInterfaceByHiperSocketStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByHiperSocketStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByHiperSocketStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByHiperSocketStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Type property. +// The type of this bare metal server network interface. +const ( + BareMetalServerNetworkInterfaceByHiperSocketTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByHiperSocketTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.InterfaceType property. +// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// within a `s390x` based system. +const ( + BareMetalServerNetworkInterfaceByHiperSocketInterfaceTypeHipersocketConst = "hipersocket" +) + +func (*BareMetalServerNetworkInterfaceByHiperSocket) isaBareMetalServerNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfaceByHiperSocket unmarshals an instance of BareMetalServerNetworkInterfaceByHiperSocket from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByHiperSocket) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceByPci : BareMetalServerNetworkInterfaceByPci struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByPci struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // The date and time that the network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The floating IPs associated with this network interface. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The MAC address of the interface. If absent, the value is not known. + MacAddress *string `json:"mac_address" validate:"required"` + + // The name for this network interface. + Name *string `json:"name" validate:"required"` + + // The network interface port speed in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups targeting this network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the network interface. + Status *string `json:"status" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The type of this bare metal server network interface. + Type *string `json:"type" validate:"required"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` + + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI interface + // - Cannot directly use an IEEE 802.1q VLAN tag. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByPciResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.Status property. +// The status of the network interface. +const ( + BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByPciStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByPciStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.Type property. +// The type of this bare metal server network interface. +const ( + BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.InterfaceType property. +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI interface +// - Cannot directly use an IEEE 802.1q VLAN tag. +const ( + BareMetalServerNetworkInterfaceByPciInterfaceTypePciConst = "pci" +) + +func (*BareMetalServerNetworkInterfaceByPci) isaBareMetalServerNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfaceByPci unmarshals an instance of BareMetalServerNetworkInterfaceByPci from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByPci) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceByVlan : BareMetalServerNetworkInterfaceByVlan struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByVlan struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // The date and time that the network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The floating IPs associated with this network interface. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The MAC address of the interface. If absent, the value is not known. + MacAddress *string `json:"mac_address" validate:"required"` + + // The name for this network interface. + Name *string `json:"name" validate:"required"` + + // The network interface port speed in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups targeting this network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the network interface. + Status *string `json:"status" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The type of this bare metal server network interface. + Type *string `json:"type" validate:"required"` + + // Indicates if the interface can float to any other server within the same + // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal + // server in the resource group. Applies only to `vlan` type interfaces. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float" validate:"required"` + + // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array + // of `allowed_vlans`. + // - Must use an IEEE 802.1q tag. + // - Has its own security groups and does not inherit those of the PCI device through + // which traffic flows. + InterfaceType *string `json:"interface_type" validate:"required"` + + // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + Vlan *int64 `json:"vlan" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByVlanResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Status property. +// The status of the network interface. +const ( + BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByVlanStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByVlanStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Type property. +// The type of this bare metal server network interface. +const ( + BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.InterfaceType property. +// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array +// of `allowed_vlans`. +// - Must use an IEEE 802.1q tag. +// - Has its own security groups and does not inherit those of the PCI device through +// which traffic flows. +const ( + BareMetalServerNetworkInterfaceByVlanInterfaceTypeVlanConst = "vlan" +) + +func (*BareMetalServerNetworkInterfaceByVlan) isaBareMetalServerNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfaceByVlan unmarshals an instance of BareMetalServerNetworkInterfaceByVlan from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByVlan) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The name for this network interface. The name must not be used by another network interface on the bare metal + // server. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the network interface. This can be specified using an existing reserved IP, or a + // prototype object for a new reserved IP. + // + // If an existing reserved IP or a prototype object with an address is specified, it must be available on the network + // interface's subnet. Otherwise, an available address on the subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity + // within a `s390x` based system. + // - Not supported on bare metal servers with a `cpu.architecture` of `amd64`. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype.InterfaceType property. +// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// within a `s390x` based system. +// - Not supported on bare metal servers with a `cpu.architecture` of `amd64`. +const ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototypeInterfaceTypeHipersocketConst = "hipersocket" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The name for this network interface. The name must not be used by another network interface on the bare metal + // server. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the network interface. This can be specified using an existing reserved IP, or a + // prototype object for a new reserved IP. + // + // If an existing reserved IP or a prototype object with an address is specified, it must be available on the network + // interface's subnet. Otherwise, an available address on the subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI interface + // - Cannot directly use an IEEE 802.1q VLAN tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype.InterfaceType property. +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI interface +// - Cannot directly use an IEEE 802.1q VLAN tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The name for this network interface. The name must not be used by another network interface on the bare metal + // server. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the network interface. This can be specified using an existing reserved IP, or a + // prototype object for a new reserved IP. + // + // If an existing reserved IP or a prototype object with an address is specified, it must be available on the network + // interface's subnet. Otherwise, an available address on the subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Indicates if the interface can float to any other server within the same + // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal + // server in the resource group. Applies only to `vlan` type interfaces. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + + // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array + // of `allowed_vlans`. + // - Must use an IEEE 802.1q tag. + // - Has its own security groups and does not inherit those of the PCI device through + // which traffic flows. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` + + // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + Vlan *int64 `json:"vlan" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype.InterfaceType property. +// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array +// of `allowed_vlans`. +// - Must use an IEEE 802.1q tag. +// - Has its own security groups and does not inherit those of the PCI device through +// which traffic flows. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototypeInterfaceTypeVlanConst = "vlan" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(subnet SubnetIdentityIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + Vlan: core.Int64Ptr(vlan), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the network interfaces of a bare metal server with this profile depends on its +// configuration. +// This model "extends" BareMetalServerProfileBandwidth +type BareMetalServerProfileBandwidthDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileBandwidthDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileBandwidthDependent) isaBareMetalServerProfileBandwidth() bool { + return true +} + +// UnmarshalBareMetalServerProfileBandwidthDependent unmarshals an instance of BareMetalServerProfileBandwidthDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidthDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network interfaces of a bare metal +// server with this profile. +// This model "extends" BareMetalServerProfileBandwidth +type BareMetalServerProfileBandwidthEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileBandwidthEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileBandwidthEnum) isaBareMetalServerProfileBandwidth() bool { + return true +} + +// UnmarshalBareMetalServerProfileBandwidthEnum unmarshals an instance of BareMetalServerProfileBandwidthEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidthEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network interfaces of a bare metal server with this +// profile. +// This model "extends" BareMetalServerProfileBandwidth +type BareMetalServerProfileBandwidthFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileBandwidthFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileBandwidthFixed) isaBareMetalServerProfileBandwidth() bool { + return true +} + +// UnmarshalBareMetalServerProfileBandwidthFixed unmarshals an instance of BareMetalServerProfileBandwidthFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidthFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network interfaces of a bare metal +// server with this profile. +// This model "extends" BareMetalServerProfileBandwidth +type BareMetalServerProfileBandwidthRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileBandwidthRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileBandwidthRange) isaBareMetalServerProfileBandwidth() bool { + return true +} + +// UnmarshalBareMetalServerProfileBandwidthRange unmarshals an instance of BareMetalServerProfileBandwidthRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidthRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCountDependent : The CPU core count for a bare metal server with this profile depends on its configuration. +// This model "extends" BareMetalServerProfileCpuCoreCount +type BareMetalServerProfileCpuCoreCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuCoreCountDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuCoreCountDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileCpuCoreCountDependent) isaBareMetalServerProfileCpuCoreCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuCoreCountDependent unmarshals an instance of BareMetalServerProfileCpuCoreCountDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCountEnum : The permitted values for CPU cores for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuCoreCount +type BareMetalServerProfileCpuCoreCountEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuCoreCountEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuCoreCountEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileCpuCoreCountEnum) isaBareMetalServerProfileCpuCoreCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuCoreCountEnum unmarshals an instance of BareMetalServerProfileCpuCoreCountEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCountEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCountEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCountFixed : The CPU core count for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuCoreCount +type BareMetalServerProfileCpuCoreCountFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuCoreCountFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuCoreCountFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileCpuCoreCountFixed) isaBareMetalServerProfileCpuCoreCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuCoreCountFixed unmarshals an instance of BareMetalServerProfileCpuCoreCountFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCountFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCountRange : The permitted range for the number of CPU cores for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuCoreCount +type BareMetalServerProfileCpuCoreCountRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuCoreCountRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuCoreCountRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileCpuCoreCountRange) isaBareMetalServerProfileCpuCoreCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuCoreCountRange unmarshals an instance of BareMetalServerProfileCpuCoreCountRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCountRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuSocketCountDependent : The CPU socket count for a bare metal server with this profile depends on its configuration. +// This model "extends" BareMetalServerProfileCpuSocketCount +type BareMetalServerProfileCpuSocketCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuSocketCountDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileCpuSocketCountDependent) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuSocketCountDependent unmarshals an instance of BareMetalServerProfileCpuSocketCountDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuSocketCountEnum : The permitted values for CPU sockets for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuSocketCount +type BareMetalServerProfileCpuSocketCountEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuSocketCountEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileCpuSocketCountEnum) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuSocketCountEnum unmarshals an instance of BareMetalServerProfileCpuSocketCountEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCountEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCountEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuSocketCountFixed : The number of CPU sockets for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuSocketCount +type BareMetalServerProfileCpuSocketCountFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuSocketCountFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileCpuSocketCountFixed) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuSocketCountFixed unmarshals an instance of BareMetalServerProfileCpuSocketCountFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCountFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuSocketCountRange : The permitted range for the number of CPU sockets for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuSocketCount +type BareMetalServerProfileCpuSocketCountRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuSocketCountRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileCpuSocketCountRange) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuSocketCountRange unmarshals an instance of BareMetalServerProfileCpuSocketCountRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCountRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskQuantityDependent : The number of disks of this configuration for a bare metal server with this profile depends on its bare metal server +// configuration. +// This model "extends" BareMetalServerProfileDiskQuantity +type BareMetalServerProfileDiskQuantityDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskQuantityDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileDiskQuantityDependent) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskQuantityDependent unmarshals an instance of BareMetalServerProfileDiskQuantityDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantityDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantityDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskQuantityEnum : The permitted the number of disks of this configuration for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileDiskQuantity +type BareMetalServerProfileDiskQuantityEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskQuantityEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileDiskQuantityEnum) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskQuantityEnum unmarshals an instance of BareMetalServerProfileDiskQuantityEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantityEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantityEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskQuantityFixed : The number of disks of this configuration for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileDiskQuantity +type BareMetalServerProfileDiskQuantityFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskQuantityFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileDiskQuantityFixed) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskQuantityFixed unmarshals an instance of BareMetalServerProfileDiskQuantityFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantityFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantityFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskQuantityRange : The permitted range for the number of disks of this configuration for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileDiskQuantity +type BareMetalServerProfileDiskQuantityRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskQuantityRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileDiskQuantityRange) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskQuantityRange unmarshals an instance of BareMetalServerProfileDiskQuantityRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantityRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantityRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSizeDependent : The disk size in GB (gigabytes) of this configuration for a bare metal server with this profile depends on its bare +// metal server configuration. +// This model "extends" BareMetalServerProfileDiskSize +type BareMetalServerProfileDiskSizeDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskSizeDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileDiskSizeDependent) isaBareMetalServerProfileDiskSize() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskSizeDependent unmarshals an instance of BareMetalServerProfileDiskSizeDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSizeDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSizeDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSizeEnum : The permitted disk size in GB (gigabytes) of this configuration for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileDiskSize +type BareMetalServerProfileDiskSizeEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskSizeEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileDiskSizeEnum) isaBareMetalServerProfileDiskSize() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskSizeEnum unmarshals an instance of BareMetalServerProfileDiskSizeEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSizeEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSizeEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSizeFixed : The size of the disk in GB (gigabytes). +// This model "extends" BareMetalServerProfileDiskSize +type BareMetalServerProfileDiskSizeFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskSizeFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileDiskSizeFixed) isaBareMetalServerProfileDiskSize() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskSizeFixed unmarshals an instance of BareMetalServerProfileDiskSizeFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSizeFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSizeFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSizeRange : The permitted range for the disk size of this configuration in GB (gigabytes) for a bare metal server with this +// profile. +// This model "extends" BareMetalServerProfileDiskSize +type BareMetalServerProfileDiskSizeRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskSizeRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileDiskSizeRange) isaBareMetalServerProfileDiskSize() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskSizeRange unmarshals an instance of BareMetalServerProfileDiskSizeRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSizeRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSizeRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileIdentityByHref : BareMetalServerProfileIdentityByHref struct +// This model "extends" BareMetalServerProfileIdentity +type BareMetalServerProfileIdentityByHref struct { + // The URL for this bare metal server profile. + Href *string `json:"href" validate:"required"` +} + +// NewBareMetalServerProfileIdentityByHref : Instantiate BareMetalServerProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerProfileIdentityByHref(href string) (_model *BareMetalServerProfileIdentityByHref, err error) { + _model = &BareMetalServerProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerProfileIdentityByHref) isaBareMetalServerProfileIdentity() bool { + return true +} + +// UnmarshalBareMetalServerProfileIdentityByHref unmarshals an instance of BareMetalServerProfileIdentityByHref from the specified map of raw messages. +func UnmarshalBareMetalServerProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileIdentityByName : BareMetalServerProfileIdentityByName struct +// This model "extends" BareMetalServerProfileIdentity +type BareMetalServerProfileIdentityByName struct { + // The name for this bare metal server profile. + Name *string `json:"name" validate:"required"` +} + +// NewBareMetalServerProfileIdentityByName : Instantiate BareMetalServerProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerProfileIdentityByName(name string) (_model *BareMetalServerProfileIdentityByName, err error) { + _model = &BareMetalServerProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerProfileIdentityByName) isaBareMetalServerProfileIdentity() bool { + return true +} + +// UnmarshalBareMetalServerProfileIdentityByName unmarshals an instance of BareMetalServerProfileIdentityByName from the specified map of raw messages. +func UnmarshalBareMetalServerProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileMemoryDependent : The memory value for a bare metal server with this profile depends on its configuration. +// This model "extends" BareMetalServerProfileMemory +type BareMetalServerProfileMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileMemoryDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileMemoryDependent) isaBareMetalServerProfileMemory() bool { + return true +} + +// UnmarshalBareMetalServerProfileMemoryDependent unmarshals an instance of BareMetalServerProfileMemoryDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileMemoryEnum : The permitted memory values (in gibibytes) for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileMemory +type BareMetalServerProfileMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileMemoryEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileMemoryEnum) isaBareMetalServerProfileMemory() bool { + return true +} + +// UnmarshalBareMetalServerProfileMemoryEnum unmarshals an instance of BareMetalServerProfileMemoryEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileMemoryFixed : The memory (in gibibytes) for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileMemory +type BareMetalServerProfileMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileMemoryFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileMemoryFixed) isaBareMetalServerProfileMemory() bool { + return true +} + +// UnmarshalBareMetalServerProfileMemoryFixed unmarshals an instance of BareMetalServerProfileMemoryFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileMemoryRange : The permitted memory range (in gibibytes) for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileMemory +type BareMetalServerProfileMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileMemoryRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileMemoryRange) isaBareMetalServerProfileMemory() bool { + return true +} + +// UnmarshalBareMetalServerProfileMemoryRange unmarshals an instance of BareMetalServerProfileMemoryRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileNetworkAttachmentCountDependent : The number of network attachments supported on a bare metal server with this profile is dependent on its +// configuration. +// This model "extends" BareMetalServerProfileNetworkAttachmentCount +type BareMetalServerProfileNetworkAttachmentCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkAttachmentCountDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkAttachmentCountDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileNetworkAttachmentCountDependent) isaBareMetalServerProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent unmarshals an instance of BareMetalServerProfileNetworkAttachmentCountDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkAttachmentCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileNetworkAttachmentCountRange : The number of network attachments supported on a bare metal server with this profile. +// This model "extends" BareMetalServerProfileNetworkAttachmentCount +type BareMetalServerProfileNetworkAttachmentCountRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkAttachmentCountRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkAttachmentCountRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileNetworkAttachmentCountRange) isaBareMetalServerProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkAttachmentCountRange unmarshals an instance of BareMetalServerProfileNetworkAttachmentCountRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkAttachmentCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkAttachmentCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileNetworkInterfaceCountDependent : The number of network interfaces supported on a bare metal server with this profile is dependent on its +// configuration. +// This model "extends" BareMetalServerProfileNetworkInterfaceCount +type BareMetalServerProfileNetworkInterfaceCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkInterfaceCountDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkInterfaceCountDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileNetworkInterfaceCountDependent) isaBareMetalServerProfileNetworkInterfaceCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent unmarshals an instance of BareMetalServerProfileNetworkInterfaceCountDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkInterfaceCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileNetworkInterfaceCountRange : The number of network interfaces supported on a bare metal server with this profile. +// This model "extends" BareMetalServerProfileNetworkInterfaceCount +type BareMetalServerProfileNetworkInterfaceCountRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkInterfaceCountRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkInterfaceCountRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileNetworkInterfaceCountRange) isaBareMetalServerProfileNetworkInterfaceCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkInterfaceCountRange unmarshals an instance of BareMetalServerProfileNetworkInterfaceCountRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkInterfaceCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkInterfaceCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototypeBareMetalServerByNetworkAttachment : BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct +// This model "extends" BareMetalServerPrototype +type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { + // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to + // boot. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + + Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` + + // The name for this bare metal server. The name must not be used by another bare metal server in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) to use for this bare metal + // server. + Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` + + // The VPC this bare metal server will reside in. If specified, it must match the VPC for the subnets of the server's + // network interfaces. + 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 *BareMetalServerPrimaryNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment : Instantiate BareMetalServerPrototypeBareMetalServerByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *BareMetalServerPrimaryNetworkAttachmentPrototype) (_model *BareMetalServerPrototypeBareMetalServerByNetworkAttachment, err error) { + _model = &BareMetalServerPrototypeBareMetalServerByNetworkAttachment{ + Initialization: initialization, + Profile: profile, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrototypeBareMetalServerByNetworkAttachment) isaBareMetalServerPrototype() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkAttachment from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototypeBareMetalServerByNetworkInterface : BareMetalServerPrototypeBareMetalServerByNetworkInterface struct +// This model "extends" BareMetalServerPrototype +type BareMetalServerPrototypeBareMetalServerByNetworkInterface struct { + // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to + // boot. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + + Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` + + // The name for this bare metal server. The name must not be used by another bare metal server in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) to use for this bare metal + // server. + Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` + + // The VPC this bare metal server will reside in. If specified, it must match the VPC for the subnets of the server's + // network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The zone this bare metal server will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network interfaces to create for the bare metal server. + NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the bare metal server. + PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewBareMetalServerPrototypeBareMetalServerByNetworkInterface : Instantiate BareMetalServerPrototypeBareMetalServerByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkInterface(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype) (_model *BareMetalServerPrototypeBareMetalServerByNetworkInterface, err error) { + _model = &BareMetalServerPrototypeBareMetalServerByNetworkInterface{ + Initialization: initialization, + Profile: profile, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrototypeBareMetalServerByNetworkInterface) isaBareMetalServerPrototype() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkInterface from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeBareMetalServerByNetworkInterface) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingIdentityCatalogOfferingByCRN : CatalogOfferingIdentityCatalogOfferingByCRN struct +// This model "extends" CatalogOfferingIdentity +type CatalogOfferingIdentityCatalogOfferingByCRN struct { + // The CRN for this + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. + CRN *string `json:"crn" validate:"required"` +} + +// NewCatalogOfferingIdentityCatalogOfferingByCRN : Instantiate CatalogOfferingIdentityCatalogOfferingByCRN (Generic Model Constructor) +func (*VpcV1) NewCatalogOfferingIdentityCatalogOfferingByCRN(crn string) (_model *CatalogOfferingIdentityCatalogOfferingByCRN, err error) { + _model = &CatalogOfferingIdentityCatalogOfferingByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CatalogOfferingIdentityCatalogOfferingByCRN) isaCatalogOfferingIdentity() bool { + return true +} + +// UnmarshalCatalogOfferingIdentityCatalogOfferingByCRN unmarshals an instance of CatalogOfferingIdentityCatalogOfferingByCRN from the specified map of raw messages. +func UnmarshalCatalogOfferingIdentityCatalogOfferingByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingIdentityCatalogOfferingByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN : CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN struct +// This model "extends" CatalogOfferingVersionIdentity +type CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN struct { + // The CRN for this version of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. + CRN *string `json:"crn" validate:"required"` +} + +// NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN : Instantiate CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN (Generic Model Constructor) +func (*VpcV1) NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(crn string) (_model *CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN, err error) { + _model = &CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN) isaCatalogOfferingVersionIdentity() bool { + return true +} + +// UnmarshalCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN unmarshals an instance of CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN from the specified map of raw messages. +func UnmarshalCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CertificateInstanceIdentityByCRN : CertificateInstanceIdentityByCRN struct +// This model "extends" CertificateInstanceIdentity +type CertificateInstanceIdentityByCRN struct { + // The CRN for this certificate instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewCertificateInstanceIdentityByCRN : Instantiate CertificateInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewCertificateInstanceIdentityByCRN(crn string) (_model *CertificateInstanceIdentityByCRN, err error) { + _model = &CertificateInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CertificateInstanceIdentityByCRN) isaCertificateInstanceIdentity() bool { + return true +} + +// UnmarshalCertificateInstanceIdentityByCRN unmarshals an instance of CertificateInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalCertificateInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CertificateInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CloudObjectStorageBucketIdentityByCRN : CloudObjectStorageBucketIdentityByCRN struct +// This model "extends" CloudObjectStorageBucketIdentity +type CloudObjectStorageBucketIdentityByCRN struct { + // The CRN of this Cloud Object Storage bucket. + CRN *string `json:"crn" validate:"required"` +} + +// NewCloudObjectStorageBucketIdentityByCRN : Instantiate CloudObjectStorageBucketIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewCloudObjectStorageBucketIdentityByCRN(crn string) (_model *CloudObjectStorageBucketIdentityByCRN, err error) { + _model = &CloudObjectStorageBucketIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CloudObjectStorageBucketIdentityByCRN) isaCloudObjectStorageBucketIdentity() bool { + return true +} + +// UnmarshalCloudObjectStorageBucketIdentityByCRN unmarshals an instance of CloudObjectStorageBucketIdentityByCRN from the specified map of raw messages. +func UnmarshalCloudObjectStorageBucketIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageBucketIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct +// This model "extends" CloudObjectStorageBucketIdentity +type CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name" validate:"required"` +} + +// NewCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : Instantiate CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName (Generic Model Constructor) +func (*VpcV1) NewCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name string) (_model *CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName, err error) { + _model = &CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) isaCloudObjectStorageBucketIdentity() bool { + return true +} + +// UnmarshalCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName unmarshals an instance of CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName from the specified map of raw messages. +func UnmarshalCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsInstanceIdentityByCRN : DnsInstanceIdentityByCRN struct +// This model "extends" DnsInstanceIdentity +type DnsInstanceIdentityByCRN struct { + // The CRN for this DNS instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewDnsInstanceIdentityByCRN : Instantiate DnsInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewDnsInstanceIdentityByCRN(crn string) (_model *DnsInstanceIdentityByCRN, err error) { + _model = &DnsInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DnsInstanceIdentityByCRN) isaDnsInstanceIdentity() bool { + return true +} + +// UnmarshalDnsInstanceIdentityByCRN unmarshals an instance of DnsInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalDnsInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsZoneIdentityByID : DnsZoneIdentityByID struct +// This model "extends" DnsZoneIdentity +type DnsZoneIdentityByID struct { + ID *string `json:"id" validate:"required"` +} + +// NewDnsZoneIdentityByID : Instantiate DnsZoneIdentityByID (Generic Model Constructor) +func (*VpcV1) NewDnsZoneIdentityByID(id string) (_model *DnsZoneIdentityByID, err error) { + _model = &DnsZoneIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DnsZoneIdentityByID) isaDnsZoneIdentity() bool { + return true +} + +// UnmarshalDnsZoneIdentityByID unmarshals an instance of DnsZoneIdentityByID from the specified map of raw messages. +func UnmarshalDnsZoneIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsZoneIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentityByCRN : DedicatedHostGroupIdentityByCRN struct +// This model "extends" DedicatedHostGroupIdentity +type DedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewDedicatedHostGroupIdentityByCRN : Instantiate DedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostGroupIdentityByCRN(crn string) (_model *DedicatedHostGroupIdentityByCRN, err error) { + _model = &DedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostGroupIdentityByCRN) isaDedicatedHostGroupIdentity() bool { + return true +} + +// UnmarshalDedicatedHostGroupIdentityByCRN unmarshals an instance of DedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentityByHref : DedicatedHostGroupIdentityByHref struct +// This model "extends" DedicatedHostGroupIdentity +type DedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewDedicatedHostGroupIdentityByHref : Instantiate DedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostGroupIdentityByHref(href string) (_model *DedicatedHostGroupIdentityByHref, err error) { + _model = &DedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostGroupIdentityByHref) isaDedicatedHostGroupIdentity() bool { + return true +} + +// UnmarshalDedicatedHostGroupIdentityByHref unmarshals an instance of DedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentityByID : DedicatedHostGroupIdentityByID struct +// This model "extends" DedicatedHostGroupIdentity +type DedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewDedicatedHostGroupIdentityByID : Instantiate DedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostGroupIdentityByID(id string) (_model *DedicatedHostGroupIdentityByID, err error) { + _model = &DedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostGroupIdentityByID) isaDedicatedHostGroupIdentity() bool { + return true +} + +// UnmarshalDedicatedHostGroupIdentityByID unmarshals an instance of DedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileIdentityByHref : DedicatedHostProfileIdentityByHref struct +// This model "extends" DedicatedHostProfileIdentity +type DedicatedHostProfileIdentityByHref struct { + // The URL for this dedicated host profile. + Href *string `json:"href" validate:"required"` +} + +// NewDedicatedHostProfileIdentityByHref : Instantiate DedicatedHostProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostProfileIdentityByHref(href string) (_model *DedicatedHostProfileIdentityByHref, err error) { + _model = &DedicatedHostProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostProfileIdentityByHref) isaDedicatedHostProfileIdentity() bool { + return true +} + +// UnmarshalDedicatedHostProfileIdentityByHref unmarshals an instance of DedicatedHostProfileIdentityByHref from the specified map of raw messages. +func UnmarshalDedicatedHostProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileIdentityByName : DedicatedHostProfileIdentityByName struct +// This model "extends" DedicatedHostProfileIdentity +type DedicatedHostProfileIdentityByName struct { + // The globally unique name for this dedicated host profile. + Name *string `json:"name" validate:"required"` +} + +// NewDedicatedHostProfileIdentityByName : Instantiate DedicatedHostProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostProfileIdentityByName(name string) (_model *DedicatedHostProfileIdentityByName, err error) { + _model = &DedicatedHostProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostProfileIdentityByName) isaDedicatedHostProfileIdentity() bool { + return true +} + +// UnmarshalDedicatedHostProfileIdentityByName unmarshals an instance of DedicatedHostProfileIdentityByName from the specified map of raw messages. +func UnmarshalDedicatedHostProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryDependent : The memory value for a dedicated host with this profile depends on its configuration. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryDependent.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryDependentTypeDependentConst = "dependent" +) + +func (*DedicatedHostProfileMemoryDependent) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryDependent unmarshals an instance of DedicatedHostProfileMemoryDependent from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryEnum : The permitted memory values (in gibibytes) for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryEnum.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryEnumTypeEnumConst = "enum" +) + +func (*DedicatedHostProfileMemoryEnum) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryEnum unmarshals an instance of DedicatedHostProfileMemoryEnum from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryFixed : The memory (in gibibytes) for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryFixed.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryFixedTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileMemoryFixed) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryFixed unmarshals an instance of DedicatedHostProfileMemoryFixed from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryRange : The permitted memory range (in gibibytes) for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryRange.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryRangeTypeRangeConst = "range" +) + +func (*DedicatedHostProfileMemoryRange) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryRange unmarshals an instance of DedicatedHostProfileMemoryRange from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketDependent : The CPU socket count for a dedicated host with this profile depends on its configuration. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketDependent.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketDependentTypeDependentConst = "dependent" +) + +func (*DedicatedHostProfileSocketDependent) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketDependent unmarshals an instance of DedicatedHostProfileSocketDependent from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketEnum : The permitted values for CPU socket count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketEnum.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketEnumTypeEnumConst = "enum" +) + +func (*DedicatedHostProfileSocketEnum) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketEnum unmarshals an instance of DedicatedHostProfileSocketEnum from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketFixed : The CPU socket count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketFixed.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketFixedTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileSocketFixed) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketFixed unmarshals an instance of DedicatedHostProfileSocketFixed from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketRange : The permitted range for CPU socket count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketRange.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketRangeTypeRangeConst = "range" +) + +func (*DedicatedHostProfileSocketRange) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketRange unmarshals an instance of DedicatedHostProfileSocketRange from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuDependent : The VCPU count for a dedicated host with this profile depends on its configuration. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuDependent.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuDependentTypeDependentConst = "dependent" +) + +func (*DedicatedHostProfileVcpuDependent) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuDependent unmarshals an instance of DedicatedHostProfileVcpuDependent from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuEnum : The permitted values for VCPU count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuEnum.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuEnumTypeEnumConst = "enum" +) + +func (*DedicatedHostProfileVcpuEnum) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuEnum unmarshals an instance of DedicatedHostProfileVcpuEnum from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuFixed : The VCPU count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuFixed.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuFixedTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileVcpuFixed) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuFixed unmarshals an instance of DedicatedHostProfileVcpuFixed from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuRange : The permitted range for VCPU count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuRange.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuRangeTypeRangeConst = "range" +) + +func (*DedicatedHostProfileVcpuRange) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuRange unmarshals an instance of DedicatedHostProfileVcpuRange from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPrototypeDedicatedHostByGroup : DedicatedHostPrototypeDedicatedHostByGroup struct +// This model "extends" DedicatedHostPrototype +type DedicatedHostPrototypeDedicatedHostByGroup struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this dedicated host. + Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The dedicated host group for this dedicated host. + Group DedicatedHostGroupIdentityIntf `json:"group" validate:"required"` +} + +// NewDedicatedHostPrototypeDedicatedHostByGroup : Instantiate DedicatedHostPrototypeDedicatedHostByGroup (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByGroup(profile DedicatedHostProfileIdentityIntf, group DedicatedHostGroupIdentityIntf) (_model *DedicatedHostPrototypeDedicatedHostByGroup, err error) { + _model = &DedicatedHostPrototypeDedicatedHostByGroup{ + Profile: profile, + Group: group, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostPrototypeDedicatedHostByGroup) isaDedicatedHostPrototype() bool { + return true +} + +// UnmarshalDedicatedHostPrototypeDedicatedHostByGroup unmarshals an instance of DedicatedHostPrototypeDedicatedHostByGroup from the specified map of raw messages. +func UnmarshalDedicatedHostPrototypeDedicatedHostByGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPrototypeDedicatedHostByGroup) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPrototypeDedicatedHostByZone : DedicatedHostPrototypeDedicatedHostByZone struct +// This model "extends" DedicatedHostPrototype +type DedicatedHostPrototypeDedicatedHostByZone struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this dedicated host. + Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Group *DedicatedHostGroupPrototypeDedicatedHostByZoneContext `json:"group,omitempty"` + + // The zone this dedicated host will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewDedicatedHostPrototypeDedicatedHostByZone : Instantiate DedicatedHostPrototypeDedicatedHostByZone (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByZone(profile DedicatedHostProfileIdentityIntf, zone ZoneIdentityIntf) (_model *DedicatedHostPrototypeDedicatedHostByZone, err error) { + _model = &DedicatedHostPrototypeDedicatedHostByZone{ + Profile: profile, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostPrototypeDedicatedHostByZone) isaDedicatedHostPrototype() bool { + return true +} + +// UnmarshalDedicatedHostPrototypeDedicatedHostByZone unmarshals an instance of DedicatedHostPrototypeDedicatedHostByZone from the specified map of raw messages. +func UnmarshalDedicatedHostPrototypeDedicatedHostByZone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPrototypeDedicatedHostByZone) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EncryptionKeyIdentityByCRN : EncryptionKeyIdentityByCRN struct +// This model "extends" EncryptionKeyIdentity +type EncryptionKeyIdentityByCRN struct { + // The CRN of the [Key Protect Root + // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto + // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. + CRN *string `json:"crn" validate:"required"` +} + +// NewEncryptionKeyIdentityByCRN : Instantiate EncryptionKeyIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewEncryptionKeyIdentityByCRN(crn string) (_model *EncryptionKeyIdentityByCRN, err error) { + _model = &EncryptionKeyIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EncryptionKeyIdentityByCRN) isaEncryptionKeyIdentity() bool { + return true +} + +// UnmarshalEncryptionKeyIdentityByCRN unmarshals an instance of EncryptionKeyIdentityByCRN from the specified map of raw messages. +func UnmarshalEncryptionKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EncryptionKeyIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPIdentity : Identifies a reserved IP by a unique property. +// Models which "extend" this model: +// - EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID +// - EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref +// This model "extends" EndpointGatewayReservedIP +type EndpointGatewayReservedIPReservedIPIdentity struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` +} + +func (*EndpointGatewayReservedIPReservedIPIdentity) isaEndpointGatewayReservedIPReservedIPIdentity() bool { + return true +} + +type EndpointGatewayReservedIPReservedIPIdentityIntf interface { + EndpointGatewayReservedIPIntf + isaEndpointGatewayReservedIPReservedIPIdentity() bool +} + +func (*EndpointGatewayReservedIPReservedIPIdentity) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPIdentity unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentity from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPPrototypeTargetContext : EndpointGatewayReservedIPReservedIPPrototypeTargetContext struct +// This model "extends" EndpointGatewayReservedIP +type EndpointGatewayReservedIPReservedIPPrototypeTargetContext struct { + // The IP address to reserve, which must not already be reserved on the subnet. + // + // If unspecified, an available address on the subnet will automatically be selected. + Address *string `json:"address,omitempty"` + + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with + // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated + // list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The subnet in which to create this reserved IP. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` +} + +// NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext : Instantiate EndpointGatewayReservedIPReservedIPPrototypeTargetContext (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext(subnet SubnetIdentityIntf) (_model *EndpointGatewayReservedIPReservedIPPrototypeTargetContext, err error) { + _model = &EndpointGatewayReservedIPReservedIPPrototypeTargetContext{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayReservedIPReservedIPPrototypeTargetContext) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext unmarshals an instance of EndpointGatewayReservedIPReservedIPPrototypeTargetContext from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPPrototypeTargetContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderCloudServiceIdentity : EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct +// Models which "extend" this model: +// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN +// This model "extends" EndpointGatewayTargetPrototype +type EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn,omitempty"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentity.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { + return true +} + +type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityIntf interface { + EndpointGatewayTargetPrototypeIntf + isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool +} + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentity from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity : EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct +// Models which "extend" this model: +// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName +// This model "extends" EndpointGatewayTargetPrototype +type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { + return true +} + +type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityIntf interface { + EndpointGatewayTargetPrototypeIntf + isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool +} + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetProviderCloudServiceReference : EndpointGatewayTargetProviderCloudServiceReference struct +// This model "extends" EndpointGatewayTarget +type EndpointGatewayTargetProviderCloudServiceReference struct { + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn" validate:"required"` + + // The type of target. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetProviderCloudServiceReference.ResourceType property. +// The type of target. +const ( + EndpointGatewayTargetProviderCloudServiceReferenceResourceTypeProviderCloudServiceConst = "provider_cloud_service" +) + +func (*EndpointGatewayTargetProviderCloudServiceReference) isaEndpointGatewayTarget() bool { + return true +} + +// UnmarshalEndpointGatewayTargetProviderCloudServiceReference unmarshals an instance of EndpointGatewayTargetProviderCloudServiceReference from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetProviderCloudServiceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetProviderCloudServiceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetProviderInfrastructureServiceReference : The name of this provider infrastructure service. +// This model "extends" EndpointGatewayTarget +type EndpointGatewayTargetProviderInfrastructureServiceReference struct { + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name" validate:"required"` + + // The type of target. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetProviderInfrastructureServiceReference.ResourceType property. +// The type of target. +const ( + EndpointGatewayTargetProviderInfrastructureServiceReferenceResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetProviderInfrastructureServiceReference) isaEndpointGatewayTarget() bool { + return true +} + +// UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference unmarshals an instance of EndpointGatewayTargetProviderInfrastructureServiceReference from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetProviderInfrastructureServiceReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPrototypeFloatingIPByTarget : FloatingIPPrototypeFloatingIPByTarget struct +// This model "extends" FloatingIPPrototype +type FloatingIPPrototypeFloatingIPByTarget struct { + // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The target resource to bind this floating IP to. + // + // The target resource must not already have a floating IP bound to it if the target + // resource is: + // + // - an instance network interface + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` + // - a virtual network interface with `enable_infrastructure_nat` set to `true`. + Target FloatingIPTargetPrototypeIntf `json:"target" validate:"required"` +} + +// NewFloatingIPPrototypeFloatingIPByTarget : Instantiate FloatingIPPrototypeFloatingIPByTarget (Generic Model Constructor) +func (*VpcV1) NewFloatingIPPrototypeFloatingIPByTarget(target FloatingIPTargetPrototypeIntf) (_model *FloatingIPPrototypeFloatingIPByTarget, err error) { + _model = &FloatingIPPrototypeFloatingIPByTarget{ + Target: target, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPPrototypeFloatingIPByTarget) isaFloatingIPPrototype() bool { + return true +} + +// UnmarshalFloatingIPPrototypeFloatingIPByTarget unmarshals an instance of FloatingIPPrototypeFloatingIPByTarget from the specified map of raw messages. +func UnmarshalFloatingIPPrototypeFloatingIPByTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPrototypeFloatingIPByTarget) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPrototypeFloatingIPByZone : FloatingIPPrototypeFloatingIPByZone struct +// This model "extends" FloatingIPPrototype +type FloatingIPPrototypeFloatingIPByZone struct { + // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The zone this floating IP will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewFloatingIPPrototypeFloatingIPByZone : Instantiate FloatingIPPrototypeFloatingIPByZone (Generic Model Constructor) +func (*VpcV1) NewFloatingIPPrototypeFloatingIPByZone(zone ZoneIdentityIntf) (_model *FloatingIPPrototypeFloatingIPByZone, err error) { + _model = &FloatingIPPrototypeFloatingIPByZone{ + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPPrototypeFloatingIPByZone) isaFloatingIPPrototype() bool { + return true +} + +// UnmarshalFloatingIPPrototypeFloatingIPByZone unmarshals an instance of FloatingIPPrototypeFloatingIPByZone from the specified map of raw messages. +func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPrototypeFloatingIPByZone) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchNetworkInterfaceIdentity : Identifies a network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +// This model "extends" FloatingIPTargetPatch +type FloatingIPTargetPatchNetworkInterfaceIdentity struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentity) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPatchNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPatchIntf + isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" FloatingIPTargetPatch +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPatchIntf + isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeNetworkInterfaceIdentity : Identifies a network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +// This model "extends" FloatingIPTargetPrototype +type FloatingIPTargetPrototypeNetworkInterfaceIdentity struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPrototypeNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPrototypeIntf + isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" FloatingIPTargetPrototype +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPrototypeIntf + isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetNetworkInterfaceReference : FloatingIPTargetNetworkInterfaceReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetNetworkInterfaceReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The name for this network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FloatingIPTargetNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetNetworkInterfaceReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FloatingIPTargetNetworkInterfaceReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetNetworkInterfaceReference unmarshals an instance of FloatingIPTargetNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetNetworkInterfaceReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPublicGatewayReference : FloatingIPTargetPublicGatewayReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetPublicGatewayReference struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` + + // The name for this public gateway. The name is unique across all public gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FloatingIPTargetPublicGatewayReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetPublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" +) + +func (*FloatingIPTargetPublicGatewayReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetPublicGatewayReference unmarshals an instance of FloatingIPTargetPublicGatewayReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPublicGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetVirtualNetworkInterfaceReference : FloatingIPTargetVirtualNetworkInterfaceReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetVirtualNetworkInterfaceReference struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VirtualNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The primary IP for this virtual network interface. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the FloatingIPTargetVirtualNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetVirtualNetworkInterfaceReferenceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +func (*FloatingIPTargetVirtualNetworkInterfaceReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference unmarshals an instance of FloatingIPTargetVirtualNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetVirtualNetworkInterfaceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID +// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN +// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeInstanceIdentity struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentity) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeInstanceIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity : Identifies an instance network attachment by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID +// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity struct { + // The unique identifier for this instance network attachment. + ID *string `json:"id,omitempty"` + + // The URL for this instance network attachment. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity : Identifies a network interface by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentity : Identifies a subnet by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID +// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN +// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeSubnetIdentity struct { + // The unique identifier for this subnet. + ID *string `json:"id,omitempty"` + + // The CRN for this subnet. + CRN *string `json:"crn,omitempty"` + + // The URL for this subnet. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentity) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeSubnetIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentity : Identifies a VPC by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID +// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN +// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeVPCIdentity struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentity) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeVPCIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeVPCIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetInstanceNetworkAttachmentReference : FlowLogCollectorTargetInstanceNetworkAttachmentReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetInstanceNetworkAttachmentReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network attachment. + ID *string `json:"id" validate:"required"` + + Name *string `json:"name" validate:"required"` + + // The primary IP address of the virtual network interface for the 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 network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetInstanceNetworkAttachmentReference.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetInstanceNetworkAttachmentReferenceResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +func (*FlowLogCollectorTargetInstanceNetworkAttachmentReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference unmarshals an instance of FlowLogCollectorTargetInstanceNetworkAttachmentReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetInstanceNetworkAttachmentReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetInstanceReference : FlowLogCollectorTargetInstanceReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetInstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. + Name *string `json:"name" validate:"required"` +} + +func (*FlowLogCollectorTargetInstanceReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetInstanceReference unmarshals an instance of FlowLogCollectorTargetInstanceReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext : FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The name for this network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetSubnetReference : FlowLogCollectorTargetSubnetReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetSubnetReference struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` + + // The name for this subnet. The name is unique across all subnets in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetSubnetReference.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetSubnetReferenceResourceTypeSubnetConst = "subnet" +) + +func (*FlowLogCollectorTargetSubnetReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetSubnetReference unmarshals an instance of FlowLogCollectorTargetSubnetReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetSubnetReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSubnetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetVPCReference : FlowLogCollectorTargetVPCReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetVPCReference struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The name for this VPC. The name is unique across all VPCs in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetVPCReference.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetVPCReferenceResourceTypeVPCConst = "vpc" +) + +func (*FlowLogCollectorTargetVPCReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetVPCReference unmarshals an instance of FlowLogCollectorTargetVPCReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetVPCReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext : FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VirtualNetworkInterfaceReferenceAttachmentContextDeleted `json:"deleted,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +func (*FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext unmarshals an instance of FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentityByCRN : ImageIdentityByCRN struct +// This model "extends" ImageIdentity +type ImageIdentityByCRN struct { + // The CRN for this image. + CRN *string `json:"crn" validate:"required"` +} + +// NewImageIdentityByCRN : Instantiate ImageIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewImageIdentityByCRN(crn string) (_model *ImageIdentityByCRN, err error) { + _model = &ImageIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImageIdentityByCRN) isaImageIdentity() bool { + return true +} + +// UnmarshalImageIdentityByCRN unmarshals an instance of ImageIdentityByCRN from the specified map of raw messages. +func UnmarshalImageIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentityByHref : ImageIdentityByHref struct +// This model "extends" ImageIdentity +type ImageIdentityByHref struct { + // The URL for this image. + Href *string `json:"href" validate:"required"` +} + +// NewImageIdentityByHref : Instantiate ImageIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewImageIdentityByHref(href string) (_model *ImageIdentityByHref, err error) { + _model = &ImageIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImageIdentityByHref) isaImageIdentity() bool { + return true +} + +// UnmarshalImageIdentityByHref unmarshals an instance of ImageIdentityByHref from the specified map of raw messages. +func UnmarshalImageIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentityByID : ImageIdentityByID struct +// This model "extends" ImageIdentity +type ImageIdentityByID struct { + // The unique identifier for this image. + ID *string `json:"id" validate:"required"` +} + +// NewImageIdentityByID : Instantiate ImageIdentityByID (Generic Model Constructor) +func (*VpcV1) NewImageIdentityByID(id string) (_model *ImageIdentityByID, err error) { + _model = &ImageIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImageIdentityByID) isaImageIdentity() bool { + return true +} + +// UnmarshalImageIdentityByID unmarshals an instance of ImageIdentityByID from the specified map of raw messages. +func UnmarshalImageIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImagePrototypeImageByFile : ImagePrototypeImageByFile struct +// This model "extends" ImagePrototype +type ImagePrototypeImageByFile struct { + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are + // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. + // + // That representation is created by wrapping the key's value with the `encryption_key` root key (which must also be + // specified), using either [Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the + // [Hyper Protect Crypto Services](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). + // + // If unspecified, the imported image is treated as unencrypted. + EncryptedDataKey *string `json:"encrypted_data_key,omitempty"` + + // The root key that was used to wrap the data key (which is ultimately represented as + // `encrypted_data_key`). Additionally, the root key will be used to encrypt volumes + // created from this image (unless an alternate `encryption_key` is specified at volume + // creation). + // + // If unspecified, the imported image is treated as unencrypted. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The file from which to create the image. + File *ImageFilePrototype `json:"file" validate:"required"` + + // The [supported operating + // system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included in this + // image. + OperatingSystem OperatingSystemIdentityIntf `json:"operating_system" validate:"required"` +} + +// NewImagePrototypeImageByFile : Instantiate ImagePrototypeImageByFile (Generic Model Constructor) +func (*VpcV1) NewImagePrototypeImageByFile(file *ImageFilePrototype, operatingSystem OperatingSystemIdentityIntf) (_model *ImagePrototypeImageByFile, err error) { + _model = &ImagePrototypeImageByFile{ + File: file, + OperatingSystem: operatingSystem, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImagePrototypeImageByFile) isaImagePrototype() bool { + return true +} + +// UnmarshalImagePrototypeImageByFile unmarshals an instance of ImagePrototypeImageByFile from the specified map of raw messages. +func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePrototypeImageByFile) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImagePrototypeImageBySourceVolume : ImagePrototypeImageBySourceVolume struct +// This model "extends" ImagePrototype +type ImagePrototypeImageBySourceVolume struct { + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are + // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The root key used to wrap the system-generated data encryption key for the image. + // + // If unspecified, the root key from `source_volume` will be used. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The volume from which to create the image. The specified volume must: + // - Have an `operating_system`, which will be used to populate this image's + // operating system information. + // - Not be `active` or `busy`. + // + // During image creation, the specified volume may briefly become `busy`. + SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` +} + +// NewImagePrototypeImageBySourceVolume : Instantiate ImagePrototypeImageBySourceVolume (Generic Model Constructor) +func (*VpcV1) NewImagePrototypeImageBySourceVolume(sourceVolume VolumeIdentityIntf) (_model *ImagePrototypeImageBySourceVolume, err error) { + _model = &ImagePrototypeImageBySourceVolume{ + SourceVolume: sourceVolume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImagePrototypeImageBySourceVolume) isaImagePrototype() bool { + return true +} + +// UnmarshalImagePrototypeImageBySourceVolume unmarshals an instance of ImagePrototypeImageBySourceVolume from the specified map of raw messages. +func UnmarshalImagePrototypeImageBySourceVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePrototypeImageBySourceVolume) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCatalogOfferingPrototypeCatalogOfferingByOffering : InstanceCatalogOfferingPrototypeCatalogOfferingByOffering struct +// This model "extends" InstanceCatalogOfferingPrototype +type InstanceCatalogOfferingPrototypeCatalogOfferingByOffering struct { + // Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering by a unique property. + Offering CatalogOfferingIdentityIntf `json:"offering" validate:"required"` +} + +// NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering : Instantiate InstanceCatalogOfferingPrototypeCatalogOfferingByOffering (Generic Model Constructor) +func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(offering CatalogOfferingIdentityIntf) (_model *InstanceCatalogOfferingPrototypeCatalogOfferingByOffering, err error) { + _model = &InstanceCatalogOfferingPrototypeCatalogOfferingByOffering{ + Offering: offering, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) isaInstanceCatalogOfferingPrototype() bool { + return true +} + +// UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering unmarshals an instance of InstanceCatalogOfferingPrototypeCatalogOfferingByOffering from the specified map of raw messages. +func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) + err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCatalogOfferingPrototypeCatalogOfferingByVersion : InstanceCatalogOfferingPrototypeCatalogOfferingByVersion struct +// This model "extends" InstanceCatalogOfferingPrototype +type InstanceCatalogOfferingPrototypeCatalogOfferingByVersion struct { + // Identifies a version of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a + // unique property. + Version CatalogOfferingVersionIdentityIntf `json:"version" validate:"required"` +} + +// NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion : Instantiate InstanceCatalogOfferingPrototypeCatalogOfferingByVersion (Generic Model Constructor) +func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(version CatalogOfferingVersionIdentityIntf) (_model *InstanceCatalogOfferingPrototypeCatalogOfferingByVersion, err error) { + _model = &InstanceCatalogOfferingPrototypeCatalogOfferingByVersion{ + Version: version, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) isaInstanceCatalogOfferingPrototype() bool { + return true +} + +// UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion unmarshals an instance of InstanceCatalogOfferingPrototypeCatalogOfferingByVersion from the specified map of raw messages. +func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototype : InstanceGroupManagerActionPrototypeScheduledActionPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec +// This model "extends" InstanceGroupManagerActionPrototype +type InstanceGroupManagerActionPrototypeScheduledActionPrototype struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototype) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf interface { + InstanceGroupManagerActionPrototypeIntf + isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototype) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionScheduledAction : InstanceGroupManagerActionScheduledAction struct +// Models which "extend" this model: +// - InstanceGroupManagerActionScheduledActionGroupTarget +// - InstanceGroupManagerActionScheduledActionManagerTarget +// This model "extends" InstanceGroupManagerAction +type InstanceGroupManagerActionScheduledAction struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. At present, this is always + // `true`, but may be modifiable in the future. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type" validate:"required"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroup `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager,omitempty"` +} + +// Constants associated with the InstanceGroupManagerActionScheduledAction.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionScheduledActionResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerActionScheduledAction.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionScheduledActionStatusActiveConst = "active" + InstanceGroupManagerActionScheduledActionStatusCompletedConst = "completed" + InstanceGroupManagerActionScheduledActionStatusFailedConst = "failed" + InstanceGroupManagerActionScheduledActionStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionScheduledActionStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerActionScheduledAction.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionScheduledActionActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerActionScheduledAction) isaInstanceGroupManagerActionScheduledAction() bool { + return true +} + +type InstanceGroupManagerActionScheduledActionIntf interface { + InstanceGroupManagerActionIntf + isaInstanceGroupManagerActionScheduledAction() bool +} + +func (*InstanceGroupManagerActionScheduledAction) isaInstanceGroupManagerAction() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionScheduledAction unmarshals an instance of InstanceGroupManagerActionScheduledAction from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionScheduledAction(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionScheduledAction) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerAutoScale : InstanceGroupManagerAutoScale struct +// This model "extends" InstanceGroupManager +type InstanceGroupManagerAutoScale struct { + // The date and time that the instance group manager was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled" validate:"required"` + + // The name for this instance group manager. The name is unique across all managers for the instance group. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window" validate:"required"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown" validate:"required"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count" validate:"required"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count" validate:"required"` + + // The policies of the instance group manager. + Policies []InstanceGroupManagerPolicyReference `json:"policies" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerAutoScale.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerAutoScaleManagerTypeAutoscaleConst = "autoscale" +) + +func (*InstanceGroupManagerAutoScale) isaInstanceGroupManager() bool { + return true +} + +// UnmarshalInstanceGroupManagerAutoScale unmarshals an instance of InstanceGroupManagerAutoScale from the specified map of raw messages. +func UnmarshalInstanceGroupManagerAutoScale(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerAutoScale) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype : InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct +// This model "extends" InstanceGroupManagerPolicyPrototype +type InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct { + // The name for this instance group manager policy. The name must not be used by another policy for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type" validate:"required"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value" validate:"required"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypePolicyTypeTargetConst = "target" +) + +// NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype : Instantiate InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(metricType string, metricValue int64, policyType string) (_model *InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype, err error) { + _model = &InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype{ + MetricType: core.StringPtr(metricType), + MetricValue: core.Int64Ptr(metricValue), + PolicyType: core.StringPtr(policyType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) isaInstanceGroupManagerPolicyPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype unmarshals an instance of InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy : InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct +// This model "extends" InstanceGroupManagerPolicy +type InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct { + // The date and time that the instance group manager policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager policy. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager policy. The name is unique across all policies for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager policy was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type" validate:"required"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value" validate:"required"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyPolicyTypeTargetConst = "target" +) + +func (*InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) isaInstanceGroupManagerPolicy() bool { + return true +} + +// UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy unmarshals an instance of InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype : InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype struct +// This model "extends" InstanceGroupManagerPrototype +type InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype struct { + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The name for this instance group manager. The name must not be used by another manager for the instance group. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count" validate:"required"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototypeManagerTypeAutoscaleConst = "autoscale" +) + +// NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype : Instantiate InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(managerType string, maxMembershipCount int64) (_model *InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype, err error) { + _model = &InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype{ + ManagerType: core.StringPtr(managerType), + MaxMembershipCount: core.Int64Ptr(maxMembershipCount), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) isaInstanceGroupManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype unmarshals an instance of InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype : InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype struct +// This model "extends" InstanceGroupManagerPrototype +type InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype struct { + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The name for this instance group manager. The name must not be used by another manager for the instance group. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototypeManagerTypeScheduledConst = "scheduled" +) + +// NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype : Instantiate InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype(managerType string) (_model *InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype, err error) { + _model = &InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype{ + ManagerType: core.StringPtr(managerType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype) isaInstanceGroupManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype unmarshals an instance of InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype) + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduled : InstanceGroupManagerScheduled struct +// This model "extends" InstanceGroupManager +type InstanceGroupManagerScheduled struct { + // The date and time that the instance group manager was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled" validate:"required"` + + // The name for this instance group manager. The name is unique across all managers for the instance group. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The actions of the instance group manager. + Actions []InstanceGroupManagerActionReference `json:"actions" validate:"required"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerScheduled.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerScheduledManagerTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerScheduled) isaInstanceGroupManager() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduled unmarshals an instance of InstanceGroupManagerScheduled from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduled(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduled) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerAutoScale : InstanceGroupManagerScheduledActionManagerAutoScale struct +// This model "extends" InstanceGroupManagerScheduledActionManager +type InstanceGroupManagerScheduledActionManagerAutoScale struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager. The name is unique across all managers for the instance group. + Name *string `json:"name" validate:"required"` + + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +func (*InstanceGroupManagerScheduledActionManagerAutoScale) isaInstanceGroupManagerScheduledActionManager() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale unmarshals an instance of InstanceGroupManagerScheduledActionManagerAutoScale from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerAutoScale) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype : The auto scale manager to update, and one or more properties to be updated. Either `id` or `href` must be specified, +// in addition to at least one of `min_membership_count` and +// `max_membership_count`. +// Models which "extend" this model: +// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID +// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref +// This model "extends" InstanceGroupManagerScheduledActionManagerPrototype +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href,omitempty"` +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { + return true +} + +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeIntf interface { + InstanceGroupManagerScheduledActionManagerPrototypeIntf + isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePatchProfileInstanceProfileIdentityByHref : InstancePatchProfileInstanceProfileIdentityByHref struct +// This model "extends" InstancePatchProfile +type InstancePatchProfileInstanceProfileIdentityByHref struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePatchProfileInstanceProfileIdentityByHref : Instantiate InstancePatchProfileInstanceProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByHref(href string) (_model *InstancePatchProfileInstanceProfileIdentityByHref, err error) { + _model = &InstancePatchProfileInstanceProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePatchProfileInstanceProfileIdentityByHref) isaInstancePatchProfile() bool { + return true +} + +// UnmarshalInstancePatchProfileInstanceProfileIdentityByHref unmarshals an instance of InstancePatchProfileInstanceProfileIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePatchProfileInstanceProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatchProfileInstanceProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePatchProfileInstanceProfileIdentityByName : InstancePatchProfileInstanceProfileIdentityByName struct +// This model "extends" InstancePatchProfile +type InstancePatchProfileInstanceProfileIdentityByName struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` +} + +// NewInstancePatchProfileInstanceProfileIdentityByName : Instantiate InstancePatchProfileInstanceProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByName(name string) (_model *InstancePatchProfileInstanceProfileIdentityByName, err error) { + _model = &InstancePatchProfileInstanceProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePatchProfileInstanceProfileIdentityByName) isaInstancePatchProfile() bool { + return true +} + +// UnmarshalInstancePatchProfileInstanceProfileIdentityByName unmarshals an instance of InstancePatchProfileInstanceProfileIdentityByName from the specified map of raw messages. +func UnmarshalInstancePatchProfileInstanceProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatchProfileInstanceProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID +// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN +// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref +// This model "extends" InstancePlacementTargetPatch +type InstancePlacementTargetPatchDedicatedHostGroupIdentity struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentity) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +type InstancePlacementTargetPatchDedicatedHostGroupIdentityIntf interface { + InstancePlacementTargetPatchIntf + isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentity) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentity : Identifies a dedicated host by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID +// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN +// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref +// This model "extends" InstancePlacementTargetPatch +type InstancePlacementTargetPatchDedicatedHostIdentity struct { + // The unique identifier for this dedicated host. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentity) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +type InstancePlacementTargetPatchDedicatedHostIdentityIntf interface { + InstancePlacementTargetPatchIntf + isaInstancePlacementTargetPatchDedicatedHostIdentity() bool +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentity) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentity unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID +// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN +// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref +// This model "extends" InstancePlacementTargetPrototype +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentity struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityIntf interface { + InstancePlacementTargetPrototypeIntf + isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentity unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentity : Identifies a dedicated host by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID +// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN +// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref +// This model "extends" InstancePlacementTargetPrototype +type InstancePlacementTargetPrototypeDedicatedHostIdentity struct { + // The unique identifier for this dedicated host. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentity) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +type InstancePlacementTargetPrototypeDedicatedHostIdentityIntf interface { + InstancePlacementTargetPrototypeIntf + isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentity) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentity unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentity : Identifies a placement group by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID +// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN +// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref +// This model "extends" InstancePlacementTargetPrototype +type InstancePlacementTargetPrototypePlacementGroupIdentity struct { + // The unique identifier for this placement group. + ID *string `json:"id,omitempty"` + + // The CRN for this placement group. + CRN *string `json:"crn,omitempty"` + + // The URL for this placement group. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentity) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +type InstancePlacementTargetPrototypePlacementGroupIdentityIntf interface { + InstancePlacementTargetPrototypeIntf + isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentity) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentity unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetDedicatedHostGroupReference : InstancePlacementTargetDedicatedHostGroupReference struct +// This model "extends" InstancePlacementTarget +type InstancePlacementTargetDedicatedHostGroupReference struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` + + // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstancePlacementTargetDedicatedHostGroupReference.ResourceType property. +// The resource type. +const ( + InstancePlacementTargetDedicatedHostGroupReferenceResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +func (*InstancePlacementTargetDedicatedHostGroupReference) isaInstancePlacementTarget() bool { + return true +} + +// UnmarshalInstancePlacementTargetDedicatedHostGroupReference unmarshals an instance of InstancePlacementTargetDedicatedHostGroupReference from the specified map of raw messages. +func UnmarshalInstancePlacementTargetDedicatedHostGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetDedicatedHostGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetDedicatedHostReference : InstancePlacementTargetDedicatedHostReference struct +// This model "extends" InstancePlacementTarget +type InstancePlacementTargetDedicatedHostReference struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` + + // The name for this dedicated host. The name is unique across all dedicated hosts in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstancePlacementTargetDedicatedHostReference.ResourceType property. +// The resource type. +const ( + InstancePlacementTargetDedicatedHostReferenceResourceTypeDedicatedHostConst = "dedicated_host" +) + +func (*InstancePlacementTargetDedicatedHostReference) isaInstancePlacementTarget() bool { + return true +} + +// UnmarshalInstancePlacementTargetDedicatedHostReference unmarshals an instance of InstancePlacementTargetDedicatedHostReference from the specified map of raw messages. +func UnmarshalInstancePlacementTargetDedicatedHostReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetDedicatedHostReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPlacementGroupReference : InstancePlacementTargetPlacementGroupReference struct +// This model "extends" InstancePlacementTarget +type InstancePlacementTargetPlacementGroupReference struct { + // The CRN for this placement group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *PlacementGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this placement group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this placement group. + ID *string `json:"id" validate:"required"` + + // The name for this placement group. The name is unique across all placement groups in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstancePlacementTargetPlacementGroupReference.ResourceType property. +// The resource type. +const ( + InstancePlacementTargetPlacementGroupReferenceResourceTypePlacementGroupConst = "placement_group" +) + +func (*InstancePlacementTargetPlacementGroupReference) isaInstancePlacementTarget() bool { + return true +} + +// UnmarshalInstancePlacementTargetPlacementGroupReference unmarshals an instance of InstancePlacementTargetPlacementGroupReference from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPlacementGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPlacementGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPlacementGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthDependent : The total bandwidth shared across the network interfaces and storage volumes of an instance with this profile depends +// on its configuration. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileBandwidthDependent) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthDependent unmarshals an instance of InstanceProfileBandwidthDependent from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network interfaces and storage +// volumes of an instance with this profile. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileBandwidthEnum) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthEnum unmarshals an instance of InstanceProfileBandwidthEnum from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network interfaces and storage volumes of an instance +// with this profile. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileBandwidthFixed) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthFixed unmarshals an instance of InstanceProfileBandwidthFixed from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network interfaces and storage volumes +// of an instance with this profile. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthRange.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthRangeTypeRangeConst = "range" +) + +func (*InstanceProfileBandwidthRange) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthRange unmarshals an instance of InstanceProfileBandwidthRange from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityDependent : The number of disks of this configuration for an instance with this profile depends on its instance configuration. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileDiskQuantityDependent) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityDependent unmarshals an instance of InstanceProfileDiskQuantityDependent from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityEnum : The permitted the number of disks of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileDiskQuantityEnum) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityEnum unmarshals an instance of InstanceProfileDiskQuantityEnum from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityFixed : The number of disks of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskQuantityFixed) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityFixed unmarshals an instance of InstanceProfileDiskQuantityFixed from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityRange : The permitted range for the number of disks of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityRange.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityRangeTypeRangeConst = "range" +) + +func (*InstanceProfileDiskQuantityRange) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityRange unmarshals an instance of InstanceProfileDiskQuantityRange from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeDependent : The disk size in GB (gigabytes) of this configuration for an instance with this profile depends on its instance +// configuration. +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileDiskSizeDependent) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeDependent unmarshals an instance of InstanceProfileDiskSizeDependent from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeEnum : The permitted disk size in GB (gigabytes) of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileDiskSizeEnum) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeEnum unmarshals an instance of InstanceProfileDiskSizeEnum from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeFixed : The size of the disk in GB (gigabytes). +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskSizeFixed) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeFixed unmarshals an instance of InstanceProfileDiskSizeFixed from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeRange : The permitted range for the disk size of this configuration in GB (gigabytes) for an instance with this profile. +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeRange.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeRangeTypeRangeConst = "range" +) + +func (*InstanceProfileDiskSizeRange) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeRange unmarshals an instance of InstanceProfileDiskSizeRange from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuDependent : The GPU count for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileGpu +type InstanceProfileGpuDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileGpuDependent) isaInstanceProfileGpu() bool { + return true +} + +// UnmarshalInstanceProfileGpuDependent unmarshals an instance of InstanceProfileGpuDependent from the specified map of raw messages. +func UnmarshalInstanceProfileGpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuEnum : The permitted GPU count values for an instance with this profile. +// This model "extends" InstanceProfileGpu +type InstanceProfileGpuEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileGpuEnum) isaInstanceProfileGpu() bool { + return true +} + +// UnmarshalInstanceProfileGpuEnum unmarshals an instance of InstanceProfileGpuEnum from the specified map of raw messages. +func UnmarshalInstanceProfileGpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuFixed : The GPU count for an instance with this profile. +// This model "extends" InstanceProfileGpu +type InstanceProfileGpuFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileGpuFixed) isaInstanceProfileGpu() bool { + return true +} + +// UnmarshalInstanceProfileGpuFixed unmarshals an instance of InstanceProfileGpuFixed from the specified map of raw messages. +func UnmarshalInstanceProfileGpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemoryDependent : The overall GPU memory value for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileGpuMemory +type InstanceProfileGpuMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuMemoryDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileGpuMemoryDependent) isaInstanceProfileGpuMemory() bool { + return true +} + +// UnmarshalInstanceProfileGpuMemoryDependent unmarshals an instance of InstanceProfileGpuMemoryDependent from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemoryEnum : The permitted overall GPU memory values in GiB (gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileGpuMemory +type InstanceProfileGpuMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuMemoryEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileGpuMemoryEnum) isaInstanceProfileGpuMemory() bool { + return true +} + +// UnmarshalInstanceProfileGpuMemoryEnum unmarshals an instance of InstanceProfileGpuMemoryEnum from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemoryFixed : The overall GPU memory in GiB (gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileGpuMemory +type InstanceProfileGpuMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuMemoryFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileGpuMemoryFixed) isaInstanceProfileGpuMemory() bool { + return true +} + +// UnmarshalInstanceProfileGpuMemoryFixed unmarshals an instance of InstanceProfileGpuMemoryFixed from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemoryRange : The permitted overall GPU memory range in GiB (gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileGpuMemory +type InstanceProfileGpuMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuMemoryRange.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryRangeTypeRangeConst = "range" +) + +func (*InstanceProfileGpuMemoryRange) isaInstanceProfileGpuMemory() bool { + return true +} + +// UnmarshalInstanceProfileGpuMemoryRange unmarshals an instance of InstanceProfileGpuMemoryRange from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuRange : The permitted GPU count range for an instance with this profile. +// This model "extends" InstanceProfileGpu +type InstanceProfileGpuRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuRange.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuRangeTypeRangeConst = "range" +) + +func (*InstanceProfileGpuRange) isaInstanceProfileGpu() bool { + return true +} + +// UnmarshalInstanceProfileGpuRange unmarshals an instance of InstanceProfileGpuRange from the specified map of raw messages. +func UnmarshalInstanceProfileGpuRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileIdentityByHref : InstanceProfileIdentityByHref struct +// This model "extends" InstanceProfileIdentity +type InstanceProfileIdentityByHref struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceProfileIdentityByHref : Instantiate InstanceProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceProfileIdentityByHref(href string) (_model *InstanceProfileIdentityByHref, err error) { + _model = &InstanceProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceProfileIdentityByHref) isaInstanceProfileIdentity() bool { + return true +} + +// UnmarshalInstanceProfileIdentityByHref unmarshals an instance of InstanceProfileIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileIdentityByName : InstanceProfileIdentityByName struct +// This model "extends" InstanceProfileIdentity +type InstanceProfileIdentityByName struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` +} + +// NewInstanceProfileIdentityByName : Instantiate InstanceProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewInstanceProfileIdentityByName(name string) (_model *InstanceProfileIdentityByName, err error) { + _model = &InstanceProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceProfileIdentityByName) isaInstanceProfileIdentity() bool { + return true +} + +// UnmarshalInstanceProfileIdentityByName unmarshals an instance of InstanceProfileIdentityByName from the specified map of raw messages. +func UnmarshalInstanceProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryDependent : The memory value for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileMemoryDependent) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryDependent unmarshals an instance of InstanceProfileMemoryDependent from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryEnum : The permitted memory values (in gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileMemoryEnum) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryEnum unmarshals an instance of InstanceProfileMemoryEnum from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryFixed : The memory (in gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileMemoryFixed) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryFixed unmarshals an instance of InstanceProfileMemoryFixed from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryRange : The permitted memory range (in gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryRange.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryRangeTypeRangeConst = "range" +) + +func (*InstanceProfileMemoryRange) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryRange unmarshals an instance of InstanceProfileMemoryRange from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkAttachmentCountDependent : The number of network attachments supported on an instance with this profile is dependent on its configuration. +// This model "extends" InstanceProfileNetworkAttachmentCount +type InstanceProfileNetworkAttachmentCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkAttachmentCountDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkAttachmentCountDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileNetworkAttachmentCountDependent) isaInstanceProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkAttachmentCountDependent unmarshals an instance of InstanceProfileNetworkAttachmentCountDependent from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkAttachmentCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkAttachmentCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkAttachmentCountRange : The number of network attachments supported on an instance with this profile. +// This model "extends" InstanceProfileNetworkAttachmentCount +type InstanceProfileNetworkAttachmentCountRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkAttachmentCountRange.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkAttachmentCountRangeTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkAttachmentCountRange) isaInstanceProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkAttachmentCountRange unmarshals an instance of InstanceProfileNetworkAttachmentCountRange from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkAttachmentCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkAttachmentCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkInterfaceCountDependent : The number of network interfaces supported on an instance with this profile is dependent on its configuration. +// This model "extends" InstanceProfileNetworkInterfaceCount +type InstanceProfileNetworkInterfaceCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkInterfaceCountDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkInterfaceCountDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileNetworkInterfaceCountDependent) isaInstanceProfileNetworkInterfaceCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkInterfaceCountDependent unmarshals an instance of InstanceProfileNetworkInterfaceCountDependent from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkInterfaceCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkInterfaceCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkInterfaceCountRange : The number of network interfaces supported on an instance with this profile. +// This model "extends" InstanceProfileNetworkInterfaceCount +type InstanceProfileNetworkInterfaceCountRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkInterfaceCountRange.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkInterfaceCountRangeTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkInterfaceCountRange) isaInstanceProfileNetworkInterfaceCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkInterfaceCountRange unmarshals an instance of InstanceProfileNetworkInterfaceCountRange from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkInterfaceCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkInterfaceCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfilePortSpeedDependent : The port speed of each network interface of an instance with this profile depends on its configuration. +// This model "extends" InstanceProfilePortSpeed +type InstanceProfilePortSpeedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfilePortSpeedDependent.Type property. +// The type for this profile field. +const ( + InstanceProfilePortSpeedDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfilePortSpeedDependent) isaInstanceProfilePortSpeed() bool { + return true +} + +// UnmarshalInstanceProfilePortSpeedDependent unmarshals an instance of InstanceProfilePortSpeedDependent from the specified map of raw messages. +func UnmarshalInstanceProfilePortSpeedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfilePortSpeedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfilePortSpeedFixed : The maximum speed (in megabits per second) of each network interface of an instance with this profile. +// This model "extends" InstanceProfilePortSpeed +type InstanceProfilePortSpeedFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfilePortSpeedFixed.Type property. +// The type for this profile field. +const ( + InstanceProfilePortSpeedFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfilePortSpeedFixed) isaInstanceProfilePortSpeed() bool { + return true +} + +// UnmarshalInstanceProfilePortSpeedFixed unmarshals an instance of InstanceProfilePortSpeedFixed from the specified map of raw messages. +func UnmarshalInstanceProfilePortSpeedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfilePortSpeedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuDependent : The VCPU count for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileVcpuDependent) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuDependent unmarshals an instance of InstanceProfileVcpuDependent from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuEnum : The permitted values for VCPU count for an instance with this profile. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileVcpuEnum) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuEnum unmarshals an instance of InstanceProfileVcpuEnum from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuFixed : The VCPU count for an instance with this profile. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileVcpuFixed) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuFixed unmarshals an instance of InstanceProfileVcpuFixed from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuRange : The permitted range for VCPU count for an instance with this profile. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuRange.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuRangeTypeRangeConst = "range" +) + +func (*InstanceProfileVcpuRange) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuRange unmarshals an instance of InstanceProfileVcpuRange from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidthDependent : The storage bandwidth shared across the storage volumes of an instance with this profile depends on its +// configuration. +// This model "extends" InstanceProfileVolumeBandwidth +type InstanceProfileVolumeBandwidthDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVolumeBandwidthDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileVolumeBandwidthDependent) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileVolumeBandwidthDependent unmarshals an instance of InstanceProfileVolumeBandwidthDependent from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidthDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidthEnum : The permitted storage bandwidth values (in megabits per second) shared across the storage volumes of an instance with +// this profile. +// This model "extends" InstanceProfileVolumeBandwidth +type InstanceProfileVolumeBandwidthEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileVolumeBandwidthEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileVolumeBandwidthEnum) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileVolumeBandwidthEnum unmarshals an instance of InstanceProfileVolumeBandwidthEnum from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidthEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidthFixed : The storage bandwidth (in megabits per second) shared across the storage volumes of an instance with this profile. +// This model "extends" InstanceProfileVolumeBandwidth +type InstanceProfileVolumeBandwidthFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVolumeBandwidthFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileVolumeBandwidthFixed) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileVolumeBandwidthFixed unmarshals an instance of InstanceProfileVolumeBandwidthFixed from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidthFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidthRange : The permitted storage bandwidth range (in megabits per second) shared across the storage volumes of an instance with +// this profile. +// This model "extends" InstanceProfileVolumeBandwidth +type InstanceProfileVolumeBandwidthRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVolumeBandwidthRange.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthRangeTypeRangeConst = "range" +) + +func (*InstanceProfileVolumeBandwidthRange) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileVolumeBandwidthRange unmarshals an instance of InstanceProfileVolumeBandwidthRange from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidthRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByCatalogOffering : Create an instance by using a catalog offering. +// Models which "extend" this model: +// - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment +// - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface +// This model "extends" InstancePrototype +type InstancePrototypeInstanceByCatalogOffering struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototypeInstanceByCatalogOffering() bool { + return true +} + +type InstancePrototypeInstanceByCatalogOfferingIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceByCatalogOffering() bool +} + +func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByCatalogOffering unmarshals an instance of InstancePrototypeInstanceByCatalogOffering from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByCatalogOffering) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByImage : Create an instance by using an image. +// Models which "extend" this model: +// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment +// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface +// This model "extends" InstancePrototype +type InstancePrototypeInstanceByImage struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment 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 network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstancePrototypeInstanceByImage) isaInstancePrototypeInstanceByImage() bool { + return true +} + +type InstancePrototypeInstanceByImageIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceByImage() bool +} + +func (*InstancePrototypeInstanceByImage) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByImage unmarshals an instance of InstancePrototypeInstanceByImage from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImage) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceSnapshot : Create an instance by using a snapshot. +// Models which "extend" this model: +// - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment +// - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface +// This model "extends" InstancePrototype +type InstancePrototypeInstanceBySourceSnapshot struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment 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 network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototypeInstanceBySourceSnapshot() bool { + return true +} + +type InstancePrototypeInstanceBySourceSnapshotIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceBySourceSnapshot() bool +} + +func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceSnapshot unmarshals an instance of InstancePrototypeInstanceBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceSnapshot) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceTemplate : Create an instance by using an instance template. +// +// The `primary_network_attachment` and `network_attachments` properties may only be specified if +// `primary_network_attachment` is specified in the source template. +// +// The `primary_network_interface` and `network_interfaces` properties may only be specified if +// `primary_network_interface` is specified in the source template. +// This model "extends" InstancePrototype +type InstancePrototypeInstanceBySourceTemplate struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment 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 network interfaces to create for the virtual server instance. + 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 network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// NewInstancePrototypeInstanceBySourceTemplate : Instantiate InstancePrototypeInstanceBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstancePrototypeInstanceBySourceTemplate, err error) { + _model = &InstancePrototypeInstanceBySourceTemplate{ + SourceTemplate: sourceTemplate, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceTemplate) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceTemplate unmarshals an instance of InstancePrototypeInstanceBySourceTemplate from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceTemplate) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByVolume : Create an instance by using a boot volume. +// Models which "extend" this model: +// - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment +// - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface +// This model "extends" InstancePrototype +type InstancePrototypeInstanceByVolume struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` + + // 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 network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstancePrototypeInstanceByVolume) isaInstancePrototypeInstanceByVolume() bool { + return true +} + +type InstancePrototypeInstanceByVolumeIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceByVolume() bool +} + +func (*InstancePrototypeInstanceByVolume) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByVolume unmarshals an instance of InstancePrototypeInstanceByVolume from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByVolume) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByCRN : InstanceTemplateIdentityByCRN struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByCRN struct { + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstanceTemplateIdentityByCRN : Instantiate InstanceTemplateIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByCRN(crn string) (_model *InstanceTemplateIdentityByCRN, err error) { + _model = &InstanceTemplateIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByCRN) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByCRN unmarshals an instance of InstanceTemplateIdentityByCRN from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByHref : InstanceTemplateIdentityByHref struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByHref struct { + // The URL for this instance template. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceTemplateIdentityByHref : Instantiate InstanceTemplateIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByHref(href string) (_model *InstanceTemplateIdentityByHref, err error) { + _model = &InstanceTemplateIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByHref) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByHref unmarshals an instance of InstanceTemplateIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByID : InstanceTemplateIdentityByID struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByID struct { + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceTemplateIdentityByID : Instantiate InstanceTemplateIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByID(id string) (_model *InstanceTemplateIdentityByID, err error) { + _model = &InstanceTemplateIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByID) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByID unmarshals an instance of InstanceTemplateIdentityByID from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Create an instance template that creates instances by using a catalog offering. +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment +// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { + return true +} + +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment +// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceTemplateByImage struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's 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 network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { + return true +} + +type InstanceTemplatePrototypeInstanceTemplateByImageIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateByImage() bool +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImage from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImage) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Create an instance template that creates instances by using a snapshot. +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment +// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The 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 network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { + return true +} + +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Create an instance template from an existing instance template. +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's 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 network interfaces to create for the virtual server instance. + 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 network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceTemplate, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceTemplate{ + SourceTemplate: sourceTemplate, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByCatalogOffering : Create an instance by using a catalog offering. +// Models which "extend" this model: +// - InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment +// - InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByCatalogOffering struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstanceTemplateInstanceByCatalogOffering) isaInstanceTemplateInstanceByCatalogOffering() bool { + return true +} + +type InstanceTemplateInstanceByCatalogOfferingIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceByCatalogOffering() bool +} + +func (*InstanceTemplateInstanceByCatalogOffering) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByCatalogOffering unmarshals an instance of InstanceTemplateInstanceByCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOffering) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImage : Create an instance by using an image. +// Models which "extend" this model: +// - InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment +// - InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByImage struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *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 network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstanceTemplateInstanceByImage) isaInstanceTemplateInstanceByImage() bool { + return true +} + +type InstanceTemplateInstanceByImageIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceByImage() bool +} + +func (*InstanceTemplateInstanceByImage) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByImage unmarshals an instance of InstanceTemplateInstanceByImage from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImage) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceBySourceSnapshot : Create an instance by using a snapshot. +// Models which "extend" this model: +// - InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment +// - InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceBySourceSnapshot struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The 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 network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstanceTemplateInstanceBySourceSnapshot) isaInstanceTemplateInstanceBySourceSnapshot() bool { + return true +} + +type InstanceTemplateInstanceBySourceSnapshotIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceBySourceSnapshot() bool +} + +func (*InstanceTemplateInstanceBySourceSnapshot) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceBySourceSnapshot unmarshals an instance of InstanceTemplateInstanceBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshot) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByCRN : KeyIdentityByCRN struct +// This model "extends" KeyIdentity +type KeyIdentityByCRN struct { + // The CRN for this key. + CRN *string `json:"crn" validate:"required"` +} + +// NewKeyIdentityByCRN : Instantiate KeyIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByCRN(crn string) (_model *KeyIdentityByCRN, err error) { + _model = &KeyIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByCRN) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByCRN unmarshals an instance of KeyIdentityByCRN from the specified map of raw messages. +func UnmarshalKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByFingerprint : KeyIdentityByFingerprint struct +// This model "extends" KeyIdentity +type KeyIdentityByFingerprint struct { + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` +} + +// NewKeyIdentityByFingerprint : Instantiate KeyIdentityByFingerprint (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByFingerprint(fingerprint string) (_model *KeyIdentityByFingerprint, err error) { + _model = &KeyIdentityByFingerprint{ + Fingerprint: core.StringPtr(fingerprint), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByFingerprint) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByFingerprint unmarshals an instance of KeyIdentityByFingerprint from the specified map of raw messages. +func UnmarshalKeyIdentityByFingerprint(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByFingerprint) + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByHref : KeyIdentityByHref struct +// This model "extends" KeyIdentity +type KeyIdentityByHref struct { + // The URL for this key. + Href *string `json:"href" validate:"required"` +} + +// NewKeyIdentityByHref : Instantiate KeyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByHref(href string) (_model *KeyIdentityByHref, err error) { + _model = &KeyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByHref) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByHref unmarshals an instance of KeyIdentityByHref from the specified map of raw messages. +func UnmarshalKeyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByID : KeyIdentityByID struct +// This model "extends" KeyIdentity +type KeyIdentityByID struct { + // The unique identifier for this key. + ID *string `json:"id" validate:"required"` +} + +// NewKeyIdentityByID : Instantiate KeyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByID(id string) (_model *KeyIdentityByID, err error) { + _model = &KeyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByID) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByID unmarshals an instance of KeyIdentityByID from the specified map of raw messages. +func UnmarshalKeyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct +// This model "extends" LegacyCloudObjectStorageBucketIdentity +type LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name" validate:"required"` +} + +// NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : Instantiate LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName (Generic Model Constructor) +func (*VpcV1) NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name string) (_model *LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName, err error) { + _model = &LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) isaLegacyCloudObjectStorageBucketIdentity() bool { + return true +} + +// UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName unmarshals an instance of LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName from the specified map of raw messages. +func UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentityByCRN : LoadBalancerIdentityByCRN struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByCRN struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewLoadBalancerIdentityByCRN : Instantiate LoadBalancerIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByCRN(crn string) (_model *LoadBalancerIdentityByCRN, err error) { + _model = &LoadBalancerIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerIdentityByCRN) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByCRN unmarshals an instance of LoadBalancerIdentityByCRN from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentityByHref : LoadBalancerIdentityByHref struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByHref struct { + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerIdentityByHref : Instantiate LoadBalancerIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByHref(href string) (_model *LoadBalancerIdentityByHref, err error) { + _model = &LoadBalancerIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerIdentityByHref) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByHref unmarshals an instance of LoadBalancerIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentityByID : LoadBalancerIdentityByID struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByID struct { + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerIdentityByID : Instantiate LoadBalancerIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByID(id string) (_model *LoadBalancerIdentityByID, err error) { + _model = &LoadBalancerIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerIdentityByID) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByID unmarshals an instance of LoadBalancerIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerIdentityByHref : LoadBalancerListenerIdentityByHref struct +// This model "extends" LoadBalancerListenerIdentity +type LoadBalancerListenerIdentityByHref struct { + // The listener's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerIdentityByHref : Instantiate LoadBalancerListenerIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerIdentityByHref(href string) (_model *LoadBalancerListenerIdentityByHref, err error) { + _model = &LoadBalancerListenerIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerIdentityByHref) isaLoadBalancerListenerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerListenerIdentityByHref unmarshals an instance of LoadBalancerListenerIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerIdentityByID : LoadBalancerListenerIdentityByID struct +// This model "extends" LoadBalancerListenerIdentity +type LoadBalancerListenerIdentityByID struct { + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerIdentityByID : Instantiate LoadBalancerListenerIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerIdentityByID(id string) (_model *LoadBalancerListenerIdentityByID, err error) { + _model = &LoadBalancerListenerIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerIdentityByID) isaLoadBalancerListenerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerListenerIdentityByID unmarshals an instance of LoadBalancerListenerIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityIntf interface { + LoadBalancerListenerPolicyTargetPatchIntf + isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype{ + HTTPStatusCode: core.Int64Ptr(httpStatusCode), + Listener: listener, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // The redirect target URL. + URL *string `json:"url" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(httpStatusCode int64, url string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype{ + HTTPStatusCode: core.Int64Ptr(httpStatusCode), + URL: core.StringPtr(url), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityIntf interface { + LoadBalancerListenerPolicyTargetPrototypeIntf + isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect : LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + Listener *LoadBalancerListenerReference `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL : LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // The redirect target URL. + URL *string `json:"url" validate:"required"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetLoadBalancerPoolReference : LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` + + // The name for this load balancer pool. The name is unique across all pools for the load balancer. + Name *string `json:"name" validate:"required"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerPoolReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerPoolIdentity +type LoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolIdentityByHref) isaLoadBalancerPoolIdentity() bool { + return true +} + +// UnmarshalLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityByID : LoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerPoolIdentity +type LoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolIdentityByID) isaLoadBalancerPoolIdentity() bool { + return true +} + +// UnmarshalLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeIP : LoadBalancerPoolMemberTargetPrototypeIP struct +// This model "extends" LoadBalancerPoolMemberTargetPrototype +type LoadBalancerPoolMemberTargetPrototypeIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeIP : Instantiate LoadBalancerPoolMemberTargetPrototypeIP (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeIP(address string) (_model *LoadBalancerPoolMemberTargetPrototypeIP, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeIP) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeIP unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeIP from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref +// This model "extends" LoadBalancerPoolMemberTargetPrototype +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentity struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityIntf interface { + LoadBalancerPoolMemberTargetPrototypeIntf + isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetIP : LoadBalancerPoolMemberTargetIP struct +// This model "extends" LoadBalancerPoolMemberTarget +type LoadBalancerPoolMemberTargetIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*LoadBalancerPoolMemberTargetIP) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetIP unmarshals an instance of LoadBalancerPoolMemberTargetIP from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetInstanceReference : LoadBalancerPoolMemberTargetInstanceReference struct +// This model "extends" LoadBalancerPoolMemberTarget +type LoadBalancerPoolMemberTargetInstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. + Name *string `json:"name" validate:"required"` +} + +func (*LoadBalancerPoolMemberTargetInstanceReference) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetInstanceReference unmarshals an instance of LoadBalancerPoolMemberTargetInstanceReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileIdentityByHref : LoadBalancerProfileIdentityByHref struct +// This model "extends" LoadBalancerProfileIdentity +type LoadBalancerProfileIdentityByHref struct { + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerProfileIdentityByHref : Instantiate LoadBalancerProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerProfileIdentityByHref(href string) (_model *LoadBalancerProfileIdentityByHref, err error) { + _model = &LoadBalancerProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerProfileIdentityByHref) isaLoadBalancerProfileIdentity() bool { + return true +} + +// UnmarshalLoadBalancerProfileIdentityByHref unmarshals an instance of LoadBalancerProfileIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileIdentityByName : LoadBalancerProfileIdentityByName struct +// This model "extends" LoadBalancerProfileIdentity +type LoadBalancerProfileIdentityByName struct { + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` +} + +// NewLoadBalancerProfileIdentityByName : Instantiate LoadBalancerProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerProfileIdentityByName(name string) (_model *LoadBalancerProfileIdentityByName, err error) { + _model = &LoadBalancerProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerProfileIdentityByName) isaLoadBalancerProfileIdentity() bool { + return true +} + +// UnmarshalLoadBalancerProfileIdentityByName unmarshals an instance of LoadBalancerProfileIdentityByName from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileInstanceGroupsSupportedDependent : The instance groups support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileInstanceGroupsSupported +type LoadBalancerProfileInstanceGroupsSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileInstanceGroupsSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileInstanceGroupsSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileInstanceGroupsSupportedDependent) isaLoadBalancerProfileInstanceGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileInstanceGroupsSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileInstanceGroupsSupportedFixed : The instance groups support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileInstanceGroupsSupported +type LoadBalancerProfileInstanceGroupsSupportedFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *bool `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileInstanceGroupsSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileInstanceGroupsSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileInstanceGroupsSupportedFixed) isaLoadBalancerProfileInstanceGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileInstanceGroupsSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileRouteModeSupportedDependent : The route mode support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileRouteModeSupported +type LoadBalancerProfileRouteModeSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileRouteModeSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileRouteModeSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileRouteModeSupportedDependent) isaLoadBalancerProfileRouteModeSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileRouteModeSupportedDependent unmarshals an instance of LoadBalancerProfileRouteModeSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileRouteModeSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileRouteModeSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileRouteModeSupportedFixed : The route mode support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileRouteModeSupported +type LoadBalancerProfileRouteModeSupportedFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *bool `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileRouteModeSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileRouteModeSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileRouteModeSupportedFixed) isaLoadBalancerProfileRouteModeSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileRouteModeSupportedFixed unmarshals an instance of LoadBalancerProfileRouteModeSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileRouteModeSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileRouteModeSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileSecurityGroupsSupportedDependent : The security group support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileSecurityGroupsSupported +type LoadBalancerProfileSecurityGroupsSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileSecurityGroupsSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileSecurityGroupsSupportedDependent) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileSecurityGroupsSupportedFixed : The security group support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileSecurityGroupsSupported +type LoadBalancerProfileSecurityGroupsSupportedFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *bool `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileSecurityGroupsSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileSecurityGroupsSupportedFixed) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileUDPSupportedDependent : The UDP support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileUDPSupported +type LoadBalancerProfileUDPSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileUDPSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileUDPSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileUDPSupportedDependent) isaLoadBalancerProfileUDPSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileUDPSupportedDependent unmarshals an instance of LoadBalancerProfileUDPSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileUDPSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileUDPSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileUDPSupportedFixed : The UDP support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileUDPSupported +type LoadBalancerProfileUDPSupportedFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *bool `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileUDPSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileUDPSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileUDPSupportedFixed) isaLoadBalancerProfileUDPSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileUDPSupportedFixed unmarshals an instance of LoadBalancerProfileUDPSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileUDPSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileUDPSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentityByCRN : NetworkACLIdentityByCRN struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByCRN struct { + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` +} + +// NewNetworkACLIdentityByCRN : Instantiate NetworkACLIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByCRN(crn string) (_model *NetworkACLIdentityByCRN, err error) { + _model = &NetworkACLIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLIdentityByCRN) isaNetworkACLIdentity() bool { + return true +} + +// UnmarshalNetworkACLIdentityByCRN unmarshals an instance of NetworkACLIdentityByCRN from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentityByHref : NetworkACLIdentityByHref struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByHref struct { + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkACLIdentityByHref : Instantiate NetworkACLIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByHref(href string) (_model *NetworkACLIdentityByHref, err error) { + _model = &NetworkACLIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLIdentityByHref) isaNetworkACLIdentity() bool { + return true +} + +// UnmarshalNetworkACLIdentityByHref unmarshals an instance of NetworkACLIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentityByID : NetworkACLIdentityByID struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByID struct { + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkACLIdentityByID : Instantiate NetworkACLIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByID(id string) (_model *NetworkACLIdentityByID, err error) { + _model = &NetworkACLIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLIdentityByID) isaNetworkACLIdentity() bool { + return true +} + +// UnmarshalNetworkACLIdentityByID unmarshals an instance of NetworkACLIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLPrototypeNetworkACLByRules : NetworkACLPrototypeNetworkACLByRules struct +// This model "extends" NetworkACLPrototype +type NetworkACLPrototypeNetworkACLByRules struct { + // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC this network ACL will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, + // resulting in all traffic being denied. + Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` +} + +// NewNetworkACLPrototypeNetworkACLByRules : Instantiate NetworkACLPrototypeNetworkACLByRules (Generic Model Constructor) +func (*VpcV1) NewNetworkACLPrototypeNetworkACLByRules(vpc VPCIdentityIntf) (_model *NetworkACLPrototypeNetworkACLByRules, err error) { + _model = &NetworkACLPrototypeNetworkACLByRules{ + VPC: vpc, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLPrototypeNetworkACLByRules) isaNetworkACLPrototype() bool { + return true +} + +// UnmarshalNetworkACLPrototypeNetworkACLByRules unmarshals an instance of NetworkACLPrototypeNetworkACLByRules from the specified map of raw messages. +func UnmarshalNetworkACLPrototypeNetworkACLByRules(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototypeNetworkACLByRules) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLPrototypeNetworkACLBySourceNetworkACL : NetworkACLPrototypeNetworkACLBySourceNetworkACL struct +// This model "extends" NetworkACLPrototype +type NetworkACLPrototypeNetworkACLBySourceNetworkACL struct { + // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC this network ACL will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // Network ACL to copy rules from. + SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl" validate:"required"` +} + +// NewNetworkACLPrototypeNetworkACLBySourceNetworkACL : Instantiate NetworkACLPrototypeNetworkACLBySourceNetworkACL (Generic Model Constructor) +func (*VpcV1) NewNetworkACLPrototypeNetworkACLBySourceNetworkACL(vpc VPCIdentityIntf, sourceNetworkACL NetworkACLIdentityIntf) (_model *NetworkACLPrototypeNetworkACLBySourceNetworkACL, err error) { + _model = &NetworkACLPrototypeNetworkACLBySourceNetworkACL{ + VPC: vpc, + SourceNetworkACL: sourceNetworkACL, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLPrototypeNetworkACLBySourceNetworkACL) isaNetworkACLPrototype() bool { + return true +} + +// UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL unmarshals an instance of NetworkACLPrototypeNetworkACLBySourceNetworkACL from the specified map of raw messages. +func UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototypeNetworkACLBySourceNetworkACL) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct +// This model "extends" NetworkACLRuleBeforePatch +type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct { + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref, err error) { + _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePatch() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct +// This model "extends" NetworkACLRuleBeforePatch +type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID, err error) { + _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePatch() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct +// This model "extends" NetworkACLRuleBeforePrototype +type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct { + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref, err error) { + _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePrototype() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct +// This model "extends" NetworkACLRuleBeforePrototype +type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID, err error) { + _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePrototype() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItemNetworkACLRuleProtocolAll : NetworkACLRuleItemNetworkACLRuleProtocolAll struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolAll struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolAllActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllProtocolAllConst = "all" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolAll) isaNetworkACLRuleItem() bool { + return true +} + +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolAll from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItemNetworkACLRuleProtocolIcmp : NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolIcmp) isaNetworkACLRuleItem() bool { + return true +} + +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItemNetworkACLRuleProtocolTcpudp : NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min" validate:"required"` +} + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) isaNetworkACLRuleItem() bool { + return true +} + +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" +) + +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" +) + +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" +) + +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototype() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototype() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototype() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleNetworkACLRuleProtocolAll : NetworkACLRuleNetworkACLRuleProtocolAll struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolAll struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolAllActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllProtocolAllConst = "all" +) + +func (*NetworkACLRuleNetworkACLRuleProtocolAll) isaNetworkACLRule() bool { + return true +} + +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolAll from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleNetworkACLRuleProtocolIcmp : NetworkACLRuleNetworkACLRuleProtocolIcmp struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolIcmp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolIcmpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*NetworkACLRuleNetworkACLRuleProtocolIcmp) isaNetworkACLRule() bool { + return true +} + +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleNetworkACLRuleProtocolTcpudp : NetworkACLRuleNetworkACLRuleProtocolTcpudp struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolTcpudp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min" validate:"required"` +} + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" + NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*NetworkACLRuleNetworkACLRuleProtocolTcpudp) isaNetworkACLRule() bool { + return true +} + +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototypeReservedIPIdentity : Identifies a reserved IP by a unique property. +// Models which "extend" this model: +// - NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID +// - NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref +// This model "extends" NetworkInterfaceIPPrototype +type NetworkInterfaceIPPrototypeReservedIPIdentity struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { + return true +} + +type NetworkInterfaceIPPrototypeReservedIPIdentityIntf interface { + NetworkInterfaceIPPrototypeIntf + isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentity from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext : NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext struct +// This model "extends" NetworkInterfaceIPPrototype +type NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext struct { + // The IP address to reserve, which must not already be reserved on the subnet. + // + // If unspecified, an available address on the subnet will automatically be selected. + Address *string `json:"address,omitempty"` + + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with + // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated + // list of randomly-selected words. + Name *string `json:"name,omitempty"` +} + +func (*NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) isaNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemIdentityByHref : OperatingSystemIdentityByHref struct +// This model "extends" OperatingSystemIdentity +type OperatingSystemIdentityByHref struct { + // The URL for this operating system. + Href *string `json:"href" validate:"required"` +} + +// NewOperatingSystemIdentityByHref : Instantiate OperatingSystemIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewOperatingSystemIdentityByHref(href string) (_model *OperatingSystemIdentityByHref, err error) { + _model = &OperatingSystemIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*OperatingSystemIdentityByHref) isaOperatingSystemIdentity() bool { + return true +} + +// UnmarshalOperatingSystemIdentityByHref unmarshals an instance of OperatingSystemIdentityByHref from the specified map of raw messages. +func UnmarshalOperatingSystemIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemIdentityByName : OperatingSystemIdentityByName struct +// This model "extends" OperatingSystemIdentity +type OperatingSystemIdentityByName struct { + // The globally unique name for this operating system. + Name *string `json:"name" validate:"required"` +} + +// NewOperatingSystemIdentityByName : Instantiate OperatingSystemIdentityByName (Generic Model Constructor) +func (*VpcV1) NewOperatingSystemIdentityByName(name string) (_model *OperatingSystemIdentityByName, err error) { + _model = &OperatingSystemIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*OperatingSystemIdentityByName) isaOperatingSystemIdentity() bool { + return true +} + +// UnmarshalOperatingSystemIdentityByName unmarshals an instance of OperatingSystemIdentityByName from the specified map of raw messages. +func UnmarshalOperatingSystemIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentity : Identifies a floating IP by a unique property. +// Models which "extend" this model: +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress +// This model "extends" PublicGatewayFloatingIPPrototype +type PublicGatewayFloatingIPPrototypeFloatingIPIdentity struct { + // The unique identifier for this floating IP. + ID *string `json:"id,omitempty"` + + // The CRN for this floating IP. + CRN *string `json:"crn,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href,omitempty"` + + // The globally unique IP address. + Address *string `json:"address,omitempty"` +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityIntf interface { + PublicGatewayFloatingIPPrototypeIntf + isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentity from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext : PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct +// This model "extends" PublicGatewayFloatingIPPrototype +type PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct { + // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentityPublicGatewayIdentityByCRN : PublicGatewayIdentityPublicGatewayIdentityByCRN struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityPublicGatewayIdentityByCRN struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` +} + +// NewPublicGatewayIdentityPublicGatewayIdentityByCRN : Instantiate PublicGatewayIdentityPublicGatewayIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByCRN(crn string) (_model *PublicGatewayIdentityPublicGatewayIdentityByCRN, err error) { + _model = &PublicGatewayIdentityPublicGatewayIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayIdentityPublicGatewayIdentityByCRN) isaPublicGatewayIdentity() bool { + return true +} + +// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByCRN from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityPublicGatewayIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentityPublicGatewayIdentityByHref : PublicGatewayIdentityPublicGatewayIdentityByHref struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityPublicGatewayIdentityByHref struct { + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` +} + +// NewPublicGatewayIdentityPublicGatewayIdentityByHref : Instantiate PublicGatewayIdentityPublicGatewayIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByHref(href string) (_model *PublicGatewayIdentityPublicGatewayIdentityByHref, err error) { + _model = &PublicGatewayIdentityPublicGatewayIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayIdentityPublicGatewayIdentityByHref) isaPublicGatewayIdentity() bool { + return true +} + +// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByHref from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityPublicGatewayIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentityPublicGatewayIdentityByID : PublicGatewayIdentityPublicGatewayIdentityByID struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityPublicGatewayIdentityByID struct { + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` +} + +// NewPublicGatewayIdentityPublicGatewayIdentityByID : Instantiate PublicGatewayIdentityPublicGatewayIdentityByID (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByID(id string) (_model *PublicGatewayIdentityPublicGatewayIdentityByID, err error) { + _model = &PublicGatewayIdentityPublicGatewayIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayIdentityPublicGatewayIdentityByID) isaPublicGatewayIdentity() bool { + return true +} + +// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByID from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityPublicGatewayIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionIdentityByHref : RegionIdentityByHref struct +// This model "extends" RegionIdentity +type RegionIdentityByHref struct { + // The URL for this region. + Href *string `json:"href" validate:"required"` +} + +// NewRegionIdentityByHref : Instantiate RegionIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRegionIdentityByHref(href string) (_model *RegionIdentityByHref, err error) { + _model = &RegionIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RegionIdentityByHref) isaRegionIdentity() bool { + return true +} + +// UnmarshalRegionIdentityByHref unmarshals an instance of RegionIdentityByHref from the specified map of raw messages. +func UnmarshalRegionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionIdentityByName : RegionIdentityByName struct +// This model "extends" RegionIdentity +type RegionIdentityByName struct { + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` +} + +// NewRegionIdentityByName : Instantiate RegionIdentityByName (Generic Model Constructor) +func (*VpcV1) NewRegionIdentityByName(name string) (_model *RegionIdentityByName, err error) { + _model = &RegionIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RegionIdentityByName) isaRegionIdentity() bool { + return true +} + +// UnmarshalRegionIdentityByName unmarshals an instance of RegionIdentityByName from the specified map of raw messages. +func UnmarshalRegionIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentity : ReservedIPTargetPrototypeEndpointGatewayIdentity struct +// Models which "extend" this model: +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref +// This model "extends" ReservedIPTargetPrototype +type ReservedIPTargetPrototypeEndpointGatewayIdentity struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +type ReservedIPTargetPrototypeEndpointGatewayIdentityIntf interface { + ReservedIPTargetPrototypeIntf + isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentity from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" ReservedIPTargetPrototype +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { + ReservedIPTargetPrototypeIntf + isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetEndpointGatewayReference : ReservedIPTargetEndpointGatewayReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetEndpointGatewayReference struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetEndpointGatewayReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +func (*ReservedIPTargetEndpointGatewayReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetEndpointGatewayReference unmarshals an instance of ReservedIPTargetEndpointGatewayReference from the specified map of raw messages. +func UnmarshalReservedIPTargetEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetEndpointGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetGenericResourceReference : Identifying information for a resource that is not native to the VPC API. +// This model "extends" ReservedIPTarget +type ReservedIPTargetGenericResourceReference struct { + // The CRN for the resource. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *GenericResourceReferenceDeleted `json:"deleted,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetGenericResourceReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetGenericResourceReferenceResourceTypeCloudResourceConst = "cloud_resource" +) + +func (*ReservedIPTargetGenericResourceReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetGenericResourceReference unmarshals an instance of ReservedIPTargetGenericResourceReference from the specified map of raw messages. +func UnmarshalReservedIPTargetGenericResourceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetGenericResourceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalGenericResourceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetLoadBalancerReference : ReservedIPTargetLoadBalancerReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetLoadBalancerReference struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` + + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` + + // The name for this load balancer. The name is unique across all load balancers in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetLoadBalancerReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" +) + +func (*ReservedIPTargetLoadBalancerReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetLoadBalancerReference unmarshals an instance of ReservedIPTargetLoadBalancerReference from the specified map of raw messages. +func UnmarshalReservedIPTargetLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetLoadBalancerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetNetworkInterfaceReferenceTargetContext : ReservedIPTargetNetworkInterfaceReferenceTargetContext struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The name for this network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + ReservedIPTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*ReservedIPTargetNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetVPNGatewayReference : ReservedIPTargetVPNGatewayReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVPNGatewayReference struct { + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetVPNGatewayReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" +) + +func (*ReservedIPTargetVPNGatewayReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetVPNGatewayReference unmarshals an instance of ReservedIPTargetVPNGatewayReference from the specified map of raw messages. +func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetVPNGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetVPNServerReference : ReservedIPTargetVPNServerReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The name for this VPN server. The name is unique across all VPN servers in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetVPNServerReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" +) + +func (*ReservedIPTargetVPNServerReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetVPNServerReference unmarshals an instance of ReservedIPTargetVPNServerReference from the specified map of raw messages. +func UnmarshalReservedIPTargetVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext : ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext.ResourceType property. +// The resource type. +const ( + ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +func (*ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext unmarshals an instance of ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext from the specified map of raw messages. +func UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroupIdentityByID : ResourceGroupIdentityByID struct +// This model "extends" ResourceGroupIdentity +type ResourceGroupIdentityByID struct { + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` +} + +// NewResourceGroupIdentityByID : Instantiate ResourceGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewResourceGroupIdentityByID(id string) (_model *ResourceGroupIdentityByID, err error) { + _model = &ResourceGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ResourceGroupIdentityByID) isaResourceGroupIdentity() bool { + return true +} + +// UnmarshalResourceGroupIdentityByID unmarshals an instance of ResourceGroupIdentityByID from the specified map of raw messages. +func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCreatorVPNGatewayReference : RouteCreatorVPNGatewayReference struct +// This model "extends" RouteCreator +type RouteCreatorVPNGatewayReference struct { + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RouteCreatorVPNGatewayReference.ResourceType property. +// The resource type. +const ( + RouteCreatorVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" +) + +func (*RouteCreatorVPNGatewayReference) isaRouteCreator() bool { + return true +} + +// UnmarshalRouteCreatorVPNGatewayReference unmarshals an instance of RouteCreatorVPNGatewayReference from the specified map of raw messages. +func UnmarshalRouteCreatorVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreatorVPNGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCreatorVPNServerReference : RouteCreatorVPNServerReference struct +// This model "extends" RouteCreator +type RouteCreatorVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The name for this VPN server. The name is unique across all VPN servers in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RouteCreatorVPNServerReference.ResourceType property. +// The resource type. +const ( + RouteCreatorVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" +) + +func (*RouteCreatorVPNServerReference) isaRouteCreator() bool { + return true +} + +// UnmarshalRouteCreatorVPNServerReference unmarshals an instance of RouteCreatorVPNServerReference from the specified map of raw messages. +func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreatorVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopIP : RouteNextHopIP struct +// This model "extends" RouteNextHop +type RouteNextHopIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*RouteNextHopIP) isaRouteNextHop() bool { + return true +} + +// UnmarshalRouteNextHopIP unmarshals an instance of RouteNextHopIP from the specified map of raw messages. +func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchRouteNextHopIP : RouteNextHopPatchRouteNextHopIP struct +// Models which "extend" this model: +// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP +// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP +// This model "extends" RouteNextHopPatch +type RouteNextHopPatchRouteNextHopIP struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` +} + +func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatchRouteNextHopIP() bool { + return true +} + +type RouteNextHopPatchRouteNextHopIPIntf interface { + RouteNextHopPatchIntf + isaRouteNextHopPatchRouteNextHopIP() bool +} + +func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchRouteNextHopIP unmarshals an instance of RouteNextHopPatchRouteNextHopIP from the specified map of raw messages. +func UnmarshalRouteNextHopPatchRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchRouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. +// Models which "extend" this model: +// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID +// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref +// This model "extends" RouteNextHopPatch +type RouteNextHopPatchVPNGatewayConnectionIdentity struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { + return true +} + +type RouteNextHopPatchVPNGatewayConnectionIdentityIntf interface { + RouteNextHopPatchIntf + isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentity from the specified map of raw messages. +func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchVPNGatewayConnectionIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopVPNGatewayConnectionReference : RouteNextHopVPNGatewayConnectionReference struct +// This model "extends" RouteNextHop +type RouteNextHopVPNGatewayConnectionReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RouteNextHopVPNGatewayConnectionReference.ResourceType property. +// The resource type. +const ( + RouteNextHopVPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +func (*RouteNextHopVPNGatewayConnectionReference) isaRouteNextHop() bool { + return true +} + +// UnmarshalRouteNextHopVPNGatewayConnectionReference unmarshals an instance of RouteNextHopVPNGatewayConnectionReference from the specified map of raw messages. +func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopVPNGatewayConnectionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct +// Models which "extend" this model: +// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP +// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP +// This model "extends" RoutePrototypeNextHop +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { + return true +} + +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPIntf interface { + RoutePrototypeNextHopIntf + isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. +// Models which "extend" this model: +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref +// This model "extends" RoutePrototypeNextHop +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityIntf interface { + RoutePrototypeNextHopIntf + isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableIdentityByHref : RoutingTableIdentityByHref struct +// This model "extends" RoutingTableIdentity +type RoutingTableIdentityByHref struct { + // The URL for this routing table. + Href *string `json:"href" validate:"required"` +} + +// NewRoutingTableIdentityByHref : Instantiate RoutingTableIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRoutingTableIdentityByHref(href string) (_model *RoutingTableIdentityByHref, err error) { + _model = &RoutingTableIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutingTableIdentityByHref) isaRoutingTableIdentity() bool { + return true +} + +// UnmarshalRoutingTableIdentityByHref unmarshals an instance of RoutingTableIdentityByHref from the specified map of raw messages. +func UnmarshalRoutingTableIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableIdentityByID : RoutingTableIdentityByID struct +// This model "extends" RoutingTableIdentity +type RoutingTableIdentityByID struct { + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` +} + +// NewRoutingTableIdentityByID : Instantiate RoutingTableIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRoutingTableIdentityByID(id string) (_model *RoutingTableIdentityByID, err error) { + _model = &RoutingTableIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutingTableIdentityByID) isaRoutingTableIdentity() bool { + return true +} + +// UnmarshalRoutingTableIdentityByID unmarshals an instance of RoutingTableIdentityByID from the specified map of raw messages. +func UnmarshalRoutingTableIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentityByCRN : SecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByCRN struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewSecurityGroupIdentityByCRN : Instantiate SecurityGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupIdentityByCRN, err error) { + _model = &SecurityGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupIdentityByCRN) isaSecurityGroupIdentity() bool { + return true +} + +// UnmarshalSecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentityByHref : SecurityGroupIdentityByHref struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByHref struct { + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewSecurityGroupIdentityByHref : Instantiate SecurityGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByHref(href string) (_model *SecurityGroupIdentityByHref, err error) { + _model = &SecurityGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupIdentityByHref) isaSecurityGroupIdentity() bool { + return true +} + +// UnmarshalSecurityGroupIdentityByHref unmarshals an instance of SecurityGroupIdentityByHref from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentityByID : SecurityGroupIdentityByID struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByID struct { + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` +} + +// NewSecurityGroupIdentityByID : Instantiate SecurityGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByID(id string) (_model *SecurityGroupIdentityByID, err error) { + _model = &SecurityGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupIdentityByID) isaSecurityGroupIdentity() bool { + return true +} + +// UnmarshalSecurityGroupIdentityByID unmarshals an instance of SecurityGroupIdentityByID from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The IP addresses or security groups from which this rule will allow traffic (or to which, + // for outbound rules). Can be specified as an IP address, a CIDR block, or a security group + // within the VPC. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllProtocolAllConst = "all" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll, err error) { + _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) isaSecurityGroupRulePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { + // The ICMP traffic code to allow. + // + // If specified, `type` must also be specified. If unspecified, all codes are allowed. + Code *int64 `json:"code,omitempty"` + + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The IP addresses or security groups from which this rule will allow traffic (or to which, + // for outbound rules). Can be specified as an IP address, a CIDR block, or a security group + // within the VPC. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The ICMP traffic type to allow. + // + // If unspecified, all types are allowed. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp, err error) { + _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) isaSecurityGroupRulePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. +// +// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are +// allowed for the protocol. When both have the same value, that single destination port is allowed. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The inclusive upper bound of TCP/UDP destination port range. + // + // If specified, `port_min` must also be specified, and must not be larger. If unspecified, + // `port_min` must also be unspecified, allowing traffic on all destination ports. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range + // + // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be + // unspecified, allowing traffic on all destination ports. + PortMin *int64 `json:"port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The IP addresses or security groups from which this rule will allow traffic (or to which, + // for outbound rules). Can be specified as an IP address, a CIDR block, or a security group + // within the VPC. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp, err error) { + _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRulePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchCIDR : SecurityGroupRuleRemotePatchCIDR struct +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchCIDR : Instantiate SecurityGroupRuleRemotePatchCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePatchCIDR, err error) { + _model = &SecurityGroupRuleRemotePatchCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchCIDR) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchCIDR unmarshals an instance of SecurityGroupRuleRemotePatchCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchIP : SecurityGroupRuleRemotePatchIP struct +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchIP : Instantiate SecurityGroupRuleRemotePatchIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchIP(address string) (_model *SecurityGroupRuleRemotePatchIP, err error) { + _model = &SecurityGroupRuleRemotePatchIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchIP) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchIP unmarshals an instance of SecurityGroupRuleRemotePatchIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentity : Identifies a security group by a unique property. +// Models which "extend" this model: +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchSecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +type SecurityGroupRuleRemotePatchSecurityGroupIdentityIntf interface { + SecurityGroupRuleRemotePatchIntf + isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeCIDR : SecurityGroupRuleRemotePrototypeCIDR struct +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeCIDR : Instantiate SecurityGroupRuleRemotePrototypeCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePrototypeCIDR, err error) { + _model = &SecurityGroupRuleRemotePrototypeCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeCIDR) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeCIDR unmarshals an instance of SecurityGroupRuleRemotePrototypeCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeIP : SecurityGroupRuleRemotePrototypeIP struct +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeIP : Instantiate SecurityGroupRuleRemotePrototypeIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeIP(address string) (_model *SecurityGroupRuleRemotePrototypeIP, err error) { + _model = &SecurityGroupRuleRemotePrototypeIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeIP) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeIP unmarshals an instance of SecurityGroupRuleRemotePrototypeIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentity : Identifies a security group by a unique property. +// Models which "extend" this model: +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentityIntf interface { + SecurityGroupRuleRemotePrototypeIntf + isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemoteCIDR : SecurityGroupRuleRemoteCIDR struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +func (*SecurityGroupRuleRemoteCIDR) isaSecurityGroupRuleRemote() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemoteCIDR unmarshals an instance of SecurityGroupRuleRemoteCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemoteIP : SecurityGroupRuleRemoteIP struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*SecurityGroupRuleRemoteIP) isaSecurityGroupRuleRemote() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemoteIP unmarshals an instance of SecurityGroupRuleRemoteIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemoteSecurityGroupReference : SecurityGroupRuleRemoteSecurityGroupReference struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteSecurityGroupReference struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The name for this security group. The name is unique across all security groups for the VPC. + Name *string `json:"name" validate:"required"` +} + +func (*SecurityGroupRuleRemoteSecurityGroupReference) isaSecurityGroupRuleRemote() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemoteSecurityGroupReference unmarshals an instance of SecurityGroupRuleRemoteSecurityGroupReference from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteSecurityGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` + + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllProtocolAllConst = "all" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolAll) isaSecurityGroupRule() bool { + return true +} + +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolAll from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` + + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The ICMP traffic code to allow. If absent, all codes are allowed. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to allow. If absent, all types are allowed. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolIcmp) isaSecurityGroupRule() bool { + return true +} + +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. +// +// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are +// allowed for the protocol. When both have the same value, that single destination port is allowed. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` + + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + PortMin *int64 `json:"port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRule() bool { + return true +} + +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceEndpointGatewayReference : SecurityGroupTargetReferenceEndpointGatewayReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceEndpointGatewayReference struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceEndpointGatewayReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +func (*SecurityGroupTargetReferenceEndpointGatewayReference) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference unmarshals an instance of SecurityGroupTargetReferenceEndpointGatewayReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceEndpointGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceLoadBalancerReference : SecurityGroupTargetReferenceLoadBalancerReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceLoadBalancerReference struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` + + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` + + // The name for this load balancer. The name is unique across all load balancers in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceLoadBalancerReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" +) + +func (*SecurityGroupTargetReferenceLoadBalancerReference) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceLoadBalancerReference unmarshals an instance of SecurityGroupTargetReferenceLoadBalancerReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceLoadBalancerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The name for this network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceVPNServerReference : SecurityGroupTargetReferenceVPNServerReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The name for this VPN server. The name is unique across all VPN servers in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceVPNServerReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" +) + +func (*SecurityGroupTargetReferenceVPNServerReference) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceVPNServerReference unmarshals an instance of SecurityGroupTargetReferenceVPNServerReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceVirtualNetworkInterfaceReference : SecurityGroupTargetReferenceVirtualNetworkInterfaceReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceVirtualNetworkInterfaceReference struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VirtualNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The primary IP for this virtual network interface. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceVirtualNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceVirtualNetworkInterfaceReferenceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +func (*SecurityGroupTargetReferenceVirtualNetworkInterfaceReference) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference unmarshals an instance of SecurityGroupTargetReferenceVirtualNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceVirtualNetworkInterfaceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareIdentityByCRN : ShareIdentityByCRN struct +// This model "extends" ShareIdentity +type ShareIdentityByCRN struct { + // The CRN for this file share. + CRN *string `json:"crn" validate:"required"` +} + +// NewShareIdentityByCRN : Instantiate ShareIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewShareIdentityByCRN(crn string) (_model *ShareIdentityByCRN, err error) { + _model = &ShareIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareIdentityByCRN) isaShareIdentity() bool { + return true +} + +// UnmarshalShareIdentityByCRN unmarshals an instance of ShareIdentityByCRN from the specified map of raw messages. +func UnmarshalShareIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareIdentityByHref : ShareIdentityByHref struct +// This model "extends" ShareIdentity +type ShareIdentityByHref struct { + // The URL for this file share. + Href *string `json:"href" validate:"required"` +} + +// NewShareIdentityByHref : Instantiate ShareIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewShareIdentityByHref(href string) (_model *ShareIdentityByHref, err error) { + _model = &ShareIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareIdentityByHref) isaShareIdentity() bool { + return true +} + +// UnmarshalShareIdentityByHref unmarshals an instance of ShareIdentityByHref from the specified map of raw messages. +func UnmarshalShareIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareIdentityByID : ShareIdentityByID struct +// This model "extends" ShareIdentity +type ShareIdentityByID struct { + // The unique identifier for this file share. + ID *string `json:"id" validate:"required"` +} + +// NewShareIdentityByID : Instantiate ShareIdentityByID (Generic Model Constructor) +func (*VpcV1) NewShareIdentityByID(id string) (_model *ShareIdentityByID, err error) { + _model = &ShareIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareIdentityByID) isaShareIdentity() bool { + return true +} + +// UnmarshalShareIdentityByID unmarshals an instance of ShareIdentityByID from the specified map of raw messages. +func UnmarshalShareIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : The virtual network interface for this share mount target. The virtual network interface's VPC must not be used by a +// virtual network interface for another mount target for this share. +// +// Required if the share's `access_control_mode` is `security_group`. +// This model "extends" ShareMountTargetPrototype +type ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup struct { + // The name for this share mount target. The name must not be used by another mount target for the file share. + Name *string `json:"name,omitempty"` + + // The transit encryption mode to use for this share mount target: + // - `none`: Not encrypted in transit. + // - `user_managed`: Encrypted in transit using an instance identity certificate. The + // `access_control_mode` for the share must be `security_group`. + TransitEncryption *string `json:"transit_encryption,omitempty"` + + VirtualNetworkInterface VirtualNetworkInterfacePrototypeShareMountTargetContextIntf `json:"virtual_network_interface" validate:"required"` +} + +// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.TransitEncryption property. +// The transit encryption mode to use for this share mount target: +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. The +// `access_control_mode` for the share must be `security_group`. +const ( + ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionNoneConst = "none" + ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionUserManagedConst = "user_managed" +) + +// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(virtualNetworkInterface VirtualNetworkInterfacePrototypeShareMountTargetContextIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup, err error) { + _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup{ + VirtualNetworkInterface: virtualNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) isaShareMountTargetPrototype() bool { + return true +} + +// UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup unmarshals an instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup from the specified map of raw messages. +func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC : The VPC in which clients can mount the file share using this mount target. The VPC must not be used by another mount +// target for this share. +// +// Required if the share's `access_control_mode` is `vpc`. +// This model "extends" ShareMountTargetPrototype +type ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC struct { + // The name for this share mount target. The name must not be used by another mount target for the file share. + Name *string `json:"name,omitempty"` + + // The transit encryption mode to use for this share mount target: + // - `none`: Not encrypted in transit. + // - `user_managed`: Encrypted in transit using an instance identity certificate. The + // `access_control_mode` for the share must be `security_group`. + TransitEncryption *string `json:"transit_encryption,omitempty"` + + // Identifies a VPC by a unique property. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` +} + +// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC.TransitEncryption property. +// The transit encryption mode to use for this share mount target: +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. The +// `access_control_mode` for the share must be `security_group`. +const ( + ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionNoneConst = "none" + ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionUserManagedConst = "user_managed" +) + +// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(vpc VPCIdentityIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC, err error) { + _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC{ + VPC: vpc, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC) isaShareMountTargetPrototype() bool { + return true +} + +// UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC unmarshals an instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC from the specified map of raw messages. +func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the ShareProfileCapacityDependentRange.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityDependentRangeTypeDependentConst = "dependent" + ShareProfileCapacityDependentRangeTypeDependentRangeConst = "dependent_range" +) + +func (*ShareProfileCapacityDependentRange) isaShareProfileCapacity() bool { + return true +} + +// UnmarshalShareProfileCapacityDependentRange unmarshals an instance of ShareProfileCapacityDependentRange from the specified map of raw messages. +func UnmarshalShareProfileCapacityDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacityDependentRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCapacityEnum : The permitted total capacities (in gigabytes) of a share with this profile. +// This model "extends" ShareProfileCapacity +type ShareProfileCapacityEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the ShareProfileCapacityEnum.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityEnumTypeEnumConst = "enum" +) + +func (*ShareProfileCapacityEnum) isaShareProfileCapacity() bool { + return true +} + +// UnmarshalShareProfileCapacityEnum unmarshals an instance of ShareProfileCapacityEnum from the specified map of raw messages. +func UnmarshalShareProfileCapacityEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacityEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCapacityFixed : The permitted total capacity (in gigabytes) of a share with this profile is fixed. +// This model "extends" ShareProfileCapacity +type ShareProfileCapacityFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the ShareProfileCapacityFixed.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityFixedTypeFixedConst = "fixed" +) + +func (*ShareProfileCapacityFixed) isaShareProfileCapacity() bool { + return true +} + +// UnmarshalShareProfileCapacityFixed unmarshals an instance of ShareProfileCapacityFixed from the specified map of raw messages. +func UnmarshalShareProfileCapacityFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacityFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCapacityRange : The permitted total capacity range (in gigabytes) of a share with this profile. +// This model "extends" ShareProfileCapacity +type ShareProfileCapacityRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the ShareProfileCapacityRange.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityRangeTypeRangeConst = "range" +) + +func (*ShareProfileCapacityRange) isaShareProfileCapacity() bool { + return true +} + +// UnmarshalShareProfileCapacityRange unmarshals an instance of ShareProfileCapacityRange from the specified map of raw messages. +func UnmarshalShareProfileCapacityRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacityRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIopsDependentRange : The permitted IOPS range of a share with this profile depends on its configuration. +// This model "extends" ShareProfileIops +type ShareProfileIopsDependentRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the ShareProfileIopsDependentRange.Type property. +// The type for this profile field. +const ( + ShareProfileIopsDependentRangeTypeDependentConst = "dependent" + ShareProfileIopsDependentRangeTypeDependentRangeConst = "dependent_range" +) + +func (*ShareProfileIopsDependentRange) isaShareProfileIops() bool { + return true +} + +// UnmarshalShareProfileIopsDependentRange unmarshals an instance of ShareProfileIopsDependentRange from the specified map of raw messages. +func UnmarshalShareProfileIopsDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIopsDependentRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIopsEnum : The permitted IOPS values of a share with this profile. +// This model "extends" ShareProfileIops +type ShareProfileIopsEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the ShareProfileIopsEnum.Type property. +// The type for this profile field. +const ( + ShareProfileIopsEnumTypeEnumConst = "enum" +) + +func (*ShareProfileIopsEnum) isaShareProfileIops() bool { + return true +} + +// UnmarshalShareProfileIopsEnum unmarshals an instance of ShareProfileIopsEnum from the specified map of raw messages. +func UnmarshalShareProfileIopsEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIopsEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIopsFixed : The permitted IOPS of a share with this profile is fixed. +// This model "extends" ShareProfileIops +type ShareProfileIopsFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the ShareProfileIopsFixed.Type property. +// The type for this profile field. +const ( + ShareProfileIopsFixedTypeFixedConst = "fixed" +) + +func (*ShareProfileIopsFixed) isaShareProfileIops() bool { + return true +} + +// UnmarshalShareProfileIopsFixed unmarshals an instance of ShareProfileIopsFixed from the specified map of raw messages. +func UnmarshalShareProfileIopsFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIopsFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIopsRange : The permitted IOPS range of a share with this profile. +// This model "extends" ShareProfileIops +type ShareProfileIopsRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the ShareProfileIopsRange.Type property. +// The type for this profile field. +const ( + ShareProfileIopsRangeTypeRangeConst = "range" +) + +func (*ShareProfileIopsRange) isaShareProfileIops() bool { + return true +} + +// UnmarshalShareProfileIopsRange unmarshals an instance of ShareProfileIopsRange from the specified map of raw messages. +func UnmarshalShareProfileIopsRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIopsRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIdentityByHref : ShareProfileIdentityByHref struct +// This model "extends" ShareProfileIdentity +type ShareProfileIdentityByHref struct { + // The URL for this share profile. + Href *string `json:"href" validate:"required"` +} + +// NewShareProfileIdentityByHref : Instantiate ShareProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewShareProfileIdentityByHref(href string) (_model *ShareProfileIdentityByHref, err error) { + _model = &ShareProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareProfileIdentityByHref) isaShareProfileIdentity() bool { + return true +} + +// UnmarshalShareProfileIdentityByHref unmarshals an instance of ShareProfileIdentityByHref from the specified map of raw messages. +func UnmarshalShareProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIdentityByName : ShareProfileIdentityByName struct +// This model "extends" ShareProfileIdentity +type ShareProfileIdentityByName struct { + // The globally unique name for this share profile. + Name *string `json:"name" validate:"required"` +} + +// NewShareProfileIdentityByName : Instantiate ShareProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewShareProfileIdentityByName(name string) (_model *ShareProfileIdentityByName, err error) { + _model = &ShareProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareProfileIdentityByName) isaShareProfileIdentity() bool { + return true +} + +// UnmarshalShareProfileIdentityByName unmarshals an instance of ShareProfileIdentityByName from the specified map of raw messages. +func UnmarshalShareProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SharePrototypeShareBySize : Create a file share by size. +// This model "extends" SharePrototype +type SharePrototypeShareBySize struct { + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the `custom` or + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each host accessing the share will be restricted to 48000 IOPS. + Iops *int64 `json:"iops,omitempty"` + + // The mount targets for the file share. Each mount target must be in a unique VPC. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` + + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use for this file share. The + // profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` + + ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this file share will reside in. For a replica share, this must be a different zone in the same region as + // the source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The access control mode for the share: + // + // - `security_group`: The security groups on the virtual network interface for a + // mount target control access to the mount target. Mount targets for this share + // require a virtual network interface. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // Mount targets for this share require a VPC. + AccessControlMode *string `json:"access_control_mode,omitempty"` + + // The root key to use to wrap the data encryption key for the share. + // + // If unspecified, the `encryption` type for the share will be `provider_managed`. + // + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The owner assigned to the file share at creation. Subsequent changes to the owner + // must be performed by a client that has mounted the file share. + InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The size of the file share rounded up to the next gigabyte. + // + // The maximum size for a share may increase in the future. + Size *int64 `json:"size" validate:"required"` +} + +// Constants associated with the SharePrototypeShareBySize.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a +// mount target control access to the mount target. Mount targets for this share +// require a virtual network interface. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// Mount targets for this share require a VPC. +const ( + SharePrototypeShareBySizeAccessControlModeSecurityGroupConst = "security_group" + SharePrototypeShareBySizeAccessControlModeVPCConst = "vpc" +) + +// NewSharePrototypeShareBySize : Instantiate SharePrototypeShareBySize (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareBySize(profile ShareProfileIdentityIntf, zone ZoneIdentityIntf, size int64) (_model *SharePrototypeShareBySize, err error) { + _model = &SharePrototypeShareBySize{ + Profile: profile, + Zone: zone, + Size: core.Int64Ptr(size), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SharePrototypeShareBySize) isaSharePrototype() bool { + return true +} + +// UnmarshalSharePrototypeShareBySize unmarshals an instance of SharePrototypeShareBySize from the specified map of raw messages. +func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototypeShareBySize) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SharePrototypeShareBySourceShare : Create a replica file share for an existing file share. The values for +// `access_control_mode`, `encryption_key`, `initial_owner`, and `size` will be inherited from `source_share`. +// This model "extends" SharePrototype +type SharePrototypeShareBySourceShare struct { + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the `custom` or + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each host accessing the share will be restricted to 48000 IOPS. + Iops *int64 `json:"iops,omitempty"` + + // The mount targets for the file share. Each mount target must be in a unique VPC. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` + + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use for this file share. The + // profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` + + ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this file share will reside in. For a replica share, this must be a different zone in the same region as + // the source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The cron specification for the file share replication schedule. + // + // Replication of a share can be scheduled to occur at most once per hour. + ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"` + + // The resource group to use. If unspecified, the resource group from + // the source share will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The source file share for this replica file share. The specified file share must not + // already have a replica, and must not be a replica. + SourceShare ShareIdentityIntf `json:"source_share" validate:"required"` +} + +// NewSharePrototypeShareBySourceShare : Instantiate SharePrototypeShareBySourceShare (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareBySourceShare(profile ShareProfileIdentityIntf, zone ZoneIdentityIntf, replicationCronSpec string, sourceShare ShareIdentityIntf) (_model *SharePrototypeShareBySourceShare, err error) { + _model = &SharePrototypeShareBySourceShare{ + Profile: profile, + Zone: zone, + ReplicationCronSpec: core.StringPtr(replicationCronSpec), + SourceShare: sourceShare, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SharePrototypeShareBySourceShare) isaSharePrototype() bool { + return true +} + +// UnmarshalSharePrototypeShareBySourceShare unmarshals an instance of SharePrototypeShareBySourceShare from the specified map of raw messages. +func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototypeShareBySourceShare) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotIdentityByCRN : SnapshotIdentityByCRN struct +// This model "extends" SnapshotIdentity +type SnapshotIdentityByCRN struct { + // The CRN of this snapshot. + CRN *string `json:"crn" validate:"required"` +} + +// NewSnapshotIdentityByCRN : Instantiate SnapshotIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSnapshotIdentityByCRN(crn string) (_model *SnapshotIdentityByCRN, err error) { + _model = &SnapshotIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotIdentityByCRN) isaSnapshotIdentity() bool { + return true +} + +// UnmarshalSnapshotIdentityByCRN unmarshals an instance of SnapshotIdentityByCRN from the specified map of raw messages. +func UnmarshalSnapshotIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotIdentityByHref : SnapshotIdentityByHref struct +// This model "extends" SnapshotIdentity +type SnapshotIdentityByHref struct { + // The URL for this snapshot. + Href *string `json:"href" validate:"required"` +} + +// NewSnapshotIdentityByHref : Instantiate SnapshotIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSnapshotIdentityByHref(href string) (_model *SnapshotIdentityByHref, err error) { + _model = &SnapshotIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotIdentityByHref) isaSnapshotIdentity() bool { + return true +} + +// UnmarshalSnapshotIdentityByHref unmarshals an instance of SnapshotIdentityByHref from the specified map of raw messages. +func UnmarshalSnapshotIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotIdentityByID : SnapshotIdentityByID struct +// This model "extends" SnapshotIdentity +type SnapshotIdentityByID struct { + // The unique identifier for this snapshot. + ID *string `json:"id" validate:"required"` +} + +// NewSnapshotIdentityByID : Instantiate SnapshotIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSnapshotIdentityByID(id string) (_model *SnapshotIdentityByID, err error) { + _model = &SnapshotIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotIdentityByID) isaSnapshotIdentity() bool { + return true +} + +// UnmarshalSnapshotIdentityByID unmarshals an instance of SnapshotIdentityByID from the specified map of raw messages. +func UnmarshalSnapshotIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotPrototypeSnapshotBySourceSnapshot : SnapshotPrototypeSnapshotBySourceSnapshot struct +// This model "extends" SnapshotPrototype +type SnapshotPrototypeSnapshotBySourceSnapshot struct { + // Clones to create for this snapshot. + Clones []SnapshotClonePrototype `json:"clones,omitempty"` + + // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` + + // The root key to use to wrap the data encryption key for this snapshot. + // + // A key must be specified if and only if the source snapshot has an `encryption` type of + // `user_managed`. To maximize snapshot availability and sharing of snapshot data, specify + // a key in the same region as the new snapshot, and use the same encryption key for all + // snapshots using the same source volume. + // + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The source snapshot (in another region) to create this snapshot from. + // The specified snapshot must not already be the source of another snapshot in this + // region. + SourceSnapshot *SnapshotIdentityByCRN `json:"source_snapshot" validate:"required"` +} + +// NewSnapshotPrototypeSnapshotBySourceSnapshot : Instantiate SnapshotPrototypeSnapshotBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceSnapshot(sourceSnapshot *SnapshotIdentityByCRN) (_model *SnapshotPrototypeSnapshotBySourceSnapshot, err error) { + _model = &SnapshotPrototypeSnapshotBySourceSnapshot{ + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotPrototypeSnapshotBySourceSnapshot) isaSnapshotPrototype() bool { + return true +} + +// UnmarshalSnapshotPrototypeSnapshotBySourceSnapshot unmarshals an instance of SnapshotPrototypeSnapshotBySourceSnapshot from the specified map of raw messages. +func UnmarshalSnapshotPrototypeSnapshotBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPrototypeSnapshotBySourceSnapshot) + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotPrototypeSnapshotBySourceVolume : SnapshotPrototypeSnapshotBySourceVolume struct +// This model "extends" SnapshotPrototype +type SnapshotPrototypeSnapshotBySourceVolume struct { + // Clones to create for this snapshot. + Clones []SnapshotClonePrototype `json:"clones,omitempty"` + + // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` + + // The volume to create this snapshot from. + SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` +} + +// NewSnapshotPrototypeSnapshotBySourceVolume : Instantiate SnapshotPrototypeSnapshotBySourceVolume (Generic Model Constructor) +func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceVolume(sourceVolume VolumeIdentityIntf) (_model *SnapshotPrototypeSnapshotBySourceVolume, err error) { + _model = &SnapshotPrototypeSnapshotBySourceVolume{ + SourceVolume: sourceVolume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotPrototypeSnapshotBySourceVolume) isaSnapshotPrototype() bool { + return true +} + +// UnmarshalSnapshotPrototypeSnapshotBySourceVolume unmarshals an instance of SnapshotPrototypeSnapshotBySourceVolume from the specified map of raw messages. +func UnmarshalSnapshotPrototypeSnapshotBySourceVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPrototypeSnapshotBySourceVolume) + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentityByCRN : SubnetIdentityByCRN struct +// This model "extends" SubnetIdentity +type SubnetIdentityByCRN struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` +} + +// NewSubnetIdentityByCRN : Instantiate SubnetIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSubnetIdentityByCRN(crn string) (_model *SubnetIdentityByCRN, err error) { + _model = &SubnetIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetIdentityByCRN) isaSubnetIdentity() bool { + return true +} + +// UnmarshalSubnetIdentityByCRN unmarshals an instance of SubnetIdentityByCRN from the specified map of raw messages. +func UnmarshalSubnetIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentityByHref : SubnetIdentityByHref struct +// This model "extends" SubnetIdentity +type SubnetIdentityByHref struct { + // The URL for this subnet. + Href *string `json:"href" validate:"required"` +} + +// NewSubnetIdentityByHref : Instantiate SubnetIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSubnetIdentityByHref(href string) (_model *SubnetIdentityByHref, err error) { + _model = &SubnetIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetIdentityByHref) isaSubnetIdentity() bool { + return true +} + +// UnmarshalSubnetIdentityByHref unmarshals an instance of SubnetIdentityByHref from the specified map of raw messages. +func UnmarshalSubnetIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentityByID : SubnetIdentityByID struct +// This model "extends" SubnetIdentity +type SubnetIdentityByID struct { + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` +} + +// NewSubnetIdentityByID : Instantiate SubnetIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSubnetIdentityByID(id string) (_model *SubnetIdentityByID, err error) { + _model = &SubnetIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetIdentityByID) isaSubnetIdentity() bool { + return true +} + +// UnmarshalSubnetIdentityByID unmarshals an instance of SubnetIdentityByID from the specified map of raw messages. +func UnmarshalSubnetIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPrototypeSubnetByCIDR : SubnetPrototypeSubnetByCIDR struct +// This model "extends" SubnetPrototype +type SubnetPrototypeSubnetByCIDR struct { + // The IP version(s) to support for this subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a + // hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. If unspecified, the default network ACL for the VPC is used. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be + // attached to a public gateway. + PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing + // table properties `route_direct_link_ingress`, + // `route_internet_ingress`, `route_transit_gateway_ingress`, and + // `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` + + // The VPC the subnet will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The IPv4 range of the subnet, expressed in CIDR format. The prefix length of the subnet's CIDR must be between `/9` + // (8,388,608 addresses) and `/29` (8 addresses). The IPv4 range of the subnet's CIDR must fall within an existing + // address prefix in the VPC and must not overlap with any existing subnet. The subnet will be created in the zone of + // the address prefix that contains the IPv4 CIDR. If zone is specified, it must match the zone of the address prefix + // that contains the subnet's IPv4 CIDR. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` + + // The zone this subnet will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// Constants associated with the SubnetPrototypeSubnetByCIDR.IPVersion property. +// The IP version(s) to support for this subnet. +const ( + SubnetPrototypeSubnetByCIDRIPVersionIpv4Const = "ipv4" +) + +// NewSubnetPrototypeSubnetByCIDR : Instantiate SubnetPrototypeSubnetByCIDR (Generic Model Constructor) +func (*VpcV1) NewSubnetPrototypeSubnetByCIDR(vpc VPCIdentityIntf, ipv4CIDRBlock string) (_model *SubnetPrototypeSubnetByCIDR, err error) { + _model = &SubnetPrototypeSubnetByCIDR{ + VPC: vpc, + Ipv4CIDRBlock: core.StringPtr(ipv4CIDRBlock), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPrototypeSubnetByCIDR) isaSubnetPrototype() bool { + return true +} + +// UnmarshalSubnetPrototypeSubnetByCIDR unmarshals an instance of SubnetPrototypeSubnetByCIDR from the specified map of raw messages. +func UnmarshalSubnetPrototypeSubnetByCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPrototypeSubnetByCIDR) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPrototypeSubnetByTotalCount : SubnetPrototypeSubnetByTotalCount struct +// This model "extends" SubnetPrototype +type SubnetPrototypeSubnetByTotalCount struct { + // The IP version(s) to support for this subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a + // hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. If unspecified, the default network ACL for the VPC is used. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be + // attached to a public gateway. + PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing + // table properties `route_direct_link_ingress`, + // `route_internet_ingress`, `route_transit_gateway_ingress`, and + // `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` + + // The VPC the subnet will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the + // specified zone, and that prefix must have a free CIDR range with at least this number of addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` + + // The zone this subnet will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// Constants associated with the SubnetPrototypeSubnetByTotalCount.IPVersion property. +// The IP version(s) to support for this subnet. +const ( + SubnetPrototypeSubnetByTotalCountIPVersionIpv4Const = "ipv4" +) + +// NewSubnetPrototypeSubnetByTotalCount : Instantiate SubnetPrototypeSubnetByTotalCount (Generic Model Constructor) +func (*VpcV1) NewSubnetPrototypeSubnetByTotalCount(vpc VPCIdentityIntf, totalIpv4AddressCount int64, zone ZoneIdentityIntf) (_model *SubnetPrototypeSubnetByTotalCount, err error) { + _model = &SubnetPrototypeSubnetByTotalCount{ + VPC: vpc, + TotalIpv4AddressCount: core.Int64Ptr(totalIpv4AddressCount), + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPrototypeSubnetByTotalCount) isaSubnetPrototype() bool { + return true +} + +// UnmarshalSubnetPrototypeSubnetByTotalCount unmarshals an instance of SubnetPrototypeSubnetByTotalCount from the specified map of raw messages. +func UnmarshalSubnetPrototypeSubnetByTotalCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPrototypeSubnetByTotalCount) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPublicGatewayPatchPublicGatewayIdentityByCRN : SubnetPublicGatewayPatchPublicGatewayIdentityByCRN struct +// This model "extends" SubnetPublicGatewayPatch +type SubnetPublicGatewayPatchPublicGatewayIdentityByCRN struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` +} + +// NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(crn string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByCRN, err error) { + _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPublicGatewayPatchPublicGatewayIdentityByCRN) isaSubnetPublicGatewayPatch() bool { + return true +} + +// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByCRN unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByCRN from the specified map of raw messages. +func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPublicGatewayPatchPublicGatewayIdentityByHref : SubnetPublicGatewayPatchPublicGatewayIdentityByHref struct +// This model "extends" SubnetPublicGatewayPatch +type SubnetPublicGatewayPatchPublicGatewayIdentityByHref struct { + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` +} + +// NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref(href string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByHref, err error) { + _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPublicGatewayPatchPublicGatewayIdentityByHref) isaSubnetPublicGatewayPatch() bool { + return true +} + +// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByHref unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByHref from the specified map of raw messages. +func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPublicGatewayPatchPublicGatewayIdentityByID : SubnetPublicGatewayPatchPublicGatewayIdentityByID struct +// This model "extends" SubnetPublicGatewayPatch +type SubnetPublicGatewayPatchPublicGatewayIdentityByID struct { + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` +} + +// NewSubnetPublicGatewayPatchPublicGatewayIdentityByID : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByID(id string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByID, err error) { + _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPublicGatewayPatchPublicGatewayIdentityByID) isaSubnetPublicGatewayPatch() bool { + return true +} + +// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByID unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByID from the specified map of raw messages. +func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfileIdentityTrustedProfileByCRN : TrustedProfileIdentityTrustedProfileByCRN struct +// This model "extends" TrustedProfileIdentity +type TrustedProfileIdentityTrustedProfileByCRN struct { + // The CRN for this trusted profile. + CRN *string `json:"crn" validate:"required"` +} + +// NewTrustedProfileIdentityTrustedProfileByCRN : Instantiate TrustedProfileIdentityTrustedProfileByCRN (Generic Model Constructor) +func (*VpcV1) NewTrustedProfileIdentityTrustedProfileByCRN(crn string) (_model *TrustedProfileIdentityTrustedProfileByCRN, err error) { + _model = &TrustedProfileIdentityTrustedProfileByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*TrustedProfileIdentityTrustedProfileByCRN) isaTrustedProfileIdentity() bool { + return true +} + +// UnmarshalTrustedProfileIdentityTrustedProfileByCRN unmarshals an instance of TrustedProfileIdentityTrustedProfileByCRN from the specified map of raw messages. +func UnmarshalTrustedProfileIdentityTrustedProfileByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TrustedProfileIdentityTrustedProfileByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfileIdentityTrustedProfileByID : TrustedProfileIdentityTrustedProfileByID struct +// This model "extends" TrustedProfileIdentity +type TrustedProfileIdentityTrustedProfileByID struct { + // The unique identifier for this trusted profile. + ID *string `json:"id" validate:"required"` +} + +// NewTrustedProfileIdentityTrustedProfileByID : Instantiate TrustedProfileIdentityTrustedProfileByID (Generic Model Constructor) +func (*VpcV1) NewTrustedProfileIdentityTrustedProfileByID(id string) (_model *TrustedProfileIdentityTrustedProfileByID, err error) { + _model = &TrustedProfileIdentityTrustedProfileByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*TrustedProfileIdentityTrustedProfileByID) isaTrustedProfileIdentity() bool { + return true +} + +// UnmarshalTrustedProfileIdentityTrustedProfileByID unmarshals an instance of TrustedProfileIdentityTrustedProfileByID from the specified map of raw messages. +func UnmarshalTrustedProfileIdentityTrustedProfileByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TrustedProfileIdentityTrustedProfileByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentityByCRN : VPCIdentityByCRN struct +// This model "extends" VPCIdentity +type VPCIdentityByCRN struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` +} + +// NewVPCIdentityByCRN : Instantiate VPCIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVPCIdentityByCRN(crn string) (_model *VPCIdentityByCRN, err error) { + _model = &VPCIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPCIdentityByCRN) isaVPCIdentity() bool { + return true +} + +// UnmarshalVPCIdentityByCRN unmarshals an instance of VPCIdentityByCRN from the specified map of raw messages. +func UnmarshalVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentityByHref : VPCIdentityByHref struct +// This model "extends" VPCIdentity +type VPCIdentityByHref struct { + // The URL for this VPC. + Href *string `json:"href" validate:"required"` +} + +// NewVPCIdentityByHref : Instantiate VPCIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPCIdentityByHref(href string) (_model *VPCIdentityByHref, err error) { + _model = &VPCIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPCIdentityByHref) isaVPCIdentity() bool { + return true +} + +// UnmarshalVPCIdentityByHref unmarshals an instance of VPCIdentityByHref from the specified map of raw messages. +func UnmarshalVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentityByID : VPCIdentityByID struct +// This model "extends" VPCIdentity +type VPCIdentityByID struct { + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` +} + +// NewVPCIdentityByID : Instantiate VPCIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPCIdentityByID(id string) (_model *VPCIdentityByID, err error) { + _model = &VPCIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPCIdentityByID) isaVPCIdentity() bool { + return true +} + +// UnmarshalVPCIdentityByID unmarshals an instance of VPCIdentityByID from the specified map of raw messages. +func UnmarshalVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct +// This model "extends" VPNGatewayConnectionIkePolicyPatch +type VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct { + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref : Instantiate VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref, err error) { + _model = &VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref) isaVPNGatewayConnectionIkePolicyPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID : VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID struct +// This model "extends" VPNGatewayConnectionIkePolicyPatch +type VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID struct { + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` +} + +// NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID : Instantiate VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(id string) (_model *VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID, err error) { + _model = &VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) isaVPNGatewayConnectionIkePolicyPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct +// This model "extends" VPNGatewayConnectionIkePolicyPrototype +type VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct { + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref : Instantiate VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref, err error) { + _model = &VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref) isaVPNGatewayConnectionIkePolicyPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID : VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID struct +// This model "extends" VPNGatewayConnectionIkePolicyPrototype +type VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID struct { + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` +} + +// NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID : Instantiate VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(id string) (_model *VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID, err error) { + _model = &VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) isaVPNGatewayConnectionIkePolicyPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref : VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref struct +// This model "extends" VPNGatewayConnectionIPsecPolicyPatch +type VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref struct { + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref : Instantiate VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref, err error) { + _model = &VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref) isaVPNGatewayConnectionIPsecPolicyPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID : VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID struct +// This model "extends" VPNGatewayConnectionIPsecPolicyPatch +type VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` +} + +// NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID : Instantiate VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(id string) (_model *VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID, err error) { + _model = &VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) isaVPNGatewayConnectionIPsecPolicyPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref : VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct +// This model "extends" VPNGatewayConnectionIPsecPolicyPrototype +type VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct { + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref : Instantiate VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref, err error) { + _model = &VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID : VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID struct +// This model "extends" VPNGatewayConnectionIPsecPolicyPrototype +type VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` +} + +// NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID : Instantiate VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(id string) (_model *VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID, err error) { + _model = &VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch : VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch struct +// This model "extends" VPNGatewayConnectionPatch +type VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"` + + IkePolicy VPNGatewayConnectionIkePolicyPatchIntf `json:"ike_policy,omitempty"` + + IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"` + + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address,omitempty"` + + // The preshared key. + Psk *string `json:"psk,omitempty"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatchRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) isaVPNGatewayConnectionPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch unmarshals an instance of VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch +func (vpnGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch *VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpnGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// VPNGatewayConnectionPolicyMode : VPNGatewayConnectionPolicyMode struct +// This model "extends" VPNGatewayConnection +type VPNGatewayConnectionPolicyMode struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // The local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs" validate:"required"` + + // The peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionPolicyMode.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionPolicyModeAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnectionPolicyMode.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionPolicyModeModePolicyConst = "policy" + VPNGatewayConnectionPolicyModeModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnectionPolicyMode.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionPolicyModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnectionPolicyMode.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionPolicyModeStatusDownConst = "down" + VPNGatewayConnectionPolicyModeStatusUpConst = "up" +) + +func (*VPNGatewayConnectionPolicyMode) isaVPNGatewayConnection() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPolicyMode unmarshals an instance of VPNGatewayConnectionPolicyMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyMode) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct +// This model "extends" VPNGatewayConnectionPrototype +type VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` + + IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` + + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // The local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs" validate:"required"` + + // The peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs" validate:"required"` +} + +// NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(peerAddress string, psk string, localCIDRs []string, peerCIDRs []string) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype, err error) { + _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype{ + PeerAddress: core.StringPtr(peerAddress), + Psk: core.StringPtr(psk), + LocalCIDRs: localCIDRs, + PeerCIDRs: peerCIDRs, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) isaVPNGatewayConnectionPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype struct +// This model "extends" VPNGatewayConnectionPrototype +type VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` + + IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` + + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototypeRoutingProtocolNoneConst = "none" +) + +// NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(peerAddress string, psk string) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype, err error) { + _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype{ + PeerAddress: core.StringPtr(peerAddress), + Psk: core.StringPtr(psk), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) isaVPNGatewayConnectionPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionStaticRouteMode struct +// This model "extends" VPNGatewayConnection +type VPNGatewayConnectionStaticRouteMode struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol" validate:"required"` + + // The VPN tunnel configuration for this VPN gateway connection (in static route mode). + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionStaticRouteModeModePolicyConst = "policy" + VPNGatewayConnectionStaticRouteModeModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionStaticRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionStaticRouteModeStatusDownConst = "down" + VPNGatewayConnectionStaticRouteModeStatusUpConst = "up" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionStaticRouteModeRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnection() bool { + return true +} + +// UnmarshalVPNGatewayConnectionStaticRouteMode unmarshals an instance of VPNGatewayConnectionStaticRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteMode) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPolicyMode : VPNGatewayPolicyMode struct +// This model "extends" VPNGateway +type VPNGatewayPolicyMode struct { + // Connections for this VPN gateway. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The 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"` + + // The status of the VPN gateway. + Status *string `json:"status" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The VPC this VPN gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // Policy mode VPN gateway. + Mode *string `json:"mode" validate:"required"` +} + +// Constants associated with the VPNGatewayPolicyMode.ResourceType property. +// The resource type. +const ( + VPNGatewayPolicyModeResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGatewayPolicyMode.Status property. +// The status of the VPN gateway. +const ( + VPNGatewayPolicyModeStatusAvailableConst = "available" + VPNGatewayPolicyModeStatusDeletingConst = "deleting" + VPNGatewayPolicyModeStatusFailedConst = "failed" + VPNGatewayPolicyModeStatusPendingConst = "pending" +) + +// Constants associated with the VPNGatewayPolicyMode.Mode property. +// Policy mode VPN gateway. +const ( + VPNGatewayPolicyModeModePolicyConst = "policy" +) + +func (*VPNGatewayPolicyMode) isaVPNGateway() bool { + return true +} + +// UnmarshalVPNGatewayPolicyMode unmarshals an instance of VPNGatewayPolicyMode from the specified map of raw messages. +func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPolicyMode) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPrototypeVPNGatewayPolicyModePrototype : VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct +// This model "extends" VPNGatewayPrototype +type VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct { + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Policy mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototypeVPNGatewayPolicyModePrototype.Mode property. +// Policy mode VPN gateway. +const ( + VPNGatewayPrototypeVPNGatewayPolicyModePrototypeModePolicyConst = "policy" +) + +// NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayPolicyModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayPolicyModePrototype, err error) { + _model = &VPNGatewayPrototypeVPNGatewayPolicyModePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayPrototypeVPNGatewayPolicyModePrototype) isaVPNGatewayPrototype() bool { + return true +} + +// UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayPolicyModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototypeVPNGatewayPolicyModePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPrototypeVPNGatewayRouteModePrototype : VPNGatewayPrototypeVPNGatewayRouteModePrototype struct +// This model "extends" VPNGatewayPrototype +type VPNGatewayPrototypeVPNGatewayRouteModePrototype struct { + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototypeVPNGatewayRouteModePrototype.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayPrototypeVPNGatewayRouteModePrototypeModeRouteConst = "route" +) + +// NewVPNGatewayPrototypeVPNGatewayRouteModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayRouteModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayRouteModePrototype, err error) { + _model = &VPNGatewayPrototypeVPNGatewayRouteModePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayPrototypeVPNGatewayRouteModePrototype) isaVPNGatewayPrototype() bool { + return true +} + +// UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayRouteModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototypeVPNGatewayRouteModePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayRouteMode : VPNGatewayRouteMode struct +// This model "extends" VPNGateway +type VPNGatewayRouteMode struct { + // Connections for this VPN gateway. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The 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"` + + // The status of the VPN gateway. + Status *string `json:"status" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The VPC this VPN gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode" validate:"required"` +} + +// Constants associated with the VPNGatewayRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayRouteModeResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGatewayRouteMode.Status property. +// The status of the VPN gateway. +const ( + VPNGatewayRouteModeStatusAvailableConst = "available" + VPNGatewayRouteModeStatusDeletingConst = "deleting" + VPNGatewayRouteModeStatusFailedConst = "failed" + VPNGatewayRouteModeStatusPendingConst = "pending" +) + +// Constants associated with the VPNGatewayRouteMode.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayRouteModeModeRouteConst = "route" +) + +func (*VPNGatewayRouteMode) isaVPNGateway() bool { + return true +} + +// UnmarshalVPNGatewayRouteMode unmarshals an instance of VPNGatewayRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayRouteMode) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByCertificate : VPNServerAuthenticationByCertificate struct +// This model "extends" VPNServerAuthentication +type VPNServerAuthenticationByCertificate struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The certificate instance used for the VPN client certificate authority (CA). + ClientCa *CertificateInstanceReference `json:"client_ca" validate:"required"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationByCertificate.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationByCertificateMethodCertificateConst = "certificate" + VPNServerAuthenticationByCertificateMethodUsernameConst = "username" +) + +func (*VPNServerAuthenticationByCertificate) isaVPNServerAuthentication() bool { + return true +} + +// UnmarshalVPNServerAuthenticationByCertificate unmarshals an instance of VPNServerAuthenticationByCertificate from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByCertificate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByCertificate) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByUsername : VPNServerAuthenticationByUsername struct +// This model "extends" VPNServerAuthentication +type VPNServerAuthenticationByUsername struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` +} + +// Constants associated with the VPNServerAuthenticationByUsername.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationByUsernameMethodCertificateConst = "certificate" + VPNServerAuthenticationByUsernameMethodUsernameConst = "username" +) + +func (*VPNServerAuthenticationByUsername) isaVPNServerAuthentication() bool { + return true +} + +// UnmarshalVPNServerAuthenticationByUsername unmarshals an instance of VPNServerAuthenticationByUsername from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByUsername(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByUsername) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByUsernameIDProviderByIam : VPNServerAuthenticationByUsernameIDProviderByIam struct +// This model "extends" VPNServerAuthenticationByUsernameIDProvider +type VPNServerAuthenticationByUsernameIDProviderByIam struct { + // The type of identity provider to be used by the VPN client. + // - `iam`: IBM identity and access management + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + ProviderType *string `json:"provider_type" validate:"required"` +} + +// Constants associated with the VPNServerAuthenticationByUsernameIDProviderByIam.ProviderType property. +// The type of identity provider to be used by the VPN client. +// - `iam`: IBM identity and access management +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + VPNServerAuthenticationByUsernameIDProviderByIamProviderTypeIamConst = "iam" +) + +// NewVPNServerAuthenticationByUsernameIDProviderByIam : Instantiate VPNServerAuthenticationByUsernameIDProviderByIam (Generic Model Constructor) +func (*VpcV1) NewVPNServerAuthenticationByUsernameIDProviderByIam(providerType string) (_model *VPNServerAuthenticationByUsernameIDProviderByIam, err error) { + _model = &VPNServerAuthenticationByUsernameIDProviderByIam{ + ProviderType: core.StringPtr(providerType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNServerAuthenticationByUsernameIDProviderByIam) isaVPNServerAuthenticationByUsernameIDProvider() bool { + return true +} + +// UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam unmarshals an instance of VPNServerAuthenticationByUsernameIDProviderByIam from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByUsernameIDProviderByIam) + err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct +// This model "extends" VPNServerAuthenticationPrototype +type VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The certificate instance to use for the VPN client certificate authority (CA). + ClientCa CertificateInstanceIdentityIntf `json:"client_ca" validate:"required"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototypeMethodCertificateConst = "certificate" + VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototypeMethodUsernameConst = "username" +) + +// NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype : Instantiate VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(method string, clientCa CertificateInstanceIdentityIntf) (_model *VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype, err error) { + _model = &VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype{ + Method: core.StringPtr(method), + ClientCa: clientCa, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) isaVPNServerAuthenticationPrototype() bool { + return true +} + +// UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype unmarshals an instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct +// This model "extends" VPNServerAuthenticationPrototype +type VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` +} + +// Constants associated with the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototypeMethodCertificateConst = "certificate" + VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototypeMethodUsernameConst = "username" +) + +// NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype : Instantiate VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(method string, identityProvider VPNServerAuthenticationByUsernameIDProviderIntf) (_model *VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype, err error) { + _model = &VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype{ + Method: core.StringPtr(method), + IdentityProvider: identityProvider, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) isaVPNServerAuthenticationPrototype() bool { + return true +} + +// UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype unmarshals an instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext : Identifies a reserved IP by a unique property. The reserved IP must be currently unbound and in the same subnet as +// the primary IP. +// Models which "extend" this model: +// - VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID +// - VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref +// This model "extends" VirtualNetworkInterfaceIPsReservedIPPrototype +type VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext 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 (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { + return true +} + +type VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextIntf interface { + VirtualNetworkInterfaceIPsReservedIPPrototypeIntf + isaVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool +} + +func (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPsReservedIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext : The prototype for a new reserved IP. Must be in the same subnet as the primary IP. +// This model "extends" VirtualNetworkInterfaceIPsReservedIPPrototype +type VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext 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 (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPsReservedIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext : 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: +// - VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID +// - VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref +// This model "extends" VirtualNetworkInterfacePrimaryIPReservedIPPrototype +type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext 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 (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { + return true +} + +type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextIntf interface { + VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf + isaVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool +} + +func (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext : The prototype for a new reserved IP. Requires `subnet` to be specified. +// This model "extends" VirtualNetworkInterfacePrimaryIPReservedIPPrototype +type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext 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 (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContext +type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity 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 (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { + return true +} + +type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityIntf interface { + VirtualNetworkInterfacePrototypeAttachmentContextIntf + isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool +} + +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext : The virtual network interface for this target. +// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContext +type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext 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 network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 + // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // same subnet as the primary IP. + // + // 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 []VirtualNetworkInterfaceIPsReservedIPPrototypeIntf `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 VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup VirtualNetworkInterfacePrototypeTargetContextResourceGroupIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP and + // `primary_ip.address` is not specified. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +} + +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalVirtualNetworkInterfacePrototypeTargetContextResourceGroup) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID : VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID struct +// This model "extends" VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup +type VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID struct { + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` +} + +// NewVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID : Instantiate VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID, err error) { + _model = &VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID) isaVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID : VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID struct +// This model "extends" VirtualNetworkInterfacePrototypeResourceGroup +type VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID struct { + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` +} + +// NewVirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID : Instantiate VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID, err error) { + _model = &VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID) isaVirtualNetworkInterfacePrototypeResourceGroup() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" VirtualNetworkInterfacePrototypeShareMountTargetContext +type VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity 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 (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity() bool { + return true +} + +type VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityIntf interface { + VirtualNetworkInterfacePrototypeShareMountTargetContextIntf + isaVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity() bool +} + +func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity unmarshals an instance of VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext : The virtual network interface for this target. +// This model "extends" VirtualNetworkInterfacePrototypeShareMountTargetContext +type VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext 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 network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 + // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // same subnet as the primary IP. + // + // 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 []VirtualNetworkInterfaceIPsReservedIPPrototypeIntf `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 VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP and + // `primary_ip.address` is not specified. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +} + +func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext) isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext unmarshals an instance of VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID : VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID struct +// This model "extends" VirtualNetworkInterfacePrototypeTargetContextResourceGroup +type VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID struct { + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` +} + +// NewVirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID : Instantiate VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID, err error) { + _model = &VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID) isaVirtualNetworkInterfacePrototypeTargetContextResourceGroup() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct +// This model "extends" VirtualNetworkInterfaceTarget +type VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted `json:"deleted,omitempty"` + + // The URL for this network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network attachment. + ID *string `json:"id" validate:"required"` + + 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.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct +// This model "extends" VirtualNetworkInterfaceTarget +type VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted `json:"deleted,omitempty"` + + // The URL for this network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network attachment. + ID *string `json:"id" validate:"required"` + + 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.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceTargetShareMountTargetReference : VirtualNetworkInterfaceTargetShareMountTargetReference struct +// This model "extends" VirtualNetworkInterfaceTarget +type VirtualNetworkInterfaceTargetShareMountTargetReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this share mount target. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this share mount target. + ID *string `json:"id" validate:"required"` + + // The name for this share mount target. The name is unique across all mount targets for the file share. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VirtualNetworkInterfaceTargetShareMountTargetReference.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceTargetShareMountTargetReferenceResourceTypeShareMountTargetConst = "share_mount_target" +) + +func (*VirtualNetworkInterfaceTargetShareMountTargetReference) isaVirtualNetworkInterfaceTarget() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference unmarshals an instance of VirtualNetworkInterfaceTargetShareMountTargetReference from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceTargetShareMountTargetReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumeIdentity : Identifies a volume by a unique property. +// Models which "extend" this model: +// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID +// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN +// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref +// This model "extends" VolumeAttachmentPrototypeVolume +type VolumeAttachmentPrototypeVolumeVolumeIdentity struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentity) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { + return true +} + +type VolumeAttachmentPrototypeVolumeVolumeIdentityIntf interface { + VolumeAttachmentPrototypeVolumeIntf + isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentity) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentity from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct +// Models which "extend" this model: +// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity +// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot +// This model "extends" VolumeAttachmentPrototypeVolume +type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use for this volume. If unspecified, the instance's resource group + // will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { + return true +} + +type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextIntf interface { + VolumeAttachmentPrototypeVolumeIntf + isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentityByCRN : VolumeIdentityByCRN struct +// This model "extends" VolumeIdentity +type VolumeIdentityByCRN struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` +} + +// NewVolumeIdentityByCRN : Instantiate VolumeIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVolumeIdentityByCRN(crn string) (_model *VolumeIdentityByCRN, err error) { + _model = &VolumeIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeIdentityByCRN) isaVolumeIdentity() bool { + return true +} + +// UnmarshalVolumeIdentityByCRN unmarshals an instance of VolumeIdentityByCRN from the specified map of raw messages. +func UnmarshalVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentityByHref : VolumeIdentityByHref struct +// This model "extends" VolumeIdentity +type VolumeIdentityByHref struct { + // The URL for this volume. + Href *string `json:"href" validate:"required"` +} + +// NewVolumeIdentityByHref : Instantiate VolumeIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVolumeIdentityByHref(href string) (_model *VolumeIdentityByHref, err error) { + _model = &VolumeIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeIdentityByHref) isaVolumeIdentity() bool { + return true +} + +// UnmarshalVolumeIdentityByHref unmarshals an instance of VolumeIdentityByHref from the specified map of raw messages. +func UnmarshalVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentityByID : VolumeIdentityByID struct +// This model "extends" VolumeIdentity +type VolumeIdentityByID struct { + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` +} + +// NewVolumeIdentityByID : Instantiate VolumeIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVolumeIdentityByID(id string) (_model *VolumeIdentityByID, err error) { + _model = &VolumeIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeIdentityByID) isaVolumeIdentity() bool { + return true +} + +// UnmarshalVolumeIdentityByID unmarshals an instance of VolumeIdentityByID from the specified map of raw messages. +func UnmarshalVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileIdentityByHref : VolumeProfileIdentityByHref struct +// This model "extends" VolumeProfileIdentity +type VolumeProfileIdentityByHref struct { + // The URL for this volume profile. + Href *string `json:"href" validate:"required"` +} + +// NewVolumeProfileIdentityByHref : Instantiate VolumeProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVolumeProfileIdentityByHref(href string) (_model *VolumeProfileIdentityByHref, err error) { + _model = &VolumeProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeProfileIdentityByHref) isaVolumeProfileIdentity() bool { + return true +} + +// UnmarshalVolumeProfileIdentityByHref unmarshals an instance of VolumeProfileIdentityByHref from the specified map of raw messages. +func UnmarshalVolumeProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileIdentityByName : VolumeProfileIdentityByName struct +// This model "extends" VolumeProfileIdentity +type VolumeProfileIdentityByName struct { + // The globally unique name for this volume profile. + Name *string `json:"name" validate:"required"` +} + +// NewVolumeProfileIdentityByName : Instantiate VolumeProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewVolumeProfileIdentityByName(name string) (_model *VolumeProfileIdentityByName, err error) { + _model = &VolumeProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeProfileIdentityByName) isaVolumeProfileIdentity() bool { + return true +} + +// UnmarshalVolumeProfileIdentityByName unmarshals an instance of VolumeProfileIdentityByName from the specified map of raw messages. +func UnmarshalVolumeProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeVolumeByCapacity : VolumePrototypeVolumeByCapacity struct +// This model "extends" VolumePrototype +type VolumePrototypeVolumeByCapacity struct { + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use for this volume. If unspecified, default 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 zone this volume will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity" validate:"required"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` +} + +// NewVolumePrototypeVolumeByCapacity : Instantiate VolumePrototypeVolumeByCapacity (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeVolumeByCapacity(profile VolumeProfileIdentityIntf, zone ZoneIdentityIntf, capacity int64) (_model *VolumePrototypeVolumeByCapacity, err error) { + _model = &VolumePrototypeVolumeByCapacity{ + Profile: profile, + Zone: zone, + Capacity: core.Int64Ptr(capacity), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumePrototypeVolumeByCapacity) isaVolumePrototype() bool { + return true +} + +// UnmarshalVolumePrototypeVolumeByCapacity unmarshals an instance of VolumePrototypeVolumeByCapacity from the specified map of raw messages. +func UnmarshalVolumePrototypeVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeVolumeByCapacity) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeVolumeBySourceSnapshot : VolumePrototypeVolumeBySourceSnapshot struct +// This model "extends" VolumePrototype +type VolumePrototypeVolumeBySourceSnapshot struct { + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use for this volume. If unspecified, default 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 zone this volume will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's + // `minimum_capacity`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` +} + +// NewVolumePrototypeVolumeBySourceSnapshot : Instantiate VolumePrototypeVolumeBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeVolumeBySourceSnapshot(profile VolumeProfileIdentityIntf, zone ZoneIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumePrototypeVolumeBySourceSnapshot, err error) { + _model = &VolumePrototypeVolumeBySourceSnapshot{ + Profile: profile, + Zone: zone, + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumePrototypeVolumeBySourceSnapshot) isaVolumePrototype() bool { + return true +} + +// UnmarshalVolumePrototypeVolumeBySourceSnapshot unmarshals an instance of VolumePrototypeVolumeBySourceSnapshot from the specified map of raw messages. +func UnmarshalVolumePrototypeVolumeBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeVolumeBySourceSnapshot) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneIdentityByHref : ZoneIdentityByHref struct +// This model "extends" ZoneIdentity +type ZoneIdentityByHref struct { + // The URL for this zone. + Href *string `json:"href" validate:"required"` +} + +// NewZoneIdentityByHref : Instantiate ZoneIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewZoneIdentityByHref(href string) (_model *ZoneIdentityByHref, err error) { + _model = &ZoneIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ZoneIdentityByHref) isaZoneIdentity() bool { + return true +} + +// UnmarshalZoneIdentityByHref unmarshals an instance of ZoneIdentityByHref from the specified map of raw messages. +func UnmarshalZoneIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneIdentityByName : ZoneIdentityByName struct +// This model "extends" ZoneIdentity +type ZoneIdentityByName struct { + // The globally unique name for this zone. + Name *string `json:"name" validate:"required"` +} + +// NewZoneIdentityByName : Instantiate ZoneIdentityByName (Generic Model Constructor) +func (*VpcV1) NewZoneIdentityByName(name string) (_model *ZoneIdentityByName, err error) { + _model = &ZoneIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ZoneIdentityByName) isaZoneIdentity() bool { + return true +} + +// UnmarshalZoneIdentityByName unmarshals an instance of ZoneIdentityByName from the specified map of raw messages. +func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref struct +// This model "extends" EndpointGatewayReservedIPReservedIPIdentity +type EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref : Instantiate EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref(href string) (_model *EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref, err error) { + _model = &EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref) isaEndpointGatewayReservedIPReservedIPIdentity() bool { + return true +} + +func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID : EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID struct +// This model "extends" EndpointGatewayReservedIPReservedIPIdentity +type EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID : Instantiate EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID(id string) (_model *EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID, err error) { + _model = &EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID) isaEndpointGatewayReservedIPReservedIPIdentity() bool { + return true +} + +func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct +// This model "extends" EndpointGatewayTargetPrototypeProviderCloudServiceIdentity +type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +// NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : Instantiate EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(resourceType string, crn string) (_model *EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN, err error) { + _model = &EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN{ + ResourceType: core.StringPtr(resourceType), + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { + return true +} + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : The name of this provider infrastructure service. +// This model "extends" EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity +type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +// NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : Instantiate EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(resourceType string, name string) (_model *EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName, err error) { + _model = &EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName{ + ResourceType: core.StringPtr(resourceType), + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { + return true +} + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity +type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { + // The URL for this network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity +type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity +type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { + // The URL for this network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity +type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity +type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity +type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref struct { + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity +type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref : FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref struct { + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID : FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID struct { + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID : Instantiate FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { + // The URL for this network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity +type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN, err error) { + _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity +type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref struct { + // The URL for this subnet. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity +type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID struct { + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN, err error) { + _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref struct { + // The URL for this VPC. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID struct { + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec struct +// Models which "extend" this model: +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototype +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { + return true +} + +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecIntf interface { + InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf + isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt struct +// Models which "extend" this model: +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototype +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { + return true +} + +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtIntf interface { + InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf + isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionScheduledActionGroupTarget : InstanceGroupManagerActionScheduledActionGroupTarget struct +// This model "extends" InstanceGroupManagerActionScheduledAction +type InstanceGroupManagerActionScheduledActionGroupTarget struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. At present, this is always + // `true`, but may be modifiable in the future. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type" validate:"required"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroup `json:"group" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetStatusActiveConst = "active" + InstanceGroupManagerActionScheduledActionGroupTargetStatusCompletedConst = "completed" + InstanceGroupManagerActionScheduledActionGroupTargetStatusFailedConst = "failed" + InstanceGroupManagerActionScheduledActionGroupTargetStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionScheduledActionGroupTargetStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerActionScheduledAction() bool { + return true +} + +func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerAction() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionGroupTarget from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionScheduledActionGroupTarget) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionScheduledActionManagerTarget : InstanceGroupManagerActionScheduledActionManagerTarget struct +// This model "extends" InstanceGroupManagerActionScheduledAction +type InstanceGroupManagerActionScheduledActionManagerTarget struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. At present, this is always + // `true`, but may be modifiable in the future. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type" validate:"required"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetStatusActiveConst = "active" + InstanceGroupManagerActionScheduledActionManagerTargetStatusCompletedConst = "completed" + InstanceGroupManagerActionScheduledActionManagerTargetStatusFailedConst = "failed" + InstanceGroupManagerActionScheduledActionManagerTargetStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionScheduledActionManagerTargetStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerActionScheduledAction() bool { + return true +} + +func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerAction() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionManagerTarget from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionScheduledActionManagerTarget) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct +// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(href string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref, err error) { + _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { + return true +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct +// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(id string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID, err error) { + _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { + return true +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct { + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct { + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct { + // The CRN for this placement group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct { + // The URL for this placement group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct { + // The unique identifier for this placement group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceByCatalogOffering +type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstancePrototypeInstanceByCatalogOffering() bool { + return true +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceByCatalogOffering +type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment 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 interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstancePrototypeInstanceByCatalogOffering() bool { + return true +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceByImage +type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment{ + Image: image, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstancePrototypeInstanceByImage() bool { + return true +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface : InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceByImage +type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment 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 interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface{ + Image: image, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstancePrototypeInstanceByImage() bool { + return true +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceBySourceSnapshot +type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstancePrototypeInstanceBySourceSnapshot() bool { + return true +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceBySourceSnapshot +type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment 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 interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstancePrototypeInstanceBySourceSnapshot() bool { + return true +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceByVolume +type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) isaInstancePrototypeInstanceByVolume() bool { + return true +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface : InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceByVolume +type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) isaInstancePrototypeInstanceByVolume() bool { + return true +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's 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 interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage +type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment{ + Image: image, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage +type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's 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 interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface{ + Image: image, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceByCatalogOffering +type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplateInstanceByCatalogOffering() bool { + return true +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceByCatalogOffering +type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *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 interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplateInstanceByCatalogOffering() bool { + return true +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment : InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceByImage +type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +func (*InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstanceTemplateInstanceByImage() bool { + return true +} + +func (*InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface : InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceByImage +type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *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 interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +func (*InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstanceTemplateInstanceByImage() bool { + return true +} + +func (*InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceBySourceSnapshot +type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplateInstanceBySourceSnapshot() bool { + return true +} + +func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceBySourceSnapshot +type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as + // SSH authorized keys for the administrative user. + // + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if + // no keys are specified, the instance will be inaccessible unless the specified image provides another means of + // access. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplateInstanceBySourceSnapshot() bool { + return true +} + +func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct { + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(href string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(id string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref : NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref struct +// This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity +type NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref(href string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref, err error) { + _model = &NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { + return true +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref) isaNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID : NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID struct +// This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity +type NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID(id string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID, err error) { + _model = &NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { + return true +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID) isaNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(address string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress, err error) { + _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN struct { + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN(crn string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN, err error) { + _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref struct { + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(href string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref, err error) { + _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID struct { + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(id string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID, err error) { + _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN struct +// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` +} + +// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(crn string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN, err error) { + _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref struct +// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref struct { + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` +} + +// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(href string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref, err error) { + _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID struct +// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` +} + +// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(id string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID, err error) { + _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP : RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct +// This model "extends" RouteNextHopPatchRouteNextHopIP +type RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP : Instantiate RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(address string) (_model *RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP, err error) { + _model = &RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPatchRouteNextHopIP() bool { + return true +} + +func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP unmarshals an instance of RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP from the specified map of raw messages. +func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP : RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct +// This model "extends" RouteNextHopPatchRouteNextHopIP +type RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct { + // A unicast IP address, which must not be any of the following values: + // + // - `0.0.0.0` (the sentinel IP address) + // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) + // - `255.255.255.255` (the broadcast IP address) + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP : Instantiate RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(address string) (_model *RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP, err error) { + _model = &RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPatchRouteNextHopIP() bool { + return true +} + +func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP unmarshals an instance of RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP from the specified map of raw messages. +func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct +// This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity +type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { + _model = &RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. +func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct +// This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity +type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` +} + +// NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { + _model = &RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. +func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { + return true +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct { + // A unicast IP address, which must not be any of the following values: + // + // - `0.0.0.0` (the sentinel IP address) + // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) + // - `255.255.255.255` (the broadcast IP address) + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { + return true +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` +} + +// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN, err error) { + _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct +// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct { + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(href string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref, err error) { + _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct +// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct { + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(id string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID, err error) { + _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN, err error) { + _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct +// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct { + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(href string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref, err error) { + _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID struct +// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID struct { + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(id string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID, err error) { + _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref : VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref struct +// This model "extends" VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref : Instantiate VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref(href string) (_model *VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref, err error) { + _model = &VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref) isaVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { + return true +} + +func (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref) isaVirtualNetworkInterfaceIPsReservedIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref unmarshals an instance of VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID : VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID struct +// This model "extends" VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID : Instantiate VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID(id string) (_model *VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID, err error) { + _model = &VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID) isaVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { + return true +} + +func (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID) isaVirtualNetworkInterfaceIPsReservedIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID unmarshals an instance of VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref : VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref struct +// This model "extends" VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext +type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref : Instantiate VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref(href string) (_model *VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref, err error) { + _model = &VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { + return true +} + +func (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID : VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID struct +// This model "extends" VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext +type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID : Instantiate VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID(id string) (_model *VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID, err error) { + _model = &VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { + return true +} + +func (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID unmarshals an instance of VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity +type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(crn string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity +type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref struct { + // The URL for this volume. + Href *string `json:"href" validate:"required"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref(href string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity +type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID struct { + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(id string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext +type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct { + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use for this volume. If unspecified, the instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity" validate:"required"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : Instantiate VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(profile VolumeProfileIdentityIntf, capacity int64) (_model *VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity{ + Profile: profile, + Capacity: core.Int64Ptr(capacity), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext +type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct { + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use for this volume. If unspecified, the instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's + // `minimum_capacity`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : Instantiate VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(profile VolumeProfileIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot{ + Profile: profile, + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup struct +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group" validate:"required"` +} + +// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup(group *InstanceGroupManagerScheduledActionGroupPrototype) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup, err error) { + _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup{ + Group: group, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager struct +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager" validate:"required"` +} + +// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager(manager InstanceGroupManagerScheduledActionManagerPrototypeIntf) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager, err error) { + _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager{ + Manager: manager, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup struct +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group" validate:"required"` +} + +// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup(group *InstanceGroupManagerScheduledActionGroupPrototype) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup, err error) { + _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup{ + Group: group, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager struct +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager" validate:"required"` +} + +// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager(manager InstanceGroupManagerScheduledActionManagerPrototypeIntf) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager, err error) { + _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager{ + Manager: manager, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcsPager can be used to simplify the use of the "ListVpcs" method. +type VpcsPager struct { + hasNext bool + options *ListVpcsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVpcsPager returns a new VpcsPager instance. +func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVpcsOptions = *options + pager = &VpcsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VpcsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVpcsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Vpcs + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, err error) { + for pager.HasNext() { + var nextPage []VPC + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VpcsPager) GetNext() (page []VPC, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VpcsPager) GetAll() (allItems []VPC, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. +type VPCAddressPrefixesPager struct { + hasNext bool + options *ListVPCAddressPrefixesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCAddressPrefixesPager returns a new VPCAddressPrefixesPager instance. +func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOptions) (pager *VPCAddressPrefixesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCAddressPrefixesOptions = *options + pager = &VPCAddressPrefixesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCAddressPrefixesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (page []AddressPrefix, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCAddressPrefixesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.AddressPrefixes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (allItems []AddressPrefix, err error) { + for pager.HasNext() { + var nextPage []AddressPrefix + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCAddressPrefixesPager) GetNext() (page []AddressPrefix, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. +type VPCRoutesPager struct { + hasNext bool + options *ListVPCRoutesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCRoutesPager returns a new VPCRoutesPager instance. +func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRoutesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCRoutesOptions = *options + pager = &VPCRoutesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCRoutesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []RouteCollectionVPCContextRoutesItem, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCRoutesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Routes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems []RouteCollectionVPCContextRoutesItem, err error) { + for pager.HasNext() { + var nextPage []RouteCollectionVPCContextRoutesItem + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutesPager) GetNext() (page []RouteCollectionVPCContextRoutesItem, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutesPager) GetAll() (allItems []RouteCollectionVPCContextRoutesItem, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPCRoutingTablesPager can be used to simplify the use of the "ListVPCRoutingTables" method. +type VPCRoutingTablesPager struct { + hasNext bool + options *ListVPCRoutingTablesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCRoutingTablesPager returns a new VPCRoutingTablesPager instance. +func (vpc *VpcV1) NewVPCRoutingTablesPager(options *ListVPCRoutingTablesOptions) (pager *VPCRoutingTablesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCRoutingTablesOptions = *options + pager = &VPCRoutingTablesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCRoutingTablesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCRoutingTablesPager) GetNextWithContext(ctx context.Context) (page []RoutingTable, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCRoutingTablesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.RoutingTables + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCRoutingTablesPager) GetAllWithContext(ctx context.Context) (allItems []RoutingTable, err error) { + for pager.HasNext() { + var nextPage []RoutingTable + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutingTablesPager) GetNext() (page []RoutingTable, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutingTablesPager) GetAll() (allItems []RoutingTable, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. +type VPCRoutingTableRoutesPager struct { + hasNext bool + options *ListVPCRoutingTableRoutesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. +func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCRoutingTableRoutesOptions = *options + pager = &VPCRoutingTableRoutesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCRoutingTableRoutesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) (page []Route, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Routes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { + for pager.HasNext() { + var nextPage []Route + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutingTableRoutesPager) GetNext() (page []Route, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SubnetsPager can be used to simplify the use of the "ListSubnets" method. +type SubnetsPager struct { + hasNext bool + options *ListSubnetsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSubnetsPager returns a new SubnetsPager instance. +func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSubnetsOptions = *options + pager = &SubnetsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SubnetsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subnet, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSubnetsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Subnets + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Subnet, err error) { + for pager.HasNext() { + var nextPage []Subnet + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SubnetsPager) GetNext() (page []Subnet, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SubnetsPager) GetAll() (allItems []Subnet, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. +type SubnetReservedIpsPager struct { + hasNext bool + options *ListSubnetReservedIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. +func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSubnetReservedIpsOptions = *options + pager = &SubnetReservedIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SubnetReservedIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSubnetReservedIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.ReservedIps + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { + for pager.HasNext() { + var nextPage []ReservedIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SubnetReservedIpsPager) GetNext() (page []ReservedIP, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// ImagesPager can be used to simplify the use of the "ListImages" method. +type ImagesPager struct { + hasNext bool + options *ListImagesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewImagesPager returns a new ImagesPager instance. +func (vpc *VpcV1) NewImagesPager(options *ListImagesOptions) (pager *ImagesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListImagesOptions = *options + pager = &ImagesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ImagesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ImagesPager) GetNextWithContext(ctx context.Context) (page []Image, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListImagesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Images + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ImagesPager) GetAllWithContext(ctx context.Context) (allItems []Image, err error) { + for pager.HasNext() { + var nextPage []Image + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ImagesPager) GetNext() (page []Image, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ImagesPager) GetAll() (allItems []Image, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// OperatingSystemsPager can be used to simplify the use of the "ListOperatingSystems" method. +type OperatingSystemsPager struct { + hasNext bool + options *ListOperatingSystemsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewOperatingSystemsPager returns a new OperatingSystemsPager instance. +func (vpc *VpcV1) NewOperatingSystemsPager(options *ListOperatingSystemsOptions) (pager *OperatingSystemsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListOperatingSystemsOptions = *options + pager = &OperatingSystemsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *OperatingSystemsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *OperatingSystemsPager) GetNextWithContext(ctx context.Context) (page []OperatingSystem, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListOperatingSystemsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.OperatingSystems + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *OperatingSystemsPager) GetAllWithContext(ctx context.Context) (allItems []OperatingSystem, err error) { + for pager.HasNext() { + var nextPage []OperatingSystem + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *OperatingSystemsPager) GetNext() (page []OperatingSystem, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *OperatingSystemsPager) GetAll() (allItems []OperatingSystem, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// KeysPager can be used to simplify the use of the "ListKeys" method. +type KeysPager struct { + hasNext bool + options *ListKeysOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewKeysPager returns a new KeysPager instance. +func (vpc *VpcV1) NewKeysPager(options *ListKeysOptions) (pager *KeysPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListKeysOptions = *options + pager = &KeysPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *KeysPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *KeysPager) GetNextWithContext(ctx context.Context) (page []Key, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListKeysWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Keys + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *KeysPager) GetAllWithContext(ctx context.Context) (allItems []Key, err error) { + for pager.HasNext() { + var nextPage []Key + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *KeysPager) GetNext() (page []Key, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *KeysPager) GetAll() (allItems []Key, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstancesPager can be used to simplify the use of the "ListInstances" method. +type InstancesPager struct { + hasNext bool + options *ListInstancesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstancesPager returns a new InstancesPager instance. +func (vpc *VpcV1) NewInstancesPager(options *ListInstancesOptions) (pager *InstancesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstancesOptions = *options + pager = &InstancesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstancesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstancesPager) GetNextWithContext(ctx context.Context) (page []Instance, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstancesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Instances + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstancesPager) GetAllWithContext(ctx context.Context) (allItems []Instance, err error) { + for pager.HasNext() { + var nextPage []Instance + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstancesPager) GetNext() (page []Instance, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstancesPager) GetAll() (allItems []Instance, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "ListInstanceNetworkInterfaceIps" method. +type InstanceNetworkInterfaceIpsPager struct { + hasNext bool + options *ListInstanceNetworkInterfaceIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceNetworkInterfaceIpsPager returns a new InstanceNetworkInterfaceIpsPager instance. +func (vpc *VpcV1) NewInstanceNetworkInterfaceIpsPager(options *ListInstanceNetworkInterfaceIpsOptions) (pager *InstanceNetworkInterfaceIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceNetworkInterfaceIpsOptions = *options + pager = &InstanceNetworkInterfaceIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceNetworkInterfaceIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceNetworkInterfaceIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Ips + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { + for pager.HasNext() { + var nextPage []ReservedIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceNetworkInterfaceIpsPager) GetNext() (page []ReservedIP, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. +type InstanceGroupsPager struct { + hasNext bool + options *ListInstanceGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupsPager returns a new InstanceGroupsPager instance. +func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupsOptions = *options + pager = &InstanceGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.InstanceGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroup, err error) { + for pager.HasNext() { + var nextPage []InstanceGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupsPager) GetNext() (page []InstanceGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. +type InstanceGroupManagersPager struct { + hasNext bool + options *ListInstanceGroupManagersOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupManagersPager returns a new InstanceGroupManagersPager instance. +func (vpc *VpcV1) NewInstanceGroupManagersPager(options *ListInstanceGroupManagersOptions) (pager *InstanceGroupManagersPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupManagersOptions = *options + pager = &InstanceGroupManagersPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupManagersPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupManagersWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Managers + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerIntf, err error) { + for pager.HasNext() { + var nextPage []InstanceGroupManagerIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagersPager) GetNext() (page []InstanceGroupManagerIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManagerIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. +type InstanceGroupManagerActionsPager struct { + hasNext bool + options *ListInstanceGroupManagerActionsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupManagerActionsPager returns a new InstanceGroupManagerActionsPager instance. +func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroupManagerActionsOptions) (pager *InstanceGroupManagerActionsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupManagerActionsOptions = *options + pager = &InstanceGroupManagerActionsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupManagerActionsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerActionIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupManagerActionsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Actions + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerActionIntf, err error) { + for pager.HasNext() { + var nextPage []InstanceGroupManagerActionIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagerActionsPager) GetNext() (page []InstanceGroupManagerActionIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGroupManagerActionIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. +type InstanceGroupManagerPoliciesPager struct { + hasNext bool + options *ListInstanceGroupManagerPoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupManagerPoliciesPager returns a new InstanceGroupManagerPoliciesPager instance. +func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGroupManagerPoliciesOptions) (pager *InstanceGroupManagerPoliciesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupManagerPoliciesOptions = *options + pager = &InstanceGroupManagerPoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupManagerPoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerPolicyIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupManagerPoliciesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Policies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerPolicyIntf, err error) { + for pager.HasNext() { + var nextPage []InstanceGroupManagerPolicyIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagerPoliciesPager) GetNext() (page []InstanceGroupManagerPolicyIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGroupManagerPolicyIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstanceGroupMembershipsPager can be used to simplify the use of the "ListInstanceGroupMemberships" method. +type InstanceGroupMembershipsPager struct { + hasNext bool + options *ListInstanceGroupMembershipsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupMembershipsPager returns a new InstanceGroupMembershipsPager instance. +func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMembershipsOptions) (pager *InstanceGroupMembershipsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupMembershipsOptions = *options + pager = &InstanceGroupMembershipsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupMembershipsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupMembership, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupMembershipsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Memberships + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupMembership, err error) { + for pager.HasNext() { + var nextPage []InstanceGroupMembership + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupMembershipsPager) GetNext() (page []InstanceGroupMembership, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMembership, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// DedicatedHostGroupsPager can be used to simplify the use of the "ListDedicatedHostGroups" method. +type DedicatedHostGroupsPager struct { + hasNext bool + options *ListDedicatedHostGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewDedicatedHostGroupsPager returns a new DedicatedHostGroupsPager instance. +func (vpc *VpcV1) NewDedicatedHostGroupsPager(options *ListDedicatedHostGroupsOptions) (pager *DedicatedHostGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListDedicatedHostGroupsOptions = *options + pager = &DedicatedHostGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *DedicatedHostGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *DedicatedHostGroupsPager) GetNextWithContext(ctx context.Context) (page []DedicatedHostGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListDedicatedHostGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Groups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *DedicatedHostGroupsPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHostGroup, err error) { + for pager.HasNext() { + var nextPage []DedicatedHostGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostGroupsPager) GetNext() (page []DedicatedHostGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostGroupsPager) GetAll() (allItems []DedicatedHostGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// DedicatedHostProfilesPager can be used to simplify the use of the "ListDedicatedHostProfiles" method. +type DedicatedHostProfilesPager struct { + hasNext bool + options *ListDedicatedHostProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewDedicatedHostProfilesPager returns a new DedicatedHostProfilesPager instance. +func (vpc *VpcV1) NewDedicatedHostProfilesPager(options *ListDedicatedHostProfilesOptions) (pager *DedicatedHostProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListDedicatedHostProfilesOptions = *options + pager = &DedicatedHostProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *DedicatedHostProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *DedicatedHostProfilesPager) GetNextWithContext(ctx context.Context) (page []DedicatedHostProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListDedicatedHostProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Profiles + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *DedicatedHostProfilesPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHostProfile, err error) { + for pager.HasNext() { + var nextPage []DedicatedHostProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostProfilesPager) GetNext() (page []DedicatedHostProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostProfilesPager) GetAll() (allItems []DedicatedHostProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// DedicatedHostsPager can be used to simplify the use of the "ListDedicatedHosts" method. +type DedicatedHostsPager struct { + hasNext bool + options *ListDedicatedHostsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewDedicatedHostsPager returns a new DedicatedHostsPager instance. +func (vpc *VpcV1) NewDedicatedHostsPager(options *ListDedicatedHostsOptions) (pager *DedicatedHostsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListDedicatedHostsOptions = *options + pager = &DedicatedHostsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *DedicatedHostsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *DedicatedHostsPager) GetNextWithContext(ctx context.Context) (page []DedicatedHost, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListDedicatedHostsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.DedicatedHosts + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *DedicatedHostsPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHost, err error) { + for pager.HasNext() { + var nextPage []DedicatedHost + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostsPager) GetNext() (page []DedicatedHost, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostsPager) GetAll() (allItems []DedicatedHost, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. +type BackupPoliciesPager struct { + hasNext bool + options *ListBackupPoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBackupPoliciesPager returns a new BackupPoliciesPager instance. +func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pager *BackupPoliciesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBackupPoliciesOptions = *options + pager = &BackupPoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BackupPoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicy, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBackupPoliciesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.BackupPolicies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicy, err error) { + for pager.HasNext() { + var nextPage []BackupPolicy + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BackupPoliciesPager) GetNext() (page []BackupPolicy, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BackupPoliciesPager) GetAll() (allItems []BackupPolicy, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. +type BackupPolicyJobsPager struct { + hasNext bool + options *ListBackupPolicyJobsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBackupPolicyJobsPager returns a new BackupPolicyJobsPager instance. +func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) (pager *BackupPolicyJobsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBackupPolicyJobsOptions = *options + pager = &BackupPolicyJobsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BackupPolicyJobsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyJob, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBackupPolicyJobsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Jobs + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { + for pager.HasNext() { + var nextPage []BackupPolicyJob + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BackupPolicyJobsPager) GetNext() (page []BackupPolicyJob, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// PlacementGroupsPager can be used to simplify the use of the "ListPlacementGroups" method. +type PlacementGroupsPager struct { + hasNext bool + options *ListPlacementGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewPlacementGroupsPager returns a new PlacementGroupsPager instance. +func (vpc *VpcV1) NewPlacementGroupsPager(options *ListPlacementGroupsOptions) (pager *PlacementGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListPlacementGroupsOptions = *options + pager = &PlacementGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *PlacementGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *PlacementGroupsPager) GetNextWithContext(ctx context.Context) (page []PlacementGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListPlacementGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.PlacementGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *PlacementGroupsPager) GetAllWithContext(ctx context.Context) (allItems []PlacementGroup, err error) { + for pager.HasNext() { + var nextPage []PlacementGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *PlacementGroupsPager) GetNext() (page []PlacementGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *PlacementGroupsPager) GetAll() (allItems []PlacementGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. +type BareMetalServerProfilesPager struct { + hasNext bool + options *ListBareMetalServerProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. +func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBareMetalServerProfilesOptions = *options + pager = &BareMetalServerProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BareMetalServerProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Profiles + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { + for pager.HasNext() { + var nextPage []BareMetalServerProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. +type BareMetalServersPager struct { + hasNext bool + options *ListBareMetalServersOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBareMetalServersPager returns a new BareMetalServersPager instance. +func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBareMetalServersOptions = *options + pager = &BareMetalServersPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BareMetalServersPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (page []BareMetalServer, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.BareMetalServers + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { + for pager.HasNext() { + var nextPage []BareMetalServer + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServersPager) GetNext() (page []BareMetalServer, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. +type BareMetalServerNetworkAttachmentsPager struct { + hasNext bool + options *ListBareMetalServerNetworkAttachmentsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBareMetalServerNetworkAttachmentsOptions = *options + pager = &BareMetalServerNetworkAttachmentsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.NetworkAttachments + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { + for pager.HasNext() { + var nextPage []BareMetalServerNetworkAttachmentIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. +type BareMetalServerNetworkInterfacesPager struct { + hasNext bool + options *ListBareMetalServerNetworkInterfacesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBareMetalServerNetworkInterfacesOptions = *options + pager = &BareMetalServerNetworkInterfacesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BareMetalServerNetworkInterfacesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkInterfaceIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.NetworkInterfaces + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { + for pager.HasNext() { + var nextPage []BareMetalServerNetworkInterfaceIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VolumeProfilesPager can be used to simplify the use of the "ListVolumeProfiles" method. +type VolumeProfilesPager struct { + hasNext bool + options *ListVolumeProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVolumeProfilesPager returns a new VolumeProfilesPager instance. +func (vpc *VpcV1) NewVolumeProfilesPager(options *ListVolumeProfilesOptions) (pager *VolumeProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVolumeProfilesOptions = *options + pager = &VolumeProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VolumeProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VolumeProfilesPager) GetNextWithContext(ctx context.Context) (page []VolumeProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVolumeProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Profiles + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VolumeProfilesPager) GetAllWithContext(ctx context.Context) (allItems []VolumeProfile, err error) { + for pager.HasNext() { + var nextPage []VolumeProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VolumeProfilesPager) GetNext() (page []VolumeProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VolumeProfilesPager) GetAll() (allItems []VolumeProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VolumesPager can be used to simplify the use of the "ListVolumes" method. +type VolumesPager struct { + hasNext bool + options *ListVolumesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVolumesPager returns a new VolumesPager instance. +func (vpc *VpcV1) NewVolumesPager(options *ListVolumesOptions) (pager *VolumesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVolumesOptions = *options + pager = &VolumesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VolumesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VolumesPager) GetNextWithContext(ctx context.Context) (page []Volume, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVolumesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Volumes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VolumesPager) GetAllWithContext(ctx context.Context) (allItems []Volume, err error) { + for pager.HasNext() { + var nextPage []Volume + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VolumesPager) GetNext() (page []Volume, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VolumesPager) GetAll() (allItems []Volume, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SnapshotsPager can be used to simplify the use of the "ListSnapshots" method. +type SnapshotsPager struct { + hasNext bool + options *ListSnapshotsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSnapshotsPager returns a new SnapshotsPager instance. +func (vpc *VpcV1) NewSnapshotsPager(options *ListSnapshotsOptions) (pager *SnapshotsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSnapshotsOptions = *options + pager = &SnapshotsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SnapshotsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SnapshotsPager) GetNextWithContext(ctx context.Context) (page []Snapshot, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSnapshotsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Snapshots + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SnapshotsPager) GetAllWithContext(ctx context.Context) (allItems []Snapshot, err error) { + for pager.HasNext() { + var nextPage []Snapshot + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SnapshotsPager) GetNext() (page []Snapshot, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. +type ShareProfilesPager struct { + hasNext bool + options *ListShareProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewShareProfilesPager returns a new ShareProfilesPager instance. +func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (pager *ShareProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListShareProfilesOptions = *options + pager = &ShareProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ShareProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page []ShareProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListShareProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Profiles + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItems []ShareProfile, err error) { + for pager.HasNext() { + var nextPage []ShareProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ShareProfilesPager) GetNext() (page []ShareProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SharesPager can be used to simplify the use of the "ListShares" method. +type SharesPager struct { + hasNext bool + options *ListSharesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSharesPager returns a new SharesPager instance. +func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSharesOptions = *options + pager = &SharesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SharesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSharesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Shares + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Share, err error) { + for pager.HasNext() { + var nextPage []Share + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SharesPager) GetNext() (page []Share, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SharesPager) GetAll() (allItems []Share, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. +type VirtualNetworkInterfacesPager struct { + hasNext bool + options *ListVirtualNetworkInterfacesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. +func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVirtualNetworkInterfacesOptions = *options + pager = &VirtualNetworkInterfacesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VirtualNetworkInterfacesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []VirtualNetworkInterface, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.VirtualNetworkInterfaces + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []VirtualNetworkInterface, err error) { + for pager.HasNext() { + var nextPage []VirtualNetworkInterface + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. +type NetworkInterfaceFloatingIpsPager struct { + hasNext bool + options *ListNetworkInterfaceFloatingIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewNetworkInterfaceFloatingIpsPager returns a new NetworkInterfaceFloatingIpsPager instance. +func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterfaceFloatingIpsOptions) (pager *NetworkInterfaceFloatingIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListNetworkInterfaceFloatingIpsOptions = *options + pager = &NetworkInterfaceFloatingIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *NetworkInterfaceFloatingIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIPReference, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListNetworkInterfaceFloatingIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.FloatingIps + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIPReference, err error) { + for pager.HasNext() { + var nextPage []FloatingIPReference + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *NetworkInterfaceFloatingIpsPager) GetNext() (page []FloatingIPReference, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "ListVirtualNetworkInterfaceIps" method. +type VirtualNetworkInterfaceIpsPager struct { + hasNext bool + options *ListVirtualNetworkInterfaceIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVirtualNetworkInterfaceIpsPager returns a new VirtualNetworkInterfaceIpsPager instance. +func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetworkInterfaceIpsOptions) (pager *VirtualNetworkInterfaceIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVirtualNetworkInterfaceIpsOptions = *options + pager = &VirtualNetworkInterfaceIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VirtualNetworkInterfaceIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIPReference, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVirtualNetworkInterfaceIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Ips + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIPReference, err error) { + for pager.HasNext() { + var nextPage []ReservedIPReference + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfaceIpsPager) GetNext() (page []ReservedIPReference, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. +type PublicGatewaysPager struct { + hasNext bool + options *ListPublicGatewaysOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewPublicGatewaysPager returns a new PublicGatewaysPager instance. +func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pager *PublicGatewaysPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListPublicGatewaysOptions = *options + pager = &PublicGatewaysPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *PublicGatewaysPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page []PublicGateway, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListPublicGatewaysWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.PublicGateways + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []PublicGateway, err error) { + for pager.HasNext() { + var nextPage []PublicGateway + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *PublicGatewaysPager) GetNext() (page []PublicGateway, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *PublicGatewaysPager) GetAll() (allItems []PublicGateway, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. +type FloatingIpsPager struct { + hasNext bool + options *ListFloatingIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewFloatingIpsPager returns a new FloatingIpsPager instance. +func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListFloatingIpsOptions = *options + pager = &FloatingIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *FloatingIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListFloatingIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.FloatingIps + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIP, err error) { + for pager.HasNext() { + var nextPage []FloatingIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *FloatingIpsPager) GetNext() (page []FloatingIP, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. +type NetworkAclsPager struct { + hasNext bool + options *ListNetworkAclsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewNetworkAclsPager returns a new NetworkAclsPager instance. +func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *NetworkAclsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListNetworkAclsOptions = *options + pager = &NetworkAclsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *NetworkAclsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []NetworkACL, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListNetworkAclsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.NetworkAcls + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACL, err error) { + for pager.HasNext() { + var nextPage []NetworkACL + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *NetworkAclsPager) GetNext() (page []NetworkACL, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// NetworkACLRulesPager can be used to simplify the use of the "ListNetworkACLRules" method. +type NetworkACLRulesPager struct { + hasNext bool + options *ListNetworkACLRulesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewNetworkACLRulesPager returns a new NetworkACLRulesPager instance. +func (vpc *VpcV1) NewNetworkACLRulesPager(options *ListNetworkACLRulesOptions) (pager *NetworkACLRulesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListNetworkACLRulesOptions = *options + pager = &NetworkACLRulesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *NetworkACLRulesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page []NetworkACLRuleItemIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListNetworkACLRulesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Rules + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACLRuleItemIntf, err error) { + for pager.HasNext() { + var nextPage []NetworkACLRuleItemIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *NetworkACLRulesPager) GetNext() (page []NetworkACLRuleItemIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. +type SecurityGroupsPager struct { + hasNext bool + options *ListSecurityGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSecurityGroupsPager returns a new SecurityGroupsPager instance. +func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSecurityGroupsOptions = *options + pager = &SecurityGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SecurityGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSecurityGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.SecurityGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroup, err error) { + for pager.HasNext() { + var nextPage []SecurityGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupsPager) GetNext() (page []SecurityGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SecurityGroupTargetsPager can be used to simplify the use of the "ListSecurityGroupTargets" method. +type SecurityGroupTargetsPager struct { + hasNext bool + options *ListSecurityGroupTargetsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSecurityGroupTargetsPager returns a new SecurityGroupTargetsPager instance. +func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargetsOptions) (pager *SecurityGroupTargetsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSecurityGroupTargetsOptions = *options + pager = &SecurityGroupTargetsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SecurityGroupTargetsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroupTargetReferenceIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSecurityGroupTargetsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Targets + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroupTargetReferenceIntf, err error) { + for pager.HasNext() { + var nextPage []SecurityGroupTargetReferenceIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupTargetsPager) GetNext() (page []SecurityGroupTargetReferenceIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTargetReferenceIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. +type IkePoliciesPager struct { + hasNext bool + options *ListIkePoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewIkePoliciesPager returns a new IkePoliciesPager instance. +func (vpc *VpcV1) NewIkePoliciesPager(options *ListIkePoliciesOptions) (pager *IkePoliciesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListIkePoliciesOptions = *options + pager = &IkePoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *IkePoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *IkePoliciesPager) GetNextWithContext(ctx context.Context) (page []IkePolicy, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListIkePoliciesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.IkePolicies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *IkePoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IkePolicy, err error) { + for pager.HasNext() { + var nextPage []IkePolicy + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *IkePoliciesPager) GetNext() (page []IkePolicy, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *IkePoliciesPager) GetAll() (allItems []IkePolicy, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// IpsecPoliciesPager can be used to simplify the use of the "ListIpsecPolicies" method. +type IpsecPoliciesPager struct { + hasNext bool + options *ListIpsecPoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewIpsecPoliciesPager returns a new IpsecPoliciesPager instance. +func (vpc *VpcV1) NewIpsecPoliciesPager(options *ListIpsecPoliciesOptions) (pager *IpsecPoliciesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListIpsecPoliciesOptions = *options + pager = &IpsecPoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *IpsecPoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *IpsecPoliciesPager) GetNextWithContext(ctx context.Context) (page []IPsecPolicy, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListIpsecPoliciesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.IpsecPolicies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *IpsecPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IPsecPolicy, err error) { + for pager.HasNext() { + var nextPage []IPsecPolicy + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *IpsecPoliciesPager) GetNext() (page []IPsecPolicy, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *IpsecPoliciesPager) GetAll() (allItems []IPsecPolicy, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. +type VPNGatewaysPager struct { + hasNext bool + options *ListVPNGatewaysOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPNGatewaysPager returns a new VPNGatewaysPager instance. +func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPNGatewaysOptions = *options + pager = &VPNGatewaysPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPNGatewaysPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPNGatewaysWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.VPNGateways + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayIntf, err error) { + for pager.HasNext() { + var nextPage []VPNGatewayIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPNGatewaysPager) GetNext() (page []VPNGatewayIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPNServersPager can be used to simplify the use of the "ListVPNServers" method. +type VPNServersPager struct { + hasNext bool + options *ListVPNServersOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPNServersPager returns a new VPNServersPager instance. +func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPNServersOptions = *options + pager = &VPNServersPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPNServersPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VPNServer, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPNServersWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.VPNServers + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems []VPNServer, err error) { + for pager.HasNext() { + var nextPage []VPNServer + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPNServersPager) GetNext() (page []VPNServer, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPNServersPager) GetAll() (allItems []VPNServer, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. +type VPNServerClientsPager struct { + hasNext bool + options *ListVPNServerClientsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPNServerClientsPager returns a new VPNServerClientsPager instance. +func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPNServerClientsOptions = *options + pager = &VPNServerClientsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPNServerClientsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (page []VPNServerClient, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPNServerClientsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Clients + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerClient, err error) { + for pager.HasNext() { + var nextPage []VPNServerClient + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPNServerClientsPager) GetNext() (page []VPNServerClient, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. +type VPNServerRoutesPager struct { + hasNext bool + options *ListVPNServerRoutesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. +func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPNServerRoutesOptions = *options + pager = &VPNServerRoutesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPNServerRoutesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page []VPNServerRoute, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPNServerRoutesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Routes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerRoute, err error) { + for pager.HasNext() { + var nextPage []VPNServerRoute + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPNServerRoutesPager) GetNext() (page []VPNServerRoute, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// LoadBalancerProfilesPager can be used to simplify the use of the "ListLoadBalancerProfiles" method. +type LoadBalancerProfilesPager struct { + hasNext bool + options *ListLoadBalancerProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewLoadBalancerProfilesPager returns a new LoadBalancerProfilesPager instance. +func (vpc *VpcV1) NewLoadBalancerProfilesPager(options *ListLoadBalancerProfilesOptions) (pager *LoadBalancerProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListLoadBalancerProfilesOptions = *options + pager = &LoadBalancerProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *LoadBalancerProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *LoadBalancerProfilesPager) GetNextWithContext(ctx context.Context) (page []LoadBalancerProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListLoadBalancerProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Profiles + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *LoadBalancerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancerProfile, err error) { + for pager.HasNext() { + var nextPage []LoadBalancerProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *LoadBalancerProfilesPager) GetNext() (page []LoadBalancerProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *LoadBalancerProfilesPager) GetAll() (allItems []LoadBalancerProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// LoadBalancersPager can be used to simplify the use of the "ListLoadBalancers" method. +type LoadBalancersPager struct { + hasNext bool + options *ListLoadBalancersOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewLoadBalancersPager returns a new LoadBalancersPager instance. +func (vpc *VpcV1) NewLoadBalancersPager(options *ListLoadBalancersOptions) (pager *LoadBalancersPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListLoadBalancersOptions = *options + pager = &LoadBalancersPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *LoadBalancersPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *LoadBalancersPager) GetNextWithContext(ctx context.Context) (page []LoadBalancer, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListLoadBalancersWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.LoadBalancers + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *LoadBalancersPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancer, err error) { + for pager.HasNext() { + var nextPage []LoadBalancer + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *LoadBalancersPager) GetNext() (page []LoadBalancer, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *LoadBalancersPager) GetAll() (allItems []LoadBalancer, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. +type EndpointGatewaysPager struct { + hasNext bool + options *ListEndpointGatewaysOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. +func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListEndpointGatewaysOptions = *options + pager = &EndpointGatewaysPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *EndpointGatewaysPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (page []EndpointGateway, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListEndpointGatewaysWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.EndpointGateways + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []EndpointGateway, err error) { + for pager.HasNext() { + var nextPage []EndpointGateway + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *EndpointGatewaysPager) GetNext() (page []EndpointGateway, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. +type EndpointGatewayIpsPager struct { + hasNext bool + options *ListEndpointGatewayIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. +func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListEndpointGatewayIpsOptions = *options + pager = &EndpointGatewayIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *EndpointGatewayIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListEndpointGatewayIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Ips + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { + for pager.HasNext() { + var nextPage []ReservedIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *EndpointGatewayIpsPager) GetNext() (page []ReservedIP, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// FlowLogCollectorsPager can be used to simplify the use of the "ListFlowLogCollectors" method. +type FlowLogCollectorsPager struct { + hasNext bool + options *ListFlowLogCollectorsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewFlowLogCollectorsPager returns a new FlowLogCollectorsPager instance. +func (vpc *VpcV1) NewFlowLogCollectorsPager(options *ListFlowLogCollectorsOptions) (pager *FlowLogCollectorsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListFlowLogCollectorsOptions = *options + pager = &FlowLogCollectorsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *FlowLogCollectorsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *FlowLogCollectorsPager) GetNextWithContext(ctx context.Context) (page []FlowLogCollector, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListFlowLogCollectorsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.FlowLogCollectors + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *FlowLogCollectorsPager) GetAllWithContext(ctx context.Context) (allItems []FlowLogCollector, err error) { + for pager.HasNext() { + var nextPage []FlowLogCollector + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *FlowLogCollectorsPager) GetNext() (page []FlowLogCollector, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *FlowLogCollectorsPager) GetAll() (allItems []FlowLogCollector, err error) { + return pager.GetAllWithContext(context.Background()) +} diff --git a/examples/ibm-is-ng/main.tf b/examples/ibm-is-ng/main.tf index 528541aec5..99ea42252d 100644 --- a/examples/ibm-is-ng/main.tf +++ b/examples/ibm-is-ng/main.tf @@ -1272,3 +1272,40 @@ data "ibm_is_share" "is_share" { data "ibm_is_shares" "is_shares" { } + +// vni +resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instance" { + allow_ip_spoofing = var.is_virtual_network_interface_allow_ip_spoofing + auto_delete = var.is_virtual_network_interface_auto_delete + enable_infrastructure_nat = var.is_virtual_network_interface_enable_infrastructure_nat + ips { + address = "192.168.3.4" + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + name = "my-reserved-ip" + } + name = var.is_virtual_network_interface_name + primary_ip { + address = "192.168.3.4" + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + name = "my-reserved-ip" + } + resource_group { + id = "fee82deba12e4c0fb69c3b09d1f12345" + } + security_groups { + crn = "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" + id = "be5df5ca-12a0-494b-907e-aa6ec2bfa271" + name = "my-security-group" + } + subnet { + crn = "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + id = "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + } +} diff --git a/go.mod b/go.mod index 89bfe14b85..dfb6c0804d 100644 --- a/go.mod +++ b/go.mod @@ -217,6 +217,8 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 +replace github.com/IBM/vpc-go-sdk v0.38.0 => ./common/github.com/IBM/vpc-go-sdk + exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index f95f752685..bece28d705 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -1025,6 +1025,7 @@ func Provider() *schema.Provider { "ibm_is_subnet_routing_table_attachment": vpc.ResourceIBMISSubnetRoutingTableAttachment(), "ibm_is_ssh_key": vpc.ResourceIBMISSSHKey(), "ibm_is_snapshot": vpc.ResourceIBMSnapshot(), + "ibm_is_virtual_network_interface": vpc.ResourceIBMIsVirtualNetworkInterface(), "ibm_is_volume": vpc.ResourceIBMISVolume(), "ibm_is_vpn_gateway": vpc.ResourceIBMISVPNGateway(), "ibm_is_vpn_gateway_connection": vpc.ResourceIBMISVPNGatewayConnection(), @@ -1430,6 +1431,7 @@ func Validator() validate.ValidatorDict { "ibm_is_ssh_key": vpc.ResourceIBMISSHKeyValidator(), "ibm_is_subnet": vpc.ResourceIBMISSubnetValidator(), "ibm_is_subnet_reserved_ip": vpc.ResourceIBMISSubnetReservedIPValidator(), + "ibm_is_virtual_network_interface": vpc.ResourceIBMIsVirtualNetworkInterfaceValidator(), "ibm_is_volume": vpc.ResourceIBMISVolumeValidator(), "ibm_is_address_prefix": vpc.ResourceIBMISAddressPrefixValidator(), "ibm_is_vpc": vpc.ResourceIBMISVPCValidator(), diff --git a/ibm/service/vpc/resource_ibm_is_instance_template.go b/ibm/service/vpc/resource_ibm_is_instance_template.go index 9ac2e29abe..23514e4910 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_template.go +++ b/ibm/service/vpc/resource_ibm_is_instance_template.go @@ -693,7 +693,7 @@ func instanceTemplateCreateByCatalogOffering(d *schema.ResourceData, meta interf return err } - instanceproto := &vpcv1.InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext{ + instanceproto := &vpcv1.InstanceTemplatePrototypeInstanceTemplateByCatalogOffering{ Zone: &vpcv1.ZoneIdentity{ Name: &zone, }, diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go new file mode 100644 index 0000000000..d57a95524f --- /dev/null +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go @@ -0,0 +1,1115 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIBMIsVirtualNetworkInterfaceCreate, + ReadContext: resourceIBMIsVirtualNetworkInterfaceRead, + UpdateContext: resourceIBMIsVirtualNetworkInterfaceUpdate, + DeleteContext: resourceIBMIsVirtualNetworkInterfaceDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "allow_ip_spoofing": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "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.", + }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Indicates whether this virtual network interface will be automatically deleted when`target` is deleted.", + }, + "enable_infrastructure_nat": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", + }, + "ips": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The URL for this reserved IP.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validate.InvokeValidator("ibm_is_virtual_network_interface", "name"), + Description: "The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC.", + }, + "primary_ip": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "The reserved IP for this virtual network interface.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The URL for this reserved IP.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "resource_group": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "The resource group for this virtual network interface.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this resource group.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique identifier for this resource group.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this resource group.", + }, + }, + }, + }, + "security_groups": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "The security groups for this virtual network interface.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The security group's CRN.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The security group's canonical URL.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique identifier for this security group.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The name for this security group. The name is unique across all security groups for the VPC.", + }, + }, + }, + }, + "subnet": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "The associated subnet.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The CRN for this subnet.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The URL for this subnet.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique identifier for this subnet.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this subnet. The name is unique across all subnets in the VPC.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date and time that the virtual network interface was created.", + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this virtual network interface.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this virtual network interface.", + }, + "lifecycle_state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The lifecycle state of the virtual network interface.", + }, + "mac_address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The MAC address of the interface. Absent when the interface is not attached to a target.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "target": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The target of this virtual network interface.If absent, this virtual network interface is not attached to a target.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "deleted": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The URL for this share mount target.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The unique identifier for this share mount target.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name for this share mount target. The name is unique across all mount targets for the file share.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The resource type.", + }, + }, + }, + }, + "vpc": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The VPC this virtual network interface resides in.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The CRN for this VPC.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The URL for this VPC.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique identifier for this VPC.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this VPC. The name is unique across all VPCs in the region.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "zone": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The zone this virtual network interface resides in.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The URL for this zone.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The globally unique name for this zone.", + }, + }, + }, + }, + }, + } +} + +func ResourceIBMIsVirtualNetworkInterfaceValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "name", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Optional: true, + Regexp: `^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$`, + MinValueLength: 1, + MaxValueLength: 63, + }, + ) + + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_is_virtual_network_interface", Schema: validateSchema} + return &resourceValidator +} + +func resourceIBMIsVirtualNetworkInterfaceCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + sess, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + createVirtualNetworkInterfaceOptions := &vpcv1.CreateVirtualNetworkInterfaceOptions{} + + if _, ok := d.GetOk("allow_ip_spoofing"); ok { + createVirtualNetworkInterfaceOptions.SetAllowIPSpoofing(d.Get("allow_ip_spoofing").(bool)) + } + if _, ok := d.GetOk("auto_delete"); ok { + createVirtualNetworkInterfaceOptions.SetAutoDelete(d.Get("auto_delete").(bool)) + } + if _, ok := d.GetOk("enable_infrastructure_nat"); ok { + createVirtualNetworkInterfaceOptions.SetEnableInfrastructureNat(d.Get("enable_infrastructure_nat").(bool)) + } + if _, ok := d.GetOk("ips"); ok { + var ips []vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeIntf + for _, v := range d.Get("ips").([]interface{}) { + value := v.(map[string]interface{}) + ipsItem, err := resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototype(value) + if err != nil { + return diag.FromErr(err) + } + ips = append(ips, ipsItem) + } + createVirtualNetworkInterfaceOptions.SetIps(ips) + } + if _, ok := d.GetOk("name"); ok { + createVirtualNetworkInterfaceOptions.SetName(d.Get("name").(string)) + } + if _, ok := d.GetOk("primary_ip"); ok { + primaryIPModel, err := resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(d.Get("primary_ip.0").(map[string]interface{})) + if err != nil { + return diag.FromErr(err) + } + createVirtualNetworkInterfaceOptions.SetPrimaryIP(primaryIPModel) + } + if _, ok := d.GetOk("resource_group"); ok { + resourceGroupModel, err := resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrototypeResourceGroup(d.Get("resource_group.0").(map[string]interface{})) + if err != nil { + return diag.FromErr(err) + } + createVirtualNetworkInterfaceOptions.SetResourceGroup(resourceGroupModel) + } + if _, ok := d.GetOk("security_groups"); ok { + var securityGroups []vpcv1.SecurityGroupIdentityIntf + for _, v := range d.Get("security_groups").([]interface{}) { + value := v.(map[string]interface{}) + securityGroupsItem, err := resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentity(value) + if err != nil { + return diag.FromErr(err) + } + securityGroups = append(securityGroups, securityGroupsItem) + } + createVirtualNetworkInterfaceOptions.SetSecurityGroups(securityGroups) + } + if _, ok := d.GetOk("subnet"); ok { + subnetModel, err := resourceIBMIsVirtualNetworkInterfaceMapToSubnetIdentity(d.Get("subnet.0").(map[string]interface{})) + if err != nil { + return diag.FromErr(err) + } + createVirtualNetworkInterfaceOptions.SetSubnet(subnetModel) + } + + virtualNetworkInterface, response, err := sess.CreateVirtualNetworkInterfaceWithContext(context, createVirtualNetworkInterfaceOptions) + if err != nil { + log.Printf("[DEBUG] CreateVirtualNetworkInterfaceWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CreateVirtualNetworkInterfaceWithContext failed %s\n%s", err, response)) + } + + d.SetId(*virtualNetworkInterface.ID) + + return resourceIBMIsVirtualNetworkInterfaceRead(context, d, meta) +} + +func resourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + sess, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + getVirtualNetworkInterfaceOptions := &vpcv1.GetVirtualNetworkInterfaceOptions{} + + getVirtualNetworkInterfaceOptions.SetID(d.Id()) + + virtualNetworkInterface, response, err := sess.GetVirtualNetworkInterfaceWithContext(context, getVirtualNetworkInterfaceOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetVirtualNetworkInterfaceWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterfaceWithContext failed %s\n%s", err, response)) + } + + if !core.IsNil(virtualNetworkInterface.AllowIPSpoofing) { + if err = d.Set("allow_ip_spoofing", virtualNetworkInterface.AllowIPSpoofing); err != nil { + return diag.FromErr(fmt.Errorf("Error setting allow_ip_spoofing: %s", err)) + } + } + if !core.IsNil(virtualNetworkInterface.AutoDelete) { + if err = d.Set("auto_delete", virtualNetworkInterface.AutoDelete); err != nil { + return diag.FromErr(fmt.Errorf("Error setting auto_delete: %s", err)) + } + } + if !core.IsNil(virtualNetworkInterface.EnableInfrastructureNat) { + if err = d.Set("enable_infrastructure_nat", virtualNetworkInterface.EnableInfrastructureNat); err != nil { + return diag.FromErr(fmt.Errorf("Error setting enable_infrastructure_nat: %s", err)) + } + } + if !core.IsNil(virtualNetworkInterface.Ips) { + ips := []map[string]interface{}{} + for _, ipsItem := range virtualNetworkInterface.Ips { + ipsItemMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(&ipsItem) + if err != nil { + return diag.FromErr(err) + } + ips = append(ips, ipsItemMap) + } + if err = d.Set("ips", ips); err != nil { + return diag.FromErr(fmt.Errorf("Error setting ips: %s", err)) + } + } + if !core.IsNil(virtualNetworkInterface.Name) { + if err = d.Set("name", virtualNetworkInterface.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + } + if !core.IsNil(virtualNetworkInterface.PrimaryIP) { + primaryIPMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(virtualNetworkInterface.PrimaryIP) + if err != nil { + return diag.FromErr(err) + } + if err = d.Set("primary_ip", []map[string]interface{}{primaryIPMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting primary_ip: %s", err)) + } + } + if !core.IsNil(virtualNetworkInterface.ResourceGroup) { + resourceGroupMap, err := resourceIBMIsVirtualNetworkInterfaceResourceGroupReferenceToMap(virtualNetworkInterface.ResourceGroup) + if err != nil { + return diag.FromErr(err) + } + if err = d.Set("resource_group", []map[string]interface{}{resourceGroupMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_group: %s", err)) + } + } + if !core.IsNil(virtualNetworkInterface.SecurityGroups) { + securityGroups := []map[string]interface{}{} + for _, securityGroupsItem := range virtualNetworkInterface.SecurityGroups { + securityGroupsItemMap, err := resourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceToMap(&securityGroupsItem) + if err != nil { + return diag.FromErr(err) + } + securityGroups = append(securityGroups, securityGroupsItemMap) + } + if err = d.Set("security_groups", securityGroups); err != nil { + return diag.FromErr(fmt.Errorf("Error setting security_groups: %s", err)) + } + } + if !core.IsNil(virtualNetworkInterface.Subnet) { + subnetMap, err := resourceIBMIsVirtualNetworkInterfaceSubnetReferenceToMap(virtualNetworkInterface.Subnet) + if err != nil { + return diag.FromErr(err) + } + if err = d.Set("subnet", []map[string]interface{}{subnetMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting subnet: %s", err)) + } + } + if err = d.Set("created_at", flex.DateTimeToString(virtualNetworkInterface.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + if err = d.Set("crn", virtualNetworkInterface.CRN); err != nil { + return diag.FromErr(fmt.Errorf("Error setting crn: %s", err)) + } + if err = d.Set("href", virtualNetworkInterface.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + if err = d.Set("lifecycle_state", virtualNetworkInterface.LifecycleState); err != nil { + return diag.FromErr(fmt.Errorf("Error setting lifecycle_state: %s", err)) + } + if !core.IsNil(virtualNetworkInterface.MacAddress) { + if err = d.Set("mac_address", virtualNetworkInterface.MacAddress); err != nil { + return diag.FromErr(fmt.Errorf("Error setting mac_address: %s", err)) + } + } + if err = d.Set("resource_type", virtualNetworkInterface.ResourceType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_type: %s", err)) + } + if !core.IsNil(virtualNetworkInterface.Target) { + targetMap, err := resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetToMap(virtualNetworkInterface.Target) + if err != nil { + return diag.FromErr(err) + } + if err = d.Set("target", []map[string]interface{}{targetMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting target: %s", err)) + } + } + vpcMap, err := resourceIBMIsVirtualNetworkInterfaceVPCReferenceToMap(virtualNetworkInterface.VPC) + if err != nil { + return diag.FromErr(err) + } + if err = d.Set("vpc", []map[string]interface{}{vpcMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting vpc: %s", err)) + } + zoneMap, err := resourceIBMIsVirtualNetworkInterfaceZoneReferenceToMap(virtualNetworkInterface.Zone) + if err != nil { + return diag.FromErr(err) + } + if err = d.Set("zone", []map[string]interface{}{zoneMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting zone: %s", err)) + } + + return nil +} + +func resourceIBMIsVirtualNetworkInterfaceUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + sess, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + updateVirtualNetworkInterfaceOptions := &vpcv1.UpdateVirtualNetworkInterfaceOptions{} + + updateVirtualNetworkInterfaceOptions.SetID(d.Id()) + + hasChange := false + + patchVals := &vpcv1.VirtualNetworkInterfacePatch{} + if d.HasChange("allow_ip_spoofing") { + newAllowIPSpoofing := d.Get("allow_ip_spoofing").(bool) + patchVals.AllowIPSpoofing = &newAllowIPSpoofing + hasChange = true + } + if d.HasChange("auto_delete") { + newAutoDelete := d.Get("auto_delete").(bool) + patchVals.AutoDelete = &newAutoDelete + hasChange = true + } + if d.HasChange("enable_infrastructure_nat") { + newEnableInfrastructureNat := d.Get("enable_infrastructure_nat").(bool) + patchVals.EnableInfrastructureNat = &newEnableInfrastructureNat + hasChange = true + } + if d.HasChange("name") { + newName := d.Get("name").(string) + patchVals.Name = &newName + hasChange = true + } + + if hasChange { + updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch, _ = patchVals.AsPatch() + _, response, err := sess.UpdateVirtualNetworkInterfaceWithContext(context, updateVirtualNetworkInterfaceOptions) + if err != nil { + log.Printf("[DEBUG] UpdateVirtualNetworkInterfaceWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("UpdateVirtualNetworkInterfaceWithContext failed %s\n%s", err, response)) + } + } + + return resourceIBMIsVirtualNetworkInterfaceRead(context, d, meta) +} + +func resourceIBMIsVirtualNetworkInterfaceDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + sess, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + deleteVirtualNetworkInterfacesOptions := &vpcv1.DeleteVirtualNetworkInterfacesOptions{} + + deleteVirtualNetworkInterfacesOptions.SetID(d.Id()) + + response, err := sess.DeleteVirtualNetworkInterfacesWithContext(context, deleteVirtualNetworkInterfacesOptions) + if err != nil { + log.Printf("[DEBUG] DeleteVirtualNetworkInterfacesWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteVirtualNetworkInterfacesWithContext failed %s\n%s", err, response)) + } + + d.SetId("") + + return nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeIntf, error) { + model := &vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototype{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + if modelMap["href"] != nil && modelMap["href"].(string) != "" { + model.Href = core.StringPtr(modelMap["href"].(string)) + } + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextIntf, error) { + model := &vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + if modelMap["href"] != nil && modelMap["href"].(string) != "" { + model.Href = core.StringPtr(modelMap["href"].(string)) + } + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID, error) { + model := &vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID{} + model.ID = core.StringPtr(modelMap["id"].(string)) + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref, error) { + model := &vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref{} + model.Href = core.StringPtr(modelMap["href"].(string)) + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext, error) { + model := &vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext{} + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf, error) { + model := &vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototype{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + if modelMap["href"] != nil && modelMap["href"].(string) != "" { + model.Href = core.StringPtr(modelMap["href"].(string)) + } + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextIntf, error) { + model := &vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + if modelMap["href"] != nil && modelMap["href"].(string) != "" { + model.Href = core.StringPtr(modelMap["href"].(string)) + } + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID, error) { + model := &vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID{} + model.ID = core.StringPtr(modelMap["id"].(string)) + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref, error) { + model := &vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref{} + model.Href = core.StringPtr(modelMap["href"].(string)) + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext, error) { + model := &vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext{} + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrototypeResourceGroup(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrototypeResourceGroupIntf, error) { + model := &vpcv1.VirtualNetworkInterfacePrototypeResourceGroup{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID, error) { + model := &vpcv1.VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID{} + model.ID = core.StringPtr(modelMap["id"].(string)) + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentity(modelMap map[string]interface{}) (vpcv1.SecurityGroupIdentityIntf, error) { + model := &vpcv1.SecurityGroupIdentity{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + if modelMap["crn"] != nil && modelMap["crn"].(string) != "" { + model.CRN = core.StringPtr(modelMap["crn"].(string)) + } + if modelMap["href"] != nil && modelMap["href"].(string) != "" { + model.Href = core.StringPtr(modelMap["href"].(string)) + } + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentityByID(modelMap map[string]interface{}) (*vpcv1.SecurityGroupIdentityByID, error) { + model := &vpcv1.SecurityGroupIdentityByID{} + model.ID = core.StringPtr(modelMap["id"].(string)) + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentityByCRN(modelMap map[string]interface{}) (*vpcv1.SecurityGroupIdentityByCRN, error) { + model := &vpcv1.SecurityGroupIdentityByCRN{} + model.CRN = core.StringPtr(modelMap["crn"].(string)) + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentityByHref(modelMap map[string]interface{}) (*vpcv1.SecurityGroupIdentityByHref, error) { + model := &vpcv1.SecurityGroupIdentityByHref{} + model.Href = core.StringPtr(modelMap["href"].(string)) + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToSubnetIdentity(modelMap map[string]interface{}) (vpcv1.SubnetIdentityIntf, error) { + model := &vpcv1.SubnetIdentity{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + if modelMap["crn"] != nil && modelMap["crn"].(string) != "" { + model.CRN = core.StringPtr(modelMap["crn"].(string)) + } + if modelMap["href"] != nil && modelMap["href"].(string) != "" { + model.Href = core.StringPtr(modelMap["href"].(string)) + } + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToSubnetIdentityByID(modelMap map[string]interface{}) (*vpcv1.SubnetIdentityByID, error) { + model := &vpcv1.SubnetIdentityByID{} + model.ID = core.StringPtr(modelMap["id"].(string)) + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToSubnetIdentityByCRN(modelMap map[string]interface{}) (*vpcv1.SubnetIdentityByCRN, error) { + model := &vpcv1.SubnetIdentityByCRN{} + model.CRN = core.StringPtr(modelMap["crn"].(string)) + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceMapToSubnetIdentityByHref(modelMap map[string]interface{}) (*vpcv1.SubnetIdentityByHref, error) { + model := &vpcv1.SubnetIdentityByHref{} + model.Href = core.StringPtr(modelMap["href"].(string)) + return model, nil +} + +func resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcv1.ReservedIPReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["address"] = model.Address + if model.Deleted != nil { + deletedMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceResourceGroupReferenceToMap(model *vpcv1.ResourceGroupReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceToMap(model *vpcv1.SecurityGroupReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := resourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceDeletedToMap(model *vpcv1.SecurityGroupReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceSubnetReferenceToMap(model *vpcv1.SubnetReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := resourceIBMIsVirtualNetworkInterfaceSubnetReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetToMap(model vpcv1.VirtualNetworkInterfaceTargetIntf) (map[string]interface{}, error) { + if _, ok := model.(*vpcv1.VirtualNetworkInterfaceTargetShareMountTargetReference); ok { + return resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMountTargetReferenceToMap(model.(*vpcv1.VirtualNetworkInterfaceTargetShareMountTargetReference)) + } else if _, ok := model.(*vpcv1.VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext); ok { + return resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextToMap(model.(*vpcv1.VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext)) + } else if _, ok := model.(*vpcv1.VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext); ok { + return resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextToMap(model.(*vpcv1.VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext)) + } else if _, ok := model.(*vpcv1.VirtualNetworkInterfaceTarget); ok { + modelMap := make(map[string]interface{}) + model := model.(*vpcv1.VirtualNetworkInterfaceTarget) + if model.Deleted != nil { + deletedMap, err := resourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + if model.Href != nil { + modelMap["href"] = model.Href + } + if model.ID != nil { + modelMap["id"] = model.ID + } + if model.Name != nil { + modelMap["name"] = model.Name + } + if model.ResourceType != nil { + modelMap["resource_type"] = model.ResourceType + } + return modelMap, nil + } else { + return nil, fmt.Errorf("Unrecognized vpcv1.VirtualNetworkInterfaceTargetIntf subtype encountered") + } +} + +func resourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model *vpcv1.ShareMountTargetReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMountTargetReferenceToMap(model *vpcv1.VirtualNetworkInterfaceTargetShareMountTargetReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Deleted != nil { + deletedMap, err := resourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextToMap(model *vpcv1.VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Deleted != nil { + deletedMap, err := resourceIBMIsVirtualNetworkInterfaceInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeletedToMap(model *vpcv1.InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextToMap(model *vpcv1.VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Deleted != nil { + deletedMap, err := resourceIBMIsVirtualNetworkInterfaceBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeletedToMap(model *vpcv1.BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceVPCReferenceToMap(model *vpcv1.VPCReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := resourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcv1.VPCReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceZoneReferenceToMap(model *vpcv1.ZoneReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["href"] = model.Href + modelMap["name"] = model.Name + return modelMap, nil +} diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go new file mode 100644 index 0000000000..8493134d37 --- /dev/null +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go @@ -0,0 +1,181 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func TestAccIBMIsVirtualNetworkInterfaceBasic(t *testing.T) { + var conf vpcv1.VirtualNetworkInterface + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic(), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIsVirtualNetworkInterfaceExists("ibm_is_virtual_network_interface.is_virtual_network_interface", conf), + ), + }, + }, + }) +} + +func TestAccIBMIsVirtualNetworkInterfaceAllArgs(t *testing.T) { + var conf vpcv1.VirtualNetworkInterface + allowIPSpoofing := "false" + autoDelete := "false" + enableInfrastructureNat := "false" + name := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) + allowIPSpoofingUpdate := "true" + autoDeleteUpdate := "true" + enableInfrastructureNatUpdate := "true" + nameUpdate := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceConfig(allowIPSpoofing, autoDelete, enableInfrastructureNat, name), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIsVirtualNetworkInterfaceExists("ibm_is_virtual_network_interface.is_virtual_network_interface", conf), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "allow_ip_spoofing", allowIPSpoofing), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "auto_delete", autoDelete), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "enable_infrastructure_nat", enableInfrastructureNat), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "name", name), + ), + }, + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceConfig(allowIPSpoofingUpdate, autoDeleteUpdate, enableInfrastructureNatUpdate, nameUpdate), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "allow_ip_spoofing", allowIPSpoofingUpdate), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "auto_delete", autoDeleteUpdate), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "enable_infrastructure_nat", enableInfrastructureNatUpdate), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "name", nameUpdate), + ), + }, + resource.TestStep{ + ResourceName: "ibm_is_virtual_network_interface.is_virtual_network_interface", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic() string { + return fmt.Sprintf(` + resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instance" { + } + `) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceConfig(allowIPSpoofing string, autoDelete string, enableInfrastructureNat string, name string) string { + return fmt.Sprintf(` + + resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instance" { + allow_ip_spoofing = %s + auto_delete = %s + enable_infrastructure_nat = %s + ips { + address = "192.168.3.4" + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + name = "my-reserved-ip" + } + name = "%s" + primary_ip { + address = "192.168.3.4" + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + name = "my-reserved-ip" + } + resource_group { + id = "fee82deba12e4c0fb69c3b09d1f12345" + } + security_groups { + crn = "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" + id = "be5df5ca-12a0-494b-907e-aa6ec2bfa271" + name = "my-security-group" + } + subnet { + crn = "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + id = "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + } + } + `, allowIPSpoofing, autoDelete, enableInfrastructureNat, name) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceExists(n string, obj vpcv1.VirtualNetworkInterface) resource.TestCheckFunc { + + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + sess, err := vpcClient(acc.TestAccProvider.Meta()) + if err != nil { + return err + } + + getVirtualNetworkInterfaceOptions := &vpcv1.GetVirtualNetworkInterfaceOptions{} + + getVirtualNetworkInterfaceOptions.SetID(rs.Primary.ID) + + virtualNetworkInterface, _, err := sess.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions) + if err != nil { + return err + } + + obj = *virtualNetworkInterface + return nil + } +} + +func testAccCheckIBMIsVirtualNetworkInterfaceDestroy(s *terraform.State) error { + sess, err := vpcClient(acc.TestAccProvider.Meta()) + if err != nil { + return err + } + + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_is_virtual_network_interface" { + continue + } + + getVirtualNetworkInterfaceOptions := &vpcv1.GetVirtualNetworkInterfaceOptions{} + + getVirtualNetworkInterfaceOptions.SetID(rs.Primary.ID) + + // Try to find the key + _, response, err := sess.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions) + + if err == nil { + return fmt.Errorf("VirtualNetworkInterface still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for VirtualNetworkInterface (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/website/docs/r/is_virtual_network_interface.html.markdown b/website/docs/r/is_virtual_network_interface.html.markdown new file mode 100644 index 0000000000..e444cc9866 --- /dev/null +++ b/website/docs/r/is_virtual_network_interface.html.markdown @@ -0,0 +1,216 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_is_virtual_network_interface" +description: |- + Manages VirtualNetworkInterface. +subcategory: "Virtual Private Cloud API" +--- + +# ibm_is_virtual_network_interface + +Create, update, and delete VirtualNetworkInterfaces with this resource. + +## Example Usage + +```terraform +resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instance" { + allow_ip_spoofing = true + auto_delete = false + enable_infrastructure_nat = true + ips { + address = "192.168.3.4" + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + name = "my-reserved-ip" + resource_type = "subnet_reserved_ip" + } + name = "my-virtual-network-interface" + primary_ip { + address = "192.168.3.4" + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + name = "my-reserved-ip" + resource_type = "subnet_reserved_ip" + } + resource_group { + href = "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345" + id = "fee82deba12e4c0fb69c3b09d1f12345" + name = "my-resource-group" + } + security_groups { + crn = "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" + id = "be5df5ca-12a0-494b-907e-aa6ec2bfa271" + name = "my-security-group" + } + subnet { + crn = "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + id = "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + name = "my-subnet" + resource_type = "subnet" + } +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +* `allow_ip_spoofing` - (Optional, Boolean) 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. +* `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted. +* `enable_infrastructure_nat` - (Optional, Boolean) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`. +* `ips` - (Optional, List) The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`. + * Constraints: The minimum length is `0` items. +Nested schema for **ips**: + * `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + * Constraints: The maximum length is `15` characters. The minimum length is `7` characters. The value must match regular expression `/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/`. + * `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + * `more_info` - (Required, String) Link to documentation about deleted resources. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `href` - (Required, String) The URL for this reserved IP. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `id` - (Required, String) The unique identifier for this reserved IP. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. + * `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^-?([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. + * `resource_type` - (Computed, String) The resource type. + * Constraints: Allowable values are: `subnet_reserved_ip`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. +* `name` - (Optional, String) The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. +* `primary_ip` - (Optional, List) The reserved IP for this virtual network interface. +Nested schema for **primary_ip**: + * `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + * Constraints: The maximum length is `15` characters. The minimum length is `7` characters. The value must match regular expression `/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/`. + * `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + * `more_info` - (Required, String) Link to documentation about deleted resources. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `href` - (Required, String) The URL for this reserved IP. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `id` - (Required, String) The unique identifier for this reserved IP. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. + * `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^-?([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. + * `resource_type` - (Computed, String) The resource type. + * Constraints: Allowable values are: `subnet_reserved_ip`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. +* `resource_group` - (Optional, List) The resource group for this virtual network interface. +Nested schema for **resource_group**: + * `href` - (Computed, String) The URL for this resource group. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `id` - (Required, String) The unique identifier for this resource group. + * Constraints: The maximum length is `32` characters. The minimum length is `32` characters. The value must match regular expression `/^[0-9a-f]{32}$/`. + * `name` - (Computed, String) The name for this resource group. + * Constraints: The maximum length is `40` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9-_ ]+$/`. +* `security_groups` - (Optional, List) The security groups for this virtual network interface. + * Constraints: The minimum length is `1` item. +Nested schema for **security_groups**: + * `crn` - (Required, String) The security group's CRN. + * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. + * `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + * `more_info` - (Required, String) Link to documentation about deleted resources. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `href` - (Required, String) The security group's canonical URL. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `id` - (Required, String) The unique identifier for this security group. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. + * `name` - (Required, String) The name for this security group. The name is unique across all security groups for the VPC. + * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^-?([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. +* `subnet` - (Optional, List) The associated subnet. +Nested schema for **subnet**: + * `crn` - (Required, String) The CRN for this subnet. + * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. + * `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + * `more_info` - (Required, String) Link to documentation about deleted resources. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `href` - (Required, String) The URL for this subnet. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `id` - (Required, String) The unique identifier for this subnet. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. + * `name` - (Computed, String) The name for this subnet. The name is unique across all subnets in the VPC. + * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^-?([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. + * `resource_type` - (Computed, String) The resource type. + * Constraints: Allowable values are: `subnet`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. + +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +* `id` - The unique identifier of the VirtualNetworkInterface. +* `created_at` - (String) The date and time that the virtual network interface was created. +* `crn` - (String) The CRN for this virtual network interface. + * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. +* `href` - (String) The URL for this virtual network interface. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. +* `lifecycle_state` - (String) The lifecycle state of the virtual network interface. + * Constraints: Allowable values are: `deleting`, `failed`, `pending`, `stable`, `suspended`, `updating`, `waiting`. +* `mac_address` - (String) The MAC address of the interface. Absent when the interface is not attached to a target. + * Constraints: The maximum length is `17` characters. The minimum length is `17` characters. The value must match regular expression `/^([0-9A-F]{2}:){5}[0-9A-F]{2}$/`. +* `resource_type` - (String) The resource type. + * Constraints: Allowable values are: `virtual_network_interface`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. +* `target` - (List) The target of this virtual network interface.If absent, this virtual network interface is not attached to a target. +Nested schema for **target**: + * `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + * `more_info` - (String) Link to documentation about deleted resources. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `href` - (String) The URL for this share mount target. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `id` - (String) The unique identifier for this share mount target. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. + * `name` - (String) The name for this share mount target. The name is unique across all mount targets for the file share. + * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^-?([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. + * `resource_type` - (String) The resource type. + * Constraints: Allowable values are: `share_mount_target`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. +* `vpc` - (List) The VPC this virtual network interface resides in. +Nested schema for **vpc**: + * `crn` - (String) The CRN for this VPC. + * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. + * `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + * `more_info` - (String) Link to documentation about deleted resources. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `href` - (String) The URL for this VPC. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `id` - (String) The unique identifier for this VPC. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. + * `name` - (String) The name for this VPC. The name is unique across all VPCs in the region. + * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^-?([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. + * `resource_type` - (String) The resource type. + * Constraints: Allowable values are: `vpc`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. +* `zone` - (List) The zone this virtual network interface resides in. +Nested schema for **zone**: + * `href` - (String) The URL for this zone. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + * `name` - (String) The globally unique name for this zone. + * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. + + +## Import + +You can import the `ibm_is_virtual_network_interface` resource by using `id`. The unique identifier for this virtual network interface. + +# Syntax +``` +$ terraform import ibm_is_virtual_network_interface.is_virtual_network_interface +``` + +# Example +``` +$ terraform import ibm_is_virtual_network_interface.is_virtual_network_interface 0767-fa41aecb-4f21-423d-8082-630bfba1e1d9 +``` From f3ffd5f4922648d5ff7bbd4597960904e3ce15be Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 27 Jul 2023 14:58:25 +0530 Subject: [PATCH 002/132] added floating ip changes --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 4113 ++++++++++------- examples/ibm-is-ng/main.tf | 13 + go.sum | 3 + .../cos/resource_ibm_cos_bucket_test.go | 2 +- ..._virtual_network_interface_floating_ip .go | 94 + ...tual_network_interface_floating_ip_test.go | 123 + ..._virtual_network_interface_floating_ips.go | 134 + ...ual_network_interface_floating_ips_test.go | 124 + ...source_ibm_is_virtual_network_interface.go | 94 +- ...s_virtual_network_interface_floating_ip.go | 208 + ...tual_network_interface_floating_ip_test.go | 177 + ...etwork_interface_floating_ip.html.markdown | 41 + ...twork_interface_floating_ips.html.markdown | 42 + ...etwork_interface_floating_ip.html.markdown | 53 + 14 files changed, 3528 insertions(+), 1693 deletions(-) create mode 100644 ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip .go create mode 100644 ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go create mode 100644 ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips.go create mode 100644 ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips_test.go create mode 100644 ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go create mode 100644 ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go create mode 100644 website/docs/d/is_virtual_network_interface_floating_ip.html.markdown create mode 100644 website/docs/d/is_virtual_network_interface_floating_ips.html.markdown create mode 100644 website/docs/r/is_virtual_network_interface_floating_ip.html.markdown 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 c29949bba9..b71f71fd2c 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.70.0-7df966bf-20230419-195904 + * IBM OpenAPI SDK Code Generator Version: 3.76.0-ad3e6f96-20230724-172814 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -27,6 +27,7 @@ import ( "fmt" "net/http" "reflect" + "strings" "time" "github.com/IBM/go-sdk-core/v5/core" @@ -37,7 +38,7 @@ import ( // VpcV1 : The IBM Cloud Virtual Private Cloud (VPC) API can be used to programmatically provision and manage virtual // server instances, along with subnets, volumes, load balancers, and more. // -// API Version: today +// API Version: 2022-09-13 type VpcV1 struct { Service *core.BaseService @@ -46,7 +47,7 @@ type VpcV1 struct { generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-07-07`. + // and `2023-07-26`. Version *string } @@ -63,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-07-07`. + // and `2023-07-26`. Version *string } @@ -1183,6 +1184,9 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO if createVPCRouteOptions.Action != nil { body["action"] = createVPCRouteOptions.Action } + if createVPCRouteOptions.Advertise != nil { + body["advertise"] = createVPCRouteOptions.Advertise + } if createVPCRouteOptions.Name != nil { body["name"] = createVPCRouteOptions.Name } @@ -1537,6 +1541,9 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom } + if createVPCRoutingTableOptions.AdvertiseRoutesTo != nil { + body["advertise_routes_to"] = createVPCRoutingTableOptions.AdvertiseRoutesTo + } if createVPCRoutingTableOptions.Name != nil { body["name"] = createVPCRoutingTableOptions.Name } @@ -1904,6 +1911,9 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre if createVPCRoutingTableRouteOptions.Action != nil { body["action"] = createVPCRoutingTableRouteOptions.Action } + if createVPCRoutingTableRouteOptions.Advertise != nil { + body["advertise"] = createVPCRoutingTableRouteOptions.Advertise + } if createVPCRoutingTableRouteOptions.Name != nil { body["name"] = createVPCRoutingTableRouteOptions.Name } @@ -2271,9 +2281,10 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio // DeleteSubnet : Delete a subnet // This request deletes a subnet. This operation cannot be reversed. For this request to succeed, the subnet must not be -// referenced by any network interfaces, VPN gateways, or load balancers. A delete operation automatically detaches the -// subnet from any network ACLs, public gateways, or endpoint gateways. All flow log collectors with `auto_delete` set -// to `true` targeting the subnet or any resource in the subnet are automatically deleted. +// referenced by any bare metal server network interfaces, instance network interfaces, virtual network interfaces, VPN +// gateways, or load balancers. A delete operation automatically detaches the subnet from any network ACLs, public +// gateways, or endpoint gateways. All flow log collectors with `auto_delete` set to `true` targeting the subnet or any +// resource in the subnet are automatically deleted. func (vpc *VpcV1) DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) } @@ -3078,8 +3089,9 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS // DeleteSubnetReservedIP : Delete a reserved IP // This request releases a reserved IP. This operation cannot be reversed. // -// For this request to succeed, the reserved IP must not be required by another resource, such as a network interface -// for which it is the primary IP. A provider-owned reserved IP is not allowed to be deleted. +// For this request to succeed, the reserved IP must not be required by another resource, such as a bare metal server +// network interface, instance network interface or virtual network interface for which it is the primary IP. A +// provider-owned reserved IP is not allowed to be deleted. func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) } @@ -3270,9 +3282,6 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS // ListImages : List all images // This request lists all images available in the region. An image provides source data for a volume. Images are either // system-provided, or created from another source, such as importing from Cloud Object Storage. -// -// The images will be sorted by their `created_at` property values, with the newest first. Images with identical -// `created_at` values will be secondarily sorted by ascending `id` property values. func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { return vpc.ListImagesWithContext(context.Background(), listImagesOptions) } @@ -3316,6 +3325,9 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * if listImagesOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) } + if listImagesOptions.Status != nil { + builder.AddQuery("status", strings.Join(listImagesOptions.Status, ",")) + } if listImagesOptions.Visibility != nil { builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) } @@ -3598,6 +3610,128 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions return } +// DeprecateImage : Deprecate an image +// This request deprecates an image, resulting in its `status` becoming `deprecated` and +// `deprecation_at` being set to the current date and time. +// +// The image must: +// - have a `status` of `available` +// - have `catalog_offering.managed` set to `false` +// - not have `deprecation_at` set +// +// The image must not have `deprecation_at` set, must have `catalog_offering.managed` set to +// `false`, and must have a `status` of `available`. +// +// A system-provided image is not allowed to be deprecated. +func (vpc *VpcV1) DeprecateImage(deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { + return vpc.DeprecateImageWithContext(context.Background(), deprecateImageOptions) +} + +// DeprecateImageWithContext is an alternate form of the DeprecateImage method which supports a Context parameter +func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deprecateImageOptions, "deprecateImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deprecateImageOptions, "deprecateImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deprecateImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/deprecate`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deprecateImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeprecateImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ObsoleteImage : Obsolete an image +// This request obsoletes an image, resulting in its `status` becoming `obsolete` and +// `obsolescence_at` being set to the current date and time. +// +// The image must: +// - have a `status` of `available` or `deprecated` +// - have `catalog_offering.managed` set to `false` +// - not have `deprecation_at` set in the future +// - not have `obsolescence_at` set +// +// A system-provided image is not allowed to be obsoleted. +func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { + return vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) +} + +// ObsoleteImageWithContext is an alternate form of the ObsoleteImage method which supports a Context parameter +func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(obsoleteImageOptions, "obsoleteImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *obsoleteImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/obsolete`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range obsoleteImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + // ListImageExportJobs : List all image export jobs // This request lists all export jobs for an image. Each job tracks the exporting of the image to another location, such // as a bucket within cloud object storage. @@ -3671,9 +3805,9 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE // CreateImageExportJob : Create an image export job // This request creates and queues a new export job for the image specified in the URL using the image export job -// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, or `unusable` -// state. The prototype object is structured in the same way as a retrieved image export job, and contains the -// information necessary to create and queue the new image export job. +// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or +// `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains +// the information necessary to create and queue the new image export job. func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { return vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) } @@ -4989,9 +5123,11 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO } // DeleteInstance : Delete an instance -// This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with the instance's -// network interfaces are implicitly disassociated. All flow log collectors with `auto_delete` set to `true` targeting -// the instance and/or the instance's network interfaces are automatically deleted. +// This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with instance +// network interfaces are implicitly disassociated. All virtual network interfaces with `auto_delete` set to `true` +// targeting instance network attachments on the instance are automatically deleted. All flow log collectors with +// `auto_delete` set to `true` targeting the instance, the instance network attachments, the instance network +// interfaces, or the automatically deleted virtual network interfaces are automatically deleted. func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) } @@ -5931,10 +6067,10 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context } // ListInstanceNetworkInterfaces : List all network interfaces on an instance -// This request lists all network interfaces on an instance. A network interface is an abstract representation of a -// network interface card and connects an instance to a subnet. While each network interface can attach to only one -// subnet, multiple network interfaces can be created to attach to multiple subnets. Multiple interfaces may also attach -// to the same subnet. +// This request lists all network interfaces on an instance. An instance network interface is an abstract representation +// of a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to +// any subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on +// the instance may also attach to the same subnet. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) @@ -6000,10 +6136,10 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, } // CreateInstanceNetworkInterface : Create a network interface on an instance -// This request creates a new network interface from a network interface prototype object. The prototype object is -// structured in the same way as a retrieved network interface, and contains the information necessary to create the new -// network interface. Any subnet in the instance's VPC may be specified, even if it is already attached to another -// network interface. Addresses on the network interface must be within the specified subnet's CIDR blocks. +// This request creates a new instance network interface from an instance network interface prototype object. The +// prototype object is structured in the same way as a retrieved instance network interface, and contains the +// information necessary to create the new instance network interface. Any subnet in the instance's VPC may be +// specified. Addresses on the instance network interface must be within the specified subnet's CIDR blocks. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) @@ -6090,10 +6226,11 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, return } -// DeleteInstanceNetworkInterface : Delete a network interface -// This request deletes a network interface. This operation cannot be reversed. Any floating IPs associated with the -// network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to `true` targeting -// the network interface are automatically deleted. The primary network interface is not allowed to be deleted. +// DeleteInstanceNetworkInterface : Delete an instance network interface +// This request deletes an instance network interface. This operation cannot be reversed. Any floating IPs associated +// with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to +// `true` targeting the instance network interface are automatically deleted. The primary instance network interface is +// not allowed to be deleted. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) @@ -6147,8 +6284,8 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, return } -// GetInstanceNetworkInterface : Retrieve a network interface -// This request retrieves a single network interface specified by the identifier in the URL. +// GetInstanceNetworkInterface : Retrieve an instance network interface +// This request retrieves a single instance network interface specified by the identifier in the URL. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) @@ -6214,10 +6351,10 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge return } -// UpdateInstanceNetworkInterface : Update a network interface -// This request updates a network interface with the information provided in a network interface patch object. The -// network interface patch object is structured in the same way as a retrieved network interface and needs to contain -// only the information to be updated. +// UpdateInstanceNetworkInterface : Update an instance network interface +// This request updates an instance network interface with the information provided in an instance network interface +// patch object. The instance network interface patch object is structured in the same way as a retrieved instance +// network interface and needs to contain only the information to be updated. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) @@ -6289,8 +6426,8 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, return } -// ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with a network interface -// This request lists all floating IPs associated with a network interface. +// ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with an instance network interface +// This request lists all floating IPs associated with an instance network interface. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) @@ -6356,8 +6493,8 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context return } -// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from a network interface -// This request disassociates the specified floating IP from the specified network interface. +// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from an instance network interface +// This request disassociates the specified floating IP from the specified instance network interface. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { return vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) @@ -6413,8 +6550,8 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex } // GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP address if it is associated with the network interface and instance -// specified in the URL. +// This request retrieves a specified floating IP address if it is associated with the instance network interface and +// instance specified in the URL. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) @@ -6481,10 +6618,10 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } -// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with a network interface -// This request associates the specified floating IP with the specified network interface, replacing any existing -// association. For this request to succeed, the existing floating IP must not be required by another resource, such as -// a public gateway. A request body is not required, and if provided, is ignored. +// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with an instance network interface +// This request associates the specified floating IP with the specified instance network interface, replacing any +// existing association. For this request to succeed, the existing floating IP must not be required by another resource, +// such as a public gateway. A request body is not required, and if provided, is ignored. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) @@ -6551,16 +6688,16 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } -// ListInstanceNetworkInterfaceIps : List all reserved IPs bound to a network interface -// This request lists all reserved IPs bound to a network interface. +// ListInstanceNetworkInterfaceIps : List all reserved IPs bound to an instance network interface +// This request lists all reserved IPs bound to an instance network interface. // Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) } // ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter // Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { +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 { @@ -6614,7 +6751,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionNetworkInterfaceContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) if err != nil { return } @@ -11802,10 +11939,10 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. } // ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server -// This request lists all network interfaces on a bare metal server. A network interface is an abstract representation -// of a network interface card and connects a bare metal server to a subnet. While each network interface can attach to -// only one subnet, multiple network interfaces can be created to attach to multiple subnets. Multiple interfaces may -// also attach to the same subnet. +// This request lists all network interfaces on a bare metal server. A bare metal server network interface is an +// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network +// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to +// the bare metal server. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) @@ -11877,10 +12014,11 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co } // CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server -// This request creates a new network interface from a network interface prototype object. The prototype object is -// structured in the same way as a retrieved network interface, and contains the information necessary to create the new -// network interface. Any subnet in the bare metal server's VPC may be specified, even if it is already attached to -// another network interface. Addresses on the network interface must be within the specified subnet's CIDR blocks. +// This request creates a new bare metal server network interface from a bare metal server network interface prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and +// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare +// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. +// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) @@ -11951,9 +12089,10 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// DeleteBareMetalServerNetworkInterface : Delete a network interface -// This request deletes a network interface. This operation cannot be reversed. Any floating IPs associated with the -// network interface are implicitly disassociated. The primary network interface is not allowed to be deleted. +// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface +// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server +// network interface is not allowed to be deleted. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) @@ -12007,8 +12146,8 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// GetBareMetalServerNetworkInterface : Retrieve a network interface -// This request retrieves a single network interface specified by the identifier in the URL. +// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface +// This request retrieves a single bare metal server network interface specified by the identifier in the URL. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) @@ -12074,10 +12213,10 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont return } -// UpdateBareMetalServerNetworkInterface : Update a network interface -// This request updates a network interface with the information provided in a network interface patch object. The -// network interface patch object is structured in the same way as a retrieved network interface and needs to contain -// only the information to be updated. +// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface +// This request updates a bare metal server network interface with the information provided in a bare metal server +// network interface patch object. The bare metal server network interface patch object is structured in the same way as +// a retrieved bare metal server network interface and needs to contain only the information to be updated. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) @@ -12149,8 +12288,8 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a network interface -// This request lists all floating IPs associated with a network interface. +// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface +// This request lists all floating IPs associated with a bare metal server network interface. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) @@ -12216,8 +12355,8 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx return } -// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a network interface -// This request disassociates the specified floating IP from the specified network interface. +// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface +// This request disassociates the specified floating IP from the specified bare metal server network interface. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { return vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) @@ -12273,7 +12412,7 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx } // GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the network interface and bare metal server +// This request retrieves a specified floating IP if it is associated with the bare metal server network interface // specified in the URL. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { @@ -12341,8 +12480,8 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } -// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a network interface -// This request associates the specified floating IP with the specified network interface. If +// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface +// This request associates the specified floating IP with the specified bare metal server network interface. If // `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` // is `true`, this replaces any existing association. For this request to succeed, the existing floating IP must not be // required by another resource, such as a public gateway. A request body is not required, and if provided, is ignored. @@ -12412,16 +12551,16 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } -// ListBareMetalServerNetworkInterfaceIps : List all reserved IPs bound to a network interface -// This request lists all reserved IPs bound to a network interface. +// ListBareMetalServerNetworkInterfaceIps : List all reserved IPs bound to a bare metal server network interface +// This request lists all reserved IPs bound to a bare metal server network interface. // Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) } // ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter // Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaceIps") err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") if err != nil { @@ -12469,7 +12608,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionNetworkInterfaceContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext) if err != nil { return } @@ -12480,7 +12619,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. } // GetBareMetalServerNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the network interface and bare metal +// This request retrieves the specified reserved IP address if it is bound to the network interface for the bare metal // server specified in the URL. // 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) { @@ -12550,7 +12689,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co // DeleteBareMetalServer : Delete a bare metal server // This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the -// bare metal server's network interfaces are implicitly disassociated. +// bare metal server network interfaces are implicitly disassociated. func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) } @@ -14365,8 +14504,8 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions // - has a `lifecycle_state` of `updating` // - has a replication operation in progress // -// If the request is accepted, the share `status` will be set to `deleting`. Otherwise, once deletion processing -// completes, the share will no longer be retrievable. +// If the request is accepted, the share `lifecycle_state` will be set to `deleting`. Once deletion processing +// completes, it will no longer be retrievable. func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { return vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) } @@ -14783,8 +14922,8 @@ func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createS // DeleteShareMountTarget : Delete a share mount target // This request deletes a share mount target. This operation cannot be reversed. // -// If the request is accepted, the share mount target `status` will be set to `deleting`. Otherwise, once deletion -// processing completes, the share mount target will no longer be retrievable. +// If the request is accepted, the share mount target `lifecycle_state` will be set to +// `deleting`. Once deletion processing completes, it will no longer be retrievable. func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { return vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) } @@ -15354,7 +15493,7 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt // ListVirtualNetworkInterfaces : List all virtual network interfaces // This request lists all virtual network interfaces in the region. A virtual network interface is a logical abstraction -// of a network interface in a subnet, and may be attached to a target resource. +// 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 @@ -16089,8 +16228,8 @@ func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context } // GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the network interface specified in the -// URL. +// This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in +// the URL. func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { return vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) } @@ -17611,8 +17750,7 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit // This request creates a new security group from a security group prototype object. The prototype object is structured // in the same way as a retrieved security group, and contains the information necessary to create the new security // group. If security group rules are included in the prototype object, those rules will be added to the security group. -// Each security group is scoped to one VPC. Only network interfaces on instances in that VPC can be added to the -// security group. +// Each security group is scoped to one VPC. Only resources in that VPC can be added to the security group. func (vpc *VpcV1) CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { return vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) } @@ -24298,8 +24436,8 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn } // ListFlowLogCollectors : List all flow log collectors -// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over one or more -// network interfaces within a VPC, depending on the chosen target. +// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over the instance +// network interfaces and instance network attachments contained within its target. func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) } @@ -24685,7 +24823,7 @@ type AddBareMetalServerNetworkInterfaceFloatingIPOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // The floating IP identifier. @@ -24771,7 +24909,7 @@ type AddInstanceNetworkInterfaceFloatingIPOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // The floating IP identifier. @@ -26444,7 +26582,8 @@ func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawM // BareMetalServer : BareMetalServer struct type BareMetalServer struct { - // The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. + // The total bandwidth (in megabits per second) shared across the bare metal server network attachments or bare metal + // server network interfaces. Bandwidth *int64 `json:"bandwidth" validate:"required"` // The possible resource types for this property are expected to expand in the future. @@ -26492,15 +26631,15 @@ type BareMetalServer struct { // The network attachments for this bare metal server, including the primary network attachment. NetworkAttachments []BareMetalServerNetworkAttachmentReference `json:"network_attachments,omitempty"` - // The network interfaces for this bare metal server, including the primary network interface. + // The bare metal server network interfaces, including the primary interface. // Deprecated: this field is deprecated and may be removed in a future release. - NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces,omitempty"` + NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces" validate:"required"` // The primary network attachment. PrimaryNetworkAttachment *BareMetalServerNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` - // Primary network interface. - PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterface `json:"primary_network_interface,omitempty"` + // The primary bare metal server network interface. + PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterface `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. @@ -27114,7 +27253,7 @@ type BareMetalServerInitializationPrototype struct { // cloud-init vendor data. For cloud-init enabled images, these keys will also be added as SSH authorized keys for the // administrative user. // - // For Windows images, at least one key must be specified, and one will be chosen to encrypt the administrator + // For Windows images, at least one key must be specified, and one will be selected to encrypt the administrator // password. Keys are optional for other images, but if no keys are specified, the instance will be inaccessible unless // the specified image provides another means of access. Keys []KeyIdentityIntf `json:"keys" validate:"required"` @@ -27397,7 +27536,7 @@ type BareMetalServerNetworkAttachmentCollection struct { // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // Collection of network attachments. + // Collection of bare metal server network attachments. NetworkAttachments []BareMetalServerNetworkAttachmentIntf `json:"network_attachments" validate:"required"` // A link to the next page of resources. This property is present for all pages @@ -27720,11 +27859,10 @@ func UnmarshalBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceCo // - BareMetalServerNetworkInterfaceByPci // - BareMetalServerNetworkInterfaceByVlan type BareMetalServerNetworkInterface struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - // The date and time that the network interface was created. + // The date and time that the bare metal server network interface was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: @@ -27732,23 +27870,23 @@ type BareMetalServerNetworkInterface struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the bare metal server network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - `interface_type` must not be `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - // The floating IPs associated with this network interface. + // The floating IPs associated with this bare metal server network interface. FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - // The URL for this network interface. + // The URL for this bare metal server network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this bare metal server network interface. ID *string `json:"id" validate:"required"` - // The network interface type: - // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity + // 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 @@ -27766,13 +27904,14 @@ type BareMetalServerNetworkInterface struct { // unexpected property value was encountered. InterfaceType *string `json:"interface_type" validate:"required"` - // The MAC address of the interface. If absent, the value is not known. + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. MacAddress *string `json:"mac_address" validate:"required"` - // The name for this network interface. + // The name for this bare metal server network interface. Name *string `json:"name" validate:"required"` - // The network interface port speed in Mbps. + // The bare metal server network interface port speed in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -27780,10 +27919,10 @@ type BareMetalServerNetworkInterface struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this network interface. + // The security groups targeting this bare metal server network interface. SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - // The status of the network interface. + // The status of the bare metal server network interface. Status *string `json:"status" validate:"required"` // The associated subnet. @@ -27805,8 +27944,8 @@ type BareMetalServerNetworkInterface struct { } // Constants associated with the BareMetalServerNetworkInterface.InterfaceType property. -// The network interface type: -// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// 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 @@ -27835,7 +27974,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterface.Status property. -// The status of the network interface. +// The status of the bare metal server network interface. const ( BareMetalServerNetworkInterfaceStatusAvailableConst = "available" BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" @@ -27891,7 +28030,7 @@ type BareMetalServerNetworkInterfaceCollection struct { // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // Collection of network interfaces. + // Collection of bare metal server network interfaces. NetworkInterfaces []BareMetalServerNetworkInterfaceIntf `json:"network_interfaces" validate:"required"` // A link to the next page of resources. This property is present for all pages @@ -27977,8 +28116,7 @@ func UnmarshalBareMetalServerNetworkInterfaceCollectionNext(m map[string]json.Ra // BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct type BareMetalServerNetworkInterfacePatch struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. @@ -27989,14 +28127,14 @@ type BareMetalServerNetworkInterfacePatch struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the bare metal server network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - `interface_type` must not be `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The name for this network interface. The name must not be used by another network interface on the bare metal - // server. + // 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"` } @@ -28039,8 +28177,7 @@ func (bareMetalServerNetworkInterfacePatch *BareMetalServerNetworkInterfacePatch // - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype // - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype type BareMetalServerNetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // If `true`: @@ -28048,14 +28185,14 @@ type BareMetalServerNetworkInterfacePrototype struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the bare metal server network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - `interface_type` must not be `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The network interface type: - // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity + // 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 @@ -28072,19 +28209,20 @@ type BareMetalServerNetworkInterfacePrototype struct { // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. InterfaceType *string `json:"interface_type" validate:"required"` - // The name for this network interface. The name must not be used by another network interface on the bare metal - // server. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The primary IP address to bind to the network interface. This can be specified using - // an existing reserved IP, or a prototype object for a new reserved IP. + // The primary IP address to bind to the bare metal server network interface. This can be + // specified using an existing reserved IP, or a prototype object for a new reserved IP. // // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the network interface's subnet. Otherwise, an available address on the - // subnet will be automatically selected and reserved. + // be available on the bare metal server network interface's subnet. Otherwise, an + // available address on the subnet will be automatically selected and reserved. PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security + // group is used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` // The associated subnet. @@ -28103,8 +28241,8 @@ type BareMetalServerNetworkInterfacePrototype struct { } // Constants associated with the BareMetalServerNetworkInterfacePrototype.InterfaceType property. -// The network interface type: -// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// 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 @@ -28158,6 +28296,42 @@ func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMess return } +// BareMetalServerNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkInterfaceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkInterfaceReferenceTargetContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerPatch : BareMetalServerPatch struct type BareMetalServerPatch struct { // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the bare metal server @@ -28288,19 +28462,19 @@ func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype(m map[string]json return } -// BareMetalServerPrimaryNetworkInterface : Primary network interface. +// BareMetalServerPrimaryNetworkInterface : The primary bare metal server network interface. type BareMetalServerPrimaryNetworkInterface struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this bare metal server network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this bare metal server network interface. ID *string `json:"id" validate:"required"` - // The name for this network interface. + // The name for this bare metal server network interface. Name *string `json:"name" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -28355,8 +28529,7 @@ func UnmarshalBareMetalServerPrimaryNetworkInterface(m map[string]json.RawMessag // BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct type BareMetalServerPrimaryNetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. @@ -28367,14 +28540,14 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the bare metal server network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - `interface_type` must not be `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The network interface type: - // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity + // 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 @@ -28385,19 +28558,20 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. InterfaceType *string `json:"interface_type,omitempty"` - // The name for this network interface. The name must not be used by another network interface on the bare metal - // server. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The primary IP address to bind to the network interface. This can be specified using - // an existing reserved IP, or a prototype object for a new reserved IP. + // The primary IP address to bind to the bare metal server network interface. This can be + // specified using an existing reserved IP, or a prototype object for a new reserved IP. // // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the network interface's subnet. Otherwise, an available address on the - // subnet will be automatically selected and reserved. + // be available on the bare metal server network interface's subnet. Otherwise, an + // available address on the subnet will be automatically selected and reserved. PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security + // group is used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` // The associated subnet. @@ -28405,8 +28579,8 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { } // Constants associated with the BareMetalServerPrimaryNetworkInterfacePrototype.InterfaceType property. -// The network interface type: -// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// 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 @@ -29634,9 +29808,9 @@ type BareMetalServerPrototype struct { // The VPC this bare metal server will reside in. // - // If specified, it must match the VPC for the subnets of the server's network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` + // If specified, it must match the VPC for the subnets that the network attachments or + // network interfaces of the bare metal server are attached to. + VPC BareMetalServerPrototypeVPCIntf `json:"vpc,omitempty"` // The zone this bare metal server will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -29647,10 +29821,10 @@ type BareMetalServerPrototype struct { // The primary network attachment to create for the bare metal server. PrimaryNetworkAttachment *BareMetalServerPrimaryNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the bare metal server. + // The additional bare metal server network interfaces to create. NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` - // The primary network interface to create for the bare metal server. + // The primary bare metal server network interface to create. PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } @@ -29689,7 +29863,7 @@ func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result inte if err != nil { return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalBareMetalServerPrototypeVPC) if err != nil { return } @@ -29717,6 +29891,52 @@ func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result inte return } +// BareMetalServerPrototypeVPC : The VPC this bare metal server will reside in. +// +// If specified, it must match the VPC for the subnets that the network attachments or network interfaces of the bare +// metal server are attached to. +// Models which "extend" this model: +// - BareMetalServerPrototypeVPCVPCIdentityByID +// - BareMetalServerPrototypeVPCVPCIdentityByCRN +// - BareMetalServerPrototypeVPCVPCIdentityByHref +type BareMetalServerPrototypeVPC struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*BareMetalServerPrototypeVPC) isaBareMetalServerPrototypeVPC() bool { + return true +} + +type BareMetalServerPrototypeVPCIntf interface { + isaBareMetalServerPrototypeVPC() bool +} + +// UnmarshalBareMetalServerPrototypeVPC unmarshals an instance of BareMetalServerPrototypeVPC from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeVPC(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeVPC) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerStatusReason : BareMetalServerStatusReason struct type BareMetalServerStatusReason struct { // The status reason code: @@ -30479,7 +30699,7 @@ type CreateBareMetalServerNetworkInterfaceOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface prototype object. + // The bare metal server network interface prototype object. BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"` // Allows users to set headers on API requests @@ -30757,9 +30977,11 @@ type CreateFlowLogCollectorOptions struct { // access to the bucket. StorageBucket LegacyCloudObjectStorageBucketIdentityIntf `json:"storage_bucket" validate:"required"` - // The target this collector will collect flow logs for. If the target is an instance, - // subnet, or VPC, flow logs will not be collected for any network interfaces within the - // target that are themselves the target of a more specific flow log collector. + // 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. Target FlowLogCollectorTargetPrototypeIntf `json:"target" validate:"required"` // Indicates whether this collector will be active upon creation. @@ -31434,23 +31656,23 @@ type CreateInstanceNetworkInterfaceOptions struct { // The associated subnet. Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this instance interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // The name for network interface. The name must not be used by another network interface on the virtual server - // instance. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for the instance network interface. The name must not be used by another network interface on the virtual + // server instance. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The primary IP address to bind to the network interface. This can be specified using - // an existing reserved IP, or a prototype object for a new reserved IP. + // The primary IP address to bind to the instance network interface. This can be + // specified using an existing reserved IP, or a prototype object for a new reserved IP. // // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the network interface's subnet. Otherwise, an available address on the - // subnet will be automatically selected and reserved. + // be available on the instance network interface's subnet. Otherwise, an + // available address on the subnet will be automatically selected and reserved. PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + // The security groups to use for this instance network interface. If unspecified, the VPC's default security group is + // used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` // Allows users to set headers on API requests @@ -33176,7 +33398,7 @@ type CreateVirtualNetworkInterfaceOptions struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the virtual network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - If the virtual network interface is attached: @@ -33193,7 +33415,7 @@ type CreateVirtualNetworkInterfaceOptions struct { // 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 []VirtualNetworkInterfaceIPsReservedIPPrototypeIntf `json:"ips,omitempty"` + 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 @@ -33209,11 +33431,11 @@ type CreateVirtualNetworkInterfaceOptions struct { // 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 VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf `json:"primary_ip,omitempty"` + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` // The resource group to use. If unspecified, the account's [default resource // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup VirtualNetworkInterfacePrototypeResourceGroupIntf `json:"resource_group,omitempty"` + 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. @@ -33251,7 +33473,7 @@ func (_options *CreateVirtualNetworkInterfaceOptions) SetEnableInfrastructureNat } // SetIps : Allow user to set Ips -func (_options *CreateVirtualNetworkInterfaceOptions) SetIps(ips []VirtualNetworkInterfaceIPsReservedIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { +func (_options *CreateVirtualNetworkInterfaceOptions) SetIps(ips []VirtualNetworkInterfaceIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { _options.Ips = ips return _options } @@ -33263,13 +33485,13 @@ func (_options *CreateVirtualNetworkInterfaceOptions) SetName(name string) *Crea } // SetPrimaryIP : Allow user to set PrimaryIP -func (_options *CreateVirtualNetworkInterfaceOptions) SetPrimaryIP(primaryIP VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { +func (_options *CreateVirtualNetworkInterfaceOptions) SetPrimaryIP(primaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { _options.PrimaryIP = primaryIP return _options } // SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateVirtualNetworkInterfaceOptions) SetResourceGroup(resourceGroup VirtualNetworkInterfacePrototypeResourceGroupIntf) *CreateVirtualNetworkInterfaceOptions { +func (_options *CreateVirtualNetworkInterfaceOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions { _options.ResourceGroup = resourceGroup return _options } @@ -33491,6 +33713,13 @@ type CreateVPCRouteOptions struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // All routes in a routing table with the same `destination` 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. @@ -33500,7 +33729,8 @@ type CreateVPCRouteOptions struct { // `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. + // and only when each route has an `action` of `deliver` and a unique `next_hop` IP + // address. NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -33560,6 +33790,12 @@ func (_options *CreateVPCRouteOptions) SetAction(action string) *CreateVPCRouteO return _options } +// SetAdvertise : Allow user to set Advertise +func (_options *CreateVPCRouteOptions) SetAdvertise(advertise bool) *CreateVPCRouteOptions { + _options.Advertise = core.BoolPtr(advertise) + return _options +} + // SetName : Allow user to set Name func (_options *CreateVPCRouteOptions) SetName(name string) *CreateVPCRouteOptions { _options.Name = core.StringPtr(name) @@ -33595,6 +33831,10 @@ type CreateVPCRoutingTableOptions struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` + // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these + // sources. + AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"` + // The name for this routing table. The name must not be used by another routing table in the VPC. If unspecified, the // name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -33604,9 +33844,9 @@ type CreateVPCRoutingTableOptions struct { // set to `true`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, + // the packet will be dropped. // // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing @@ -33620,9 +33860,9 @@ type CreateVPCRoutingTableOptions struct { // - Traffic destined for IP addresses associated with public gateways will not be // subject to routes in this routing table. // - Routes with an action of deliver are treated as drop unless the `next_hop` is an - // IP address bound to a network interface on a subnet in the route's `zone`. - // Therefore, if an incoming packet matches a route with a `next_hop` of an - // internet-bound IP address or a VPN gateway connection, the packet will be dropped. + // IP address in a subnet in the route's `zone`. Therefore, if an incoming packet + // matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"` // If set to `true`, this routing table will be used to route traffic that originates from [Transit @@ -33630,18 +33870,18 @@ type CreateVPCRoutingTableOptions struct { // this property set to `true`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, + // the packet will be dropped. RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` // If set to `true`, this routing table will be used to route traffic that originates from subnets in other zones in // this VPC. The VPC must not already have a routing table with this property set to `true`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. - // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway - // connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, + // the packet will be dropped. RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` // The prototype objects for routes to create for this routing table. If unspecified, the routing table will be created @@ -33652,6 +33892,16 @@ type CreateVPCRoutingTableOptions struct { Headers map[string]string } +// Constants associated with the CreateVPCRoutingTableOptions.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + CreateVPCRoutingTableOptionsAdvertiseRoutesToDirectLinkConst = "direct_link" + CreateVPCRoutingTableOptionsAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + // NewCreateVPCRoutingTableOptions : Instantiate CreateVPCRoutingTableOptions func (*VpcV1) NewCreateVPCRoutingTableOptions(vpcID string) *CreateVPCRoutingTableOptions { return &CreateVPCRoutingTableOptions{ @@ -33671,6 +33921,12 @@ func (_options *CreateVPCRoutingTableOptions) SetAcceptRoutesFrom(acceptRoutesFr return _options } +// SetAdvertiseRoutesTo : Allow user to set AdvertiseRoutesTo +func (_options *CreateVPCRoutingTableOptions) SetAdvertiseRoutesTo(advertiseRoutesTo []string) *CreateVPCRoutingTableOptions { + _options.AdvertiseRoutesTo = advertiseRoutesTo + return _options +} + // SetName : Allow user to set Name func (_options *CreateVPCRoutingTableOptions) SetName(name string) *CreateVPCRoutingTableOptions { _options.Name = core.StringPtr(name) @@ -33736,6 +33992,13 @@ type CreateVPCRoutingTableRouteOptions struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // All routes in a routing table with the same `destination` 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. @@ -33745,7 +34008,8 @@ type CreateVPCRoutingTableRouteOptions struct { // `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. + // and only when each route has an `action` of `deliver` and a unique `next_hop` IP + // address. NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -33812,6 +34076,12 @@ func (_options *CreateVPCRoutingTableRouteOptions) SetAction(action string) *Cre return _options } +// SetAdvertise : Allow user to set Advertise +func (_options *CreateVPCRoutingTableRouteOptions) SetAdvertise(advertise bool) *CreateVPCRoutingTableRouteOptions { + _options.Advertise = core.BoolPtr(advertise) + return _options +} + // SetName : Allow user to set Name func (_options *CreateVPCRoutingTableRouteOptions) SetName(name string) *CreateVPCRoutingTableRouteOptions { _options.Name = core.StringPtr(name) @@ -36051,6 +36321,14 @@ type DefaultRoutingTable struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` + // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these + // sources. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` + // The date and time that this routing table was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -36077,9 +36355,9 @@ type DefaultRoutingTable struct { // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, + // the packet will be dropped. RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from the internet. @@ -36088,27 +36366,27 @@ type DefaultRoutingTable struct { // - Traffic destined for IP addresses associated with public gateways will not be // subject to routes in this routing table. // - Routes with an action of deliver are treated as drop unless the `next_hop` is an - // IP address bound to a network interface on a subnet in the route's `zone`. - // Therefore, if an incoming packet matches a route with a `next_hop` of an - // internet-bound IP address or a VPN gateway connection, the packet will be dropped. + // IP address in a subnet in the route's `zone`. Therefore, if an incoming packet + // matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from from [Transit // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, + // the packet will be dropped. RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this // VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, + // the packet will be dropped. RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` // The routes for the default routing table for this VPC. The table is created with no routes, but routes may be added, @@ -36119,6 +36397,16 @@ type DefaultRoutingTable struct { Subnets []SubnetReference `json:"subnets" validate:"required"` } +// Constants associated with the DefaultRoutingTable.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + DefaultRoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link" + DefaultRoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + // Constants associated with the DefaultRoutingTable.LifecycleState property. // The lifecycle state of the routing table. const ( @@ -36144,6 +36432,10 @@ func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -36403,7 +36695,7 @@ type DeleteBareMetalServerNetworkInterfaceOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -36997,7 +37289,7 @@ type DeleteInstanceNetworkInterfaceOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -38388,6 +38680,34 @@ func (options *DeleteVPNServerRouteOptions) SetHeaders(param map[string]string) return options } +// DeprecateImageOptions : The DeprecateImage options. +type DeprecateImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeprecateImageOptions : Instantiate DeprecateImageOptions +func (*VpcV1) NewDeprecateImageOptions(id string) *DeprecateImageOptions { + return &DeprecateImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeprecateImageOptions) SetID(id string) *DeprecateImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeprecateImageOptions) SetHeaders(param map[string]string) *DeprecateImageOptions { + options.Headers = param + return options +} + // DisconnectVPNClientOptions : The DisconnectVPNClient options. type DisconnectVPNClientOptions struct { // The VPN server identifier. @@ -39453,6 +39773,7 @@ func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result in // FloatingIPTarget : The target of this floating IP. // Models which "extend" this model: // - FloatingIPTargetNetworkInterfaceReference +// - FloatingIPTargetBareMetalServerNetworkInterfaceReference // - FloatingIPTargetPublicGatewayReference // - FloatingIPTargetVirtualNetworkInterfaceReference type FloatingIPTarget struct { @@ -39460,13 +39781,13 @@ type FloatingIPTarget struct { // some supplementary information. Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The name for this network interface. + // The name for this instance network interface. Name *string `json:"name,omitempty"` PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` @@ -39548,10 +39869,10 @@ func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) // - FloatingIPTargetPatchNetworkInterfaceIdentity // - FloatingIPTargetPatchVirtualNetworkInterfaceIdentity type FloatingIPTargetPatch struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` // The CRN for this virtual network interface. @@ -39596,10 +39917,10 @@ func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interfa // - FloatingIPTargetPrototypeNetworkInterfaceIdentity // - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity type FloatingIPTargetPrototype struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` // The CRN for this virtual network interface. @@ -39699,8 +40020,8 @@ type FlowLogCollector struct { // - 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 network interfaces within the target that are themselves the target of - // a more specific flow log collector. + // for any instance network attachments or instance network interfaces within the target + // that are themselves the target of a more specific flow log collector. Target FlowLogCollectorTargetIntf `json:"target" validate:"required"` // The VPC this flow log collector resides in. @@ -39917,8 +40238,8 @@ func (flowLogCollectorPatch *FlowLogCollectorPatch) AsPatch() (_patch map[string // - 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 network interfaces within the target that are themselves the -// target of a more specific flow log collector. +// subnet, or VPC, flow logs will not be collected for any instance network attachments or instance network interfaces +// within the target that are themselves the target of a more specific flow log collector. // Models which "extend" this model: // - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext // - FlowLogCollectorTargetInstanceReference @@ -39931,13 +40252,13 @@ type FlowLogCollectorTarget struct { // some supplementary information. Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The name for this network interface. + // The name for this instance network interface. Name *string `json:"name,omitempty"` // The resource type. @@ -40006,9 +40327,11 @@ func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interf return } -// FlowLogCollectorTargetPrototype : The target this collector will collect flow logs for. If the target is an instance, subnet, or VPC, flow logs will -// not be collected for any network interfaces within the target that are themselves the target of a more specific flow -// log collector. +// 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. // Models which "extend" this model: // - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity // - FlowLogCollectorTargetPrototypeInstanceIdentity @@ -40017,10 +40340,10 @@ func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interf // - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity // - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity type FlowLogCollectorTargetPrototype struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` // The CRN for this virtual server instance. @@ -40285,7 +40608,7 @@ type GetBareMetalServerNetworkInterfaceFloatingIPOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // The floating IP identifier. @@ -40333,7 +40656,7 @@ type GetBareMetalServerNetworkInterfaceIPOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // The reserved IP identifier. @@ -40381,7 +40704,7 @@ type GetBareMetalServerNetworkInterfaceOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -41117,7 +41440,7 @@ type GetInstanceNetworkInterfaceFloatingIPOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // The floating IP identifier. @@ -41165,7 +41488,7 @@ type GetInstanceNetworkInterfaceIPOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // The reserved IP identifier. @@ -41213,7 +41536,7 @@ type GetInstanceNetworkInterfaceOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -43907,6 +44230,11 @@ type Image struct { // The CRN for this image. CRN *string `json:"crn" validate:"required"` + // The deprecation date and time (UTC) for this image. + // + // If absent, no deprecation date and time has been set. + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + // The type of encryption used on the image. Encryption *string `json:"encryption" validate:"required"` @@ -43933,6 +44261,11 @@ type Image struct { // The name for this image. The name is unique across all images in the region. Name *string `json:"name" validate:"required"` + // The obsolescence date and time (UTC) for this image. + // + // If absent, no obsolescence date and time has been set. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` + // The operating system included in this image. OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` @@ -43951,8 +44284,9 @@ type Image struct { // - available: image can be used (provisionable) // - deleting: image is being deleted, and can no longer be used to provision new // resources - // - deprecated: image is administratively slated to be deleted + // - deprecated: image is administratively slated to become `obsolete` // - failed: image is corrupt or did not pass validation + // - obsolete: image administratively set to not be used for new resources // - pending: image is being imported and is not yet `available` // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) // @@ -44003,8 +44337,9 @@ const ( // - available: image can be used (provisionable) // - deleting: image is being deleted, and can no longer be used to provision new // resources -// - deprecated: image is administratively slated to be deleted +// - deprecated: image is administratively slated to become `obsolete` // - failed: image is corrupt or did not pass validation +// - obsolete: image administratively set to not be used for new resources // - pending: image is being imported and is not yet `available` // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) // @@ -44016,6 +44351,7 @@ const ( ImageStatusDeletingConst = "deleting" ImageStatusDeprecatedConst = "deprecated" ImageStatusFailedConst = "failed" + ImageStatusObsoleteConst = "obsolete" ImageStatusPendingConst = "pending" ImageStatusUnusableConst = "unusable" ) @@ -44044,6 +44380,10 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) if err != nil { return @@ -44072,6 +44412,10 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) if err != nil { return @@ -44596,18 +44940,59 @@ func UnmarshalImageIdentity(m map[string]json.RawMessage, result interface{}) (e // ImagePatch : ImagePatch struct type ImagePatch struct { + // The deprecation date and time to set for this image. + // + // This cannot be set if the image has a `status` of `failed` or `deleting`, or if + // `catalog_offering.managed` is `true`. + // + // The date and time must not be in the past, and must be earlier than `obsolescence_at` + // (if `obsolescence_at` is set). Additionally, if the image status is currently + // `deprecated`, the value cannot be changed (but may be removed). + // + // Specify `null` to remove an existing deprecation date and time. If the image status is currently `deprecated`, it + // will become `available`. + // + // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will + // transition to `deprecated` upon its successful creation (or + // `obsolete` if the obsolescence date and time was also reached). + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are // reserved for system-provided images, and are not allowed. Name *string `json:"name,omitempty"` + + // The obsolescence date and time to set for this image. + // + // This cannot be set if the image has a `status` of `failed` or `deleting`, or if + // `catalog_offering.managed` is `true`. + // + // The date and time must not be in the past, and must be later than `deprecation_at` (if + // `deprecation_at` is set). Additionally, if the image status is currently `obsolete`, the value cannot be changed + // (but may be removed). + // + // Specify `null` to remove an existing obsolescence date and time. If the image status is currently `obsolete`, it + // will become `deprecated` if `deprecation_at` is in the past. Otherwise, it will become `available`. + // + // If the obsolescence date and time is reached while the image has a status of `pending`, the image's status will + // transition to `obsolete` upon its successful creation. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` } // UnmarshalImagePatch unmarshals an instance of ImagePatch from the specified map of raw messages. func UnmarshalImagePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ImagePatch) + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -44627,11 +45012,34 @@ func (imagePatch *ImagePatch) AsPatch() (_patch map[string]interface{}, err erro // - ImagePrototypeImageByFile // - ImagePrototypeImageBySourceVolume type ImagePrototype struct { + // The deprecation date and time to set for this image. + // + // The date and time must not be in the past, and must be earlier than `obsolescence_at` + // (if `obsolescence_at` is set). + // + // If unspecified, no deprecation date and time will be set. + // + // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will + // transition to `deprecated` upon its successful creation (or + // `obsolete` if the obsolescence date and time was also reached). + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of // randomly-selected words. Name *string `json:"name,omitempty"` + // The obsolescence date and time to set for this image. + // + // The date and time must not be in the past, and must be later than `deprecation_at` (if + // `deprecation_at` is set). + // + // If unspecified, no obsolescence date and time will be set. + // + // If the obsolescence date and time is reached while the image has a status of + // `pending`, the image's status will transition to `obsolete` upon its successful creation. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` + // The resource group to use. If unspecified, the account's [default resource // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -44681,10 +45089,18 @@ type ImagePrototypeIntf interface { // UnmarshalImagePrototype unmarshals an instance of ImagePrototype from the specified map of raw messages. func UnmarshalImagePrototype(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ImagePrototype) + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -44873,8 +45289,8 @@ type Instance struct { // The availability policy for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicy `json:"availability_policy" validate:"required"` - // The total bandwidth (in megabits per second) shared across the virtual server instance's network interfaces and - // storage volumes. + // The total bandwidth (in megabits per second) shared across the instance network attachments or instance network + // interfaces and storage volumes of the virtual server instance. Bandwidth *int64 `json:"bandwidth" validate:"required"` // Boot volume attachment. @@ -44930,7 +45346,7 @@ type Instance struct { // 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 virtual server instance, including the primary network interface. + // The instance network interfaces, including the primary instance network interface. // Deprecated: this field is deprecated and may be removed in a future release. NetworkInterfaces []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"` @@ -44940,7 +45356,7 @@ type Instance struct { // The primary network attachment for this virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` - // Primary network interface. + // The primary instance network interface. PrimaryNetworkInterface *NetworkInterfaceInstanceContextReference `json:"primary_network_interface" validate:"required"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this virtual @@ -44970,7 +45386,8 @@ type Instance struct { // unexpected reason code was encountered. StatusReasons []InstanceStatusReason `json:"status_reasons" validate:"required"` - // The amount of bandwidth (in megabits per second) allocated exclusively to instance network interfaces. + // The amount of bandwidth (in megabits per second) allocated exclusively to instance network attachments or instance + // network interfaces. TotalNetworkBandwidth *int64 `json:"total_network_bandwidth" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -48183,14 +48600,14 @@ func UnmarshalInstanceNetworkAttachment(m map[string]json.RawMessage, result int // InstanceNetworkAttachmentCollection : InstanceNetworkAttachmentCollection struct type InstanceNetworkAttachmentCollection struct { - // Collection of network attachments. - NetworkAttachments []NetworkAttachment `json:"network_attachments" validate:"required"` + // Collection of instance network attachments. + NetworkAttachments []InstanceNetworkAttachment `json:"network_attachments" validate:"required"` } // UnmarshalInstanceNetworkAttachmentCollection unmarshals an instance of InstanceNetworkAttachmentCollection from the specified map of raw messages. func UnmarshalInstanceNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceNetworkAttachmentCollection) - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalNetworkAttachment) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachment) if err != nil { return } @@ -48388,7 +48805,8 @@ type InstancePatch struct { // instance is placed on a dedicated host, the requested profile `family` must be // the same as the dedicated host `family`. // - Have the same `vcpu.architecture`. - // - Support the number of network interfaces currently attached to the instance. + // - Support the number of network attachments or network interfaces the instance + // currently has. Profile InstancePatchProfileIntf `json:"profile,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -48447,7 +48865,8 @@ func (instancePatch *InstancePatch) AsPatch() (_patch map[string]interface{}, er // instance is placed on a dedicated host, the requested profile `family` must be // the same as the dedicated host `family`. // - Have the same `vcpu.architecture`. -// - Support the number of network interfaces currently attached to the instance. +// - Support the number of network attachments or network interfaces the instance +// currently has. // // Models which "extend" this model: // - InstancePatchProfileInstanceProfileIdentityByName @@ -49883,7 +50302,7 @@ type InstancePrototype struct { // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -49930,8 +50349,8 @@ type InstancePrototype struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance's network - // interfaces. + // If specified, it must match the VPC for the subnets of the instance network + // attachments or instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -49949,10 +50368,10 @@ type InstancePrototype struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering @@ -50211,7 +50630,7 @@ type InstanceTemplate struct { // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -50254,8 +50673,8 @@ type InstanceTemplate struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance's network - // interfaces. + // If specified, it must match the VPC for the subnets of the instance network + // attachments or instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -50273,10 +50692,10 @@ type InstanceTemplate struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering @@ -50573,7 +50992,7 @@ type InstanceTemplatePrototype struct { // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -50618,8 +51037,8 @@ type InstanceTemplatePrototype struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance's network - // interfaces. + // If specified, it must match the VPC for the subnets of the instance network + // attachments or instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -50637,10 +51056,10 @@ type InstanceTemplatePrototype struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) @@ -51528,7 +51947,7 @@ type ListBareMetalServerNetworkInterfaceFloatingIpsOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // Allows users to set headers on API requests @@ -51566,7 +51985,7 @@ type ListBareMetalServerNetworkInterfaceIpsOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // Allows users to set headers on API requests @@ -52448,6 +52867,9 @@ type ListImagesOptions struct { // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` + // Filters the collection to images with a `status` property matching one of the specified comma-separated values. + Status []string `json:"status,omitempty"` + // Filters the collection to images with a `visibility` property matching the specified value. Visibility *string `json:"visibility,omitempty"` @@ -52455,6 +52877,17 @@ type ListImagesOptions struct { Headers map[string]string } +// Constants associated with the ListImagesOptions.Status property. +const ( + ListImagesOptionsStatusAvailableConst = "available" + ListImagesOptionsStatusDeletingConst = "deleting" + ListImagesOptionsStatusDeprecatedConst = "deprecated" + ListImagesOptionsStatusFailedConst = "failed" + ListImagesOptionsStatusObsoleteConst = "obsolete" + ListImagesOptionsStatusPendingConst = "pending" + ListImagesOptionsStatusUnusableConst = "unusable" +) + // Constants associated with the ListImagesOptions.Visibility property. // Filters the collection to images with a `visibility` property matching the specified value. const ( @@ -52491,6 +52924,12 @@ func (_options *ListImagesOptions) SetName(name string) *ListImagesOptions { return _options } +// SetStatus : Allow user to set Status +func (_options *ListImagesOptions) SetStatus(status []string) *ListImagesOptions { + _options.Status = status + return _options +} + // SetVisibility : Allow user to set Visibility func (_options *ListImagesOptions) SetVisibility(visibility string) *ListImagesOptions { _options.Visibility = core.StringPtr(visibility) @@ -52803,7 +53242,7 @@ type ListInstanceNetworkInterfaceFloatingIpsOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // Allows users to set headers on API requests @@ -52841,7 +53280,7 @@ type ListInstanceNetworkInterfaceIpsOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // A server-provided token determining what resource to start the page on. @@ -60678,133 +61117,27 @@ func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, resul return } -// NetworkAttachment : NetworkAttachment struct -type NetworkAttachment struct { - // The date and time that the network attachment was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network attachment. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the network attachment. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - Name *string `json:"name" validate:"required"` - - // The port speed for this network attachment in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - // The primary IP address of the virtual network interface for the 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 network attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The network attachment type. - Type *string `json:"type" validate:"required"` - - // The virtual network interface for this network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` -} - -// Constants associated with the NetworkAttachment.LifecycleState property. -// The lifecycle state of the network attachment. -const ( - NetworkAttachmentLifecycleStateDeletingConst = "deleting" - NetworkAttachmentLifecycleStateFailedConst = "failed" - NetworkAttachmentLifecycleStatePendingConst = "pending" - NetworkAttachmentLifecycleStateStableConst = "stable" - NetworkAttachmentLifecycleStateSuspendedConst = "suspended" - NetworkAttachmentLifecycleStateUpdatingConst = "updating" - NetworkAttachmentLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the NetworkAttachment.Type property. -// The network attachment type. -const ( - NetworkAttachmentTypePrimaryConst = "primary" - NetworkAttachmentTypeSecondaryConst = "secondary" -) - -// UnmarshalNetworkAttachment unmarshals an instance of NetworkAttachment from the specified map of raw messages. -func UnmarshalNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkAttachment) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // NetworkInterface : NetworkInterface struct type NetworkInterface struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this instance interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - // The date and time that the network interface was created. + // The date and time that the instance network interface was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The floating IPs associated with this network interface. + // The floating IPs associated with this instance network interface. FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` - // The name for this network interface. + // The name for this instance network interface. Name *string `json:"name" validate:"required"` - // The network interface port speed in Mbps. + // The instance network interface port speed in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -60812,16 +61145,16 @@ type NetworkInterface struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this network interface. + // The security groups targeting this instance network interface. SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - // The status of the network interface. + // The status of the instance network interface. Status *string `json:"status" validate:"required"` // The associated subnet. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The type of this network interface as it relates to an instance. + // The type of this instance network interface as it relates to an instance. Type *string `json:"type" validate:"required"` } @@ -60832,7 +61165,7 @@ const ( ) // Constants associated with the NetworkInterface.Status property. -// The status of the network interface. +// The status of the instance network interface. const ( NetworkInterfaceStatusAvailableConst = "available" NetworkInterfaceStatusDeletingConst = "deleting" @@ -60841,7 +61174,7 @@ const ( ) // Constants associated with the NetworkInterface.Type property. -// The type of this network interface as it relates to an instance. +// The type of this instance network interface as it relates to an instance. const ( NetworkInterfaceTypePrimaryConst = "primary" NetworkInterfaceTypeSecondaryConst = "secondary" @@ -60912,13 +61245,13 @@ type NetworkInterfaceBareMetalServerContextReference struct { // some supplementary information. Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this bare metal server network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this bare metal server network interface. ID *string `json:"id" validate:"required"` - // The name for this network interface. + // The name for this bare metal server network interface. Name *string `json:"name" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -61056,13 +61389,13 @@ type NetworkInterfaceInstanceContextReference struct { // some supplementary information. Deleted *NetworkInterfaceInstanceContextReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` - // The name for this network interface. + // The name for this instance network interface. Name *string `json:"name" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -61135,12 +61468,11 @@ func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json. // NetworkInterfacePatch : NetworkInterfacePatch struct type NetworkInterfacePatch struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this instance interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // The name for network interface. The name must not be used by another network interface on the virtual server - // instance. + // 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"` } @@ -61171,23 +61503,23 @@ func (networkInterfacePatch *NetworkInterfacePatch) AsPatch() (_patch map[string // NetworkInterfacePrototype : NetworkInterfacePrototype struct type NetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this instance interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // The name for network interface. The name must not be used by another network interface on the virtual server - // instance. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for the instance network interface. The name must not be used by another network interface on the virtual + // server instance. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The primary IP address to bind to the network interface. This can be specified using - // an existing reserved IP, or a prototype object for a new reserved IP. + // The primary IP address to bind to the instance network interface. This can be + // specified using an existing reserved IP, or a prototype object for a new reserved IP. // // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the network interface's subnet. Otherwise, an available address on the - // subnet will be automatically selected and reserved. + // be available on the instance network interface's subnet. Otherwise, an + // available address on the subnet will be automatically selected and reserved. PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + // The security groups to use for this instance network interface. If unspecified, the VPC's default security group is + // used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` // The associated subnet. @@ -61268,7 +61600,7 @@ func UnmarshalNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.Ra // NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct type NetworkInterfaceUnpaginatedCollection struct { - // Collection of network interfaces. + // Collection of instance network interfaces. NetworkInterfaces []NetworkInterface `json:"network_interfaces" validate:"required"` } @@ -61283,6 +61615,34 @@ func UnmarshalNetworkInterfaceUnpaginatedCollection(m map[string]json.RawMessage return } +// ObsoleteImageOptions : The ObsoleteImage options. +type ObsoleteImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewObsoleteImageOptions : Instantiate ObsoleteImageOptions +func (*VpcV1) NewObsoleteImageOptions(id string) *ObsoleteImageOptions { + return &ObsoleteImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ObsoleteImageOptions) SetID(id string) *ObsoleteImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ObsoleteImageOptions) SetHeaders(param map[string]string) *ObsoleteImageOptions { + options.Headers = param + return options +} + // OperatingSystem : OperatingSystem struct type OperatingSystem struct { // The operating system architecture. @@ -62308,7 +62668,7 @@ type RemoveBareMetalServerNetworkInterfaceFloatingIPOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // The floating IP identifier. @@ -62394,7 +62754,7 @@ type RemoveInstanceNetworkInterfaceFloatingIPOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // The floating IP identifier. @@ -62925,6 +63285,86 @@ func (resp *ReservedIPCollection) GetNextStart() (*string, error) { return start, nil } +// ReservedIPCollectionBareMetalServerNetworkInterfaceContext : ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct +type ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct { + // A link to the first page of resources. + First *ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst `json:"first" validate:"required"` + + // Collection of reserved IPs bound to a bare metal server network interface. + Ips []ReservedIP `json:"ips" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionBareMetalServerNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionBareMetalServerNetworkInterfaceContext) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst : A link to the first page of resources. +type ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst from the specified map of raw messages. +func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. +type ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext from the specified map of raw messages. +func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ReservedIPCollectionEndpointGatewayContext : ReservedIPCollectionEndpointGatewayContext struct type ReservedIPCollectionEndpointGatewayContext struct { // A link to the first page of resources. @@ -63034,12 +63474,12 @@ func UnmarshalReservedIPCollectionFirst(m map[string]json.RawMessage, result int return } -// ReservedIPCollectionNetworkInterfaceContext : ReservedIPCollectionNetworkInterfaceContext struct -type ReservedIPCollectionNetworkInterfaceContext struct { +// ReservedIPCollectionInstanceNetworkInterfaceContext : ReservedIPCollectionInstanceNetworkInterfaceContext struct +type ReservedIPCollectionInstanceNetworkInterfaceContext struct { // A link to the first page of resources. - First *ReservedIPCollectionNetworkInterfaceContextFirst `json:"first" validate:"required"` + First *ReservedIPCollectionInstanceNetworkInterfaceContextFirst `json:"first" validate:"required"` - // Collection of reserved IPs bound to a network interface. + // Collection of reserved IPs bound to an instance network interface. Ips []ReservedIP `json:"ips" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -63047,16 +63487,16 @@ type ReservedIPCollectionNetworkInterfaceContext struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *ReservedIPCollectionNetworkInterfaceContextNext `json:"next,omitempty"` + Next *ReservedIPCollectionInstanceNetworkInterfaceContextNext `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalReservedIPCollectionNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionNetworkInterfaceContext from the specified map of raw messages. -func UnmarshalReservedIPCollectionNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionNetworkInterfaceContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionNetworkInterfaceContextFirst) +// UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionInstanceNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionInstanceNetworkInterfaceContext) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextFirst) if err != nil { return } @@ -63068,7 +63508,7 @@ func UnmarshalReservedIPCollectionNetworkInterfaceContext(m map[string]json.RawM if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionNetworkInterfaceContextNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext) if err != nil { return } @@ -63081,7 +63521,7 @@ func UnmarshalReservedIPCollectionNetworkInterfaceContext(m map[string]json.RawM } // Retrieve the value to be passed to a request to access the next page of results -func (resp *ReservedIPCollectionNetworkInterfaceContext) GetNextStart() (*string, error) { +func (resp *ReservedIPCollectionInstanceNetworkInterfaceContext) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -63092,15 +63532,15 @@ func (resp *ReservedIPCollectionNetworkInterfaceContext) GetNextStart() (*string return start, nil } -// ReservedIPCollectionNetworkInterfaceContextFirst : A link to the first page of resources. -type ReservedIPCollectionNetworkInterfaceContextFirst struct { +// ReservedIPCollectionInstanceNetworkInterfaceContextFirst : A link to the first page of resources. +type ReservedIPCollectionInstanceNetworkInterfaceContextFirst struct { // The URL for a page of resources. Href *string `json:"href" validate:"required"` } -// UnmarshalReservedIPCollectionNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionNetworkInterfaceContextFirst from the specified map of raw messages. -func UnmarshalReservedIPCollectionNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionNetworkInterfaceContextFirst) +// UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionInstanceNetworkInterfaceContextFirst from the specified map of raw messages. +func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionInstanceNetworkInterfaceContextFirst) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -63109,15 +63549,15 @@ func UnmarshalReservedIPCollectionNetworkInterfaceContextFirst(m map[string]json return } -// ReservedIPCollectionNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type ReservedIPCollectionNetworkInterfaceContextNext struct { +// ReservedIPCollectionInstanceNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. +type ReservedIPCollectionInstanceNetworkInterfaceContextNext struct { // The URL for a page of resources. Href *string `json:"href" validate:"required"` } -// UnmarshalReservedIPCollectionNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionNetworkInterfaceContextNext from the specified map of raw messages. -func UnmarshalReservedIPCollectionNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionNetworkInterfaceContextNext) +// UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionInstanceNetworkInterfaceContextNext from the specified map of raw messages. +func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionInstanceNetworkInterfaceContextNext) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -63361,6 +63801,7 @@ func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result in // - ReservedIPTargetEndpointGatewayReference // - ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext // - ReservedIPTargetNetworkInterfaceReferenceTargetContext +// - ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext // - ReservedIPTargetLoadBalancerReference // - ReservedIPTargetVPNGatewayReference // - ReservedIPTargetVPNServerReference @@ -63592,6 +64033,10 @@ type Route struct { // - `drop`: drop the packet. Action *string `json:"action" validate:"required"` + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + Advertise *bool `json:"advertise" validate:"required"` + // The date and time that the route was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -63685,6 +64130,10 @@ func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -63926,6 +64375,10 @@ type RouteCollectionVPCContextRoutesItem struct { // - `drop`: drop the packet. Action *string `json:"action" validate:"required"` + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + Advertise *bool `json:"advertise" validate:"required"` + // The date and time that the route was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -64019,6 +64472,10 @@ func UnmarshalRouteCollectionVPCContextRoutesItem(m map[string]json.RawMessage, if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -64217,7 +64674,7 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er // `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. +// an `action` of `deliver` and a unique `next_hop` IP address. // Models which "extend" this model: // - RouteNextHopPatchRouteNextHopIP // - RouteNextHopPatchVPNGatewayConnectionIdentity @@ -64265,6 +64722,13 @@ func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{} // RoutePatch : RoutePatch struct type RoutePatch struct { + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // All routes in a routing table with the same `destination` 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. Name *string `json:"name,omitempty"` @@ -64273,7 +64737,8 @@ type RoutePatch struct { // `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. + // and only when each route has an `action` of `deliver` and a unique `next_hop` IP + // address. NextHop RouteNextHopPatchIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -64287,6 +64752,10 @@ type RoutePatch struct { // UnmarshalRoutePatch unmarshals an instance of RoutePatch from the specified map of raw messages. func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(RoutePatch) + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -64322,6 +64791,13 @@ type RoutePrototype struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // All routes in a routing table with the same `destination` must have the same + // `advertise` value. + Advertise *bool `json:"advertise,omitempty"` + // The destination of the route. At most two routes per `zone` in a table can have the same `destination` and // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Destination *string `json:"destination" validate:"required"` @@ -64335,7 +64811,8 @@ type RoutePrototype struct { // `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. + // and only when each route has an `action` of `deliver` and a unique `next_hop` IP + // address. NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -64380,6 +64857,10 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) if err != nil { return @@ -64408,7 +64889,7 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( // `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. +// an `action` of `deliver` and a unique `next_hop` IP address. // Models which "extend" this model: // - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP // - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity @@ -64519,6 +65000,14 @@ type RoutingTable struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` + // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these + // sources. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` + // The date and time that this routing table was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -64544,9 +65033,9 @@ type RoutingTable struct { // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, + // the packet will be dropped. RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from the internet. @@ -64555,27 +65044,27 @@ type RoutingTable struct { // - Traffic destined for IP addresses associated with public gateways will not be // subject to routes in this routing table. // - Routes with an action of deliver are treated as drop unless the `next_hop` is an - // IP address bound to a network interface on a subnet in the route's `zone`. - // Therefore, if an incoming packet matches a route with a `next_hop` of an - // internet-bound IP address or a VPN gateway connection, the packet will be dropped. + // IP address in a subnet in the route's `zone`. Therefore, if an incoming packet + // matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from from [Transit // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, + // the packet will be dropped. RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this // VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, + // the packet will be dropped. RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` // The routes for this routing table. @@ -64585,6 +65074,16 @@ type RoutingTable struct { Subnets []SubnetReference `json:"subnets" validate:"required"` } +// Constants associated with the RoutingTable.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + RoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link" + RoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + // Constants associated with the RoutingTable.LifecycleState property. // The lifecycle state of the routing table. const ( @@ -64610,6 +65109,10 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -64804,6 +65307,10 @@ type RoutingTablePatch struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` + // The ingress sources to advertise routes to, replacing any existing sources to advertise to. Routes in the table with + // `advertise` enabled will be advertised to these sources. + AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"` + // The name for this routing table. The name must not be used by another routing table in the VPC. Name *string `json:"name,omitempty"` @@ -64811,12 +65318,13 @@ type RoutingTablePatch struct { // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to `true` selects this routing table, provided // no other routing table in the VPC already has this property set to `true`, and no subnets are attached to this // routing table. Updating to - // `false` deselects this routing table. + // `false` deselects this routing table, provided `direct_link` is absent from + // `advertise_routes_to`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, + // the packet will be dropped. RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` // Indicates whether this routing table is used to route traffic that originates from the internet. Updating to `true` @@ -64827,20 +65335,21 @@ type RoutingTablePatch struct { // - Traffic destined for IP addresses associated with public gateways will not be subject // to routes in this routing table. // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is an - // IP address bound to a network interface on a subnet in the route's `zone`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // IP address in a subnet in the route's `zone`. Therefore, if an incoming packet matches + // a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, + // the packet will be dropped. RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"` // Indicates whether this routing table is used to route traffic that originates from // [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. Updating to // `true` selects this routing table, provided no other routing table in the VPC already has this property set to - // `true`, and no subnets are attached to this routing table. Updating to `false` deselects this routing table. + // `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 bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, + // the packet will be dropped. // // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing @@ -64853,12 +65362,22 @@ type RoutingTablePatch struct { // routing table. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, + // the packet will be dropped. RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` } +// 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) @@ -64866,6 +65385,10 @@ func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{} if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -65902,6 +66425,7 @@ func UnmarshalSecurityGroupTargetCollectionNext(m map[string]json.RawMessage, re // Optionally halt processing and surface an error, or bypass resources of unrecognized types. // Models which "extend" this model: // - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext +// - SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext // - SecurityGroupTargetReferenceLoadBalancerReference // - SecurityGroupTargetReferenceEndpointGatewayReference // - SecurityGroupTargetReferenceVPNServerReference @@ -65911,13 +66435,13 @@ type SecurityGroupTargetReference struct { // some supplementary information. Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The name for this network interface. + // The name for this instance network interface. Name *string `json:"name,omitempty"` // The resource type. @@ -66047,6 +66571,8 @@ type Share struct { Encryption *string `json:"encryption" validate:"required"` // The key used to encrypt this file share. + // + // This property will be present if `encryption_type` is `user_managed`. EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` // The URL for this file share. @@ -66055,8 +66581,8 @@ type Share struct { // The unique identifier for this file share. ID *string `json:"id" validate:"required"` - // The maximum input/output operations per second (IOPS) for the file share. In addition, each host accessing the share - // will be restricted to 48000 IOPS. + // The maximum input/output operations per second (IOPS) for the file share. In addition, each client accessing the + // share will be restricted to 48,000 IOPS. // // The maximum IOPS for a share may increase in the future. Iops *int64 `json:"iops" validate:"required"` @@ -66780,17 +67306,80 @@ func UnmarshalShareMountTarget(m map[string]json.RawMessage, result interface{}) // ShareMountTargetCollection : ShareMountTargetCollection struct type ShareMountTargetCollection struct { + // A link to the first page of resources. + First *ShareMountTargetCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + // Collection of share mount targets. MountTargets []ShareMountTarget `json:"mount_targets" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ShareMountTargetCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } // UnmarshalShareMountTargetCollection unmarshals an instance of ShareMountTargetCollection from the specified map of raw messages. func UnmarshalShareMountTargetCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ShareMountTargetCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareMountTargetCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTarget) if err != nil { return } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareMountTargetCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetCollectionFirst : A link to the first page of resources. +type ShareMountTargetCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalShareMountTargetCollectionFirst unmarshals an instance of ShareMountTargetCollectionFirst from the specified map of raw messages. +func UnmarshalShareMountTargetCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type ShareMountTargetCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalShareMountTargetCollectionNext unmarshals an instance of ShareMountTargetCollectionNext from the specified map of raw messages. +func UnmarshalShareMountTargetCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -66836,7 +67425,7 @@ type ShareMountTargetPrototype struct { // `access_control_mode` for the share must be `security_group`. TransitEncryption *string `json:"transit_encryption,omitempty"` - VirtualNetworkInterface VirtualNetworkInterfacePrototypeShareMountTargetContextIntf `json:"virtual_network_interface,omitempty"` + VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface,omitempty"` // Identifies a VPC by a unique property. VPC VPCIdentityIntf `json:"vpc,omitempty"` @@ -66871,7 +67460,7 @@ func UnmarshalShareMountTargetPrototype(m map[string]json.RawMessage, result int if err != nil { return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContext) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) if err != nil { return } @@ -66953,6 +67542,144 @@ func UnmarshalShareMountTargetReferenceDeleted(m map[string]json.RawMessage, res 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`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 + // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // same subnet as the primary IP. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. + // + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP and + // `primary_ip.address` is not specified. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototype) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +type ShareMountTargetVirtualNetworkInterfacePrototypeIntf interface { + isaShareMountTargetVirtualNetworkInterfacePrototype() bool +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototype unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SharePatch : SharePatch struct type SharePatch struct { // The access control mode for the share: @@ -67069,7 +67796,7 @@ func (sharePatch *SharePatch) AsPatch() (_patch map[string]interface{}, err erro // ShareProfile : ShareProfile struct type ShareProfile struct { // The permitted capacity range (in gigabytes) for a share with this profile. - Capacity ShareProfileCapacityIntf `json:"capacity,omitempty"` + Capacity ShareProfileCapacityIntf `json:"capacity" validate:"required"` // The product family this share profile belongs to. Family *string `json:"family" validate:"required"` @@ -67078,7 +67805,7 @@ type ShareProfile struct { Href *string `json:"href" validate:"required"` // The permitted IOPS range for a share with this profile. - Iops ShareProfileIopsIntf `json:"iops,omitempty"` + Iops ShareProfileIopsIntf `json:"iops" validate:"required"` // The globally unique name for this share profile. Name *string `json:"name" validate:"required"` @@ -67460,7 +68187,7 @@ type SharePrototype struct { // The maximum input/output operations per second (IOPS) for the file share. The share must be in the `custom` or // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. // - // In addition, each host accessing the share will be restricted to 48000 IOPS. + // In addition, each client accessing the share will be restricted to 48,000 IOPS. Iops *int64 `json:"iops,omitempty"` // The mount targets for the file share. Each mount target must be in a unique VPC. @@ -67616,7 +68343,7 @@ type SharePrototypeShareContext struct { // The maximum input/output operations per second (IOPS) for the file share. The share must be in the `custom` or // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. // - // In addition, each host accessing the share will be restricted to 48000 IOPS. + // In addition, each client accessing the share will be restricted to 48,000 IOPS. Iops *int64 `json:"iops,omitempty"` // The mount targets for this replica file share. Each mount target must be in a unique VPC. @@ -68967,7 +69694,8 @@ type SubnetPatch struct { // 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. + // The public gateway to use for internet-bound traffic for this subnet. Specify `null` to + // remove an existing public gateway. PublicGateway SubnetPublicGatewayPatchIntf `json:"public_gateway,omitempty"` // The routing table to use for this subnet. The routing table properties @@ -69117,7 +69845,8 @@ func UnmarshalSubnetPrototype(m map[string]json.RawMessage, result interface{}) return } -// SubnetPublicGatewayPatch : The public gateway to use for internet-bound traffic for this subnet. +// SubnetPublicGatewayPatch : The public gateway to use for internet-bound traffic for this subnet. Specify `null` to remove an existing public +// gateway. // Models which "extend" this model: // - SubnetPublicGatewayPatchPublicGatewayIdentityByID // - SubnetPublicGatewayPatchPublicGatewayIdentityByCRN @@ -69544,10 +70273,10 @@ type UpdateBareMetalServerNetworkInterfaceOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. ID *string `json:"id" validate:"required,ne="` - // The network interface patch. + // The bare metal server network interface patch. BareMetalServerNetworkInterfacePatch map[string]interface{} `json:"BareMetalServerNetworkInterface_patch" validate:"required"` // Allows users to set headers on API requests @@ -69869,7 +70598,7 @@ type UpdateIkePolicyOptions struct { ID *string `json:"id" validate:"required,ne="` // The IKE policy patch. - IkePolicyPatch map[string]interface{} `json:"IKEPolicy_patch" validate:"required"` + IkePolicyPatch map[string]interface{} `json:"IkePolicy_patch" validate:"required"` // Allows users to set headers on API requests Headers map[string]string @@ -70338,10 +71067,10 @@ type UpdateInstanceNetworkInterfaceOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. ID *string `json:"id" validate:"required,ne="` - // The network interface patch. + // The instance network interface patch. NetworkInterfacePatch map[string]interface{} `json:"NetworkInterface_patch" validate:"required"` // Allows users to set headers on API requests @@ -74554,7 +75283,7 @@ type VirtualNetworkInterface struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the virtual network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - If the virtual network interface is attached: @@ -74802,11 +75531,11 @@ func UnmarshalVirtualNetworkInterfaceCollectionNext(m map[string]json.RawMessage return } -// VirtualNetworkInterfaceIPsReservedIPPrototype : VirtualNetworkInterfaceIPsReservedIPPrototype struct +// VirtualNetworkInterfaceIPPrototype : VirtualNetworkInterfaceIPPrototype struct // Models which "extend" this model: -// - VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext -// - VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext -type VirtualNetworkInterfaceIPsReservedIPPrototype struct { +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +// - VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPPrototype struct { // The unique identifier for this reserved IP. ID *string `json:"id,omitempty"` @@ -74828,17 +75557,17 @@ type VirtualNetworkInterfaceIPsReservedIPPrototype struct { Name *string `json:"name,omitempty"` } -func (*VirtualNetworkInterfaceIPsReservedIPPrototype) isaVirtualNetworkInterfaceIPsReservedIPPrototype() bool { +func (*VirtualNetworkInterfaceIPPrototype) isaVirtualNetworkInterfaceIPPrototype() bool { return true } -type VirtualNetworkInterfaceIPsReservedIPPrototypeIntf interface { - isaVirtualNetworkInterfaceIPsReservedIPPrototype() bool +type VirtualNetworkInterfaceIPPrototypeIntf interface { + isaVirtualNetworkInterfaceIPPrototype() bool } -// UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototype unmarshals an instance of VirtualNetworkInterfaceIPsReservedIPPrototype from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPsReservedIPPrototype) +// UnmarshalVirtualNetworkInterfaceIPPrototype unmarshals an instance of VirtualNetworkInterfaceIPPrototype from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototype) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -74878,7 +75607,7 @@ type VirtualNetworkInterfacePatch struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the virtual network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - If the virtual network interface is attached: @@ -74924,11 +75653,11 @@ func (virtualNetworkInterfacePatch *VirtualNetworkInterfacePatch) AsPatch() (_pa return } -// VirtualNetworkInterfacePrimaryIPReservedIPPrototype : VirtualNetworkInterfacePrimaryIPReservedIPPrototype struct +// VirtualNetworkInterfacePrimaryIPPrototype : VirtualNetworkInterfacePrimaryIPPrototype struct // Models which "extend" this model: -// - VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext -// - VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext -type VirtualNetworkInterfacePrimaryIPReservedIPPrototype struct { +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext +type VirtualNetworkInterfacePrimaryIPPrototype struct { // The unique identifier for this reserved IP. ID *string `json:"id,omitempty"` @@ -74950,17 +75679,17 @@ type VirtualNetworkInterfacePrimaryIPReservedIPPrototype struct { Name *string `json:"name,omitempty"` } -func (*VirtualNetworkInterfacePrimaryIPReservedIPPrototype) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototype() bool { +func (*VirtualNetworkInterfacePrimaryIPPrototype) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { return true } -type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf interface { - isaVirtualNetworkInterfacePrimaryIPReservedIPPrototype() bool +type VirtualNetworkInterfacePrimaryIPPrototypeIntf interface { + isaVirtualNetworkInterfacePrimaryIPPrototype() bool } -// UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototype unmarshals an instance of VirtualNetworkInterfacePrimaryIPReservedIPPrototype from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPReservedIPPrototype) +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototype unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototype from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototype) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -75004,7 +75733,7 @@ type VirtualNetworkInterfacePrototypeAttachmentContext struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the virtual network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - If the virtual network interface is attached: @@ -75021,7 +75750,7 @@ type VirtualNetworkInterfacePrototypeAttachmentContext struct { // 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 []VirtualNetworkInterfaceIPsReservedIPPrototypeIntf `json:"ips,omitempty"` + 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 @@ -75037,11 +75766,11 @@ type VirtualNetworkInterfacePrototypeAttachmentContext struct { // 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 VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf `json:"primary_ip,omitempty"` + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` // The resource group to use. If unspecified, the account's [default resource // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup VirtualNetworkInterfacePrototypeTargetContextResourceGroupIntf `json:"resource_group,omitempty"` + 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. @@ -75084,201 +75813,7 @@ func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext(m map[string]jso if err != nil { return } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalVirtualNetworkInterfacePrototypeTargetContextResourceGroup) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup : The resource group to use. If unspecified, the account's [default resource -// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. -// Models which "extend" this model: -// - VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID -type VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup struct { - // The unique identifier for this resource group. - ID *string `json:"id,omitempty"` -} - -func (*VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup) isaVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup() bool { - return true -} - -type VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupIntf interface { - isaVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup() bool -} - -// UnmarshalVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup unmarshals an instance of VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeResourceGroup : The resource group to use. If unspecified, the account's [default resource -// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. -// Models which "extend" this model: -// - VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID -type VirtualNetworkInterfacePrototypeResourceGroup struct { - // The unique identifier for this resource group. - ID *string `json:"id,omitempty"` -} - -func (*VirtualNetworkInterfacePrototypeResourceGroup) isaVirtualNetworkInterfacePrototypeResourceGroup() bool { - return true -} - -type VirtualNetworkInterfacePrototypeResourceGroupIntf interface { - isaVirtualNetworkInterfacePrototypeResourceGroup() bool -} - -// UnmarshalVirtualNetworkInterfacePrototypeResourceGroup unmarshals an instance of VirtualNetworkInterfacePrototypeResourceGroup from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeResourceGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeResourceGroup) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeShareMountTargetContext : VirtualNetworkInterfacePrototypeShareMountTargetContext struct -// Models which "extend" this model: -// - VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext -// - VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeShareMountTargetContext 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 network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. - 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 - // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // same subnet as the primary IP. - // - // 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 []VirtualNetworkInterfaceIPsReservedIPPrototypeIntf `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 VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupIntf `json:"resource_group,omitempty"` - - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. Required if `primary_ip` does not specify a reserved IP and - // `primary_ip.address` is not specified. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` - - // 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 (*VirtualNetworkInterfacePrototypeShareMountTargetContext) isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool { - return true -} - -type VirtualNetworkInterfacePrototypeShareMountTargetContextIntf interface { - isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool -} - -// UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContext unmarshals an instance of VirtualNetworkInterfacePrototypeShareMountTargetContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeShareMountTargetContext) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototype) + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) if err != nil { return } @@ -75286,11 +75821,11 @@ func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContext(m map[stri if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototype) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -75318,34 +75853,6 @@ func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContext(m map[stri return } -// VirtualNetworkInterfacePrototypeTargetContextResourceGroup : The resource group to use. If unspecified, the account's [default resource -// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. -// Models which "extend" this model: -// - VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID -type VirtualNetworkInterfacePrototypeTargetContextResourceGroup struct { - // The unique identifier for this resource group. - ID *string `json:"id,omitempty"` -} - -func (*VirtualNetworkInterfacePrototypeTargetContextResourceGroup) isaVirtualNetworkInterfacePrototypeTargetContextResourceGroup() bool { - return true -} - -type VirtualNetworkInterfacePrototypeTargetContextResourceGroupIntf interface { - isaVirtualNetworkInterfacePrototypeTargetContextResourceGroup() bool -} - -// UnmarshalVirtualNetworkInterfacePrototypeTargetContextResourceGroup unmarshals an instance of VirtualNetworkInterfacePrototypeTargetContextResourceGroup from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeTargetContextResourceGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeTargetContextResourceGroup) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VirtualNetworkInterfaceReferenceAttachmentContext : VirtualNetworkInterfaceReferenceAttachmentContext struct type VirtualNetworkInterfaceReferenceAttachmentContext struct { // The CRN for this virtual network interface. @@ -76162,8 +76669,8 @@ type VolumeAttachmentPrototypeVolume struct { // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` - // The resource group to use for this volume. If unspecified, the instance's resource group - // will be used. + // The resource group to use for this volume. If unspecified, the instance's resource + // group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -76859,8 +77366,8 @@ type VolumePrototype struct { // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - // The resource group to use for this volume. If unspecified, default resource group - // will be used. + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -76958,8 +77465,8 @@ type VolumePrototypeInstanceByImageContext struct { // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - // The resource group to use for this volume. If unspecified, the instance's resource group - // will be used. + // The resource group to use for this volume. If unspecified, the instance's resource + // group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -77035,8 +77542,8 @@ type VolumePrototypeInstanceBySourceSnapshotContext struct { // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - // The resource group to use for this volume. If unspecified, the instance's resource group - // will be used. + // The resource group to use for this volume. If unspecified, the instance's resource + // group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The snapshot from which to clone the volume. @@ -78239,11 +78746,10 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAtt // BareMetalServerNetworkInterfaceByHiperSocket : BareMetalServerNetworkInterfaceByHiperSocket struct // This model "extends" BareMetalServerNetworkInterface type BareMetalServerNetworkInterfaceByHiperSocket struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - // The date and time that the network interface was created. + // The date and time that the bare metal server network interface was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: @@ -78251,28 +78757,29 @@ type BareMetalServerNetworkInterfaceByHiperSocket struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the bare metal server network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - `interface_type` must not be `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - // The floating IPs associated with this network interface. + // The floating IPs associated with this bare metal server network interface. FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - // The URL for this network interface. + // The URL for this bare metal server network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this bare metal server network interface. ID *string `json:"id" validate:"required"` - // The MAC address of the interface. If absent, the value is not known. + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. MacAddress *string `json:"mac_address" validate:"required"` - // The name for this network interface. + // The name for this bare metal server network interface. Name *string `json:"name" validate:"required"` - // The network interface port speed in Mbps. + // The bare metal server network interface port speed in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -78280,10 +78787,10 @@ type BareMetalServerNetworkInterfaceByHiperSocket struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this network interface. + // The security groups targeting this bare metal server network interface. SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - // The status of the network interface. + // The status of the bare metal server network interface. Status *string `json:"status" validate:"required"` // The associated subnet. @@ -78304,7 +78811,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Status property. -// The status of the network interface. +// The status of the bare metal server network interface. const ( BareMetalServerNetworkInterfaceByHiperSocketStatusAvailableConst = "available" BareMetalServerNetworkInterfaceByHiperSocketStatusDeletingConst = "deleting" @@ -78404,11 +78911,10 @@ func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.Raw // BareMetalServerNetworkInterfaceByPci : BareMetalServerNetworkInterfaceByPci struct // This model "extends" BareMetalServerNetworkInterface type BareMetalServerNetworkInterfaceByPci struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - // The date and time that the network interface was created. + // The date and time that the bare metal server network interface was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: @@ -78416,28 +78922,29 @@ type BareMetalServerNetworkInterfaceByPci struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the bare metal server network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - `interface_type` must not be `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - // The floating IPs associated with this network interface. + // The floating IPs associated with this bare metal server network interface. FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - // The URL for this network interface. + // The URL for this bare metal server network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this bare metal server network interface. ID *string `json:"id" validate:"required"` - // The MAC address of the interface. If absent, the value is not known. + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. MacAddress *string `json:"mac_address" validate:"required"` - // The name for this network interface. + // The name for this bare metal server network interface. Name *string `json:"name" validate:"required"` - // The network interface port speed in Mbps. + // The bare metal server network interface port speed in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -78445,10 +78952,10 @@ type BareMetalServerNetworkInterfaceByPci struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this network interface. + // The security groups targeting this bare metal server network interface. SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - // The status of the network interface. + // The status of the bare metal server network interface. Status *string `json:"status" validate:"required"` // The associated subnet. @@ -78475,7 +78982,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterfaceByPci.Status property. -// The status of the network interface. +// The status of the bare metal server network interface. const ( BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" @@ -78582,11 +79089,10 @@ func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, // BareMetalServerNetworkInterfaceByVlan : BareMetalServerNetworkInterfaceByVlan struct // This model "extends" BareMetalServerNetworkInterface type BareMetalServerNetworkInterfaceByVlan struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - // The date and time that the network interface was created. + // The date and time that the bare metal server network interface was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: @@ -78594,28 +79100,29 @@ type BareMetalServerNetworkInterfaceByVlan struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the bare metal server network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - `interface_type` must not be `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - // The floating IPs associated with this network interface. + // The floating IPs associated with this bare metal server network interface. FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - // The URL for this network interface. + // The URL for this bare metal server network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this bare metal server network interface. ID *string `json:"id" validate:"required"` - // The MAC address of the interface. If absent, the value is not known. + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. MacAddress *string `json:"mac_address" validate:"required"` - // The name for this network interface. + // The name for this bare metal server network interface. Name *string `json:"name" validate:"required"` - // The network interface port speed in Mbps. + // The bare metal server network interface port speed in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -78623,10 +79130,10 @@ type BareMetalServerNetworkInterfaceByVlan struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this network interface. + // The security groups targeting this bare metal server network interface. SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - // The status of the network interface. + // The status of the bare metal server network interface. Status *string `json:"status" validate:"required"` // The associated subnet. @@ -78658,7 +79165,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterfaceByVlan.Status property. -// The status of the network interface. +// The status of the bare metal server network interface. const ( BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" @@ -78769,8 +79276,7 @@ func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage // BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct // This model "extends" BareMetalServerNetworkInterfacePrototype type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // If `true`: @@ -78778,24 +79284,26 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHi // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the bare metal server network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - `interface_type` must not be `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The name for this network interface. The name must not be used by another network interface on the bare metal - // server. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The primary IP address to bind to the network interface. This can be specified using an existing reserved IP, or a - // prototype object for a new reserved IP. + // The primary IP address to bind to the bare metal server network interface. This can be specified using an existing + // reserved IP, or a prototype object for a new reserved IP. // - // If an existing reserved IP or a prototype object with an address is specified, it must be available on the network - // interface's subnet. Otherwise, an available address on the subnet will be automatically selected and reserved. + // If an existing reserved IP or a prototype object with an address is specified, it must be available on the bare + // metal server network interface's subnet. Otherwise, an available address on the subnet will be automatically + // selected and reserved. PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security + // group is used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` // The associated subnet. @@ -78867,8 +79375,7 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte // BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct // This model "extends" BareMetalServerNetworkInterfacePrototype type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // If `true`: @@ -78876,24 +79383,26 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the bare metal server network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - `interface_type` must not be `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The name for this network interface. The name must not be used by another network interface on the bare metal - // server. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The primary IP address to bind to the network interface. This can be specified using an existing reserved IP, or a - // prototype object for a new reserved IP. + // The primary IP address to bind to the bare metal server network interface. This can be specified using an existing + // reserved IP, or a prototype object for a new reserved IP. // - // If an existing reserved IP or a prototype object with an address is specified, it must be available on the network - // interface's subnet. Otherwise, an available address on the subnet will be automatically selected and reserved. + // If an existing reserved IP or a prototype object with an address is specified, it must be available on the bare + // metal server network interface's subnet. Otherwise, an available address on the subnet will be automatically + // selected and reserved. PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security + // group is used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` // The associated subnet. @@ -78978,8 +79487,7 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte // BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct // This model "extends" BareMetalServerNetworkInterfacePrototype type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // If `true`: @@ -78987,24 +79495,26 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the bare metal server network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - `interface_type` must not be `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The name for this network interface. The name must not be used by another network interface on the bare metal - // server. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The primary IP address to bind to the network interface. This can be specified using an existing reserved IP, or a - // prototype object for a new reserved IP. + // The primary IP address to bind to the bare metal server network interface. This can be specified using an existing + // reserved IP, or a prototype object for a new reserved IP. // - // If an existing reserved IP or a prototype object with an address is specified, it must be available on the network - // interface's subnet. Otherwise, an available address on the subnet will be automatically selected and reserved. + // If an existing reserved IP or a prototype object with an address is specified, it must be available on the bare + // metal server network interface's subnet. Otherwise, an available address on the subnet will be automatically + // selected and reserved. PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security + // group is used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` // The associated subnet. @@ -79096,8 +79606,8 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte return } -// BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the network interfaces of a bare metal server with this profile depends on its -// configuration. +// BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the bare metal server network 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. @@ -79125,8 +79635,8 @@ func UnmarshalBareMetalServerProfileBandwidthDependent(m map[string]json.RawMess return } -// BareMetalServerProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network interfaces of a bare metal -// server with this profile. +// BareMetalServerProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the bare metal server network 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. @@ -79168,8 +79678,8 @@ func UnmarshalBareMetalServerProfileBandwidthEnum(m map[string]json.RawMessage, return } -// BareMetalServerProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network interfaces of a bare metal server with this -// profile. +// BareMetalServerProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the bare metal server network 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. @@ -79204,8 +79714,8 @@ func UnmarshalBareMetalServerProfileBandwidthFixed(m map[string]json.RawMessage, return } -// BareMetalServerProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network interfaces of a bare metal -// server with this profile. +// BareMetalServerProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the 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. @@ -80202,8 +80712,8 @@ func UnmarshalBareMetalServerProfileNetworkAttachmentCountRange(m map[string]jso return } -// BareMetalServerProfileNetworkInterfaceCountDependent : The number of network interfaces supported on a bare metal server with this profile is dependent on its -// configuration. +// BareMetalServerProfileNetworkInterfaceCountDependent : The number of bare metal server network interfaces supported on a bare metal server with this profile is dependent on +// its configuration. // This model "extends" BareMetalServerProfileNetworkInterfaceCount type BareMetalServerProfileNetworkInterfaceCountDependent struct { // The type for this profile field. @@ -80231,7 +80741,7 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent(m map[string] return } -// BareMetalServerProfileNetworkInterfaceCountRange : The number of network interfaces supported on a bare metal server with this profile. +// BareMetalServerProfileNetworkInterfaceCountRange : The number of bare metal server network interfaces supported on a bare metal server with this profile. // This model "extends" BareMetalServerProfileNetworkInterfaceCount type BareMetalServerProfileNetworkInterfaceCountRange struct { // The maximum value for this profile field. @@ -80273,6 +80783,99 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCountRange(m map[string]json return } +// BareMetalServerPrototypeVPCVPCIdentityByCRN : BareMetalServerPrototypeVPCVPCIdentityByCRN struct +// This model "extends" BareMetalServerPrototypeVPC +type BareMetalServerPrototypeVPCVPCIdentityByCRN struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` +} + +// NewBareMetalServerPrototypeVPCVPCIdentityByCRN : Instantiate BareMetalServerPrototypeVPCVPCIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeVPCVPCIdentityByCRN(crn string) (_model *BareMetalServerPrototypeVPCVPCIdentityByCRN, err error) { + _model = &BareMetalServerPrototypeVPCVPCIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrototypeVPCVPCIdentityByCRN) isaBareMetalServerPrototypeVPC() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeVPCVPCIdentityByCRN unmarshals an instance of BareMetalServerPrototypeVPCVPCIdentityByCRN from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeVPCVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeVPCVPCIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototypeVPCVPCIdentityByHref : BareMetalServerPrototypeVPCVPCIdentityByHref struct +// This model "extends" BareMetalServerPrototypeVPC +type BareMetalServerPrototypeVPCVPCIdentityByHref struct { + // The URL for this VPC. + Href *string `json:"href" validate:"required"` +} + +// NewBareMetalServerPrototypeVPCVPCIdentityByHref : Instantiate BareMetalServerPrototypeVPCVPCIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeVPCVPCIdentityByHref(href string) (_model *BareMetalServerPrototypeVPCVPCIdentityByHref, err error) { + _model = &BareMetalServerPrototypeVPCVPCIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrototypeVPCVPCIdentityByHref) isaBareMetalServerPrototypeVPC() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeVPCVPCIdentityByHref unmarshals an instance of BareMetalServerPrototypeVPCVPCIdentityByHref from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeVPCVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeVPCVPCIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototypeVPCVPCIdentityByID : BareMetalServerPrototypeVPCVPCIdentityByID struct +// This model "extends" BareMetalServerPrototypeVPC +type BareMetalServerPrototypeVPCVPCIdentityByID struct { + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` +} + +// NewBareMetalServerPrototypeVPCVPCIdentityByID : Instantiate BareMetalServerPrototypeVPCVPCIdentityByID (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeVPCVPCIdentityByID(id string) (_model *BareMetalServerPrototypeVPCVPCIdentityByID, err error) { + _model = &BareMetalServerPrototypeVPCVPCIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrototypeVPCVPCIdentityByID) isaBareMetalServerPrototypeVPC() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeVPCVPCIdentityByID unmarshals an instance of BareMetalServerPrototypeVPCVPCIdentityByID from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeVPCVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeVPCVPCIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerPrototypeBareMetalServerByNetworkAttachment : BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct // This model "extends" BareMetalServerPrototype type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { @@ -80296,9 +80899,7 @@ type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` - // The VPC this bare metal server will reside in. If specified, it must match the VPC for the subnets of the server's - // network interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` + VPC BareMetalServerPrototypeVPCIntf `json:"vpc,omitempty"` // The zone this bare metal server will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -80353,7 +80954,7 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[s if err != nil { return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalBareMetalServerPrototypeVPC) if err != nil { return } @@ -80396,17 +80997,15 @@ type BareMetalServerPrototypeBareMetalServerByNetworkInterface struct { TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` - // The VPC this bare metal server will reside in. If specified, it must match the VPC for the subnets of the server's - // network interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` + VPC BareMetalServerPrototypeVPCIntf `json:"vpc,omitempty"` // The zone this bare metal server will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The additional network interfaces to create for the bare metal server. + // The additional bare metal server network interfaces to create. NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` - // The primary network interface to create for the bare metal server. + // The primary bare metal server network interface to create. PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } @@ -80453,7 +81052,7 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalBareMetalServerPrototypeVPC) if err != nil { return } @@ -81849,16 +82448,16 @@ func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, return } -// FloatingIPTargetPatchNetworkInterfaceIdentity : Identifies a network interface by a unique property. +// FloatingIPTargetPatchNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. // Models which "extend" this model: // - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID // - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref // This model "extends" FloatingIPTargetPatch type FloatingIPTargetPatchNetworkInterfaceIdentity struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` } @@ -81939,16 +82538,16 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity(m map[string] return } -// FloatingIPTargetPrototypeNetworkInterfaceIdentity : Identifies a network interface by a unique property. +// FloatingIPTargetPrototypeNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. // Models which "extend" this model: // - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID // - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref // This model "extends" FloatingIPTargetPrototype type FloatingIPTargetPrototypeNetworkInterfaceIdentity struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` } @@ -82029,6 +82628,69 @@ func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[str return } +// FloatingIPTargetBareMetalServerNetworkInterfaceReference : FloatingIPTargetBareMetalServerNetworkInterfaceReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetBareMetalServerNetworkInterfaceReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this bare metal server network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server network interface. + ID *string `json:"id" validate:"required"` + + // The name for this bare metal server network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FloatingIPTargetBareMetalServerNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetBareMetalServerNetworkInterfaceReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FloatingIPTargetBareMetalServerNetworkInterfaceReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference unmarshals an instance of FloatingIPTargetBareMetalServerNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetBareMetalServerNetworkInterfaceReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetNetworkInterfaceReference : FloatingIPTargetNetworkInterfaceReference struct // This model "extends" FloatingIPTarget type FloatingIPTargetNetworkInterfaceReference struct { @@ -82036,13 +82698,13 @@ type FloatingIPTargetNetworkInterfaceReference struct { // some supplementary information. Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` - // The name for this network interface. + // The name for this instance network interface. Name *string `json:"name" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -82324,16 +82986,16 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity(m return } -// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity : Identifies a network interface by a unique property. +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. // Models which "extend" this model: // - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID // - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref // This model "extends" FlowLogCollectorTargetPrototype type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` } @@ -82640,13 +83302,13 @@ type FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct { // some supplementary information. Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` - // The name for this network interface. + // The name for this instance network interface. Name *string `json:"name" validate:"required"` // The resource type. @@ -82978,11 +83640,34 @@ func UnmarshalImageIdentityByID(m map[string]json.RawMessage, result interface{} // ImagePrototypeImageByFile : ImagePrototypeImageByFile struct // This model "extends" ImagePrototype type ImagePrototypeImageByFile struct { + // The deprecation date and time to set for this image. + // + // The date and time must not be in the past, and must be earlier than `obsolescence_at` + // (if `obsolescence_at` is set). + // + // If unspecified, no deprecation date and time will be set. + // + // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will + // transition to `deprecated` upon its successful creation (or + // `obsolete` if the obsolescence date and time was also reached). + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of // randomly-selected words. Name *string `json:"name,omitempty"` + // The obsolescence date and time to set for this image. + // + // The date and time must not be in the past, and must be later than `deprecation_at` (if + // `deprecation_at` is set). + // + // If unspecified, no obsolescence date and time will be set. + // + // If the obsolescence date and time is reached while the image has a status of + // `pending`, the image's status will transition to `obsolete` upon its successful creation. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. @@ -83028,10 +83713,18 @@ func (*ImagePrototypeImageByFile) isaImagePrototype() bool { // UnmarshalImagePrototypeImageByFile unmarshals an instance of ImagePrototypeImageByFile from the specified map of raw messages. func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ImagePrototypeImageByFile) + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -83059,11 +83752,34 @@ func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result int // ImagePrototypeImageBySourceVolume : ImagePrototypeImageBySourceVolume struct // This model "extends" ImagePrototype type ImagePrototypeImageBySourceVolume struct { + // The deprecation date and time to set for this image. + // + // The date and time must not be in the past, and must be earlier than `obsolescence_at` + // (if `obsolescence_at` is set). + // + // If unspecified, no deprecation date and time will be set. + // + // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will + // transition to `deprecated` upon its successful creation (or + // `obsolete` if the obsolescence date and time was also reached). + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of // randomly-selected words. Name *string `json:"name,omitempty"` + // The obsolescence date and time to set for this image. + // + // The date and time must not be in the past, and must be later than `deprecation_at` (if + // `deprecation_at` is set). + // + // If unspecified, no obsolescence date and time will be set. + // + // If the obsolescence date and time is reached while the image has a status of + // `pending`, the image's status will transition to `obsolete` upon its successful creation. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The root key used to wrap the system-generated data encryption key for the image. @@ -83096,10 +83812,18 @@ func (*ImagePrototypeImageBySourceVolume) isaImagePrototype() bool { // UnmarshalImagePrototypeImageBySourceVolume unmarshals an instance of ImagePrototypeImageBySourceVolume from the specified map of raw messages. func UnmarshalImagePrototypeImageBySourceVolume(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ImagePrototypeImageBySourceVolume) + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -84498,8 +85222,8 @@ func UnmarshalInstancePlacementTargetPlacementGroupReference(m map[string]json.R return } -// InstanceProfileBandwidthDependent : The total bandwidth shared across the network interfaces and storage volumes of an instance with this profile depends -// on its configuration. +// InstanceProfileBandwidthDependent : The total bandwidth shared across the network attachments or network interfaces and storage volumes of an instance +// with this profile depends on its configuration. // This model "extends" InstanceProfileBandwidth type InstanceProfileBandwidthDependent struct { // The type for this profile field. @@ -84527,8 +85251,8 @@ func UnmarshalInstanceProfileBandwidthDependent(m map[string]json.RawMessage, re return } -// InstanceProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network interfaces and storage -// volumes of an instance with this profile. +// InstanceProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network attachments or network +// interfaces and storage volumes of an instance with this profile. // This model "extends" InstanceProfileBandwidth type InstanceProfileBandwidthEnum struct { // The default value for this profile field. @@ -84570,8 +85294,8 @@ func UnmarshalInstanceProfileBandwidthEnum(m map[string]json.RawMessage, result return } -// InstanceProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network interfaces and storage volumes of an instance -// with this profile. +// InstanceProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network attachments or network interfaces and storage +// volumes of an instance with this profile. // This model "extends" InstanceProfileBandwidth type InstanceProfileBandwidthFixed struct { // The type for this profile field. @@ -84606,8 +85330,8 @@ func UnmarshalInstanceProfileBandwidthFixed(m map[string]json.RawMessage, result return } -// InstanceProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network interfaces and storage volumes -// of an instance with this profile. +// InstanceProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network attachments or network +// interfaces and storage volumes of an instance with this profile. // This model "extends" InstanceProfileBandwidth type InstanceProfileBandwidthRange struct { // The default value for this profile field. @@ -86068,16 +86792,18 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -86098,8 +86824,9 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -86116,8 +86843,10 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -86142,10 +86871,10 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } @@ -86254,16 +86983,18 @@ type InstancePrototypeInstanceByImage struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -86284,8 +87015,9 @@ type InstancePrototypeInstanceByImage struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -86302,8 +87034,10 @@ type InstancePrototypeInstanceByImage struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -86321,10 +87055,10 @@ type InstancePrototypeInstanceByImage struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } @@ -86433,16 +87167,18 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -86463,8 +87199,9 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -86481,8 +87218,10 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -86497,10 +87236,10 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } @@ -86608,16 +87347,18 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -86638,8 +87379,9 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -86656,8 +87398,10 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -86680,13 +87424,13 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The additional network attachments to create for the virtual server instance. NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The template to create this virtual server instance from. @@ -86809,16 +87553,18 @@ type InstancePrototypeInstanceByVolume struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -86839,8 +87585,9 @@ type InstancePrototypeInstanceByVolume struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -86857,8 +87604,10 @@ type InstancePrototypeInstanceByVolume struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -86873,10 +87622,10 @@ type InstancePrototypeInstanceByVolume struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } @@ -87074,16 +87823,18 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -87102,8 +87853,9 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -87120,8 +87872,10 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -87146,10 +87900,10 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } @@ -87258,16 +88012,18 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -87286,8 +88042,9 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -87304,8 +88061,10 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -87323,10 +88082,10 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } @@ -87435,16 +88194,18 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -87463,8 +88224,9 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -87481,8 +88243,10 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -87497,10 +88261,10 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } @@ -87602,16 +88366,18 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -87630,8 +88396,9 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -87648,8 +88415,10 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -87672,13 +88441,13 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The additional network attachments to create for the virtual server instance. NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The template to create this virtual server instance from. @@ -87807,9 +88576,11 @@ type InstanceTemplateInstanceByCatalogOffering struct { // The CRN for this instance template. CRN *string `json:"crn" validate:"required"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The URL for this instance template. @@ -87822,7 +88593,7 @@ type InstanceTemplateInstanceByCatalogOffering struct { // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -87840,8 +88611,9 @@ type InstanceTemplateInstanceByCatalogOffering struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group for this instance template. @@ -87859,8 +88631,10 @@ type InstanceTemplateInstanceByCatalogOffering struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -87885,10 +88659,10 @@ type InstanceTemplateInstanceByCatalogOffering struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } @@ -88019,9 +88793,11 @@ type InstanceTemplateInstanceByImage struct { // The CRN for this instance template. CRN *string `json:"crn" validate:"required"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The URL for this instance template. @@ -88034,7 +88810,7 @@ type InstanceTemplateInstanceByImage struct { // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -88052,8 +88828,9 @@ type InstanceTemplateInstanceByImage struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group for this instance template. @@ -88071,8 +88848,10 @@ type InstanceTemplateInstanceByImage struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -88090,10 +88869,10 @@ type InstanceTemplateInstanceByImage struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } @@ -88224,9 +89003,11 @@ type InstanceTemplateInstanceBySourceSnapshot struct { // The CRN for this instance template. CRN *string `json:"crn" validate:"required"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The URL for this instance template. @@ -88239,7 +89020,7 @@ type InstanceTemplateInstanceBySourceSnapshot struct { // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -88257,8 +89038,9 @@ type InstanceTemplateInstanceBySourceSnapshot struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group for this instance template. @@ -88276,8 +89058,10 @@ type InstanceTemplateInstanceBySourceSnapshot struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -88292,10 +89076,10 @@ type InstanceTemplateInstanceBySourceSnapshot struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } @@ -91944,6 +92728,63 @@ func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[str return } +// ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext : ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this bare metal server network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server network interface. + ID *string `json:"id" validate:"required"` + + // The name for this bare metal server network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ReservedIPTargetEndpointGatewayReference : ReservedIPTargetEndpointGatewayReference struct // This model "extends" ReservedIPTarget type ReservedIPTargetEndpointGatewayReference struct { @@ -92122,13 +92963,13 @@ type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { // some supplementary information. Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` - // The name for this network interface. + // The name for this instance network interface. Name *string `json:"name" validate:"required"` // The resource type. @@ -93808,6 +94649,63 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json return } +// SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this bare metal server network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server network interface. + ID *string `json:"id" validate:"required"` + + // The name for this bare metal server network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SecurityGroupTargetReferenceEndpointGatewayReference : SecurityGroupTargetReferenceEndpointGatewayReference struct // This model "extends" SecurityGroupTargetReference type SecurityGroupTargetReferenceEndpointGatewayReference struct { @@ -93943,13 +94841,13 @@ type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { // some supplementary information. Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` - // The name for this network interface. + // The name for this instance network interface. Name *string `json:"name" validate:"required"` // The resource type. @@ -94243,7 +95141,7 @@ type ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup s // `access_control_mode` for the share must be `security_group`. TransitEncryption *string `json:"transit_encryption,omitempty"` - VirtualNetworkInterface VirtualNetworkInterfacePrototypeShareMountTargetContextIntf `json:"virtual_network_interface" validate:"required"` + VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface" validate:"required"` } // Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.TransitEncryption property. @@ -94257,7 +95155,7 @@ const ( ) // NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup (Generic Model Constructor) -func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(virtualNetworkInterface VirtualNetworkInterfacePrototypeShareMountTargetContextIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup, err error) { +func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(virtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup, err error) { _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup{ VirtualNetworkInterface: virtualNetworkInterface, } @@ -94280,7 +95178,7 @@ func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeSecuri if err != nil { return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContext) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) if err != nil { return } @@ -94349,6 +95247,166 @@ func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(m return } +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototype +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityIntf interface { + ShareMountTargetVirtualNetworkInterfacePrototypeIntf + isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext : The virtual network interface for this target. +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototype +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext struct { + // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on + // this interface. If `true`, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the virtual network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 + // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // same subnet as the primary IP. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. + // + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP and + // `primary_ip.address` is not specified. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ShareProfileCapacityDependentRange : The permitted total capacity (in gigabytes) of a share with this profile depends on its configuration. // This model "extends" ShareProfileCapacity type ShareProfileCapacityDependentRange struct { @@ -94359,7 +95417,7 @@ type ShareProfileCapacityDependentRange struct { Min *int64 `json:"min" validate:"required"` // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + Step *int64 `json:"step" validate:"required"` // The type for this profile field. Type *string `json:"type" validate:"required"` @@ -94542,7 +95600,7 @@ type ShareProfileIopsDependentRange struct { Min *int64 `json:"min" validate:"required"` // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + Step *int64 `json:"step" validate:"required"` // The type for this profile field. Type *string `json:"type" validate:"required"` @@ -94783,7 +95841,7 @@ type SharePrototypeShareBySize struct { // The maximum input/output operations per second (IOPS) for the file share. The share must be in the `custom` or // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. // - // In addition, each host accessing the share will be restricted to 48000 IOPS. + // In addition, each client accessing the share will be restricted to 48,000 IOPS. Iops *int64 `json:"iops,omitempty"` // The mount targets for the file share. Each mount target must be in a unique VPC. @@ -94926,7 +95984,7 @@ type SharePrototypeShareBySourceShare struct { // The maximum input/output operations per second (IOPS) for the file share. The share must be in the `custom` or // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. // - // In addition, each host accessing the share will be restricted to 48000 IOPS. + // In addition, each client accessing the share will be restricted to 48,000 IOPS. Iops *int64 `json:"iops,omitempty"` // The mount targets for the file share. Each mount target must be in a unique VPC. @@ -95356,7 +96414,7 @@ type SubnetPrototypeSubnetByCIDR struct { // hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The network ACL to use for this subnet. If unspecified, the default network ACL for the VPC is used. + // The network ACL to use for this subnet. NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be @@ -95458,7 +96516,7 @@ type SubnetPrototypeSubnetByTotalCount struct { // hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The network ACL to use for this subnet. If unspecified, the default network ACL for the VPC is used. + // The network ACL to use for this subnet. NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be @@ -97206,13 +98264,13 @@ func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernameP return } -// VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext : Identifies a reserved IP by a unique property. The reserved IP must be currently unbound and in the same subnet as +// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext : Identifies a reserved IP by a unique property. The reserved IP must be currently unbound and in the same subnet as // the primary IP. // Models which "extend" this model: -// - VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID -// - VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref -// This model "extends" VirtualNetworkInterfaceIPsReservedIPPrototype -type VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext struct { +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref +// This model "extends" VirtualNetworkInterfaceIPPrototype +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext struct { // The unique identifier for this reserved IP. ID *string `json:"id,omitempty"` @@ -97220,22 +98278,22 @@ type VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetwo Href *string `json:"href,omitempty"` } -func (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { return true } -type VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextIntf interface { - VirtualNetworkInterfaceIPsReservedIPPrototypeIntf - isaVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextIntf interface { + VirtualNetworkInterfaceIPPrototypeIntf + isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool } -func (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPsReservedIPPrototype() bool { +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototype() bool { return true } -// UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -97248,9 +98306,9 @@ func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVir return } -// VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext : The prototype for a new reserved IP. Must be in the same subnet as the primary IP. -// This model "extends" VirtualNetworkInterfaceIPsReservedIPPrototype -type VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext struct { +// VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext : The prototype for a new reserved IP. Must be in the same subnet as the primary IP. +// 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. @@ -97266,13 +98324,13 @@ type VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetw Name *string `json:"name,omitempty"` } -func (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPsReservedIPPrototype() bool { +func (*VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototype() bool { return true } -// UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return @@ -97289,13 +98347,13 @@ func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVi return } -// VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext : Identifies a reserved IP by a unique property. Required if `subnet` is not specified. The reserved IP must be +// 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: -// - VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID -// - VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref -// This model "extends" VirtualNetworkInterfacePrimaryIPReservedIPPrototype -type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext struct { +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref +// This model "extends" VirtualNetworkInterfacePrimaryIPPrototype +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext struct { // The unique identifier for this reserved IP. ID *string `json:"id,omitempty"` @@ -97303,22 +98361,22 @@ type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtua Href *string `json:"href,omitempty"` } -func (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { return true } -type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextIntf interface { - VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf - isaVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextIntf interface { + VirtualNetworkInterfacePrimaryIPPrototypeIntf + isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool } -func (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototype() bool { +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { return true } -// UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -97331,9 +98389,9 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdent return } -// VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext : The prototype for a new reserved IP. Requires `subnet` to be specified. -// This model "extends" VirtualNetworkInterfacePrimaryIPReservedIPPrototype -type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext struct { +// 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. @@ -97349,13 +98407,13 @@ type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtu Name *string `json:"name,omitempty"` } -func (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototype() bool { +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { return true } -// UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return @@ -97437,7 +98495,7 @@ type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePro // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - Packets are passed unchanged to/from the virtual network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - If the virtual network interface is attached: @@ -97454,7 +98512,7 @@ type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePro // 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 []VirtualNetworkInterfaceIPsReservedIPPrototypeIntf `json:"ips,omitempty"` + 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 @@ -97470,11 +98528,11 @@ type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePro // 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 VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf `json:"primary_ip,omitempty"` + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` // The resource group to use. If unspecified, the account's [default resource // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup VirtualNetworkInterfacePrototypeTargetContextResourceGroupIntf `json:"resource_group,omitempty"` + 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. @@ -97504,229 +98562,7 @@ func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInt if err != nil { return } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalVirtualNetworkInterfacePrototypeTargetContextResourceGroup) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID : VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID struct -// This model "extends" VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup -type VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID struct { - // The unique identifier for this resource group. - ID *string `json:"id" validate:"required"` -} - -// NewVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID : Instantiate VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID, err error) { - _model = &VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID) isaVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupResourceGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID : VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID struct -// This model "extends" VirtualNetworkInterfacePrototypeResourceGroup -type VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID struct { - // The unique identifier for this resource group. - ID *string `json:"id" validate:"required"` -} - -// NewVirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID : Instantiate VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID, err error) { - _model = &VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID) isaVirtualNetworkInterfacePrototypeResourceGroup() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" VirtualNetworkInterfacePrototypeShareMountTargetContext -type VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity 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 (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity() bool { - return true -} - -type VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityIntf interface { - VirtualNetworkInterfacePrototypeShareMountTargetContextIntf - isaVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity() bool -} - -func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity unmarshals an instance of VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext : The virtual network interface for this target. -// This model "extends" VirtualNetworkInterfacePrototypeShareMountTargetContext -type VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext 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 network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. - 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 - // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // same subnet as the primary IP. - // - // 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 []VirtualNetworkInterfaceIPsReservedIPPrototypeIntf `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 VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup VirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroupIntf `json:"resource_group,omitempty"` - - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. Required if `primary_ip` does not specify a reserved IP and - // `primary_ip.address` is not specified. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` -} - -func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext) isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext unmarshals an instance of VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfacePrototypeMultiVPCTargetContext) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototype) + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) if err != nil { return } @@ -97734,11 +98570,11 @@ func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetw if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototype) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalVirtualNetworkInterfacePrototypeMultiVPCTargetContextResourceGroup) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -97754,37 +98590,6 @@ func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetw return } -// VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID : VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID struct -// This model "extends" VirtualNetworkInterfacePrototypeTargetContextResourceGroup -type VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID struct { - // The unique identifier for this resource group. - ID *string `json:"id" validate:"required"` -} - -// NewVirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID : Instantiate VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID, err error) { - _model = &VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID) isaVirtualNetworkInterfacePrototypeTargetContextResourceGroup() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeTargetContextResourceGroupResourceGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct // This model "extends" VirtualNetworkInterfaceTarget type VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { @@ -98021,8 +98826,8 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - // The resource group to use for this volume. If unspecified, the instance's resource group - // will be used. + // The resource group to use for this volume. If unspecified, the instance's resource + // group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -98262,7 +99067,6 @@ type VolumePrototypeVolumeByCapacity struct { // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - // The resource group to use for this volume. If unspecified, default 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. @@ -98349,7 +99153,6 @@ type VolumePrototypeVolumeBySourceSnapshot struct { // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - // The resource group to use for this volume. If unspecified, default 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. @@ -98667,7 +99470,7 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentit // FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct // This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` } @@ -98702,7 +99505,7 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdent // FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct // This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` } @@ -98842,7 +99645,7 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetwork // FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct // This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` } @@ -98877,7 +99680,7 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceI // FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct // This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` } @@ -99192,7 +99995,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityIn // FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct // This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` } @@ -99227,7 +100030,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInte // FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct // This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` } @@ -100630,16 +101433,18 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -100660,8 +101465,9 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -100678,8 +101484,10 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -100797,16 +101605,18 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -100827,8 +101637,9 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -100845,8 +101656,10 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -100857,10 +101670,10 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } @@ -100964,16 +101777,18 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -100994,8 +101809,9 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -101012,8 +101828,10 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -101132,16 +101950,18 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface s // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -101162,8 +101982,9 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface s // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -101180,8 +102001,10 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface s // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -101193,10 +102016,10 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface s // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } @@ -101300,16 +102123,18 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -101330,8 +102155,9 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -101348,8 +102174,10 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -101461,16 +102289,18 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -101491,8 +102321,9 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -101509,8 +102340,10 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -101519,10 +102352,10 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } @@ -101622,16 +102455,18 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmen // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -101652,8 +102487,9 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmen // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -101670,8 +102506,10 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmen // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -101783,16 +102621,18 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -101813,8 +102653,9 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -101831,8 +102672,10 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -101841,10 +102684,10 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } @@ -101944,16 +102787,18 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -101972,8 +102817,9 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -101990,8 +102836,10 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -102109,16 +102957,18 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -102137,8 +102987,9 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -102155,8 +103006,10 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -102167,10 +103020,10 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } @@ -102274,16 +103127,18 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -102302,8 +103157,9 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -102320,8 +103176,10 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -102440,16 +103298,18 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -102468,8 +103328,9 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -102486,8 +103347,10 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -102499,10 +103362,10 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } @@ -102606,16 +103469,18 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -102634,8 +103499,9 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -102652,8 +103518,10 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -102765,16 +103633,18 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -102793,8 +103663,9 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -102811,8 +103682,10 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -102821,10 +103694,10 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } @@ -102930,9 +103803,11 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB // The CRN for this instance template. CRN *string `json:"crn" validate:"required"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The URL for this instance template. @@ -102945,7 +103820,7 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -102963,8 +103838,9 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group for this instance template. @@ -102982,8 +103858,10 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -103112,9 +103990,11 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB // The CRN for this instance template. CRN *string `json:"crn" validate:"required"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The URL for this instance template. @@ -103127,7 +104007,7 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -103145,8 +104025,9 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group for this instance template. @@ -103164,8 +104045,10 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -103176,10 +104059,10 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } @@ -103294,9 +104177,11 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment s // The CRN for this instance template. CRN *string `json:"crn" validate:"required"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The URL for this instance template. @@ -103309,7 +104194,7 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment s // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -103327,8 +104212,9 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment s // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group for this instance template. @@ -103346,8 +104232,10 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment s // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -103477,9 +104365,11 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface st // The CRN for this instance template. CRN *string `json:"crn" validate:"required"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The URL for this instance template. @@ -103492,7 +104382,7 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface st // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -103510,8 +104400,9 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface st // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group for this instance template. @@ -103529,8 +104420,10 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface st // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -103542,10 +104435,10 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface st // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } @@ -103660,9 +104553,11 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN // The CRN for this instance template. CRN *string `json:"crn" validate:"required"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The URL for this instance template. @@ -103675,7 +104570,7 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -103693,8 +104588,9 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group for this instance template. @@ -103712,8 +104608,10 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -103836,9 +104734,11 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN // The CRN for this instance template. CRN *string `json:"crn" validate:"required"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The URL for this instance template. @@ -103851,7 +104751,7 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. // - // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if // no keys are specified, the instance will be inaccessible unless the specified image provides another means of // access. @@ -103869,8 +104769,9 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group for this instance template. @@ -103888,8 +104789,10 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -103898,10 +104801,10 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } @@ -105179,34 +106082,34 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroup return } -// VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref : VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref struct -// This model "extends" VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext -type VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref struct { - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` } -// NewVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref : Instantiate VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref(href string) (_model *VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref, err error) { - _model = &VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref{ - Href: core.StringPtr(href), +// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref) isaVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { return true } -func (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref) isaVirtualNetworkInterfaceIPsReservedIPPrototype() bool { +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { return true } -// UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref unmarshals an instance of VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } @@ -105214,34 +106117,34 @@ func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVir return } -// VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID : VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID struct -// This model "extends" VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext -type VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID struct { - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` } -// NewVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID : Instantiate VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID(id string) (_model *VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID, err error) { - _model = &VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID{ - ID: core.StringPtr(id), +// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID) isaVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { return true } -func (*VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID) isaVirtualNetworkInterfaceIPsReservedIPPrototype() bool { +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { return true } -// UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID unmarshals an instance of VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -105249,34 +106152,34 @@ func UnmarshalVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVir return } -// VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref : VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref struct -// This model "extends" VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext -type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref struct { - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` } -// NewVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref : Instantiate VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref(href string) (_model *VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref, err error) { - _model = &VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref{ - Href: core.StringPtr(href), +// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { return true } -func (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototype() bool { +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { return true } -// UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } @@ -105284,34 +106187,34 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdent return } -// VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID : VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID struct -// This model "extends" VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext -type VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID struct { - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` +// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref struct +// This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` } -// NewVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID : Instantiate VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID(id string) (_model *VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID, err error) { - _model = &VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID{ - ID: core.StringPtr(id), +// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref(href string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref, err error) { + _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref{ + Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { return true } -func (*VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID) isaVirtualNetworkInterfacePrimaryIPReservedIPPrototype() bool { +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref) isaVirtualNetworkInterfaceIPPrototype() bool { return true } -// UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID unmarshals an instance of VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -105319,34 +106222,34 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdent return } -// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` +// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID struct +// This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` } -// NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), +// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID(id string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID, err error) { + _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID{ + ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { return true } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID) isaVirtualNetworkInterfaceIPPrototype() bool { return true } -// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } @@ -105354,33 +106257,33 @@ func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInt return } -// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. +// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref struct +// This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref struct { + // The URL for this reserved IP. Href *string `json:"href" validate:"required"` } -// NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ +// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref(href string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref, err error) { + _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { return true } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { return true } -// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -105389,33 +106292,33 @@ func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInt return } -// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. +// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID struct +// This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID struct { + // The unique identifier for this reserved IP. ID *string `json:"id" validate:"required"` } -// NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ +// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID(id string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID, err error) { + _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { return true } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { return true } -// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -105424,33 +106327,33 @@ func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInt return } -// VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { +// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { // The CRN for this virtual network interface. CRN *string `json:"crn" validate:"required"` } -// NewVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ +// NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity() bool { +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { return true } -func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool { +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { return true } -// UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) +// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return @@ -105459,33 +106362,33 @@ func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetw return } -// VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { +// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { // The URL for this virtual network interface. Href *string `json:"href" validate:"required"` } -// NewVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ +// NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity() bool { +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { return true } -func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool { +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { return true } -// UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) +// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -105494,33 +106397,33 @@ func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetw return } -// VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { +// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { // The unique identifier for this virtual network interface. ID *string `json:"id" validate:"required"` } -// NewVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ +// NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentity() bool { +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { return true } -func (*VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeShareMountTargetContext() bool { +func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { return true } -// UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeShareMountTargetContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) +// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return diff --git a/examples/ibm-is-ng/main.tf b/examples/ibm-is-ng/main.tf index 99ea42252d..7471c646ea 100644 --- a/examples/ibm-is-ng/main.tf +++ b/examples/ibm-is-ng/main.tf @@ -1309,3 +1309,16 @@ resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instan id = "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" } } +resource "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { + virtual_network_interface = + floating_ip = +} + +data "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { + virtual_network_interface = + floating_ip = +} + +data "ibm_is_virtual_network_interface_floating_ips" "vni_fips" { + virtual_network_interface = +} \ No newline at end of file diff --git a/go.sum b/go.sum index f8d5b01549..c2f04df783 100644 --- a/go.sum +++ b/go.sum @@ -138,6 +138,7 @@ github.com/IBM/go-sdk-core/v5 v5.7.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= +github.com/IBM/go-sdk-core/v5 v5.12.1/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= github.com/IBM/go-sdk-core/v5 v5.13.4 h1:kJvBNQOwhFRkXCPapjNvKVC7n7n2vd1Nr6uUtDZGcfo= github.com/IBM/go-sdk-core/v5 v5.13.4/go.mod h1:gKRSB+YyKsGlRQW7v5frlLbue5afulSvrRa4O26o4MM= github.com/IBM/ibm-cos-sdk-go v1.3.1/go.mod h1:YLBAYobEA8bD27P7xpMwSQeNQu6W3DNBtBComXrRzRY= @@ -1286,9 +1287,11 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/onsi/gomega v1.18.0/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU= +github.com/onsi/gomega v1.27.7/go.mod h1:1p8OOlwo2iUUDsHnOrjE5UKYJ+e3W8eQ3qSlRahPmr4= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= diff --git a/ibm/service/cos/resource_ibm_cos_bucket_test.go b/ibm/service/cos/resource_ibm_cos_bucket_test.go index 0e0c34dc2f..c17052e661 100644 --- a/ibm/service/cos/resource_ibm_cos_bucket_test.go +++ b/ibm/service/cos/resource_ibm_cos_bucket_test.go @@ -1255,7 +1255,7 @@ func TestAccIBMCOSHPCS(t *testing.T) { }) } -//new hpcs +// new hpcs func TestAccIBMCOSKPKmsParamValid(t *testing.T) { instanceName := fmt.Sprintf("kms_%d", acctest.RandIntRange(10, 100)) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip .go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip .go new file mode 100644 index 0000000000..37a9d19160 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip .go @@ -0,0 +1,94 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func DataSourceIBMIsVirtualNetworkInterfaceFloatingIP() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIBMIsVirtualNetworkInterfaceFloatingIPRead, + + Schema: map[string]*schema.Schema{ + "virtual_network_interface": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The virtual network interface identifier", + }, + "floating_ip": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The floating IP identifier", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this floating IP. The name is unique across all floating IPs in the region.", + }, + + "deleted": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "If present, this property indicates the referenced resource has been deleted, and provides some supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Link to documentation about deleted resources", + }, + }, + }, + }, + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The globally unique IP address.", + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this floating IP.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this floating IP.", + }, + }, + } +} + +func dataSourceIBMIsVirtualNetworkInterfaceFloatingIPRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + sess, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + vniId := d.Get("virtual_network_interface").(string) + fipId := d.Get("floating_ip").(string) + + getNetworkInterfaceFloatingIPOptions := &vpcv1.GetNetworkInterfaceFloatingIPOptions{} + getNetworkInterfaceFloatingIPOptions.SetVirtualNetworkInterfaceID(vniId) + getNetworkInterfaceFloatingIPOptions.SetID(fipId) + + floatingIP, response, err := sess.GetNetworkInterfaceFloatingIPWithContext(context, getNetworkInterfaceFloatingIPOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetVirtualNetworkInterfaceFloatingIPWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterfaceFloatingIPWithContext failed %s\n%s", err, response)) + } + resourceIBMIsVirtualNetworkInterfaceFloatingIPGet(d, floatingIP) + return nil +} diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go new file mode 100644 index 0000000000..2569321c4c --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go @@ -0,0 +1,123 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIBMIsVirtualNetworkInterfaceFloatingIPDataSourceBasic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "instance_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "network_interface_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "address"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "resource_group.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "status"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "zone.#"), + ), + }, + }, + }) +} + +func TestAccIBMIsVirtualNetworkInterfaceFloatingIPDataSourceAllArgs(t *testing.T) { + floatingIPName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDataSourceConfig(floatingIPName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "instance_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "network_interface_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "address"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "resource_group.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "status"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "target.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "zone.#"), + ), + }, + }, + }) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDataSourceConfigBasic() string { + return fmt.Sprintf(` + resource "ibm_is_floating_ip" "is_floating_ip_instance" { + } + + data "ibm_is_virtual_network_interface_floating_ip" "is_floating_ip_instance" { + virtual_network_interface = "virtual_network_interface_id" + flating_ip = "flating_ip_id" + } + `) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDataSourceConfig(floatingIPName string) string { + return fmt.Sprintf(` + resource "ibm_is_floating_ip" "is_floating_ip_instance" { + name = "%s" + resource_group { + href = "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345" + id = "fee82deba12e4c0fb69c3b09d1f12345" + name = "my-resource-group" + } + target { + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" + id = "10c02d81-0ecb-4dc5-897d-28392913b81e" + name = "my-instance-network-interface" + primary_ip { + address = "192.168.3.4" + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + name = "my-reserved-ip" + resource_type = "subnet_reserved_ip" + } + resource_type = "network_interface" + } + zone { + href = "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1" + name = "us-south-1" + } + } + + data "ibm_is_floating_ip" "is_floating_ip_instance" { + instance_id = "instance_id" + network_interface_id = "network_interface_id" + id = "id" + } + `, floatingIPName) +} diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips.go new file mode 100644 index 0000000000..227bbbe364 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips.go @@ -0,0 +1,134 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "time" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func DataSourceIBMIsVirtualNetworkInterfaceFloatingIPs() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIBMIsVirtualNetworkInterfaceFloatingIPsRead, + + Schema: map[string]*schema.Schema{ + "virtual_network_interface": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The virtual network interface identifier", + }, + "floating_ips": { + Type: schema.TypeList, + Description: "List of floating ips associated with the virtual network interface id", + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "floating_ip": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The floating IP identifier", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this floating IP. The name is unique across all floating IPs in the region.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "If present, this property indicates the referenced resource has been deleted, and provides some supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Link to documentation about deleted resources", + }, + }, + }, + }, + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The globally unique IP address.", + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this floating IP.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this floating IP.", + }, + }, + }, + }, + }, + } +} + +func dataSourceIBMIsVirtualNetworkInterfaceFloatingIPsRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + sess, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + vniId := d.Get("virtual_network_interface").(string) + + start := "" + allrecs := []vpcv1.FloatingIPReference{} + for { + listNetworkInterfaceFloatingIpsOptions := &vpcv1.ListNetworkInterfaceFloatingIpsOptions{} + listNetworkInterfaceFloatingIpsOptions.SetVirtualNetworkInterfaceID(vniId) + if start != "" { + listNetworkInterfaceFloatingIpsOptions.Start = &start + } + floatingIPCollection, response, err := sess.ListNetworkInterfaceFloatingIpsWithContext(context, listNetworkInterfaceFloatingIpsOptions) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error ListNetworkInterfaceFloatingIpsWithContext %s\n%s", err, response)) + } + start = flex.GetNext(floatingIPCollection.Next) + allrecs = append(allrecs, floatingIPCollection.FloatingIps...) + if start == "" { + break + } + } + floatingIpsInfo := make([]map[string]interface{}, 0) + for _, floatingIP := range allrecs { + l := map[string]interface{}{} + + if !core.IsNil(floatingIP.Name) { + l["name"] = floatingIP.Name + } + l["address"] = floatingIP.Address + + l["crn"] = floatingIP.CRN + l["href"] = floatingIP.Href + if deleted, err := resourceIBMIsVirtualNetworkInterfaceFloatingIPNetworkInterfaceReferenceDeletedToMap(floatingIP.Deleted); err != nil { + return diag.FromErr(fmt.Errorf("Error setting status: %s", err)) + } else { + l["deleted"] = deleted + } + floatingIpsInfo = append(floatingIpsInfo, l) + + } + d.SetId(dataSourceIBMISVirtualNetworkInterfaceFloatingIPsID(d)) + d.Set("floating_ips", floatingIpsInfo) + + return nil +} + +// dataSourceIBMISVirtualNetworkInterfaceFloatingIPsID returns a reasonable ID for a Virtual Network Interface FloatingIPs ID list. +func dataSourceIBMISVirtualNetworkInterfaceFloatingIPsID(d *schema.ResourceData) string { + return time.Now().UTC().String() +} diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips_test.go new file mode 100644 index 0000000000..cba2e2623b --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips_test.go @@ -0,0 +1,124 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceBasic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "instance_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "network_interface_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "address"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "resource_group.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "status"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "zone.#"), + ), + }, + }, + }) +} + +func TestAccIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceAllArgs(t *testing.T) { + floatingIPName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceConfig(floatingIPName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "instance_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "network_interface_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "address"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "resource_group.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "status"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "target.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "zone.#"), + ), + }, + }, + }) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceConfigBasic() string { + return fmt.Sprintf(` + resource "ibm_is_floating_ip" "is_floating_ip_instance" { + } + + data "ibm_is_floating_ip" "is_floating_ip_instance" { + instance_id = "instance_id" + network_interface_id = "network_interface_id" + id = "id" + } + `) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceConfig(floatingIPName string) string { + return fmt.Sprintf(` + resource "ibm_is_floating_ip" "is_floating_ip_instance" { + name = "%s" + resource_group { + href = "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345" + id = "fee82deba12e4c0fb69c3b09d1f12345" + name = "my-resource-group" + } + target { + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" + id = "10c02d81-0ecb-4dc5-897d-28392913b81e" + name = "my-instance-network-interface" + primary_ip { + address = "192.168.3.4" + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + name = "my-reserved-ip" + resource_type = "subnet_reserved_ip" + } + resource_type = "network_interface" + } + zone { + href = "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1" + name = "us-south-1" + } + } + + data "ibm_is_floating_ip" "is_floating_ip_instance" { + instance_id = "instance_id" + network_interface_id = "network_interface_id" + id = "id" + } + `, floatingIPName) +} diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go index d57a95524f..fe010c9d8c 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go @@ -449,7 +449,7 @@ func resourceIBMIsVirtualNetworkInterfaceCreate(context context.Context, d *sche createVirtualNetworkInterfaceOptions.SetEnableInfrastructureNat(d.Get("enable_infrastructure_nat").(bool)) } if _, ok := d.GetOk("ips"); ok { - var ips []vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeIntf + var ips []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf for _, v := range d.Get("ips").([]interface{}) { value := v.(map[string]interface{}) ipsItem, err := resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototype(value) @@ -715,8 +715,8 @@ func resourceIBMIsVirtualNetworkInterfaceDelete(context context.Context, d *sche return nil } -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeIntf, error) { - model := &vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototype{} +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfaceIPPrototypeIntf, error) { + model := &vpcv1.VirtualNetworkInterfaceIPPrototype{} if modelMap["id"] != nil && modelMap["id"].(string) != "" { model.ID = core.StringPtr(modelMap["id"].(string)) } @@ -735,88 +735,14 @@ func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReserved return model, nil } -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextIntf, error) { - model := &vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext{} +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeIntf, error) { + model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototype{} if modelMap["id"] != nil && modelMap["id"].(string) != "" { model.ID = core.StringPtr(modelMap["id"].(string)) } if modelMap["href"] != nil && modelMap["href"].(string) != "" { model.Href = core.StringPtr(modelMap["href"].(string)) } - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID, error) { - model := &vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID{} - model.ID = core.StringPtr(modelMap["id"].(string)) - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref, error) { - model := &vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref{} - model.Href = core.StringPtr(modelMap["href"].(string)) - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext, error) { - model := &vpcv1.VirtualNetworkInterfaceIPsReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext{} - if modelMap["address"] != nil && modelMap["address"].(string) != "" { - model.Address = core.StringPtr(modelMap["address"].(string)) - } - if modelMap["auto_delete"] != nil { - model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) - } - if modelMap["name"] != nil && modelMap["name"].(string) != "" { - model.Name = core.StringPtr(modelMap["name"].(string)) - } - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeIntf, error) { - model := &vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototype{} - if modelMap["id"] != nil && modelMap["id"].(string) != "" { - model.ID = core.StringPtr(modelMap["id"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { - model.Href = core.StringPtr(modelMap["href"].(string)) - } - if modelMap["address"] != nil && modelMap["address"].(string) != "" { - model.Address = core.StringPtr(modelMap["address"].(string)) - } - if modelMap["auto_delete"] != nil { - model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) - } - if modelMap["name"] != nil && modelMap["name"].(string) != "" { - model.Name = core.StringPtr(modelMap["name"].(string)) - } - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextIntf, error) { - model := &vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext{} - if modelMap["id"] != nil && modelMap["id"].(string) != "" { - model.ID = core.StringPtr(modelMap["id"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { - model.Href = core.StringPtr(modelMap["href"].(string)) - } - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID, error) { - model := &vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID{} - model.ID = core.StringPtr(modelMap["id"].(string)) - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref, error) { - model := &vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref{} - model.Href = core.StringPtr(modelMap["href"].(string)) - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext, error) { - model := &vpcv1.VirtualNetworkInterfacePrimaryIPReservedIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext{} if modelMap["address"] != nil && modelMap["address"].(string) != "" { model.Address = core.StringPtr(modelMap["address"].(string)) } @@ -829,20 +755,14 @@ func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPRe return model, nil } -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrototypeResourceGroup(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrototypeResourceGroupIntf, error) { - model := &vpcv1.VirtualNetworkInterfacePrototypeResourceGroup{} +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrototypeResourceGroup(modelMap map[string]interface{}) (vpcv1.ResourceGroupIdentityIntf, error) { + model := &vpcv1.ResourceGroupIdentity{} if modelMap["id"] != nil && modelMap["id"].(string) != "" { model.ID = core.StringPtr(modelMap["id"].(string)) } return model, nil } -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID, error) { - model := &vpcv1.VirtualNetworkInterfacePrototypeResourceGroupResourceGroupIdentityByID{} - model.ID = core.StringPtr(modelMap["id"].(string)) - return model, nil -} - func resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentity(modelMap map[string]interface{}) (vpcv1.SecurityGroupIdentityIntf, error) { model := &vpcv1.SecurityGroupIdentity{} if modelMap["id"] != nil && modelMap["id"].(string) != "" { diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go new file mode 100644 index 0000000000..efebff6d93 --- /dev/null +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go @@ -0,0 +1,208 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func ResourceIBMIsVirtualNetworkInterfaceFloatingIP() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIBMIsVirtualNetworkInterfaceFloatingIPCreate, + ReadContext: resourceIBMIsVirtualNetworkInterfaceFloatingIPRead, + DeleteContext: resourceIBMIsVirtualNetworkInterfaceFloatingIPDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "virtual_network_interface": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The virtual network interface identifier", + }, + "floating_ip": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The floating IP identifier", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this floating IP. The name is unique across all floating IPs in the region.", + }, + + "deleted": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "If present, this property indicates the referenced resource has been deleted, and provides some supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Link to documentation about deleted resources", + }, + }, + }, + }, + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The globally unique IP address.", + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this floating IP.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this floating IP.", + }, + }, + } +} + +func resourceIBMIsVirtualNetworkInterfaceFloatingIPCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + sess, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + createVirtualNetworkInterfaceFloatingIPOptions := &vpcv1.AddNetworkInterfaceFloatingIPOptions{} + vniId := d.Get("virtual_network_interface").(string) + fipId := d.Get("floating_ip").(string) + createVirtualNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID = &vniId + createVirtualNetworkInterfaceFloatingIPOptions.ID = &fipId + + floatingIP, response, err := sess.AddNetworkInterfaceFloatingIPWithContext(context, createVirtualNetworkInterfaceFloatingIPOptions) + if err != nil { + log.Printf("[DEBUG] AddNetworkInterfaceFloatingIPOptions failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("AddNetworkInterfaceFloatingIPOptions failed %s\n%s", err, response)) + } + d.SetId(MakeTerraformVNIFloatingIpID(vniId, fipId)) + resourceIBMIsVirtualNetworkInterfaceFloatingIPGet(d, floatingIP) + + return resourceIBMIsVirtualNetworkInterfaceFloatingIPRead(context, d, meta) +} + +func resourceIBMIsVirtualNetworkInterfaceFloatingIPRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + sess, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + vniId, fipId, err := ParseVNIFloatingIpTerraformID(d.Id()) + if err != nil { + return diag.FromErr(err) + } + getNetworkInterfaceFloatingIPOptions := &vpcv1.GetNetworkInterfaceFloatingIPOptions{} + getNetworkInterfaceFloatingIPOptions.SetVirtualNetworkInterfaceID(vniId) + getNetworkInterfaceFloatingIPOptions.SetID(fipId) + + floatingIP, response, err := sess.GetNetworkInterfaceFloatingIPWithContext(context, getNetworkInterfaceFloatingIPOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetVirtualNetworkInterfaceFloatingIPWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterfaceFloatingIPWithContext failed %s\n%s", err, response)) + } + resourceIBMIsVirtualNetworkInterfaceFloatingIPGet(d, floatingIP) + + return nil +} +func resourceIBMIsVirtualNetworkInterfaceFloatingIPGet(d *schema.ResourceData, floatingIP *vpcv1.FloatingIPReference) diag.Diagnostics { + if !core.IsNil(floatingIP.Name) { + if err := d.Set("name", floatingIP.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + } + if err := d.Set("address", floatingIP.Address); err != nil { + return diag.FromErr(fmt.Errorf("Error setting address: %s", err)) + } + + if err := d.Set("crn", floatingIP.CRN); err != nil { + return diag.FromErr(fmt.Errorf("Error setting crn: %s", err)) + } + if err := d.Set("href", floatingIP.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + if deleted, err := resourceIBMIsVirtualNetworkInterfaceFloatingIPNetworkInterfaceReferenceDeletedToMap(floatingIP.Deleted); err != nil { + return diag.FromErr(fmt.Errorf("Error setting status: %s", err)) + } else { + d.Set("deleted", deleted) + } + + return nil +} + +func resourceIBMIsVirtualNetworkInterfaceFloatingIPDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + sess, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + vniId, fipId, err := ParseVNIFloatingIpTerraformID(d.Id()) + if err != nil { + return diag.FromErr(err) + } + removeNetworkInterfaceFloatingIPOptions := &vpcv1.RemoveNetworkInterfaceFloatingIPOptions{} + + removeNetworkInterfaceFloatingIPOptions.SetVirtualNetworkInterfaceID(vniId) + removeNetworkInterfaceFloatingIPOptions.SetID(fipId) + + response, err := sess.RemoveNetworkInterfaceFloatingIPWithContext(context, removeNetworkInterfaceFloatingIPOptions) + if err != nil { + log.Printf("[DEBUG] RemoveNetworkInterfaceFloatingIPWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("RemoveNetworkInterfaceFloatingIPWithContext failed %s\n%s", err, response)) + } + + d.SetId("") + + return nil +} + +func resourceIBMIsVirtualNetworkInterfaceFloatingIPNetworkInterfaceReferenceDeletedToMap(model *vpcv1.FloatingIPReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func resourceIBMIsVirtualNetworkInterfaceFloatingIPReservedIPReferenceDeletedToMap(model *vpcv1.FloatingIPReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model != nil { + deletedMap, err := resourceIBMIsVirtualNetworkInterfaceFloatingIPNetworkInterfaceReferenceDeletedToMap(model) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + return modelMap, nil +} + +func MakeTerraformVNIFloatingIpID(id1, id2 string) string { + // Include both virtual network interface id and floating ip id to create a unique Terraform id. As a bonus, + // we can extract the bare metal sever id as needed for API calls such as READ. + return fmt.Sprintf("%s/%s", id1, id2) +} + +func ParseVNIFloatingIpTerraformID(s string) (string, string, error) { + segments := strings.Split(s, "/") + if len(segments) != 2 { + return "", "", fmt.Errorf("invalid terraform Id %s (incorrect number of segments for vitual network interface floating ip)", s) + } + if segments[0] == "" || segments[1] == "" { + return "", "", fmt.Errorf("invalid terraform Id %s (one or more empty segments) for vitual network interface floating ip", s) + } + return segments[0], segments[1], nil +} diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go new file mode 100644 index 0000000000..6b023a2e28 --- /dev/null +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go @@ -0,0 +1,177 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func TestAccIBMIsVirtualNetworkInterfaceFloatingIPBasic(t *testing.T) { + var conf vpcv1.FloatingIPReference + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfigBasic(), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPExists("ibm_is_floating_ip.is_floating_ip", conf), + ), + }, + }, + }) +} + +func TestAccIBMIsVirtualNetworkInterfaceFloatingIPAllArgs(t *testing.T) { + var conf vpcv1.FloatingIPReference + name := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) + nameUpdate := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfig(name), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPExists("ibm_is_floating_ip.is_floating_ip", conf), + resource.TestCheckResourceAttr("ibm_is_floating_ip.is_floating_ip", "name", name), + ), + }, + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfig(nameUpdate), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ibm_is_floating_ip.is_floating_ip", "name", nameUpdate), + ), + }, + resource.TestStep{ + ResourceName: "ibm_is_floating_ip.is_floating_ip", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfigBasic() string { + return fmt.Sprintf(` + resource "ibm_is_floating_ip" "is_floating_ip_instance" { + } + `) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfig(name string) string { + return fmt.Sprintf(` + + resource "ibm_is_floating_ip" "fip" { + name = "%s" + zone = "%s" + } + resource "ibm_is_virtual_network_interface" "vni" { + allow_ip_spoofing = %s + auto_delete = %s + enable_infrastructure_nat = %s + ips { + address = "192.168.3.4" + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + name = "my-reserved-ip" + } + name = "%s" + primary_ip { + address = "192.168.3.4" + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + name = "my-reserved-ip" + } + resource_group { + id = "fee82deba12e4c0fb69c3b09d1f12345" + } + security_groups { + crn = "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" + id = "be5df5ca-12a0-494b-907e-aa6ec2bfa271" + name = "my-security-group" + } + subnet { + crn = "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + id = "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + } + } + resource "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { + virtual_network_interface = ibm_is_virtual_network_interface.vni.id + flaoting_ip = ibm_is_floating_ip.fip.id + } + + `, name, acc.ISZoneName) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPExists(n string, obj vpcv1.FloatingIPReference) resource.TestCheckFunc { + + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + sess, err := vpcClient(acc.TestAccProvider.Meta()) + if err != nil { + return err + } + + getVirtualNetworkInterfaceFloatingIPOptions := &vpcv1.GetNetworkInterfaceFloatingIPOptions{} + + getVirtualNetworkInterfaceFloatingIPOptions.SetID(rs.Primary.ID) + + floatingIP, _, err := sess.GetNetworkInterfaceFloatingIP(getVirtualNetworkInterfaceFloatingIPOptions) + if err != nil { + return err + } + + obj = *floatingIP + return nil + } +} + +func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDestroy(s *terraform.State) error { + sess, err := vpcClient(acc.TestAccProvider.Meta()) + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_is_floating_ip" { + continue + } + + getVirtualNetworkInterfaceFloatingIPOptions := &vpcv1.GetNetworkInterfaceFloatingIPOptions{} + + getVirtualNetworkInterfaceFloatingIPOptions.SetID(rs.Primary.ID) + + // Try to find the key + _, response, err := sess.GetNetworkInterfaceFloatingIP(getVirtualNetworkInterfaceFloatingIPOptions) + + if err == nil { + return fmt.Errorf("VirtualNetworkInterfaceFloatingIP still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for VirtualNetworkInterfaceFloatingIP (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/website/docs/d/is_virtual_network_interface_floating_ip.html.markdown b/website/docs/d/is_virtual_network_interface_floating_ip.html.markdown new file mode 100644 index 0000000000..ed4a5111c8 --- /dev/null +++ b/website/docs/d/is_virtual_network_interface_floating_ip.html.markdown @@ -0,0 +1,41 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_is_virtual_network_interface_floating_ip" +description: |- + Get information about Virtual Network Interface Floating IP. +subcategory: "Virtual Private Cloud API" +--- + +# ibm_is_virtual_network_interface_floating_ip + +Provides a read-only data source to retrieve information about a Virtual Network Interface Floating IP. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```terraform +data "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { + virtual_network_interface = + floating_ip = +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +- `virtual_network_interface` - (Required, String) The virtual network interface identifier +- `floating_ip` - (Required, String) The floating IP identifier + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + + +- `id` - The unique identifier of the FloatingIP. +- `address` - (String) The globally unique IP address. +- `crn` - (String) The CRN for this floating IP. +- `href` - (String) The URL for this floating IP. +- `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. + Nested scheme for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. +- `name` - (String) The name for this floating IP. The name is unique across all floating IPs in the region. diff --git a/website/docs/d/is_virtual_network_interface_floating_ips.html.markdown b/website/docs/d/is_virtual_network_interface_floating_ips.html.markdown new file mode 100644 index 0000000000..dce34de700 --- /dev/null +++ b/website/docs/d/is_virtual_network_interface_floating_ips.html.markdown @@ -0,0 +1,42 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_is_virtual_network_interface_floating_ips" +description: |- + List information about Virtual Network Interface Floating IPs. +subcategory: "Virtual Private Cloud API" +--- + +# ibm_is_virtual_network_interface_floating_ips + +Provides a read-only data source to retrieve information about a list of Virtual Network Interface Floating IPs. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```terraform +data "ibm_is_virtual_network_interface_floating_ips" "vni_fips" { + virtual_network_interface = +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +- `virtual_network_interface` - (Required, String) The virtual network interface identifier + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. +- `floating_ips` - (List) Lists all floatings ips in the virtual network interface. + + Nested scheme for `floating_ips`: + - `id` - The unique identifier of the FloatingIP + - `address` - (String) The globally unique IP address. + - `crn` - (String) The CRN for this floating IP. + - `href` - (String) The URL for this floating IP. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. + Nested scheme for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `name` - (String) The name for this floating IP. The name is unique across all floating IPs in the region. + + diff --git a/website/docs/r/is_virtual_network_interface_floating_ip.html.markdown b/website/docs/r/is_virtual_network_interface_floating_ip.html.markdown new file mode 100644 index 0000000000..55eae68e72 --- /dev/null +++ b/website/docs/r/is_virtual_network_interface_floating_ip.html.markdown @@ -0,0 +1,53 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_is_virtual_network_interface_floating_ip" +description: |- + Manages Virtual Network Interface Floating IP. +subcategory: "Virtual Private Cloud API" +--- + +# ibm_is_virtual_network_interface_floating_ip + +Create, read, and delete Virtual Network Interface Floating IP with this resource. + +## Example Usage + +```terrform +resource "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { + virtual_network_interface = + floating_ip = +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +- `virtual_network_interface` - (Required, String) The virtual network interface identifier +- `floating_ip` - (Required, String) The floating IP identifier +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +- `id` - The unique identifier of the VirtualNetworkInterfaceFloatingIP. The ID is composed of `/`. +- `address` - (String) The globally unique IP address. +- `crn` - (String) The CRN for this floating IP. +- `href` - (String) The URL for this floating IP. +- `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. + Nested scheme for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. +- `name` - (String) The name for this floating IP. The name is unique across all floating IPs in the region. + +## Import + +You can import the `ibm_is_virtual_network_interface_floating_ip` resource by using `< vni_id >/< floating_ip_id >` combination. The unique identifier for this floating IP. + +# Syntax +``` +$ terraform import ibm_is_virtual_network_interface_floating_ip.vni_fip < vni_id >/< floating_ip_id > +``` + +# Example +``` + +``` From 4bb4ce93d87a0dbb99101e129fa7d01b2a38073f Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 31 Aug 2023 16:41:53 +0530 Subject: [PATCH 003/132] sdk update --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 2034 ++++++++--------- .../vpc/resource_ibm_is_bare_metal_server.go | 12 +- ...tual_network_interface_floating_ip_test.go | 2 +- 3 files changed, 956 insertions(+), 1092 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 b71f71fd2c..1bc4c15882 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 @@ -47,7 +47,7 @@ type VpcV1 struct { generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-07-26`. + // and `2023-08-31`. Version *string } @@ -6071,15 +6071,12 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context // 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. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) } // ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaces") err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") if err != nil { return @@ -6140,15 +6137,12 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, // prototype object is structured in the same way as a retrieved instance network interface, and contains the // information necessary to create the new instance network interface. Any subnet in the instance's VPC may be // specified. Addresses on the instance network interface must be within the specified subnet's CIDR blocks. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) } // CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: CreateInstanceNetworkInterface") err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") if err != nil { return @@ -6231,15 +6225,12 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, // with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to // `true` targeting the instance network interface are automatically deleted. The primary instance network interface is // not allowed to be deleted. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) } // DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: DeleteInstanceNetworkInterface") err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") if err != nil { return @@ -6286,15 +6277,12 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, // GetInstanceNetworkInterface : Retrieve an instance network interface // This request retrieves a single instance network interface specified by the identifier in the URL. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) } // GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterface") err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") if err != nil { return @@ -6355,15 +6343,12 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge // This request updates an instance network interface with the information provided in an instance network interface // patch object. The instance network interface patch object is structured in the same way as a retrieved instance // network interface and needs to contain only the information to be updated. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) } // UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: UpdateInstanceNetworkInterface") err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") if err != nil { return @@ -6428,15 +6413,12 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, // ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with an instance network interface // This request lists all floating IPs associated with an instance network interface. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) } // ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceFloatingIps") err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { return @@ -6495,15 +6477,12 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context // RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from an instance network interface // This request disassociates the specified floating IP from the specified instance network interface. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { return vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) } // RemoveInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: RemoveInstanceNetworkInterfaceFloatingIP") err = core.ValidateNotNil(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { return @@ -6552,15 +6531,12 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex // GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP // This request retrieves a specified floating IP address if it is associated with the instance network interface and // instance specified in the URL. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) } // GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceFloatingIP") err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { return @@ -6622,15 +6598,12 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C // This request associates the specified floating IP with the specified instance network interface, replacing any // existing association. For this request to succeed, the existing floating IP must not be required by another resource, // such as a public gateway. A request body is not required, and if provided, is ignored. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) } // AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: AddInstanceNetworkInterfaceFloatingIP") err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { return @@ -6690,15 +6663,12 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C // ListInstanceNetworkInterfaceIps : List all reserved IPs bound to an instance network interface // This request lists all reserved IPs bound to an instance network interface. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) } // ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceIps") err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") if err != nil { return @@ -6764,15 +6734,12 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context // GetInstanceNetworkInterfaceIP : Retrieve bound reserved IP // This request retrieves the specified reserved IP address if it is bound to the network interface and instance // specified in the URL. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) } // GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceIP") err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") if err != nil { return @@ -11943,15 +11910,12 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. // 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. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) } // ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaces") err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") if err != nil { return @@ -12019,15 +11983,12 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co // contains the information necessary to create the new bare metal server network interface. Any subnet in the bare // metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. // Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) } // CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: CreateBareMetalServerNetworkInterface") err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { return @@ -12093,15 +12054,12 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C // This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs // associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server // network interface is not allowed to be deleted. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) } // DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: DeleteBareMetalServerNetworkInterface") err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { return @@ -12148,15 +12106,12 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C // GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface // This request retrieves a single bare metal server network interface specified by the identifier in the URL. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) } // GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterface") err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { return @@ -12217,15 +12172,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont // This request updates a bare metal server network interface with the information provided in a bare metal server // network interface patch object. The bare metal server network interface patch object is structured in the same way as // a retrieved bare metal server network interface and needs to contain only the information to be updated. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) } // UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: UpdateBareMetalServerNetworkInterface") err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { return @@ -12290,15 +12242,12 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C // ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface // This request lists all floating IPs associated with a bare metal server network interface. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) } // ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaceFloatingIps") err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { return @@ -12357,15 +12306,12 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx // RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface // This request disassociates the specified floating IP from the specified bare metal server network interface. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { return vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) } // RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: RemoveBareMetalServerNetworkInterfaceFloatingIP") err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { return @@ -12414,15 +12360,12 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx // 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. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) } // GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceFloatingIP") err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { return @@ -12485,15 +12428,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co // `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` // is `true`, this replaces any existing association. For this request to succeed, the existing floating IP must not be // required by another resource, such as a public gateway. A request body is not required, and if provided, is ignored. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) } // AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: AddBareMetalServerNetworkInterfaceFloatingIP") err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { return @@ -12553,15 +12493,12 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co // ListBareMetalServerNetworkInterfaceIps : List all reserved IPs bound to a bare metal server network interface // This request lists all reserved IPs bound to a bare metal server network interface. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) } // ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaceIps") err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") if err != nil { return @@ -12621,15 +12558,12 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. // GetBareMetalServerNetworkInterfaceIP : Retrieve bound reserved IP // This request retrieves the specified reserved IP address if it is bound to the network interface for the bare metal // server specified in the URL. -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) } // GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") if err != nil { return @@ -13911,7 +13845,8 @@ func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions } // UpdateSnapshot : Update a snapshot -// This request updates a snapshot's name. +// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group +// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { return vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) } @@ -14776,13 +14711,11 @@ func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOpt } // ListShareMountTargets : List all mount targets for a file share -// This request retrieves all share mount targets for a file share. +// This request retrieves all share mount targets for a file share. A share mount target is a network endpoint at which +// a file share may be mounted. The file share can be mounted by clients in the same VPC and zone after creating share +// mount targets. // -// A share mount target is a network endpoint at which a file share may be mounted. -// -// It exists within the same zone where the file share resides in. -// -// The file share can be mounted by instances in the same VPC and zone after creating share mount targets. +// The share mount targets will be sorted by their `created_at` property values, with newest targets first. func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { return vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) } @@ -14825,6 +14758,12 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar 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 { @@ -15180,12 +15119,12 @@ func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareS // GetShareSource : Retrieve the source file share for a replica file share // This request retrieves the source file share associated with the replica file share specified by the identifier in // the URL. -func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { return vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) } // GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter -func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") if err != nil { return @@ -15231,7 +15170,7 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) if err != nil { return } @@ -25362,8 +25301,8 @@ type BackupPolicy struct { // The lifecycle state of the backup policy. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will - // be subject to the backup policy. + // The resource types this backup policy applies to. Resources that have both a matching type and a matching user tag + // will be subject to the backup policy. // // The enumerated values for this property will expand in the future. When processing this property, check for and log // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the @@ -25927,8 +25866,8 @@ func UnmarshalBackupPolicyJobStatusReason(m map[string]json.RawMessage, result i // BackupPolicyPatch : BackupPolicyPatch struct type BackupPolicyPatch struct { - // The user tags this backup policy applies to (replacing any existing tags). Resources that have both a matching user - // tag and a matching type will be subject to the backup policy. + // 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. @@ -26632,14 +26571,13 @@ type BareMetalServer struct { NetworkAttachments []BareMetalServerNetworkAttachmentReference `json:"network_attachments,omitempty"` // The bare metal server network interfaces, including the primary interface. - // Deprecated: this field is deprecated and may be removed in a future release. NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces" validate:"required"` // The primary network attachment. PrimaryNetworkAttachment *BareMetalServerNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` // The primary bare metal server network interface. - PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterface `json:"primary_network_interface" validate:"required"` + 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. @@ -26769,7 +26707,7 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterface) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceBareMetalServerContextReference) if err != nil { return } @@ -28462,71 +28400,6 @@ func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype(m map[string]json return } -// BareMetalServerPrimaryNetworkInterface : The primary bare metal server network interface. -type BareMetalServerPrimaryNetworkInterface struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this bare metal server network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network interface. - ID *string `json:"id" validate:"required"` - - // The name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the BareMetalServerPrimaryNetworkInterface.ResourceType property. -// The resource type. -const ( - BareMetalServerPrimaryNetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" -) - -// UnmarshalBareMetalServerPrimaryNetworkInterface unmarshals an instance of BareMetalServerPrimaryNetworkInterface from the specified map of raw messages. -func UnmarshalBareMetalServerPrimaryNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrimaryNetworkInterface) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct type BareMetalServerPrimaryNetworkInterfacePrototype struct { // Indicates whether source IP spoofing is allowed on this bare metal server network interface. @@ -29810,7 +29683,7 @@ type BareMetalServerPrototype struct { // // If specified, it must match the VPC for the subnets that the network attachments or // network interfaces of the bare metal server are attached to. - VPC BareMetalServerPrototypeVPCIntf `json:"vpc,omitempty"` + VPC VPCIdentityIntf `json:"vpc,omitempty"` // The zone this bare metal server will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -29863,7 +29736,7 @@ func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result inte if err != nil { return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalBareMetalServerPrototypeVPC) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { return } @@ -29891,52 +29764,6 @@ func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result inte return } -// BareMetalServerPrototypeVPC : The VPC this bare metal server will reside in. -// -// If specified, it must match the VPC for the subnets that the network attachments or network interfaces of the bare -// metal server are attached to. -// Models which "extend" this model: -// - BareMetalServerPrototypeVPCVPCIdentityByID -// - BareMetalServerPrototypeVPCVPCIdentityByCRN -// - BareMetalServerPrototypeVPCVPCIdentityByHref -type BareMetalServerPrototypeVPC struct { - // The unique identifier for this VPC. - ID *string `json:"id,omitempty"` - - // The CRN for this VPC. - CRN *string `json:"crn,omitempty"` - - // The URL for this VPC. - Href *string `json:"href,omitempty"` -} - -func (*BareMetalServerPrototypeVPC) isaBareMetalServerPrototypeVPC() bool { - return true -} - -type BareMetalServerPrototypeVPCIntf interface { - isaBareMetalServerPrototypeVPC() bool -} - -// UnmarshalBareMetalServerPrototypeVPC unmarshals an instance of BareMetalServerPrototypeVPC from the specified map of raw messages. -func UnmarshalBareMetalServerPrototypeVPC(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototypeVPC) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // BareMetalServerStatusReason : BareMetalServerStatusReason struct type BareMetalServerStatusReason struct { // The status reason code: @@ -30421,12 +30248,12 @@ func UnmarshalCloudObjectStorageObjectReference(m map[string]json.RawMessage, re // CreateBackupPolicyOptions : The CreateBackupPolicy options. type CreateBackupPolicyOptions struct { - // The user tags this backup policy applies to. Resources that have both a matching user tag and a matching type will - // be subject to the backup policy. + // 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"` - // A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will - // be subject to the backup policy. + // The resource types this backup policy will apply to. Resources that have both a matching type and a matching user + // tag will be subject to the backup policy. MatchResourceTypes []string `json:"match_resource_types,omitempty"` // The name for this backup policy. The name must not be used by another backup policy in the region. If unspecified, @@ -33698,7 +33525,9 @@ type CreateVPCRouteOptions struct { // The VPC identifier. VPCID *string `json:"vpc_id" validate:"required,ne="` - // The destination of the route. At most two routes per `zone` in a table can have the same `destination` and + // The destination CIDR of the route. The host identifier in the CIDR must be zero. + // + // At most two routes per `zone` in a table can have the same `destination` and // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Destination *string `json:"destination" validate:"required"` @@ -33977,7 +33806,9 @@ type CreateVPCRoutingTableRouteOptions struct { // The routing table identifier. RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` - // The destination of the route. At most two routes per `zone` in a table can have the same `destination` and + // The destination CIDR of the route. The host identifier in the CIDR must be zero. + // + // At most two routes per `zone` in a table can have the same `destination` and // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Destination *string `json:"destination" validate:"required"` @@ -45347,7 +45178,6 @@ type Instance struct { NetworkAttachments []InstanceNetworkAttachmentReference `json:"network_attachments" validate:"required"` // The instance network interfaces, including the primary instance network interface. - // Deprecated: this field is deprecated and may be removed in a future release. NetworkInterfaces []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"` // The placement restrictions for the virtual server instance. @@ -54425,6 +54255,12 @@ type ListShareMountTargetsOptions 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"` + // Allows users to set headers on API requests Headers map[string]string } @@ -54448,6 +54284,18 @@ func (_options *ListShareMountTargetsOptions) SetName(name string) *ListShareMou 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 @@ -64045,7 +63893,7 @@ type Route struct { // and future `origin` values may also have this property set. Creator RouteCreatorIntf `json:"creator,omitempty"` - // The destination of the route. + // The destination CIDR of the route. Destination *string `json:"destination" validate:"required"` // The URL for this route. @@ -64387,7 +64235,7 @@ type RouteCollectionVPCContextRoutesItem struct { // and future `origin` values may also have this property set. Creator RouteCreatorIntf `json:"creator,omitempty"` - // The destination of the route. + // The destination CIDR of the route. Destination *string `json:"destination" validate:"required"` // The URL for this route. @@ -64725,8 +64573,9 @@ type RoutePatch struct { // 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` must have the same - // `advertise` value. + // Since all routes in a routing table with the same `destination` must have the same + // `advertise` value, this property can only be changed for routes with a unique + // `destination` in the routing table. 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-` @@ -64798,7 +64647,9 @@ type RoutePrototype struct { // `advertise` value. Advertise *bool `json:"advertise,omitempty"` - // The destination of the route. At most two routes per `zone` in a table can have the same `destination` and + // The destination CIDR of the route. The host identifier in the CIDR must be zero. + // + // At most two routes per `zone` in a table can have the same `destination` and // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Destination *string `json:"destination" validate:"required"` @@ -65815,10 +65666,9 @@ type SecurityGroupRule struct { // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` - // The IP addresses or security groups from which this rule allows traffic (or to which, for - // outbound rules). Can be specified as an IP address, a CIDR block, or a security group. A - // CIDR block of `0.0.0.0/0` allows traffic from any source (or to any destination, for - // outbound rules). + // 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. @@ -65937,7 +65787,7 @@ type SecurityGroupRulePatch struct { // Specify `null` to remove an existing lower bound. PortMin *int64 `json:"port_min,omitempty"` - // The IP addresses or security groups from which this rule will allow traffic (or to + // 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). @@ -66026,9 +65876,9 @@ type SecurityGroupRulePrototype struct { // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` - // The IP addresses or security groups from which this rule will allow traffic (or to which, - // for outbound rules). Can be specified as an IP address, a CIDR block, or a security group - // within the VPC. + // 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). @@ -66116,9 +65966,9 @@ func UnmarshalSecurityGroupRulePrototype(m map[string]json.RawMessage, result in return } -// SecurityGroupRuleRemote : The IP addresses or security groups from which this rule allows traffic (or to which, for outbound rules). Can be -// specified as an IP address, a CIDR block, or a security group. A CIDR block of `0.0.0.0/0` allows traffic from any -// source (or to any destination, for outbound rules). +// 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 @@ -66196,9 +66046,9 @@ func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result inter return } -// SecurityGroupRuleRemotePatch : The IP addresses or security groups from which this rule will allow traffic (or to which, for outbound rules). Can be -// specified as an IP address, a CIDR block, or a security group. A CIDR block of `0.0.0.0/0` will allow traffic from -// any source (or to any destination, for outbound rules). +// 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 @@ -66261,8 +66111,8 @@ func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result return } -// SecurityGroupRuleRemotePrototype : The IP addresses or security groups from which this rule will allow traffic (or to which, for outbound rules). Can be -// specified as an IP address, a CIDR block, or a security group within the VPC. +// 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). @@ -66595,7 +66445,7 @@ type Share struct { // The lifecycle state of the file share. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // Mount targets for the file share. + // 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. @@ -67350,6 +67200,18 @@ func UnmarshalShareMountTargetCollection(m map[string]json.RawMessage, result in return } +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ShareMountTargetCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + // ShareMountTargetCollectionFirst : A link to the first page of resources. type ShareMountTargetCollectionFirst struct { // The URL for a page of resources. @@ -73313,7 +73175,7 @@ type VPNGatewayConnection struct { // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address" validate:"required"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk" validate:"required"` // The resource type. @@ -73776,7 +73638,7 @@ type VPNGatewayConnectionPatch struct { // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address,omitempty"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk,omitempty"` // Routing protocols are disabled for this VPN gateway connection. @@ -73889,7 +73751,7 @@ type VPNGatewayConnectionPrototype struct { // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address" validate:"required"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk" validate:"required"` // Routing protocols are disabled for this VPN gateway connection. @@ -80783,99 +80645,6 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCountRange(m map[string]json return } -// BareMetalServerPrototypeVPCVPCIdentityByCRN : BareMetalServerPrototypeVPCVPCIdentityByCRN struct -// This model "extends" BareMetalServerPrototypeVPC -type BareMetalServerPrototypeVPCVPCIdentityByCRN struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` -} - -// NewBareMetalServerPrototypeVPCVPCIdentityByCRN : Instantiate BareMetalServerPrototypeVPCVPCIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrototypeVPCVPCIdentityByCRN(crn string) (_model *BareMetalServerPrototypeVPCVPCIdentityByCRN, err error) { - _model = &BareMetalServerPrototypeVPCVPCIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerPrototypeVPCVPCIdentityByCRN) isaBareMetalServerPrototypeVPC() bool { - return true -} - -// UnmarshalBareMetalServerPrototypeVPCVPCIdentityByCRN unmarshals an instance of BareMetalServerPrototypeVPCVPCIdentityByCRN from the specified map of raw messages. -func UnmarshalBareMetalServerPrototypeVPCVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototypeVPCVPCIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPrototypeVPCVPCIdentityByHref : BareMetalServerPrototypeVPCVPCIdentityByHref struct -// This model "extends" BareMetalServerPrototypeVPC -type BareMetalServerPrototypeVPCVPCIdentityByHref struct { - // The URL for this VPC. - Href *string `json:"href" validate:"required"` -} - -// NewBareMetalServerPrototypeVPCVPCIdentityByHref : Instantiate BareMetalServerPrototypeVPCVPCIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrototypeVPCVPCIdentityByHref(href string) (_model *BareMetalServerPrototypeVPCVPCIdentityByHref, err error) { - _model = &BareMetalServerPrototypeVPCVPCIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerPrototypeVPCVPCIdentityByHref) isaBareMetalServerPrototypeVPC() bool { - return true -} - -// UnmarshalBareMetalServerPrototypeVPCVPCIdentityByHref unmarshals an instance of BareMetalServerPrototypeVPCVPCIdentityByHref from the specified map of raw messages. -func UnmarshalBareMetalServerPrototypeVPCVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototypeVPCVPCIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPrototypeVPCVPCIdentityByID : BareMetalServerPrototypeVPCVPCIdentityByID struct -// This model "extends" BareMetalServerPrototypeVPC -type BareMetalServerPrototypeVPCVPCIdentityByID struct { - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` -} - -// NewBareMetalServerPrototypeVPCVPCIdentityByID : Instantiate BareMetalServerPrototypeVPCVPCIdentityByID (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrototypeVPCVPCIdentityByID(id string) (_model *BareMetalServerPrototypeVPCVPCIdentityByID, err error) { - _model = &BareMetalServerPrototypeVPCVPCIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerPrototypeVPCVPCIdentityByID) isaBareMetalServerPrototypeVPC() bool { - return true -} - -// UnmarshalBareMetalServerPrototypeVPCVPCIdentityByID unmarshals an instance of BareMetalServerPrototypeVPCVPCIdentityByID from the specified map of raw messages. -func UnmarshalBareMetalServerPrototypeVPCVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototypeVPCVPCIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // BareMetalServerPrototypeBareMetalServerByNetworkAttachment : BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct // This model "extends" BareMetalServerPrototype type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { @@ -80899,7 +80668,11 @@ type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` - VPC BareMetalServerPrototypeVPCIntf `json:"vpc,omitempty"` + // The VPC this bare metal server will reside in. + // + // If specified, it must match the VPC for the subnets that the network attachments or network interfaces of the bare + // metal server are attached to. + VPC VPCIdentityIntf `json:"vpc,omitempty"` // The zone this bare metal server will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -80954,7 +80727,7 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[s if err != nil { return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalBareMetalServerPrototypeVPC) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { return } @@ -80997,7 +80770,11 @@ type BareMetalServerPrototypeBareMetalServerByNetworkInterface struct { TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` - VPC BareMetalServerPrototypeVPCIntf `json:"vpc,omitempty"` + // The VPC this bare metal server will reside in. + // + // If specified, it must match the VPC for the subnets that the network attachments or network interfaces of the bare + // metal server are attached to. + VPC VPCIdentityIntf `json:"vpc,omitempty"` // The zone this bare metal server will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -81052,7 +80829,7 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalBareMetalServerPrototypeVPC) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { return } @@ -82089,8 +81866,8 @@ func UnmarshalEncryptionKeyIdentityByCRN(m map[string]json.RawMessage, result in // EndpointGatewayReservedIPReservedIPIdentity : Identifies a reserved IP by a unique property. // Models which "extend" this model: -// - EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID -// - EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref +// - EndpointGatewayReservedIPReservedIPIdentityByID +// - EndpointGatewayReservedIPReservedIPIdentityByHref // This model "extends" EndpointGatewayReservedIP type EndpointGatewayReservedIPReservedIPIdentity struct { // The unique identifier for this reserved IP. @@ -87814,15 +87591,21 @@ func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result return } -// InstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Create an instance template that creates instances by using a catalog offering. +// InstanceTemplateInstanceByCatalogOffering : Create an instance by using a catalog offering. // Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment -// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { +// - InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -87830,6 +87613,12 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -87846,9 +87635,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -87858,7 +87646,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -87907,30 +87696,46 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { +func (*InstanceTemplateInstanceByCatalogOffering) isaInstanceTemplateInstanceByCatalogOffering() bool { return true } -type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingIntf interface { - InstanceTemplatePrototypeIntf - isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool +type InstanceTemplateInstanceByCatalogOfferingIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceByCatalogOffering() bool } -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByCatalogOffering) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceByCatalogOffering unmarshals an instance of InstanceTemplateInstanceByCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOffering) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -87951,7 +87756,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -88003,15 +87808,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s return } -// InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. +// InstanceTemplateInstanceByImage : Create an instance by using an image. // Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment -// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateByImage struct { +// - InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByImage struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -88019,6 +87830,12 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -88035,9 +87852,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -88047,7 +87863,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -88089,30 +87906,46 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } -func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { +func (*InstanceTemplateInstanceByImage) isaInstanceTemplateInstanceByImage() bool { return true } -type InstanceTemplatePrototypeInstanceTemplateByImageIntf interface { - InstanceTemplatePrototypeIntf - isaInstanceTemplatePrototypeInstanceTemplateByImage() bool +type InstanceTemplateInstanceByImageIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceByImage() bool } -func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByImage) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceByImage unmarshals an instance of InstanceTemplateInstanceByImage from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImage) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -88133,7 +87966,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -88185,15 +88018,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json return } -// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Create an instance template that creates instances by using a snapshot. +// InstanceTemplateInstanceBySourceSnapshot : Create an instance by using a snapshot. // Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment -// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { +// - InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceBySourceSnapshot struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -88201,6 +88040,12 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -88217,9 +88062,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -88229,7 +88073,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -88268,30 +88113,46 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { +func (*InstanceTemplateInstanceBySourceSnapshot) isaInstanceTemplateInstanceBySourceSnapshot() bool { return true } -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotIntf interface { - InstanceTemplatePrototypeIntf - isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool +type InstanceTemplateInstanceBySourceSnapshotIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceBySourceSnapshot() bool } -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceBySourceSnapshot) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) +// UnmarshalInstanceTemplateInstanceBySourceSnapshot unmarshals an instance of InstanceTemplateInstanceBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshot) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -88312,7 +88173,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -88360,9 +88221,12 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st return } -// InstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Create an instance template from an existing instance template. +// 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 InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { +type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -88424,55 +88288,48 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering version to use when provisioning this virtual server instance. - // If an offering is specified, the latest version of that offering will be used. + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. // - // The specified offering or offering version may be in a different account, subject to - // IAM policies. + // If an offering is specified, the latest version of that offering will be used. // - // If specified, `image` must not be specified, and `source_template` must not have - // `image` specified. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - // The 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" 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 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 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"` +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { + return true } -// NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceTemplate (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceTemplate, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceTemplate{ - SourceTemplate: sourceTemplate, - } - err = core.ValidateStruct(_model, "required parameters") - return +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool } -func (*InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) 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) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -88529,7 +88386,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } @@ -88537,23 +88394,15 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -88561,21 +88410,15 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st return } -// InstanceTemplateInstanceByCatalogOffering : Create an instance by using a catalog offering. +// InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. // Models which "extend" this model: -// - InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment -// - InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceByCatalogOffering struct { +// - 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 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. @@ -88583,12 +88426,6 @@ type InstanceTemplateInstanceByCatalogOffering struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -88605,8 +88442,9 @@ type InstanceTemplateInstanceByCatalogOffering struct { 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -88616,8 +88454,7 @@ type InstanceTemplateInstanceByCatalogOffering struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -88640,15 +88477,8 @@ type InstanceTemplateInstanceByCatalogOffering struct { // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + // The 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"` @@ -88666,46 +88496,30 @@ type InstanceTemplateInstanceByCatalogOffering struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } -func (*InstanceTemplateInstanceByCatalogOffering) isaInstanceTemplateInstanceByCatalogOffering() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { return true } -type InstanceTemplateInstanceByCatalogOfferingIntf interface { - InstanceTemplateIntf - isaInstanceTemplateInstanceByCatalogOffering() bool +type InstanceTemplatePrototypeInstanceTemplateByImageIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateByImage() bool } -func (*InstanceTemplateInstanceByCatalogOffering) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceByCatalogOffering unmarshals an instance of InstanceTemplateInstanceByCatalogOffering from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOffering) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImage from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImage) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -88726,7 +88540,7 @@ func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -88750,7 +88564,7 @@ func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { return } @@ -88778,21 +88592,15 @@ func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMes return } -// InstanceTemplateInstanceByImage : Create an instance by using an image. +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Create an instance template that creates instances by using a snapshot. // Models which "extend" this model: -// - InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment -// - InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceByImage struct { +// - 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 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. @@ -88800,12 +88608,6 @@ type InstanceTemplateInstanceByImage struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -88822,8 +88624,9 @@ type InstanceTemplateInstanceByImage struct { 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -88833,8 +88636,7 @@ type InstanceTemplateInstanceByImage struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -88855,10 +88657,7 @@ type InstanceTemplateInstanceByImage struct { 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"` + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -88876,46 +88675,30 @@ type InstanceTemplateInstanceByImage struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } -func (*InstanceTemplateInstanceByImage) isaInstanceTemplateInstanceByImage() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { return true } -type InstanceTemplateInstanceByImageIntf interface { - InstanceTemplateIntf - isaInstanceTemplateInstanceByImage() bool +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool } -func (*InstanceTemplateInstanceByImage) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceByImage unmarshals an instance of InstanceTemplateInstanceByImage from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImage) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -88936,7 +88719,7 @@ func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, resu if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -88956,11 +88739,7 @@ func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, resu if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { return } @@ -88988,21 +88767,12 @@ func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, resu return } -// InstanceTemplateInstanceBySourceSnapshot : Create an instance by using a snapshot. -// Models which "extend" this model: -// - InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment -// - InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceBySourceSnapshot struct { +// InstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Create an instance template from an existing instance 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 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. @@ -89010,12 +88780,6 @@ type InstanceTemplateInstanceBySourceSnapshot struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -89032,8 +88796,9 @@ type InstanceTemplateInstanceBySourceSnapshot struct { 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -89043,8 +88808,7 @@ type InstanceTemplateInstanceBySourceSnapshot struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -89065,64 +88829,65 @@ type InstanceTemplateInstanceBySourceSnapshot struct { VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` + // 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 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 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"` -} -func (*InstanceTemplateInstanceBySourceSnapshot) isaInstanceTemplateInstanceBySourceSnapshot() bool { - return true + // 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"` } -type InstanceTemplateInstanceBySourceSnapshotIntf interface { - InstanceTemplateIntf - isaInstanceTemplateInstanceBySourceSnapshot() bool +// NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceTemplate, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceTemplate{ + SourceTemplate: sourceTemplate, + } + err = core.ValidateStruct(_model, "required parameters") + return } -func (*InstanceTemplateInstanceBySourceSnapshot) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceBySourceSnapshot unmarshals an instance of InstanceTemplateInstanceBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshot) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -89143,7 +88908,7 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMess if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -89163,19 +88928,19 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMess if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } @@ -89183,10 +88948,22 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMess if err != nil { return } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -92245,8 +92022,8 @@ func UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp(m map[string]json.RawMe // NetworkInterfaceIPPrototypeReservedIPIdentity : Identifies a reserved IP by a unique property. // Models which "extend" this model: -// - NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID -// - NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref +// - NetworkInterfaceIPPrototypeReservedIPIdentityByID +// - NetworkInterfaceIPPrototypeReservedIPIdentityByHref // This model "extends" NetworkInterfaceIPPrototype type NetworkInterfaceIPPrototypeReservedIPIdentity struct { // The unique identifier for this reserved IP. @@ -93774,9 +93551,9 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` - // The IP addresses or security groups from which this rule will allow traffic (or to which, - // for outbound rules). Can be specified as an IP address, a CIDR block, or a security group - // within the VPC. + // 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). @@ -93860,9 +93637,9 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` - // The IP addresses or security groups from which this rule will allow traffic (or to which, - // for outbound rules). Can be specified as an IP address, a CIDR block, or a security group - // within the VPC. + // 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). @@ -93969,9 +93746,9 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` - // The IP addresses or security groups from which this rule will allow traffic (or to which, - // for outbound rules). Can be specified as an IP address, a CIDR block, or a security group - // within the VPC. + // 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). @@ -95977,8 +95754,8 @@ func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result int return } -// SharePrototypeShareBySourceShare : Create a replica file share for an existing file share. The values for -// `access_control_mode`, `encryption_key`, `initial_owner`, and `size` will be inherited from `source_share`. +// SharePrototypeShareBySourceShare : Create a replica file share for an existing file share. The values for `access_control_mode`, +// `encryption_key`, `initial_owner`, and `size` will be inherited from `source_share`. // This model "extends" SharePrototype type SharePrototypeShareBySourceShare struct { // The maximum input/output operations per second (IOPS) for the file share. The share must be in the `custom` or @@ -97120,7 +96897,7 @@ type VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch struct { // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address,omitempty"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk,omitempty"` // Routing protocols are disabled for this VPN gateway connection. @@ -97223,7 +97000,7 @@ type VPNGatewayConnectionPolicyMode struct { // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address" validate:"required"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk" validate:"required"` // The resource type. @@ -97359,7 +97136,7 @@ type VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address" validate:"required"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk" validate:"required"` // The local CIDRs for this resource. @@ -97447,7 +97224,7 @@ type VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype s // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address" validate:"required"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk" validate:"required"` // Routing protocols are disabled for this VPN gateway connection. @@ -97550,7 +97327,7 @@ type VPNGatewayConnectionStaticRouteMode struct { // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address" validate:"required"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk" validate:"required"` // The resource type. @@ -98267,8 +98044,8 @@ func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernameP // VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext : Identifies a reserved IP by a unique property. The reserved IP must be currently unbound and in the same subnet as // the primary IP. // Models which "extend" this model: -// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID -// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref // This model "extends" VirtualNetworkInterfaceIPPrototype type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext struct { // The unique identifier for this reserved IP. @@ -98350,8 +98127,8 @@ func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetwor // 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: -// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID -// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref // This model "extends" VirtualNetworkInterfacePrimaryIPPrototype type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext struct { // The unique identifier for this reserved IP. @@ -99296,33 +99073,33 @@ func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{ return } -// EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref struct +// EndpointGatewayReservedIPReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityByHref struct // This model "extends" EndpointGatewayReservedIPReservedIPIdentity -type EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref struct { +type EndpointGatewayReservedIPReservedIPIdentityByHref struct { // The URL for this reserved IP. Href *string `json:"href" validate:"required"` } -// NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref : Instantiate EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref(href string) (_model *EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref, err error) { - _model = &EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref{ +// NewEndpointGatewayReservedIPReservedIPIdentityByHref : Instantiate EndpointGatewayReservedIPReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByHref(href string) (_model *EndpointGatewayReservedIPReservedIPIdentityByHref, err error) { + _model = &EndpointGatewayReservedIPReservedIPIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref) isaEndpointGatewayReservedIPReservedIPIdentity() bool { +func (*EndpointGatewayReservedIPReservedIPIdentityByHref) isaEndpointGatewayReservedIPReservedIPIdentity() bool { return true } -func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref) isaEndpointGatewayReservedIP() bool { +func (*EndpointGatewayReservedIPReservedIPIdentityByHref) isaEndpointGatewayReservedIP() bool { return true } -// UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref) +// UnmarshalEndpointGatewayReservedIPReservedIPIdentityByHref unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -99331,33 +99108,33 @@ func UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReser return } -// EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID : EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID struct +// EndpointGatewayReservedIPReservedIPIdentityByID : EndpointGatewayReservedIPReservedIPIdentityByID struct // This model "extends" EndpointGatewayReservedIPReservedIPIdentity -type EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID struct { +type EndpointGatewayReservedIPReservedIPIdentityByID struct { // The unique identifier for this reserved IP. ID *string `json:"id" validate:"required"` } -// NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID : Instantiate EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID(id string) (_model *EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID, err error) { - _model = &EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID{ +// NewEndpointGatewayReservedIPReservedIPIdentityByID : Instantiate EndpointGatewayReservedIPReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByID(id string) (_model *EndpointGatewayReservedIPReservedIPIdentityByID, err error) { + _model = &EndpointGatewayReservedIPReservedIPIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID) isaEndpointGatewayReservedIPReservedIPIdentity() bool { +func (*EndpointGatewayReservedIPReservedIPIdentityByID) isaEndpointGatewayReservedIPReservedIPIdentity() bool { return true } -func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID) isaEndpointGatewayReservedIP() bool { +func (*EndpointGatewayReservedIPReservedIPIdentityByID) isaEndpointGatewayReservedIP() bool { return true } -// UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityReservedIPIdentityByID) +// UnmarshalEndpointGatewayReservedIPReservedIPIdentityByID unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -102781,12 +102558,18 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork return } -// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering -type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct { +// InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceByCatalogOffering +type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -102794,6 +102577,12 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -102810,9 +102599,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -102822,7 +102610,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -102857,36 +102646,41 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment{ - CatalogOffering: catalogOffering, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { +func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByCatalogOffering() bool { return true } -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -102907,7 +102701,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -102951,12 +102745,18 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance return } -// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering -type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct { +// InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceByCatalogOffering +type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -102964,6 +102764,12 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -102980,9 +102786,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -102992,7 +102797,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -103027,36 +102833,41 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface{ - CatalogOffering: catalogOffering, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { +func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByCatalogOffering() bool { return true } -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -103077,7 +102888,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -103121,12 +102932,18 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance return } -// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage -type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct { +// InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceByImage +type InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -103134,6 +102951,12 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -103150,9 +102973,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -103162,7 +102984,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -103198,36 +103021,41 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment{ - Image: image, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { +func (*InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByImage() bool { return true } -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -103248,7 +103076,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -103292,12 +103120,18 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy return } -// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage -type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct { +// InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceByImage +type InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -103305,6 +103139,12 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -103321,9 +103161,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -103333,7 +103172,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -103369,36 +103209,41 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface{ - Image: image, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { +func (*InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByImage() bool { return true } -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -103419,7 +103264,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -103463,12 +103308,18 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy return } -// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct { +// InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceBySourceSnapshot +type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -103476,6 +103327,12 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -103492,9 +103349,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -103504,7 +103360,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -103537,36 +103394,41 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceBySourceSnapshot() bool { return true } -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -103587,7 +103449,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -103627,12 +103489,18 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT return } -// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct { +// InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceBySourceSnapshot +type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -103640,6 +103508,12 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -103656,9 +103530,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -103668,7 +103541,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -103701,36 +103575,41 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceBySourceSnapshot() bool { return true } -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -103751,7 +103630,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -103791,18 +103670,12 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT return } -// InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplateInstanceByCatalogOffering -type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct { +// 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 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. @@ -103810,12 +103683,6 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -103832,8 +103699,9 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -103843,8 +103711,7 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -103879,41 +103746,36 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } -func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplateInstanceByCatalogOffering() bool { +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { return true } -func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -103934,7 +103796,7 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOffering if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -103978,18 +103840,12 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOffering return } -// InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct -// This model "extends" InstanceTemplateInstanceByCatalogOffering -type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct { +// 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 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. @@ -103997,12 +103853,6 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -104019,8 +103869,9 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -104030,8 +103881,7 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -104066,41 +103916,36 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceB PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplateInstanceByCatalogOffering() bool { +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { return true } -func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -104121,7 +103966,7 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOffering if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -104165,18 +104010,12 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOffering return } -// InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment : InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplateInstanceByImage -type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment struct { +// 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 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. @@ -104184,12 +104023,6 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment s // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -104206,8 +104039,9 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment s 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -104217,8 +104051,7 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment s // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -104254,41 +104087,36 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment s PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } -func (*InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstanceTemplateInstanceByImage() bool { +// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment{ + Image: image, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { return true } -func (*InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAttachment) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -104309,7 +104137,7 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAtt if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -104353,18 +104181,12 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkAtt return } -// InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface : InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface struct -// This model "extends" InstanceTemplateInstanceByImage -type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface struct { +// 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 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. @@ -104372,12 +104194,6 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface st // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -104394,8 +104210,9 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface st 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -104405,8 +104222,7 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface st // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -104442,41 +104258,36 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface st PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -func (*InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstanceTemplateInstanceByImage() bool { +// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface{ + Image: image, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { return true } -func (*InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInterface) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -104497,7 +104308,7 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInt if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -104541,18 +104352,12 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceByNetworkInt return } -// InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplateInstanceBySourceSnapshot -type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct { +// 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 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. @@ -104560,12 +104365,6 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -104582,8 +104381,9 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -104593,8 +104393,7 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -104627,41 +104426,36 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } -func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplateInstanceBySourceSnapshot() bool { +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { return true } -func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -104682,7 +104476,7 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotIn if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -104722,18 +104516,12 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotIn return } -// InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct -// This model "extends" InstanceTemplateInstanceBySourceSnapshot -type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct { +// 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 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. @@ -104741,12 +104529,6 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -104763,8 +104545,9 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -104774,8 +104557,7 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -104808,41 +104590,36 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByN PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplateInstanceBySourceSnapshot() bool { +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { return true } -func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -104863,7 +104640,7 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotIn if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -105148,33 +104925,33 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdent return } -// NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref : NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref struct +// NetworkInterfaceIPPrototypeReservedIPIdentityByHref : NetworkInterfaceIPPrototypeReservedIPIdentityByHref struct // This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity -type NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref struct { +type NetworkInterfaceIPPrototypeReservedIPIdentityByHref struct { // The URL for this reserved IP. Href *string `json:"href" validate:"required"` } -// NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref(href string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref, err error) { - _model = &NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref{ +// NewNetworkInterfaceIPPrototypeReservedIPIdentityByHref : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByHref(href string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityByHref, err error) { + _model = &NetworkInterfaceIPPrototypeReservedIPIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { +func (*NetworkInterfaceIPPrototypeReservedIPIdentityByHref) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { return true } -func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref) isaNetworkInterfaceIPPrototype() bool { +func (*NetworkInterfaceIPPrototypeReservedIPIdentityByHref) isaNetworkInterfaceIPPrototype() bool { return true } -// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByHref) +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByHref unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -105183,33 +104960,33 @@ func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityRes return } -// NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID : NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID struct +// NetworkInterfaceIPPrototypeReservedIPIdentityByID : NetworkInterfaceIPPrototypeReservedIPIdentityByID struct // This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity -type NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID struct { +type NetworkInterfaceIPPrototypeReservedIPIdentityByID struct { // The unique identifier for this reserved IP. ID *string `json:"id" validate:"required"` } -// NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID(id string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID, err error) { - _model = &NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID{ +// NewNetworkInterfaceIPPrototypeReservedIPIdentityByID : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByID(id string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityByID, err error) { + _model = &NetworkInterfaceIPPrototypeReservedIPIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { +func (*NetworkInterfaceIPPrototypeReservedIPIdentityByID) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { return true } -func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID) isaNetworkInterfaceIPPrototype() bool { +func (*NetworkInterfaceIPPrototypeReservedIPIdentityByID) isaNetworkInterfaceIPPrototype() bool { return true } -// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityReservedIPIdentityByID) +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByID unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -106187,33 +105964,33 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte return } -// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref struct +// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct // This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext -type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref struct { +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct { // The URL for this reserved IP. Href *string `json:"href" validate:"required"` } -// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref(href string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref, err error) { - _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref{ +// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(href string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref, err error) { + _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { return true } -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref) isaVirtualNetworkInterfaceIPPrototype() bool { +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) isaVirtualNetworkInterfaceIPPrototype() bool { return true } -// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByHref) +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -106222,33 +105999,33 @@ func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetwork return } -// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID struct +// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID struct // This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext -type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID struct { +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID struct { // The unique identifier for this reserved IP. ID *string `json:"id" validate:"required"` } -// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID(id string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID, err error) { - _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID{ +// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(id string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID, err error) { + _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { return true } -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID) isaVirtualNetworkInterfaceIPPrototype() bool { +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) isaVirtualNetworkInterfaceIPPrototype() bool { return true } -// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityVirtualNetworkInterfaceIPsContextReservedIPIdentityByID) +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -106257,33 +106034,33 @@ func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetwork return } -// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref struct +// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct // This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext -type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref struct { +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct { // The URL for this reserved IP. Href *string `json:"href" validate:"required"` } -// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref(href string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref, err error) { - _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref{ +// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref(href string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref, err error) { + _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { return true } -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { return true } -// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByHref) +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -106292,33 +106069,33 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtual return } -// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID struct +// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID struct // This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext -type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID struct { +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID struct { // The unique identifier for this reserved IP. ID *string `json:"id" validate:"required"` } -// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID(id string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID, err error) { - _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID{ +// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID(id string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID, err error) { + _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { return true } -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { return true } -// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextReservedIPIdentityByID) +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -109646,6 +109423,91 @@ func (pager *SharesPager) GetAll() (allItems []Share, err error) { return pager.GetAllWithContext(context.Background()) } +// ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. +type ShareMountTargetsPager struct { + hasNext bool + options *ListShareMountTargetsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewShareMountTargetsPager returns a new ShareMountTargetsPager instance. +func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOptions) (pager *ShareMountTargetsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListShareMountTargetsOptions = *options + pager = &ShareMountTargetsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ShareMountTargetsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (page []ShareMountTarget, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListShareMountTargetsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.MountTargets + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (allItems []ShareMountTarget, err error) { + for pager.HasNext() { + var nextPage []ShareMountTarget + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ShareMountTargetsPager) GetNext() (page []ShareMountTarget, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err error) { + return pager.GetAllWithContext(context.Background()) +} + // VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. type VirtualNetworkInterfacesPager struct { hasNext bool diff --git a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go index 94c1ede67f..788dceec57 100644 --- a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go +++ b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go @@ -696,7 +696,8 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou if err != nil { return diag.FromErr(err) } - options := &vpcv1.CreateBareMetalServerOptions{} + createoptions := &vpcv1.CreateBareMetalServerOptions{} + options := &vpcv1.BareMetalServerPrototype{} var imageStr string if image, ok := d.GetOk(isBareMetalServerImage); ok { imageStr = image.(string) @@ -705,7 +706,8 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou // enable secure boot if _, ok := d.GetOkExists(isBareMetalServerEnableSecureBoot); ok { - options.SetEnableSecureBoot(d.Get(isBareMetalServerEnableSecureBoot).(bool)) + enablesecureboot := d.Get(isBareMetalServerEnableSecureBoot).(bool) + options.EnableSecureBoot = &enablesecureboot } // trusted_platform_module @@ -715,7 +717,7 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou if err != nil { return diag.FromErr(err) } - options.SetTrustedPlatformModule(trustedPlatformModuleModel) + options.TrustedPlatformModule = trustedPlatformModuleModel } keySet := d.Get(isBareMetalServerKeys).(*schema.Set) @@ -1300,8 +1302,8 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou ID: &vpc, } } - - bms, response, err := sess.CreateBareMetalServerWithContext(context, options) + createoptions.BareMetalServerPrototype = options + bms, response, err := sess.CreateBareMetalServerWithContext(context, createoptions) if err != nil { return diag.FromErr(fmt.Errorf("[DEBUG] Create bare metal server err %s\n%s", err, response)) } diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go index 6b023a2e28..fd8909099e 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go @@ -119,7 +119,7 @@ func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfig(name string) strin flaoting_ip = ibm_is_floating_ip.fip.id } - `, name, acc.ISZoneName) + `, name, acc.ISZoneName, name, acc.ISZoneName, name, acc.ISZoneName) } func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPExists(n string, obj vpcv1.FloatingIPReference) resource.TestCheckFunc { From 337e8a208b60f924d9c86173b92083c6d3a146d5 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 31 Aug 2023 16:45:30 +0530 Subject: [PATCH 004/132] space in filename --- ...> data_source_ibm_is_virtual_network_interface_floating_ip.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ibm/service/vpc/{data_source_ibm_is_virtual_network_interface_floating_ip .go => data_source_ibm_is_virtual_network_interface_floating_ip.go} (100%) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip .go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip.go similarity index 100% rename from ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip .go rename to ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip.go From 1e2230fbd9e67075ac6c66f79c7e71061d2cae47 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 31 Aug 2023 19:13:15 +0530 Subject: [PATCH 005/132] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 625d569464..b32478cd28 100644 --- a/go.mod +++ b/go.mod @@ -228,7 +228,7 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.38.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.41.0 => ./common/github.com/IBM/vpc-go-sdk exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 From eeca172dc9e4e636af18617cf6e485a28b31576e Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 8 Sep 2023 15:52:57 +0530 Subject: [PATCH 006/132] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 3155 ++++++++++++----- 1 file changed, 2276 insertions(+), 879 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 1bc4c15882..23e5a1110b 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.76.0-ad3e6f96-20230724-172814 + * IBM OpenAPI SDK Code Generator Version: 3.78.0-67aec9b7-20230818-174940 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -39,6 +39,10 @@ import ( // server instances, along with subnets, volumes, load balancers, and more. // // API Version: 2022-09-13 +const ( + YYYYMMDD = "2006-01-02" +) + type VpcV1 struct { Service *core.BaseService @@ -47,7 +51,7 @@ type VpcV1 struct { generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-08-31`. + // and `2023-09-07`. Version *string } @@ -64,7 +68,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-07-26`. + // and `2023-09-07`. Version *string } @@ -120,9 +124,9 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { return } } - + now := time.Now().UTC() if options.Version == nil { - options.Version = core.StringPtr("2023-06-27") + options.Version = core.StringPtr(now.Format(YYYYMMDD)) } service = &VpcV1{ @@ -219,6 +223,8 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVpcsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) @@ -288,6 +294,8 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -371,6 +379,8 @@ func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *De } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -423,6 +433,8 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -488,6 +500,8 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) @@ -557,6 +571,8 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -622,6 +638,8 @@ func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getV builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -686,6 +704,8 @@ func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, get builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -749,6 +769,8 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPCAddressPrefixesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) @@ -820,6 +842,8 @@ func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createV builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -902,6 +926,8 @@ func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteV } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -955,6 +981,8 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -1021,6 +1049,8 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPCAddressPrefixOptions.AddressPrefixPatch) @@ -1094,6 +1124,8 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPCRoutesOptions.ZoneName != nil { builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) @@ -1172,6 +1204,8 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -1265,6 +1299,8 @@ func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -1321,6 +1357,8 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -1390,6 +1428,8 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPCRouteOptions.RoutePatch) @@ -1461,6 +1501,8 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPCRoutingTablesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) @@ -1535,6 +1577,8 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -1632,6 +1676,8 @@ func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVP } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -1685,6 +1731,8 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -1754,6 +1802,8 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) @@ -1827,6 +1877,8 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPCRoutingTableRoutesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) @@ -1899,6 +1951,8 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -1991,6 +2045,8 @@ func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, del } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -2045,6 +2101,8 @@ func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPC builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -2113,6 +2171,8 @@ func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, upd builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPCRoutingTableRouteOptions.RoutePatch) @@ -2174,6 +2234,8 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listSubnetsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) @@ -2251,6 +2313,8 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createSubnetOptions.SubnetPrototype) @@ -2322,6 +2386,8 @@ func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptio } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -2374,6 +2440,8 @@ func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *Ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -2439,6 +2507,8 @@ func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptio builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateSubnetOptions.SubnetPatch) @@ -2507,6 +2577,8 @@ func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetN builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -2571,6 +2643,8 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(replaceSubnetNetworkACLOptions.NetworkACLIdentity) @@ -2638,6 +2712,8 @@ func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unset } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -2690,6 +2766,8 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -2755,6 +2833,8 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(setSubnetPublicGatewayOptions.PublicGatewayIdentity) @@ -2823,6 +2903,8 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -2890,6 +2972,8 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(replaceSubnetRoutingTableOptions.RoutingTableIdentity) @@ -2959,6 +3043,8 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listSubnetReservedIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) @@ -3045,6 +3131,8 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -3130,6 +3218,8 @@ func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteS } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -3183,6 +3273,8 @@ func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetR builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -3251,6 +3343,8 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateSubnetReservedIPOptions.ReservedIPPatch) @@ -3312,6 +3406,8 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listImagesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) @@ -3393,6 +3489,8 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) @@ -3464,6 +3562,8 @@ func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -3516,6 +3616,8 @@ func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetI builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -3582,6 +3684,8 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateImageOptions.ImagePatch) @@ -3660,6 +3764,8 @@ func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -3720,6 +3826,8 @@ func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOpt } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -3777,6 +3885,8 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listImageExportJobsOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) @@ -3847,6 +3957,8 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -3927,6 +4039,8 @@ func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteIma } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -3980,6 +4094,8 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -4047,6 +4163,8 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateImageExportJobOptions.ImageExportJobPatch) @@ -4107,6 +4225,8 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listOperatingSystemsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) @@ -4176,6 +4296,8 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -4232,6 +4354,8 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listKeysOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listKeysOptions.Start)) @@ -4300,6 +4424,8 @@ func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *Cr builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -4380,6 +4506,8 @@ func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *De } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -4432,6 +4560,8 @@ func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOp builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -4496,6 +4626,8 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateKeyOptions.KeyPatch) @@ -4557,6 +4689,8 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -4620,6 +4754,8 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -4675,6 +4811,8 @@ func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInst builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -4739,6 +4877,8 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createInstanceTemplateOptions.InstanceTemplatePrototype) @@ -4806,6 +4946,8 @@ func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteI } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -4858,6 +5000,8 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -4924,6 +5068,8 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceTemplateOptions.InstanceTemplatePatch) @@ -4984,6 +5130,8 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstancesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) @@ -5094,6 +5242,8 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createInstanceOptions.InstancePrototype) @@ -5165,6 +5315,8 @@ func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -5217,6 +5369,8 @@ func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -5282,6 +5436,8 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) @@ -5351,6 +5507,8 @@ func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getI builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -5416,6 +5574,8 @@ func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createIns builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -5495,6 +5655,8 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -5572,6 +5734,8 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -5636,6 +5800,8 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -5701,6 +5867,8 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceDiskOptions.InstanceDiskPatch) @@ -5774,6 +5942,8 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -5840,6 +6010,8 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -5918,6 +6090,8 @@ func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -5971,6 +6145,8 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -6038,6 +6214,8 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) @@ -6109,6 +6287,8 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -6176,6 +6356,8 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -6263,6 +6445,8 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -6316,6 +6500,8 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -6383,6 +6569,8 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) @@ -6452,6 +6640,8 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -6516,6 +6706,8 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -6571,6 +6763,8 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -6638,6 +6832,8 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -6702,6 +6898,8 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstanceNetworkInterfaceIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) @@ -6774,6 +6972,8 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -6839,6 +7039,8 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -6906,6 +7108,8 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -6985,6 +7189,8 @@ func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -7038,6 +7244,8 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -7105,6 +7313,8 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) @@ -7165,6 +7375,8 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstanceGroupsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) @@ -7231,6 +7443,8 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -7324,6 +7538,8 @@ func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInst } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -7376,6 +7592,8 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -7441,6 +7659,8 @@ func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInst builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupOptions.InstanceGroupPatch) @@ -7508,6 +7728,8 @@ func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -7560,6 +7782,8 @@ func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstanceGroupManagersOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) @@ -7630,6 +7854,8 @@ func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, cre builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) @@ -7698,6 +7924,8 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, del } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -7751,6 +7979,8 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -7816,6 +8046,8 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, upd builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) @@ -7885,6 +8117,8 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstanceGroupManagerActionsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) @@ -7956,6 +8190,8 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) @@ -8025,6 +8261,8 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -8079,6 +8317,8 @@ func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -8145,6 +8385,8 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) @@ -8214,6 +8456,8 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstanceGroupManagerPoliciesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Start)) @@ -8285,6 +8529,8 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) @@ -8354,6 +8600,8 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -8408,6 +8656,8 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -8474,6 +8724,8 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) @@ -8542,6 +8794,8 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -8594,6 +8848,8 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstanceGroupMembershipsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) @@ -8664,6 +8920,8 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -8717,6 +8975,8 @@ func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, get builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -8782,6 +9042,8 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupMembershipOptions.InstanceGroupMembershipPatch) @@ -8843,6 +9105,8 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listDedicatedHostGroupsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) @@ -8918,6 +9182,8 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -9001,6 +9267,8 @@ func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, delet } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -9053,6 +9321,8 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -9119,6 +9389,8 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) @@ -9180,6 +9452,8 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listDedicatedHostProfilesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) @@ -9249,6 +9523,8 @@ func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDed builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -9304,6 +9580,8 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listDedicatedHostsOptions.DedicatedHostGroupID != nil { builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) @@ -9382,6 +9660,8 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createDedicatedHostOptions.DedicatedHostPrototype) @@ -9452,6 +9732,8 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -9516,6 +9798,8 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -9581,6 +9865,8 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) @@ -9648,6 +9934,8 @@ func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedi } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -9700,6 +9988,8 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -9766,6 +10056,8 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) @@ -9827,6 +10119,8 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listBackupPoliciesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) @@ -9903,6 +10197,8 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -9988,6 +10284,8 @@ func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBacku builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listBackupPolicyJobsOptions.Status != nil { builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) @@ -10076,6 +10374,8 @@ func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPo builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -10139,6 +10439,8 @@ func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBack builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listBackupPolicyPlansOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) @@ -10213,6 +10515,8 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -10315,6 +10619,8 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -10379,6 +10685,8 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -10448,6 +10756,8 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) @@ -10522,6 +10832,8 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -10585,6 +10897,8 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -10653,6 +10967,8 @@ func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBacku } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) @@ -10713,6 +11029,8 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listPlacementGroupsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) @@ -10779,6 +11097,8 @@ func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPla builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -10857,6 +11177,8 @@ func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePla } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -10909,6 +11231,8 @@ func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacement builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -10974,6 +11298,8 @@ func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePla builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updatePlacementGroupOptions.PlacementGroupPatch) @@ -11036,6 +11362,8 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listBareMetalServerProfilesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) @@ -11105,6 +11433,8 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -11160,6 +11490,8 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listBareMetalServersOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) @@ -11261,6 +11593,8 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createBareMetalServerOptions.BareMetalServerPrototype) @@ -11333,6 +11667,8 @@ func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -11410,6 +11746,8 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -11474,6 +11812,8 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -11539,6 +11879,8 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) @@ -11614,6 +11956,8 @@ func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.C builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listBareMetalServerNetworkAttachmentsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) @@ -11686,6 +12030,8 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context. builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) @@ -11757,6 +12103,8 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context. } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -11810,6 +12158,8 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -11877,6 +12227,8 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) @@ -11948,6 +12300,8 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listBareMetalServerNetworkInterfacesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) @@ -12022,6 +12376,8 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) @@ -12092,6 +12448,8 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -12145,6 +12503,8 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -12212,6 +12572,8 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) @@ -12281,6 +12643,8 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -12345,6 +12709,8 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -12400,6 +12766,8 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -12468,6 +12836,8 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -12532,6 +12902,8 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -12598,6 +12970,8 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -12661,6 +13035,8 @@ func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBa } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -12713,6 +13089,8 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -12778,6 +13156,8 @@ func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBa builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateBareMetalServerOptions.BareMetalServerPatch) @@ -12848,6 +13228,8 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -12910,6 +13292,8 @@ func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restart } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -12961,6 +13345,8 @@ func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBare } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -13014,6 +13400,8 @@ func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMe builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -13068,6 +13456,8 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVolumeProfilesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) @@ -13137,6 +13527,8 @@ func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProf builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -13193,6 +13585,8 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVolumesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) @@ -13278,6 +13672,8 @@ func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptio builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createVolumeOptions.VolumePrototype) @@ -13349,6 +13745,8 @@ func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptio } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -13401,6 +13799,8 @@ func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *Ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -13469,6 +13869,8 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) @@ -13532,6 +13934,8 @@ func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshot } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) @@ -13578,6 +13982,8 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listSnapshotsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) @@ -13699,6 +14105,8 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createSnapshotOptions.SnapshotPrototype) @@ -13769,6 +14177,8 @@ func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -13821,6 +14231,8 @@ func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -13889,6 +14301,8 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) @@ -13957,6 +14371,8 @@ func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapsho builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -14021,6 +14437,8 @@ func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnap } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -14074,6 +14492,8 @@ func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCl builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -14139,6 +14559,8 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -14196,6 +14618,8 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listShareProfilesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) @@ -14268,6 +14692,8 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -14323,6 +14749,8 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listSharesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) @@ -14405,6 +14833,8 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) @@ -14482,6 +14912,8 @@ func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -14545,6 +14977,8 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -14613,6 +15047,8 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) @@ -14686,6 +15122,8 @@ func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOpt builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -14754,6 +15192,8 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listShareMountTargetsOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) @@ -14830,6 +15270,8 @@ func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createS builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) @@ -14902,6 +15344,8 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -14966,6 +15410,8 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -15033,6 +15479,8 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateShareMountTargetOptions.ShareMountTargetPatch) @@ -15104,6 +15552,8 @@ func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareS } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -15157,6 +15607,8 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -15216,6 +15668,8 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -15279,6 +15733,8 @@ func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *Ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -15343,6 +15799,8 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -15407,6 +15865,8 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -15467,6 +15927,8 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVirtualNetworkInterfacesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) @@ -15538,6 +16000,8 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -15596,7 +16060,8 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, // 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 a primary network attachment. +// virtual network interface must not be required by another resource, such as the primary network attachment for an +// instance. func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) } @@ -15634,6 +16099,8 @@ func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -15686,6 +16153,8 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, get builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -15752,6 +16221,8 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) @@ -15820,6 +16291,8 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listNetworkInterfaceFloatingIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) @@ -15892,6 +16365,8 @@ func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -15946,6 +16421,8 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -16016,6 +16493,8 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -16079,6 +16558,8 @@ func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVirtualNetworkInterfaceIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start)) @@ -16154,6 +16635,8 @@ func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -16208,6 +16691,8 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, g builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -16273,6 +16758,8 @@ func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, a builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -16330,6 +16817,8 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listPublicGatewaysOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) @@ -16404,6 +16893,8 @@ func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPubl builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -16489,6 +16980,8 @@ func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePubl } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -16541,6 +17034,8 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -16605,6 +17100,8 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) @@ -16666,6 +17163,8 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listFloatingIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listFloatingIpsOptions.Start)) @@ -16750,6 +17249,8 @@ func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatin builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createFloatingIPOptions.FloatingIPPrototype) @@ -16818,6 +17319,8 @@ func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatin } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -16870,6 +17373,8 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -16934,6 +17439,8 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateFloatingIPOptions.FloatingIPPatch) @@ -16996,6 +17503,8 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listNetworkAclsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) @@ -17067,6 +17576,8 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createNetworkACLOptions.NetworkACLPrototype) @@ -17135,6 +17646,8 @@ func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetwork } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -17187,6 +17700,8 @@ func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -17251,6 +17766,8 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) @@ -17320,6 +17837,8 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listNetworkACLRulesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listNetworkACLRulesOptions.Start)) @@ -17394,6 +17913,8 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) @@ -17462,6 +17983,8 @@ func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNet } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -17515,6 +18038,8 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -17581,6 +18106,8 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) @@ -17644,6 +18171,8 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listSecurityGroupsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSecurityGroupsOptions.Start)) @@ -17725,6 +18254,8 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -17806,6 +18337,8 @@ func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecu } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -17858,6 +18391,8 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -17924,6 +18459,8 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateSecurityGroupOptions.SecurityGroupPatch) @@ -17994,6 +18531,8 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -18063,6 +18602,8 @@ func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, create builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) @@ -18132,6 +18673,8 @@ func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, delete } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -18185,6 +18728,8 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -18252,6 +18797,8 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) @@ -18321,6 +18868,8 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listSecurityGroupTargetsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) @@ -18401,6 +18950,8 @@ func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -18455,6 +19006,8 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -18529,6 +19082,8 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -18584,6 +19139,8 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listIkePoliciesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listIkePoliciesOptions.Start)) @@ -18650,6 +19207,8 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -18740,6 +19299,8 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -18792,6 +19353,8 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -18856,6 +19419,8 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateIkePolicyOptions.IkePolicyPatch) @@ -18924,6 +19489,8 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -18979,6 +19546,8 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listIpsecPoliciesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listIpsecPoliciesOptions.Start)) @@ -19045,6 +19614,8 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -19132,6 +19703,8 @@ func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecP } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -19184,6 +19757,8 @@ func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyO builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -19248,6 +19823,8 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) @@ -19316,6 +19893,8 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -19371,6 +19950,8 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPNGatewaysOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPNGatewaysOptions.Start)) @@ -19446,6 +20027,8 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) @@ -19515,6 +20098,8 @@ func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGate } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -19567,6 +20152,8 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -19631,6 +20218,8 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPNGatewayOptions.VPNGatewayPatch) @@ -19699,6 +20288,8 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPNGatewayConnectionsOptions.Status != nil { builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) @@ -19766,6 +20357,8 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) @@ -19835,6 +20428,8 @@ func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, del } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -19888,6 +20483,8 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -19953,6 +20550,8 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) @@ -20024,6 +20623,8 @@ func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Cont builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -20091,6 +20692,8 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Con } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -20147,6 +20750,8 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Cont } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -20204,6 +20809,8 @@ func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -20259,6 +20866,8 @@ func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Conte builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -20326,6 +20935,8 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Cont } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -20382,6 +20993,8 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Conte } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -20439,6 +21052,8 @@ func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -20483,6 +21098,8 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPNServersOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) @@ -20558,6 +21175,8 @@ func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServe builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -20665,6 +21284,8 @@ func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServe } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -20717,6 +21338,8 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -20785,6 +21408,8 @@ func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServe } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) @@ -20854,6 +21479,8 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context builder.AddHeader("Accept", "text/plain") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -20907,6 +21534,8 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPNServerClientsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start)) @@ -20981,6 +21610,8 @@ func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVP } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -21034,6 +21665,8 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -21099,6 +21732,8 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -21153,6 +21788,8 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPNServerRoutesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPNServerRoutesOptions.Start)) @@ -21229,6 +21866,8 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -21307,6 +21946,8 @@ func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPN } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -21360,6 +22001,8 @@ func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServer builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -21426,6 +22069,8 @@ func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPN builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPNServerRouteOptions.VPNServerRoutePatch) @@ -21487,6 +22132,8 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listLoadBalancerProfilesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) @@ -21556,6 +22203,8 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -21611,6 +22260,8 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listLoadBalancersOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start)) @@ -21677,6 +22328,8 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -21785,6 +22438,8 @@ func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadB } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -21837,6 +22492,8 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -21906,6 +22563,8 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) @@ -21974,6 +22633,8 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -22037,6 +22698,8 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -22101,6 +22764,8 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -22204,6 +22869,8 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, del } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -22257,6 +22924,8 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -22322,6 +22991,8 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) @@ -22391,6 +23062,8 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -22456,6 +23129,8 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -22541,6 +23216,8 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -22595,6 +23272,8 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -22661,6 +23340,8 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) @@ -22731,6 +23412,8 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -22797,6 +23480,8 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -22880,6 +23565,8 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Co } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -22935,6 +23622,8 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -23002,6 +23691,8 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) @@ -23070,6 +23761,8 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -23134,6 +23827,8 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -23225,6 +23920,8 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteL } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -23278,6 +23975,8 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -23343,6 +24042,8 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) @@ -23412,6 +24113,8 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -23477,6 +24180,8 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -23558,6 +24263,8 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -23631,6 +24338,8 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, d } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -23685,6 +24394,8 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -23751,6 +24462,8 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) @@ -23812,6 +24525,8 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listEndpointGatewaysOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listEndpointGatewaysOptions.Name)) @@ -23885,6 +24600,8 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -23972,6 +24689,8 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listEndpointGatewayIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listEndpointGatewayIpsOptions.Start)) @@ -24045,6 +24764,8 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -24098,6 +24819,8 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -24165,6 +24888,8 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -24230,6 +24955,8 @@ func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEn } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -24282,6 +25009,8 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -24346,6 +25075,8 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateEndpointGatewayOptions.EndpointGatewayPatch) @@ -24407,6 +25138,8 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listFlowLogCollectorsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listFlowLogCollectorsOptions.Start)) @@ -24496,6 +25229,8 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -24581,6 +25316,8 @@ func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteF } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -24633,6 +25370,8 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() @@ -24699,6 +25438,8 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateFlowLogCollectorOptions.FlowLogCollectorPatch) @@ -26570,13 +27311,13 @@ type BareMetalServer struct { // The network attachments for this bare metal server, including the primary network attachment. NetworkAttachments []BareMetalServerNetworkAttachmentReference `json:"network_attachments,omitempty"` - // The bare metal server network interfaces, including the primary interface. + // The network interfaces for this bare metal server, including the primary network interface. NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces" validate:"required"` - // The primary network attachment. + // The primary network attachment for this bare metal server. PrimaryNetworkAttachment *BareMetalServerNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` - // The primary bare metal server network interface. + // The primary network interface for this bare metal server. PrimaryNetworkInterface *NetworkInterfaceBareMetalServerContextReference `json:"primary_network_interface" validate:"required"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) @@ -27326,13 +28067,13 @@ func UnmarshalBareMetalServerLifecycleReason(m map[string]json.RawMessage, resul // - BareMetalServerNetworkAttachmentByPci // - BareMetalServerNetworkAttachmentByVlan type BareMetalServerNetworkAttachment struct { - // The date and time that the network attachment was created. + // 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 network attachment. + // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this network attachment. + // The unique identifier for this bare metal server network attachment. ID *string `json:"id" validate:"required"` // The network attachment's interface type: @@ -27352,34 +28093,39 @@ type BareMetalServerNetworkAttachment struct { // unexpected property value was encountered. InterfaceType *string `json:"interface_type" validate:"required"` - // The lifecycle state of the network attachment. + // 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 network attachment in Mbps. + // The port speed for this bare metal server network attachment in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` - // The primary IP address of the virtual network interface for the network attachment. + // 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 network attachment. + // The subnet of the virtual network interface for the bare metal server network + // attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` - // This bare metal server network attachment's interface type. + // The bare metal server network attachment type. Type *string `json:"type" validate:"required"` - // The virtual network interface for this network attachment. + // The virtual network interface for this bare metal server network attachment. VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // Indicates if the network attachment can automatically float to any other server within the same `resource_group`. - // The network attachment will float automatically if the network detects a GARP or RARP on another bare metal server - // in the resource group. Applies only to network attachments with `vlan` interface type. + // Indicates if the bare metal server network attachment can automatically float to any other server within the same + // `resource_group`. The bare metal server network attachment will float automatically if the network detects a GARP or + // RARP on another bare metal server in the resource group. Applies only to bare metal server network attachments with + // `vlan` interface type. AllowToFloat *bool `json:"allow_to_float,omitempty"` // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this attachment. @@ -27409,7 +28155,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkAttachment.LifecycleState property. -// The lifecycle state of the network attachment. +// The lifecycle state of the bare metal server network attachment. const ( BareMetalServerNetworkAttachmentLifecycleStateDeletingConst = "deleting" BareMetalServerNetworkAttachmentLifecycleStateFailedConst = "failed" @@ -27427,7 +28173,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkAttachment.Type property. -// This bare metal server network attachment's interface type. +// The bare metal server network attachment type. const ( BareMetalServerNetworkAttachmentTypePrimaryConst = "primary" BareMetalServerNetworkAttachmentTypeSecondaryConst = "secondary" @@ -27615,21 +28361,22 @@ type BareMetalServerNetworkAttachmentPrototype struct { // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. InterfaceType *string `json:"interface_type" validate:"required"` - // The name for this 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. + // 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 network attachment. This can be specified using an - // existing virtual network interface, or a prototype object for a new virtual network - // interface. - VirtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + // 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. + VirtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) attachment. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // Indicates if the network attachment can automatically float to any other server within the same `resource_group`. - // The network attachment will float automatically if the network detects a GARP or RARP on another bare metal server - // in the resource group. Applies only to network attachments with `vlan` interface type. + // Indicates if the bare metal server network attachment can automatically float to any other server within the same + // `resource_group`. The bare metal server network attachment will float automatically if the network detects a GARP or + // RARP on another bare metal server in the resource group. Applies only to bare metal server network attachments with + // `vlan` interface type. AllowToFloat *bool `json:"allow_to_float,omitempty"` // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this attachment. @@ -27696,21 +28443,25 @@ type BareMetalServerNetworkAttachmentReference struct { // some supplementary information. Deleted *BareMetalServerNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network attachment. + // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this network attachment. + // 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 network attachment. + // 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 network attachment. + // The subnet of the virtual network interface for the bare metal server network + // attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` } @@ -27866,7 +28617,7 @@ type BareMetalServerNetworkInterface struct { // The associated subnet. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The type of this bare metal server network interface. + // The bare metal server network interface type. Type *string `json:"type" validate:"required"` // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. @@ -27921,7 +28672,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterface.Type property. -// The type of this bare metal server network interface. +// The bare metal server network interface type. const ( BareMetalServerNetworkInterfaceTypePrimaryConst = "primary" BareMetalServerNetworkInterfaceTypeSecondaryConst = "secondary" @@ -28336,14 +29087,14 @@ type BareMetalServerPrimaryNetworkAttachmentPrototype struct { // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. InterfaceType *string `json:"interface_type" validate:"required"` - // The name for this 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. + // 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 network attachment. This can be specified using an - // existing virtual network interface, or a prototype object for a new virtual network - // interface. - VirtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + // 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. + VirtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` } // Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototype.InterfaceType property. @@ -28368,7 +29119,7 @@ const ( ) // NewBareMetalServerPrimaryNetworkAttachmentPrototype : Instantiate BareMetalServerPrimaryNetworkAttachmentPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototype(interfaceType string, virtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf) (_model *BareMetalServerPrimaryNetworkAttachmentPrototype, err error) { +func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototype(interfaceType string, virtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf) (_model *BareMetalServerPrimaryNetworkAttachmentPrototype, err error) { _model = &BareMetalServerPrimaryNetworkAttachmentPrototype{ InterfaceType: core.StringPtr(interfaceType), VirtualNetworkInterface: virtualNetworkInterface, @@ -28392,7 +29143,7 @@ func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype(m map[string]json if err != nil { return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) if err != nil { return } @@ -31430,10 +32181,10 @@ type CreateInstanceNetworkAttachmentOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // A virtual network interface for the network attachment. This can be specified using an - // existing virtual network interface, or a prototype object for a new virtual network - // interface. - VirtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + // 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. + VirtualNetworkInterface VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf `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. @@ -31444,7 +32195,7 @@ type CreateInstanceNetworkAttachmentOptions struct { } // NewCreateInstanceNetworkAttachmentOptions : Instantiate CreateInstanceNetworkAttachmentOptions -func (*VpcV1) NewCreateInstanceNetworkAttachmentOptions(instanceID string, virtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf) *CreateInstanceNetworkAttachmentOptions { +func (*VpcV1) NewCreateInstanceNetworkAttachmentOptions(instanceID string, virtualNetworkInterface VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf) *CreateInstanceNetworkAttachmentOptions { return &CreateInstanceNetworkAttachmentOptions{ InstanceID: core.StringPtr(instanceID), VirtualNetworkInterface: virtualNetworkInterface, @@ -31458,7 +32209,7 @@ func (_options *CreateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID } // SetVirtualNetworkInterface : Allow user to set VirtualNetworkInterface -func (_options *CreateInstanceNetworkAttachmentOptions) SetVirtualNetworkInterface(virtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf) *CreateInstanceNetworkAttachmentOptions { +func (_options *CreateInstanceNetworkAttachmentOptions) SetVirtualNetworkInterface(virtualNetworkInterface VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf) *CreateInstanceNetworkAttachmentOptions { _options.VirtualNetworkInterface = virtualNetworkInterface return _options } @@ -36488,7 +37239,7 @@ type DeleteBareMetalServerNetworkAttachmentOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network attachment identifier. + // The bare metal server network attachment identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -39697,13 +40448,14 @@ func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) // // Specify `null` to remove an existing binding. // Models which "extend" this model: +// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity // - FloatingIPTargetPatchNetworkInterfaceIdentity // - FloatingIPTargetPatchVirtualNetworkInterfaceIdentity type FloatingIPTargetPatch struct { - // The unique identifier for this instance network interface. + // The unique identifier for this bare metal server network interface. ID *string `json:"id,omitempty"` - // The URL for this instance network interface. + // The URL for this bare metal server network interface. Href *string `json:"href,omitempty"` // The CRN for this virtual network interface. @@ -39745,13 +40497,14 @@ func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interfa // - 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 instance network interface. + // The unique identifier for this bare metal server network interface. ID *string `json:"id,omitempty"` - // The URL for this instance network interface. + // The URL for this bare metal server network interface. Href *string `json:"href,omitempty"` // The CRN for this virtual network interface. @@ -40098,10 +40851,11 @@ type FlowLogCollectorTarget struct { // The CRN for this virtual server instance. CRN *string `json:"crn,omitempty"` - // The primary IP address of the virtual network interface for the network attachment. + // 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 network attachment. + // The subnet of the virtual network interface for the instance network attachment. Subnet *SubnetReference `json:"subnet,omitempty"` } @@ -40401,7 +41155,7 @@ type GetBareMetalServerNetworkAttachmentOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network attachment identifier. + // The bare metal server network attachment identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -45177,7 +45931,7 @@ type Instance struct { // The network attachments for this virtual server instance, including the primary network attachment. NetworkAttachments []InstanceNetworkAttachmentReference `json:"network_attachments" validate:"required"` - // The instance network interfaces, including the primary instance network interface. + // The network interfaces for this instance, including the primary network interface. NetworkInterfaces []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"` // The placement restrictions for the virtual server instance. @@ -45186,7 +45940,7 @@ type Instance struct { // The primary network attachment for this virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` - // The primary instance network interface. + // The primary network interface for this virtual server instance. PrimaryNetworkInterface *NetworkInterfaceInstanceContextReference `json:"primary_network_interface" validate:"required"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this virtual @@ -48319,41 +49073,43 @@ func UnmarshalInstanceMetadataServicePrototype(m map[string]json.RawMessage, res // InstanceNetworkAttachment : InstanceNetworkAttachment struct type InstanceNetworkAttachment struct { - // The date and time that the network attachment was created. + // The date and time that the instance network attachment was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The URL for this network attachment. + // The URL for this instance network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this network attachment. + // The unique identifier for this instance network attachment. ID *string `json:"id" validate:"required"` - // The lifecycle state of the network attachment. + // 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 network attachment in Mbps. + // 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 network attachment. + // 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 network attachment. + // The subnet of the virtual network interface for the instance network attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The network attachment type. + // The instance network attachment type. Type *string `json:"type" validate:"required"` - // The virtual network interface for this network attachment. + // 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 network attachment. +// The lifecycle state of the instance network attachment. const ( InstanceNetworkAttachmentLifecycleStateDeletingConst = "deleting" InstanceNetworkAttachmentLifecycleStateFailedConst = "failed" @@ -48371,7 +49127,7 @@ const ( ) // Constants associated with the InstanceNetworkAttachment.Type property. -// The network attachment type. +// The instance network attachment type. const ( InstanceNetworkAttachmentTypePrimaryConst = "primary" InstanceNetworkAttachmentTypeSecondaryConst = "secondary" @@ -48478,14 +49234,14 @@ type InstanceNetworkAttachmentPrototype struct { // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // A virtual network interface for the network attachment. This can be specified using an - // existing virtual network interface, or a prototype object for a new virtual network - // interface. - VirtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + // 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. + VirtualNetworkInterface VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` } // NewInstanceNetworkAttachmentPrototype : Instantiate InstanceNetworkAttachmentPrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf) (_model *InstanceNetworkAttachmentPrototype, err error) { +func (*VpcV1) NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf) (_model *InstanceNetworkAttachmentPrototype, err error) { _model = &InstanceNetworkAttachmentPrototype{ VirtualNetworkInterface: virtualNetworkInterface, } @@ -48500,7 +49256,7 @@ func UnmarshalInstanceNetworkAttachmentPrototype(m map[string]json.RawMessage, r if err != nil { return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) if err != nil { return } @@ -48514,21 +49270,23 @@ type InstanceNetworkAttachmentReference struct { // some supplementary information. Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network attachment. + // The URL for this instance network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this network attachment. + // 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 network attachment. + // 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 network attachment. + // The subnet of the virtual network interface for the instance network attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` } @@ -50429,9 +51187,9 @@ func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interfac // InstanceTemplate : InstanceTemplate struct // Models which "extend" this model: -// - InstanceTemplateInstanceByImage -// - InstanceTemplateInstanceBySourceSnapshot -// - InstanceTemplateInstanceByCatalogOffering +// - InstanceTemplateInstanceByImageInstanceTemplateContext +// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext +// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext type InstanceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -61002,7 +61760,7 @@ type NetworkInterface struct { // The associated subnet. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The type of this instance network interface as it relates to an instance. + // The instance network interface type. Type *string `json:"type" validate:"required"` } @@ -61022,7 +61780,7 @@ const ( ) // Constants associated with the NetworkInterface.Type property. -// The type of this instance network interface as it relates to an instance. +// The instance network interface type. const ( NetworkInterfaceTypePrimaryConst = "primary" NetworkInterfaceTypeSecondaryConst = "secondary" @@ -68460,7 +69218,7 @@ type Snapshot struct { // The name for this snapshot. The name is unique across all snapshots in the region. Name *string `json:"name" validate:"required"` - // The operating system included in this image. + // The operating system included in this snapshot. OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` // The resource group for this snapshot. @@ -70087,7 +70845,7 @@ type UpdateBareMetalServerNetworkAttachmentOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network attachment identifier. + // The bare metal server network attachment identifier. ID *string `json:"id" validate:"required,ne="` // The bare metal server network attachment patch. @@ -75576,12 +76334,12 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototype(m map[string]json.RawMes return } -// VirtualNetworkInterfacePrototypeAttachmentContext : A virtual network interface for the network attachment. This can be specified using an existing virtual network -// interface, or a prototype object for a new virtual network interface. +// VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext : 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. // Models which "extend" this model: -// - VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext -// - VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeAttachmentContext struct { +// - VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext +// - VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext 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"` @@ -75652,17 +76410,156 @@ type VirtualNetworkInterfacePrototypeAttachmentContext struct { CRN *string `json:"crn,omitempty"` } -func (*VirtualNetworkInterfacePrototypeAttachmentContext) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { +func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool { return true } -type VirtualNetworkInterfacePrototypeAttachmentContextIntf interface { - isaVirtualNetworkInterfacePrototypeAttachmentContext() bool +type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf interface { + isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool } -// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeAttachmentContext) +// UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext unmarshals an instance of VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext : 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. +// Models which "extend" this model: +// - VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext +// - VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext 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`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 + // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // same subnet as the primary IP. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. + // + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP and + // `primary_ip.address` is not specified. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` + + // 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 (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool { + return true +} + +type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf interface { + isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool +} + +// UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext unmarshals an instance of VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { return @@ -77985,36 +78882,38 @@ func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializat // BareMetalServerNetworkAttachmentByHiperSocket : BareMetalServerNetworkAttachmentByHiperSocket struct // This model "extends" BareMetalServerNetworkAttachment type BareMetalServerNetworkAttachmentByHiperSocket struct { - // The date and time that the network attachment was created. + // 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 network attachment. + // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this network attachment. + // The unique identifier for this bare metal server network attachment. ID *string `json:"id" validate:"required"` - // The lifecycle state of the network attachment. + // 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 network attachment in Mbps. + // The port speed for this bare metal server network attachment in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` - // The primary IP address of the virtual network interface for the network attachment. + // 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 network attachment. + // The subnet of the virtual network interface for the bare metal server network attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` - // This bare metal server network attachment's interface type. + // The bare metal server network attachment type. Type *string `json:"type" validate:"required"` - // The virtual network interface for this network attachment. + // The virtual network interface for this bare metal server network attachment. VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity @@ -78023,7 +78922,7 @@ type BareMetalServerNetworkAttachmentByHiperSocket struct { } // Constants associated with the BareMetalServerNetworkAttachmentByHiperSocket.LifecycleState property. -// The lifecycle state of the network attachment. +// The lifecycle state of the bare metal server network attachment. const ( BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateDeletingConst = "deleting" BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateFailedConst = "failed" @@ -78041,7 +78940,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkAttachmentByHiperSocket.Type property. -// This bare metal server network attachment's interface type. +// The bare metal server network attachment type. const ( BareMetalServerNetworkAttachmentByHiperSocketTypePrimaryConst = "primary" BareMetalServerNetworkAttachmentByHiperSocketTypeSecondaryConst = "secondary" @@ -78116,36 +79015,38 @@ func UnmarshalBareMetalServerNetworkAttachmentByHiperSocket(m map[string]json.Ra // BareMetalServerNetworkAttachmentByPci : BareMetalServerNetworkAttachmentByPci struct // This model "extends" BareMetalServerNetworkAttachment type BareMetalServerNetworkAttachmentByPci struct { - // The date and time that the network attachment was created. + // 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 network attachment. + // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this network attachment. + // The unique identifier for this bare metal server network attachment. ID *string `json:"id" validate:"required"` - // The lifecycle state of the network attachment. + // 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 network attachment in Mbps. + // The port speed for this bare metal server network attachment in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` - // The primary IP address of the virtual network interface for the network attachment. + // 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 network attachment. + // The subnet of the virtual network interface for the bare metal server network attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` - // This bare metal server network attachment's interface type. + // The bare metal server network attachment type. Type *string `json:"type" validate:"required"` - // The virtual network interface for this network attachment. + // The virtual network interface for this bare metal server network attachment. VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` @@ -78159,7 +79060,7 @@ type BareMetalServerNetworkAttachmentByPci struct { } // Constants associated with the BareMetalServerNetworkAttachmentByPci.LifecycleState property. -// The lifecycle state of the network attachment. +// The lifecycle state of the bare metal server network attachment. const ( BareMetalServerNetworkAttachmentByPciLifecycleStateDeletingConst = "deleting" BareMetalServerNetworkAttachmentByPciLifecycleStateFailedConst = "failed" @@ -78177,7 +79078,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkAttachmentByPci.Type property. -// This bare metal server network attachment's interface type. +// The bare metal server network attachment type. const ( BareMetalServerNetworkAttachmentByPciTypePrimaryConst = "primary" BareMetalServerNetworkAttachmentByPciTypeSecondaryConst = "secondary" @@ -78259,41 +79160,44 @@ func UnmarshalBareMetalServerNetworkAttachmentByPci(m map[string]json.RawMessage // BareMetalServerNetworkAttachmentByVlan : BareMetalServerNetworkAttachmentByVlan struct // This model "extends" BareMetalServerNetworkAttachment type BareMetalServerNetworkAttachmentByVlan struct { - // The date and time that the network attachment was created. + // 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 network attachment. + // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this network attachment. + // The unique identifier for this bare metal server network attachment. ID *string `json:"id" validate:"required"` - // The lifecycle state of the network attachment. + // 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 network attachment in Mbps. + // The port speed for this bare metal server network attachment in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` - // The primary IP address of the virtual network interface for the network attachment. + // 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 network attachment. + // The subnet of the virtual network interface for the bare metal server network attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` - // This bare metal server network attachment's interface type. + // The bare metal server network attachment type. Type *string `json:"type" validate:"required"` - // The virtual network interface for this network attachment. + // The virtual network interface for this bare metal server network attachment. VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` - // Indicates if the network attachment can automatically float to any other server within the same `resource_group`. - // The network attachment will float automatically if the network detects a GARP or RARP on another bare metal server - // in the resource group. Applies only to network attachments with `vlan` interface type. + // Indicates if the bare metal server network attachment can automatically float to any other server within the same + // `resource_group`. The bare metal server network attachment will float automatically if the network detects a GARP or + // RARP on another bare metal server in the resource group. Applies only to bare metal server network attachments with + // `vlan` interface type. AllowToFloat *bool `json:"allow_to_float" validate:"required"` // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array @@ -78306,7 +79210,7 @@ type BareMetalServerNetworkAttachmentByVlan struct { } // Constants associated with the BareMetalServerNetworkAttachmentByVlan.LifecycleState property. -// The lifecycle state of the network attachment. +// The lifecycle state of the bare metal server network attachment. const ( BareMetalServerNetworkAttachmentByVlanLifecycleStateDeletingConst = "deleting" BareMetalServerNetworkAttachmentByVlanLifecycleStateFailedConst = "failed" @@ -78324,7 +79228,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkAttachmentByVlan.Type property. -// This bare metal server network attachment's interface type. +// The bare metal server network attachment type. const ( BareMetalServerNetworkAttachmentByVlanTypePrimaryConst = "primary" BareMetalServerNetworkAttachmentByVlanTypeSecondaryConst = "secondary" @@ -78408,11 +79312,11 @@ func UnmarshalBareMetalServerNetworkAttachmentByVlan(m map[string]json.RawMessag // BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype struct // This model "extends" BareMetalServerNetworkAttachmentPrototype type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype struct { - // The name for this 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. + // 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 VirtualNetworkInterfacePrototypeAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + VirtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity // within a `s390x` based system. @@ -78429,7 +79333,7 @@ const ( ) // NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype, err error) { +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype, err error) { _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype{ VirtualNetworkInterface: virtualNetworkInterface, InterfaceType: core.StringPtr(interfaceType), @@ -78449,7 +79353,7 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAtt if err != nil { return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) if err != nil { return } @@ -78464,11 +79368,11 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAtt // BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct // This model "extends" BareMetalServerNetworkAttachmentPrototype type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct { - // The name for this 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. + // 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 VirtualNetworkInterfacePrototypeAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + VirtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) attachment. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` @@ -78494,7 +79398,7 @@ const ( ) // NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype, err error) { +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype, err error) { _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype{ VirtualNetworkInterface: virtualNetworkInterface, InterfaceType: core.StringPtr(interfaceType), @@ -78514,7 +79418,7 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAtt if err != nil { return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) if err != nil { return } @@ -78533,15 +79437,16 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAtt // BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct // This model "extends" BareMetalServerNetworkAttachmentPrototype type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct { - // The name for this 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. + // 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 VirtualNetworkInterfacePrototypeAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + VirtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` - // Indicates if the network attachment can automatically float to any other server within the same `resource_group`. - // The network attachment will float automatically if the network detects a GARP or RARP on another bare metal server - // in the resource group. Applies only to network attachments with `vlan` interface type. + // Indicates if the bare metal server network attachment can automatically float to any other server within the same + // `resource_group`. The bare metal server network attachment will float automatically if the network detects a GARP or + // RARP on another bare metal server in the resource group. Applies only to bare metal server network attachments with + // `vlan` interface type. AllowToFloat *bool `json:"allow_to_float,omitempty"` // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array @@ -78564,7 +79469,7 @@ const ( ) // NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeAttachmentContextIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype, err error) { +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype, err error) { _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype{ VirtualNetworkInterface: virtualNetworkInterface, InterfaceType: core.StringPtr(interfaceType), @@ -78585,7 +79490,7 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAtt if err != nil { return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeAttachmentContext) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) if err != nil { return } @@ -78658,7 +79563,7 @@ type BareMetalServerNetworkInterfaceByHiperSocket struct { // The associated subnet. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The type of this bare metal server network interface. + // The bare metal server network interface type. Type *string `json:"type" validate:"required"` // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity @@ -78682,7 +79587,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Type property. -// The type of this bare metal server network interface. +// The bare metal server network interface type. const ( BareMetalServerNetworkInterfaceByHiperSocketTypePrimaryConst = "primary" BareMetalServerNetworkInterfaceByHiperSocketTypeSecondaryConst = "secondary" @@ -78823,7 +79728,7 @@ type BareMetalServerNetworkInterfaceByPci struct { // The associated subnet. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The type of this bare metal server network interface. + // The bare metal server network interface type. Type *string `json:"type" validate:"required"` // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. @@ -78853,7 +79758,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterfaceByPci.Type property. -// The type of this bare metal server network interface. +// The bare metal server network interface type. const ( BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" @@ -79001,7 +79906,7 @@ type BareMetalServerNetworkInterfaceByVlan struct { // The associated subnet. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The type of this bare metal server network interface. + // The bare metal server network interface type. Type *string `json:"type" validate:"required"` // Indicates if the interface can float to any other server within the same @@ -79036,7 +79941,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterfaceByVlan.Type property. -// The type of this bare metal server network interface. +// The bare metal server network interface type. const ( BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" @@ -82225,6 +83130,47 @@ func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, 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. + ID *string `json:"id,omitempty"` + + // The URL for this bare metal server network interface. + Href *string `json:"href,omitempty"` +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPatchIntf + isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetPatchNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. // Models which "extend" this model: // - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID @@ -82315,6 +83261,47 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity(m map[string] 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. + ID *string `json:"id,omitempty"` + + // The URL for this bare metal server network interface. + Href *string `json:"href,omitempty"` +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPrototypeIntf + isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetPrototypeNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. // Models which "extend" this model: // - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID @@ -82958,21 +83945,23 @@ type FlowLogCollectorTargetInstanceNetworkAttachmentReference struct { // some supplementary information. Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network attachment. + // The URL for this instance network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this network attachment. + // 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 network attachment. + // 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 network attachment. + // The subnet of the virtual network interface for the instance network attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` } @@ -87591,21 +88580,15 @@ func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result return } -// InstanceTemplateInstanceByCatalogOffering : Create an instance by using a catalog offering. +// InstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Create an instance template that creates instances by using a catalog offering. // Models which "extend" this model: -// - InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment -// - InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceByCatalogOffering struct { +// - 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 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. @@ -87613,12 +88596,6 @@ type InstanceTemplateInstanceByCatalogOffering struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -87635,8 +88612,9 @@ type InstanceTemplateInstanceByCatalogOffering struct { 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -87646,8 +88624,7 @@ type InstanceTemplateInstanceByCatalogOffering struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -87696,46 +88673,30 @@ type InstanceTemplateInstanceByCatalogOffering struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } -func (*InstanceTemplateInstanceByCatalogOffering) isaInstanceTemplateInstanceByCatalogOffering() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { return true } -type InstanceTemplateInstanceByCatalogOfferingIntf interface { - InstanceTemplateIntf - isaInstanceTemplateInstanceByCatalogOffering() bool +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool } -func (*InstanceTemplateInstanceByCatalogOffering) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceByCatalogOffering unmarshals an instance of InstanceTemplateInstanceByCatalogOffering from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOffering) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -87756,7 +88717,7 @@ func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -87808,21 +88769,15 @@ func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMes return } -// InstanceTemplateInstanceByImage : Create an instance by using an image. +// InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. // Models which "extend" this model: -// - InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment -// - InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceByImage struct { +// - 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 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. @@ -87830,12 +88785,6 @@ type InstanceTemplateInstanceByImage struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -87852,8 +88801,9 @@ type InstanceTemplateInstanceByImage struct { 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -87863,8 +88813,7 @@ type InstanceTemplateInstanceByImage struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -87906,46 +88855,30 @@ type InstanceTemplateInstanceByImage struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } -func (*InstanceTemplateInstanceByImage) isaInstanceTemplateInstanceByImage() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { return true } -type InstanceTemplateInstanceByImageIntf interface { - InstanceTemplateIntf - isaInstanceTemplateInstanceByImage() bool +type InstanceTemplatePrototypeInstanceTemplateByImageIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateByImage() bool } -func (*InstanceTemplateInstanceByImage) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceByImage unmarshals an instance of InstanceTemplateInstanceByImage from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImage) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImage from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImage) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -87966,7 +88899,7 @@ func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, resu if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -88018,21 +88951,15 @@ func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, resu return } -// InstanceTemplateInstanceBySourceSnapshot : Create an instance by using a snapshot. +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Create an instance template that creates instances by using a snapshot. // Models which "extend" this model: -// - InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment -// - InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceBySourceSnapshot struct { +// - 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 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. @@ -88040,12 +88967,6 @@ type InstanceTemplateInstanceBySourceSnapshot struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -88062,8 +88983,9 @@ type InstanceTemplateInstanceBySourceSnapshot struct { 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -88073,8 +88995,7 @@ type InstanceTemplateInstanceBySourceSnapshot struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -88113,46 +89034,30 @@ type InstanceTemplateInstanceBySourceSnapshot struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } -func (*InstanceTemplateInstanceBySourceSnapshot) isaInstanceTemplateInstanceBySourceSnapshot() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { return true } -type InstanceTemplateInstanceBySourceSnapshotIntf interface { - InstanceTemplateIntf - isaInstanceTemplateInstanceBySourceSnapshot() bool +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool } -func (*InstanceTemplateInstanceBySourceSnapshot) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceBySourceSnapshot unmarshals an instance of InstanceTemplateInstanceBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshot) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -88173,7 +89078,7 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMess if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -88221,12 +89126,9 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMess return } -// InstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Create an instance template that creates instances by using a catalog offering. -// Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment -// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface +// InstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Create an instance template from an existing instance template. // This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { +type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -88288,48 +89190,55 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // 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. - // + // 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 in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + // The 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 zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` + // 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 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 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"` -} -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { - return true + // 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"` } -type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingIntf interface { - InstanceTemplatePrototypeIntf - isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool +// NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceTemplate, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceTemplate{ + SourceTemplate: sourceTemplate, + } + err = core.ValidateStruct(_model, "required parameters") + return } -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) 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) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -88386,7 +89295,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { return } @@ -88394,11 +89303,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } @@ -88406,19 +89315,33 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s if err != nil { return } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext : Create an instance by using a catalog offering. // Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment -// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateByImage struct { +// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -88426,6 +89349,12 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -88442,9 +89371,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -88454,7 +89382,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -88477,8 +89406,15 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // 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 [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -88496,30 +89432,46 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } -func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { return true } -type InstanceTemplatePrototypeInstanceTemplateByImageIntf interface { - InstanceTemplatePrototypeIntf - isaInstanceTemplatePrototypeInstanceTemplateByImage() bool +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool } -func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -88540,7 +89492,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -88564,7 +89516,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json if err != nil { return } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { return } @@ -88592,15 +89544,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json return } -// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Create an instance template that creates instances by using a snapshot. +// InstanceTemplateInstanceByImageInstanceTemplateContext : Create an instance by using an image. // Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment -// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { +// - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -88608,6 +89566,12 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -88624,9 +89588,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -88636,7 +89599,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -88657,7 +89621,10 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The 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"` @@ -88675,30 +89642,46 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { +func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { return true } -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotIntf interface { - InstanceTemplatePrototypeIntf - isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool +type InstanceTemplateInstanceByImageInstanceTemplateContextIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool } -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) +// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -88719,7 +89702,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -88739,7 +89722,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { return } @@ -88767,12 +89754,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st return } -// InstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Create an instance template from an existing instance template. -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { +// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext : Create an instance by using a snapshot. +// Models which "extend" this model: +// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -88780,6 +89776,12 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -88796,9 +89798,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -88808,7 +89809,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -88829,65 +89831,64 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { 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"` + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - // 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" 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 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 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"` +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { + return true } -// NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceTemplate (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceTemplate, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceTemplate{ - SourceTemplate: sourceTemplate, - } - err = core.ValidateStruct(_model, "required parameters") - return +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool } -func (*InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceTemplate from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -88908,7 +89909,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -88928,15 +89929,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { return } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } @@ -88944,23 +89941,15 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -98207,13 +99196,13 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtua return } -// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. // Models which "extend" this model: -// - VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContext -type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity struct { +// - VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext +type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity struct { // The unique identifier for this virtual network interface. ID *string `json:"id,omitempty"` @@ -98224,22 +99213,22 @@ type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIde CRN *string `json:"crn,omitempty"` } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { +func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { return true } -type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityIntf interface { - VirtualNetworkInterfacePrototypeAttachmentContextIntf - isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool +type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityIntf interface { + VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf + isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { +func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool { return true } -// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity) +// UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity unmarshals an instance of VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -98256,9 +99245,9 @@ func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInt return } -// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext : The virtual network interface for this target. -// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContext -type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext struct { +// VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext : The virtual network interface for this target. +// This model "extends" VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext +type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext 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"` @@ -98320,13 +99309,173 @@ type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePro Subnet SubnetIdentityIntf `json:"subnet,omitempty"` } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { +func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool { return true } -// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfacePrototypeTargetContext) +// UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext unmarshals an instance of VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext +type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity 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 (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { + return true +} + +type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityIntf interface { + VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf + isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool +} + +func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity unmarshals an instance of VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext : The virtual network interface for this target. +// This model "extends" VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext +type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext 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`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 + // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // same subnet as the primary IP. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. + // + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP and + // `primary_ip.address` is not specified. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +} + +func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext unmarshals an instance of VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext) err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { return @@ -98374,12 +99523,14 @@ type VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtu // some supplementary information. Deleted *BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted `json:"deleted,omitempty"` - // The URL for this network attachment. + // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this network attachment. + // 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. @@ -98430,12 +99581,13 @@ type VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetwo // some supplementary information. Deleted *InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted `json:"deleted,omitempty"` - // The URL for this network attachment. + // The URL for this instance network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this network attachment. + // 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. @@ -99244,6 +100396,76 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentit return } +// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity +type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { + // The URL for this bare metal server network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity +type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { + // The unique identifier for this bare metal server network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct // This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { @@ -99419,6 +100641,76 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetwork return } +// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity +type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { + // The URL for this bare metal server network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity +type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { + // The unique identifier for this bare metal server network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct // This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { @@ -102558,18 +103850,12 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork return } -// InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplateInstanceByCatalogOffering -type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct { +// 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 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. @@ -102577,12 +103863,6 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceT // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -102599,8 +103879,9 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceT 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -102610,8 +103891,7 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceT // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -102646,41 +103926,36 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceT PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } -func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByCatalogOffering() bool { +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { return true } -func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -102701,7 +103976,7 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOffering if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -102745,18 +104020,12 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOffering return } -// InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct -// This model "extends" InstanceTemplateInstanceByCatalogOffering -type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct { +// 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 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. @@ -102764,12 +104033,6 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceT // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -102786,8 +104049,9 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceT 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -102797,8 +104061,7 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceT // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -102833,41 +104096,36 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceT PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByCatalogOffering() bool { +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { return true } -func (*InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -102888,7 +104146,7 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOffering if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -102932,18 +104190,12 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceByCatalogOffering return } -// InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplateInstanceByImage -type InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct { +// 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 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. @@ -102951,12 +104203,6 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstan // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -102973,8 +104219,9 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstan 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -102984,8 +104231,7 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstan // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -103021,41 +104267,36 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstan PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } -func (*InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByImage() bool { +// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment{ + Image: image, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { return true } -func (*InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -103076,7 +104317,7 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceTemplateCont if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -103120,18 +104361,12 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceTemplateCont return } -// InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct -// This model "extends" InstanceTemplateInstanceByImage -type InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct { +// 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 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. @@ -103139,12 +104374,6 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstan // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -103161,8 +104390,9 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstan 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -103172,8 +104402,7 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstan // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -103209,41 +104438,36 @@ type InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstan PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -func (*InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByImage() bool { +// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface{ + Image: image, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { return true } -func (*InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImageInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -103264,7 +104488,7 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceTemplateCont if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -103308,18 +104532,12 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceByImageInstanceTemplateCont return } -// InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplateInstanceBySourceSnapshot -type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct { +// 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 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. @@ -103327,12 +104545,6 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTem // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -103349,8 +104561,9 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTem 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -103360,8 +104573,7 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTem // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -103394,41 +104606,36 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTem PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } -func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceBySourceSnapshot() bool { +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { return true } -func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -103449,7 +104656,7 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotIn if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -103489,18 +104696,12 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotIn return } -// InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct -// This model "extends" InstanceTemplateInstanceBySourceSnapshot -type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct { +// 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 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. @@ -103508,12 +104709,6 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTem // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -103530,8 +104725,9 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTem 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 name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -103541,8 +104737,7 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTem // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + 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 @@ -103575,41 +104770,36 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTem PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceBySourceSnapshot() bool { +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { return true } -func (*InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -103630,7 +104820,7 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotIn if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -103670,12 +104860,18 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceBySourceSnapshotIn return } -// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering -type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct { +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -103683,6 +104879,12 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -103699,9 +104901,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -103711,7 +104912,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -103746,36 +104948,41 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment{ - CatalogOffering: catalogOffering, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { return true } -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -103796,7 +105003,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -103840,12 +105047,18 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance return } -// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering -type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct { +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -103853,6 +105066,12 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -103869,9 +105088,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -103881,7 +105099,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -103916,36 +105135,41 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface{ - CatalogOffering: catalogOffering, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { return true } -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -103966,7 +105190,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -104010,12 +105234,18 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance return } -// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage -type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct { +// InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceByImageInstanceTemplateContext +type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -104023,6 +105253,12 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -104039,9 +105275,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -104051,7 +105286,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -104087,36 +105323,41 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment{ - Image: image, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { return true } -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -104137,7 +105378,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -104181,12 +105422,18 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy return } -// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage -type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct { +// InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceByImageInstanceTemplateContext +type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -104194,6 +105441,12 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -104210,9 +105463,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -104222,7 +105474,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -104258,36 +105511,41 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface{ - Image: image, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { return true } -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -104308,7 +105566,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -104352,12 +105610,18 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy return } -// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct { +// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -104365,6 +105629,12 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -104381,9 +105651,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -104393,7 +105662,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -104426,36 +105696,41 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { return true } -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -104476,7 +105751,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -104516,12 +105791,18 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT return } -// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct { +// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -104529,6 +105810,12 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -104545,9 +105832,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -104557,7 +105843,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -104590,36 +105877,41 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { return true } -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() 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) +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -104640,7 +105932,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -106104,33 +107396,138 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtual return } -// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { +// VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { // The CRN for this virtual network interface. CRN *string `json:"crn" validate:"required"` } -// NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ +// NewVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { +func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { return true } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { +func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool { return true } -// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) +// UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return @@ -106139,33 +107536,33 @@ func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInt return } -// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { +// VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { // The URL for this virtual network interface. Href *string `json:"href" validate:"required"` } -// NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ +// NewVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { +func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { return true } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { +func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool { return true } -// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) +// UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -106174,33 +107571,33 @@ func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInt return } -// VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { +// VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity +type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { // The unique identifier for this virtual network interface. ID *string `json:"id" validate:"required"` } -// NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ +// NewVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentity() bool { +func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { return true } -func (*VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeAttachmentContext() bool { +func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool { return true } -// UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) +// UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return From f4e68c59ed834a2e24d1ad2307a7b19805710ebf Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 11 Sep 2023 10:46:49 +0530 Subject: [PATCH 007/132] Update resource_ibm_is_virtual_network_interface.go --- ...source_ibm_is_virtual_network_interface.go | 135 ++++++++++-------- 1 file changed, 75 insertions(+), 60 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go index fe010c9d8c..90c7283a37 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go @@ -28,60 +28,68 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { "allow_ip_spoofing": &schema.Schema{ Type: schema.TypeBool, Optional: true, - Default: false, + Computed: true, Description: "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.", }, "auto_delete": &schema.Schema{ Type: schema.TypeBool, Optional: true, - Default: false, + Computed: true, Description: "Indicates whether this virtual network interface will be automatically deleted when`target` is deleted.", }, "enable_infrastructure_nat": &schema.Schema{ Type: schema.TypeBool, Optional: true, - Default: true, + Computed: true, Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", }, "ips": &schema.Schema{ Type: schema.TypeList, Optional: true, + Computed: true, Description: "The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "address": &schema.Schema{ Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", }, "deleted": &schema.Schema{ Type: schema.TypeList, - MaxItems: 1, Computed: true, Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "more_info": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "Link to documentation about deleted resources.", }, }, }, }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "Indicates whether this reserved IP member will be automatically deleted when either target is deleted, or the reserved IP is unbound.", + }, "href": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The URL for this reserved IP.", }, - "id": &schema.Schema{ + "reserved_ip": &schema.Schema{ Type: schema.TypeString, - Required: true, + Optional: true, Description: "The unique identifier for this reserved IP.", }, "name": &schema.Schema{ Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", }, "resource_type": &schema.Schema{ @@ -95,6 +103,7 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { "name": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, ValidateFunc: validate.InvokeValidator("ibm_is_virtual_network_interface", "name"), Description: "The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC.", }, @@ -102,24 +111,25 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { Type: schema.TypeList, MaxItems: 1, Optional: true, + Computed: true, Description: "The reserved IP for this virtual network interface.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "address": &schema.Schema{ Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", }, "deleted": &schema.Schema{ Type: schema.TypeList, - MaxItems: 1, Computed: true, Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "more_info": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "Link to documentation about deleted resources.", }, }, @@ -127,17 +137,19 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { }, "href": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The URL for this reserved IP.", }, - "id": &schema.Schema{ + "reserved_ip": &schema.Schema{ Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, Description: "The unique identifier for this reserved IP.", }, "name": &schema.Schema{ Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", }, "resource_type": &schema.Schema{ @@ -152,6 +164,7 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { Type: schema.TypeList, MaxItems: 1, Optional: true, + Computed: true, Description: "The resource group for this virtual network interface.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -176,24 +189,25 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { "security_groups": &schema.Schema{ Type: schema.TypeList, Optional: true, + Computed: true, Description: "The security groups for this virtual network interface.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "crn": &schema.Schema{ Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, Description: "The security group's CRN.", }, "deleted": &schema.Schema{ Type: schema.TypeList, - MaxItems: 1, - Optional: true, + Computed: true, Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "more_info": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "Link to documentation about deleted resources.", }, }, @@ -201,17 +215,19 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { }, "href": &schema.Schema{ Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, Description: "The security group's canonical URL.", }, - "id": &schema.Schema{ + "security_group": &schema.Schema{ Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, Description: "The unique identifier for this security group.", }, "name": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The name for this security group. The name is unique across all security groups for the VPC.", }, }, @@ -226,19 +242,18 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { Schema: map[string]*schema.Schema{ "crn": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The CRN for this subnet.", }, "deleted": &schema.Schema{ Type: schema.TypeList, - MaxItems: 1, Computed: true, Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "more_info": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "Link to documentation about deleted resources.", }, }, @@ -246,10 +261,10 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { }, "href": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The URL for this subnet.", }, - "id": &schema.Schema{ + "subnet": &schema.Schema{ Type: schema.TypeString, Required: true, Description: "The unique identifier for this subnet.", @@ -305,14 +320,13 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { Schema: map[string]*schema.Schema{ "deleted": &schema.Schema{ Type: schema.TypeList, - MaxItems: 1, - Optional: true, + Computed: true, Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "more_info": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "Link to documentation about deleted resources.", }, }, @@ -320,22 +334,22 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { }, "href": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, Description: "The URL for this share mount target.", }, "id": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, Description: "The unique identifier for this share mount target.", }, "name": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, Description: "The name for this share mount target. The name is unique across all mount targets for the file share.", }, "resource_type": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, Description: "The resource type.", }, }, @@ -349,19 +363,18 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { Schema: map[string]*schema.Schema{ "crn": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The CRN for this VPC.", }, "deleted": &schema.Schema{ Type: schema.TypeList, - MaxItems: 1, Computed: true, Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "more_info": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "Link to documentation about deleted resources.", }, }, @@ -369,12 +382,12 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { }, "href": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The URL for this VPC.", }, "id": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The unique identifier for this VPC.", }, "name": &schema.Schema{ @@ -398,12 +411,12 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { Schema: map[string]*schema.Schema{ "href": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The URL for this zone.", }, "name": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The globally unique name for this zone.", }, }, @@ -439,13 +452,13 @@ func resourceIBMIsVirtualNetworkInterfaceCreate(context context.Context, d *sche createVirtualNetworkInterfaceOptions := &vpcv1.CreateVirtualNetworkInterfaceOptions{} - if _, ok := d.GetOk("allow_ip_spoofing"); ok { + if _, ok := d.GetOkExists("allow_ip_spoofing"); ok { createVirtualNetworkInterfaceOptions.SetAllowIPSpoofing(d.Get("allow_ip_spoofing").(bool)) } - if _, ok := d.GetOk("auto_delete"); ok { + if _, ok := d.GetOkExists("auto_delete"); ok { createVirtualNetworkInterfaceOptions.SetAutoDelete(d.Get("auto_delete").(bool)) } - if _, ok := d.GetOk("enable_infrastructure_nat"); ok { + if _, ok := d.GetOkExists("enable_infrastructure_nat"); ok { createVirtualNetworkInterfaceOptions.SetEnableInfrastructureNat(d.Get("enable_infrastructure_nat").(bool)) } if _, ok := d.GetOk("ips"); ok { @@ -629,6 +642,8 @@ func resourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema if err = d.Set("target", []map[string]interface{}{targetMap}); err != nil { return diag.FromErr(fmt.Errorf("Error setting target: %s", err)) } + } else { + d.Set("target", nil) } vpcMap, err := resourceIBMIsVirtualNetworkInterfaceVPCReferenceToMap(virtualNetworkInterface.VPC) if err != nil { @@ -717,8 +732,8 @@ func resourceIBMIsVirtualNetworkInterfaceDelete(context context.Context, d *sche func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfaceIPPrototypeIntf, error) { model := &vpcv1.VirtualNetworkInterfaceIPPrototype{} - if modelMap["id"] != nil && modelMap["id"].(string) != "" { - model.ID = core.StringPtr(modelMap["id"].(string)) + if modelMap["reserved_ip"] != nil && modelMap["reserved_ip"].(string) != "" { + model.ID = core.StringPtr(modelMap["reserved_ip"].(string)) } if modelMap["href"] != nil && modelMap["href"].(string) != "" { model.Href = core.StringPtr(modelMap["href"].(string)) @@ -737,8 +752,8 @@ func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReserved func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeIntf, error) { model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototype{} - if modelMap["id"] != nil && modelMap["id"].(string) != "" { - model.ID = core.StringPtr(modelMap["id"].(string)) + if modelMap["reserved_ip"] != nil && modelMap["reserved_ip"].(string) != "" { + model.ID = core.StringPtr(modelMap["reserved_ip"].(string)) } if modelMap["href"] != nil && modelMap["href"].(string) != "" { model.Href = core.StringPtr(modelMap["href"].(string)) @@ -765,8 +780,8 @@ func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrototypeRe func resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentity(modelMap map[string]interface{}) (vpcv1.SecurityGroupIdentityIntf, error) { model := &vpcv1.SecurityGroupIdentity{} - if modelMap["id"] != nil && modelMap["id"].(string) != "" { - model.ID = core.StringPtr(modelMap["id"].(string)) + if modelMap["security_group"] != nil && modelMap["security_group"].(string) != "" { + model.ID = core.StringPtr(modelMap["security_group"].(string)) } if modelMap["crn"] != nil && modelMap["crn"].(string) != "" { model.CRN = core.StringPtr(modelMap["crn"].(string)) @@ -779,7 +794,7 @@ func resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentity(modelMap map func resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentityByID(modelMap map[string]interface{}) (*vpcv1.SecurityGroupIdentityByID, error) { model := &vpcv1.SecurityGroupIdentityByID{} - model.ID = core.StringPtr(modelMap["id"].(string)) + model.ID = core.StringPtr(modelMap["security_group"].(string)) return model, nil } @@ -797,8 +812,8 @@ func resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentityByHref(modelM func resourceIBMIsVirtualNetworkInterfaceMapToSubnetIdentity(modelMap map[string]interface{}) (vpcv1.SubnetIdentityIntf, error) { model := &vpcv1.SubnetIdentity{} - if modelMap["id"] != nil && modelMap["id"].(string) != "" { - model.ID = core.StringPtr(modelMap["id"].(string)) + if modelMap["subnet"] != nil && modelMap["subnet"].(string) != "" { + model.ID = core.StringPtr(modelMap["subnet"].(string)) } if modelMap["crn"] != nil && modelMap["crn"].(string) != "" { model.CRN = core.StringPtr(modelMap["crn"].(string)) @@ -811,7 +826,7 @@ func resourceIBMIsVirtualNetworkInterfaceMapToSubnetIdentity(modelMap map[string func resourceIBMIsVirtualNetworkInterfaceMapToSubnetIdentityByID(modelMap map[string]interface{}) (*vpcv1.SubnetIdentityByID, error) { model := &vpcv1.SubnetIdentityByID{} - model.ID = core.StringPtr(modelMap["id"].(string)) + model.ID = core.StringPtr(modelMap["subnet"].(string)) return model, nil } @@ -838,7 +853,7 @@ func resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcv1.R modelMap["deleted"] = []map[string]interface{}{deletedMap} } modelMap["href"] = model.Href - modelMap["id"] = model.ID + modelMap["reserved_ip"] = model.ID modelMap["name"] = model.Name modelMap["resource_type"] = model.ResourceType return modelMap, nil @@ -869,7 +884,7 @@ func resourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceToMap(model *vpcv modelMap["deleted"] = []map[string]interface{}{deletedMap} } modelMap["href"] = model.Href - modelMap["id"] = model.ID + modelMap["security_group"] = model.ID modelMap["name"] = model.Name return modelMap, nil } @@ -891,7 +906,7 @@ func resourceIBMIsVirtualNetworkInterfaceSubnetReferenceToMap(model *vpcv1.Subne modelMap["deleted"] = []map[string]interface{}{deletedMap} } modelMap["href"] = model.Href - modelMap["id"] = model.ID + modelMap["subnet"] = model.ID modelMap["name"] = model.Name modelMap["resource_type"] = model.ResourceType return modelMap, nil From deadb563c6c0631ae60a2129d4fc3300cb08e4c7 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 27 Sep 2023 10:33:50 +0530 Subject: [PATCH 008/132] updated sdk --- .../IBM/vpc-go-sdk/common/headers.go | 14 + .../IBM/vpc-go-sdk/common/headers_test.go | 7 +- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 4872 ++++++++++++----- .../data_source_ibm_is_bare_metal_servers.go | 24 +- .../data_source_ibm_is_share_mount_target.go | 26 +- .../vpc/resource_ibm_is_share_mount_target.go | 6 +- ...source_ibm_is_virtual_network_interface.go | 48 +- 7 files changed, 3521 insertions(+), 1476 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers.go b/common/github.com/IBM/vpc-go-sdk/common/headers.go index 00d92fdb3c..87cc2bfcd9 100644 --- a/common/github.com/IBM/vpc-go-sdk/common/headers.go +++ b/common/github.com/IBM/vpc-go-sdk/common/headers.go @@ -3,12 +3,18 @@ package common import ( "fmt" "runtime" + + "github.com/google/uuid" ) const ( HEADER_NAME_USER_AGENT = "User-Agent" SDK_NAME = "vpc-go-sdk" + + X_CORRELATION_ID = "X-Correlation-Id" + + X_REQUEST_ID = "X-Request-Id" ) // GetSdkHeaders - returns the set of SDK-specific headers to be included in an outgoing request. @@ -36,6 +42,8 @@ func GetSdkHeaders(serviceName string, serviceVersion string, operationId string sdkHeaders := make(map[string]string) sdkHeaders[HEADER_NAME_USER_AGENT] = GetUserAgentInfo() + sdkHeaders[X_CORRELATION_ID] = GetNewXCorrelationID() + sdkHeaders[X_REQUEST_ID] = GetNewXRequestID() return sdkHeaders } @@ -45,6 +53,12 @@ var UserAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo( func GetUserAgentInfo() string { return UserAgent } +func GetNewXCorrelationID() string { + return uuid.New().String() +} +func GetNewXRequestID() string { + return uuid.New().String() +} var systemInfo = fmt.Sprintf("(arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version()) diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go index deca50645d..c8e610ed55 100644 --- a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go +++ b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go @@ -1,9 +1,10 @@ package common import ( - "github.com/stretchr/testify/assert" "strings" "testing" + + "github.com/stretchr/testify/assert" ) func TestGetSystemInfo(t *testing.T) { @@ -22,4 +23,8 @@ func TestGetSdkHeaders(t *testing.T) { _, foundIt = headers[HEADER_NAME_USER_AGENT] assert.True(t, foundIt) + _, foundIt = headers[X_CORRELATION_ID] + assert.True(t, foundIt) + _, foundIt = headers[X_REQUEST_ID] + assert.True(t, foundIt) } diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 23e5a1110b..7919f366c8 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 @@ -39,6 +39,7 @@ import ( // server instances, along with subnets, volumes, load balancers, and more. // // API Version: 2022-09-13 + const ( YYYYMMDD = "2006-01-02" ) @@ -51,7 +52,7 @@ type VpcV1 struct { generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-09-07`. + // and `2023-09-25`. Version *string } @@ -68,7 +69,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-09-07`. + // and `2023-09-25`. Version *string } @@ -124,6 +125,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { return } } + now := time.Now().UTC() if options.Version == nil { options.Version = core.StringPtr(now.Format(YYYYMMDD)) @@ -305,6 +307,9 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr if createVPCOptions.ClassicAccess != nil { body["classic_access"] = createVPCOptions.ClassicAccess } + if createVPCOptions.Dns != nil { + body["dns"] = createVPCOptions.Dns + } if createVPCOptions.Name != nil { body["name"] = createVPCOptions.Name } @@ -338,10 +343,15 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr } // DeleteVPC : Delete a VPC -// This request deletes a VPC. This operation cannot be reversed. For this request to succeed, the VPC must not contain -// any instances, subnets, public gateways, or endpoint gateways. All security groups and network ACLs associated with -// the VPC are automatically deleted. All flow log collectors with `auto_delete` set to `true` targeting the VPC or any -// resource in the VPC are automatically deleted. +// This request deletes a VPC. This operation cannot be reversed. +// +// For this request to succeed: +// - Instances, subnets, public gateways, and endpoint gateways must not reside in this VPC +// - The VPC must not be providing DNS resolution for any other VPCs +// - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero +// +// All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with +// `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) } @@ -377,6 +387,9 @@ func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *De for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + if deleteVPCOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -498,6 +511,9 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVPCOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPCOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -1079,6 +1095,389 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV return } +// ListVPCDnsResolutionBindings : List all DNS resolution bindings for a VPC +// This request lists all DNS resolution bindings for a VPC. A DNS resolution binding represents an association with +// another VPC for centralizing DNS name resolution. +// +// If the VPC specified by the identifier in the URL is a DNS hub VPC (has `dns.enable_hub` set to `true`) then there is +// one binding for each VPC bound to the hub VPC. The endpoint gateways in the bound VPCs can allow (using +// `allow_dns_resolution_binding`) the hub VPC to centralize resolution of their DNS names. +// +// If the VPC specified by the identifier in the URL is not a DNS hub VPC, then there is at most one binding (to a hub +// VPC). The endpoint gateways in the VPC specified by the identifier in the URL can allow (using +// `allow_dns_resolution_binding`) its hub VPC to centralize resolution of their DNS names. +// +// To make use of centralized DNS resolution, a VPC bound to a DNS hub VPC must delegate DNS resolution to its hub VPC +// by setting `dns.resolver.type` to `delegate`. +// +// The bindings will be sorted by their `created_at` property values, with newest bindings first. Bindings with +// identical `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListVPCDnsResolutionBindings(listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) +} + +// ListVPCDnsResolutionBindingsWithContext is an alternate form of the ListVPCDnsResolutionBindings method which supports a Context parameter +func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCDnsResolutionBindingsOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCDnsResolutionBindingsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCDnsResolutionBindingsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Sort)) + } + if listVPCDnsResolutionBindingsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Start)) + } + if listVPCDnsResolutionBindingsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Limit)) + } + if listVPCDnsResolutionBindingsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Name)) + } + if listVPCDnsResolutionBindingsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCCRN)) + } + if listVPCDnsResolutionBindingsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCName)) + } + if listVPCDnsResolutionBindingsOptions.AccountID != nil { + builder.AddQuery("account.id", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.AccountID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBindingCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// 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. +// +// # TODO: finalize topic name with docs team See [Configuring endpoint gateway DNS +// sharing](/docs/vpc?topic=vpc-hub-spoke-model) for more information. +func (vpc *VpcV1) CreateVPCDnsResolutionBinding(createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + return vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) +} + +// CreateVPCDnsResolutionBindingWithContext is an alternate form of the CreateVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCDnsResolutionBindingOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCDnsResolutionBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCDnsResolutionBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCDnsResolutionBindingOptions.VPC != nil { + body["vpc"] = createVPCDnsResolutionBindingOptions.VPC + } + if createVPCDnsResolutionBindingOptions.Name != nil { + body["name"] = createVPCDnsResolutionBindingOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPCDnsResolutionBinding : Delete a DNS resolution binding +// This request deletes a DNS resolution binding. This operation cannot be reversed. +// +// A DNS resolution binding for a VPC with `dns.enable_hub` set to `true` cannot be deleted. +func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) +} + +// DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCDnsResolutionBindingOptions.VPCID, + "id": *deleteVPCDnsResolutionBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCDnsResolutionBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCDnsResolutionBinding : Retrieve a DNS resolution binding +// This request retrieves a single DNS resolution binding specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCDnsResolutionBinding(getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + return vpc.GetVPCDnsResolutionBindingWithContext(context.Background(), getVPCDnsResolutionBindingOptions) +} + +// GetVPCDnsResolutionBindingWithContext is an alternate form of the GetVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCDnsResolutionBindingOptions.VPCID, + "id": *getVPCDnsResolutionBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDnsResolutionBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDnsResolutionBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCDnsResolutionBinding : Update a DNS resolution binding +// This request updates a DNS resolution binding with the information in a provided DNS resolution binding patch. The +// DNS resolution binding patch object is structured in the same way as a retrieved DNS resolution binding and contains +// only the information to be updated. +func (vpc *VpcV1) UpdateVPCDnsResolutionBinding(updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) +} + +// UpdateVPCDnsResolutionBindingWithContext is an alternate form of the UpdateVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCDnsResolutionBindingOptions.VPCID, + "id": *updateVPCDnsResolutionBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCDnsResolutionBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCDnsResolutionBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + response.Result = result + } + + return +} + // ListVPCRoutes : List all routes in a VPC's default routing table // This request lists all routes in the VPC's default routing table. Each route is zone-specific and directs any packets // matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's @@ -1218,9 +1617,6 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO if createVPCRouteOptions.Action != nil { body["action"] = createVPCRouteOptions.Action } - if createVPCRouteOptions.Advertise != nil { - body["advertise"] = createVPCRouteOptions.Advertise - } if createVPCRouteOptions.Name != nil { body["name"] = createVPCRouteOptions.Name } @@ -1585,9 +1981,6 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom } - if createVPCRoutingTableOptions.AdvertiseRoutesTo != nil { - body["advertise_routes_to"] = createVPCRoutingTableOptions.AdvertiseRoutesTo - } if createVPCRoutingTableOptions.Name != nil { body["name"] = createVPCRoutingTableOptions.Name } @@ -1965,9 +2358,6 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre if createVPCRoutingTableRouteOptions.Action != nil { body["action"] = createVPCRoutingTableRouteOptions.Action } - if createVPCRoutingTableRouteOptions.Advertise != nil { - body["advertise"] = createVPCRoutingTableRouteOptions.Advertise - } if createVPCRoutingTableRouteOptions.Name != nil { body["name"] = createVPCRoutingTableRouteOptions.Name } @@ -2246,6 +2636,18 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions if listSubnetsOptions.ResourceGroupID != nil { builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) } + if listSubnetsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listSubnetsOptions.ZoneName)) + } + if listSubnetsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listSubnetsOptions.VPCID)) + } + if listSubnetsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listSubnetsOptions.VPCCRN)) + } + if listSubnetsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listSubnetsOptions.VPCName)) + } if listSubnetsOptions.RoutingTableID != nil { builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) } @@ -5154,15 +5556,6 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt if listInstancesOptions.VPCName != nil { builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) } - if listInstancesOptions.NetworkAttachmentsSubnetID != nil { - builder.AddQuery("network_attachments[].subnet.id", fmt.Sprint(*listInstancesOptions.NetworkAttachmentsSubnetID)) - } - if listInstancesOptions.NetworkAttachmentsSubnetCRN != nil { - builder.AddQuery("network_attachments[].subnet.crn", fmt.Sprint(*listInstancesOptions.NetworkAttachmentsSubnetCRN)) - } - if listInstancesOptions.NetworkAttachmentsSubnetName != nil { - builder.AddQuery("network_attachments[].subnet.name", fmt.Sprint(*listInstancesOptions.NetworkAttachmentsSubnetName)) - } if listInstancesOptions.DedicatedHostID != nil { builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) } @@ -5898,8 +6291,8 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta } // ListInstanceNetworkAttachments : List all network attachments on an instance -// This request lists all network attachments on an instance. This request lists all network attachments on an instance. -// A network attachment represents a device on the instance to which a virtual network interface is attached. +// This request lists all network attachments on an instance. A network attachment represents a device on the instance +// to which a virtual network interface is attached. // // The network attachments will be sorted by their `created_at` property values, with newest network attachments first. // Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property @@ -6857,14 +7250,17 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } -// ListInstanceNetworkInterfaceIps : List all reserved IPs bound to an instance network interface -// This request lists all reserved IPs bound to an instance network interface. +// ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface +// This request lists the primary reserved IP for an instance network interface. +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) } // ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceIps") err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") if err != nil { return @@ -6929,15 +7325,17 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context return } -// GetInstanceNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the network interface and instance -// specified in the URL. +// GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for an instance network interface. +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) } // GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceIP") err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") if err != nil { return @@ -11514,24 +11912,6 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM if listBareMetalServersOptions.VPCName != nil { builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) } - if listBareMetalServersOptions.NetworkInterfacesSubnetID != nil { - builder.AddQuery("network_interfaces.subnet.id", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetID)) - } - if listBareMetalServersOptions.NetworkAttachmentsSubnetID != nil { - builder.AddQuery("network_attachments[].subnet.id", fmt.Sprint(*listBareMetalServersOptions.NetworkAttachmentsSubnetID)) - } - if listBareMetalServersOptions.NetworkInterfacesSubnetCRN != nil { - builder.AddQuery("network_interfaces.subnet.crn", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetCRN)) - } - if listBareMetalServersOptions.NetworkAttachmentsSubnetCRN != nil { - builder.AddQuery("network_attachments[].subnet.crn", fmt.Sprint(*listBareMetalServersOptions.NetworkAttachmentsSubnetCRN)) - } - if listBareMetalServersOptions.NetworkInterfacesSubnetName != nil { - builder.AddQuery("network_interfaces.subnet.name", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetName)) - } - if listBareMetalServersOptions.NetworkAttachmentsSubnetName != nil { - builder.AddQuery("network_attachments[].subnet.name", fmt.Sprint(*listBareMetalServersOptions.NetworkAttachmentsSubnetName)) - } request, err := builder.Build() if err != nil { @@ -12861,14 +13241,17 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } -// ListBareMetalServerNetworkInterfaceIps : List all reserved IPs bound to a bare metal server network interface -// This request lists all reserved IPs bound to a bare metal server network interface. +// ListBareMetalServerNetworkInterfaceIps : List the primary reserved IP for a bare metal server network interface +// This request lists the primary reserved IP for a bare metal server network interface. +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) } // ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaceIps") err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") if err != nil { return @@ -12927,15 +13310,17 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. return } -// GetBareMetalServerNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the network interface for the bare metal -// server specified in the URL. +// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for a bare metal server network interface. +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) } // GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") if err != nil { return @@ -15569,12 +15954,12 @@ func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareS // GetShareSource : Retrieve the source file share for a replica file share // This request retrieves the source file share associated with the replica file share specified by the identifier in // the URL. -func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { return vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) } // GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter -func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") if err != nil { return @@ -15622,7 +16007,7 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { return } @@ -16447,13 +16832,15 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, } // AddNetworkInterfaceFloatingIP : Associate a floating IP with a virtual network interface -// This request associates the specified floating IP with the specified virtual network interface. The specified -// floating IP must not be required by another resource, such as a public gateway. A request body is not required, and -// if provided, is ignored. +// This request associates the specified floating IP with the specified virtual network interface. A request body is not +// required, and if provided, is ignored. // -// If `enable_infrastructure_nat` is `true`, this replaces any existing association. +// If `enable_infrastructure_nat` is `true`, this replaces any existing floating IP association. // -// If `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. +// If `enable_infrastructure_nat` is `false`, this adds the floating IP to any existing associations. +// +// The floating IP must not currently be associated with another resource. The virtual network interface's `target` must +// not currently be a file share mount target. func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { return vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) } @@ -16717,8 +17104,10 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, g } // 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 same subnet as the `primary_ip`. +// This request binds the specified reserved IP to the specified virtual network interface. +// +// The reserved IP must currently be unbound and in the same subnet as the `primary_ip`. The virtual network interface's +// `target` must not currently be a file share mount target. func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { return vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) } @@ -24540,6 +24929,18 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo if listEndpointGatewaysOptions.ResourceGroupID != nil { builder.AddQuery("resource_group.id", fmt.Sprint(*listEndpointGatewaysOptions.ResourceGroupID)) } + if listEndpointGatewaysOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listEndpointGatewaysOptions.VPCID)) + } + if listEndpointGatewaysOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listEndpointGatewaysOptions.VPCCRN)) + } + if listEndpointGatewaysOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listEndpointGatewaysOptions.VPCName)) + } + if listEndpointGatewaysOptions.AllowDnsResolutionBinding != nil { + builder.AddQuery("allow_dns_resolution_binding", fmt.Sprint(*listEndpointGatewaysOptions.AllowDnsResolutionBinding)) + } request, err := builder.Build() if err != nil { @@ -24611,6 +25012,9 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn if createEndpointGatewayOptions.VPC != nil { body["vpc"] = createEndpointGatewayOptions.VPC } + if createEndpointGatewayOptions.AllowDnsResolutionBinding != nil { + body["allow_dns_resolution_binding"] = createEndpointGatewayOptions.AllowDnsResolutionBinding + } if createEndpointGatewayOptions.Ips != nil { body["ips"] = createEndpointGatewayOptions.Ips } @@ -28368,7 +28772,10 @@ type BareMetalServerNetworkAttachmentPrototype struct { // 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. - VirtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + // + // If an existing virtual network interface is specified, it must not be the target of a flow + // log collector. + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) attachment. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` @@ -28414,26 +28821,172 @@ type BareMetalServerNetworkAttachmentPrototypeIntf interface { // UnmarshalBareMetalServerNetworkAttachmentPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototype from the specified map of raw messages. func UnmarshalBareMetalServerNetworkAttachmentPrototype(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) + obj := new(BareMetalServerNetworkAttachmentPrototype) + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) return } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { return } - if discValue == "hipersocket" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype) - } else if discValue == "pci" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) - } else if discValue == "vlan" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface : A virtual network interface for the bare metal server network attachment. This can be specified using an existing +// virtual network interface, or a prototype object for a new virtual network interface. +// +// If an existing virtual network interface is specified, it must not be the target of a flow log collector. +// Models which "extend" this model: +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface struct { + // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on + // this interface. If `true`, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the virtual network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 + // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // same subnet as the primary IP. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. + // + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use for this virtual network interface. If unspecified, the + // bare metal server's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { + isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -28524,24 +29077,6 @@ func UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted(m map[string]json return } -// BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted unmarshals an instance of BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct // Models which "extend" this model: // - BareMetalServerNetworkInterfaceByHiperSocket @@ -29067,10 +29602,10 @@ func (bareMetalServerPatch *BareMetalServerPatch) AsPatch() (_patch map[string]i } // BareMetalServerPrimaryNetworkAttachmentPrototype : BareMetalServerPrimaryNetworkAttachmentPrototype struct +// Models which "extend" this model: +// - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype +// - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype type BareMetalServerPrimaryNetworkAttachmentPrototype struct { - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) attachment. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // The network attachment's interface type: // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity // within a `s390x` based system @@ -29080,12 +29615,8 @@ type BareMetalServerPrimaryNetworkAttachmentPrototype struct { // - 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 VLAN tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x` - // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its - // array of `allowed_vlans`. - // - Must use an IEEE 802.1q tag. // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type" validate:"required"` + 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. @@ -29094,7 +29625,13 @@ type BareMetalServerPrimaryNetworkAttachmentPrototype struct { // 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. - VirtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + // + // If an existing virtual network interface is specified, it must not be the target of a flow + // log collector. + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` } // Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototype.InterfaceType property. @@ -29107,43 +29644,36 @@ type BareMetalServerPrimaryNetworkAttachmentPrototype struct { // - 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 VLAN tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x` -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its -// array of `allowed_vlans`. -// - Must use an IEEE 802.1q tag. // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypeHipersocketConst = "hipersocket" BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" - BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypeVlanConst = "vlan" ) -// NewBareMetalServerPrimaryNetworkAttachmentPrototype : Instantiate BareMetalServerPrimaryNetworkAttachmentPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototype(interfaceType string, virtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf) (_model *BareMetalServerPrimaryNetworkAttachmentPrototype, err error) { - _model = &BareMetalServerPrimaryNetworkAttachmentPrototype{ - InterfaceType: core.StringPtr(interfaceType), - VirtualNetworkInterface: virtualNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return +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, "allowed_vlans", &obj.AllowedVlans) + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } @@ -30425,7 +30955,7 @@ type BareMetalServerPrototype struct { Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` @@ -30443,7 +30973,7 @@ type BareMetalServerPrototype struct { NetworkAttachments []BareMetalServerNetworkAttachmentPrototypeIntf `json:"network_attachments,omitempty"` // The primary network attachment to create for the bare metal server. - PrimaryNetworkAttachment *BareMetalServerPrimaryNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + PrimaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf `json:"primary_network_attachment,omitempty"` // The additional bare metal server network interfaces to create. NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` @@ -31015,7 +31545,7 @@ type CreateBackupPolicyOptions struct { Plans []BackupPolicyPlanPrototype `json:"plans,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Allows users to set headers on API requests @@ -31354,7 +31884,7 @@ type CreateDedicatedHostGroupOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Allows users to set headers on API requests @@ -31451,6 +31981,13 @@ type CreateEndpointGatewayOptions struct { // The VPC this endpoint gateway will reside in. VPC VPCIdentityIntf `json:"vpc" validate:"required"` + // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in + // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. + // + // Must be `true` if the VPC this endpoint gateway resides in has `dns.enable_hub` set to + // `true`. + AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` + // The reserved IPs to bind to this endpoint gateway. At most one reserved IP per zone is allowed. Ips []EndpointGatewayReservedIPIntf `json:"ips,omitempty"` @@ -31459,7 +31996,7 @@ type CreateEndpointGatewayOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The security groups to use for this endpoint gateway. If unspecified, the VPC's default security group is used. @@ -31489,6 +32026,12 @@ func (_options *CreateEndpointGatewayOptions) SetVPC(vpc VPCIdentityIntf) *Creat return _options } +// SetAllowDnsResolutionBinding : Allow user to set AllowDnsResolutionBinding +func (_options *CreateEndpointGatewayOptions) SetAllowDnsResolutionBinding(allowDnsResolutionBinding bool) *CreateEndpointGatewayOptions { + _options.AllowDnsResolutionBinding = core.BoolPtr(allowDnsResolutionBinding) + return _options +} + // SetIps : Allow user to set Ips func (_options *CreateEndpointGatewayOptions) SetIps(ips []EndpointGatewayReservedIPIntf) *CreateEndpointGatewayOptions { _options.Ips = ips @@ -31560,6 +32103,9 @@ type CreateFlowLogCollectorOptions struct { // 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. @@ -31570,7 +32116,7 @@ type CreateFlowLogCollectorOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Allows users to set headers on API requests @@ -31643,7 +32189,7 @@ type CreateIkePolicyOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Allows users to set headers on API requests @@ -32107,7 +32653,7 @@ type CreateInstanceGroupOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Allows users to set headers on API requests @@ -32184,7 +32730,10 @@ type CreateInstanceNetworkAttachmentOptions struct { // 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. - VirtualNetworkInterface VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + // + // If an existing virtual network interface is specified, `enable_infrastructure_nat` must be + // `false`. + 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. @@ -32195,7 +32744,7 @@ type CreateInstanceNetworkAttachmentOptions struct { } // NewCreateInstanceNetworkAttachmentOptions : Instantiate CreateInstanceNetworkAttachmentOptions -func (*VpcV1) NewCreateInstanceNetworkAttachmentOptions(instanceID string, virtualNetworkInterface VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf) *CreateInstanceNetworkAttachmentOptions { +func (*VpcV1) NewCreateInstanceNetworkAttachmentOptions(instanceID string, virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) *CreateInstanceNetworkAttachmentOptions { return &CreateInstanceNetworkAttachmentOptions{ InstanceID: core.StringPtr(instanceID), VirtualNetworkInterface: virtualNetworkInterface, @@ -32209,7 +32758,7 @@ func (_options *CreateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID } // SetVirtualNetworkInterface : Allow user to set VirtualNetworkInterface -func (_options *CreateInstanceNetworkAttachmentOptions) SetVirtualNetworkInterface(virtualNetworkInterface VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf) *CreateInstanceNetworkAttachmentOptions { +func (_options *CreateInstanceNetworkAttachmentOptions) SetVirtualNetworkInterface(virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) *CreateInstanceNetworkAttachmentOptions { _options.VirtualNetworkInterface = virtualNetworkInterface return _options } @@ -32446,7 +32995,7 @@ type CreateIpsecPolicyOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Allows users to set headers on API requests @@ -32564,7 +33113,7 @@ type CreateKeyOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The crypto-system used by this key. @@ -33077,7 +33626,7 @@ type CreateLoadBalancerOptions struct { Profile LoadBalancerProfileIdentityIntf `json:"profile,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Indicates whether route mode is enabled for this load balancer. @@ -33475,7 +34024,7 @@ type CreatePlacementGroupOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Allows users to set headers on API requests @@ -33541,7 +34090,7 @@ type CreatePublicGatewayOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Allows users to set headers on API requests @@ -33602,7 +34151,7 @@ type CreateSecurityGroupOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The prototype objects for rules to be created for this security group. If unspecified, no rules will be created, @@ -34012,15 +34561,14 @@ type CreateVirtualNetworkInterfaceOptions struct { PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 and - // `primary_ip.address` is not specified. + // The associated subnet. Required if `primary_ip` does not specify a reserved IP. Subnet SubnetIdentityIntf `json:"subnet,omitempty"` // Allows users to set headers on API requests @@ -34197,6 +34745,59 @@ func (options *CreateVPCAddressPrefixOptions) SetHeaders(param map[string]string return options } +// CreateVPCDnsResolutionBindingOptions : The CreateVPCDnsResolutionBinding options. +type CreateVPCDnsResolutionBindingOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // Another VPC to bind this VPC to for DNS resolution. The VPC must have + // `dns.enable_hub` set to `true`, and may be in a different account (subject to + // IAM policies). + // + // Additionally, the VPC specified in the URL (this VPC) must have `dns.enable_hub` + // set to `false` and a `dns.resolution_binding_count` of zero. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC. + // If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPCDnsResolutionBindingOptions : Instantiate CreateVPCDnsResolutionBindingOptions +func (*VpcV1) NewCreateVPCDnsResolutionBindingOptions(vpcID string, vpc VPCIdentityIntf) *CreateVPCDnsResolutionBindingOptions { + return &CreateVPCDnsResolutionBindingOptions{ + VPCID: core.StringPtr(vpcID), + VPC: vpc, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *CreateVPCDnsResolutionBindingOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPC : Allow user to set VPC +func (_options *CreateVPCDnsResolutionBindingOptions) SetVPC(vpc VPCIdentityIntf) *CreateVPCDnsResolutionBindingOptions { + _options.VPC = vpc + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCDnsResolutionBindingOptions) SetName(name string) *CreateVPCDnsResolutionBindingOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *CreateVPCDnsResolutionBindingOptions { + options.Headers = param + return options +} + // CreateVPCOptions : The CreateVPC options. type CreateVPCOptions struct { // Indicates whether a [default address prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes) @@ -34212,12 +34813,18 @@ type CreateVPCOptions struct { // connected in this way. This value is set at creation and subsequently immutable. ClassicAccess *bool `json:"classic_access,omitempty"` + // The DNS configuration for this VPC. + // + // If unspecified, the system will assign DNS servers capable of resolving hosts and endpoint + // gateways within this VPC, and hosts on the internet. + Dns *VpcdnsPrototype `json:"dns,omitempty"` + // The name for this VPC. The name must not be used by another VPC in the region. If unspecified, the name will be a // hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Allows users to set headers on API requests @@ -34253,6 +34860,12 @@ func (_options *CreateVPCOptions) SetClassicAccess(classicAccess bool) *CreateVP return _options } +// SetDns : Allow user to set Dns +func (_options *CreateVPCOptions) SetDns(dns *VpcdnsPrototype) *CreateVPCOptions { + _options.Dns = dns + return _options +} + // SetName : Allow user to set Name func (_options *CreateVPCOptions) SetName(name string) *CreateVPCOptions { _options.Name = core.StringPtr(name) @@ -34293,13 +34906,6 @@ type CreateVPCRouteOptions struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - // - // All routes in a routing table with the same `destination` 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. @@ -34309,8 +34915,7 @@ type CreateVPCRouteOptions struct { // `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 a unique `next_hop` IP - // address. + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -34370,12 +34975,6 @@ func (_options *CreateVPCRouteOptions) SetAction(action string) *CreateVPCRouteO return _options } -// SetAdvertise : Allow user to set Advertise -func (_options *CreateVPCRouteOptions) SetAdvertise(advertise bool) *CreateVPCRouteOptions { - _options.Advertise = core.BoolPtr(advertise) - return _options -} - // SetName : Allow user to set Name func (_options *CreateVPCRouteOptions) SetName(name string) *CreateVPCRouteOptions { _options.Name = core.StringPtr(name) @@ -34411,10 +35010,6 @@ type CreateVPCRoutingTableOptions struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` - // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these - // sources. - AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"` - // The name for this routing table. The name must not be used by another routing table in the VPC. If unspecified, the // name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -34424,9 +35019,9 @@ type CreateVPCRoutingTableOptions struct { // set to `true`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, - // the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. // // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing @@ -34439,9 +35034,9 @@ type CreateVPCRoutingTableOptions struct { // Incoming traffic will be routed according to the routing table with two exceptions: // - Traffic destined for IP addresses associated with public gateways will not be // subject to routes in this routing table. - // - Routes with an action of deliver are treated as drop unless the `next_hop` is an - // IP address in a subnet in the route's `zone`. Therefore, if an incoming packet - // matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // - 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"` @@ -34450,18 +35045,18 @@ type CreateVPCRoutingTableOptions struct { // this property set to `true`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, - // the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` // If set to `true`, this routing table will be used to route traffic that originates from subnets in other zones in // this VPC. The VPC must not already have a routing table with this property set to `true`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, - // the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` // The prototype objects for routes to create for this routing table. If unspecified, the routing table will be created @@ -34472,16 +35067,6 @@ type CreateVPCRoutingTableOptions struct { Headers map[string]string } -// Constants associated with the CreateVPCRoutingTableOptions.AdvertiseRoutesTo property. -// An ingress source that routes can be advertised to: -// -// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) -// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). -const ( - CreateVPCRoutingTableOptionsAdvertiseRoutesToDirectLinkConst = "direct_link" - CreateVPCRoutingTableOptionsAdvertiseRoutesToTransitGatewayConst = "transit_gateway" -) - // NewCreateVPCRoutingTableOptions : Instantiate CreateVPCRoutingTableOptions func (*VpcV1) NewCreateVPCRoutingTableOptions(vpcID string) *CreateVPCRoutingTableOptions { return &CreateVPCRoutingTableOptions{ @@ -34501,12 +35086,6 @@ func (_options *CreateVPCRoutingTableOptions) SetAcceptRoutesFrom(acceptRoutesFr return _options } -// SetAdvertiseRoutesTo : Allow user to set AdvertiseRoutesTo -func (_options *CreateVPCRoutingTableOptions) SetAdvertiseRoutesTo(advertiseRoutesTo []string) *CreateVPCRoutingTableOptions { - _options.AdvertiseRoutesTo = advertiseRoutesTo - return _options -} - // SetName : Allow user to set Name func (_options *CreateVPCRoutingTableOptions) SetName(name string) *CreateVPCRoutingTableOptions { _options.Name = core.StringPtr(name) @@ -34574,13 +35153,6 @@ type CreateVPCRoutingTableRouteOptions struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - // - // All routes in a routing table with the same `destination` 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. @@ -34590,8 +35162,7 @@ type CreateVPCRoutingTableRouteOptions struct { // `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 a unique `next_hop` IP - // address. + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -34658,12 +35229,6 @@ func (_options *CreateVPCRoutingTableRouteOptions) SetAction(action string) *Cre return _options } -// SetAdvertise : Allow user to set Advertise -func (_options *CreateVPCRoutingTableRouteOptions) SetAdvertise(advertise bool) *CreateVPCRoutingTableRouteOptions { - _options.Advertise = core.BoolPtr(advertise) - return _options -} - // SetName : Allow user to set Name func (_options *CreateVPCRoutingTableRouteOptions) SetName(name string) *CreateVPCRoutingTableRouteOptions { _options.Name = core.StringPtr(name) @@ -34800,7 +35365,7 @@ type CreateVPNServerOptions struct { Protocol *string `json:"protocol,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The security groups to use for this VPN server. If unspecified, the VPC's default security group is used. @@ -35031,6 +35596,71 @@ func UnmarshalDnsInstanceReference(m map[string]json.RawMessage, result interfac return } +// DnsServer : A DNS server. +type DnsServer struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // If present, DHCP configuration for this zone will have this DNS server listed first. + ZoneAffinity *ZoneReference `json:"zone_affinity,omitempty"` +} + +// UnmarshalDnsServer unmarshals an instance of DnsServer from the specified map of raw messages. +func UnmarshalDnsServer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsServer) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsServerPrototype : DnsServerPrototype struct +type DnsServerPrototype struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // DHCP configuration for the specified zone will have this DNS server listed first. + ZoneAffinity ZoneIdentityIntf `json:"zone_affinity,omitempty"` +} + +// NewDnsServerPrototype : Instantiate DnsServerPrototype (Generic Model Constructor) +func (*VpcV1) NewDnsServerPrototype(address string) (_model *DnsServerPrototype, err error) { + _model = &DnsServerPrototype{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalDnsServerPrototype unmarshals an instance of DnsServerPrototype from the specified map of raw messages. +func UnmarshalDnsServerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsServerPrototype) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // DnsZoneIdentity : Identifies a DNS zone by a unique property. // Models which "extend" this model: // - DnsZoneIdentityByID @@ -36693,7 +37323,7 @@ type DedicatedHostPrototype struct { Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The dedicated host group for this dedicated host. @@ -36903,14 +37533,6 @@ type DefaultRoutingTable struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` - // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these - // sources. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` - // The date and time that this routing table was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -36937,9 +37559,9 @@ type DefaultRoutingTable struct { // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, - // the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from the internet. @@ -36947,9 +37569,9 @@ type DefaultRoutingTable struct { // Incoming traffic will be routed according to the routing table with two exceptions: // - Traffic destined for IP addresses associated with public gateways will not be // subject to routes in this routing table. - // - Routes with an action of deliver are treated as drop unless the `next_hop` is an - // IP address in a subnet in the route's `zone`. Therefore, if an incoming packet - // matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // - 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"` @@ -36957,18 +37579,18 @@ type DefaultRoutingTable struct { // 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`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, - // the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this // VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, - // the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` // The routes for the default routing table for this VPC. The table is created with no routes, but routes may be added, @@ -36979,16 +37601,6 @@ type DefaultRoutingTable struct { Subnets []SubnetReference `json:"subnets" validate:"required"` } -// Constants associated with the DefaultRoutingTable.AdvertiseRoutesTo property. -// An ingress source that routes can be advertised to: -// -// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) -// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). -const ( - DefaultRoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link" - DefaultRoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway" -) - // Constants associated with the DefaultRoutingTable.LifecycleState property. // The lifecycle state of the routing table. const ( @@ -37014,10 +37626,6 @@ func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface if err != nil { return } - err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -38922,11 +39530,52 @@ func (options *DeleteVPCAddressPrefixOptions) SetHeaders(param map[string]string return options } +// DeleteVPCDnsResolutionBindingOptions : The DeleteVPCDnsResolutionBinding options. +type DeleteVPCDnsResolutionBindingOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The DNS resolution binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCDnsResolutionBindingOptions : Instantiate DeleteVPCDnsResolutionBindingOptions +func (*VpcV1) NewDeleteVPCDnsResolutionBindingOptions(vpcID string, id string) *DeleteVPCDnsResolutionBindingOptions { + return &DeleteVPCDnsResolutionBindingOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *DeleteVPCDnsResolutionBindingOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCDnsResolutionBindingOptions) SetID(id string) *DeleteVPCDnsResolutionBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *DeleteVPCDnsResolutionBindingOptions { + options.Headers = param + return options +} + // DeleteVPCOptions : The DeleteVPC options. type DeleteVPCOptions struct { // The VPC identifier. ID *string `json:"id" validate:"required,ne="` + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -38944,6 +39593,12 @@ func (_options *DeleteVPCOptions) SetID(id string) *DeleteVPCOptions { return _options } +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVPCOptions) SetIfMatch(ifMatch string) *DeleteVPCOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + // SetHeaders : Allow user to set Headers func (options *DeleteVPCOptions) SetHeaders(param map[string]string) *DeleteVPCOptions { options.Headers = param @@ -39378,6 +40033,10 @@ func UnmarshalEncryptionKeyReference(m map[string]json.RawMessage, result interf // EndpointGateway : EndpointGateway struct type EndpointGateway struct { + // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in + // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. + AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding" validate:"required"` + // The date and time that the endpoint gateway was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -39467,6 +40126,10 @@ const ( // UnmarshalEndpointGateway unmarshals an instance of EndpointGateway from the specified map of raw messages. func UnmarshalEndpointGateway(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(EndpointGateway) + err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -39625,6 +40288,13 @@ func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result // EndpointGatewayPatch : EndpointGatewayPatch struct type EndpointGatewayPatch struct { + // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in + // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. + // + // Must be `true` if the VPC this endpoint gateway resides in has `dns.enable_hub` set to + // `true`. + AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` + // The name for this endpoint gateway. The name must not be used by another endpoint gateway in the VPC. Name *string `json:"name,omitempty"` } @@ -39632,6 +40302,10 @@ type EndpointGatewayPatch struct { // UnmarshalEndpointGatewayPatch unmarshals an instance of EndpointGatewayPatch from the specified map of raw messages. func UnmarshalEndpointGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(EndpointGatewayPatch) + err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -39668,6 +40342,92 @@ func UnmarshalEndpointGatewayReferenceDeleted(m map[string]json.RawMessage, resu return } +// EndpointGatewayReferenceRemote : EndpointGatewayReferenceRemote struct +type EndpointGatewayReferenceRemote struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` + + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *EndpointGatewayRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the EndpointGatewayReferenceRemote.ResourceType property. +// The resource type. +const ( + EndpointGatewayReferenceRemoteResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +// UnmarshalEndpointGatewayReferenceRemote unmarshals an instance of EndpointGatewayReferenceRemote from the specified map of raw messages. +func UnmarshalEndpointGatewayReferenceRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReferenceRemote) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalEndpointGatewayRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type EndpointGatewayRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // account, and identifies the owning account. + Account *AccountReference `json:"account,omitempty"` + + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalEndpointGatewayRemote unmarshals an instance of EndpointGatewayRemote from the specified map of raw messages. +func UnmarshalEndpointGatewayRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayRemote) + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // EndpointGatewayReservedIP : A reserved IP to bind to the endpoint gateway. This can be specified using an existing reserved IP, or a prototype // object for a new reserved IP. The reserved IP will be bound to the endpoint gateway to function as a virtual private // endpoint for the service. @@ -40233,7 +40993,7 @@ type FloatingIPPrototype struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The zone this floating IP will reside in. @@ -40917,6 +41677,9 @@ func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interf // 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 @@ -43586,6 +44349,44 @@ func (options *GetVPCDefaultSecurityGroupOptions) SetHeaders(param map[string]st return options } +// GetVPCDnsResolutionBindingOptions : The GetVPCDnsResolutionBinding options. +type GetVPCDnsResolutionBindingOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The DNS resolution binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDnsResolutionBindingOptions : Instantiate GetVPCDnsResolutionBindingOptions +func (*VpcV1) NewGetVPCDnsResolutionBindingOptions(vpcID string, id string) *GetVPCDnsResolutionBindingOptions { + return &GetVPCDnsResolutionBindingOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *GetVPCDnsResolutionBindingOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCDnsResolutionBindingOptions) SetID(id string) *GetVPCDnsResolutionBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *GetVPCDnsResolutionBindingOptions { + options.Headers = param + return options +} + // GetVPCOptions : The GetVPC options. type GetVPCOptions struct { // The VPC identifier. @@ -45626,7 +46427,7 @@ type ImagePrototype struct { ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. @@ -49237,11 +50038,14 @@ type InstanceNetworkAttachmentPrototype struct { // 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. - VirtualNetworkInterface VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + // + // If an existing virtual network interface is specified, `enable_infrastructure_nat` must be + // `false`. + VirtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` } // NewInstanceNetworkAttachmentPrototype : Instantiate InstanceNetworkAttachmentPrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf) (_model *InstanceNetworkAttachmentPrototype, err error) { +func (*VpcV1) NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) (_model *InstanceNetworkAttachmentPrototype, err error) { _model = &InstanceNetworkAttachmentPrototype{ VirtualNetworkInterface: virtualNetworkInterface, } @@ -49256,7 +50060,148 @@ func UnmarshalInstanceNetworkAttachmentPrototype(m map[string]json.RawMessage, r if err != nil { return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterface : A virtual network interface for the instance network attachment. This can be specified using an existing virtual +// network interface, or a prototype object for a new virtual network interface. +// +// If an existing virtual network interface is specified, `enable_infrastructure_nat` must be +// `false`. +// 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`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 + // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // same subnet as the primary IP. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. + // + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use for this virtual network interface. If unspecified, the + // virtual server instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { + isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } @@ -49349,24 +50294,6 @@ func UnmarshalInstanceNetworkAttachmentReferenceDeleted(m map[string]json.RawMes return } -// InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted unmarshals an instance of InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // InstancePatch : InstancePatch struct type InstancePatch struct { // The availability policy for this virtual server instance. @@ -50920,7 +51847,7 @@ type InstancePrototype struct { Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -51608,7 +52535,7 @@ type InstanceTemplatePrototype struct { Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -52710,30 +53637,6 @@ type ListBareMetalServersOptions struct { // Filters the collection to resources with a `vpc.name` property matching the exact specified name. VPCName *string `json:"vpc.name,omitempty"` - // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.id` - // property matching the specified identifier. - NetworkInterfacesSubnetID *string `json:"network_interfaces.subnet.id,omitempty"` - - // Filters the collection to resources with an item in the `network_attachments` property with a `subnet.id` property - // matching the specified identifier. - NetworkAttachmentsSubnetID *string `json:"network_attachments[].subnet.id,omitempty"` - - // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.crn` - // property matching the specified CRN. - NetworkInterfacesSubnetCRN *string `json:"network_interfaces.subnet.crn,omitempty"` - - // Filters the collection to resources with an item in the `network_attachments` property with a `subnet.crn` property - // matching the specified CRN. - NetworkAttachmentsSubnetCRN *string `json:"network_attachments[].subnet.crn,omitempty"` - - // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.name` - // property matching the exact specified name. - NetworkInterfacesSubnetName *string `json:"network_interfaces.subnet.name,omitempty"` - - // Filters the collection to resources with an item in the `network_attachments` property with a `subnet.name` property - // matching the exact specified name. - NetworkAttachmentsSubnetName *string `json:"network_attachments[].subnet.name,omitempty"` - // Allows users to set headers on API requests Headers map[string]string } @@ -52785,42 +53688,6 @@ func (_options *ListBareMetalServersOptions) SetVPCName(vpcName string) *ListBar return _options } -// SetNetworkInterfacesSubnetID : Allow user to set NetworkInterfacesSubnetID -func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetID(networkInterfacesSubnetID string) *ListBareMetalServersOptions { - _options.NetworkInterfacesSubnetID = core.StringPtr(networkInterfacesSubnetID) - return _options -} - -// SetNetworkAttachmentsSubnetID : Allow user to set NetworkAttachmentsSubnetID -func (_options *ListBareMetalServersOptions) SetNetworkAttachmentsSubnetID(networkAttachmentsSubnetID string) *ListBareMetalServersOptions { - _options.NetworkAttachmentsSubnetID = core.StringPtr(networkAttachmentsSubnetID) - return _options -} - -// SetNetworkInterfacesSubnetCRN : Allow user to set NetworkInterfacesSubnetCRN -func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetCRN(networkInterfacesSubnetCRN string) *ListBareMetalServersOptions { - _options.NetworkInterfacesSubnetCRN = core.StringPtr(networkInterfacesSubnetCRN) - return _options -} - -// SetNetworkAttachmentsSubnetCRN : Allow user to set NetworkAttachmentsSubnetCRN -func (_options *ListBareMetalServersOptions) SetNetworkAttachmentsSubnetCRN(networkAttachmentsSubnetCRN string) *ListBareMetalServersOptions { - _options.NetworkAttachmentsSubnetCRN = core.StringPtr(networkAttachmentsSubnetCRN) - return _options -} - -// SetNetworkInterfacesSubnetName : Allow user to set NetworkInterfacesSubnetName -func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetName(networkInterfacesSubnetName string) *ListBareMetalServersOptions { - _options.NetworkInterfacesSubnetName = core.StringPtr(networkInterfacesSubnetName) - return _options -} - -// SetNetworkAttachmentsSubnetName : Allow user to set NetworkAttachmentsSubnetName -func (_options *ListBareMetalServersOptions) SetNetworkAttachmentsSubnetName(networkAttachmentsSubnetName string) *ListBareMetalServersOptions { - _options.NetworkAttachmentsSubnetName = core.StringPtr(networkAttachmentsSubnetName) - return _options -} - // SetHeaders : Allow user to set Headers func (options *ListBareMetalServersOptions) SetHeaders(param map[string]string) *ListBareMetalServersOptions { options.Headers = param @@ -53104,6 +53971,19 @@ type ListEndpointGatewaysOptions struct { // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. ResourceGroupID *string `json:"resource_group.id,omitempty"` + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to endpoint gateways with an `allow_dns_resolution_binding` property matching the specified + // value. + AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -53137,6 +54017,30 @@ func (_options *ListEndpointGatewaysOptions) SetResourceGroupID(resourceGroupID return _options } +// SetVPCID : Allow user to set VPCID +func (_options *ListEndpointGatewaysOptions) SetVPCID(vpcID string) *ListEndpointGatewaysOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListEndpointGatewaysOptions) SetVPCCRN(vpcCRN string) *ListEndpointGatewaysOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListEndpointGatewaysOptions) SetVPCName(vpcName string) *ListEndpointGatewaysOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetAllowDnsResolutionBinding : Allow user to set AllowDnsResolutionBinding +func (_options *ListEndpointGatewaysOptions) SetAllowDnsResolutionBinding(allowDnsResolutionBinding bool) *ListEndpointGatewaysOptions { + _options.AllowDnsResolutionBinding = core.BoolPtr(allowDnsResolutionBinding) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListEndpointGatewaysOptions) SetHeaders(param map[string]string) *ListEndpointGatewaysOptions { options.Headers = param @@ -54034,18 +54938,6 @@ type ListInstancesOptions struct { // Filters the collection to resources with a `vpc.name` property matching the exact specified name. VPCName *string `json:"vpc.name,omitempty"` - // Filters the collection to resources with an item in the `network_attachments` property with a `subnet.id` property - // matching the specified identifier. - NetworkAttachmentsSubnetID *string `json:"network_attachments[].subnet.id,omitempty"` - - // Filters the collection to resources with an item in the `network_attachments` property with a `subnet.crn` property - // matching the specified CRN. - NetworkAttachmentsSubnetCRN *string `json:"network_attachments[].subnet.crn,omitempty"` - - // Filters the collection to resources with an item in the `network_attachments` property with a `subnet.name` property - // matching the exact specified name. - NetworkAttachmentsSubnetName *string `json:"network_attachments[].subnet.name,omitempty"` - // Filters the collection to instances with a `dedicated_host.id` property matching the specified identifier. DedicatedHostID *string `json:"dedicated_host.id,omitempty"` @@ -54118,24 +55010,6 @@ func (_options *ListInstancesOptions) SetVPCName(vpcName string) *ListInstancesO return _options } -// SetNetworkAttachmentsSubnetID : Allow user to set NetworkAttachmentsSubnetID -func (_options *ListInstancesOptions) SetNetworkAttachmentsSubnetID(networkAttachmentsSubnetID string) *ListInstancesOptions { - _options.NetworkAttachmentsSubnetID = core.StringPtr(networkAttachmentsSubnetID) - return _options -} - -// SetNetworkAttachmentsSubnetCRN : Allow user to set NetworkAttachmentsSubnetCRN -func (_options *ListInstancesOptions) SetNetworkAttachmentsSubnetCRN(networkAttachmentsSubnetCRN string) *ListInstancesOptions { - _options.NetworkAttachmentsSubnetCRN = core.StringPtr(networkAttachmentsSubnetCRN) - return _options -} - -// SetNetworkAttachmentsSubnetName : Allow user to set NetworkAttachmentsSubnetName -func (_options *ListInstancesOptions) SetNetworkAttachmentsSubnetName(networkAttachmentsSubnetName string) *ListInstancesOptions { - _options.NetworkAttachmentsSubnetName = core.StringPtr(networkAttachmentsSubnetName) - return _options -} - // SetDedicatedHostID : Allow user to set DedicatedHostID func (_options *ListInstancesOptions) SetDedicatedHostID(dedicatedHostID string) *ListInstancesOptions { _options.DedicatedHostID = core.StringPtr(dedicatedHostID) @@ -55570,6 +56444,18 @@ type ListSubnetsOptions struct { // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. ResourceGroupID *string `json:"resource_group.id,omitempty"` + // Filters the collection to resources with a `zone.name` property matching the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + // Filters the collection to subnets with a `routing_table.id` property matching the specified identifier. RoutingTableID *string `json:"routing_table.id,omitempty"` @@ -55603,6 +56489,30 @@ func (_options *ListSubnetsOptions) SetResourceGroupID(resourceGroupID string) * return _options } +// SetZoneName : Allow user to set ZoneName +func (_options *ListSubnetsOptions) SetZoneName(zoneName string) *ListSubnetsOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListSubnetsOptions) SetVPCID(vpcID string) *ListSubnetsOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListSubnetsOptions) SetVPCCRN(vpcCRN string) *ListSubnetsOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListSubnetsOptions) SetVPCName(vpcName string) *ListSubnetsOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + // SetRoutingTableID : Allow user to set RoutingTableID func (_options *ListSubnetsOptions) SetRoutingTableID(routingTableID string) *ListSubnetsOptions { _options.RoutingTableID = core.StringPtr(routingTableID) @@ -55926,6 +56836,109 @@ func (options *ListVPCAddressPrefixesOptions) SetHeaders(param map[string]string return options } +// ListVPCDnsResolutionBindingsOptions : The ListVPCDnsResolutionBindings options. +type ListVPCDnsResolutionBindingsOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to resources with a `vpc.remote.account.id` property matching the specified account + // identifier. + AccountID *string `json:"account.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPCDnsResolutionBindingsOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListVPCDnsResolutionBindingsOptionsSortCreatedAtConst = "created_at" + ListVPCDnsResolutionBindingsOptionsSortNameConst = "name" +) + +// NewListVPCDnsResolutionBindingsOptions : Instantiate ListVPCDnsResolutionBindingsOptions +func (*VpcV1) NewListVPCDnsResolutionBindingsOptions(vpcID string) *ListVPCDnsResolutionBindingsOptions { + return &ListVPCDnsResolutionBindingsOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCID(vpcID string) *ListVPCDnsResolutionBindingsOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPCDnsResolutionBindingsOptions) SetSort(sort string) *ListVPCDnsResolutionBindingsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPCDnsResolutionBindingsOptions) SetStart(start string) *ListVPCDnsResolutionBindingsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPCDnsResolutionBindingsOptions) SetLimit(limit int64) *ListVPCDnsResolutionBindingsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListVPCDnsResolutionBindingsOptions) SetName(name string) *ListVPCDnsResolutionBindingsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCCRN(vpcCRN string) *ListVPCDnsResolutionBindingsOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCName(vpcName string) *ListVPCDnsResolutionBindingsOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetAccountID : Allow user to set AccountID +func (_options *ListVPCDnsResolutionBindingsOptions) SetAccountID(accountID string) *ListVPCDnsResolutionBindingsOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCDnsResolutionBindingsOptions) SetHeaders(param map[string]string) *ListVPCDnsResolutionBindingsOptions { + options.Headers = param + return options +} + // ListVPCRoutesOptions : The ListVPCRoutes options. type ListVPCRoutesOptions struct { // The VPC identifier. @@ -60759,7 +61772,7 @@ type NetworkACLPrototype struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The VPC this network ACL will reside in. @@ -62958,7 +63971,7 @@ type PublicGatewayFloatingIPPrototype struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` } @@ -64544,7 +65557,7 @@ func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) ( } // ResourceGroupIdentity : The resource group to use. If unspecified, the account's [default resource -// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. +// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. // Models which "extend" this model: // - ResourceGroupIdentityByID type ResourceGroupIdentity struct { @@ -64639,10 +65652,6 @@ type Route struct { // - `drop`: drop the packet. Action *string `json:"action" validate:"required"` - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - Advertise *bool `json:"advertise" validate:"required"` - // The date and time that the route was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -64736,10 +65745,6 @@ func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } - err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -64981,10 +65986,6 @@ type RouteCollectionVPCContextRoutesItem struct { // - `drop`: drop the packet. Action *string `json:"action" validate:"required"` - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - Advertise *bool `json:"advertise" validate:"required"` - // The date and time that the route was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -65078,10 +66079,6 @@ func UnmarshalRouteCollectionVPCContextRoutesItem(m map[string]json.RawMessage, if err != nil { return } - err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -65280,7 +66277,7 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er // `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 a unique `next_hop` IP address. +// an `action` of `deliver` and `next_hop` is an IP address. // Models which "extend" this model: // - RouteNextHopPatchRouteNextHopIP // - RouteNextHopPatchVPNGatewayConnectionIdentity @@ -65328,14 +66325,6 @@ func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{} // RoutePatch : RoutePatch struct type RoutePatch struct { - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - // - // Since all routes in a routing table with the same `destination` must have the same - // `advertise` value, this property can only be changed for routes with a unique - // `destination` in the routing table. - 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"` @@ -65344,8 +66333,7 @@ type RoutePatch struct { // `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 a unique `next_hop` IP - // address. + // 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. @@ -65359,10 +66347,6 @@ type RoutePatch struct { // UnmarshalRoutePatch unmarshals an instance of RoutePatch from the specified map of raw messages. func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(RoutePatch) - err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -65398,13 +66382,6 @@ type RoutePrototype struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - // - // All routes in a routing table with the same `destination` 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 @@ -65420,8 +66397,7 @@ type RoutePrototype struct { // `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 a unique `next_hop` IP - // address. + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -65466,10 +66442,6 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } - err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) if err != nil { return @@ -65498,7 +66470,7 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( // `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 a unique `next_hop` IP address. +// an `action` of `deliver` and `next_hop` is an IP address. // Models which "extend" this model: // - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP // - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity @@ -65609,14 +66581,6 @@ type RoutingTable struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` - // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these - // sources. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` - // The date and time that this routing table was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -65642,9 +66606,9 @@ type RoutingTable struct { // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, - // the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from the internet. @@ -65652,9 +66616,9 @@ type RoutingTable struct { // Incoming traffic will be routed according to the routing table with two exceptions: // - Traffic destined for IP addresses associated with public gateways will not be // subject to routes in this routing table. - // - Routes with an action of deliver are treated as drop unless the `next_hop` is an - // IP address in a subnet in the route's `zone`. Therefore, if an incoming packet - // matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // - 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"` @@ -65662,18 +66626,18 @@ type RoutingTable struct { // 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`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, - // the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this // VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, - // the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` // The routes for this routing table. @@ -65683,16 +66647,6 @@ type RoutingTable struct { Subnets []SubnetReference `json:"subnets" validate:"required"` } -// Constants associated with the RoutingTable.AdvertiseRoutesTo property. -// An ingress source that routes can be advertised to: -// -// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) -// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). -const ( - RoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link" - RoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway" -) - // Constants associated with the RoutingTable.LifecycleState property. // The lifecycle state of the routing table. const ( @@ -65718,10 +66672,6 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } - err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -65916,10 +66866,6 @@ type RoutingTablePatch struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` - // The ingress sources to advertise routes to, replacing any existing sources to advertise to. Routes in the table with - // `advertise` enabled will be advertised to these sources. - AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"` - // The name for this routing table. The name must not be used by another routing table in the VPC. Name *string `json:"name,omitempty"` @@ -65927,13 +66873,12 @@ type RoutingTablePatch struct { // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to `true` selects this routing table, provided // no other routing table in the VPC already has this property set to `true`, and no subnets are attached to this // routing table. Updating to - // `false` deselects this routing table, provided `direct_link` is absent from - // `advertise_routes_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`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, - // the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` // Indicates whether this routing table is used to route traffic that originates from the internet. Updating to `true` @@ -65944,21 +66889,20 @@ type RoutingTablePatch struct { // - 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`. Therefore, if an incoming packet matches - // a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, - // the packet will be dropped. + // 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`. + // `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`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, - // the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. // // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing @@ -65971,22 +66915,12 @@ type RoutingTablePatch struct { // 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`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway connection, - // the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,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) @@ -65994,10 +66928,6 @@ func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{} if err != nil { return } - err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -68215,16 +69145,11 @@ type ShareMountTargetVirtualNetworkInterfacePrototype struct { // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC // for the subnet is used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - // The associated subnet. Required if `primary_ip` does not specify a reserved IP and - // `primary_ip.address` is not specified. + // The associated subnet. Required if `primary_ip` does not specify a reserved IP. Subnet SubnetIdentityIntf `json:"subnet,omitempty"` // The unique identifier for this virtual network interface. @@ -68272,10 +69197,6 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) if err != nil { return @@ -68315,8 +69236,7 @@ type SharePatch struct { // The maximum input/output operations per second (IOPS) for the file share. The value must be in the range supported // by the share's size. // - // For this property to be changed, the share `lifecycle_state` must be `stable` and the share must be in the `custom` - // or `defined_performance` profile family. + // For this property to be changed, the share `lifecycle_state` must be `stable`. Iops *int64 `json:"iops,omitempty"` // The name for this share. The name must not be used by another share in the region. @@ -68324,17 +69244,7 @@ type SharePatch struct { // 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. + // The requested profile must be in the same `family`. Profile ShareProfileIdentityIntf `json:"profile,omitempty"` // The cron specification for the file share replication schedule. @@ -68437,9 +69347,7 @@ type ShareProfile struct { // Constants associated with the ShareProfile.Family property. // The product family this share profile belongs to. const ( - ShareProfileFamilyCustomConst = "custom" ShareProfileFamilyDefinedPerformanceConst = "defined_performance" - ShareProfileFamilyTieredConst = "tiered" ) // Constants associated with the ShareProfile.ResourceType property. @@ -68804,7 +69712,7 @@ func UnmarshalShareProfileReference(m map[string]json.RawMessage, result interfa // - SharePrototypeShareBySize // - SharePrototypeShareBySourceShare type SharePrototype struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the `custom` or + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. // // In addition, each client accessing the share will be restricted to 48,000 IOPS. @@ -68854,7 +69762,7 @@ type SharePrototype struct { InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The size of the file share rounded up to the next gigabyte. @@ -68960,7 +69868,7 @@ func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) ( // subsequently added by creating a new file share with a // `source_share` referencing this file share. type SharePrototypeShareContext struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the `custom` or + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. // // In addition, each client accessing the share will be restricted to 48,000 IOPS. @@ -69701,7 +70609,7 @@ type SnapshotPrototype struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. @@ -70314,8 +71222,7 @@ type SubnetPatch struct { // 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. Specify `null` to - // remove an existing public gateway. + // 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 @@ -70377,7 +71284,7 @@ type SubnetPrototype struct { PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The routing table to use for this subnet. If unspecified, the default routing table @@ -70465,8 +71372,7 @@ func UnmarshalSubnetPrototype(m map[string]json.RawMessage, result interface{}) return } -// SubnetPublicGatewayPatch : The public gateway to use for internet-bound traffic for this subnet. Specify `null` to remove an existing public -// gateway. +// SubnetPublicGatewayPatch : The public gateway to use for internet-bound traffic for this subnet. // Models which "extend" this model: // - SubnetPublicGatewayPatchPublicGatewayIdentityByID // - SubnetPublicGatewayPatchPublicGatewayIdentityByCRN @@ -72870,6 +73776,54 @@ func (options *UpdateVPCAddressPrefixOptions) SetHeaders(param map[string]string return options } +// UpdateVPCDnsResolutionBindingOptions : The UpdateVPCDnsResolutionBinding options. +type UpdateVPCDnsResolutionBindingOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The DNS resolution binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // The DNS resolution binding patch. + VpcdnsResolutionBindingPatch map[string]interface{} `json:"VpcdnsResolutionBinding_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCDnsResolutionBindingOptions : Instantiate UpdateVPCDnsResolutionBindingOptions +func (*VpcV1) NewUpdateVPCDnsResolutionBindingOptions(vpcID string, id string, vpcdnsResolutionBindingPatch map[string]interface{}) *UpdateVPCDnsResolutionBindingOptions { + return &UpdateVPCDnsResolutionBindingOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + VpcdnsResolutionBindingPatch: vpcdnsResolutionBindingPatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *UpdateVPCDnsResolutionBindingOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCDnsResolutionBindingOptions) SetID(id string) *UpdateVPCDnsResolutionBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVpcdnsResolutionBindingPatch : Allow user to set VpcdnsResolutionBindingPatch +func (_options *UpdateVPCDnsResolutionBindingOptions) SetVpcdnsResolutionBindingPatch(vpcdnsResolutionBindingPatch map[string]interface{}) *UpdateVPCDnsResolutionBindingOptions { + _options.VpcdnsResolutionBindingPatch = vpcdnsResolutionBindingPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *UpdateVPCDnsResolutionBindingOptions { + options.Headers = param + return options +} + // UpdateVPCOptions : The UpdateVPC options. type UpdateVPCOptions struct { // The VPC identifier. @@ -72878,6 +73832,9 @@ type UpdateVPCOptions struct { // The VPC patch. VPCPatch map[string]interface{} `json:"VPC_patch" validate:"required"` + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -72902,6 +73859,12 @@ func (_options *UpdateVPCOptions) SetVPCPatch(vpcPatch map[string]interface{}) * return _options } +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVPCOptions) SetIfMatch(ifMatch string) *UpdateVPCOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + // SetHeaders : Allow user to set Headers func (options *UpdateVPCOptions) SetHeaders(param map[string]string) *UpdateVPCOptions { options.Headers = param @@ -73313,6 +74276,25 @@ type VPC struct { // default. DefaultSecurityGroup *SecurityGroupReference `json:"default_security_group" validate:"required"` + // The DNS configuration for this VPC. + Dns *Vpcdns `json:"dns" validate:"required"` + + // The reasons for the current `health_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPCHealthReason `json:"health_reasons" validate:"required"` + + // The health of this resource. + // - `ok`: No abnormal behavior detected + // - `degraded`: Experiencing compromised performance, capacity, or connectivity + // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated + // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a + // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also + // have this state. + HealthState *string `json:"health_state" validate:"required"` + // The URL for this VPC. Href *string `json:"href" validate:"required"` @@ -73332,6 +74314,21 @@ type VPC struct { Status *string `json:"status" validate:"required"` } +// Constants associated with the VPC.HealthState property. +// The health of this resource. +// - `ok`: No abnormal behavior detected +// - `degraded`: Experiencing compromised performance, capacity, or connectivity +// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated +// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle +// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this +// state. +const ( + VPCHealthStateDegradedConst = "degraded" + VPCHealthStateFaultedConst = "faulted" + VPCHealthStateInapplicableConst = "inapplicable" + VPCHealthStateOkConst = "ok" +) + // Constants associated with the VPC.ResourceType property. // The resource type. const ( @@ -73378,6 +74375,18 @@ func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) if err != nil { return } + err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdns) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPCHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -73522,6 +74531,604 @@ func UnmarshalVPCCollectionNext(m map[string]json.RawMessage, result interface{} return } +// Vpcdns : The DNS configuration for this VPC. +type Vpcdns struct { + // Indicates whether this VPC is enabled as a DNS name resolution hub. + EnableHub *bool `json:"enable_hub" validate:"required"` + + // The number of DNS resolution bindings for this VPC. + ResolutionBindingCount *int64 `json:"resolution_binding_count" validate:"required"` + + // The DNS resolver configuration for the VPC. + Resolver VpcdnsResolverIntf `json:"resolver" validate:"required"` +} + +// UnmarshalVpcdns unmarshals an instance of Vpcdns from the specified map of raw messages. +func UnmarshalVpcdns(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Vpcdns) + err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resolution_binding_count", &obj.ResolutionBindingCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolver) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsPatch : The DNS configuration for this VPC. +type VpcdnsPatch struct { + // Indicates whether this VPC is enabled as a DNS name resolution hub. + // + // Updating the value to `true` requires `allow_dns_resolution_binding` to be `true` for all endpoint gateways residing + // in this VPC. + // + // Changing the value requires `dns.resolution_binding_count` to be zero. + EnableHub *bool `json:"enable_hub,omitempty"` + + Resolver *VpcdnsResolverPatch `json:"resolver,omitempty"` +} + +// UnmarshalVpcdnsPatch unmarshals an instance of VpcdnsPatch from the specified map of raw messages. +func UnmarshalVpcdnsPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsPatch) + err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsPrototype : The DNS configuration for this VPC. +// +// If unspecified, the system will assign DNS servers capable of resolving hosts and endpoint gateways within this VPC, +// and hosts on the internet. +type VpcdnsPrototype struct { + // Indicates whether this VPC is enabled as a DNS name resolution hub. + EnableHub *bool `json:"enable_hub,omitempty"` + + Resolver VpcdnsResolverPrototypeIntf `json:"resolver,omitempty"` +} + +// UnmarshalVpcdnsPrototype unmarshals an instance of VpcdnsPrototype from the specified map of raw messages. +func UnmarshalVpcdnsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsPrototype) + err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolutionBinding : VpcdnsResolutionBinding struct +type VpcdnsResolutionBinding struct { + // The date and time that the DNS resolution binding was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The endpoint gateways that have `allow_dns_resolution_binding` set to `true` and reside in the VPC that has + // `dns.enable_hub` set to `false`. + // + // The endpoint gateways may be remote and therefore may not be directly retrievable. + EndpointGateways []EndpointGatewayReferenceRemote `json:"endpoint_gateways" validate:"required"` + + // The URL for this DNS resolution binding. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this DNS resolution binding. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the DNS resolution binding. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this DNS resolution binding. The name is unique across all DNS resolution bindings for the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The VPC bound to for DNS resolution. + // + // The VPC may be remote and therefore may not be directly retrievable. + VPC *VPCReferenceRemote `json:"vpc" validate:"required"` +} + +// Constants associated with the VpcdnsResolutionBinding.LifecycleState property. +// The lifecycle state of the DNS resolution binding. +const ( + VpcdnsResolutionBindingLifecycleStateDeletingConst = "deleting" + VpcdnsResolutionBindingLifecycleStateFailedConst = "failed" + VpcdnsResolutionBindingLifecycleStatePendingConst = "pending" + VpcdnsResolutionBindingLifecycleStateStableConst = "stable" + VpcdnsResolutionBindingLifecycleStateSuspendedConst = "suspended" + VpcdnsResolutionBindingLifecycleStateUpdatingConst = "updating" + VpcdnsResolutionBindingLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VpcdnsResolutionBinding.ResourceType property. +// The resource type. +const ( + VpcdnsResolutionBindingResourceTypeVPCDnsResolutionBindingConst = "vpc_dns_resolution_binding" +) + +// UnmarshalVpcdnsResolutionBinding unmarshals an instance of VpcdnsResolutionBinding from the specified map of raw messages. +func UnmarshalVpcdnsResolutionBinding(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolutionBinding) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGatewayReferenceRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceRemote) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolutionBindingCollection : VpcdnsResolutionBindingCollection struct +type VpcdnsResolutionBindingCollection struct { + // Collection of DNS resolution bindings for this VPC. + DnsResolutionBindings []VpcdnsResolutionBinding `json:"dns_resolution_bindings" validate:"required"` + + // A link to the first page of resources. + First *VpcdnsResolutionBindingCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VpcdnsResolutionBindingCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalVpcdnsResolutionBindingCollection unmarshals an instance of VpcdnsResolutionBindingCollection from the specified map of raw messages. +func UnmarshalVpcdnsResolutionBindingCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolutionBindingCollection) + err = core.UnmarshalModel(m, "dns_resolution_bindings", &obj.DnsResolutionBindings, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVpcdnsResolutionBindingCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVpcdnsResolutionBindingCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VpcdnsResolutionBindingCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// VpcdnsResolutionBindingPatch : VpcdnsResolutionBindingPatch struct +type VpcdnsResolutionBindingPatch struct { + // The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVpcdnsResolutionBindingPatch unmarshals an instance of VpcdnsResolutionBindingPatch from the specified map of raw messages. +func UnmarshalVpcdnsResolutionBindingPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolutionBindingPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VpcdnsResolutionBindingPatch +func (vpcdnsResolutionBindingPatch *VpcdnsResolutionBindingPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpcdnsResolutionBindingPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// VpcdnsResolver : VpcdnsResolver struct +// Models which "extend" this model: +// - VpcdnsResolverTypeDelegated +// - VpcdnsResolverTypeManual +// - VpcdnsResolverTypeSystem +type VpcdnsResolver struct { + // The DNS servers for this VPC. The servers are populated: + // + // - by the system when `dns.resolver.type` is `system` + // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + Servers []DnsServer `json:"servers" validate:"required"` + + // The type of the DNS resolver used for the VPC. + // + // - `delegated`: DNS server addresses are provided by the DNS resolver of the VPC + // specified in `dns.resolver.vpc`. + // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. + // - `system`: DNS server addresses are provided by the system. + Type *string `json:"type" validate:"required"` + + // The VPC whose DNS resolver provides the DNS server addresses for this VPC. + // + // The VPC may be remote and therefore may not be directly retrievable. + VPC *VPCReferenceDnsResolverContext `json:"vpc,omitempty"` + + // The manually specified DNS servers for this VPC. + ManualServers []DnsServer `json:"manual_servers,omitempty"` + + // The configuration of the system DNS resolver for this VPC. + // + // - `custom_resolver`: A custom DNS resolver is configured for this VPC. + // + // - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when + // the VPC has either or both of the following: + // + // - at least one endpoint gateway residing in it + // - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it + // + // - `default`: The provider default DNS resolvers are configured for this VPC. + // + // This system DNS resolver configuration is used when the VPC has: + // + // - no custom DNS resolver configured for it, and + // - no endpoint gateways residing in it, and + // - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. + Configuration *string `json:"configuration,omitempty"` +} + +// Constants associated with the VpcdnsResolver.Type property. +// The type of the DNS resolver used for the VPC. +// +// - `delegated`: DNS server addresses are provided by the DNS resolver of the VPC +// specified in `dns.resolver.vpc`. +// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. +// - `system`: DNS server addresses are provided by the system. +const ( + VpcdnsResolverTypeDelegatedConst = "delegated" + VpcdnsResolverTypeManualConst = "manual" + VpcdnsResolverTypeSystemConst = "system" +) + +// Constants associated with the VpcdnsResolver.Configuration property. +// The configuration of the system DNS resolver for this VPC. +// +// - `custom_resolver`: A custom DNS resolver is configured for this VPC. +// +// - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when +// the VPC has either or both of the following: +// +// - at least one endpoint gateway residing in it +// +// - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it +// +// - `default`: The provider default DNS resolvers are configured for this VPC. +// +// This system DNS resolver configuration is used when the VPC has: +// +// - no custom DNS resolver configured for it, and +// - no endpoint gateways residing in it, and +// - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. +const ( + VpcdnsResolverConfigurationCustomResolverConst = "custom_resolver" + VpcdnsResolverConfigurationDefaultConst = "default" + VpcdnsResolverConfigurationPrivateResolverConst = "private_resolver" +) + +func (*VpcdnsResolver) isaVpcdnsResolver() bool { + return true +} + +type VpcdnsResolverIntf interface { + isaVpcdnsResolver() bool +} + +// UnmarshalVpcdnsResolver unmarshals an instance of VpcdnsResolver from the specified map of raw messages. +func UnmarshalVpcdnsResolver(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolver) + err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverPatch : VpcdnsResolverPatch struct +type VpcdnsResolverPatch struct { + // The DNS servers to use for this VPC, replacing any existing servers. All the DNS servers must either: + // + // - have a unique `zone_affinity`, or + // - not have a `zone_affinity`. + // + // `dns.resolver.manual_servers` must be set if and only if `dns.resolver.type` is `manual`. + ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"` + + // The type of the DNS resolver to use. + // + // - `delegated`: DNS server addresses will be provided by the resolver for the VPC + // specified in `dns.resolver.vpc`. Requires `dns.enable_hub` to be + // `false`. + // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. + // - `system`: DNS server addresses will be provided by the system and depend on the + // configuration. + // + // Updating from `manual` requires `dns.resolver.manual_servers` to be specified as + // `null`. + // + // Updating to `manual` requires `dns.resolver.manual_servers` to be specified and not empty. + // + // Updating from `delegated` requires `dns.resolver.vpc` to be specified as `null`. + Type *string `json:"type,omitempty"` + + // The VPC to provide DNS server addresses for this VPC. The specified VPC must be configured + // with a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) custom resolver and must be in + // one of this VPC's DNS resolution bindings. + // + // Specify `null` to remove an existing VPC. + // + // This property must be set if and only if `dns.resolver.type` is `delegated`. + VPC VpcdnsResolverVPCPatchIntf `json:"vpc,omitempty"` +} + +// Constants associated with the VpcdnsResolverPatch.Type property. +// The type of the DNS resolver to use. +// +// - `delegated`: DNS server addresses will be provided by the resolver for the VPC +// specified in `dns.resolver.vpc`. Requires `dns.enable_hub` to be +// `false`. +// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. +// - `system`: DNS server addresses will be provided by the system and depend on the +// configuration. +// +// Updating from `manual` requires `dns.resolver.manual_servers` to be specified as +// `null`. +// +// Updating to `manual` requires `dns.resolver.manual_servers` to be specified and not empty. +// +// Updating from `delegated` requires `dns.resolver.vpc` to be specified as `null`. +const ( + VpcdnsResolverPatchTypeDelegatedConst = "delegated" + VpcdnsResolverPatchTypeManualConst = "manual" + VpcdnsResolverPatchTypeSystemConst = "system" +) + +// UnmarshalVpcdnsResolverPatch unmarshals an instance of VpcdnsResolverPatch from the specified map of raw messages. +func UnmarshalVpcdnsResolverPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverPatch) + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVpcdnsResolverVPCPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverPrototype : VpcdnsResolverPrototype struct +// Models which "extend" this model: +// - VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype +// - VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype +type VpcdnsResolverPrototype struct { + // The type of the DNS resolver to use. + // + // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. + // - `system`: DNS server addresses will be provided by the system and depend on the + // configuration. + Type *string `json:"type,omitempty"` + + // The DNS servers to use for this VPC. All the DNS servers must either: + // + // - have a unique `zone_affinity`, or + // - not have a `zone_affinity`. + ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"` +} + +// Constants associated with the VpcdnsResolverPrototype.Type property. +// The type of the DNS resolver to use. +// +// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. +// - `system`: DNS server addresses will be provided by the system and depend on the +// configuration. +const ( + VpcdnsResolverPrototypeTypeManualConst = "manual" + VpcdnsResolverPrototypeTypeSystemConst = "system" +) + +func (*VpcdnsResolverPrototype) isaVpcdnsResolverPrototype() bool { + return true +} + +type VpcdnsResolverPrototypeIntf interface { + isaVpcdnsResolverPrototype() bool +} + +// UnmarshalVpcdnsResolverPrototype unmarshals an instance of VpcdnsResolverPrototype from the specified map of raw messages. +func UnmarshalVpcdnsResolverPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverPrototype) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverVPCPatch : The VPC to provide DNS server addresses for this VPC. The specified VPC must be configured with a [DNS +// Services](https://cloud.ibm.com/docs/dns-svcs) custom resolver and must be in one of this VPC's DNS resolution +// bindings. +// +// Specify `null` to remove an existing VPC. +// +// This property must be set if and only if `dns.resolver.type` is `delegated`. +// Models which "extend" this model: +// - VpcdnsResolverVPCPatchVPCIdentityByID +// - VpcdnsResolverVPCPatchVPCIdentityByCRN +// - VpcdnsResolverVPCPatchVPCIdentityByHref +type VpcdnsResolverVPCPatch struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*VpcdnsResolverVPCPatch) isaVpcdnsResolverVPCPatch() bool { + return true +} + +type VpcdnsResolverVPCPatchIntf interface { + isaVpcdnsResolverVPCPatch() bool +} + +// UnmarshalVpcdnsResolverVPCPatch unmarshals an instance of VpcdnsResolverVPCPatch from the specified map of raw messages. +func UnmarshalVpcdnsResolverVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverVPCPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCHealthReason : VPCHealthReason struct +type VPCHealthReason struct { + // A snake case string succinctly identifying the reason for this health state. + Code *string `json:"code" validate:"required"` + + // An explanation of the reason for this health state. + Message *string `json:"message" validate:"required"` + + // Link to documentation about the reason for this health state. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the VPCHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VPCHealthReasonCodeDnsResolutionBindingFailedConst = "dns_resolution_binding_failed" +) + +// UnmarshalVPCHealthReason unmarshals an instance of VPCHealthReason from the specified map of raw messages. +func UnmarshalVPCHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPCIdentity : Identifies a VPC by a unique property. // Models which "extend" this model: // - VPCIdentityByID @@ -73567,6 +75174,9 @@ func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err // VPCPatch : VPCPatch struct type VPCPatch struct { + // The DNS configuration for this VPC. + Dns *VpcdnsPatch `json:"dns,omitempty"` + // The name for this VPC. The name must not be used by another VPC in the region. Name *string `json:"name,omitempty"` } @@ -73574,6 +75184,10 @@ type VPCPatch struct { // UnmarshalVPCPatch unmarshals an instance of VPCPatch from the specified map of raw messages. func UnmarshalVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPCPatch) + err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdnsPatch) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -73651,6 +75265,75 @@ func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (er return } +// VPCReferenceDnsResolverContext : A VPC whose DNS resolver is delegated to provide DNS servers for this VPC. +// +// The VPC may be remote and therefore may not be directly retrievable. +type VPCReferenceDnsResolverContext struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPCReferenceDnsResolverContextDeleted `json:"deleted,omitempty"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The name for this VPC. The name is unique across all VPCs in the region. + Name *string `json:"name" validate:"required"` + + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *VPCRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPCReferenceDnsResolverContext.ResourceType property. +// The resource type. +const ( + VPCReferenceDnsResolverContextResourceTypeVPCConst = "vpc" +) + +// UnmarshalVPCReferenceDnsResolverContext unmarshals an instance of VPCReferenceDnsResolverContext from the specified map of raw messages. +func UnmarshalVPCReferenceDnsResolverContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceDnsResolverContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDnsResolverContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVPCRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPCReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary // information. type VPCReferenceDeleted struct { @@ -73669,6 +75352,110 @@ func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface return } +// VPCReferenceDnsResolverContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPCReferenceDnsResolverContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPCReferenceDnsResolverContextDeleted unmarshals an instance of VPCReferenceDnsResolverContextDeleted from the specified map of raw messages. +func UnmarshalVPCReferenceDnsResolverContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceDnsResolverContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCReferenceRemote : VPCReferenceRemote struct +type VPCReferenceRemote struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The name for this VPC. The name is unique across all VPCs in the region. + Name *string `json:"name" validate:"required"` + + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *VPCRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPCReferenceRemote.ResourceType property. +// The resource type. +const ( + VPCReferenceRemoteResourceTypeVPCConst = "vpc" +) + +// UnmarshalVPCReferenceRemote unmarshals an instance of VPCReferenceRemote from the specified map of raw messages. +func UnmarshalVPCReferenceRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceRemote) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVPCRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type VPCRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // account, and identifies the owning account. + Account *AccountReference `json:"account,omitempty"` + + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalVPCRemote unmarshals an instance of VPCRemote from the specified map of raw messages. +func UnmarshalVPCRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCRemote) + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNGateway : VPNGateway struct // Models which "extend" this model: // - VPNGatewayRouteMode @@ -74777,7 +76564,7 @@ type VPNGatewayPrototype struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Identifies a subnet by a unique property. @@ -75925,7 +77712,7 @@ type VirtualNetworkInterface struct { // The lifecycle state of the virtual network interface. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The MAC address of the interface. Absent when the interface is not attached to a target. + // 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. @@ -76214,8 +78001,9 @@ func UnmarshalVirtualNetworkInterfaceIPPrototype(m map[string]json.RawMessage, r // VirtualNetworkInterfacePatch : VirtualNetworkInterfacePatch struct type VirtualNetworkInterfacePatch struct { - // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on - // this interface. If `true`, source IP spoofing is allowed on this interface. + // Indicates whether source IP spoofing is allowed on this 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 @@ -76334,293 +78122,11 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototype(m map[string]json.RawMes return } -// VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext : 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. -// Models which "extend" this model: -// - VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext -// - VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext 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`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. - 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 - // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // same subnet as the primary IP. - // - // If reserved IP identities are provided, the specified reserved IPs must be unbound. - // - // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network - // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet - // will be automatically selected and reserved. - Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are - // reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the virtual network interface. May be either a - // reserved IP identity, or a reserved IP prototype object which will be used to create a - // new reserved IP. - // - // If a reserved IP identity is provided, the specified reserved IP must be unbound. - // - // If a reserved IP prototype object with an address is provided, the address must be - // available on the virtual network interface's subnet. If no address is specified, - // an available address on the subnet will be automatically selected and reserved. - PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. Required if `primary_ip` does not specify a reserved IP and - // `primary_ip.address` is not specified. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` - - // 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 (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool { - return true -} - -type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf interface { - isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool -} - -// UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext unmarshals an instance of VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext : 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. -// Models which "extend" this model: -// - VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext -// - VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext 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`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. - 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 - // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // same subnet as the primary IP. - // - // If reserved IP identities are provided, the specified reserved IPs must be unbound. - // - // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network - // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet - // will be automatically selected and reserved. - Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are - // reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the virtual network interface. May be either a - // reserved IP identity, or a reserved IP prototype object which will be used to create a - // new reserved IP. - // - // If a reserved IP identity is provided, the specified reserved IP must be unbound. - // - // If a reserved IP prototype object with an address is provided, the address must be - // available on the virtual network interface's subnet. If no address is specified, - // an available address on the subnet will be automatically selected and reserved. - PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. Required if `primary_ip` does not specify a reserved IP and - // `primary_ip.address` is not specified. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` - - // 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 (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool { - return true -} - -type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf interface { - isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool -} - -// UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext unmarshals an instance of VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VirtualNetworkInterfaceReferenceAttachmentContext : VirtualNetworkInterfaceReferenceAttachmentContext struct type VirtualNetworkInterfaceReferenceAttachmentContext struct { // The CRN for this virtual network interface. CRN *string `json:"crn" validate:"required"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VirtualNetworkInterfaceReferenceAttachmentContextDeleted `json:"deleted,omitempty"` - // The URL for this virtual network interface. Href *string `json:"href" validate:"required"` @@ -76647,10 +78153,6 @@ func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]jso if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -76671,24 +78173,6 @@ func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]jso return } -// VirtualNetworkInterfaceReferenceAttachmentContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VirtualNetworkInterfaceReferenceAttachmentContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceAttachmentContextDeleted from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceReferenceAttachmentContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VirtualNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary // information. type VirtualNetworkInterfaceReferenceDeleted struct { @@ -76707,24 +78191,6 @@ func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessa return } -// VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VirtualNetworkInterfaceTarget : A virtual network interface target. // // The resource types that can be virtual network interface targets are expected to expand in the future. When iterating @@ -78126,7 +79592,7 @@ type VolumePrototype struct { Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -78579,6 +80045,40 @@ func UnmarshalVolumeStatusReason(m map[string]json.RawMessage, result interface{ return } +// VpcdnsResolutionBindingCollectionFirst : A link to the first page of resources. +type VpcdnsResolutionBindingCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVpcdnsResolutionBindingCollectionFirst unmarshals an instance of VpcdnsResolutionBindingCollectionFirst from the specified map of raw messages. +func UnmarshalVpcdnsResolutionBindingCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolutionBindingCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolutionBindingCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VpcdnsResolutionBindingCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVpcdnsResolutionBindingCollectionNext unmarshals an instance of VpcdnsResolutionBindingCollectionNext from the specified map of raw messages. +func UnmarshalVpcdnsResolutionBindingCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolutionBindingCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // Zone : Zone struct type Zone struct { // The URL for this zone. @@ -79309,6 +80809,165 @@ func UnmarshalBareMetalServerNetworkAttachmentByVlan(m map[string]json.RawMessag return } +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityIntf interface { + BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf + isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext : The virtual network interface for this target. +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext struct { + // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on + // this interface. If `true`, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the virtual network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 + // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // same subnet as the primary IP. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. + // + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use for this virtual network interface. If unspecified, the + // bare metal server's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype struct // This model "extends" BareMetalServerNetworkAttachmentPrototype type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype struct { @@ -79316,7 +80975,7 @@ type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentBy // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - VirtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity // within a `s390x` based system. @@ -79333,7 +80992,7 @@ const ( ) // NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype, err error) { +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype, err error) { _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype{ VirtualNetworkInterface: virtualNetworkInterface, InterfaceType: core.StringPtr(interfaceType), @@ -79353,7 +81012,7 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAtt if err != nil { return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { return } @@ -79372,7 +81031,7 @@ type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentBy // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - VirtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) attachment. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` @@ -79398,7 +81057,7 @@ const ( ) // NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype, err error) { +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype, err error) { _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype{ VirtualNetworkInterface: virtualNetworkInterface, InterfaceType: core.StringPtr(interfaceType), @@ -79418,7 +81077,7 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAtt if err != nil { return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { return } @@ -79441,7 +81100,7 @@ type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentBy // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - VirtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf `json:"virtual_network_interface" validate:"required"` + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` // Indicates if the bare metal server network attachment can automatically float to any other server within the same // `resource_group`. The bare metal server network attachment will float automatically if the network detects a GARP or @@ -79469,7 +81128,7 @@ const ( ) // NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(virtualNetworkInterface VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype, err error) { +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype, err error) { _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype{ VirtualNetworkInterface: virtualNetworkInterface, InterfaceType: core.StringPtr(interfaceType), @@ -79490,7 +81149,7 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAtt if err != nil { return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { return } @@ -80373,6 +82032,131 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte return } +// BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype : BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype struct +// This model "extends" BareMetalServerPrimaryNetworkAttachmentPrototype +type BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype 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"` + + // - `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 BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype.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 ( + BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototypeInterfaceTypeHipersocketConst = "hipersocket" +) + +// NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype : Instantiate BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string) (_model *BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype, err error) { + _model = &BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct +// This model "extends" BareMetalServerPrimaryNetworkAttachmentPrototype +type BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype 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 what VLAN IDs (for VLAN type only) can use this physical (PCI type) 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 VLAN tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype.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 VLAN tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : Instantiate BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string) (_model *BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype, err error) { + _model = &BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the bare metal server network attachments or bare metal server network interfaces // of a bare metal server with this profile depends on its configuration. // This model "extends" BareMetalServerProfileBandwidth @@ -81586,11 +83370,11 @@ type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { NetworkAttachments []BareMetalServerNetworkAttachmentPrototypeIntf `json:"network_attachments,omitempty"` // The primary network attachment to create for the bare metal server. - PrimaryNetworkAttachment *BareMetalServerPrimaryNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` + PrimaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf `json:"primary_network_attachment" validate:"required"` } // NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment : Instantiate BareMetalServerPrototypeBareMetalServerByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *BareMetalServerPrimaryNetworkAttachmentPrototype) (_model *BareMetalServerPrototypeBareMetalServerByNetworkAttachment, err error) { +func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf) (_model *BareMetalServerPrototypeBareMetalServerByNetworkAttachment, err error) { _model = &BareMetalServerPrototypeBareMetalServerByNetworkAttachment{ Initialization: initialization, Profile: profile, @@ -84252,10 +86036,6 @@ type FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext str // The CRN for this virtual network interface. CRN *string `json:"crn" validate:"required"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VirtualNetworkInterfaceReferenceAttachmentContextDeleted `json:"deleted,omitempty"` - // The URL for this virtual network interface. Href *string `json:"href" validate:"required"` @@ -84286,10 +86066,6 @@ func UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentCo if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -85489,6 +87265,165 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScaleProtot return } +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterface +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityIntf interface { + InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf + isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext : The virtual network interface for this target. +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterface +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext struct { + // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on + // this interface. If `true`, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the virtual network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - If the virtual network interface is attached: + // - The target `resource_type` must be `bare_metal_server_network_attachment`. + // - The target `interface_type` must not be `hipersocket`. + 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 + // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // same subnet as the primary IP. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. + // + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use for this virtual network interface. If unspecified, the + // virtual server instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstancePatchProfileInstanceProfileIdentityByHref : InstancePatchProfileInstanceProfileIdentityByHref struct // This model "extends" InstancePatchProfile type InstancePatchProfileInstanceProfileIdentityByHref struct { @@ -93218,7 +95153,7 @@ type PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` } @@ -93913,10 +95848,6 @@ type ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext str // The CRN for this virtual network interface. CRN *string `json:"crn" validate:"required"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted `json:"deleted,omitempty"` - // The URL for this virtual network interface. Href *string `json:"href" validate:"required"` @@ -93947,10 +95878,6 @@ func UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetCo if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -95892,8 +97819,15 @@ func UnmarshalShareIdentityByID(m map[string]json.RawMessage, result interface{} return } -// ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : The virtual network interface for this share mount target. The virtual network interface's VPC must not be used by a -// virtual network interface for another mount target for this share. +// ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : The virtual network interface for this share mount target. The virtual network interface must: +// +// - have `allow_ip_spoofing` set to `false` +// - have `enable_infrastructure_nat` set to `true` +// - not be in the same VPC as an existing mount target for this share +// - not have `ips` other than the `primary_ip` address +// +// If an existing virtual network interface is specified, it must not have a floating IP bound to it, and it must not be +// the target of a flow log collector. // // Required if the share's `access_control_mode` is `security_group`. // This model "extends" ShareMountTargetPrototype @@ -96113,16 +98047,11 @@ type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceProt // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC // for the subnet is used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - // The associated subnet. Required if `primary_ip` does not specify a reserved IP and - // `primary_ip.address` is not specified. + // The associated subnet. Required if `primary_ip` does not specify a reserved IP. Subnet SubnetIdentityIntf `json:"subnet,omitempty"` } @@ -96157,10 +98086,6 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) if err != nil { return @@ -96604,7 +98529,7 @@ func UnmarshalShareProfileIdentityByName(m map[string]json.RawMessage, result in // SharePrototypeShareBySize : Create a file share by size. // This model "extends" SharePrototype type SharePrototypeShareBySize struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the `custom` or + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. // // In addition, each client accessing the share will be restricted to 48,000 IOPS. @@ -96651,7 +98576,7 @@ type SharePrototypeShareBySize struct { InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The size of the file share rounded up to the next gigabyte. @@ -96747,7 +98672,7 @@ func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result int // `encryption_key`, `initial_owner`, and `size` will be inherited from `source_share`. // This model "extends" SharePrototype type SharePrototypeShareBySourceShare struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the `custom` or + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. // // In addition, each client accessing the share will be restricted to 48,000 IOPS. @@ -97527,6 +99452,358 @@ func UnmarshalTrustedProfileIdentityTrustedProfileByID(m map[string]json.RawMess return } +// VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype : Manually specify the DNS server addresses for this VPC. +// This model "extends" VpcdnsResolverPrototype +type VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype struct { + // The DNS servers to use for this VPC. All the DNS servers must either: + // + // - have a unique `zone_affinity`, or + // - not have a `zone_affinity`. + ManualServers []DnsServerPrototype `json:"manual_servers" validate:"required"` + + // The type of the DNS resolver to use. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype.Type property. +// The type of the DNS resolver to use. +const ( + VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototypeTypeManualConst = "manual" +) + +// NewVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype : Instantiate VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype (Generic Model Constructor) +func (*VpcV1) NewVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(manualServers []DnsServerPrototype, typeVar string) (_model *VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype, err error) { + _model = &VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype{ + ManualServers: manualServers, + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype) isaVpcdnsResolverPrototype() bool { + return true +} + +// UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype unmarshals an instance of VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype from the specified map of raw messages. +func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype) + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype : The system will provide DNS server addresses for this VPC. The system-provided DNS server addresses depend on whether +// any endpoint gateways reside in the VPC, and whether a +// [DNS Services](https://cloud.ibm.com/docs/dns-svcs) instance is configured for the VPC. +// This model "extends" VpcdnsResolverPrototype +type VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype struct { + // The type of the DNS resolver to use. + Type *string `json:"type,omitempty"` +} + +// Constants associated with the VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype.Type property. +// The type of the DNS resolver to use. +const ( + VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototypeTypeSystemConst = "system" +) + +func (*VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype) isaVpcdnsResolverPrototype() bool { + return true +} + +// UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype unmarshals an instance of VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype from the specified map of raw messages. +func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverTypeDelegated : The DNS server addresses are delegated to the DNS resolver of another VPC. +// This model "extends" VpcdnsResolver +type VpcdnsResolverTypeDelegated struct { + // The DNS servers for this VPC. The servers are populated: + // + // - by the system when `dns.resolver.type` is `system` + // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + Servers []DnsServer `json:"servers" validate:"required"` + + // The type of the DNS resolver used for the VPC. + Type *string `json:"type" validate:"required"` + + // The VPC whose DNS resolver provides the DNS server addresses for this VPC. + // + // The VPC may be remote and therefore may not be directly retrievable. + VPC *VPCReferenceDnsResolverContext `json:"vpc" validate:"required"` +} + +// Constants associated with the VpcdnsResolverTypeDelegated.Type property. +// The type of the DNS resolver used for the VPC. +const ( + VpcdnsResolverTypeDelegatedTypeDelegatedConst = "delegated" +) + +func (*VpcdnsResolverTypeDelegated) isaVpcdnsResolver() bool { + return true +} + +// UnmarshalVpcdnsResolverTypeDelegated unmarshals an instance of VpcdnsResolverTypeDelegated from the specified map of raw messages. +func UnmarshalVpcdnsResolverTypeDelegated(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverTypeDelegated) + err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverTypeManual : The DNS server addresses are manually specified. +// This model "extends" VpcdnsResolver +type VpcdnsResolverTypeManual struct { + // The DNS servers for this VPC. The servers are populated: + // + // - by the system when `dns.resolver.type` is `system` + // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + Servers []DnsServer `json:"servers" validate:"required"` + + // The manually specified DNS servers for this VPC. + ManualServers []DnsServer `json:"manual_servers" validate:"required"` + + // The type of the DNS resolver used for the VPC. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VpcdnsResolverTypeManual.Type property. +// The type of the DNS resolver used for the VPC. +const ( + VpcdnsResolverTypeManualTypeManualConst = "manual" +) + +func (*VpcdnsResolverTypeManual) isaVpcdnsResolver() bool { + return true +} + +// UnmarshalVpcdnsResolverTypeManual unmarshals an instance of VpcdnsResolverTypeManual from the specified map of raw messages. +func UnmarshalVpcdnsResolverTypeManual(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverTypeManual) + err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverTypeSystem : The DNS server addresses are provided by the system and depend on the configuration. +// This model "extends" VpcdnsResolver +type VpcdnsResolverTypeSystem struct { + // The DNS servers for this VPC. The servers are populated: + // + // - by the system when `dns.resolver.type` is `system` + // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + Servers []DnsServer `json:"servers" validate:"required"` + + // The configuration of the system DNS resolver for this VPC. + // + // - `custom_resolver`: A custom DNS resolver is configured for this VPC. + // + // - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when + // the VPC has either or both of the following: + // + // - at least one endpoint gateway residing in it + // - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it + // + // - `default`: The provider default DNS resolvers are configured for this VPC. + // + // This system DNS resolver configuration is used when the VPC has: + // + // - no custom DNS resolver configured for it, and + // - no endpoint gateways residing in it, and + // - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. + Configuration *string `json:"configuration" validate:"required"` + + // The type of the DNS resolver used for the VPC. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VpcdnsResolverTypeSystem.Configuration property. +// The configuration of the system DNS resolver for this VPC. +// +// - `custom_resolver`: A custom DNS resolver is configured for this VPC. +// +// - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when +// the VPC has either or both of the following: +// +// - at least one endpoint gateway residing in it +// +// - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it +// +// - `default`: The provider default DNS resolvers are configured for this VPC. +// +// This system DNS resolver configuration is used when the VPC has: +// +// - no custom DNS resolver configured for it, and +// - no endpoint gateways residing in it, and +// - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. +const ( + VpcdnsResolverTypeSystemConfigurationCustomResolverConst = "custom_resolver" + VpcdnsResolverTypeSystemConfigurationDefaultConst = "default" + VpcdnsResolverTypeSystemConfigurationPrivateResolverConst = "private_resolver" +) + +// Constants associated with the VpcdnsResolverTypeSystem.Type property. +// The type of the DNS resolver used for the VPC. +const ( + VpcdnsResolverTypeSystemTypeSystemConst = "system" +) + +func (*VpcdnsResolverTypeSystem) isaVpcdnsResolver() bool { + return true +} + +// UnmarshalVpcdnsResolverTypeSystem unmarshals an instance of VpcdnsResolverTypeSystem from the specified map of raw messages. +func UnmarshalVpcdnsResolverTypeSystem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverTypeSystem) + err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverVPCPatchVPCIdentityByCRN : VpcdnsResolverVPCPatchVPCIdentityByCRN struct +// This model "extends" VpcdnsResolverVPCPatch +type VpcdnsResolverVPCPatchVPCIdentityByCRN struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` +} + +// NewVpcdnsResolverVPCPatchVPCIdentityByCRN : Instantiate VpcdnsResolverVPCPatchVPCIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByCRN(crn string) (_model *VpcdnsResolverVPCPatchVPCIdentityByCRN, err error) { + _model = &VpcdnsResolverVPCPatchVPCIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VpcdnsResolverVPCPatchVPCIdentityByCRN) isaVpcdnsResolverVPCPatch() bool { + return true +} + +// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByCRN unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByCRN from the specified map of raw messages. +func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverVPCPatchVPCIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverVPCPatchVPCIdentityByHref : VpcdnsResolverVPCPatchVPCIdentityByHref struct +// This model "extends" VpcdnsResolverVPCPatch +type VpcdnsResolverVPCPatchVPCIdentityByHref struct { + // The URL for this VPC. + Href *string `json:"href" validate:"required"` +} + +// NewVpcdnsResolverVPCPatchVPCIdentityByHref : Instantiate VpcdnsResolverVPCPatchVPCIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByHref(href string) (_model *VpcdnsResolverVPCPatchVPCIdentityByHref, err error) { + _model = &VpcdnsResolverVPCPatchVPCIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VpcdnsResolverVPCPatchVPCIdentityByHref) isaVpcdnsResolverVPCPatch() bool { + return true +} + +// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByHref unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByHref from the specified map of raw messages. +func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverVPCPatchVPCIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverVPCPatchVPCIdentityByID : VpcdnsResolverVPCPatchVPCIdentityByID struct +// This model "extends" VpcdnsResolverVPCPatch +type VpcdnsResolverVPCPatchVPCIdentityByID struct { + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` +} + +// NewVpcdnsResolverVPCPatchVPCIdentityByID : Instantiate VpcdnsResolverVPCPatchVPCIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByID(id string) (_model *VpcdnsResolverVPCPatchVPCIdentityByID, err error) { + _model = &VpcdnsResolverVPCPatchVPCIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VpcdnsResolverVPCPatchVPCIdentityByID) isaVpcdnsResolverVPCPatch() bool { + return true +} + +// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByID unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByID from the specified map of raw messages. +func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverVPCPatchVPCIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPCIdentityByCRN : VPCIdentityByCRN struct // This model "extends" VPCIdentity type VPCIdentityByCRN struct { @@ -99196,333 +101473,9 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtua return } -// VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext -type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity 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 (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { - return true -} - -type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityIntf interface { - VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextIntf - isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool -} - -func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity unmarshals an instance of VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext : The virtual network interface for this target. -// This model "extends" VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext -type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext 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`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. - 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 - // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // same subnet as the primary IP. - // - // If reserved IP identities are provided, the specified reserved IPs must be unbound. - // - // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network - // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet - // will be automatically selected and reserved. - Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are - // reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the virtual network interface. May be either a - // reserved IP identity, or a reserved IP prototype object which will be used to create a - // new reserved IP. - // - // If a reserved IP identity is provided, the specified reserved IP must be unbound. - // - // If a reserved IP prototype object with an address is provided, the address must be - // available on the virtual network interface's subnet. If no address is specified, - // an available address on the subnet will be automatically selected and reserved. - PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. Required if `primary_ip` does not specify a reserved IP and - // `primary_ip.address` is not specified. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` -} - -func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext unmarshals an instance of VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext -type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity 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 (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { - return true -} - -type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityIntf interface { - VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextIntf - isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool -} - -func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity unmarshals an instance of VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext : The virtual network interface for this target. -// This model "extends" VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext -type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext 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`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. - 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 - // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // same subnet as the primary IP. - // - // If reserved IP identities are provided, the specified reserved IPs must be unbound. - // - // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network - // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet - // will be automatically selected and reserved. - Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are - // reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the virtual network interface. May be either a - // reserved IP identity, or a reserved IP prototype object which will be used to create a - // new reserved IP. - // - // If a reserved IP identity is provided, the specified reserved IP must be unbound. - // - // If a reserved IP prototype object with an address is provided, the address must be - // available on the virtual network interface's subnet. If no address is specified, - // an available address on the subnet will be automatically selected and reserved. - PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. Required if `primary_ip` does not specify a reserved IP and - // `primary_ip.address` is not specified. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` -} - -func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext unmarshals an instance of VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfacePrototypeTargetContext) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct // This model "extends" VirtualNetworkInterfaceTarget type VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted `json:"deleted,omitempty"` - // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` @@ -99550,10 +101503,6 @@ func (*VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVir // 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.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -99577,10 +101526,6 @@ func UnmarshalVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentRefer // VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct // This model "extends" VirtualNetworkInterfaceTarget type VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted `json:"deleted,omitempty"` - // The URL for this instance network attachment. Href *string `json:"href" validate:"required"` @@ -99607,10 +101552,6 @@ func (*VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNet // 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.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -100225,6 +102166,111 @@ func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{ return } +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // EndpointGatewayReservedIPReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityByHref struct // This model "extends" EndpointGatewayReservedIPReservedIPIdentity type EndpointGatewayReservedIPReservedIPIdentityByHref struct { @@ -101971,6 +104017,111 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScaleProtot return } +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct // This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { @@ -107396,216 +109547,6 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtual return } -// VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity -type VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct // This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct { @@ -108270,6 +110211,91 @@ func (pager *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err er return pager.GetAllWithContext(context.Background()) } +// VPCDnsResolutionBindingsPager can be used to simplify the use of the "ListVPCDnsResolutionBindings" method. +type VPCDnsResolutionBindingsPager struct { + hasNext bool + options *ListVPCDnsResolutionBindingsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCDnsResolutionBindingsPager returns a new VPCDnsResolutionBindingsPager instance. +func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolutionBindingsOptions) (pager *VPCDnsResolutionBindingsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCDnsResolutionBindingsOptions = *options + pager = &VPCDnsResolutionBindingsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCDnsResolutionBindingsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Context) (page []VpcdnsResolutionBinding, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCDnsResolutionBindingsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.DnsResolutionBindings + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Context) (allItems []VpcdnsResolutionBinding, err error) { + for pager.HasNext() { + var nextPage []VpcdnsResolutionBinding + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCDnsResolutionBindingsPager) GetNext() (page []VpcdnsResolutionBinding, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCDnsResolutionBindingsPager) GetAll() (allItems []VpcdnsResolutionBinding, err error) { + return pager.GetAllWithContext(context.Background()) +} + // VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. type VPCRoutesPager struct { hasNext bool diff --git a/ibm/service/vpc/data_source_ibm_is_bare_metal_servers.go b/ibm/service/vpc/data_source_ibm_is_bare_metal_servers.go index b659a318b2..8f7bbb8d8a 100644 --- a/ibm/service/vpc/data_source_ibm_is_bare_metal_servers.go +++ b/ibm/service/vpc/data_source_ibm_is_bare_metal_servers.go @@ -485,18 +485,18 @@ func dataSourceIBMISBareMetalServersRead(context context.Context, d *schema.Reso vpcCrn := vpcCrnIntf.(string) listBareMetalServersOptions.VPCCRN = &vpcCrn } - if subnetIntf, ok := d.GetOk("network_interfaces_subnet"); ok { - subnetId := subnetIntf.(string) - listBareMetalServersOptions.NetworkInterfacesSubnetID = &subnetId - } - if subnetNameIntf, ok := d.GetOk("network_interfaces_subnet_name"); ok { - subnetName := subnetNameIntf.(string) - listBareMetalServersOptions.NetworkInterfacesSubnetName = &subnetName - } - if subnetCrnIntf, ok := d.GetOk("network_interfaces_subnet_crn"); ok { - subnetCrn := subnetCrnIntf.(string) - listBareMetalServersOptions.NetworkInterfacesSubnetCRN = &subnetCrn - } + // if subnetIntf, ok := d.GetOk("network_interfaces_subnet"); ok { + // // subnetId := subnetIntf.(string) + // // listBareMetalServersOptions.NetworkInterfacesSubnetID = &subnetId + // } + // if subnetNameIntf, ok := d.GetOk("network_interfaces_subnet_name"); ok { + // // subnetName := subnetNameIntf.(string) + // // listBareMetalServersOptions.NetworkInterfacesSubnetName = &subnetName + // } + // if subnetCrnIntf, ok := d.GetOk("network_interfaces_subnet_crn"); ok { + // // subnetCrn := subnetCrnIntf.(string) + // // listBareMetalServersOptions.NetworkInterfacesSubnetCRN = &subnetCrn + // } for { if start != "" { 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 0da8b036af..f397ff7ad6 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 @@ -443,12 +443,12 @@ func dataSourceShareTargetVNIToMap(VNIItem vpcv1.VirtualNetworkInterfaceReferenc if VNIItem.CRN != nil { subnetMap["crn"] = VNIItem.CRN } - if VNIItem.Deleted != nil { - deletedList := []map[string]interface{}{} - deletedMap := dataSourceShareTargetVNIDeletedToMap(*VNIItem.Deleted) - deletedList = append(deletedList, deletedMap) - subnetMap["deleted"] = deletedList - } + // if VNIItem.Deleted != nil { + // deletedList := []map[string]interface{}{} + // deletedMap := dataSourceShareTargetVNIDeletedToMap(*VNIItem.Deleted) + // deletedList = append(deletedList, deletedMap) + // subnetMap["deleted"] = deletedList + // } if VNIItem.Href != nil { subnetMap["href"] = VNIItem.Href } @@ -466,12 +466,12 @@ func dataSourceShareTargetVNIToMap(VNIItem vpcv1.VirtualNetworkInterfaceReferenc return subnetMap } -func dataSourceShareTargetVNIDeletedToMap(deletedItem vpcv1.VirtualNetworkInterfaceReferenceAttachmentContextDeleted) (deletedMap map[string]interface{}) { - deletedMap = map[string]interface{}{} +// func dataSourceShareTargetVNIDeletedToMap(deletedItem vpcv1.VirtualNetworkInterfaceReferenceAttachmentContextDeleted) (deletedMap map[string]interface{}) { +// deletedMap = map[string]interface{}{} - if deletedItem.MoreInfo != nil { - deletedMap["more_info"] = deletedItem.MoreInfo - } +// if deletedItem.MoreInfo != nil { +// deletedMap["more_info"] = deletedItem.MoreInfo +// } - return deletedMap -} +// return deletedMap +// } 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 c723dd3338..d546bea8e2 100644 --- a/ibm/service/vpc/resource_ibm_is_share_mount_target.go +++ b/ibm/service/vpc/resource_ibm_is_share_mount_target.go @@ -777,9 +777,9 @@ func ShareMountTargetMapToShareMountTargetPrototype(d *schema.ResourceData, vniM } } if resourceGroup := vniMap["resource_group"].(string); resourceGroup != "" { - vniPrototype.ResourceGroup = &vpcv1.ResourceGroupIdentity{ - ID: &resourceGroup, - } + // vniPrototype.ResourceGroup = &vpcv1.ResourceGroupIdentity{ + // ID: &resourceGroup, + // } } if secGrpIntf, ok := vniMap["security_groups"]; ok { secGrpSet := secGrpIntf.(*schema.Set) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go index 90c7283a37..5149e100d6 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go @@ -977,13 +977,13 @@ func resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMount func resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextToMap(model *vpcv1.VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) - if model.Deleted != nil { - deletedMap, err := resourceIBMIsVirtualNetworkInterfaceInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeletedToMap(model.Deleted) - if err != nil { - return modelMap, err - } - modelMap["deleted"] = []map[string]interface{}{deletedMap} - } + // if model.Deleted != nil { + // deletedMap, err := resourceIBMIsVirtualNetworkInterfaceInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeletedToMap(model.Deleted) + // if err != nil { + // return modelMap, err + // } + // modelMap["deleted"] = []map[string]interface{}{deletedMap} + // } modelMap["href"] = model.Href modelMap["id"] = model.ID modelMap["name"] = model.Name @@ -991,21 +991,21 @@ func resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetInstanceNe return modelMap, nil } -func resourceIBMIsVirtualNetworkInterfaceInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeletedToMap(model *vpcv1.InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - modelMap["more_info"] = model.MoreInfo - return modelMap, nil -} +// func resourceIBMIsVirtualNetworkInterfaceInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeletedToMap(model *vpcv1.InstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) (map[string]interface{}, error) { +// modelMap := make(map[string]interface{}) +// modelMap["more_info"] = model.MoreInfo +// return modelMap, nil +// } func resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextToMap(model *vpcv1.VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) - if model.Deleted != nil { - deletedMap, err := resourceIBMIsVirtualNetworkInterfaceBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeletedToMap(model.Deleted) - if err != nil { - return modelMap, err - } - modelMap["deleted"] = []map[string]interface{}{deletedMap} - } + // if model.Deleted != nil { + // deletedMap, err := resourceIBMIsVirtualNetworkInterfaceBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeletedToMap(model.Deleted) + // if err != nil { + // return modelMap, err + // } + // modelMap["deleted"] = []map[string]interface{}{deletedMap} + // } modelMap["href"] = model.Href modelMap["id"] = model.ID modelMap["name"] = model.Name @@ -1013,11 +1013,11 @@ func resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetBareMetalS return modelMap, nil } -func resourceIBMIsVirtualNetworkInterfaceBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeletedToMap(model *vpcv1.BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - modelMap["more_info"] = model.MoreInfo - return modelMap, nil -} +// func resourceIBMIsVirtualNetworkInterfaceBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeletedToMap(model *vpcv1.BareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextDeleted) (map[string]interface{}, error) { +// modelMap := make(map[string]interface{}) +// modelMap["more_info"] = model.MoreInfo +// return modelMap, nil +// } func resourceIBMIsVirtualNetworkInterfaceVPCReferenceToMap(model *vpcv1.VPCReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) From 57ad9479f6ef5831660885029d8253ffa546a3af Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 27 Sep 2023 11:46:07 +0530 Subject: [PATCH 009/132] update sdk --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 16197 ++++++++-------- examples/ibm-is-ng/main.tf | 101 +- go.sum | 2 - 3 files changed, 8157 insertions(+), 8143 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 7919f366c8..3185b0f1f7 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 @@ -39,7 +39,6 @@ import ( // server instances, along with subnets, volumes, load balancers, and more. // // API Version: 2022-09-13 - const ( YYYYMMDD = "2006-01-02" ) @@ -52,7 +51,7 @@ type VpcV1 struct { generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-09-25`. + // and `2023-09-27`. Version *string } @@ -69,7 +68,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-09-25`. + // and `2023-09-27`. Version *string } @@ -191,77 +190,6 @@ func (vpc *VpcV1) DisableRetries() { vpc.Service.DisableRetries() } -// ListVpcs : List all VPCs -// This request lists all VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical -// isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC -// can contain resources in multiple zones in a region. -func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { - return vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) -} - -// ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter -func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listVpcsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVpcsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) - } - if listVpcsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVpcsOptions.Limit)) - } - if listVpcsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVpcsOptions.ResourceGroupID)) - } - if listVpcsOptions.ClassicAccess != nil { - builder.AddQuery("classic_access", fmt.Sprint(*listVpcsOptions.ClassicAccess)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - // 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. @@ -342,114 +270,156 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr return } -// DeleteVPC : Delete a VPC -// This request deletes a VPC. This operation cannot be reversed. -// -// For this request to succeed: -// - Instances, subnets, public gateways, and endpoint gateways must not reside in this VPC -// - The VPC must not be providing DNS resolution for any other VPCs -// - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero -// -// All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with -// `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. -func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) +// CreateVPCAddressPrefix : Create an address prefix for a VPC +// This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way +// as a retrieved prefix, and contains the information necessary to create the new prefix. +func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) } -// 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") +// CreateVPCAddressPrefixWithContext is an alternate form of the CreateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") + err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteVPCOptions.ID, + "vpc_id": *createVPCAddressPrefixOptions.VPCID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteVPCOptions.Headers { + for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteVPCOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCOptions.IfMatch)) - } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createVPCAddressPrefixOptions.CIDR != nil { + body["cidr"] = createVPCAddressPrefixOptions.CIDR + } + if createVPCAddressPrefixOptions.Zone != nil { + body["zone"] = createVPCAddressPrefixOptions.Zone + } + if createVPCAddressPrefixOptions.IsDefault != nil { + body["is_default"] = createVPCAddressPrefixOptions.IsDefault + } + if createVPCAddressPrefixOptions.Name != nil { + body["name"] = createVPCAddressPrefixOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + 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) { - return vpc.GetVPCWithContext(context.Background(), getVPCOptions) +// 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. +// +// # TODO: finalize topic name with docs team See [Configuring endpoint gateway DNS +// sharing](/docs/vpc?topic=vpc-hub-spoke-model) for more information. +func (vpc *VpcV1) CreateVPCDnsResolutionBinding(createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + return vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) } -// 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") +// CreateVPCDnsResolutionBindingWithContext is an alternate form of the CreateVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPCOptions, "getVPCOptions") + err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getVPCOptions.ID, + "vpc_id": *createVPCDnsResolutionBindingOptions.VPCID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPCOptions.Headers { + for headerName, headerValue := range createVPCDnsResolutionBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createVPCDnsResolutionBindingOptions.VPC != nil { + body["vpc"] = createVPCDnsResolutionBindingOptions.VPC + } + if createVPCDnsResolutionBindingOptions.Name != nil { + body["name"] = createVPCDnsResolutionBindingOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -461,7 +431,7 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { return } @@ -471,56 +441,76 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp return } -// UpdateVPC : Update a VPC -// This request updates a VPC with the information provided in a VPC patch object. The patch object is structured in the -// same way as a retrieved VPC and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) +// CreateVPCRoute : Create a route in a VPC's default routing table +// This request creates a new route in the VPC's default routing table. The route prototype object is structured in the +// same way as a retrieved route, and contains the information necessary to create the new route. The request will fail +// if the new route will cause a loop. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) } -// 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") +// CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") + err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") + err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateVPCOptions.ID, + "vpc_id": *createVPCRouteOptions.VPCID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateVPCOptions.Headers { + for headerName, headerValue := range createVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") + 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/merge-patch+json") - if updateVPCOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPCOptions.IfMatch)) - } + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) + body := make(map[string]interface{}) + if createVPCRouteOptions.Destination != nil { + body["destination"] = createVPCRouteOptions.Destination + } + if createVPCRouteOptions.Zone != nil { + body["zone"] = createVPCRouteOptions.Zone + } + if createVPCRouteOptions.Action != nil { + body["action"] = createVPCRouteOptions.Action + } + if createVPCRouteOptions.Name != nil { + body["name"] = createVPCRouteOptions.Name + } + if createVPCRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRouteOptions.NextHop + } + if createVPCRouteOptions.Priority != nil { + body["priority"] = createVPCRouteOptions.Priority + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } @@ -536,7 +526,7 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { return } @@ -546,51 +536,79 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up return } -// GetVPCDefaultNetworkACL : Retrieve a VPC's default network ACL -// This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default -// network ACL is applied to any new subnets in the VPC which do not specify a network ACL. -func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { - return vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) +// CreateVPCRoutingTable : Create a routing table for a VPC +// This request creates a routing table from a routing table prototype object. The prototype object is structured in the +// same way as a retrieved routing table, and contains the information necessary to create the new routing table. +func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) } -// 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") +// CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") + err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getVPCDefaultNetworkACLOptions.ID, + "vpc_id": *createVPCRoutingTableOptions.VPCID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_network_acl`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { + for headerName, headerValue := range createVPCRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { + body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom + } + if createVPCRoutingTableOptions.Name != nil { + body["name"] = createVPCRoutingTableOptions.Name + } + if createVPCRoutingTableOptions.RouteDirectLinkIngress != nil { + body["route_direct_link_ingress"] = createVPCRoutingTableOptions.RouteDirectLinkIngress + } + if createVPCRoutingTableOptions.RouteInternetIngress != nil { + body["route_internet_ingress"] = createVPCRoutingTableOptions.RouteInternetIngress + } + if createVPCRoutingTableOptions.RouteTransitGatewayIngress != nil { + body["route_transit_gateway_ingress"] = createVPCRoutingTableOptions.RouteTransitGatewayIngress + } + if createVPCRoutingTableOptions.RouteVPCZoneIngress != nil { + body["route_vpc_zone_ingress"] = createVPCRoutingTableOptions.RouteVPCZoneIngress + } + if createVPCRoutingTableOptions.Routes != nil { + body["routes"] = createVPCRoutingTableOptions.Routes + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -602,7 +620,7 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { return } @@ -612,52 +630,77 @@ 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) { - return vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) +// CreateVPCRoutingTableRoute : Create a route in a VPC routing table +// This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the +// same way as a retrieved VPC route and contains the information necessary to create the route. +func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) } -// 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") +// CreateVPCRoutingTableRouteWithContext is an alternate form of the CreateVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") + err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getVPCDefaultRoutingTableOptions.ID, + "vpc_id": *createVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *createVPCRoutingTableRouteOptions.RoutingTableID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_routing_table`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { + for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createVPCRoutingTableRouteOptions.Destination != nil { + body["destination"] = createVPCRoutingTableRouteOptions.Destination + } + if createVPCRoutingTableRouteOptions.Zone != nil { + body["zone"] = createVPCRoutingTableRouteOptions.Zone + } + if createVPCRoutingTableRouteOptions.Action != nil { + body["action"] = createVPCRoutingTableRouteOptions.Action + } + if createVPCRoutingTableRouteOptions.Name != nil { + body["name"] = createVPCRoutingTableRouteOptions.Name + } + if createVPCRoutingTableRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop + } + if createVPCRoutingTableRouteOptions.Priority != nil { + body["priority"] = createVPCRoutingTableRouteOptions.Priority + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -669,7 +712,7 @@ func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getV return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { return } @@ -679,45 +722,54 @@ 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) { - return vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) +// DeleteVPC : Delete a VPC +// This request deletes a VPC. This operation cannot be reversed. +// +// For this request to succeed: +// - Instances, subnets, public gateways, and endpoint gateways must not reside in this VPC +// - The VPC must not be providing DNS resolution for any other VPCs +// - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero +// +// All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with +// `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. +func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) } -// 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") +// DeleteVPCWithContext is an alternate form of the DeleteVPC method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCOptions, "deleteVPCOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") + err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getVPCDefaultSecurityGroupOptions.ID, + "id": *deleteVPCOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_security_group`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { + for headerName, headerValue := range deleteVPCOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + if deleteVPCOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -729,214 +781,274 @@ func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, get return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListVPCAddressPrefixes : List all address prefixes for a VPC -// This request lists all address pool prefixes for a VPC. -func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) +// DeleteVPCAddressPrefix : Delete an address prefix +// This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses +// from this prefix. +func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) } -// 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") +// DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") + err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCAddressPrefixesOptions.VPCID, + "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, + "id": *deleteVPCAddressPrefixOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { + for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPCAddressPrefixesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) - } - if listVPCAddressPrefixesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.Limit)) - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// CreateVPCAddressPrefix : Create an address prefix for a VPC -// This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way -// as a retrieved prefix, and contains the information necessary to create the new prefix. -func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - return vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) +// DeleteVPCDnsResolutionBinding : Delete a DNS resolution binding +// This request deletes a DNS resolution binding. This operation cannot be reversed. +// +// A DNS resolution binding for a VPC with `dns.enable_hub` set to `true` cannot be deleted. +func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) } -// 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") +// DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") + err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCAddressPrefixOptions.VPCID, + "vpc_id": *deleteVPCDnsResolutionBindingOptions.VPCID, + "id": *deleteVPCDnsResolutionBindingOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { + for headerName, headerValue := range deleteVPCDnsResolutionBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createVPCAddressPrefixOptions.CIDR != nil { - body["cidr"] = createVPCAddressPrefixOptions.CIDR - } - if createVPCAddressPrefixOptions.Zone != nil { - body["zone"] = createVPCAddressPrefixOptions.Zone - } - if createVPCAddressPrefixOptions.IsDefault != nil { - body["is_default"] = createVPCAddressPrefixOptions.IsDefault + request, err := builder.Build() + if err != nil { + return } - if createVPCAddressPrefixOptions.Name != nil { - body["name"] = createVPCAddressPrefixOptions.Name + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteVPCRoute : Delete a VPC route +// This request deletes a route. This operation cannot be reversed. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) +} + +// DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: DeleteVPCRoute") + err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") + if err != nil { + return } - _, err = builder.SetBodyContentJSON(body) + err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRouteOptions.VPCID, + "id": *deleteVPCRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { return } + for headerName, headerValue := range deleteVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteVPCRoutingTable : Delete a VPC routing table +// This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the +// VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) +} + +// DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") if err != nil { return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) - if err != nil { - return - } - response.Result = result + err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRoutingTableOptions.VPCID, + "id": *deleteVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteVPCRoutingTableOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCRoutingTableOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return } + response, err = vpc.Service.Request(request, nil) + return } -// DeleteVPCAddressPrefix : Delete an address prefix -// This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses -// from this prefix. -func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) +// DeleteVPCRoutingTableRoute : Delete a VPC routing table route +// This request deletes a VPC route. This operation cannot be reversed. Only VPC routes with an `origin` of `user` are +// allowed to be deleted. +func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) } -// DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") +// DeleteVPCRoutingTableRouteWithContext is an alternate form of the DeleteVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") + err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, - "id": *deleteVPCAddressPrefixOptions.ID, + "vpc_id": *deleteVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *deleteVPCRoutingTableRouteOptions.RoutingTableID, + "id": *deleteVPCRoutingTableRouteOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { + for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -956,41 +1068,40 @@ func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteV return } -// GetVPCAddressPrefix : Retrieve an address prefix -// This request retrieves a single prefix specified by the identifier in the URL. -func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - return vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) +// GetVPC : Retrieve a VPC +// This request retrieves a single VPC specified by the identifier in the URL. +func (vpc *VpcV1) GetVPC(getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.GetVPCWithContext(context.Background(), getVPCOptions) } -// GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") +// GetVPCWithContext is an alternate form of the GetVPC method which supports a Context parameter +func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCOptions, "getVPCOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") + err = core.ValidateStruct(getVPCOptions, "getVPCOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCAddressPrefixOptions.VPCID, - "id": *getVPCAddressPrefixOptions.ID, + "id": *getVPCOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { + for headerName, headerValue := range getVPCOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1012,7 +1123,7 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { return } @@ -1022,30 +1133,29 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr return } -// UpdateVPCAddressPrefix : Update an address prefix -// This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured -// in the same way as a retrieved prefix and contains only the information to be updated. -func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) +// GetVPCAddressPrefix : Retrieve an address prefix +// This request retrieves a single prefix specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) } -// UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") +// GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") + err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCAddressPrefixOptions.VPCID, - "id": *updateVPCAddressPrefixOptions.ID, + "vpc_id": *getVPCAddressPrefixOptions.VPCID, + "id": *getVPCAddressPrefixOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) @@ -1053,27 +1163,21 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV return } - for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { + for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateVPCAddressPrefixOptions.AddressPrefixPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -1095,55 +1199,41 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV return } -// ListVPCDnsResolutionBindings : List all DNS resolution bindings for a VPC -// This request lists all DNS resolution bindings for a VPC. A DNS resolution binding represents an association with -// another VPC for centralizing DNS name resolution. -// -// If the VPC specified by the identifier in the URL is a DNS hub VPC (has `dns.enable_hub` set to `true`) then there is -// one binding for each VPC bound to the hub VPC. The endpoint gateways in the bound VPCs can allow (using -// `allow_dns_resolution_binding`) the hub VPC to centralize resolution of their DNS names. -// -// If the VPC specified by the identifier in the URL is not a DNS hub VPC, then there is at most one binding (to a hub -// VPC). The endpoint gateways in the VPC specified by the identifier in the URL can allow (using -// `allow_dns_resolution_binding`) its hub VPC to centralize resolution of their DNS names. -// -// To make use of centralized DNS resolution, a VPC bound to a DNS hub VPC must delegate DNS resolution to its hub VPC -// by setting `dns.resolver.type` to `delegate`. -// -// The bindings will be sorted by their `created_at` property values, with newest bindings first. Bindings with -// identical `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListVPCDnsResolutionBindings(listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) +// GetVPCDefaultNetworkACL : Retrieve a VPC's default network ACL +// This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default +// network ACL is applied to any new subnets in the VPC which do not specify a network ACL. +func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) } -// ListVPCDnsResolutionBindingsWithContext is an alternate form of the ListVPCDnsResolutionBindings method which supports a Context parameter -func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions cannot be nil") +// GetVPCDefaultNetworkACLWithContext is an alternate form of the GetVPCDefaultNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") + err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCDnsResolutionBindingsOptions.VPCID, + "id": *getVPCDefaultNetworkACLOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_network_acl`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPCDnsResolutionBindingsOptions.Headers { + for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1153,27 +1243,6 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPCDnsResolutionBindingsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Sort)) - } - if listVPCDnsResolutionBindingsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Start)) - } - if listVPCDnsResolutionBindingsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Limit)) - } - if listVPCDnsResolutionBindingsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Name)) - } - if listVPCDnsResolutionBindingsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCCRN)) - } - if listVPCDnsResolutionBindingsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCName)) - } - if listVPCDnsResolutionBindingsOptions.AccountID != nil { - builder.AddQuery("account.id", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.AccountID)) - } request, err := builder.Build() if err != nil { @@ -1186,7 +1255,7 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBindingCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) if err != nil { return } @@ -1196,71 +1265,52 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l return } -// CreateVPCDnsResolutionBinding : Create a DNS resolution binding -// This request creates a new DNS resolution binding from a DNS resolution binding prototype object. The prototype -// object is structured in the same way as a retrieved DNS resolution binding, and contains the information necessary to -// create the new DNS resolution binding. -// -// For this request to succeed, `dns.enable_hub` must be `false` for the VPC specified by the identifier in the URL, and -// the VPC must not already have a DNS resolution binding. -// -// # TODO: finalize topic name with docs team See [Configuring endpoint gateway DNS -// sharing](/docs/vpc?topic=vpc-hub-spoke-model) for more information. -func (vpc *VpcV1) CreateVPCDnsResolutionBinding(createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - return vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) +// GetVPCDefaultRoutingTable : Retrieve a VPC's default routing table +// This request retrieves the default routing table for the VPC specified by the identifier in the URL. The default +// routing table is associated with any subnets in the VPC which have not been explicitly associated with another +// routing table. +func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) } -// CreateVPCDnsResolutionBindingWithContext is an alternate form of the CreateVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions cannot be nil") +// GetVPCDefaultRoutingTableWithContext is an alternate form of the GetVPCDefaultRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") + err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCDnsResolutionBindingOptions.VPCID, + "id": *getVPCDefaultRoutingTableOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_routing_table`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createVPCDnsResolutionBindingOptions.Headers { + for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCDnsResolutionBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createVPCDnsResolutionBindingOptions.VPC != nil { - body["vpc"] = createVPCDnsResolutionBindingOptions.VPC - } - if createVPCDnsResolutionBindingOptions.Name != nil { - body["name"] = createVPCDnsResolutionBindingOptions.Name - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -1272,7 +1322,7 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) if err != nil { return } @@ -1282,46 +1332,45 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, return } -// DeleteVPCDnsResolutionBinding : Delete a DNS resolution binding -// This request deletes a DNS resolution binding. This operation cannot be reversed. -// -// A DNS resolution binding for a VPC with `dns.enable_hub` set to `true` cannot be deleted. -func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) +// GetVPCDefaultSecurityGroup : Retrieve a VPC's default security group +// This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources +// created in this VPC that allow a security group to be optionally specified will use this security group by default. +func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) } -// DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") +// GetVPCDefaultSecurityGroupWithContext is an alternate form of the GetVPCDefaultSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") + err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCDnsResolutionBindingOptions.VPCID, - "id": *deleteVPCDnsResolutionBindingOptions.ID, + "id": *getVPCDefaultSecurityGroupOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_security_group`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteVPCDnsResolutionBindingOptions.Headers { + for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -1333,7 +1382,18 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) + if err != nil { + return + } + response.Result = result + } return } @@ -1404,59 +1464,54 @@ func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, get return } -// UpdateVPCDnsResolutionBinding : Update a DNS resolution binding -// This request updates a DNS resolution binding with the information in a provided DNS resolution binding patch. The -// DNS resolution binding patch object is structured in the same way as a retrieved DNS resolution binding and contains -// only the information to be updated. -func (vpc *VpcV1) UpdateVPCDnsResolutionBinding(updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) +// GetVPCRoute : Retrieve a VPC route +// This request retrieves a single route specified by the identifier in the URL. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) } -// UpdateVPCDnsResolutionBindingWithContext is an alternate form of the UpdateVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions cannot be nil") +// GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") + err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") + err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCDnsResolutionBindingOptions.VPCID, - "id": *updateVPCDnsResolutionBindingOptions.ID, + "vpc_id": *getVPCRouteOptions.VPCID, + "id": *getVPCRouteOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateVPCDnsResolutionBindingOptions.Headers { + for headerName, headerValue := range getVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCDnsResolutionBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -1468,7 +1523,7 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { return } @@ -1478,45 +1533,41 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, return } -// ListVPCRoutes : List all routes in a VPC's default routing table -// This request lists all routes in the VPC's default routing table. Each route is zone-specific and directs any packets -// matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's -// destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { - return vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) +// GetVPCRoutingTable : Retrieve a VPC routing table +// This request retrieves a single routing table specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) } -// ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") - err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") +// GetVPCRoutingTableWithContext is an alternate form of the GetVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableOptions, "getVPCRoutingTableOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") + err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutesOptions.VPCID, + "vpc_id": *getVPCRoutingTableOptions.VPCID, + "id": *getVPCRoutingTableOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPCRoutesOptions.Headers { + for headerName, headerValue := range getVPCRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1526,15 +1577,6 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPCRoutesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) - } - if listVPCRoutesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutesOptions.Start)) - } - if listVPCRoutesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -1547,7 +1589,7 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollectionVPCContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { return } @@ -1557,80 +1599,52 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt return } -// CreateVPCRoute : Create a route in a VPC's default routing table -// This request creates a new route in the VPC's default routing table. The route prototype object is structured in the -// same way as a retrieved route, and contains the information necessary to create the new route. The request will fail -// if the new route will cause a loop. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) +// GetVPCRoutingTableRoute : Retrieve a VPC routing table route +// This request retrieves a single VPC route specified by the identifier in the URL path. +func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) } -// CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") - err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") +// GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") + err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCRouteOptions.VPCID, + "vpc_id": *getVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *getVPCRoutingTableRouteOptions.RoutingTableID, + "id": *getVPCRoutingTableRouteOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createVPCRouteOptions.Headers { + for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createVPCRouteOptions.Destination != nil { - body["destination"] = createVPCRouteOptions.Destination - } - if createVPCRouteOptions.Zone != nil { - body["zone"] = createVPCRouteOptions.Zone - } - if createVPCRouteOptions.Action != nil { - body["action"] = createVPCRouteOptions.Action - } - if createVPCRouteOptions.Name != nil { - body["name"] = createVPCRouteOptions.Name - } - if createVPCRouteOptions.NextHop != nil { - body["next_hop"] = createVPCRouteOptions.NextHop - } - if createVPCRouteOptions.Priority != nil { - body["priority"] = createVPCRouteOptions.Priority - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -1652,101 +1666,126 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO return } -// DeleteVPCRoute : Delete a VPC route -// This request deletes a route. This operation cannot be reversed. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) +// ListVPCAddressPrefixes : List all address prefixes for a VPC +// This request lists all address pool prefixes for a VPC. +func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) } -// DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: DeleteVPCRoute") - err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") +// ListVPCAddressPrefixesWithContext is an alternate form of the ListVPCAddressPrefixes method which supports a Context parameter +func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") + err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRouteOptions.VPCID, - "id": *deleteVPCRouteOptions.ID, + "vpc_id": *listVPCAddressPrefixesOptions.VPCID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteVPCRouteOptions.Headers { + for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCAddressPrefixesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) + } + if listVPCAddressPrefixesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.Limit)) + } request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetVPCRoute : Retrieve a VPC route -// This request retrieves a single route specified by the identifier in the URL. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) +// ListVPCDnsResolutionBindings : List all DNS resolution bindings for a VPC +// This request lists all DNS resolution bindings for a VPC. A DNS resolution binding represents an association with +// another VPC for centralizing DNS name resolution. +// +// If the VPC specified by the identifier in the URL is a DNS hub VPC (has `dns.enable_hub` set to `true`) then there is +// one binding for each VPC bound to the hub VPC. The endpoint gateways in the bound VPCs can allow (using +// `allow_dns_resolution_binding`) the hub VPC to centralize resolution of their DNS names. +// +// If the VPC specified by the identifier in the URL is not a DNS hub VPC, then there is at most one binding (to a hub +// VPC). The endpoint gateways in the VPC specified by the identifier in the URL can allow (using +// `allow_dns_resolution_binding`) its hub VPC to centralize resolution of their DNS names. +// +// To make use of centralized DNS resolution, a VPC bound to a DNS hub VPC must delegate DNS resolution to its hub VPC +// by setting `dns.resolver.type` to `delegate`. +// +// The bindings will be sorted by their `created_at` property values, with newest bindings first. Bindings with +// identical `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListVPCDnsResolutionBindings(listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) } -// GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") - err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") +// ListVPCDnsResolutionBindingsWithContext is an alternate form of the ListVPCDnsResolutionBindings method which supports a Context parameter +func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") + err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCRouteOptions.VPCID, - "id": *getVPCRouteOptions.ID, + "vpc_id": *listVPCDnsResolutionBindingsOptions.VPCID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPCRouteOptions.Headers { + for headerName, headerValue := range listVPCDnsResolutionBindingsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1756,6 +1795,27 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCDnsResolutionBindingsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Sort)) + } + if listVPCDnsResolutionBindingsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Start)) + } + if listVPCDnsResolutionBindingsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Limit)) + } + if listVPCDnsResolutionBindingsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Name)) + } + if listVPCDnsResolutionBindingsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCCRN)) + } + if listVPCDnsResolutionBindingsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCName)) + } + if listVPCDnsResolutionBindingsOptions.AccountID != nil { + builder.AddQuery("account.id", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.AccountID)) + } request, err := builder.Build() if err != nil { @@ -1768,7 +1828,7 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBindingCollection) if err != nil { return } @@ -1778,59 +1838,62 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions return } -// UpdateVPCRoute : Update a VPC route -// This request updates a route with the information in a provided route patch. The route patch object is structured in -// the same way as a retrieved route and contains only the information to be updated. +// ListVPCRoutes : List all routes in a VPC's default routing table +// This request lists all routes in the VPC's default routing table. Each route is zone-specific and directs any packets +// matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's +// destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. // Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) +func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) } -// UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter +// ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter // Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") - err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") +func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") + err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") + err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRouteOptions.VPCID, - "id": *updateVPCRouteOptions.ID, + "vpc_id": *listVPCRoutesOptions.VPCID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateVPCRouteOptions.Headers { + for headerName, headerValue := range listVPCRoutesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPCRouteOptions.RoutePatch) - if err != nil { - return + if listVPCRoutesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) + } + if listVPCRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutesOptions.Start)) + } + if listVPCRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutesOptions.Limit)) } request, err := builder.Build() @@ -1844,7 +1907,7 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollectionVPCContext) if err != nil { return } @@ -1854,43 +1917,45 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO return } -// ListVPCRoutingTables : List all routing tables for a VPC -// This request lists all routing tables for a VPC. Each subnet in a VPC is associated with a routing table, which -// controls delivery of packets sent on that subnet according to the action of the most specific matching route in the -// table. If multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, -// delivery will be controlled by the system's built-in routes. -func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) +// ListVPCRoutingTableRoutes : List all routes in a VPC routing table +// This request lists all routes in a VPC routing table. If subnets are associated with this routing table, delivery of +// packets sent on a subnet is performed according to the action of the most specific matching route in the table +// (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, the route with the +// highest priority will be used. If two matching routes have the same destination and priority, traffic will be +// distributed between them. If no routes match, delivery will be controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) } -// ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter -func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") +// ListVPCRoutingTableRoutesWithContext is an alternate form of the ListVPCRoutingTableRoutes method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") + err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutingTablesOptions.VPCID, + "vpc_id": *listVPCRoutingTableRoutesOptions.VPCID, + "routing_table_id": *listVPCRoutingTableRoutesOptions.RoutingTableID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { + for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1900,14 +1965,11 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPCRoutingTablesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) - } - if listVPCRoutingTablesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTablesOptions.Limit)) + if listVPCRoutingTableRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) } - if listVPCRoutingTablesOptions.IsDefault != nil { - builder.AddQuery("is_default", fmt.Sprint(*listVPCRoutingTablesOptions.IsDefault)) + if listVPCRoutingTableRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Limit)) } request, err := builder.Build() @@ -1921,7 +1983,7 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) if err != nil { return } @@ -1931,29 +1993,31 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo return } -// CreateVPCRoutingTable : Create a routing table for a VPC -// This request creates a routing table from a routing table prototype object. The prototype object is structured in the -// same way as a retrieved routing table, and contains the information necessary to create the new routing table. -func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) +// ListVPCRoutingTables : List all routing tables for a VPC +// This request lists all routing tables for a VPC. Each subnet in a VPC is associated with a routing table, which +// controls delivery of packets sent on that subnet according to the action of the most specific matching route in the +// table. If multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, +// delivery will be controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) } -// CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") +// ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") + err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCRoutingTableOptions.VPCID, + "vpc_id": *listVPCRoutingTablesOptions.VPCID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) @@ -1961,47 +2025,28 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP return } - for headerName, headerValue := range createVPCRoutingTableOptions.Headers { + for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { - body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom - } - if createVPCRoutingTableOptions.Name != nil { - body["name"] = createVPCRoutingTableOptions.Name - } - if createVPCRoutingTableOptions.RouteDirectLinkIngress != nil { - body["route_direct_link_ingress"] = createVPCRoutingTableOptions.RouteDirectLinkIngress - } - if createVPCRoutingTableOptions.RouteInternetIngress != nil { - body["route_internet_ingress"] = createVPCRoutingTableOptions.RouteInternetIngress - } - if createVPCRoutingTableOptions.RouteTransitGatewayIngress != nil { - body["route_transit_gateway_ingress"] = createVPCRoutingTableOptions.RouteTransitGatewayIngress - } - if createVPCRoutingTableOptions.RouteVPCZoneIngress != nil { - body["route_vpc_zone_ingress"] = createVPCRoutingTableOptions.RouteVPCZoneIngress + if listVPCRoutingTablesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) } - if createVPCRoutingTableOptions.Routes != nil { - body["routes"] = createVPCRoutingTableOptions.Routes + if listVPCRoutingTablesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTablesOptions.Limit)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return + if listVPCRoutingTablesOptions.IsDefault != nil { + builder.AddQuery("is_default", fmt.Sprint(*listVPCRoutingTablesOptions.IsDefault)) } request, err := builder.Build() @@ -2015,7 +2060,7 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) if err != nil { return } @@ -2025,109 +2070,131 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP return } -// DeleteVPCRoutingTable : Delete a VPC routing table -// This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the -// VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. -func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) +// ListVpcs : List all VPCs +// This request lists all VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical +// isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC +// can contain resources in multiple zones in a region. +func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + return vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) } -// DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") +// ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter +func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRoutingTableOptions.VPCID, - "id": *deleteVPCRoutingTableOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) if err != nil { return } - for headerName, headerValue := range deleteVPCRoutingTableOptions.Headers { + for headerName, headerValue := range listVpcsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteVPCRoutingTableOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCRoutingTableOptions.IfMatch)) - } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVpcsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) + } + if listVpcsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVpcsOptions.Limit)) + } + if listVpcsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVpcsOptions.ResourceGroupID)) + } + if listVpcsOptions.ClassicAccess != nil { + builder.AddQuery("classic_access", fmt.Sprint(*listVpcsOptions.ClassicAccess)) + } request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetVPCRoutingTable : Retrieve a VPC routing table -// This request retrieves a single routing table specified by the identifier in the URL. -func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) +// UpdateVPC : Update a VPC +// This request updates a VPC with the information provided in a VPC patch object. The patch object is structured in the +// same way as a retrieved VPC and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) } -// 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") +// UpdateVPCWithContext is an alternate form of the UpdateVPC method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCOptions, "updateVPCOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") + err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCRoutingTableOptions.VPCID, - "id": *getVPCRoutingTableOptions.ID, + "id": *updateVPCOptions.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, `/vpcs/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPCRoutingTableOptions.Headers { + for headerName, headerValue := range updateVPCOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -2139,7 +2206,7 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { return } @@ -2149,57 +2216,54 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti return } -// UpdateVPCRoutingTable : Update a VPC routing table -// This request updates a routing table with the information in a provided routing table patch. The patch object is -// structured in the same way as a retrieved table and contains only the information to be updated. -func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) +// UpdateVPCAddressPrefix : Update an address prefix +// This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured +// in the same way as a retrieved prefix and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) } -// 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") +// UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") + err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRoutingTableOptions.VPCID, - "id": *updateVPCRoutingTableOptions.ID, + "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}/routing_tables/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { + for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") + 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") - if updateVPCRoutingTableOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPCRoutingTableOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) + _, err = builder.SetBodyContentJSON(updateVPCAddressPrefixOptions.AddressPrefixPatch) if err != nil { return } @@ -2215,7 +2279,7 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) if err != nil { return } @@ -2225,59 +2289,57 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP return } -// ListVPCRoutingTableRoutes : List all routes in a VPC routing table -// This request lists all routes in a VPC routing table. If subnets are associated with this routing table, delivery of -// packets sent on a subnet is performed according to the action of the most specific matching route in the table -// (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, the route with the -// highest priority will be used. If two matching routes have the same destination and priority, traffic will be -// distributed between them. If no routes match, delivery will be controlled by the system's built-in routes. -func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) +// UpdateVPCDnsResolutionBinding : Update a DNS resolution binding +// This request updates a DNS resolution binding with the information in a provided DNS resolution binding patch. The +// DNS resolution binding patch object is structured in the same way as a retrieved DNS resolution binding and contains +// only the information to be updated. +func (vpc *VpcV1) UpdateVPCDnsResolutionBinding(updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) } -// 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") +// UpdateVPCDnsResolutionBindingWithContext is an alternate form of the UpdateVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") + err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutingTableRoutesOptions.VPCID, - "routing_table_id": *listVPCRoutingTableRoutesOptions.RoutingTableID, + "vpc_id": *updateVPCDnsResolutionBindingOptions.VPCID, + "id": *updateVPCDnsResolutionBindingOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { + for headerName, headerValue := range updateVPCDnsResolutionBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPCRoutingTableRoutesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) - } - if listVPCRoutingTableRoutesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) + if err != nil { + return } request, err := builder.Build() @@ -2291,7 +2353,7 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { return } @@ -2301,73 +2363,57 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list return } -// CreateVPCRoutingTableRoute : Create a route in a VPC routing table -// This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the -// same way as a retrieved VPC route and contains the information necessary to create the route. -func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) +// UpdateVPCRoute : Update a VPC route +// This request updates a route with the information in a provided route patch. The route patch object is structured in +// the same way as a retrieved route and contains only the information to be updated. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) } -// 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") +// UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") + err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") + err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *createVPCRoutingTableRouteOptions.RoutingTableID, + "vpc_id": *updateVPCRouteOptions.VPCID, + "id": *updateVPCRouteOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { + for headerName, headerValue := range updateVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") + 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/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createVPCRoutingTableRouteOptions.Destination != nil { - body["destination"] = createVPCRoutingTableRouteOptions.Destination - } - if createVPCRoutingTableRouteOptions.Zone != nil { - body["zone"] = createVPCRoutingTableRouteOptions.Zone - } - if createVPCRoutingTableRouteOptions.Action != nil { - body["action"] = createVPCRoutingTableRouteOptions.Action - } - if createVPCRoutingTableRouteOptions.Name != nil { - body["name"] = createVPCRoutingTableRouteOptions.Name - } - if createVPCRoutingTableRouteOptions.NextHop != nil { - body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop - } - if createVPCRoutingTableRouteOptions.Priority != nil { - body["priority"] = createVPCRoutingTableRouteOptions.Priority - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateVPCRouteOptions.RoutePatch) if err != nil { return } @@ -2393,108 +2439,61 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre return } -// DeleteVPCRoutingTableRoute : Delete a VPC routing table route -// This request deletes a VPC route. This operation cannot be reversed. Only VPC routes with an `origin` of `user` are -// allowed to be deleted. -func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) +// UpdateVPCRoutingTable : Update a VPC routing table +// This request updates a routing table with the information in a provided routing table patch. The patch object is +// structured in the same way as a retrieved table and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) } -// 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") +// UpdateVPCRoutingTableWithContext is an alternate form of the UpdateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") + err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *deleteVPCRoutingTableRouteOptions.RoutingTableID, - "id": *deleteVPCRoutingTableRouteOptions.ID, + "vpc_id": *updateVPCRoutingTableOptions.VPCID, + "id": *updateVPCRoutingTableOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { + for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetVPCRoutingTableRoute : Retrieve a VPC routing table route -// This request retrieves a single VPC route specified by the identifier in the URL path. -func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) -} - -// GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *getVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *getVPCRoutingTableRouteOptions.RoutingTableID, - "id": *getVPCRoutingTableRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) if err != nil { return } - for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() if err != nil { return @@ -2506,7 +2505,7 @@ func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPC return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { return } @@ -2591,21 +2590,26 @@ func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, upd return } -// ListSubnets : List all subnets -// This request lists all subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block -// notation. Each subnet is within a particular zone and cannot span multiple zones or regions. -func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { - return vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) +// CreateSubnet : Create a subnet +// This request creates a new subnet from a subnet prototype object. The prototype object is structured in the same way +// as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, +// the prototype's CIDR block must not overlap with an existing subnet in the VPC. +func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) } -// ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter -func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") +// CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) @@ -2613,46 +2617,25 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions return } - for headerName, headerValue := range listSubnetsOptions.Headers { + for headerName, headerValue := range createSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSubnetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) - } - if listSubnetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSubnetsOptions.Limit)) - } - if listSubnetsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) - } - if listSubnetsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listSubnetsOptions.ZoneName)) - } - if listSubnetsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listSubnetsOptions.VPCID)) - } - if listSubnetsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listSubnetsOptions.VPCCRN)) - } - if listSubnetsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listSubnetsOptions.VPCName)) - } - if listSubnetsOptions.RoutingTableID != nil { - builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) - } - if listSubnetsOptions.RoutingTableName != nil { - builder.AddQuery("routing_table.name", fmt.Sprint(*listSubnetsOptions.RoutingTableName)) + + _, err = builder.SetBodyContentJSON(createSubnetOptions.SubnetPrototype) + if err != nil { + return } request, err := builder.Build() @@ -2666,7 +2649,7 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) if err != nil { return } @@ -2676,38 +2659,41 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions return } -// CreateSubnet : Create a subnet -// This request creates a new subnet from a subnet prototype object. The prototype object is structured in the same way -// as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, -// the prototype's CIDR block must not overlap with an existing subnet in the VPC. -func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - return vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) +// CreateSubnetReservedIP : Reserve an IP in a subnet +// This request reserves an IP address in a subnet. If the provided prototype object includes an `address`, the address +// must not already be reserved. +func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) } -// CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter -func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") +// CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") + err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "subnet_id": *createSubnetReservedIPOptions.SubnetID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createSubnetOptions.Headers { + for headerName, headerValue := range createSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -2719,7 +2705,20 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createSubnetOptions.SubnetPrototype) + body := make(map[string]interface{}) + if createSubnetReservedIPOptions.Address != nil { + body["address"] = createSubnetReservedIPOptions.Address + } + if createSubnetReservedIPOptions.AutoDelete != nil { + body["auto_delete"] = createSubnetReservedIPOptions.AutoDelete + } + if createSubnetReservedIPOptions.Name != nil { + body["name"] = createSubnetReservedIPOptions.Name + } + if createSubnetReservedIPOptions.Target != nil { + body["target"] = createSubnetReservedIPOptions.Target + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } @@ -2735,7 +2734,7 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { return } @@ -2802,44 +2801,48 @@ func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptio return } -// GetSubnet : Retrieve a subnet -// This request retrieves a single subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - return vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) +// DeleteSubnetReservedIP : Delete a reserved IP +// This request releases a reserved IP. This operation cannot be reversed. +// +// For this request to succeed, the reserved IP must not be required by another resource, such as a bare metal server +// network interface, instance network interface or virtual network interface for which it is the primary IP. A +// provider-owned reserved IP is not allowed to be deleted. +func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) } -// GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter -func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") +// DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") + err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getSubnetOptions.ID, + "subnet_id": *deleteSubnetReservedIPOptions.SubnetID, + "id": *deleteSubnetReservedIPOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getSubnetOptions.Headers { + for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -2851,45 +2854,33 @@ func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *Ge return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// UpdateSubnet : Update a subnet -// This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured -// in the same way as a retrieved subnet and contains only the information to be updated. -func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - return vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) +// GetSubnet : Retrieve a subnet +// This request retrieves a single subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) } -// UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter -func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") +// GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter +func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") + err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateSubnetOptions.ID, + "id": *getSubnetOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) @@ -2897,27 +2888,21 @@ func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptio return } - for headerName, headerValue := range updateSubnetOptions.Headers { + for headerName, headerValue := range getSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateSubnetOptions.SubnetPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -3004,56 +2989,50 @@ func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetN return } -// ReplaceSubnetNetworkACL : Replace the network ACL for a subnet -// This request replaces the existing network ACL for a subnet with the network ACL specified in the request body. -func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - return vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) +// GetSubnetPublicGateway : Retrieve a subnet's attached public gateway +// This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) } -// ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter -func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") +// GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") + err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *replaceSubnetNetworkACLOptions.ID, + "id": *getSubnetPublicGatewayOptions.ID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { + for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(replaceSubnetNetworkACLOptions.NetworkACLIdentity) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -3065,7 +3044,7 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { return } @@ -3075,43 +3054,45 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac return } -// UnsetSubnetPublicGateway : Detach a public gateway from a subnet -// This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. -func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { - return vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) +// GetSubnetReservedIP : Retrieve a reserved IP +// This request retrieves a single reserved IP specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) } -// UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") +// GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") + err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *unsetSubnetPublicGatewayOptions.ID, + "subnet_id": *getSubnetReservedIPOptions.SubnetID, + "id": *getSubnetReservedIPOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { + for headerName, headerValue := range getSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -3123,45 +3104,56 @@ 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 { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } return } -// GetSubnetPublicGateway : Retrieve a subnet's attached public gateway -// This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - return vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) +// GetSubnetRoutingTable : Retrieve a subnet's attached routing table +// This request retrieves the routing table attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) } -// GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") +// GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") + err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getSubnetPublicGatewayOptions.ID, + "id": *getSubnetRoutingTableOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { + for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3183,7 +3175,7 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { return } @@ -3193,55 +3185,70 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn return } -// SetSubnetPublicGateway : Attach a public gateway to a subnet -// This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet -// identifier in the URL. The public gateway must have the same VPC and zone as the subnet. -func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - return vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) +// ListSubnetReservedIps : List all reserved IPs in a subnet +// This request lists all reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet +// which is not available for use. +func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + return vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) } -// SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") +// ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter +func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") + err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *setSubnetPublicGatewayOptions.ID, + "subnet_id": *listSubnetReservedIpsOptions.SubnetID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { + for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(setSubnetPublicGatewayOptions.PublicGatewayIdentity) - if err != nil { - return + if listSubnetReservedIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) + } + if listSubnetReservedIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetReservedIpsOptions.Limit)) + } + if listSubnetReservedIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) + } + if listSubnetReservedIpsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listSubnetReservedIpsOptions.TargetID)) + } + if listSubnetReservedIpsOptions.TargetCRN != nil { + builder.AddQuery("target.crn", fmt.Sprint(*listSubnetReservedIpsOptions.TargetCRN)) + } + if listSubnetReservedIpsOptions.TargetName != nil { + builder.AddQuery("target.name", fmt.Sprint(*listSubnetReservedIpsOptions.TargetName)) + } + if listSubnetReservedIpsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listSubnetReservedIpsOptions.TargetResourceType)) } request, err := builder.Build() @@ -3255,7 +3262,7 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollection) if err != nil { return } @@ -3265,40 +3272,33 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn return } -// GetSubnetRoutingTable : Retrieve a subnet's attached routing table -// This request retrieves the routing table attached to the subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) +// ListSubnets : List all subnets +// This request lists all subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block +// notation. Each subnet is within a particular zone and cannot span multiple zones or regions. +func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + return vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) } -// GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter -func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") +// ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter +func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *getSubnetRoutingTableOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) if err != nil { return } - for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { + for headerName, headerValue := range listSubnetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3308,6 +3308,33 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSubnetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) + } + if listSubnetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetsOptions.Limit)) + } + if listSubnetsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) + } + if listSubnetsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listSubnetsOptions.ZoneName)) + } + if listSubnetsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listSubnetsOptions.VPCID)) + } + if listSubnetsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listSubnetsOptions.VPCCRN)) + } + if listSubnetsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listSubnetsOptions.VPCName)) + } + if listSubnetsOptions.RoutingTableID != nil { + builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) + } + if listSubnetsOptions.RoutingTableName != nil { + builder.AddQuery("routing_table.name", fmt.Sprint(*listSubnetsOptions.RoutingTableName)) + } request, err := builder.Build() if err != nil { @@ -3320,7 +3347,7 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) if err != nil { return } @@ -3330,43 +3357,40 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne return } -// ReplaceSubnetRoutingTable : Replace the routing table for a subnet -// This request replaces the existing routing table for a subnet with the routing table specified in the request body. -// -// For this request to succeed, the routing table `route_direct_link_ingress`, -// `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. -func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) +// ReplaceSubnetNetworkACL : Replace the network ACL for a subnet +// This request replaces the existing network ACL for a subnet with the network ACL specified in the request body. +func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) } -// ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter -func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") +// ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") + err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *replaceSubnetRoutingTableOptions.ID, + "id": *replaceSubnetNetworkACLOptions.ID, } builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { + for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3378,7 +3402,7 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(replaceSubnetRoutingTableOptions.RoutingTableIdentity) + _, err = builder.SetBodyContentJSON(replaceSubnetNetworkACLOptions.NetworkACLIdentity) if err != nil { return } @@ -3394,7 +3418,7 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) if err != nil { return } @@ -3404,70 +3428,57 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl return } -// ListSubnetReservedIps : List all reserved IPs in a subnet -// This request lists all reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet -// which is not available for use. -func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { - return vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) +// ReplaceSubnetRoutingTable : Replace the routing table for a subnet +// This request replaces the existing routing table for a subnet with the routing table specified in the request body. +// +// For this request to succeed, the routing table `route_direct_link_ingress`, +// `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. +func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) } -// ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter -func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") +// ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") + err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") if err != nil { return } pathParamsMap := map[string]string{ - "subnet_id": *listSubnetReservedIpsOptions.SubnetID, + "id": *replaceSubnetRoutingTableOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { + for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSubnetReservedIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) - } - if listSubnetReservedIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSubnetReservedIpsOptions.Limit)) - } - if listSubnetReservedIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) - } - if listSubnetReservedIpsOptions.TargetID != nil { - builder.AddQuery("target.id", fmt.Sprint(*listSubnetReservedIpsOptions.TargetID)) - } - if listSubnetReservedIpsOptions.TargetCRN != nil { - builder.AddQuery("target.crn", fmt.Sprint(*listSubnetReservedIpsOptions.TargetCRN)) - } - if listSubnetReservedIpsOptions.TargetName != nil { - builder.AddQuery("target.name", fmt.Sprint(*listSubnetReservedIpsOptions.TargetName)) - } - if listSubnetReservedIpsOptions.TargetResourceType != nil { - builder.AddQuery("target.resource_type", fmt.Sprint(*listSubnetReservedIpsOptions.TargetResourceType)) + + _, err = builder.SetBodyContentJSON(replaceSubnetRoutingTableOptions.RoutingTableIdentity) + if err != nil { + return } request, err := builder.Build() @@ -3481,7 +3492,7 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { return } @@ -3491,41 +3502,41 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn return } -// CreateSubnetReservedIP : Reserve an IP in a subnet -// This request reserves an IP address in a subnet. If the provided prototype object includes an `address`, the address -// must not already be reserved. -func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) +// SetSubnetPublicGateway : Attach a public gateway to a subnet +// This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet +// identifier in the URL. The public gateway must have the same VPC and zone as the subnet. +func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) } -// CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") +// SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") + err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") if err != nil { return } pathParamsMap := map[string]string{ - "subnet_id": *createSubnetReservedIPOptions.SubnetID, + "id": *setSubnetPublicGatewayOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createSubnetReservedIPOptions.Headers { + for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3537,20 +3548,7 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createSubnetReservedIPOptions.Address != nil { - body["address"] = createSubnetReservedIPOptions.Address - } - if createSubnetReservedIPOptions.AutoDelete != nil { - body["auto_delete"] = createSubnetReservedIPOptions.AutoDelete - } - if createSubnetReservedIPOptions.Name != nil { - body["name"] = createSubnetReservedIPOptions.Name - } - if createSubnetReservedIPOptions.Target != nil { - body["target"] = createSubnetReservedIPOptions.Target - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(setSubnetPublicGatewayOptions.PublicGatewayIdentity) if err != nil { return } @@ -3566,7 +3564,7 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { return } @@ -3576,45 +3574,40 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS return } -// DeleteSubnetReservedIP : Delete a reserved IP -// This request releases a reserved IP. This operation cannot be reversed. -// -// For this request to succeed, the reserved IP must not be required by another resource, such as a bare metal server -// network interface, instance network interface or virtual network interface for which it is the primary IP. A -// provider-owned reserved IP is not allowed to be deleted. -func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) +// UnsetSubnetPublicGateway : Detach a public gateway from a subnet +// This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. +func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) } -// DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") +// UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") + err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") if err != nil { return } pathParamsMap := map[string]string{ - "subnet_id": *deleteSubnetReservedIPOptions.SubnetID, - "id": *deleteSubnetReservedIPOptions.ID, + "id": *unsetSubnetPublicGatewayOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { + for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3634,51 +3627,57 @@ func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteS return } -// GetSubnetReservedIP : Retrieve a reserved IP -// This request retrieves a single reserved IP specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) +// UpdateSubnet : Update a subnet +// This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured +// in the same way as a retrieved subnet and contains only the information to be updated. +func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) } -// GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") +// UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter +func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") + err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") if err != nil { return } pathParamsMap := map[string]string{ - "subnet_id": *getSubnetReservedIPOptions.SubnetID, - "id": *getSubnetReservedIPOptions.ID, + "id": *updateSubnetOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getSubnetReservedIPOptions.Headers { + for headerName, headerValue := range updateSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateSubnetOptions.SubnetPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -3690,7 +3689,7 @@ func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetR return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) if err != nil { return } @@ -3775,21 +3774,27 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS return } -// ListImages : List all images -// This request lists all images available in the region. An image provides source data for a volume. Images are either -// system-provided, or created from another source, such as importing from Cloud Object Storage. -func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { - return vpc.ListImagesWithContext(context.Background(), listImagesOptions) +// CreateImage : Create an image +// This request creates a new image from an image prototype object. The prototype object is structured in the same way +// as a retrieved image, and contains the information necessary to create the new image. If an image is being imported, +// a URL to the image file on object storage must be specified. If an image is being created from an existing volume, +// that volume must be specified. +func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.CreateImageWithContext(context.Background(), createImageOptions) } -// ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter -func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listImagesOptions, "listImagesOptions") +// CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter +func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createImageOptions, "createImageOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) @@ -3797,37 +3802,25 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * return } - for headerName, headerValue := range listImagesOptions.Headers { + for headerName, headerValue := range createImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listImagesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) - } - if listImagesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listImagesOptions.Limit)) - } - if listImagesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listImagesOptions.ResourceGroupID)) - } - if listImagesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) - } - if listImagesOptions.Status != nil { - builder.AddQuery("status", strings.Join(listImagesOptions.Status, ",")) - } - if listImagesOptions.Visibility != nil { - builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) + + _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) + if err != nil { + return } request, err := builder.Build() @@ -3841,7 +3834,7 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) if err != nil { return } @@ -3851,39 +3844,43 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * return } -// CreateImage : Create an image -// This request creates a new image from an image prototype object. The prototype object is structured in the same way -// as a retrieved image, and contains the information necessary to create the new image. If an image is being imported, -// a URL to the image file on object storage must be specified. If an image is being created from an existing volume, -// that volume must be specified. -func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - return vpc.CreateImageWithContext(context.Background(), createImageOptions) +// CreateImageExportJob : Create an image export job +// This request creates and queues a new export job for the image specified in the URL using the image export job +// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or +// `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains +// the information necessary to create and queue the new image export job. +func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + return vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) } -// CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter -func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") +// CreateImageExportJobWithContext is an alternate form of the CreateImageExportJob method which supports a Context parameter +func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createImageExportJobOptions, "createImageExportJobOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createImageOptions, "createImageOptions") + err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "image_id": *createImageExportJobOptions.ImageID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createImageOptions.Headers { + for headerName, headerValue := range createImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3895,7 +3892,17 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) + body := make(map[string]interface{}) + if createImageExportJobOptions.StorageBucket != nil { + body["storage_bucket"] = createImageExportJobOptions.StorageBucket + } + if createImageExportJobOptions.Format != nil { + body["format"] = createImageExportJobOptions.Format + } + if createImageExportJobOptions.Name != nil { + body["name"] = createImageExportJobOptions.Name + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } @@ -3911,7 +3918,7 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) if err != nil { return } @@ -3978,44 +3985,46 @@ func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions return } -// GetImage : Retrieve an image -// This request retrieves a single image specified by the identifier in the URL. -func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { - return vpc.GetImageWithContext(context.Background(), getImageOptions) +// DeleteImageExportJob : Delete an image export job +// This request deletes an image export job. This operation cannot be reversed. If the job has not completed, the job +// will be canceled, and the incomplete exported image object deleted. If the job has completed, the exported image +// object will not be deleted. +func (vpc *VpcV1) DeleteImageExportJob(deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) } -// 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") +// DeleteImageExportJobWithContext is an alternate form of the DeleteImageExportJob method which supports a Context parameter +func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteImageExportJobOptions, "deleteImageExportJobOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getImageOptions, "getImageOptions") + err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getImageOptions.ID, + "image_id": *deleteImageExportJobOptions.ImageID, + "id": *deleteImageExportJobOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getImageOptions.Headers { + for headerName, headerValue := range deleteImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -4027,46 +4036,97 @@ func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetI return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeprecateImage : Deprecate an image +// This request deprecates an image, resulting in its `status` becoming `deprecated` and +// `deprecation_at` being set to the current date and time. +// +// The image must: +// - have a `status` of `available` +// - have `catalog_offering.managed` set to `false` +// - not have `deprecation_at` set +// +// The image must not have `deprecation_at` set, must have `catalog_offering.managed` set to +// `false`, and must have a `status` of `available`. +// +// A system-provided image is not allowed to be deprecated. +func (vpc *VpcV1) DeprecateImage(deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { + return vpc.DeprecateImageWithContext(context.Background(), deprecateImageOptions) +} + +// DeprecateImageWithContext is an alternate form of the DeprecateImage method which supports a Context parameter +func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deprecateImageOptions, "deprecateImageOptions cannot be nil") if err != nil { return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) - if err != nil { - return - } - response.Result = result + err = core.ValidateStruct(deprecateImageOptions, "deprecateImageOptions") + if err != nil { + return } + pathParamsMap := map[string]string{ + "id": *deprecateImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/deprecate`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deprecateImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeprecateImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + return } -// UpdateImage : Update an image -// This request updates an image with the information in a provided image patch. The image patch object is structured in -// the same way as a retrieved image and contains only the information to be updated. A system-provided image is not -// allowed to be updated. An image with a `status` of `deleting` cannot be updated. -func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - return vpc.UpdateImageWithContext(context.Background(), updateImageOptions) +// GetImage : Retrieve an image +// This request retrieves a single image specified by the identifier in the URL. +func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.GetImageWithContext(context.Background(), getImageOptions) } -// 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") +// GetImageWithContext is an alternate form of the GetImage method which supports a Context parameter +func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getImageOptions, "getImageOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateImageOptions, "updateImageOptions") + err = core.ValidateStruct(getImageOptions, "getImageOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateImageOptions.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, `/images/{id}`, pathParamsMap) @@ -4074,27 +4134,21 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions return } - for headerName, headerValue := range updateImageOptions.Headers { + for headerName, headerValue := range getImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateImageOptions.ImagePatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -4116,54 +4170,45 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions return } -// DeprecateImage : Deprecate an image -// This request deprecates an image, resulting in its `status` becoming `deprecated` and -// `deprecation_at` being set to the current date and time. -// -// The image must: -// - have a `status` of `available` -// - have `catalog_offering.managed` set to `false` -// - not have `deprecation_at` set -// -// The image must not have `deprecation_at` set, must have `catalog_offering.managed` set to -// `false`, and must have a `status` of `available`. -// -// A system-provided image is not allowed to be deprecated. -func (vpc *VpcV1) DeprecateImage(deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { - return vpc.DeprecateImageWithContext(context.Background(), deprecateImageOptions) +// GetImageExportJob : Retrieve an image export job +// This request retrieves a single image export job specified by the identifier in the URL. +func (vpc *VpcV1) GetImageExportJob(getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + return vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) } -// 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") +// GetImageExportJobWithContext is an alternate form of the GetImageExportJob method which supports a Context parameter +func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getImageExportJobOptions, "getImageExportJobOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deprecateImageOptions, "deprecateImageOptions") + err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deprecateImageOptions.ID, + "image_id": *getImageExportJobOptions.ImageID, + "id": *getImageExportJobOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/deprecate`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deprecateImageOptions.Headers { + for headerName, headerValue := range getImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeprecateImage") + 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("future_version", fmt.Sprint("true")) @@ -4175,57 +4220,60 @@ 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 { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + if err != nil { + return + } + response.Result = result + } return } -// ObsoleteImage : Obsolete an image -// This request obsoletes an image, resulting in its `status` becoming `obsolete` and -// `obsolescence_at` being set to the current date and time. -// -// The image must: -// - have a `status` of `available` or `deprecated` -// - have `catalog_offering.managed` set to `false` -// - not have `deprecation_at` set in the future -// - not have `obsolescence_at` set -// -// A system-provided image is not allowed to be obsoleted. -func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { - return vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) +// GetOperatingSystem : Retrieve an operating system +// This request retrieves a single operating system specified by the name in the URL. +func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + return vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) } -// 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") +// GetOperatingSystemWithContext is an alternate form of the GetOperatingSystem method which supports a Context parameter +func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOperatingSystemOptions, "getOperatingSystemOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") + err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *obsoleteImageOptions.ID, + "name": *getOperatingSystemOptions.Name, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/obsolete`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range obsoleteImageOptions.Headers { + for headerName, headerValue := range getOperatingSystemOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") + 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("future_version", fmt.Sprint("true")) @@ -4237,7 +4285,18 @@ 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 { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) + if err != nil { + return + } + response.Result = result + } return } @@ -4315,69 +4374,124 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE return } -// CreateImageExportJob : Create an image export job -// This request creates and queues a new export job for the image specified in the URL using the image export job -// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or -// `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains -// the information necessary to create and queue the new image export job. -func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - return vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) +// ListImages : List all images +// This request lists all images available in the region. An image provides source data for a volume. Images are either +// system-provided, or created from another source, such as importing from Cloud Object Storage. +func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + return vpc.ListImagesWithContext(context.Background(), listImagesOptions) } -// CreateImageExportJobWithContext is an alternate form of the CreateImageExportJob method which supports a Context parameter -func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createImageExportJobOptions, "createImageExportJobOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") +// ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter +func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listImagesOptions, "listImagesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "image_id": *createImageExportJobOptions.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, `/images/{image_id}/export_jobs`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) if err != nil { return } - for headerName, headerValue := range createImageExportJobOptions.Headers { + for headerName, headerValue := range listImagesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listImagesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) + } + if listImagesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listImagesOptions.Limit)) + } + if listImagesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listImagesOptions.ResourceGroupID)) + } + if listImagesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) + } + if listImagesOptions.Status != nil { + builder.AddQuery("status", strings.Join(listImagesOptions.Status, ",")) + } + if listImagesOptions.Visibility != nil { + builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) + } - body := make(map[string]interface{}) - if createImageExportJobOptions.StorageBucket != nil { - body["storage_bucket"] = createImageExportJobOptions.StorageBucket + request, err := builder.Build() + if err != nil { + return } - if createImageExportJobOptions.Format != nil { - body["format"] = createImageExportJobOptions.Format + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return } - if createImageExportJobOptions.Name != nil { - body["name"] = createImageExportJobOptions.Name + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) + if err != nil { + return + } + response.Result = result } - _, err = builder.SetBodyContentJSON(body) + + return +} + +// ListOperatingSystems : List all operating systems +// This request lists all operating systems in the region. +func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + return vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) +} + +// ListOperatingSystemsWithContext is an alternate form of the ListOperatingSystems method which supports a Context parameter +func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listOperatingSystemsOptions, "listOperatingSystemsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems`, nil) if err != nil { return } + for headerName, headerValue := range listOperatingSystemsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listOperatingSystemsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) + } + if listOperatingSystemsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listOperatingSystemsOptions.Limit)) + } + request, err := builder.Build() if err != nil { return @@ -4389,7 +4503,7 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) if err != nil { return } @@ -4399,43 +4513,49 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma return } -// DeleteImageExportJob : Delete an image export job -// This request deletes an image export job. This operation cannot be reversed. If the job has not completed, the job -// will be canceled, and the incomplete exported image object deleted. If the job has completed, the exported image -// object will not be deleted. -func (vpc *VpcV1) DeleteImageExportJob(deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) +// ObsoleteImage : Obsolete an image +// This request obsoletes an image, resulting in its `status` becoming `obsolete` and +// `obsolescence_at` being set to the current date and time. +// +// The image must: +// - have a `status` of `available` or `deprecated` +// - have `catalog_offering.managed` set to `false` +// - not have `deprecation_at` set in the future +// - not have `obsolescence_at` set +// +// A system-provided image is not allowed to be obsoleted. +func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { + return vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) } -// 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") +// ObsoleteImageWithContext is an alternate form of the ObsoleteImage method which supports a Context parameter +func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(obsoleteImageOptions, "obsoleteImageOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") + err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") if err != nil { return } pathParamsMap := map[string]string{ - "image_id": *deleteImageExportJobOptions.ImageID, - "id": *deleteImageExportJobOptions.ID, + "id": *obsoleteImageOptions.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, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/obsolete`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteImageExportJobOptions.Headers { + for headerName, headerValue := range obsoleteImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -4455,51 +4575,58 @@ func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteIma return } -// GetImageExportJob : Retrieve an image export job -// This request retrieves a single image export job specified by the identifier in the URL. -func (vpc *VpcV1) GetImageExportJob(getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - return vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) +// UpdateImage : Update an image +// This request updates an image with the information in a provided image patch. The image patch object is structured in +// the same way as a retrieved image and contains only the information to be updated. A system-provided image is not +// allowed to be updated. An image with a `status` of `deleting` cannot be updated. +func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.UpdateImageWithContext(context.Background(), updateImageOptions) } -// 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") +// UpdateImageWithContext is an alternate form of the UpdateImage method which supports a Context parameter +func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateImageOptions, "updateImageOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") + err = core.ValidateStruct(updateImageOptions, "updateImageOptions") if err != nil { return } pathParamsMap := map[string]string{ - "image_id": *getImageExportJobOptions.ImageID, - "id": *getImageExportJobOptions.ID, + "id": *updateImageOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getImageExportJobOptions.Headers { + for headerName, headerValue := range updateImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImageExportJob") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateImageOptions.ImagePatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -4511,7 +4638,7 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) if err != nil { return } @@ -4595,46 +4722,65 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma return } -// ListOperatingSystems : List all operating systems -// This request lists all operating systems in the region. -func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { - return vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) +// CreateKey : Create a key +// This request creates a new SSH key from an key prototype object. The prototype object is structured in the same way +// as a retrieved key, and contains the information necessary to create the new key. The public key value must be +// provided. +func (vpc *VpcV1) CreateKey(createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.CreateKeyWithContext(context.Background(), createKeyOptions) } -// 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") +// CreateKeyWithContext is an alternate form of the CreateKey method which supports a Context parameter +func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createKeyOptions, "createKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createKeyOptions, "createKeyOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) if err != nil { return } - for headerName, headerValue := range listOperatingSystemsOptions.Headers { + for headerName, headerValue := range createKeyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listOperatingSystemsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) + + body := make(map[string]interface{}) + if createKeyOptions.PublicKey != nil { + body["public_key"] = createKeyOptions.PublicKey } - if listOperatingSystemsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listOperatingSystemsOptions.Limit)) + if createKeyOptions.Name != nil { + body["name"] = createKeyOptions.Name + } + if createKeyOptions.ResourceGroup != nil { + body["resource_group"] = createKeyOptions.ResourceGroup + } + if createKeyOptions.Type != nil { + body["type"] = createKeyOptions.Type + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return } request, err := builder.Build() @@ -4648,7 +4794,7 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) if err != nil { return } @@ -4658,44 +4804,43 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera return } -// GetOperatingSystem : Retrieve an operating system -// This request retrieves a single operating system specified by the name in the URL. -func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { - return vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) +// DeleteKey : Delete a key +// This request deletes a key. This operation cannot be reversed. +func (vpc *VpcV1) DeleteKey(deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteKeyWithContext(context.Background(), deleteKeyOptions) } -// 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") +// DeleteKeyWithContext is an alternate form of the DeleteKey method which supports a Context parameter +func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteKeyOptions, "deleteKeyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") + err = core.ValidateStruct(deleteKeyOptions, "deleteKeyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "name": *getOperatingSystemOptions.Name, + "id": *deleteKeyOptions.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, `/operating_systems/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getOperatingSystemOptions.Headers { + for headerName, headerValue := range deleteKeyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteKey") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -4707,16 +4852,70 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) - if err != nil { - return - } + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetKey : Retrieve a key +// This request retrieves a single key specified by the identifier in the URL. +func (vpc *VpcV1) GetKey(getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.GetKeyWithContext(context.Background(), getKeyOptions) +} + +// GetKeyWithContext is an alternate form of the GetKey method which supports a Context parameter +func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getKeyOptions, "getKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getKeyOptions, "getKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + if err != nil { + return + } response.Result = result } @@ -4787,63 +4986,52 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List return } -// CreateKey : Create a key -// This request creates a new SSH key from an key prototype object. The prototype object is structured in the same way -// as a retrieved key, and contains the information necessary to create the new key. The public key value must be -// provided. -func (vpc *VpcV1) CreateKey(createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - return vpc.CreateKeyWithContext(context.Background(), createKeyOptions) +// UpdateKey : Update a key +// This request updates a key's name. +func (vpc *VpcV1) UpdateKey(updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.UpdateKeyWithContext(context.Background(), updateKeyOptions) } -// 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") +// UpdateKeyWithContext is an alternate form of the UpdateKey method which supports a Context parameter +func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateKeyOptions, "updateKeyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createKeyOptions, "createKeyOptions") + err = core.ValidateStruct(updateKeyOptions, "updateKeyOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + 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`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createKeyOptions.Headers { + for headerName, headerValue := range updateKeyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateKey") + 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/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createKeyOptions.PublicKey != nil { - body["public_key"] = createKeyOptions.PublicKey - } - if createKeyOptions.Name != nil { - body["name"] = createKeyOptions.Name - } - if createKeyOptions.ResourceGroup != nil { - body["resource_group"] = createKeyOptions.ResourceGroup - } - if createKeyOptions.Type != nil { - body["type"] = createKeyOptions.Type - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateKeyOptions.KeyPatch) if err != nil { return } @@ -4869,43 +5057,48 @@ 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) { - return vpc.DeleteKeyWithContext(context.Background(), deleteKeyOptions) +// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with an instance network interface +// This request associates the specified floating IP with the specified instance network interface, replacing any +// existing association. For this request to succeed, the existing floating IP must not be required by another resource, +// such as a public gateway. A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) } -// 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") +// AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteKeyOptions, "deleteKeyOptions") + err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteKeyOptions.ID, + "instance_id": *addInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *addInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addInstanceNetworkInterfaceFloatingIPOptions.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, `/keys/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteKeyOptions.Headers { + for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteKey") + 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("future_version", fmt.Sprint("true")) @@ -4917,55 +5110,70 @@ 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 { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + 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) { - return vpc.GetKeyWithContext(context.Background(), getKeyOptions) +// CreateInstance : Create an instance +// This request provisions a new instance from an instance prototype object. The prototype object is structured in the +// same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance +// is automatically started. +func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) } -// 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") +// CreateInstanceWithContext is an alternate form of the CreateInstance method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceOptions, "createInstanceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getKeyOptions, "getKeyOptions") + err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *getKeyOptions.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, `/keys/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) if err != nil { return } - for headerName, headerValue := range getKeyOptions.Headers { + for headerName, headerValue := range createInstanceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetKey") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(createInstanceOptions.InstancePrototype) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -4977,7 +5185,7 @@ func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOp return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) if err != nil { return } @@ -4987,52 +5195,60 @@ func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOp return } -// UpdateKey : Update a key -// This request updates a key's name. -func (vpc *VpcV1) UpdateKey(updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - return vpc.UpdateKeyWithContext(context.Background(), updateKeyOptions) +// CreateInstanceAction : Create an instance action +// This request creates a new action which will be queued up to run as soon as any pending or running actions have +// completed. +func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) } -// 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") +// CreateInstanceActionWithContext is an alternate form of the CreateInstanceAction method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceActionOptions, "createInstanceActionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateKeyOptions, "updateKeyOptions") + err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateKeyOptions.ID, + "instance_id": *createInstanceActionOptions.InstanceID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/actions`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateKeyOptions.Headers { + for headerName, headerValue := range createInstanceActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateKey") + 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/merge-patch+json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateKeyOptions.KeyPatch) + body := make(map[string]interface{}) + if createInstanceActionOptions.Type != nil { + body["type"] = createInstanceActionOptions.Type + } + if createInstanceActionOptions.Force != nil { + body["force"] = createInstanceActionOptions.Force + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } @@ -5048,7 +5264,7 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) if err != nil { return } @@ -5058,43 +5274,66 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up return } -// ListInstanceProfiles : List all instance profiles -// This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the -// region. An instance profile specifies the performance characteristics and pricing model for an instance. -func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) +// CreateInstanceConsoleAccessToken : Create a console access token for an instance +// This request creates a new single-use console access token for an instance. All console configuration is provided at +// token create time, and the token is subsequently used in the `access_token` query parameter for the WebSocket +// request. The access token is only valid for a short period of time, and a maximum of one token is valid for a given +// instance at a time. +func (vpc *VpcV1) CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) } -// 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") +// CreateInstanceConsoleAccessTokenWithContext is an alternate form of the CreateInstanceConsoleAccessToken method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Context, createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "instance_id": *createInstanceConsoleAccessTokenOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/console_access_token`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listInstanceProfilesOptions.Headers { + for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createInstanceConsoleAccessTokenOptions.ConsoleType != nil { + body["console_type"] = createInstanceConsoleAccessTokenOptions.ConsoleType + } + if createInstanceConsoleAccessTokenOptions.Force != nil { + body["force"] = createInstanceConsoleAccessTokenOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -5106,7 +5345,7 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) if err != nil { return } @@ -5116,50 +5355,65 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta return } -// GetInstanceProfile : Retrieve an instance profile -// This request retrieves a single instance profile specified by the name in the URL. -func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { - return vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) +// CreateInstanceNetworkAttachment : Create a network attachment on an instance +// This request creates a new instance network attachment from an instance network attachment prototype object. The +// prototype object is structured in the same way as a retrieved instance network attachment, and contains the +// information necessary to create the new instance network attachment. +func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) } -// 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") +// CreateInstanceNetworkAttachmentWithContext is an alternate form of the CreateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context, createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") + err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "name": *getInstanceProfileOptions.Name, + "instance_id": *createInstanceNetworkAttachmentOptions.InstanceID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getInstanceProfileOptions.Headers { + for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createInstanceNetworkAttachmentOptions.VirtualNetworkInterface != nil { + body["virtual_network_interface"] = createInstanceNetworkAttachmentOptions.VirtualNetworkInterface + } + if createInstanceNetworkAttachmentOptions.Name != nil { + body["name"] = createInstanceNetworkAttachmentOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -5171,7 +5425,7 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) if err != nil { return } @@ -5181,42 +5435,75 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance return } -// ListInstanceTemplates : List all instance templates -// This request lists all instance templates in the region. -func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) +// 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. +func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) } -// 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") +// CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + 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, `/instance/templates`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listInstanceTemplatesOptions.Headers { + for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createInstanceNetworkInterfaceOptions.Subnet != nil { + body["subnet"] = createInstanceNetworkInterfaceOptions.Subnet + } + if createInstanceNetworkInterfaceOptions.AllowIPSpoofing != nil { + body["allow_ip_spoofing"] = createInstanceNetworkInterfaceOptions.AllowIPSpoofing + } + if createInstanceNetworkInterfaceOptions.Name != nil { + body["name"] = createInstanceNetworkInterfaceOptions.Name + } + if createInstanceNetworkInterfaceOptions.PrimaryIP != nil { + body["primary_ip"] = createInstanceNetworkInterfaceOptions.PrimaryIP + } + if createInstanceNetworkInterfaceOptions.SecurityGroups != nil { + body["security_groups"] = createInstanceNetworkInterfaceOptions.SecurityGroups + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -5228,7 +5515,7 @@ func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInst return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplateCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { return } @@ -5309,103 +5596,69 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI return } -// DeleteInstanceTemplate : Delete an instance template -// This request deletes the instance template. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) +// CreateInstanceVolumeAttachment : Create a volume attachment on an instance +// This request creates a new volume attachment from a volume attachment prototype object, connecting a volume to an +// instance. For this request to succeed, the specified volume must not be busy. The prototype object is structured in +// the same way as a retrieved volume attachment, and contains the information necessary to create the new volume +// attachment. +func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) } -// 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") +// CreateInstanceVolumeAttachmentWithContext is an alternate form of the CreateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") + err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteInstanceTemplateOptions.ID, + "instance_id": *createInstanceVolumeAttachmentOptions.InstanceID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { + for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetInstanceTemplate : Retrieve an instance template -// This request retrieves a single instance template specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) -} - -// GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") - if err != nil { - return + body := make(map[string]interface{}) + if createInstanceVolumeAttachmentOptions.Volume != nil { + body["volume"] = createInstanceVolumeAttachmentOptions.Volume } - err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") - if err != nil { - return + if createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete != nil { + body["delete_volume_on_instance_delete"] = createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete } - - pathParamsMap := map[string]string{ - "id": *getInstanceTemplateOptions.ID, + if createInstanceVolumeAttachmentOptions.Name != nil { + body["name"] = createInstanceVolumeAttachmentOptions.Name } - - 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.SetBodyContentJSON(body) if err != nil { return } - for headerName, headerValue := range getInstanceTemplateOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() if err != nil { return @@ -5417,7 +5670,7 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { return } @@ -5427,282 +5680,266 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc return } -// UpdateInstanceTemplate : Update an instance template -// This request updates an instance template with the information provided in the instance template patch. The instance -// template patch object is structured in the same way as a retrieved instance template and contains only the -// information to be updated. -func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) +// DeleteInstance : Delete an instance +// This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with instance +// network interfaces are implicitly disassociated. All virtual network interfaces with `auto_delete` set to `true` +// targeting instance network attachments on the instance are automatically deleted. All flow log collectors with +// `auto_delete` set to `true` targeting the instance, the instance network attachments, the instance network +// interfaces, or the automatically deleted virtual network interfaces are automatically deleted. +func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) } -// 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") +// DeleteInstanceWithContext is an alternate form of the DeleteInstance method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceOptions, "deleteInstanceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") + err = core.ValidateStruct(deleteInstanceOptions, "deleteInstanceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateInstanceTemplateOptions.ID, + "id": *deleteInstanceOptions.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/templates/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateInstanceTemplateOptions.Headers { + for headerName, headerValue := range deleteInstanceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstance") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateInstanceTemplateOptions.InstanceTemplatePatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListInstances : List all instances -// This request lists all instances in the region. -func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) +// DeleteInstanceNetworkAttachment : Delete an instance network attachment +// This request deletes an instance network attachment. This operation cannot be reversed. Any floating IPs associated +// with the instance network attachment are implicitly disassociated. All flow log collectors with `auto_delete` set to +// `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment +// is not allowed to be deleted. +func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) } -// 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") +// DeleteInstanceNetworkAttachmentWithContext is an alternate form of the DeleteInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context, deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + 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`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listInstancesOptions.Headers { + for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listInstancesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) - } - if listInstancesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstancesOptions.Limit)) - } - if listInstancesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listInstancesOptions.ResourceGroupID)) - } - if listInstancesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) - } - if listInstancesOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) - } - if listInstancesOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) - } - if listInstancesOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) - } - if listInstancesOptions.DedicatedHostID != nil { - builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) - } - if listInstancesOptions.DedicatedHostCRN != nil { - builder.AddQuery("dedicated_host.crn", fmt.Sprint(*listInstancesOptions.DedicatedHostCRN)) - } - if listInstancesOptions.DedicatedHostName != nil { - builder.AddQuery("dedicated_host.name", fmt.Sprint(*listInstancesOptions.DedicatedHostName)) - } - if listInstancesOptions.PlacementGroupID != nil { - builder.AddQuery("placement_group.id", fmt.Sprint(*listInstancesOptions.PlacementGroupID)) - } - if listInstancesOptions.PlacementGroupCRN != nil { - builder.AddQuery("placement_group.crn", fmt.Sprint(*listInstancesOptions.PlacementGroupCRN)) - } - if listInstancesOptions.PlacementGroupName != nil { - builder.AddQuery("placement_group.name", fmt.Sprint(*listInstancesOptions.PlacementGroupName)) - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// CreateInstance : Create an instance -// This request provisions a new instance from an instance prototype object. The prototype object is structured in the -// same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance -// is automatically started. -func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) +// DeleteInstanceNetworkInterface : Delete an instance network interface +// This request deletes an instance network interface. This operation cannot be reversed. Any floating IPs associated +// with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to +// `true` targeting the instance network interface are automatically deleted. The primary instance network interface is +// not allowed to be deleted. +func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) } -// 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") +// DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") + err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + 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`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createInstanceOptions.Headers { + for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createInstanceOptions.InstancePrototype) + request, err := builder.Build() if err != nil { return } - request, err := builder.Build() + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteInstanceTemplate : Delete an instance template +// This request deletes the instance template. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) +} + +// DeleteInstanceTemplateWithContext is an alternate form of the DeleteInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + pathParamsMap := map[string]string{ + "id": *deleteInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) - if err != nil { - return - } - response.Result = result + + 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("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return } + response, err = vpc.Service.Request(request, nil) + return } -// DeleteInstance : Delete an instance -// This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with instance -// network interfaces are implicitly disassociated. All virtual network interfaces with `auto_delete` set to `true` -// targeting instance network attachments on the instance are automatically deleted. All flow log collectors with -// `auto_delete` set to `true` targeting the instance, the instance network attachments, the instance network -// interfaces, or the automatically deleted virtual network interfaces are automatically deleted. -func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) +// DeleteInstanceVolumeAttachment : Delete a volume attachment +// This request deletes a volume attachment. This operation cannot be reversed, but a new volume attachment may +// subsequently be created for the volume. For this request to succeed, the volume must not be busy. +func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) } -// 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") +// DeleteInstanceVolumeAttachmentWithContext is an alternate form of the DeleteInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteInstanceOptions, "deleteInstanceOptions") + err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteInstanceOptions.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, `/instances/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteInstanceOptions.Headers { + for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstance") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -5787,57 +6024,51 @@ func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions return } -// UpdateInstance : Update an instance -// This request updates an instance with the information in a provided instance patch. The instance patch object is -// structured in the same way as a retrieved instance and contains only the information to be updated. -func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) +// GetInstanceDisk : Retrieve an instance disk +// This request retrieves a single instance disk specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + return vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) } -// 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") +// GetInstanceDiskWithContext is an alternate form of the GetInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceDiskOptions, "getInstanceDiskOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") + err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateInstanceOptions.ID, + "instance_id": *getInstanceDiskOptions.InstanceID, + "id": *getInstanceDiskOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateInstanceOptions.Headers { + for headerName, headerValue := range getInstanceDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -5849,7 +6080,7 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) if err != nil { return } @@ -5925,64 +6156,51 @@ func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getI return } -// CreateInstanceAction : Create an instance action -// This request creates a new action which will be queued up to run as soon as any pending or running actions have -// completed. -func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) +// GetInstanceNetworkAttachment : Retrieve an instance network attachment +// This request retrieves a single instance network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) } -// 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") +// GetInstanceNetworkAttachmentWithContext is an alternate form of the GetInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") + err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceActionOptions.InstanceID, + "instance_id": *getInstanceNetworkAttachmentOptions.InstanceID, + "id": *getInstanceNetworkAttachmentOptions.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}/actions`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createInstanceActionOptions.Headers { + for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createInstanceActionOptions.Type != nil { - body["type"] = createInstanceActionOptions.Type - } - if createInstanceActionOptions.Force != nil { - body["force"] = createInstanceActionOptions.Force - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -5994,7 +6212,7 @@ func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createIns return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) if err != nil { return } @@ -6004,66 +6222,51 @@ 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) { - return vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) +// GetInstanceNetworkInterface : Retrieve an instance network interface +// This request retrieves a single instance network interface specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) } -// 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") +// GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") + err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceConsoleAccessTokenOptions.InstanceID, + "instance_id": *getInstanceNetworkInterfaceOptions.InstanceID, + "id": *getInstanceNetworkInterfaceOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/console_access_token`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { + for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createInstanceConsoleAccessTokenOptions.ConsoleType != nil { - body["console_type"] = createInstanceConsoleAccessTokenOptions.ConsoleType - } - if createInstanceConsoleAccessTokenOptions.Force != nil { - body["force"] = createInstanceConsoleAccessTokenOptions.Force - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -6075,7 +6278,7 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { return } @@ -6085,42 +6288,43 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex return } -// ListInstanceDisks : List all disks on an instance -// This request lists all disks on an instance. A disk is a block device that is locally attached to the instance's -// physical host and is also referred to as instance storage. By default, the listed disks are sorted by their -// `created_at` property values, with the newest disk first. -func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) +// GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP address if it is associated with the instance network interface and +// instance specified in the URL. +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) } -// 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") +// GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") + err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceDisksOptions.InstanceID, + "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}/disks`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listInstanceDisksOptions.Headers { + for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -6142,7 +6346,7 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { return } @@ -6152,41 +6356,45 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance return } -// GetInstanceDisk : Retrieve an instance disk -// This request retrieves a single instance disk specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - return vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) +// GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for an instance network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) } -// 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") +// GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceIP") + err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") + err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceDiskOptions.InstanceID, - "id": *getInstanceDiskOptions.ID, + "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}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getInstanceDiskOptions.Headers { + for headerName, headerValue := range getInstanceNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -6208,7 +6416,7 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { return } @@ -6218,57 +6426,50 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis return } -// UpdateInstanceDisk : Update an instance disk -// This request updates the instance disk with the information in a provided patch. -func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) +// GetInstanceProfile : Retrieve an instance profile +// This request retrieves a single instance profile specified by the name in the URL. +func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + return vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) } -// 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") +// GetInstanceProfileWithContext is an alternate form of the GetInstanceProfile method which supports a Context parameter +func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceProfileOptions, "getInstanceProfileOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") + err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *updateInstanceDiskOptions.InstanceID, - "id": *updateInstanceDiskOptions.ID, + "name": *getInstanceProfileOptions.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, `/instances/{instance_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateInstanceDiskOptions.Headers { + for headerName, headerValue := range getInstanceProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateInstanceDiskOptions.InstanceDiskPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -6280,7 +6481,7 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) if err != nil { return } @@ -6290,45 +6491,40 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta return } -// ListInstanceNetworkAttachments : List all network attachments on an instance -// This request lists all network attachments on an instance. A network attachment represents a device on the instance -// to which a virtual network interface is attached. -// -// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. -// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property -// values. -func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) +// GetInstanceTemplate : Retrieve an instance template +// This request retrieves a single instance template specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) } -// 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") +// GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") + err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkAttachmentsOptions.InstanceID, + "id": *getInstanceTemplateOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { + for headerName, headerValue := range getInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -6350,7 +6546,7 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachmentCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) if err != nil { return } @@ -6360,66 +6556,52 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, return } -// CreateInstanceNetworkAttachment : Create a network attachment on an instance -// This request creates a new instance network attachment from an instance network attachment prototype object. The -// prototype object is structured in the same way as a retrieved instance network attachment, and contains the -// information necessary to create the new instance network attachment. -func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) +// GetInstanceVolumeAttachment : Retrieve a volume attachment +// This request retrieves a single volume attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) } -// 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") +// GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceNetworkAttachmentOptions.InstanceID, + "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, + "id": *getInstanceVolumeAttachmentOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createInstanceNetworkAttachmentOptions.VirtualNetworkInterface != nil { - body["virtual_network_interface"] = createInstanceNetworkAttachmentOptions.VirtualNetworkInterface - } - if createInstanceNetworkAttachmentOptions.Name != nil { - body["name"] = createInstanceNetworkAttachmentOptions.Name - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() + request, err := builder.Build() if err != nil { return } @@ -6430,7 +6612,7 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { return } @@ -6440,47 +6622,46 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context return } -// DeleteInstanceNetworkAttachment : Delete an instance network attachment -// This request deletes an instance network attachment. This operation cannot be reversed. Any floating IPs associated -// with the instance network attachment are implicitly disassociated. All flow log collectors with `auto_delete` set to -// `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment -// is not allowed to be deleted. -func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) +// ListInstanceDisks : List all disks on an instance +// This request lists all disks on an instance. A disk is a block device that is locally attached to the instance's +// physical host and is also referred to as instance storage. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) } -// 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") +// ListInstanceDisksWithContext is an alternate form of the ListInstanceDisks method which supports a Context parameter +func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceDisksOptions, "listInstanceDisksOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceNetworkAttachmentOptions.InstanceID, - "id": *deleteInstanceNetworkAttachmentOptions.ID, + "instance_id": *listInstanceDisksOptions.InstanceID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { + for headerName, headerValue := range listInstanceDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") + 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("future_version", fmt.Sprint("true")) @@ -6492,46 +6673,61 @@ 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 { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetInstanceNetworkAttachment : Retrieve an instance network attachment -// This request retrieves a single instance network attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) +// ListInstanceNetworkAttachments : List all network attachments on an instance +// This request lists all network attachments on an instance. A network attachment represents a device on the instance +// to which a virtual network interface is attached. +// +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) } -// 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") +// ListInstanceNetworkAttachmentsWithContext is an alternate form of the ListInstanceNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkAttachmentOptions.InstanceID, - "id": *getInstanceNetworkAttachmentOptions.ID, + "instance_id": *listInstanceNetworkAttachmentsOptions.InstanceID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { + for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -6553,7 +6749,7 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachmentCollection) if err != nil { return } @@ -6563,59 +6759,51 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g return } -// UpdateInstanceNetworkAttachment : Update an instance network attachment -// This request updates an instance network attachment with the information provided in an instance network interface -// patch object. The instance network attachment patch object is structured in the same way as a retrieved instance -// network attachment and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) +// ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with an instance network interface +// This request lists all floating IPs associated with an instance network interface. +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) } -// 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") +// ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *updateInstanceNetworkAttachmentOptions.InstanceID, - "id": *updateInstanceNetworkAttachmentOptions.ID, + "instance_id": *listInstanceNetworkInterfaceFloatingIpsOptions.InstanceID, + "network_interface_id": *listInstanceNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { + for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -6627,7 +6815,7 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) if err != nil { return } @@ -6637,43 +6825,44 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context return } -// ListInstanceNetworkInterfaces : List all network interfaces on an instance -// This request lists all network interfaces on an instance. An instance network interface is an abstract representation -// of a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to -// any subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on -// the instance may also attach to the same subnet. -func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) +// ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface +// This request lists the primary reserved IP for an instance network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) } -// 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") +// ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceIps") + err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") + err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfacesOptions.InstanceID, + "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`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { + for headerName, headerValue := range listInstanceNetworkInterfaceIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -6683,6 +6872,12 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceNetworkInterfaceIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) + } + if listInstanceNetworkInterfaceIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -6695,7 +6890,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) if err != nil { return } @@ -6705,31 +6900,31 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, return } -// CreateInstanceNetworkInterface : Create a network interface on an instance -// This request creates a new instance network interface from an instance network interface prototype object. The -// prototype object is structured in the same way as a retrieved instance network interface, and contains the -// information necessary to create the new instance network interface. Any subnet in the instance's VPC may be -// specified. Addresses on the instance network interface must be within the specified subnet's CIDR blocks. -func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) +// ListInstanceNetworkInterfaces : List all network interfaces on an instance +// This request lists all network interfaces on an instance. An instance network interface is an abstract representation +// of a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to +// any subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on +// the instance may also attach to the same subnet. +func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) } -// 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") +// ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceNetworkInterfaceOptions.InstanceID, + "instance_id": *listInstanceNetworkInterfacesOptions.InstanceID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) @@ -6737,43 +6932,21 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, return } - for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { + for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createInstanceNetworkInterfaceOptions.Subnet != nil { - body["subnet"] = createInstanceNetworkInterfaceOptions.Subnet - } - if createInstanceNetworkInterfaceOptions.AllowIPSpoofing != nil { - body["allow_ip_spoofing"] = createInstanceNetworkInterfaceOptions.AllowIPSpoofing - } - if createInstanceNetworkInterfaceOptions.Name != nil { - body["name"] = createInstanceNetworkInterfaceOptions.Name - } - if createInstanceNetworkInterfaceOptions.PrimaryIP != nil { - body["primary_ip"] = createInstanceNetworkInterfaceOptions.PrimaryIP - } - if createInstanceNetworkInterfaceOptions.SecurityGroups != nil { - body["security_groups"] = createInstanceNetworkInterfaceOptions.SecurityGroups - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -6785,7 +6958,7 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) if err != nil { return } @@ -6795,47 +6968,37 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, return } -// DeleteInstanceNetworkInterface : Delete an instance network interface -// This request deletes an instance network interface. This operation cannot be reversed. Any floating IPs associated -// with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to -// `true` targeting the instance network interface are automatically deleted. The primary instance network interface is -// not allowed to be deleted. -func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) +// ListInstanceProfiles : List all instance profiles +// This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the +// region. An instance profile specifies the performance characteristics and pricing model for an instance. +func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) } -// DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") +// ListInstanceProfilesWithContext is an alternate form of the ListInstanceProfiles method which supports a Context parameter +func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceProfilesOptions, "listInstanceProfilesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceNetworkInterfaceOptions.InstanceID, - "id": *deleteInstanceNetworkInterfaceOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil) if err != nil { return } - for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { + for headerName, headerValue := range listInstanceProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") + 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("future_version", fmt.Sprint("true")) @@ -6847,46 +7010,48 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetInstanceNetworkInterface : Retrieve an instance network interface -// This request retrieves a single instance network interface specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) +// ListInstanceTemplates : List all instance templates +// This request lists all instance templates in the region. +func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) } -// GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") +// ListInstanceTemplatesWithContext is an alternate form of the ListInstanceTemplates method which supports a Context parameter +func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceTemplatesOptions, "listInstanceTemplatesOptions") if err != nil { return } - 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) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) if err != nil { return } - for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { + for headerName, headerValue := range listInstanceTemplatesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -6908,7 +7073,7 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplateCollection) if err != nil { return } @@ -6918,59 +7083,52 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge return } -// UpdateInstanceNetworkInterface : Update an instance network interface -// This request updates an instance network interface with the information provided in an instance network interface -// patch object. The instance network interface patch object is structured in the same way as a retrieved instance -// network interface and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) +// ListInstanceVolumeAttachments : List all volumes attachments on an instance +// This request lists all volume attachments on an instance. A volume attachment connects a volume to an instance. Each +// instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one +// volume. +func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) } -// 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") +// ListInstanceVolumeAttachmentsWithContext is an alternate form of the ListInstanceVolumeAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *updateInstanceNetworkInterfaceOptions.InstanceID, - "id": *updateInstanceNetworkInterfaceOptions.ID, + "instance_id": *listInstanceVolumeAttachmentsOptions.InstanceID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { + for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -6982,7 +7140,7 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachmentCollection) if err != nil { return } @@ -6992,41 +7150,32 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, return } -// ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with an instance network interface -// This request lists all floating IPs associated with an instance network interface. -func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) +// ListInstances : List all instances +// This request lists all instances in the region. +func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) } -// ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") +// ListInstancesWithContext is an alternate form of the ListInstances method which supports a Context parameter +func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstancesOptions, "listInstancesOptions") if err != nil { return } - 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) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) if err != nil { return } - for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { + for headerName, headerValue := range listInstancesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7036,6 +7185,45 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstancesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) + } + if listInstancesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstancesOptions.Limit)) + } + if listInstancesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listInstancesOptions.ResourceGroupID)) + } + if listInstancesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) + } + if listInstancesOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) + } + if listInstancesOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) + } + if listInstancesOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) + } + if listInstancesOptions.DedicatedHostID != nil { + builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) + } + if listInstancesOptions.DedicatedHostCRN != nil { + builder.AddQuery("dedicated_host.crn", fmt.Sprint(*listInstancesOptions.DedicatedHostCRN)) + } + if listInstancesOptions.DedicatedHostName != nil { + builder.AddQuery("dedicated_host.name", fmt.Sprint(*listInstancesOptions.DedicatedHostName)) + } + if listInstancesOptions.PlacementGroupID != nil { + builder.AddQuery("placement_group.id", fmt.Sprint(*listInstancesOptions.PlacementGroupID)) + } + if listInstancesOptions.PlacementGroupCRN != nil { + builder.AddQuery("placement_group.crn", fmt.Sprint(*listInstancesOptions.PlacementGroupCRN)) + } + if listInstancesOptions.PlacementGroupName != nil { + builder.AddQuery("placement_group.name", fmt.Sprint(*listInstancesOptions.PlacementGroupName)) + } request, err := builder.Build() if err != nil { @@ -7048,7 +7236,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) if err != nil { return } @@ -7113,53 +7301,57 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex return } -// GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP address if it is associated with the instance network interface and -// instance specified in the URL. -func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) +// UpdateInstance : Update an instance +// This request updates an instance with the information in a provided instance patch. The instance patch object is +// structured in the same way as a retrieved instance and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) } -// 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") +// UpdateInstanceWithContext is an alternate form of the UpdateInstance method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceOptions, "updateInstanceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *getInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *getInstanceNetworkInterfaceFloatingIPOptions.ID, + "id": *updateInstanceOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range updateInstanceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -7171,7 +7363,7 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) if err != nil { return } @@ -7181,54 +7373,57 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } -// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with an instance network interface -// This request associates the specified floating IP with the specified instance network interface, replacing any -// existing association. For this request to succeed, the existing floating IP must not be required by another resource, -// such as a public gateway. A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) +// UpdateInstanceDisk : Update an instance disk +// This request updates the instance disk with the information in a provided patch. +func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) } -// 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") +// UpdateInstanceDiskWithContext is an alternate form of the UpdateInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceDiskOptions, "updateInstanceDiskOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *addInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *addInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *addInstanceNetworkInterfaceFloatingIPOptions.ID, + "instance_id": *updateInstanceDiskOptions.InstanceID, + "id": *updateInstanceDiskOptions.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, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range updateInstanceDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateInstanceDiskOptions.InstanceDiskPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -7240,7 +7435,7 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) if err != nil { return } @@ -7250,58 +7445,57 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } -// ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface -// This request lists the primary reserved IP for an instance network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) +// UpdateInstanceNetworkAttachment : Update an instance network attachment +// This request updates an instance network attachment with the information provided in an instance network interface +// patch object. The instance network attachment patch object is structured in the same way as a retrieved instance +// network attachment and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) } -// 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") +// UpdateInstanceNetworkAttachmentWithContext is an alternate form of the UpdateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context, updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") + err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfaceIpsOptions.InstanceID, - "network_interface_id": *listInstanceNetworkInterfaceIpsOptions.NetworkInterfaceID, + "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, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listInstanceNetworkInterfaceIpsOptions.Headers { + for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listInstanceNetworkInterfaceIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) - } - if listInstanceNetworkInterfaceIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) + if err != nil { + return } request, err := builder.Build() @@ -7315,7 +7509,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) if err != nil { return } @@ -7325,55 +7519,59 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context return } -// GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP -// This request retrieves the primary reserved IP for an instance network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) +// UpdateInstanceNetworkInterface : Update an instance network interface +// This request updates an instance network interface with the information provided in an instance network interface +// patch object. The instance network interface patch object is structured in the same way as a retrieved instance +// network interface and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) } -// 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") +// UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") + err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceIPOptions.InstanceID, - "network_interface_id": *getInstanceNetworkInterfaceIPOptions.NetworkInterfaceID, - "id": *getInstanceNetworkInterfaceIPOptions.ID, + "instance_id": *updateInstanceNetworkInterfaceOptions.InstanceID, + "id": *updateInstanceNetworkInterfaceOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/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 { return } - for headerName, headerValue := range getInstanceNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -7385,7 +7583,7 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { return } @@ -7395,52 +7593,58 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, return } -// ListInstanceVolumeAttachments : List all volumes attachments on an instance -// This request lists all volume attachments on an instance. A volume attachment connects a volume to an instance. Each -// instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one -// volume. -func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) +// UpdateInstanceTemplate : Update an instance template +// This request updates an instance template with the information provided in the instance template patch. The instance +// template patch object is structured in the same way as a retrieved instance template and contains only the +// information to be updated. +func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) } -// 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") +// UpdateInstanceTemplateWithContext is an alternate form of the UpdateInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceTemplateOptions, "updateInstanceTemplateOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") + err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceVolumeAttachmentsOptions.InstanceID, + "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, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { + for headerName, headerValue := range updateInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateInstanceTemplateOptions.InstanceTemplatePatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -7452,7 +7656,7 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachmentCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) if err != nil { return } @@ -7462,65 +7666,55 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, return } -// CreateInstanceVolumeAttachment : Create a volume attachment on an instance -// This request creates a new volume attachment from a volume attachment prototype object, connecting a volume to an -// instance. For this request to succeed, the specified volume must not be busy. The prototype object is structured in -// the same way as a retrieved volume attachment, and contains the information necessary to create the new volume -// attachment. -func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) +// UpdateInstanceVolumeAttachment : Update a volume attachment +// This request updates a volume attachment with the information provided in a volume attachment patch object. The +// volume attachment patch object is structured in the same way as a retrieved volume attachment and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) } -// 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") +// UpdateInstanceVolumeAttachmentWithContext is an alternate form of the UpdateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") + err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceVolumeAttachmentOptions.InstanceID, + "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, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { + for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") + 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/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createInstanceVolumeAttachmentOptions.Volume != nil { - body["volume"] = createInstanceVolumeAttachmentOptions.Volume - } - if createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete != nil { - body["delete_volume_on_instance_delete"] = createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete - } - if createInstanceVolumeAttachmentOptions.Name != nil { - body["name"] = createInstanceVolumeAttachmentOptions.Name - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) if err != nil { return } @@ -7546,105 +7740,76 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, return } -// DeleteInstanceVolumeAttachment : Delete a volume attachment -// This request deletes a volume attachment. This operation cannot be reversed, but a new volume attachment may -// subsequently be created for the volume. For this request to succeed, the volume must not be busy. -func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) +// CreateInstanceGroup : Create an instance group +// This request creates a new instance group. +func (vpc *VpcV1) CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupWithContext(context.Background(), createInstanceGroupOptions) } -// 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") +// CreateInstanceGroupWithContext is an alternate form of the CreateInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupOptions, "createInstanceGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") + err = core.ValidateStruct(createInstanceGroupOptions, "createInstanceGroupOptions") if err != nil { 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, `/instance_groups`, nil) if err != nil { return } - for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { + for headerName, headerValue := range createInstanceGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() - if err != nil { - return + body := make(map[string]interface{}) + if createInstanceGroupOptions.InstanceTemplate != nil { + body["instance_template"] = createInstanceGroupOptions.InstanceTemplate } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetInstanceVolumeAttachment : Retrieve a volume attachment -// This request retrieves a single volume attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - return vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) -} - -// GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") - if err != nil { - return + if createInstanceGroupOptions.Subnets != nil { + body["subnets"] = createInstanceGroupOptions.Subnets } - err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") - if err != nil { - return + if createInstanceGroupOptions.ApplicationPort != nil { + body["application_port"] = createInstanceGroupOptions.ApplicationPort } - - pathParamsMap := map[string]string{ - "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, - "id": *getInstanceVolumeAttachmentOptions.ID, + if createInstanceGroupOptions.LoadBalancer != nil { + body["load_balancer"] = createInstanceGroupOptions.LoadBalancer } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) - if err != nil { - return + if createInstanceGroupOptions.LoadBalancerPool != nil { + body["load_balancer_pool"] = createInstanceGroupOptions.LoadBalancerPool } - - for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) + if createInstanceGroupOptions.MembershipCount != nil { + body["membership_count"] = createInstanceGroupOptions.MembershipCount } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) + if createInstanceGroupOptions.Name != nil { + body["name"] = createInstanceGroupOptions.Name + } + if createInstanceGroupOptions.ResourceGroup != nil { + body["resource_group"] = createInstanceGroupOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() if err != nil { @@ -7657,7 +7822,7 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) if err != nil { return } @@ -7667,55 +7832,52 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge return } -// UpdateInstanceVolumeAttachment : Update a volume attachment -// This request updates a volume attachment with the information provided in a volume attachment patch object. The -// volume attachment patch object is structured in the same way as a retrieved volume attachment and needs to contain -// only the information to be updated. -func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) +// CreateInstanceGroupManager : Create a manager for an instance group +// This request creates a new instance group manager. +func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) } -// 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") +// CreateInstanceGroupManagerWithContext is an alternate form of the CreateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") + err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_id": *updateInstanceVolumeAttachmentOptions.InstanceID, - "id": *updateInstanceVolumeAttachmentOptions.ID, + "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, } - 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, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { + for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") + 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/merge-patch+json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) if err != nil { return } @@ -7731,7 +7893,7 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) if err != nil { return } @@ -7741,46 +7903,55 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, return } -// ListInstanceGroups : List all instance groups -// This request lists all instance groups in the region. -func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) +// CreateInstanceGroupManagerAction : Create an instance group manager action +// This request creates a new instance group manager action. +func (vpc *VpcV1) CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) } -// 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 { + return + } + err = core.ValidateStruct(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") if err != nil { 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 { return } - for headerName, headerValue := range listInstanceGroupsOptions.Headers { + for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listInstanceGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) - } - if listInstanceGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) + if err != nil { + return } request, err := builder.Build() @@ -7794,7 +7965,7 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) if err != nil { return } @@ -7804,36 +7975,41 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc return } -// CreateInstanceGroup : Create an instance group -// This request creates a new instance group. -func (vpc *VpcV1) CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupWithContext(context.Background(), createInstanceGroupOptions) +// CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager +// This request creates a new instance group manager policy. +func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) } -// 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") +// CreateInstanceGroupManagerPolicyWithContext is an alternate form of the CreateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Context, createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createInstanceGroupOptions, "createInstanceGroupOptions") + err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "instance_group_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createInstanceGroupOptions.Headers { + for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7845,32 +8021,7 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createInstanceGroupOptions.InstanceTemplate != nil { - body["instance_template"] = createInstanceGroupOptions.InstanceTemplate - } - if createInstanceGroupOptions.Subnets != nil { - body["subnets"] = createInstanceGroupOptions.Subnets - } - if createInstanceGroupOptions.ApplicationPort != nil { - body["application_port"] = createInstanceGroupOptions.ApplicationPort - } - if createInstanceGroupOptions.LoadBalancer != nil { - body["load_balancer"] = createInstanceGroupOptions.LoadBalancer - } - if createInstanceGroupOptions.LoadBalancerPool != nil { - body["load_balancer_pool"] = createInstanceGroupOptions.LoadBalancerPool - } - if createInstanceGroupOptions.MembershipCount != nil { - body["membership_count"] = createInstanceGroupOptions.MembershipCount - } - if createInstanceGroupOptions.Name != nil { - body["name"] = createInstanceGroupOptions.Name - } - if createInstanceGroupOptions.ResourceGroup != nil { - body["resource_group"] = createInstanceGroupOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) if err != nil { return } @@ -7886,7 +8037,7 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { return } @@ -7950,44 +8101,43 @@ func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInst return } -// GetInstanceGroup : Retrieve an instance group -// This request retrieves a single instance group specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) +// DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer +// This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) } -// 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") +// DeleteInstanceGroupLoadBalancerWithContext is an alternate form of the DeleteInstanceGroupLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context, deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") + err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getInstanceGroupOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/load_balancer`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getInstanceGroupOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -7999,128 +8149,101 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// UpdateInstanceGroup : Update an instance group -// This request updates an instance group with the information provided instance group patch. The instance group patch -// object is structured in the same way as a retrieved instance group and contains only the information to be updated. -func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) +// DeleteInstanceGroupManager : Delete an instance group manager +// This request deletes an instance group manager. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) } -// 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") +// DeleteInstanceGroupManagerWithContext is an alternate form of the DeleteInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") + err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateInstanceGroupOptions.ID, + "instance_group_id": *deleteInstanceGroupManagerOptions.InstanceGroupID, + "id": *deleteInstanceGroupManagerOptions.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/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateInstanceGroupOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateInstanceGroupOptions.InstanceGroupPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer -// This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. -func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) +// DeleteInstanceGroupManagerAction : Delete specified instance group manager action +// This request deletes an instance group manager action. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) } -// 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") +// DeleteInstanceGroupManagerActionWithContext is an alternate form of the DeleteInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Context, deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") + err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupLoadBalancerOptions.InstanceGroupID, + "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}/load_balancer`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -8140,183 +8263,151 @@ func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context return } -// ListInstanceGroupManagers : List all managers for an instance group -// This request lists all managers for an instance group. -func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) +// DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy +// This request deletes an instance group manager policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) } -// 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") +// DeleteInstanceGroupManagerPolicyWithContext is an alternate form of the DeleteInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Context, deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") + err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagersOptions.InstanceGroupID, + "instance_group_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listInstanceGroupManagersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) - } - if listInstanceGroupManagersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagersOptions.Limit)) - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// CreateInstanceGroupManager : Create a manager for an instance group -// This request creates a new instance group manager. -func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) +// DeleteInstanceGroupMembership : Delete an instance group membership +// This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the +// membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. +func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) } -// 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") +// DeleteInstanceGroupMembershipWithContext is an alternate form of the DeleteInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") + err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, + "instance_group_id": *deleteInstanceGroupMembershipOptions.InstanceGroupID, + "id": *deleteInstanceGroupMembershipOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// DeleteInstanceGroupManager : Delete an instance group manager -// This request deletes an instance group manager. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) +// DeleteInstanceGroupMemberships : Delete all memberships from an instance group +// This request deletes all memberships of an instance group. This operation cannot be reversed. reversed. Any +// memberships that have `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. +func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) } -// 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") +// DeleteInstanceGroupMembershipsWithContext is an alternate form of the DeleteInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") + err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerOptions.InstanceGroupID, - "id": *deleteInstanceGroupManagerOptions.ID, + "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}/managers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -8336,41 +8427,40 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, del return } -// GetInstanceGroupManager : Retrieve an instance group manager -// This request retrieves a single instance group manager specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) +// GetInstanceGroup : Retrieve an instance group +// This request retrieves a single instance group specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) } -// 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") +// GetInstanceGroupWithContext is an alternate form of the GetInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupOptions, "getInstanceGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") + err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupManagerOptions.InstanceGroupID, - "id": *getInstanceGroupManagerOptions.ID, + "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/{instance_group_id}/managers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { + for headerName, headerValue := range getInstanceGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -8392,7 +8482,7 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) if err != nil { return } @@ -8402,29 +8492,29 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns return } -// UpdateInstanceGroupManager : Update an instance group manager -// This request updates an instance group manager with the information provided instance group manager patch. -func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) +// GetInstanceGroupManager : Retrieve an instance group manager +// This request retrieves a single instance group manager specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) } -// 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") +// GetInstanceGroupManagerWithContext is an alternate form of the GetInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") + err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerOptions.InstanceGroupID, - "id": *updateInstanceGroupManagerOptions.ID, + "instance_group_id": *getInstanceGroupManagerOptions.InstanceGroupID, + "id": *getInstanceGroupManagerOptions.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) @@ -8432,27 +8522,21 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, upd return } - for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { + for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -8474,41 +8558,42 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, upd return } -// ListInstanceGroupManagerActions : List all actions for an instance group manager -// This request lists all instance group actions for an instance group manager. -func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) +// GetInstanceGroupManagerAction : Retrieve specified instance group manager action +// This request retrieves a single instance group manager action specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerActionWithContext(context.Background(), getInstanceGroupManagerActionOptions) } -// 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") +// GetInstanceGroupManagerActionWithContext is an alternate form of the GetInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") + err = core.ValidateStruct(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagerActionsOptions.InstanceGroupID, - "instance_group_manager_id": *listInstanceGroupManagerActionsOptions.InstanceGroupManagerID, + "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`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listInstanceGroupManagerActionsOptions.Headers { + for headerName, headerValue := range getInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerAction") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -8518,12 +8603,6 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listInstanceGroupManagerActionsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) - } - if listInstanceGroupManagerActionsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -8536,7 +8615,7 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerActionsCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) if err != nil { return } @@ -8546,57 +8625,52 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context return } -// CreateInstanceGroupManagerAction : Create an instance group manager action -// This request creates a new instance group manager action. -func (vpc *VpcV1) CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) +// GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy +// This request retrieves a single instance group manager policy specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) } -// 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") +// GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") + err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *createInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "instance_group_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *getInstanceGroupManagerPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { + for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerAction") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -8608,7 +8682,7 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { return } @@ -8618,97 +8692,41 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex return } -// DeleteInstanceGroupManagerAction : Delete specified instance group manager action -// This request deletes an instance group manager action. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) -} - -// DeleteInstanceGroupManagerActionWithContext is an alternate form of the DeleteInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Context, deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *deleteInstanceGroupManagerActionOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetInstanceGroupManagerAction : Retrieve specified instance group manager action -// This request retrieves a single instance group manager action specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupManagerActionWithContext(context.Background(), getInstanceGroupManagerActionOptions) +// GetInstanceGroupMembership : Retrieve an instance group membership +// This request retrieves a single instance group membership specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) } -// 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") +// GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions") + err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *getInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *getInstanceGroupManagerActionOptions.ID, + "instance_group_id": *getInstanceGroupMembershipOptions.InstanceGroupID, + "id": *getInstanceGroupMembershipOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getInstanceGroupManagerActionOptions.Headers { + for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerAction") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -8730,7 +8748,7 @@ func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) if err != nil { return } @@ -8740,56 +8758,55 @@ func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, return } -// UpdateInstanceGroupManagerAction : Update specified instance group manager action -// This request updates an instance group manager action. -func (vpc *VpcV1) UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) +// ListInstanceGroupManagerActions : List all actions for an instance group manager +// This request lists all instance group actions for an instance group manager. +func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) } -// 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") +// ListInstanceGroupManagerActionsWithContext is an alternate form of the ListInstanceGroupManagerActions method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context, listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions") + err = core.ValidateStruct(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *updateInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *updateInstanceGroupManagerActionOptions.ID, + "instance_group_id": *listInstanceGroupManagerActionsOptions.InstanceGroupID, + "instance_group_manager_id": *listInstanceGroupManagerActionsOptions.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}/actions/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { + for headerName, headerValue := range listInstanceGroupManagerActionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerAction") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) - if err != nil { - return + if listInstanceGroupManagerActionsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) + } + if listInstanceGroupManagerActionsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Limit)) } request, err := builder.Build() @@ -8803,7 +8820,7 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerActionsCollection) if err != nil { return } @@ -8885,55 +8902,54 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex return } -// CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager -// This request creates a new instance group manager policy. -func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) +// ListInstanceGroupManagers : List all managers for an instance group +// This request lists all managers for an instance group. +func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) } -// 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") +// ListInstanceGroupManagersWithContext is an alternate form of the ListInstanceGroupManagers method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") + err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "instance_group_id": *listInstanceGroupManagersOptions.InstanceGroupID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { + for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) - if err != nil { - return + 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() @@ -8947,7 +8963,7 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) if err != nil { return } @@ -8957,97 +8973,103 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex return } -// DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy -// This request deletes an instance group manager policy. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) +// ListInstanceGroupMemberships : List all memberships for an instance group +// This request lists all instance group memberships for an instance group. +func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) } -// 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") +// ListInstanceGroupMembershipsWithContext is an alternate form of the ListInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") + err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *deleteInstanceGroupManagerPolicyOptions.ID, + "instance_group_id": *listInstanceGroupMembershipsOptions.InstanceGroupID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { + for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupMembershipsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) + } + if listInstanceGroupMembershipsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.Limit)) + } request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy -// This request retrieves a single instance group manager policy specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) +// ListInstanceGroups : List all instance groups +// This request lists all instance groups in the region. +func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) } -// GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") +// ListInstanceGroupsWithContext is an alternate form of the ListInstanceGroups method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceGroupsOptions, "listInstanceGroupsOptions") if err != nil { return } - 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) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) if err != nil { return } - for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { + for headerName, headerValue := range listInstanceGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -9057,6 +9079,12 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) + } + if listInstanceGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -9069,7 +9097,7 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) if err != nil { return } @@ -9079,42 +9107,41 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, return } -// UpdateInstanceGroupManagerPolicy : Update an instance group manager policy -// This request updates an instance group manager policy. -func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) +// UpdateInstanceGroup : Update an instance group +// This request updates an instance group with the information provided instance group patch. The instance group patch +// object is structured in the same way as a retrieved instance group and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) } -// 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") +// UpdateInstanceGroupWithContext is an alternate form of the UpdateInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupOptions, "updateInstanceGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") + err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *updateInstanceGroupManagerPolicyOptions.ID, + "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/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { + for headerName, headerValue := range updateInstanceGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -9126,7 +9153,7 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) + _, err = builder.SetBodyContentJSON(updateInstanceGroupOptions.InstanceGroupPatch) if err != nil { return } @@ -9142,7 +9169,7 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) if err != nil { return } @@ -9152,108 +9179,128 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex return } -// DeleteInstanceGroupMemberships : Delete all memberships from an instance group -// This request deletes all memberships of an instance group. This operation cannot be reversed. reversed. Any -// memberships that have `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. -func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) +// UpdateInstanceGroupManager : Update an instance group manager +// This request updates an instance group manager with the information provided instance group manager patch. +func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) } -// 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") +// UpdateInstanceGroupManagerWithContext is an alternate form of the UpdateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") + err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupMembershipsOptions.InstanceGroupID, + "instance_group_id": *updateInstanceGroupManagerOptions.InstanceGroupID, + "id": *updateInstanceGroupManagerOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { + for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + return + } + response.Result = result + } return } -// ListInstanceGroupMemberships : List all memberships for an instance group -// This request lists all instance group memberships for an instance group. -func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) +// UpdateInstanceGroupManagerAction : Update specified instance group manager action +// This request updates an instance group manager action. +func (vpc *VpcV1) UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) } -// 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") +// UpdateInstanceGroupManagerActionWithContext is an alternate form of the UpdateInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Context, updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") + err = core.ValidateStruct(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupMembershipsOptions.InstanceGroupID, + "instance_group_id": *updateInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *updateInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupManagerActionOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { + for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listInstanceGroupMembershipsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) - } - if listInstanceGroupMembershipsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) + if err != nil { + return } request, err := builder.Build() @@ -9267,7 +9314,7 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) if err != nil { return } @@ -9277,106 +9324,58 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l return } -// DeleteInstanceGroupMembership : Delete an instance group membership -// This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the -// membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. -func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) +// UpdateInstanceGroupManagerPolicy : Update an instance group manager policy +// This request updates an instance group manager policy. +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) } -// 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") +// UpdateInstanceGroupManagerPolicyWithContext is an alternate form of the UpdateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Context, updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") + err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupMembershipOptions.InstanceGroupID, - "id": *deleteInstanceGroupMembershipOptions.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, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { + for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetInstanceGroupMembership : Retrieve an instance group membership -// This request retrieves a single instance group membership specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) -} - -// GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupMembershipOptions.InstanceGroupID, - "id": *getInstanceGroupMembershipOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) if err != nil { return } - for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() if err != nil { return @@ -9388,7 +9387,7 @@ func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, get return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { return } @@ -9470,56 +9469,50 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, return } -// ListDedicatedHostGroups : List all dedicated host groups -// This request lists all dedicated host groups in the region. Host groups are a collection of dedicated hosts for -// placement of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. -func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) +// CreateDedicatedHost : Create a dedicated host +// This request creates a new dedicated host. +func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) } -// ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") +// CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) if err != nil { return } - for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { + for headerName, headerValue := range createDedicatedHostOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listDedicatedHostGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) - } - if listDedicatedHostGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) - } - if listDedicatedHostGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostGroupsOptions.ResourceGroupID)) - } - if listDedicatedHostGroupsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostGroupsOptions.ZoneName)) - } - if listDedicatedHostGroupsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listDedicatedHostGroupsOptions.Name)) + + _, err = builder.SetBodyContentJSON(createDedicatedHostOptions.DedicatedHostPrototype) + if err != nil { + return } request, err := builder.Build() @@ -9533,7 +9526,7 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { return } @@ -9626,6 +9619,59 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat return } +// DeleteDedicatedHost : Delete a dedicated host +// This request deletes a dedicated host. +func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) +} + +// DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + // DeleteDedicatedHostGroup : Delete a dedicated host group // This request deletes a dedicated host group. func (vpc *VpcV1) DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { @@ -9679,40 +9725,40 @@ func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, delet return } -// GetDedicatedHostGroup : Retrieve a dedicated host group -// This request retrieves a single dedicated host group specified by the identifier in the URL. -func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) +// GetDedicatedHost : Retrieve a dedicated host +// This request retrieves a single dedicated host specified by the identifiers in the URL. +func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) } -// GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") +// GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") + err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getDedicatedHostGroupOptions.ID, + "id": *getDedicatedHostOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { + for headerName, headerValue := range getDedicatedHostOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -9734,7 +9780,7 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { return } @@ -9744,58 +9790,51 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic return } -// UpdateDedicatedHostGroup : Update a dedicated host group -// This request updates a dedicated host group with the information in a provided dedicated host group patch. The -// dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only -// the information to be updated. -func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - return vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) +// GetDedicatedHostDisk : Retrieve a dedicated host disk +// This request retrieves a single dedicated host disk specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) } -// UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") +// GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") + err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateDedicatedHostGroupOptions.ID, + "dedicated_host_id": *getDedicatedHostDiskOptions.DedicatedHostID, + "id": *getDedicatedHostDiskOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { + for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -9807,7 +9846,7 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) if err != nil { return } @@ -9817,33 +9856,40 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat return } -// ListDedicatedHostProfiles : List all dedicated host profiles -// This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in -// the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. -func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) +// GetDedicatedHostGroup : Retrieve a dedicated host group +// This request retrieves a single dedicated host group specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) } -// ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") +// GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "id": *getDedicatedHostGroupOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { + for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -9853,12 +9899,6 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listDedicatedHostProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) - } - if listDedicatedHostProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -9871,7 +9911,7 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { return } @@ -9946,32 +9986,42 @@ func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDed return } -// ListDedicatedHosts : List all dedicated hosts -// This request lists all dedicated hosts in the region. -func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) +// ListDedicatedHostDisks : List all disks on a dedicated host +// This request lists all disks on a dedicated host. A disk is a physical device that is locally attached to the +// compute node. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) } -// ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") +// ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") if err != nil { return } + err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "dedicated_host_id": *listDedicatedHostDisksOptions.DedicatedHostID, + } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listDedicatedHostsOptions.Headers { + for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -9981,24 +10031,6 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listDedicatedHostsOptions.DedicatedHostGroupID != nil { - builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) - } - if listDedicatedHostsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostsOptions.Start)) - } - if listDedicatedHostsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostsOptions.Limit)) - } - if listDedicatedHostsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostsOptions.ResourceGroupID)) - } - if listDedicatedHostsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostsOptions.ZoneName)) - } - if listDedicatedHostsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listDedicatedHostsOptions.Name)) - } request, err := builder.Build() if err != nil { @@ -10011,7 +10043,7 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) if err != nil { return } @@ -10021,50 +10053,56 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat return } -// CreateDedicatedHost : Create a dedicated host -// This request creates a new dedicated host. -func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - return vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) +// ListDedicatedHostGroups : List all dedicated host groups +// This request lists all dedicated host groups in the region. Host groups are a collection of dedicated hosts for +// placement of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. +func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) } -// CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") +// ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) if err != nil { return } - for headerName, headerValue := range createDedicatedHostOptions.Headers { + for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createDedicatedHostOptions.DedicatedHostPrototype) - if err != nil { - return + if listDedicatedHostGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) + } + if listDedicatedHostGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) + } + if listDedicatedHostGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostGroupsOptions.ResourceGroupID)) + } + if listDedicatedHostGroupsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostGroupsOptions.ZoneName)) + } + if listDedicatedHostGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listDedicatedHostGroupsOptions.Name)) } request, err := builder.Build() @@ -10078,7 +10116,7 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) if err != nil { return } @@ -10088,42 +10126,33 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi return } -// ListDedicatedHostDisks : List all disks on a dedicated host -// This request lists all disks on a dedicated host. A disk is a physical device that is locally attached to the -// compute node. By default, the listed disks are sorted by their -// `created_at` property values, with the newest disk first. -func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) +// ListDedicatedHostProfiles : List all dedicated host profiles +// This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in +// the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. +func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) } -// ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") +// ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "dedicated_host_id": *listDedicatedHostDisksOptions.DedicatedHostID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles`, nil) if err != nil { return } - for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { + for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -10133,6 +10162,12 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listDedicatedHostProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) + } + if listDedicatedHostProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -10145,7 +10180,7 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) if err != nil { return } @@ -10155,41 +10190,32 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed return } -// GetDedicatedHostDisk : Retrieve a dedicated host disk -// This request retrieves a single dedicated host disk specified by the identifier in the URL. -func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) +// ListDedicatedHosts : List all dedicated hosts +// This request lists all dedicated hosts in the region. +func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) } -// GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") +// ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "dedicated_host_id": *getDedicatedHostDiskOptions.DedicatedHostID, - "id": *getDedicatedHostDiskOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) if err != nil { return } - for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { + for headerName, headerValue := range listDedicatedHostsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -10199,6 +10225,24 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listDedicatedHostsOptions.DedicatedHostGroupID != nil { + builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) + } + if listDedicatedHostsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostsOptions.Start)) + } + if listDedicatedHostsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostsOptions.Limit)) + } + if listDedicatedHostsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostsOptions.ResourceGroupID)) + } + if listDedicatedHostsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostsOptions.ZoneName)) + } + if listDedicatedHostsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listDedicatedHostsOptions.Name)) + } request, err := builder.Build() if err != nil { @@ -10211,7 +10255,7 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) if err != nil { return } @@ -10221,41 +10265,42 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica return } -// UpdateDedicatedHostDisk : Update a dedicated host disk -// This request updates the dedicated host disk with the information in a provided patch. -func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - return vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) +// UpdateDedicatedHost : Update a dedicated host +// This request updates a dedicated host with the information in a provided dedicated host patch. The dedicated host +// patch object is structured in the same way as a retrieved dedicated host and contains only the information to be +// updated. +func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) } -// UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") +// UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") + err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") if err != nil { return } pathParamsMap := map[string]string{ - "dedicated_host_id": *updateDedicatedHostDiskOptions.DedicatedHostID, - "id": *updateDedicatedHostDiskOptions.ID, + "id": *updateDedicatedHostOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { + for headerName, headerValue := range updateDedicatedHostOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -10267,7 +10312,7 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) + _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) if err != nil { return } @@ -10283,7 +10328,7 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { return } @@ -10293,103 +10338,57 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update return } -// DeleteDedicatedHost : Delete a dedicated host -// This request deletes a dedicated host. -func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) +// UpdateDedicatedHostDisk : Update a dedicated host disk +// This request updates the dedicated host disk with the information in a provided patch. +func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) } -// DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") +// UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") + err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteDedicatedHostOptions.ID, + "dedicated_host_id": *updateDedicatedHostDiskOptions.DedicatedHostID, + "id": *updateDedicatedHostDiskOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteDedicatedHostOptions.Headers { + for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetDedicatedHost : Retrieve a dedicated host -// This request retrieves a single dedicated host specified by the identifiers in the URL. -func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) -} - -// GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getDedicatedHostOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + _, err = builder.SetBodyContentJSON(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) if err != nil { return } - for headerName, headerValue := range getDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() if err != nil { return @@ -10401,7 +10400,7 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) if err != nil { return } @@ -10411,42 +10410,42 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH return } -// UpdateDedicatedHost : Update a dedicated host -// This request updates a dedicated host with the information in a provided dedicated host patch. The dedicated host -// patch object is structured in the same way as a retrieved dedicated host and contains only the information to be -// updated. -func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - return vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) +// UpdateDedicatedHostGroup : Update a dedicated host group +// This request updates a dedicated host group with the information in a provided dedicated host group patch. The +// dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only +// the information to be updated. +func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) } -// UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") +// UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") + err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateDedicatedHostOptions.ID, + "id": *updateDedicatedHostGroupOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateDedicatedHostOptions.Headers { + for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -10458,84 +10457,11 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListBackupPolicies : List all backup policies -// This request lists all backup policies in the region. Backup policies control which sources are selected for backup -// and include a set of backup policy plans that provide the backup schedules and deletion triggers. -func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) -} - -// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter -func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + _, err = builder.SetBodyContentJSON(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) if err != nil { return } - for headerName, headerValue := range listBackupPoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBackupPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) - } - if listBackupPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) - } - if listBackupPoliciesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) - } - if listBackupPoliciesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) - } - if listBackupPoliciesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) - } - request, err := builder.Build() if err != nil { return @@ -10547,7 +10473,7 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { return } @@ -10641,73 +10567,86 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku return } -// ListBackupPolicyJobs : List all jobs for a backup policy -// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan -// for a resource matching the policy's criteria. -func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) +// CreateBackupPolicyPlan : Create a plan for a backup policy +// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is +// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the +// new backup policy plan. +// +// Backups created by this plan will use the resource group of the source being backed up. +// +// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character +// suffix. +func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) } -// 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") +// CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") + err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") if err != nil { return } pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, + "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { + for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBackupPolicyJobsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) + + body := make(map[string]interface{}) + if createBackupPolicyPlanOptions.CronSpec != nil { + body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec } - if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) + if createBackupPolicyPlanOptions.Active != nil { + body["active"] = createBackupPolicyPlanOptions.Active } - if listBackupPolicyJobsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) + if createBackupPolicyPlanOptions.AttachUserTags != nil { + body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags } - if listBackupPolicyJobsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) + if createBackupPolicyPlanOptions.ClonePolicy != nil { + body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy } - if listBackupPolicyJobsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) + if createBackupPolicyPlanOptions.CopyUserTags != nil { + body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags } - if listBackupPolicyJobsOptions.SourceID != nil { - builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) + if createBackupPolicyPlanOptions.DeletionTrigger != nil { + body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger } - if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { - builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) + if createBackupPolicyPlanOptions.Name != nil { + body["name"] = createBackupPolicyPlanOptions.Name } - if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { - builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) + if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil { + body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return } request, err := builder.Build() @@ -10721,7 +10660,7 @@ func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBacku return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { return } @@ -10731,45 +10670,50 @@ func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBacku return } -// GetBackupPolicyJob : Retrieve a backup policy job -// This request retrieves a single backup policy job specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) +// DeleteBackupPolicy : Delete a backup policy +// This request deletes a backup policy. This operation cannot be reversed. +// +// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, +// the backup policy will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + return vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) } -// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") +// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") + err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, - "id": *getBackupPolicyJobOptions.ID, + "id": *deleteBackupPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBackupPolicyJobOptions.Headers { + for headerName, headerValue := range deleteBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -10787,7 +10731,7 @@ func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPo return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { return } @@ -10797,52 +10741,58 @@ func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPo return } -// ListBackupPolicyPlans : List all plans for a backup policy -// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. -func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) +// DeleteBackupPolicyPlan : Delete a backup policy plan +// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by +// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with +// the plan will run to completion before the plan is deleted. +// +// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing +// completes, the backup policy plan will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) } -// 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") +// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") + err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") if err != nil { return } pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, + "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, + "id": *deleteBackupPolicyPlanOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { + for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBackupPolicyPlansOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) - } request, err := builder.Build() if err != nil { @@ -10855,7 +10805,7 @@ func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBack return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { return } @@ -10865,88 +10815,50 @@ func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBack return } -// CreateBackupPolicyPlan : Create a plan for a backup policy -// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is -// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the -// new backup policy plan. -// -// Backups created by this plan will use the resource group of the source being backed up. -// -// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character -// suffix. -func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) +// GetBackupPolicy : Retrieve a backup policy +// This request retrieves a single backup policy specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) } -// 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") +// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") + err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, + "id": *getBackupPolicyOptions.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, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range getBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createBackupPolicyPlanOptions.CronSpec != nil { - body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec - } - if createBackupPolicyPlanOptions.Active != nil { - body["active"] = createBackupPolicyPlanOptions.Active - } - if createBackupPolicyPlanOptions.AttachUserTags != nil { - body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags - } - if createBackupPolicyPlanOptions.ClonePolicy != nil { - body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy - } - if createBackupPolicyPlanOptions.CopyUserTags != nil { - body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags - } - if createBackupPolicyPlanOptions.DeletionTrigger != nil { - body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger - } - if createBackupPolicyPlanOptions.Name != nil { - body["name"] = createBackupPolicyPlanOptions.Name - } - if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil { - body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -10958,7 +10870,7 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { return } @@ -10968,53 +10880,45 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB return } -// DeleteBackupPolicyPlan : Delete a backup policy plan -// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by -// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with -// the plan will run to completion before the plan is deleted. -// -// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing -// completes, the backup policy plan will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) +// GetBackupPolicyJob : Retrieve a backup policy job +// This request retrieves a single backup policy job specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) } -// 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") +// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") + err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") if err != nil { return } pathParamsMap := map[string]string{ - "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, - "id": *deleteBackupPolicyPlanOptions.ID, + "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, + "id": *getBackupPolicyJobOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range getBackupPolicyJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") 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("future_version", fmt.Sprint("true")) @@ -11032,7 +10936,7 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) if err != nil { return } @@ -11108,59 +11012,56 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP return } -// UpdateBackupPolicyPlan : Update a backup policy plan -// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is -// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) +// ListBackupPolicies : List all backup policies +// This request lists all backup policies in the region. Backup policies control which sources are selected for backup +// and include a set of backup policy plans that provide the backup schedules and deletion triggers. +func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) } -// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") +// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter +func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, - "id": *updateBackupPolicyPlanOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) if err != nil { return } - for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range listBackupPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) - if err != nil { - return + 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() @@ -11174,7 +11075,7 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) if err != nil { return } @@ -11184,55 +11085,74 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB return } -// DeleteBackupPolicy : Delete a backup policy -// This request deletes a backup policy. This operation cannot be reversed. -// -// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, -// the backup policy will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { - return vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) +// ListBackupPolicyJobs : List all jobs for a backup policy +// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan +// for a resource matching the policy's criteria. +func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) } -// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") +// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") + err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteBackupPolicyOptions.ID, + "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteBackupPolicyOptions.Headers { + for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBackupPolicyJobsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) + } + if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) + } + if listBackupPolicyJobsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) + } + if listBackupPolicyJobsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) + } + if listBackupPolicyJobsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) + } + if listBackupPolicyJobsOptions.SourceID != nil { + builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { + builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { + builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) + } request, err := builder.Build() if err != nil { @@ -11245,7 +11165,7 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) if err != nil { return } @@ -11255,40 +11175,40 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku return } -// GetBackupPolicy : Retrieve a backup policy -// This request retrieves a single backup policy specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) +// ListBackupPolicyPlans : List all plans for a backup policy +// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. +func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) } -// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") +// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") + err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getBackupPolicyOptions.ID, + "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBackupPolicyOptions.Headers { + for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11298,6 +11218,9 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBackupPolicyPlansOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) + } request, err := builder.Build() if err != nil { @@ -11310,7 +11233,7 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) if err != nil { return } @@ -11395,46 +11318,59 @@ func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBacku return } -// ListPlacementGroups : List all placement groups -// This request lists all placement groups in the region. -func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) +// UpdateBackupPolicyPlan : Update a backup policy plan +// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is +// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) } -// 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") +// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, + "id": *updateBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listPlacementGroupsOptions.Headers { + for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listPlacementGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) - } - if listPlacementGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) + if err != nil { + return } request, err := builder.Build() @@ -11448,7 +11384,7 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { return } @@ -11654,89 +11590,15 @@ func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacement return } -// UpdatePlacementGroup : Update a placement group -// This request updates a placement group with the information provided placement group patch. The placement group patch -// object is structured in the same way as a retrieved placement group and contains only the information to be updated. -func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - return vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) -} - -// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updatePlacementGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updatePlacementGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updatePlacementGroupOptions.PlacementGroupPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerProfiles : List all bare metal server profiles -// This request lists all [bare metal server -// profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) available in the region. A bare metal -// server profile specifies the performance characteristics and pricing model for a bare metal server. -func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) +// ListPlacementGroups : List all placement groups +// This request lists all placement groups in the region. +func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) } -// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") +// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter +func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") if err != nil { return } @@ -11744,16 +11606,16 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) if err != nil { return } - for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { + for headerName, headerValue := range listPlacementGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11763,11 +11625,11 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServerProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) + if listPlacementGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) } - if listBareMetalServerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.Limit)) + if listPlacementGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.Limit)) } request, err := builder.Build() @@ -11781,7 +11643,7 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) if err != nil { return } @@ -11791,50 +11653,57 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li return } -// GetBareMetalServerProfile : Retrieve a bare metal server profile -// This request retrieves a single bare metal server profile specified by the name in the URL. -func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) +// UpdatePlacementGroup : Update a placement group +// This request updates a placement group with the information provided placement group patch. The placement group patch +// object is structured in the same way as a retrieved placement group and contains only the information to be updated. +func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + return vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) } -// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") +// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") + err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "name": *getBareMetalServerProfileOptions.Name, + "id": *updatePlacementGroupOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { + for headerName, headerValue := range updatePlacementGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updatePlacementGroupOptions.PlacementGroupPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -11846,7 +11715,7 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) if err != nil { return } @@ -11856,32 +11725,45 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB return } -// ListBareMetalServers : List all bare metal servers -// This request lists all bare metal servers in the region. -func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) +// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface +// This request associates the specified floating IP with the specified bare metal server network interface. If +// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` +// is `true`, this replaces any existing association. For this request to succeed, the existing floating IP must not be +// required by another resource, such as a public gateway. A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) } -// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") +// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBareMetalServersOptions.Headers { + for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11891,27 +11773,6 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) - } - if listBareMetalServersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) - } - if listBareMetalServersOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) - } - if listBareMetalServersOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) - } - if listBareMetalServersOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) - } - if listBareMetalServersOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) - } - if listBareMetalServersOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) - } request, err := builder.Build() if err != nil { @@ -11924,7 +11785,7 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { return } @@ -12084,52 +11945,58 @@ func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context return } -// ListBareMetalServerDisks : List all disks on a bare metal server -// This request lists all disks on a bare metal server. A disk is a block device that is locally attached to the -// physical server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk -// first. -func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) +// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server +// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and +// contains the information necessary to create the new bare metal server network attachment. +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) } -// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") +// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") + err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, + "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { + for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -12141,7 +12008,7 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { return } @@ -12151,51 +12018,60 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB return } -// GetBareMetalServerDisk : Retrieve a bare metal server disk -// This request retrieves a single disk specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) +// 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. +func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) } -// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") +// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") + err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, - "id": *getBareMetalServerDiskOptions.ID, + "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { + for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -12207,7 +12083,7 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { return } @@ -12217,325 +12093,211 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare return } -// UpdateBareMetalServerDisk : Update a bare metal server disk -// This request updates the bare metal server disk with the information in a provided patch. -func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) +// DeleteBareMetalServer : Delete a bare metal server +// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the +// bare metal server network interfaces are implicitly disassociated. +func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) } -// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") +// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") + err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, - "id": *updateBareMetalServerDiskOptions.ID, + "id": *deleteBareMetalServerOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server -// This request lists all network attachments on a bare metal server. A network attachment represents a device on the -// bare metal server to which a virtual network interface is attached. Network attachments can be `pci` or `vlan` -// devices for `amd64` based systems, or -// `hipersocket` devices for `s390x` based systems. +// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment +// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network attachment are implicitly disassociated. // -// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. -// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property -// values. -func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) +// The bare metal server's primary network attachment cannot be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) } -// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") +// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") + err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, + "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServerNetworkAttachmentsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) - } - if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server -// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and -// contains the information necessary to create the new bare metal server network attachment. -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) +// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface +// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server +// network interface is not allowed to be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) } -// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") +// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkInterfaceOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment -// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network attachment are implicitly disassociated. -// -// The bare metal server's primary network attachment cannot be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) +// GetBareMetalServer : Retrieve a bare metal server +// This request retrieves a single bare metal server specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) } -// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") +// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, + "id": *getBareMetalServerOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment -// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) -} - -// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -12553,7 +12315,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { return } @@ -12563,59 +12325,51 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con return } -// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment -// This request updates a bare metal server network attachment with the information provided in a bare metal server -// network attachment patch object. The bare metal server network attachment patch object is structured in the same way -// as a retrieved bare metal server network attachment and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) +// GetBareMetalServerDisk : Retrieve a bare metal server disk +// This request retrieves a single disk specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) } -// 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") +// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkAttachmentOptions.ID, + "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, + "id": *getBareMetalServerDiskOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -12627,7 +12381,7 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) if err != nil { return } @@ -12637,43 +12391,42 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. return } -// ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server -// This request lists all network interfaces on a bare metal server. A bare metal server network interface is an -// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network -// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to -// the bare metal server. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) +// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server +// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and +// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be +// current. +func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) } -// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") +// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") + err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, + "id": *getBareMetalServerInitializationOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { + for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12683,12 +12436,6 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServerNetworkInterfacesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) - } - if listBareMetalServerNetworkInterfacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -12701,7 +12448,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) if err != nil { return } @@ -12711,60 +12458,51 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co return } -// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server -// This request creates a new bare metal server network interface from a bare metal server network interface prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and -// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare -// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. -// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. -func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) +// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment +// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) } -// 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") +// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkAttachmentOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -12776,7 +12514,7 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { return } @@ -12786,31 +12524,29 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface -// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server -// network interface is not allowed to be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) +// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface +// This request retrieves a single bare metal server network interface specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) } -// 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") +// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkInterfaceOptions.ID, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkInterfaceOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) @@ -12818,14 +12554,15 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C return } - for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") + 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("future_version", fmt.Sprint("true")) @@ -12837,46 +12574,59 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + response.Result = result + } return } -// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface -// This request retrieves a single bare metal server network interface specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) +// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP if it is associated with the bare metal server network interface +// specified in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) } -// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") +// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkInterfaceOptions.ID, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12898,7 +12648,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { return } @@ -12908,59 +12658,55 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont return } -// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface -// This request updates a bare metal server network interface with the information provided in a bare metal server -// network interface patch object. The bare metal server network interface patch object is structured in the same way as -// a retrieved bare metal server network interface and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) +// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for a bare metal server network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) } -// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") +// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkInterfaceOptions.ID, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceIPOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -12972,7 +12718,7 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { return } @@ -12982,41 +12728,40 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface -// This request lists all floating IPs associated with a bare metal server network interface. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) +// GetBareMetalServerProfile : Retrieve a bare metal server profile +// This request retrieves a single bare metal server profile specified by the name in the URL. +func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) } -// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") +// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") + err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, - "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + "name": *getBareMetalServerProfileOptions.Name, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { + for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13038,7 +12783,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) if err != nil { return } @@ -13048,45 +12793,46 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx return } -// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface -// This request disassociates the specified floating IP from the specified bare metal server network interface. -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) +// ListBareMetalServerDisks : List all disks on a bare metal server +// This request lists all disks on a bare metal server. A disk is a block device that is locally attached to the +// physical server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk +// first. +func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) } -// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") +// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -13098,48 +12844,63 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the bare metal server network interface -// specified in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) +// ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server +// This request lists all network attachments on a bare metal server. A network attachment represents a device on the +// bare metal server to which a virtual network interface is attached. Network attachments can be `pci` or `vlan` +// devices for `amd64` based systems, or +// `hipersocket` devices for `s390x` based systems. +// +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) } -// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") +// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13149,6 +12910,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServerNetworkAttachmentsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) + } + if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -13161,7 +12928,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) if err != nil { return } @@ -13171,45 +12938,41 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } -// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface -// This request associates the specified floating IP with the specified bare metal server network interface. If -// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` -// is `true`, this replaces any existing association. For this request to succeed, the existing floating IP must not be -// required by another resource, such as a public gateway. A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) +// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface +// This request lists all floating IPs associated with a bare metal server network interface. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) } -// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") +// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13231,7 +12994,7 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) if err != nil { return } @@ -13310,45 +13073,43 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. return } -// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP -// This request retrieves the primary reserved IP for a bare metal server network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) +// ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server +// This request lists all network interfaces on a bare metal server. A bare metal server network interface is an +// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network +// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to +// the bare metal server. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) } -// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") +// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceIPOptions.ID, + "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13358,6 +13119,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServerNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) + } + if listBareMetalServerNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -13370,7 +13137,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) if err != nil { return } @@ -13380,103 +13147,49 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co return } -// DeleteBareMetalServer : Delete a bare metal server -// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the -// bare metal server network interfaces are implicitly disassociated. -func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) +// ListBareMetalServerProfiles : List all bare metal server profiles +// This request lists all [bare metal server +// profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) available in the region. A bare metal +// server profile specifies the performance characteristics and pricing model for a bare metal server. +func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) } -// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") +// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *deleteBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) if err != nil { return } - for headerName, headerValue := range deleteBareMetalServerOptions.Headers { + for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetBareMetalServer : Retrieve a bare metal server -// This request retrieves a single bare metal server specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) -} - -// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) + } + if listBareMetalServerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -13489,7 +13202,7 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) if err != nil { return } @@ -13499,55 +13212,61 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta return } -// UpdateBareMetalServer : Update a bare metal server -// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object -// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) +// ListBareMetalServers : List all bare metal servers +// This request lists all bare metal servers in the region. +func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) } -// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") +// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *updateBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) if err != nil { return } - for headerName, headerValue := range updateBareMetalServerOptions.Headers { + for headerName, headerValue := range listBareMetalServersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateBareMetalServerOptions.BareMetalServerPatch) - if err != nil { - return + if listBareMetalServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) + } + if listBareMetalServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) + } + if listBareMetalServersOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) + } + if listBareMetalServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) + } + if listBareMetalServersOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) + } + if listBareMetalServersOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) + } + if listBareMetalServersOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) } request, err := builder.Build() @@ -13561,7 +13280,7 @@ func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBa return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) if err != nil { return } @@ -13571,46 +13290,45 @@ func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBa return } -// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server -// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and -// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be -// current. -func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) +// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface +// This request disassociates the specified floating IP from the specified bare metal server network interface. +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) } -// 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") +// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") + err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getBareMetalServerInitializationOptions.ID, + "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { + for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -13622,18 +13340,7 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } @@ -13808,47 +13515,55 @@ func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMe return } -// ListVolumeProfiles : List all volume profiles -// This request lists all [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available -// in the region. A volume profile specifies the performance characteristics and pricing model for a volume. -func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) +// UpdateBareMetalServer : Update a bare metal server +// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object +// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) } -// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter -func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") +// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *updateBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVolumeProfilesOptions.Headers { + for headerName, headerValue := range updateBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVolumeProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) - } - if listVolumeProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerOptions.BareMetalServerPatch) + if err != nil { + return } request, err := builder.Build() @@ -13862,7 +13577,7 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { return } @@ -13872,50 +13587,57 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP return } -// GetVolumeProfile : Retrieve a volume profile -// This request retrieves a single volume profile specified by the name in the URL. -func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - return vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) +// UpdateBareMetalServerDisk : Update a bare metal server disk +// This request updates the bare metal server disk with the information in a provided patch. +func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) } -// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter -func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") +// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") + err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") if err != nil { return } pathParamsMap := map[string]string{ - "name": *getVolumeProfileOptions.Name, + "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, + "id": *updateBareMetalServerDiskOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVolumeProfileOptions.Headers { + for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -13927,7 +13649,7 @@ func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProf return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) if err != nil { return } @@ -13937,65 +13659,131 @@ func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProf return } -// ListVolumes : List all volumes -// This request lists all volumes in the region. Volumes are network-connected block storage devices that may be -// attached to one or more instances in the same region. -func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - return vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) +// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment +// This request updates a bare metal server network attachment with the information provided in a bare metal server +// network attachment patch object. The bare metal server network attachment patch object is structured in the same way +// as a retrieved bare metal server network attachment and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) } -// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter -func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") +// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVolumesOptions.Headers { + for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVolumesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) + if err != nil { + return } - if listVolumesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) + + request, err := builder.Build() + if err != nil { + return } - if listVolumesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return } - if listVolumesOptions.AttachmentState != nil { - builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + response.Result = result } - if listVolumesOptions.Encryption != nil { - builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) + + 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. +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) +} + +// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return } - if listVolumesOptions.OperatingSystemFamily != nil { - builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) + err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") + if err != nil { + return } - if listVolumesOptions.OperatingSystemArchitecture != nil { - builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkInterfaceOptions.ID, } - if listVolumesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) + if err != nil { + return } request, err := builder.Build() @@ -14009,7 +13797,7 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { return } @@ -14209,60 +13997,50 @@ func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *Ge return } -// UpdateVolume : Update a volume -// This request updates a volume with the information in a provided volume patch. The volume patch object is structured -// in the same way as a retrieved volume and contains only the information to be updated. -func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - return vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) +// GetVolumeProfile : Retrieve a volume profile +// This request retrieves a single volume profile specified by the name in the URL. +func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + return vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) } -// 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") +// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter +func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") + err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateVolumeOptions.ID, + "name": *getVolumeProfileOptions.Name, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateVolumeOptions.Headers { + for headerName, headerValue := range getVolumeProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVolumeOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -14274,7 +14052,7 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) if err != nil { return } @@ -14284,66 +14062,80 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio return } -// DeleteSnapshots : Delete a filtered collection of snapshots -// This request deletes all snapshots created from a specific source volume. -func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) +// ListVolumeProfiles : List all volume profiles +// This request lists all [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available +// in the region. A volume profile specifies the performance characteristics and pricing model for a volume. +func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) } -// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") +// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter +func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.DELETE) + 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, `/volume/profiles`, nil) if err != nil { return } - for headerName, headerValue := range deleteSnapshotsOptions.Headers { + for headerName, headerValue := range listVolumeProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) + if listVolumeProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) + } + if listVolumeProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) + } request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) + if err != nil { + return + } + response.Result = result + } return } -// ListSnapshots : List all snapshots -// This request lists all snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is -// created. -func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - return vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) +// ListVolumes : List all volumes +// This request lists all volumes in the region. Volumes are network-connected block storage devices that may be +// attached to one or more instances in the same region. +func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + return vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) } -// 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") +// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter +func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") if err != nil { return } @@ -14351,16 +14143,16 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt 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, `/volumes`, nil) if err != nil { return } - for headerName, headerValue := range listSnapshotsOptions.Headers { + for headerName, headerValue := range listVolumesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14370,65 +14162,104 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSnapshotsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) - } - if listSnapshotsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) + if listVolumesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) } - if listSnapshotsOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) + if listVolumesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) } - if listSnapshotsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) + if listVolumesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) } - if listSnapshotsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) + if listVolumesOptions.AttachmentState != nil { + builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) } - if listSnapshotsOptions.SourceVolumeID != nil { - builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) + if listVolumesOptions.Encryption != nil { + builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) } - if listSnapshotsOptions.SourceVolumeCRN != nil { - builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) + if listVolumesOptions.OperatingSystemFamily != nil { + builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) } - if listSnapshotsOptions.SourceImageID != nil { - builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) + if listVolumesOptions.OperatingSystemArchitecture != nil { + builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) } - if listSnapshotsOptions.SourceImageCRN != nil { - builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) + if listVolumesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) } - if listSnapshotsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) + + request, err := builder.Build() + if err != nil { + return } - if listSnapshotsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return } - if listSnapshotsOptions.CopiesID != nil { - builder.AddQuery("copies[].id", fmt.Sprint(*listSnapshotsOptions.CopiesID)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) + if err != nil { + return + } + response.Result = result } - if listSnapshotsOptions.CopiesName != nil { - builder.AddQuery("copies[].name", fmt.Sprint(*listSnapshotsOptions.CopiesName)) + + return +} + +// UpdateVolume : Update a volume +// This request updates a volume with the information in a provided volume patch. The volume patch object is structured +// in the same way as a retrieved volume and contains only the information to be updated. +func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) +} + +// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter +func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") + if err != nil { + return } - if listSnapshotsOptions.CopiesCRN != nil { - builder.AddQuery("copies[].crn", fmt.Sprint(*listSnapshotsOptions.CopiesCRN)) + err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") + if err != nil { + return } - if listSnapshotsOptions.CopiesRemoteRegionName != nil { - builder.AddQuery("copies[].remote.region.name", fmt.Sprint(*listSnapshotsOptions.CopiesRemoteRegionName)) + + pathParamsMap := map[string]string{ + "id": *updateVolumeOptions.ID, } - if listSnapshotsOptions.SourceSnapshotID != nil { - builder.AddQuery("source_snapshot.id", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotID)) + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + return } - if listSnapshotsOptions.SourceSnapshotRemoteRegionName != nil { - builder.AddQuery("source_snapshot.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotRemoteRegionName)) + + for headerName, headerValue := range updateVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) } - if listSnapshotsOptions.SourceVolumeRemoteRegionName != nil { - builder.AddQuery("source_volume.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceVolumeRemoteRegionName)) + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - if listSnapshotsOptions.SourceImageRemoteRegionName != nil { - builder.AddQuery("source_image.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceImageRemoteRegionName)) + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) } - if listSnapshotsOptions.ClonesZoneName != nil { - builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) + if err != nil { + return } request, err := builder.Build() @@ -14442,7 +14273,7 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) if err != nil { return } @@ -14520,46 +14351,46 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO return } -// DeleteSnapshot : Delete a snapshot -// This request deletes a snapshot. This operation cannot be reversed. -func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) +// CreateSnapshotClone : Create a clone for a snapshot +// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if +// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. +func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + return vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) } -// 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") +// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") + err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteSnapshotOptions.ID, + "id": *createSnapshotCloneOptions.ID, + "zone_name": *createSnapshotCloneOptions.ZoneName, } - 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, `/snapshots/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteSnapshotOptions.Headers { + for headerName, headerValue := range createSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) - } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -14571,33 +14402,44 @@ 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 { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + if err != nil { + return + } + response.Result = result + } return } -// GetSnapshot : Retrieve a snapshot -// This request retrieves a single snapshot specified by the identifier in the URL. -func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) +// DeleteSnapshot : Delete a snapshot +// This request deletes a snapshot. This operation cannot be reversed. +func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) } -// 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") +// DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") + err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getSnapshotOptions.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, `/snapshots/{id}`, pathParamsMap) @@ -14605,15 +14447,17 @@ func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions return } - for headerName, headerValue := range getSnapshotOptions.Headers { + for headerName, headerValue := range deleteSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + if deleteSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -14625,201 +14469,154 @@ func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// UpdateSnapshot : Update a snapshot -// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group -// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. -func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) +// DeleteSnapshotClone : Delete a snapshot clone +// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated +// from the snapshot. +func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) } -// 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") +// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") + err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateSnapshotOptions.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, `/snapshots/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateSnapshotOptions.Headers { + for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListSnapshotClones : List all clones for a snapshot -// This request lists all clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. -func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - return vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) +// DeleteSnapshots : Delete a filtered collection of snapshots +// This request deletes all snapshots created from a specific source volume. +func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) } -// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") +// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") + err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *listSnapshotClonesOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { return } - for headerName, headerValue := range listSnapshotClonesOptions.Headers { + for headerName, headerValue := range deleteSnapshotsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// DeleteSnapshotClone : Delete a snapshot clone -// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated -// from the snapshot. -func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) +// GetSnapshot : Retrieve a snapshot +// This request retrieves a single snapshot specified by the identifier in the URL. +func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) } -// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") +// GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") + err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteSnapshotCloneOptions.ID, - "zone_name": *deleteSnapshotCloneOptions.ZoneName, + "id": *getSnapshotOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { + for headerName, headerValue := range getSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -14831,7 +14628,18 @@ func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnap return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + if err != nil { + return + } + response.Result = result + } return } @@ -14902,42 +14710,40 @@ func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCl return } -// CreateSnapshotClone : Create a clone for a snapshot -// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if -// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. -func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - return vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) +// ListSnapshotClones : List all clones for a snapshot +// This request lists all clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. +func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + return vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) } -// 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") +// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") + err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *createSnapshotCloneOptions.ID, - "zone_name": *createSnapshotCloneOptions.ZoneName, + "id": *listSnapshotClonesOptions.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, `/snapshots/{id}/clones`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createSnapshotCloneOptions.Headers { + for headerName, headerValue := range listSnapshotClonesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14959,7 +14765,7 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) if err != nil { return } @@ -14969,17 +14775,16 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap return } -// ListShareProfiles : List all file share profiles -// This request lists all [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) -// available in the region. A file share profile specifies the performance characteristics and pricing model for a file -// share. -func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) +// ListSnapshots : List all snapshots +// This request lists all snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is +// created. +func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + return vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) } -// 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") +// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") if err != nil { return } @@ -14987,16 +14792,16 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { return } - for headerName, headerValue := range listShareProfilesOptions.Headers { + for headerName, headerValue := range listSnapshotsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15006,14 +14811,65 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listShareProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) + if listSnapshotsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) } - if listShareProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) + if listSnapshotsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) } - if listShareProfilesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) + 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)) } request, err := builder.Build() @@ -15027,7 +14883,7 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) if err != nil { return } @@ -15037,50 +14893,60 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro return } -// GetShareProfile : Retrieve a file share profile -// This request retrieves a single file share profile specified by the name in the URL. -func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - return vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) +// UpdateSnapshot : Update a snapshot +// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group +// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. +func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) } -// 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") +// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") + err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") if err != nil { return } pathParamsMap := map[string]string{ - "name": *getShareProfileOptions.Name, + "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, `/share/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getShareProfileOptions.Headers { + for headerName, headerValue := range updateSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -15092,7 +14958,7 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) if err != nil { return } @@ -15102,20 +14968,28 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil return } -// ListShares : List all file shares -// This request lists all file shares in the region. -func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - return vpc.ListSharesWithContext(context.Background(), listSharesOptions) +// CreateShare : Create a file share +// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, +// a replica share, or both a source and replica share. +// +// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to +// provision the new file shares. +func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.CreateShareWithContext(context.Background(), createShareOptions) } -// 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") +// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter +func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createShareOptions, "createShareOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) @@ -15123,37 +14997,25 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * return } - for headerName, headerValue := range listSharesOptions.Headers { + for headerName, headerValue := range createShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSharesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) - } - if listSharesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) - } - if listSharesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) - } - if listSharesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) - } - if listSharesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) - } - if listSharesOptions.ReplicationRole != nil { - builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) + + _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) + if err != nil { + return } request, err := builder.Build() @@ -15167,7 +15029,7 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { return } @@ -15177,40 +15039,43 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * return } -// CreateShare : Create a file share -// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, -// a replica share, or both a source and replica share. +// 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, and contains the information necessary to -// provision the new file shares. -func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.CreateShareWithContext(context.Background(), createShareOptions) +// The prototype object is structured in the same way as a retrieved share mount target, and contains the information +// necessary to provision the new file share mount target. +func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) } -// 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") +// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createShareOptions, "createShareOptions") + err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "share_id": *createShareMountTargetOptions.ShareID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createShareOptions.Headers { + for headerName, headerValue := range createShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15222,7 +15087,7 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) + _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) if err != nil { return } @@ -15238,7 +15103,7 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { return } @@ -15322,40 +15187,44 @@ func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions return } -// GetShare : Retrieve a file share -// This request retrieves a single file share specified by the identifier in the URL. -func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.GetShareWithContext(context.Background(), getShareOptions) +// DeleteShareMountTarget : Delete a share mount target +// This request deletes a share mount target. This operation cannot be reversed. +// +// If the request is accepted, the share mount target `lifecycle_state` will be set to +// `deleting`. Once deletion processing completes, it will no longer be retrievable. +func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) } -// 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") +// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getShareOptions, "getShareOptions") + err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getShareOptions.ID, + "share_id": *deleteShareMountTargetOptions.ShareID, + "id": *deleteShareMountTargetOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getShareOptions.Headers { + for headerName, headerValue := range deleteShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15377,7 +15246,7 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { return } @@ -15387,77 +15256,59 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS return } -// UpdateShare : Update a file share -// This request updates a share with the information in a provided share patch. The share patch object is structured in -// the same way as a retrieved share and contains only the information to be updated. -func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.UpdateShareWithContext(context.Background(), updateShareOptions) +// DeleteShareSource : Split the source file share from a replica share +// This request removes the replication relationship between a source share and the replica share specified by the +// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a +// `lifecycle_state` of `updating`, or has a replication operation in progress. +// +// This operation cannot be reversed. +func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) } -// 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") +// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter +func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateShareOptions, "updateShareOptions") + err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateShareOptions.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, `/shares/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateShareOptions.Headers { + for headerName, headerValue := range deleteShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } @@ -15533,44 +15384,40 @@ func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOpt return } -// ListShareMountTargets : List all mount targets for a file share -// This request retrieves all share mount targets for a file share. A share mount target is a network endpoint at which -// a file share may be mounted. The file share can be mounted by clients in the same VPC and zone after creating share -// mount targets. -// -// The share mount targets will be sorted by their `created_at` property values, with newest targets first. -func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - return vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) +// GetShare : Retrieve a file share +// This request retrieves a single file share specified by the identifier in the URL. +func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.GetShareWithContext(context.Background(), getShareOptions) } -// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter -func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") +// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter +func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") + err = core.ValidateStruct(getShareOptions, "getShareOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *listShareMountTargetsOptions.ShareID, + "id": *getShareOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listShareMountTargetsOptions.Headers { + for headerName, headerValue := range getShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15580,15 +15427,6 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listShareMountTargetsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) - } - if listShareMountTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) - } - if listShareMountTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -15601,7 +15439,7 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { return } @@ -15611,59 +15449,51 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar return } -// CreateShareMountTarget : Create a mount target for a file share -// This request creates a new share mount target from a share mount target prototype object. -// -// The prototype object is structured in the same way as a retrieved share mount target, and contains the information -// necessary to provision the new file share mount target. -func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) +// GetShareMountTarget : Retrieve a share mount target +// This request retrieves a single share mount target specified by the identifier in the URL. +func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) } -// 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") +// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") + err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *createShareMountTargetOptions.ShareID, + "share_id": *getShareMountTargetOptions.ShareID, + "id": *getShareMountTargetOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createShareMountTargetOptions.Headers { + for headerName, headerValue := range getShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -15685,44 +15515,40 @@ func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createS return } -// DeleteShareMountTarget : Delete a share mount target -// This request deletes a share mount target. This operation cannot be reversed. -// -// If the request is accepted, the share mount target `lifecycle_state` will be set to -// `deleting`. Once deletion processing completes, it will no longer be retrievable. -func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) +// GetShareProfile : Retrieve a file share profile +// This request retrieves a single file share profile specified by the name in the URL. +func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + return vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) } -// 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") +// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter +func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") + err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *deleteShareMountTargetOptions.ShareID, - "id": *deleteShareMountTargetOptions.ID, + "name": *getShareProfileOptions.Name, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteShareMountTargetOptions.Headers { + for headerName, headerValue := range getShareProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15744,7 +15570,7 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) if err != nil { return } @@ -15754,41 +15580,41 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS return } -// GetShareMountTarget : Retrieve a share mount target -// This request retrieves a single share mount target specified by the identifier in the URL. -func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) +// GetShareSource : Retrieve the source file share for a replica file share +// This request retrieves the source file share associated with the replica file share specified by the identifier in +// the URL. +func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) } -// 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") +// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter +func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") + err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *getShareMountTargetOptions.ShareID, - "id": *getShareMountTargetOptions.ID, + "share_id": *getShareSourceOptions.ShareID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getShareMountTargetOptions.Headers { + for headerName, headerValue := range getShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15810,7 +15636,7 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { return } @@ -15820,57 +15646,61 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo return } -// UpdateShareMountTarget : Update a share mount target -// This request updates a share mount target with the information provided in a share mount target patch object. The -// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain -// only the information to be updated. -func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) +// ListShareMountTargets : List all mount targets for a file share +// This request retrieves all share mount targets for a file share. A share mount target is a network endpoint at which +// a file share may be mounted. The file share can be mounted by clients in the same VPC and zone after creating share +// mount targets. +// +// The share mount targets will be sorted by their `created_at` property values, with newest targets first. +func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + return vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) } -// 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") +// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter +func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") + err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *updateShareMountTargetOptions.ShareID, - "id": *updateShareMountTargetOptions.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, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateShareMountTargetOptions.Headers { + for headerName, headerValue := range listShareMountTargetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateShareMountTargetOptions.ShareMountTargetPatch) - if err != nil { - return + if listShareMountTargetsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) + } + if listShareMountTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) + } + if listShareMountTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) } request, err := builder.Build() @@ -15884,7 +15714,7 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) if err != nil { return } @@ -15894,108 +15724,203 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS return } -// DeleteShareSource : Split the source file share from a replica share -// This request removes the replication relationship between a source share and the replica share specified by the -// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a -// `lifecycle_state` of `updating`, or has a replication operation in progress. -// -// This operation cannot be reversed. -func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) +// ListShareProfiles : List all file share profiles +// This request lists all [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) +// available in the region. A file share profile specifies the performance characteristics and pricing model for a file +// share. +func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) } -// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter -func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") +// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter +func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "share_id": *deleteShareSourceOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) if err != nil { return } - for headerName, headerValue := range deleteShareSourceOptions.Headers { + for headerName, headerValue := range listShareProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listShareProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) + } + if listShareProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) + } + if listShareProfilesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) + } request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) - - 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 *Share, response *core.DetailedResponse, err error) { - return vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) -} - -// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter -func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } - err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListShares : List all file shares +// This request lists all file shares in the region. +func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + return vpc.ListSharesWithContext(context.Background(), listSharesOptions) +} + +// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter +func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSharesOptions, "listSharesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSharesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSharesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) + } + if listSharesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) + } + if listSharesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) + } + if listSharesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) + } + if listSharesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) + } + if listSharesOptions.ReplicationRole != nil { + builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateShare : Update a file share +// This request updates a share with the information in a provided share patch. The share patch object is structured in +// the same way as a retrieved share and contains only the information to be updated. +func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.UpdateShareWithContext(context.Background(), updateShareOptions) +} + +// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter +func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateShareOptions, "updateShareOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *getShareSourceOptions.ShareID, + "id": *updateShareOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getShareSourceOptions.Headers { + for headerName, headerValue := range updateShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -16017,46 +15942,59 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO return } -// ListRegions : List all regions -// This request lists all regions. Each region is a separate geographic area that contains multiple isolated zones. -// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones -// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation -// available. Resources deployed within a single region also benefit from the low latency afforded by geographic -// proximity. -func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { - return vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) +// UpdateShareMountTarget : Update a share mount target +// This request updates a share mount target with the information provided in a share mount target patch object. The +// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) } -// 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") +// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + 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, `/regions`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listRegionsOptions.Headers { + for headerName, headerValue := range updateShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateShareMountTargetOptions.ShareMountTargetPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -16068,7 +16006,7 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { return } @@ -16143,6 +16081,72 @@ 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) { + return vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) +} + +// GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter +func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "region_name": *getRegionZoneOptions.RegionName, + "name": *getRegionZoneOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getRegionZoneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) + if err != nil { + return + } + response.Result = result + } + + return +} + // ListRegionZones : List all zones in a region // This request lists all zones in a region. Zones represent logically-isolated data centers with high-bandwidth and // low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. @@ -16209,41 +16213,110 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone return } -// GetRegionZone : Retrieve a zone -// This request retrieves a single zone specified by the region and zone names in the URL. -func (vpc *VpcV1) GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { - return vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) +// ListRegions : List all regions +// This request lists all regions. Each region is a separate geographic area that contains multiple isolated zones. +// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones +// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation +// available. Resources deployed within a single region also benefit from the low latency afforded by geographic +// proximity. +func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + return vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) } -// GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter -func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") +// ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter +func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") if err != nil { return } - err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listRegionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddNetworkInterfaceFloatingIP : Associate a floating IP with a virtual network interface +// This request associates the specified floating IP with the specified virtual network interface. A request body is not +// required, and if provided, is ignored. +// +// If `enable_infrastructure_nat` is `true`, this replaces any existing floating IP association. +// +// If `enable_infrastructure_nat` is `false`, this adds the floating IP to any existing associations. +// +// The floating IP must not currently be associated with another resource. The virtual network interface's `target` must +// not currently be a file share mount target. +func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + return vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) +} + +// AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "region_name": *getRegionZoneOptions.RegionName, - "name": *getRegionZoneOptions.Name, + "virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *addNetworkInterfaceFloatingIPOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getRegionZoneOptions.Headers { + for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16265,7 +16338,7 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) if err != nil { return } @@ -16275,37 +16348,44 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt return } -// ListVirtualNetworkInterfaces : List all virtual network interfaces -// This request lists all virtual network interfaces in the region. A virtual network interface is a logical abstraction -// of a virtual network interface in a subnet, and may be attached to a target resource. +// AddVirtualNetworkInterfaceIP : Bind a reserved IP to a virtual network interface +// This request binds the specified reserved IP to the specified virtual network interface. // -// The virtual network interfaces will be sorted by their `created_at` property values, with newest virtual network -// interfaces first. Virtual network interfaces with identical -// `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - return vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) +// The reserved IP must currently be unbound and in the same subnet as the `primary_ip`. The virtual network interface's +// `target` must not currently be a file share mount target. +func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + return vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) } -// ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions") +// AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *addVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { + for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16315,15 +16395,6 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVirtualNetworkInterfacesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) - } - if listVirtualNetworkInterfacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Limit)) - } - if listVirtualNetworkInterfacesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVirtualNetworkInterfacesOptions.ResourceGroupID)) - } request, err := builder.Build() if err != nil { @@ -16336,7 +16407,7 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) if err != nil { return } @@ -16498,6 +16569,73 @@ 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) { + return vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) +} + +// GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *getNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + // GetVirtualNetworkInterface : Retrieve a virtual network interface // This request retrieves a single virtual network interface specified by the identifier in the URL. func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { @@ -16563,58 +16701,52 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, get return } -// UpdateVirtualNetworkInterface : Update a virtual network interface -// This request updates a virtual network interface with the information in a provided virtual network interface patch. -// The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and -// contains only the information to be updated. -func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - return vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) +// GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP +// This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in +// the URL. +func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + return vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) } -// 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") +// GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") + err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateVirtualNetworkInterfaceOptions.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, `/virtual_network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateVirtualNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -16626,7 +16758,7 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) if err != nil { return } @@ -16710,105 +16842,58 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context return } -// RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface -// This request disassociates the specified floating IP from the specified virtual network interface. -func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) +// ListVirtualNetworkInterfaceIps : List all reserved IPs bound to a virtual network interface +// This request lists all reserved IPs bound to a virtual network interface. +func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) } -// 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") +// ListVirtualNetworkInterfaceIpsWithContext is an alternate form of the ListVirtualNetworkInterfaceIps method which supports a Context parameter +func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *removeNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *removeNetworkInterfaceFloatingIPOptions.ID, + "virtual_network_interface_id": *listVirtualNetworkInterfaceIpsOptions.VirtualNetworkInterfaceID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listVirtualNetworkInterfaceIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the virtual network interface specified in -// the URL. -func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - return vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) -} - -// GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *getNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - return + if listVirtualNetworkInterfaceIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start)) } - - for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) + if listVirtualNetworkInterfaceIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Limit)) } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) + if listVirtualNetworkInterfaceIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Sort)) } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) request, err := builder.Build() if err != nil { @@ -16821,7 +16906,7 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) if err != nil { return } @@ -16831,49 +16916,37 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, return } -// AddNetworkInterfaceFloatingIP : Associate a floating IP with a virtual network interface -// This request associates the specified floating IP with the specified virtual network interface. A request body is not -// required, and if provided, is ignored. -// -// If `enable_infrastructure_nat` is `true`, this replaces any existing floating IP association. -// -// If `enable_infrastructure_nat` is `false`, this adds the floating IP to any existing associations. +// ListVirtualNetworkInterfaces : List all virtual network interfaces +// This request lists all virtual network interfaces in the region. A virtual network interface is a logical abstraction +// of a virtual network interface in a subnet, and may be attached to a target resource. // -// The floating IP must not currently be associated with another resource. The virtual network interface's `target` must -// not currently be a file share mount target. -func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - return vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) +// The virtual network interfaces will be sorted by their `created_at` property values, with newest virtual network +// interfaces first. Virtual network interfaces with identical +// `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + return vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) } -// AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") +// ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *addNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) if err != nil { return } - for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16883,6 +16956,15 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVirtualNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) + } + if listVirtualNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Limit)) + } + if listVirtualNetworkInterfacesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVirtualNetworkInterfacesOptions.ResourceGroupID)) + } request, err := builder.Build() if err != nil { @@ -16895,7 +16977,7 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection) if err != nil { return } @@ -16905,76 +16987,56 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, return } -// ListVirtualNetworkInterfaceIps : List all reserved IPs bound to a virtual network interface -// This request lists all reserved IPs bound to a virtual network interface. -func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) +// RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface +// This request disassociates the specified floating IP from the specified virtual network interface. +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) } -// ListVirtualNetworkInterfaceIpsWithContext is an alternate form of the ListVirtualNetworkInterfaceIps method which supports a Context parameter -func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions cannot be nil") +// RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions") + err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *listVirtualNetworkInterfaceIpsOptions.VirtualNetworkInterfaceID, + "virtual_network_interface_id": *removeNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *removeNetworkInterfaceFloatingIPOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVirtualNetworkInterfaceIpsOptions.Headers { + for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaceIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVirtualNetworkInterfaceIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start)) - } - if listVirtualNetworkInterfaceIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Limit)) - } - if listVirtualNetworkInterfaceIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Sort)) - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } @@ -17036,189 +17098,58 @@ func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context return } -// GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in -// the URL. -func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - return vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) -} - -// GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *getVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, - "id": *getVirtualNetworkInterfaceIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) - if err != nil { - return - } - response.Result = result - } - - return -} - -// 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 same subnet as the `primary_ip`. The virtual network interface's -// `target` must not currently be a file share mount target. -func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - return vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) +// UpdateVirtualNetworkInterface : Update a virtual network interface +// This request updates a virtual network interface with the information in a provided virtual network interface patch. +// The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and +// contains only the information to be updated. +func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + return vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) } -// 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") +// UpdateVirtualNetworkInterfaceWithContext is an alternate form of the UpdateVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") + err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, - "id": *addVirtualNetworkInterfaceIPOptions.ID, + "id": *updateVirtualNetworkInterfaceOptions.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, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range updateVirtualNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListPublicGateways : List all public gateways -// This request lists all public gateways in the region. A public gateway is a virtual network device associated with a -// VPC, which allows access to the Internet. A public gateway resides in a zone and can be connected to subnets in the -// same zone only. -func (vpc *VpcV1) ListPublicGateways(listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { - return vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) -} - -// ListPublicGatewaysWithContext is an alternate form of the ListPublicGateways method which supports a Context parameter -func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listPublicGatewaysOptions, "listPublicGatewaysOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) + _, err = builder.SetBodyContentJSON(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) if err != nil { return } - for headerName, headerValue := range listPublicGatewaysOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listPublicGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) - } - if listPublicGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) - } - if listPublicGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) - } - request, err := builder.Build() if err != nil { return @@ -17230,7 +17161,7 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) if err != nil { return } @@ -17448,54 +17379,51 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate return } -// UpdatePublicGateway : Update a public gateway -// This request updates a public gateway's name. -func (vpc *VpcV1) UpdatePublicGateway(updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - return vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) +// ListPublicGateways : List all public gateways +// This request lists all public gateways in the region. A public gateway is a virtual network device associated with a +// VPC, which allows access to the Internet. A public gateway resides in a zone and can be connected to subnets in the +// same zone only. +func (vpc *VpcV1) ListPublicGateways(listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { + return vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) } -// UpdatePublicGatewayWithContext is an alternate form of the UpdatePublicGateway method which supports a Context parameter -func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePublicGatewayOptions, "updatePublicGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") +// ListPublicGatewaysWithContext is an alternate form of the ListPublicGateways method which supports a Context parameter +func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPublicGatewaysOptions, "listPublicGatewaysOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *updatePublicGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) if err != nil { return } - for headerName, headerValue := range updatePublicGatewayOptions.Headers { + for headerName, headerValue := range listPublicGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) - if err != nil { - return + if listPublicGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) + } + if listPublicGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) + } + if listPublicGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) } request, err := builder.Build() @@ -17509,7 +17437,7 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) if err != nil { return } @@ -17519,65 +17447,54 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl return } -// ListFloatingIps : List all floating IPs -// This request lists all floating IPs in the region. Floating IPs allow inbound and outbound traffic from the Internet -// to an instance. -func (vpc *VpcV1) ListFloatingIps(listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { - return vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) +// UpdatePublicGateway : Update a public gateway +// This request updates a public gateway's name. +func (vpc *VpcV1) UpdatePublicGateway(updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) } -// ListFloatingIpsWithContext is an alternate form of the ListFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listFloatingIpsOptions, "listFloatingIpsOptions") +// UpdatePublicGatewayWithContext is an alternate form of the UpdatePublicGateway method which supports a Context parameter +func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePublicGatewayOptions, "updatePublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *updatePublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listFloatingIpsOptions.Headers { + for headerName, headerValue := range updatePublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listFloatingIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listFloatingIpsOptions.Start)) - } - if listFloatingIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listFloatingIpsOptions.Limit)) - } - if listFloatingIpsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listFloatingIpsOptions.ResourceGroupID)) - } - if listFloatingIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listFloatingIpsOptions.Sort)) - } - if listFloatingIpsOptions.TargetID != nil { - builder.AddQuery("target.id", fmt.Sprint(*listFloatingIpsOptions.TargetID)) - } - if listFloatingIpsOptions.TargetCRN != nil { - builder.AddQuery("target.crn", fmt.Sprint(*listFloatingIpsOptions.TargetCRN)) - } - if listFloatingIpsOptions.TargetName != nil { - builder.AddQuery("target.name", fmt.Sprint(*listFloatingIpsOptions.TargetName)) - } - if listFloatingIpsOptions.TargetResourceType != nil { - builder.AddQuery("target.resource_type", fmt.Sprint(*listFloatingIpsOptions.TargetResourceType)) + + _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) + if err != nil { + return } request, err := builder.Build() @@ -17591,7 +17508,7 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { return } @@ -17787,54 +17704,65 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt return } -// UpdateFloatingIP : Update a floating IP -// This request updates a floating IP's name and/or target. -func (vpc *VpcV1) UpdateFloatingIP(updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) +// ListFloatingIps : List all floating IPs +// This request lists all floating IPs in the region. Floating IPs allow inbound and outbound traffic from the Internet +// to an instance. +func (vpc *VpcV1) ListFloatingIps(listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { + return vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) } -// UpdateFloatingIPWithContext is an alternate form of the UpdateFloatingIP method which supports a Context parameter -func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateFloatingIPOptions, "updateFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") +// ListFloatingIpsWithContext is an alternate form of the ListFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listFloatingIpsOptions, "listFloatingIpsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *updateFloatingIPOptions.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, `/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) if err != nil { return } - for headerName, headerValue := range updateFloatingIPOptions.Headers { + for headerName, headerValue := range listFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateFloatingIPOptions.FloatingIPPatch) - if err != nil { - return + if listFloatingIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listFloatingIpsOptions.Start)) + } + if listFloatingIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listFloatingIpsOptions.Limit)) + } + if listFloatingIpsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listFloatingIpsOptions.ResourceGroupID)) + } + if listFloatingIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listFloatingIpsOptions.Sort)) + } + if listFloatingIpsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listFloatingIpsOptions.TargetID)) + } + if listFloatingIpsOptions.TargetCRN != nil { + builder.AddQuery("target.crn", fmt.Sprint(*listFloatingIpsOptions.TargetCRN)) + } + if listFloatingIpsOptions.TargetName != nil { + builder.AddQuery("target.name", fmt.Sprint(*listFloatingIpsOptions.TargetName)) + } + if listFloatingIpsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listFloatingIpsOptions.TargetResourceType)) } request, err := builder.Build() @@ -17848,7 +17776,7 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) if err != nil { return } @@ -17858,51 +17786,54 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin return } -// ListNetworkAcls : List all network ACLs -// This request lists all network ACLs in the region. A network ACL defines a set of packet filtering (5-tuple) rules -// for all traffic in and out of a subnet. Both allow and deny rules can be defined, and rules are stateless such that -// reverse traffic in response to allowed traffic is not automatically permitted. -func (vpc *VpcV1) ListNetworkAcls(listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { - return vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) -} - -// 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") +// UpdateFloatingIP : Update a floating IP +// This request updates a floating IP's name and/or target. +func (vpc *VpcV1) UpdateFloatingIP(updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) +} + +// UpdateFloatingIPWithContext is an alternate form of the UpdateFloatingIP method which supports a Context parameter +func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateFloatingIPOptions, "updateFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + 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, `/network_acls`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listNetworkAclsOptions.Headers { + for headerName, headerValue := range updateFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listNetworkAclsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) - } - if listNetworkAclsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listNetworkAclsOptions.Limit)) - } - if listNetworkAclsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listNetworkAclsOptions.ResourceGroupID)) + + _, err = builder.SetBodyContentJSON(updateFloatingIPOptions.FloatingIPPatch) + if err != nil { + return } request, err := builder.Build() @@ -17916,7 +17847,7 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { return } @@ -17995,6 +17926,78 @@ 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) { + return vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) +} + +// CreateNetworkACLRuleWithContext is an alternate form of the CreateNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createNetworkACLRuleOptions, "createNetworkACLRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + } + + return +} + // DeleteNetworkACL : Delete a network ACL // This request deletes a network ACL. This operation cannot be reversed. For this request to succeed, the network ACL // must not be the default network ACL for any VPCs, and the network ACL must not be attached to any subnets. @@ -18049,6 +18052,60 @@ func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetwork return } +// DeleteNetworkACLRule : Delete a network ACL rule +// This request deletes a rule. This operation cannot be reversed. +func (vpc *VpcV1) DeleteNetworkACLRule(deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) +} + +// DeleteNetworkACLRuleWithContext is an alternate form of the DeleteNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *deleteNetworkACLRuleOptions.NetworkACLID, + "id": *deleteNetworkACLRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + // GetNetworkACL : Retrieve a network ACL // This request retrieves a single network ACL specified by the identifier in the URL. func (vpc *VpcV1) GetNetworkACL(getNetworkACLOptions *GetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { @@ -18114,56 +18171,51 @@ func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOpt return } -// UpdateNetworkACL : Update a network ACL -// This request updates a network ACL's name. -func (vpc *VpcV1) UpdateNetworkACL(updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - return vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) +// GetNetworkACLRule : Retrieve a network ACL rule +// This request retrieves a single rule specified by the identifier in the URL. +func (vpc *VpcV1) GetNetworkACLRule(getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + return vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) } -// UpdateNetworkACLWithContext is an alternate form of the UpdateNetworkACL method which supports a Context parameter -func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateNetworkACLOptions, "updateNetworkACLOptions cannot be nil") +// GetNetworkACLRuleWithContext is an alternate form of the GetNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkACLRuleOptions, "getNetworkACLRuleOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") + err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateNetworkACLOptions.ID, + "network_acl_id": *getNetworkACLRuleOptions.NetworkACLID, + "id": *getNetworkACLRuleOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateNetworkACLOptions.Headers { + for headerName, headerValue := range getNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -18175,7 +18227,7 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) if err != nil { return } @@ -18260,55 +18312,51 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor return } -// CreateNetworkACLRule : Create a rule for a network ACL -// This request creates a new rule from a network ACL rule prototype object. The prototype object is structured in the -// same way as a retrieved rule, and contains the information necessary to create the new rule. -func (vpc *VpcV1) CreateNetworkACLRule(createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - return vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) +// ListNetworkAcls : List all network ACLs +// This request lists all network ACLs in the region. A network ACL defines a set of packet filtering (5-tuple) rules +// for all traffic in and out of a subnet. Both allow and deny rules can be defined, and rules are stateless such that +// reverse traffic in response to allowed traffic is not automatically permitted. +func (vpc *VpcV1) ListNetworkAcls(listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { + return vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) } -// CreateNetworkACLRuleWithContext is an alternate form of the CreateNetworkACLRule method which supports a Context parameter -func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createNetworkACLRuleOptions, "createNetworkACLRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") +// ListNetworkAclsWithContext is an alternate form of the ListNetworkAcls method which supports a Context parameter +func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listNetworkAclsOptions, "listNetworkAclsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, - } - - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) if err != nil { return } - for headerName, headerValue := range createNetworkACLRuleOptions.Headers { + for headerName, headerValue := range listNetworkAclsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) - if err != nil { - return + if listNetworkAclsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) + } + if listNetworkAclsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkAclsOptions.Limit)) + } + if listNetworkAclsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listNetworkAclsOptions.ResourceGroupID)) } request, err := builder.Build() @@ -18322,7 +18370,7 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) if err != nil { return } @@ -18332,105 +18380,56 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet return } -// DeleteNetworkACLRule : Delete a network ACL rule -// This request deletes a rule. This operation cannot be reversed. -func (vpc *VpcV1) DeleteNetworkACLRule(deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) +// UpdateNetworkACL : Update a network ACL +// This request updates a network ACL's name. +func (vpc *VpcV1) UpdateNetworkACL(updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) } -// DeleteNetworkACLRuleWithContext is an alternate form of the DeleteNetworkACLRule method which supports a Context parameter -func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions cannot be nil") +// UpdateNetworkACLWithContext is an alternate form of the UpdateNetworkACL method which supports a Context parameter +func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateNetworkACLOptions, "updateNetworkACLOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") + err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") if err != nil { return } pathParamsMap := map[string]string{ - "network_acl_id": *deleteNetworkACLRuleOptions.NetworkACLID, - "id": *deleteNetworkACLRuleOptions.ID, + "id": *updateNetworkACLOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { + for headerName, headerValue := range updateNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetNetworkACLRule : Retrieve a network ACL rule -// This request retrieves a single rule specified by the identifier in the URL. -func (vpc *VpcV1) GetNetworkACLRule(getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - return vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) -} - -// GetNetworkACLRuleWithContext is an alternate form of the GetNetworkACLRule method which supports a Context parameter -func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getNetworkACLRuleOptions, "getNetworkACLRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "network_acl_id": *getNetworkACLRuleOptions.NetworkACLID, - "id": *getNetworkACLRuleOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) + _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) if err != nil { return } - for headerName, headerValue := range getNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() if err != nil { return @@ -18442,7 +18441,7 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) if err != nil { return } @@ -18525,84 +18524,6 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet return } -// ListSecurityGroups : List all security groups -// This request lists all security groups in the region. Security groups provide a way to apply IP filtering rules to -// instances in the associated VPC. With security groups, all traffic is denied by default, and rules added to security -// groups define which traffic the security group permits. Security group rules are stateful such that reverse traffic -// in response to allowed traffic is automatically permitted. -func (vpc *VpcV1) ListSecurityGroups(listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) -} - -// ListSecurityGroupsWithContext is an alternate form of the ListSecurityGroups method which supports a Context parameter -func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSecurityGroupsOptions, "listSecurityGroupsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listSecurityGroupsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSecurityGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSecurityGroupsOptions.Start)) - } - if listSecurityGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupsOptions.Limit)) - } - if listSecurityGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSecurityGroupsOptions.ResourceGroupID)) - } - if listSecurityGroupsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listSecurityGroupsOptions.VPCID)) - } - if listSecurityGroupsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listSecurityGroupsOptions.VPCCRN)) - } - if listSecurityGroupsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listSecurityGroupsOptions.VPCName)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - // 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 @@ -18686,94 +18607,127 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu return } -// DeleteSecurityGroup : Delete a security group -// This request deletes a security group. A security group cannot be deleted if it is referenced by any security group -// targets or rules. Additionally, a VPC's default security group cannot be deleted. This operation cannot be reversed. -func (vpc *VpcV1) DeleteSecurityGroup(deleteSecurityGroupOptions *DeleteSecurityGroupOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) +// CreateSecurityGroupRule : Create a rule for a security group +// This request creates a new security group rule from a security group rule prototype object. The prototype object is +// structured in the same way as a retrieved security group rule and contains the information necessary to create the +// rule. As part of creating a new rule in a security group, the rule is applied to all the networking interfaces in the +// security group. Rules specify which IP traffic a security group will allow. Security group rules are stateful, such +// that reverse traffic in response to allowed traffic is automatically permitted. A rule allowing inbound TCP traffic +// on port 80 also allows outbound TCP traffic on port 80 without the need for an additional rule. +func (vpc *VpcV1) CreateSecurityGroupRule(createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + return vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) } -// 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") +// CreateSecurityGroupRuleWithContext is an alternate form of the CreateSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") + err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteSecurityGroupOptions.ID, + "security_group_id": *createSecurityGroupRuleOptions.SecurityGroupID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteSecurityGroupOptions.Headers { + for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + if err != nil { + return + } + response.Result = result + } return } -// GetSecurityGroup : Retrieve a security group -// This request retrieves a single security group specified by the identifier in the URL path. -func (vpc *VpcV1) GetSecurityGroup(getSecurityGroupOptions *GetSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - return vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) +// CreateSecurityGroupTargetBinding : Add a target to a security group +// This request adds a resource to an existing security group. The specified target identifier can be: +// +// - A bare metal server network interface identifier +// - A virtual network interface identifier +// - A VPN server identifier +// - An application load balancer identifier +// - An endpoint gateway identifier +// - An instance network interface identifier +// +// When a target is added to a security group, the security group rules are applied to the target. A request body is not +// required, and if provided, is ignored. +func (vpc *VpcV1) CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + return vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions) } -// 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") +// CreateSecurityGroupTargetBindingWithContext is an alternate form of the CreateSecurityGroupTargetBinding method which supports a Context parameter +func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Context, createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") + err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getSecurityGroupOptions.ID, + "security_group_id": *createSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *createSecurityGroupTargetBindingOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getSecurityGroupOptions.Headers { + for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18795,7 +18749,7 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) if err != nil { return } @@ -18805,30 +18759,29 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr return } -// UpdateSecurityGroup : Update a security group -// This request updates a security group with the information provided in a security group patch object. The security -// group patch object is structured in the same way as a retrieved security group and contains only the information to -// be updated. -func (vpc *VpcV1) UpdateSecurityGroup(updateSecurityGroupOptions *UpdateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - return vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) -} - -// 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") +// DeleteSecurityGroup : Delete a security group +// This request deletes a security group. A security group cannot be deleted if it is referenced by any security group +// targets or rules. Additionally, a VPC's default security group cannot be deleted. This operation cannot be reversed. +func (vpc *VpcV1) DeleteSecurityGroup(deleteSecurityGroupOptions *DeleteSecurityGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) +} + +// DeleteSecurityGroupWithContext is an alternate form of the DeleteSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecurityGroupOptions *DeleteSecurityGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSecurityGroupOptions, "deleteSecurityGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") + err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateSecurityGroupOptions.ID, + "id": *deleteSecurityGroupOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) @@ -18836,88 +18789,69 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu return } - for headerName, headerValue := range updateSecurityGroupOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateSecurityGroupOptions.SecurityGroupPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListSecurityGroupRules : List all rules in a security group -// This request lists all rules in a security group. These rules define what traffic the security group permits. -// Security group rules are stateful, such that reverse traffic in response to allowed traffic is automatically -// permitted. -func (vpc *VpcV1) ListSecurityGroupRules(listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) (result *SecurityGroupRuleCollection, response *core.DetailedResponse, err error) { - return vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) +// DeleteSecurityGroupRule : Delete a security group rule +// This request deletes a security group rule. This operation cannot be reversed. Removing a security group rule will +// not end existing connections allowed by that rule. +func (vpc *VpcV1) DeleteSecurityGroupRule(deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) } -// 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") +// DeleteSecurityGroupRuleWithContext is an alternate form of the DeleteSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") + err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *listSecurityGroupRulesOptions.SecurityGroupID, + "security_group_id": *deleteSecurityGroupRuleOptions.SecurityGroupID, + "id": *deleteSecurityGroupRuleOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -18929,137 +18863,114 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// CreateSecurityGroupRule : Create a rule for a security group -// This request creates a new security group rule from a security group rule prototype object. The prototype object is -// structured in the same way as a retrieved security group rule and contains the information necessary to create the -// rule. As part of creating a new rule in a security group, the rule is applied to all the networking interfaces in the -// security group. Rules specify which IP traffic a security group will allow. Security group rules are stateful, such -// that reverse traffic in response to allowed traffic is automatically permitted. A rule allowing inbound TCP traffic -// on port 80 also allows outbound TCP traffic on port 80 without the need for an additional rule. -func (vpc *VpcV1) CreateSecurityGroupRule(createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - return vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) +// DeleteSecurityGroupTargetBinding : Remove a target from a security group +// This request removes a target from a security group. For this request to succeed, the target must be attached to at +// least one other security group. The specified target identifier can be: +// +// - A bare metal server network interface identifier +// - A virtual network interface identifier +// - A VPN server identifier +// - An application load balancer identifier +// - An endpoint gateway identifier +// - An instance network interface identifier +// +// Security groups are stateful, so any changes to a target's security groups are applied to new connections. Existing +// connections are not affected. +func (vpc *VpcV1) DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) } -// 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") +// DeleteSecurityGroupTargetBindingWithContext is an alternate form of the DeleteSecurityGroupTargetBinding method which supports a Context parameter +func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Context, deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") + err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *createSecurityGroupRuleOptions.SecurityGroupID, + "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *deleteSecurityGroupTargetBindingOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// DeleteSecurityGroupRule : Delete a security group rule -// This request deletes a security group rule. This operation cannot be reversed. Removing a security group rule will -// not end existing connections allowed by that rule. -func (vpc *VpcV1) DeleteSecurityGroupRule(deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) +// GetSecurityGroup : Retrieve a security group +// This request retrieves a single security group specified by the identifier in the URL path. +func (vpc *VpcV1) GetSecurityGroup(getSecurityGroupOptions *GetSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + return vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) } -// 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") +// GetSecurityGroupWithContext is an alternate form of the GetSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGroupOptions *GetSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSecurityGroupOptions, "getSecurityGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") + err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *deleteSecurityGroupRuleOptions.SecurityGroupID, - "id": *deleteSecurityGroupRuleOptions.ID, + "id": *getSecurityGroupOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range getSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") + 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("future_version", fmt.Sprint("true")) @@ -19071,7 +18982,18 @@ func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, delete return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + if err != nil { + return + } + response.Result = result + } return } @@ -19142,59 +19064,52 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri return } -// UpdateSecurityGroupRule : Update a security group rule -// This request updates a security group rule with the information in a provided rule patch object. The rule patch -// object contains only the information to be updated. The request will fail if the information is not applicable to the -// rule's protocol. -func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) +// GetSecurityGroupTarget : Retrieve a security group target +// This request retrieves a single target specified by the identifier in the URL path. The target must be an existing +// target of the security group. +func (vpc *VpcV1) GetSecurityGroupTarget(getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + return vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) } -// 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") +// GetSecurityGroupTargetWithContext is an alternate form of the GetSecurityGroupTarget method which supports a Context parameter +func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") + err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *updateSecurityGroupRuleOptions.SecurityGroupID, - "id": *updateSecurityGroupRuleOptions.ID, + "security_group_id": *getSecurityGroupTargetOptions.SecurityGroupID, + "id": *getSecurityGroupTargetOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -19206,7 +19121,7 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) if err != nil { return } @@ -19216,41 +19131,42 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update return } -// ListSecurityGroupTargets : List all targets associated with a security group -// This request lists all targets associated with a security group, to which the rules in the security group are -// applied. -func (vpc *VpcV1) ListSecurityGroupTargets(listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) (result *SecurityGroupTargetCollection, response *core.DetailedResponse, err error) { - return vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) +// ListSecurityGroupRules : List all rules in a security group +// This request lists all rules in a security group. These rules define what traffic the security group permits. +// Security group rules are stateful, such that reverse traffic in response to allowed traffic is automatically +// permitted. +func (vpc *VpcV1) ListSecurityGroupRules(listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) (result *SecurityGroupRuleCollection, response *core.DetailedResponse, err error) { + return vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) } -// 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") +// ListSecurityGroupRulesWithContext is an alternate form of the ListSecurityGroupRules method which supports a Context parameter +func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) (result *SecurityGroupRuleCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions") + err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *listSecurityGroupTargetsOptions.SecurityGroupID, + "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}/targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { + for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19260,12 +19176,6 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSecurityGroupTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) - } - if listSecurityGroupTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -19278,7 +19188,7 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) if err != nil { return } @@ -19288,107 +19198,107 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS return } -// DeleteSecurityGroupTargetBinding : Remove a target from a security group -// This request removes a target from a security group. For this request to succeed, the target must be attached to at -// least one other security group. The specified target identifier can be: -// -// - A bare metal server network interface identifier -// - A virtual network interface identifier -// - A VPN server identifier -// - An application load balancer identifier -// - An endpoint gateway identifier -// - An instance network interface identifier -// -// Security groups are stateful, so any changes to a target's security groups are applied to new connections. Existing -// connections are not affected. -func (vpc *VpcV1) DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) +// ListSecurityGroupTargets : List all targets associated with a security group +// This request lists all targets associated with a security group, to which the rules in the security group are +// applied. +func (vpc *VpcV1) ListSecurityGroupTargets(listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) (result *SecurityGroupTargetCollection, response *core.DetailedResponse, err error) { + return vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) } -// 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") +// ListSecurityGroupTargetsWithContext is an alternate form of the ListSecurityGroupTargets method which supports a Context parameter +func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) (result *SecurityGroupTargetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") + err = core.ValidateStruct(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, - "id": *deleteSecurityGroupTargetBindingOptions.ID, + "security_group_id": *listSecurityGroupTargetsOptions.SecurityGroupID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { + for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSecurityGroupTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) + } + if listSecurityGroupTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.Limit)) + } request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetSecurityGroupTarget : Retrieve a security group target -// This request retrieves a single target specified by the identifier in the URL path. The target must be an existing -// target of the security group. -func (vpc *VpcV1) GetSecurityGroupTarget(getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { - return vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) +// ListSecurityGroups : List all security groups +// This request lists all security groups in the region. Security groups provide a way to apply IP filtering rules to +// instances in the associated VPC. With security groups, all traffic is denied by default, and rules added to security +// groups define which traffic the security group permits. Security group rules are stateful such that reverse traffic +// in response to allowed traffic is automatically permitted. +func (vpc *VpcV1) ListSecurityGroups(listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) } -// GetSecurityGroupTargetWithContext is an alternate form of the GetSecurityGroupTarget method which supports a Context parameter -func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") +// ListSecurityGroupsWithContext is an alternate form of the ListSecurityGroups method which supports a Context parameter +func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSecurityGroupsOptions, "listSecurityGroupsOptions") if err != nil { return } - 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) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) if err != nil { return } - for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { + for headerName, headerValue := range listSecurityGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19398,6 +19308,24 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSecurityGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupsOptions.Start)) + } + if listSecurityGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupsOptions.Limit)) + } + if listSecurityGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSecurityGroupsOptions.ResourceGroupID)) + } + if listSecurityGroupsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listSecurityGroupsOptions.VPCID)) + } + if listSecurityGroupsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listSecurityGroupsOptions.VPCCRN)) + } + if listSecurityGroupsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listSecurityGroupsOptions.VPCName)) + } request, err := builder.Build() if err != nil { @@ -19410,7 +19338,7 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) if err != nil { return } @@ -19420,61 +19348,58 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu return } -// CreateSecurityGroupTargetBinding : Add a target to a security group -// This request adds a resource to an existing security group. The specified target identifier can be: -// -// - A bare metal server network interface identifier -// - A virtual network interface identifier -// - A VPN server identifier -// - An application load balancer identifier -// - An endpoint gateway identifier -// - An instance network interface identifier -// -// When a target is added to a security group, the security group rules are applied to the target. A request body is not -// required, and if provided, is ignored. -func (vpc *VpcV1) CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { - return vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions) +// UpdateSecurityGroup : Update a security group +// This request updates a security group with the information provided in a security group patch object. The security +// group patch object is structured in the same way as a retrieved security group and contains only the information to +// be updated. +func (vpc *VpcV1) UpdateSecurityGroup(updateSecurityGroupOptions *UpdateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) } -// 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") +// UpdateSecurityGroupWithContext is an alternate form of the UpdateSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecurityGroupOptions *UpdateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSecurityGroupOptions, "updateSecurityGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") + err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *createSecurityGroupTargetBindingOptions.SecurityGroupID, - "id": *createSecurityGroupTargetBindingOptions.ID, + "id": *updateSecurityGroupOptions.ID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { + for headerName, headerValue := range updateSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateSecurityGroupOptions.SecurityGroupPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -19486,7 +19411,7 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { return } @@ -19496,46 +19421,57 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex return } -// ListIkePolicies : List all IKE policies -// This request lists all IKE policies in the region. -func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) +// UpdateSecurityGroupRule : Update a security group rule +// This request updates a security group rule with the information in a provided rule patch object. The rule patch +// object contains only the information to be updated. The request will fail if the information is not applicable to the +// rule's protocol. +func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) } -// 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") +// UpdateSecurityGroupRuleWithContext is an alternate form of the UpdateSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + 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, `/ike_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listIkePoliciesOptions.Headers { + for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listIkePoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listIkePoliciesOptions.Start)) - } - if listIkePoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listIkePoliciesOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) + if err != nil { + return } request, err := builder.Build() @@ -19549,7 +19485,7 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { return } @@ -19559,130 +19495,163 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie return } -// CreateIkePolicy : Create an IKE policy -// This request creates a new IKE policy. -func (vpc *VpcV1) CreateIkePolicy(createIkePolicyOptions *CreateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - return vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) +// AddVPNGatewayConnectionLocalCIDR : Set a local CIDR on a VPN gateway connection +// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified +// CIDR already exists. A request body is not required, and if provided, is ignored. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.AddVPNGatewayConnectionLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionLocalCIDROptions) } -// 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") +// AddVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the AddVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") + err = core.ValidateStruct(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "vpn_gateway_id": *addVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *addVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *addVPNGatewayConnectionLocalCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createIkePolicyOptions.Headers { + for headerName, headerValue := range addVPNGatewayConnectionLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionLocalCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createIkePolicyOptions.AuthenticationAlgorithm != nil { - body["authentication_algorithm"] = createIkePolicyOptions.AuthenticationAlgorithm + request, err := builder.Build() + if err != nil { + return } - 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 + + response, err = vpc.Service.Request(request, nil) + + return +} + +// AddVPNGatewayConnectionPeerCIDR : Set a peer CIDR on a VPN gateway connection +// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified +// CIDR already exists. A request body is not required, and if provided, is ignored. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.AddVPNGatewayConnectionPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionPeerCIDROptions) +} + +// AddVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the AddVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions cannot be nil") + if err != nil { + return } - _, err = builder.SetBodyContentJSON(body) + err = core.ValidateStruct(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions") if err != nil { return } - request, err := builder.Build() + pathParamsMap := map[string]string{ + "vpn_gateway_id": *addVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *addVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *addVPNGatewayConnectionPeerCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + for headerName, headerValue := range addVPNGatewayConnectionPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionPeerCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() if err != nil { return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) - if err != nil { - return - } - response.Result = result - } + + response, err = vpc.Service.Request(request, nil) return } -// DeleteIkePolicy : Delete an IKE policy -// This request deletes an IKE policy. This operation cannot be reversed. For this request to succeed, there must not be -// any VPN gateway connections using this policy. -func (vpc *VpcV1) DeleteIkePolicy(deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) +// CheckVPNGatewayConnectionLocalCIDR : Check if the specified local CIDR exists on a VPN gateway connection +// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.CheckVPNGatewayConnectionLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionLocalCIDROptions) } -// 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") +// CheckVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") + err = core.ValidateStruct(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteIkePolicyOptions.ID, + "vpn_gateway_id": *checkVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *checkVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *checkVPNGatewayConnectionLocalCIDROptions.PrefixLength, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteIkePolicyOptions.Headers { + for headerName, headerValue := range checkVPNGatewayConnectionLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionLocalCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19702,44 +19671,48 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic return } -// GetIkePolicy : Retrieve an IKE policy -// This request retrieves a single IKE policy specified by the identifier in the URL. -func (vpc *VpcV1) GetIkePolicy(getIkePolicyOptions *GetIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - return vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) +// CheckVPNGatewayConnectionPeerCIDR : Check if the specified peer CIDR exists on a VPN gateway connection +// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.CheckVPNGatewayConnectionPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionPeerCIDROptions) } -// 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") +// CheckVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") + err = core.ValidateStruct(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getIkePolicyOptions.ID, + "vpn_gateway_id": *checkVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *checkVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *checkVPNGatewayConnectionPeerCIDROptions.PrefixLength, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getIkePolicyOptions.Headers { + for headerName, headerValue := range checkVPNGatewayConnectionPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionPeerCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -19751,68 +19724,75 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// UpdateIkePolicy : Update an IKE policy -// This request updates the properties of an existing IKE policy. -func (vpc *VpcV1) UpdateIkePolicy(updateIkePolicyOptions *UpdateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - return vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) +// CreateIkePolicy : Create an IKE policy +// This request creates a new IKE policy. +func (vpc *VpcV1) CreateIkePolicy(createIkePolicyOptions *CreateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + return vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) } -// 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") +// CreateIkePolicyWithContext is an alternate form of the CreateIkePolicy method which supports a Context parameter +func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolicyOptions *CreateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createIkePolicyOptions, "createIkePolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") + err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *updateIkePolicyOptions.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, `/ike_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) if err != nil { return } - for headerName, headerValue := range updateIkePolicyOptions.Headers { + for headerName, headerValue := range createIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateIkePolicyOptions.IkePolicyPatch) + body := make(map[string]interface{}) + if createIkePolicyOptions.AuthenticationAlgorithm != nil { + body["authentication_algorithm"] = createIkePolicyOptions.AuthenticationAlgorithm + } + if createIkePolicyOptions.DhGroup != nil { + body["dh_group"] = createIkePolicyOptions.DhGroup + } + if createIkePolicyOptions.EncryptionAlgorithm != nil { + body["encryption_algorithm"] = createIkePolicyOptions.EncryptionAlgorithm + } + if createIkePolicyOptions.IkeVersion != nil { + body["ike_version"] = createIkePolicyOptions.IkeVersion + } + if createIkePolicyOptions.KeyLifetime != nil { + body["key_lifetime"] = createIkePolicyOptions.KeyLifetime + } + if createIkePolicyOptions.Name != nil { + body["name"] = createIkePolicyOptions.Name + } + if createIkePolicyOptions.ResourceGroup != nil { + body["resource_group"] = createIkePolicyOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } @@ -19838,50 +19818,71 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic return } -// ListIkePolicyConnections : List all VPN gateway connections that use a specified IKE policy -// This request lists all VPN gateway connections that use a policy. -func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) +// CreateIpsecPolicy : Create an IPsec policy +// This request creates a new IPsec policy. +func (vpc *VpcV1) CreateIpsecPolicy(createIpsecPolicyOptions *CreateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + return vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) } -// ListIkePolicyConnectionsWithContext is an alternate form of the ListIkePolicyConnections method which supports a Context parameter -func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions cannot be nil") +// CreateIpsecPolicyWithContext is an alternate form of the CreateIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecPolicyOptions *CreateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createIpsecPolicyOptions, "createIpsecPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") + err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *listIkePolicyConnectionsOptions.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, `/ike_policies/{id}/connections`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) if err != nil { return } - for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { + for headerName, headerValue := range createIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createIpsecPolicyOptions.AuthenticationAlgorithm != nil { + body["authentication_algorithm"] = createIpsecPolicyOptions.AuthenticationAlgorithm + } + if createIpsecPolicyOptions.EncryptionAlgorithm != nil { + body["encryption_algorithm"] = createIpsecPolicyOptions.EncryptionAlgorithm + } + if createIpsecPolicyOptions.Pfs != nil { + body["pfs"] = createIpsecPolicyOptions.Pfs + } + if createIpsecPolicyOptions.KeyLifetime != nil { + body["key_lifetime"] = createIpsecPolicyOptions.KeyLifetime + } + if createIpsecPolicyOptions.Name != nil { + body["name"] = createIpsecPolicyOptions.Name + } + if createIpsecPolicyOptions.ResourceGroup != nil { + body["resource_group"] = createIpsecPolicyOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -19893,7 +19894,7 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) if err != nil { return } @@ -19903,46 +19904,50 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI return } -// ListIpsecPolicies : List all IPsec policies -// This request lists all IPsec policies in the region. -func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) +// CreateVPNGateway : Create a VPN gateway +// This request creates a new VPN gateway. +func (vpc *VpcV1) CreateVPNGateway(createVPNGatewayOptions *CreateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + return vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) } -// 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") +// CreateVPNGatewayWithContext is an alternate form of the CreateVPNGateway method which supports a Context parameter +func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGatewayOptions *CreateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNGatewayOptions, "createVPNGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) if err != nil { return } - for headerName, headerValue := range listIpsecPoliciesOptions.Headers { + for headerName, headerValue := range createVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listIpsecPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listIpsecPoliciesOptions.Start)) - } - if listIpsecPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listIpsecPoliciesOptions.Limit)) + + _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) + if err != nil { + return } request, err := builder.Build() @@ -19956,7 +19961,7 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) if err != nil { return } @@ -19966,36 +19971,40 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol return } -// CreateIpsecPolicy : Create an IPsec policy -// This request creates a new IPsec policy. -func (vpc *VpcV1) CreateIpsecPolicy(createIpsecPolicyOptions *CreateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - return vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) +// CreateVPNGatewayConnection : Create a connection for a VPN gateway +// This request creates a new VPN gateway connection. +func (vpc *VpcV1) CreateVPNGatewayConnection(createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + return vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) } -// 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") +// CreateVPNGatewayConnectionWithContext is an alternate form of the CreateVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") + err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createIpsecPolicyOptions.Headers { + for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIpsecPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -20007,26 +20016,7 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createIpsecPolicyOptions.AuthenticationAlgorithm != nil { - body["authentication_algorithm"] = createIpsecPolicyOptions.AuthenticationAlgorithm - } - if createIpsecPolicyOptions.EncryptionAlgorithm != nil { - body["encryption_algorithm"] = createIpsecPolicyOptions.EncryptionAlgorithm - } - if createIpsecPolicyOptions.Pfs != nil { - body["pfs"] = createIpsecPolicyOptions.Pfs - } - if createIpsecPolicyOptions.KeyLifetime != nil { - body["key_lifetime"] = createIpsecPolicyOptions.KeyLifetime - } - if createIpsecPolicyOptions.Name != nil { - body["name"] = createIpsecPolicyOptions.Name - } - if createIpsecPolicyOptions.ResourceGroup != nil { - body["resource_group"] = createIpsecPolicyOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) if err != nil { return } @@ -20042,7 +20032,7 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) if err != nil { return } @@ -20052,6 +20042,60 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP return } +// DeleteIkePolicy : Delete an IKE policy +// This request deletes an IKE policy. This operation cannot be reversed. For this request to succeed, there must not be +// any VPN gateway connections using this policy. +func (vpc *VpcV1) DeleteIkePolicy(deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) +} + +// DeleteIkePolicyWithContext is an alternate form of the DeleteIkePolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteIkePolicyOptions, "deleteIkePolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + // DeleteIpsecPolicy : Delete an IPsec policy // This request deletes an IPsec policy. This operation cannot be reversed. For this request to succeed, there must not // be any VPN gateway connections using this policy. @@ -20106,44 +20150,45 @@ func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecP return } -// GetIpsecPolicy : Retrieve an IPsec policy -// This request retrieves a single IPsec policy specified by the identifier in the URL. -func (vpc *VpcV1) GetIpsecPolicy(getIpsecPolicyOptions *GetIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - return vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) +// DeleteVPNGateway : Delete a VPN gateway +// This request deletes a VPN gateway. This operation cannot be reversed. For this request to succeed, the VPN gateway +// must not have a `status` of `pending`, and there must not be any VPC routes using the VPN gateway's connections as a +// next hop. +func (vpc *VpcV1) DeleteVPNGateway(deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) } -// 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") +// DeleteVPNGatewayWithContext is an alternate form of the DeleteVPNGateway method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNGatewayOptions, "deleteVPNGatewayOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions") + err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getIpsecPolicyOptions.ID, + "id": *deleteVPNGatewayOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getIpsecPolicyOptions.Headers { + for headerName, headerValue := range deleteVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -20155,127 +20200,100 @@ func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyO return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// UpdateIpsecPolicy : Update an IPsec policy -// This request updates the properties of an existing IPsec policy. -func (vpc *VpcV1) UpdateIpsecPolicy(updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - return vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) +// DeleteVPNGatewayConnection : Delete a VPN gateway connection +// This request deletes a VPN gateway connection. This operation cannot be reversed. For this request to succeed, there +// must not be VPC routes using this VPN connection as a next hop. +func (vpc *VpcV1) DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) } -// 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") +// DeleteVPNGatewayConnectionWithContext is an alternate form of the DeleteVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") + err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateIpsecPolicyOptions.ID, + "vpn_gateway_id": *deleteVPNGatewayConnectionOptions.VPNGatewayID, + "id": *deleteVPNGatewayConnectionOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateIpsecPolicyOptions.Headers { + for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListIpsecPolicyConnections : List all VPN gateway connections that use a specified IPsec policy -// This request lists all VPN gateway connections that use a policy. -func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) +// GetIkePolicy : Retrieve an IKE policy +// This request retrieves a single IKE policy specified by the identifier in the URL. +func (vpc *VpcV1) GetIkePolicy(getIkePolicyOptions *GetIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + return vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) } -// ListIpsecPolicyConnectionsWithContext is an alternate form of the ListIpsecPolicyConnections method which supports a Context parameter -func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions cannot be nil") +// GetIkePolicyWithContext is an alternate form of the GetIkePolicy method which supports a Context parameter +func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptions *GetIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getIkePolicyOptions, "getIkePolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") + err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *listIpsecPolicyConnectionsOptions.ID, + "id": *getIkePolicyOptions.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) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { + for headerName, headerValue := range getIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -20297,7 +20315,7 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) if err != nil { return } @@ -20307,32 +20325,40 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis return } -// ListVPNGateways : List all VPN gateways -// This request lists all VPN gateways in the region. -func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions) +// GetIpsecPolicy : Retrieve an IPsec policy +// This request retrieves a single IPsec policy specified by the identifier in the URL. +func (vpc *VpcV1) GetIpsecPolicy(getIpsecPolicyOptions *GetIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + return vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) } -// 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") +// GetIpsecPolicyWithContext is an alternate form of the GetIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyOptions *GetIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getIpsecPolicyOptions, "getIpsecPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "id": *getIpsecPolicyOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPNGatewaysOptions.Headers { + for headerName, headerValue := range getIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -20342,21 +20368,6 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPNGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNGatewaysOptions.Start)) - } - if listVPNGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNGatewaysOptions.Limit)) - } - if listVPNGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNGatewaysOptions.ResourceGroupID)) - } - if listVPNGatewaysOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNGatewaysOptions.Sort)) - } - if listVPNGatewaysOptions.Mode != nil { - builder.AddQuery("mode", fmt.Sprint(*listVPNGatewaysOptions.Mode)) - } request, err := builder.Build() if err != nil { @@ -20369,7 +20380,7 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) if err != nil { return } @@ -20379,52 +20390,50 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway return } -// CreateVPNGateway : Create a VPN gateway -// This request creates a new VPN gateway. -func (vpc *VpcV1) CreateVPNGateway(createVPNGatewayOptions *CreateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - return vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) +// GetVPNGateway : Retrieve a VPN gateway +// This request retrieves a single VPN gateway specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNGateway(getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + return vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) } -// 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") +// GetVPNGatewayWithContext is an alternate form of the GetVPNGateway method which supports a Context parameter +func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNGatewayOptions, "getVPNGatewayOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") + err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + 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`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createVPNGatewayOptions.Headers { + for headerName, headerValue := range getVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -20446,45 +20455,45 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate return } -// DeleteVPNGateway : Delete a VPN gateway -// This request deletes a VPN gateway. This operation cannot be reversed. For this request to succeed, the VPN gateway -// must not have a `status` of `pending`, and there must not be any VPC routes using the VPN gateway's connections as a -// next hop. -func (vpc *VpcV1) DeleteVPNGateway(deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) +// GetVPNGatewayConnection : Retrieve a VPN gateway connection +// This request retrieves a single VPN gateway connection specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNGatewayConnection(getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + return vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions) } -// 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") +// GetVPNGatewayConnectionWithContext is an alternate form of the GetVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") + err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteVPNGatewayOptions.ID, + "vpn_gateway_id": *getVPNGatewayConnectionOptions.VPNGatewayID, + "id": *getVPNGatewayConnectionOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteVPNGatewayOptions.Headers { + for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") + 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("future_version", fmt.Sprint("true")) @@ -20496,45 +20505,48 @@ func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGate return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + response.Result = result + } return } -// GetVPNGateway : Retrieve a VPN gateway -// This request retrieves a single VPN gateway specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNGateway(getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - return vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) +// ListIkePolicies : List all IKE policies +// This request lists all IKE policies in the region. +func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) } -// GetVPNGatewayWithContext is an alternate form of the GetVPNGateway method which supports a Context parameter -func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNGatewayOptions, "getVPNGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") +// ListIkePoliciesWithContext is an alternate form of the ListIkePolicies method which supports a Context parameter +func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listIkePoliciesOptions, "listIkePoliciesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *getVPNGatewayOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) if err != nil { return } - for headerName, headerValue := range getVPNGatewayOptions.Headers { + for headerName, headerValue := range listIkePoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -20544,6 +20556,12 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listIkePoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listIkePoliciesOptions.Start)) + } + if listIkePoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listIkePoliciesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -20556,7 +20574,7 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) if err != nil { return } @@ -20566,56 +20584,50 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt return } -// UpdateVPNGateway : Update a VPN gateway -// This request updates the properties of an existing VPN gateway. -func (vpc *VpcV1) UpdateVPNGateway(updateVPNGatewayOptions *UpdateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) +// ListIkePolicyConnections : List all VPN gateway connections that use a specified IKE policy +// This request lists all VPN gateway connections that use a policy. +func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) } -// 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") +// ListIkePolicyConnectionsWithContext is an alternate form of the ListIkePolicyConnections method which supports a Context parameter +func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") + err = core.ValidateStruct(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateVPNGatewayOptions.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, `/vpn_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}/connections`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateVPNGatewayOptions.Headers { + for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateVPNGatewayOptions.VPNGatewayPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -20627,7 +20639,7 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) if err != nil { return } @@ -20637,40 +20649,32 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate return } -// ListVPNGatewayConnections : List all connections of a VPN gateway -// This request lists all connections of a VPN gateway. -func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) +// ListIpsecPolicies : List all IPsec policies +// This request lists all IPsec policies in the region. +func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) } -// ListVPNGatewayConnectionsWithContext is an alternate form of the ListVPNGatewayConnections method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") +// ListIpsecPoliciesWithContext is an alternate form of the ListIpsecPolicies method which supports a Context parameter +func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listIpsecPoliciesOptions, "listIpsecPoliciesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "vpn_gateway_id": *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) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) if err != nil { return } - for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { + for headerName, headerValue := range listIpsecPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -20680,8 +20684,11 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPNGatewayConnectionsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) + 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() @@ -20695,7 +20702,7 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyCollection) if err != nil { return } @@ -20705,56 +20712,50 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list return } -// CreateVPNGatewayConnection : Create a connection for a VPN gateway -// This request creates a new VPN gateway connection. -func (vpc *VpcV1) CreateVPNGatewayConnection(createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - return vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) +// ListIpsecPolicyConnections : List all VPN gateway connections that use a specified IPsec policy +// This request lists all VPN gateway connections that use a policy. +func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) } -// 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") +// ListIpsecPolicyConnectionsWithContext is an alternate form of the ListIpsecPolicyConnections method which supports a Context parameter +func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") + err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, + "id": *listIpsecPolicyConnectionsOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}/connections`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -20766,7 +20767,7 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) if err != nil { return } @@ -20776,45 +20777,47 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre return } -// DeleteVPNGatewayConnection : Delete a VPN gateway connection -// This request deletes a VPN gateway connection. This operation cannot be reversed. For this request to succeed, there -// must not be VPC routes using this VPN connection as a next hop. -func (vpc *VpcV1) DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) +// ListVPNGatewayConnectionLocalCIDRs : List all local CIDRs for a VPN gateway connection +// This request lists all local CIDRs for a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionLocalCIDRsOptions) } -// 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") +// ListVPNGatewayConnectionLocalCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionLocalCIDRs method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") + err = core.ValidateStruct(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *deleteVPNGatewayConnectionOptions.VPNGatewayID, - "id": *deleteVPNGatewayConnectionOptions.ID, + "vpn_gateway_id": *listVPNGatewayConnectionLocalCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionLocalCIDRsOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionLocalCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionLocalCIDRs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -20826,46 +20829,59 @@ 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 { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionLocalCIDRs) + if err != nil { + return + } + response.Result = result + } return } -// GetVPNGatewayConnection : Retrieve a VPN gateway connection -// This request retrieves a single VPN gateway connection specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNGatewayConnection(getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - return vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions) +// ListVPNGatewayConnectionPeerCIDRs : List all peer CIDRs for a VPN gateway connection +// This request lists all peer CIDRs for a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionPeerCIDRsOptions) } -// 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") +// ListVPNGatewayConnectionPeerCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionPeerCIDRs method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") + err = core.ValidateStruct(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *getVPNGatewayConnectionOptions.VPNGatewayID, - "id": *getVPNGatewayConnectionOptions.ID, + "vpn_gateway_id": *listVPNGatewayConnectionPeerCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionPeerCIDRsOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionPeerCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionPeerCIDRs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -20887,7 +20903,7 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionPeerCIDRs) if err != nil { return } @@ -20897,55 +20913,51 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN return } -// UpdateVPNGatewayConnection : Update a VPN gateway connection -// This request updates the properties of an existing VPN gateway connection. -func (vpc *VpcV1) UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) +// ListVPNGatewayConnections : List all connections of a VPN gateway +// This request lists all connections of a VPN gateway. +func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) } -// 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") +// ListVPNGatewayConnectionsWithContext is an alternate form of the ListVPNGatewayConnections method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") + err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *updateVPNGatewayConnectionOptions.VPNGatewayID, - "id": *updateVPNGatewayConnectionOptions.ID, + "vpn_gateway_id": *listVPNGatewayConnectionsOptions.VPNGatewayID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) - if err != nil { - return + if listVPNGatewayConnectionsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) } request, err := builder.Build() @@ -20959,7 +20971,7 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) if err != nil { return } @@ -20969,43 +20981,32 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd return } -// ListVPNGatewayConnectionLocalCIDRs : List all local CIDRs for a VPN gateway connection -// This request lists all local CIDRs for a VPN gateway connection. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionLocalCIDRsOptions) +// ListVPNGateways : List all VPN gateways +// This request lists all VPN gateways in the region. +func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions) } -// ListVPNGatewayConnectionLocalCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionLocalCIDRs method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions") +// ListVPNGatewaysWithContext is an alternate form of the ListVPNGateways method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVPNGatewaysOptions, "listVPNGatewaysOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionLocalCIDRsOptions.VPNGatewayID, - "id": *listVPNGatewayConnectionLocalCIDRsOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) if err != nil { return } - for headerName, headerValue := range listVPNGatewayConnectionLocalCIDRsOptions.Headers { + for headerName, headerValue := range listVPNGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionLocalCIDRs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21015,6 +21016,21 @@ func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Cont builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPNGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNGatewaysOptions.Start)) + } + if listVPNGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNGatewaysOptions.Limit)) + } + if listVPNGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNGatewaysOptions.ResourceGroupID)) + } + if listVPNGatewaysOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNGatewaysOptions.Sort)) + } + if listVPNGatewaysOptions.Mode != nil { + builder.AddQuery("mode", fmt.Sprint(*listVPNGatewaysOptions.Mode)) + } request, err := builder.Build() if err != nil { @@ -21027,7 +21043,7 @@ func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Cont return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionLocalCIDRs) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) if err != nil { return } @@ -21095,45 +21111,45 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Con return } -// CheckVPNGatewayConnectionLocalCIDR : Check if the specified local CIDR exists on a VPN gateway connection -// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. +// RemoveVPNGatewayConnectionPeerCIDR : Remove a peer CIDR from a VPN gateway connection +// This request removes a CIDR from a VPN gateway connection. // // This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.CheckVPNGatewayConnectionLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionLocalCIDROptions) +func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveVPNGatewayConnectionPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionPeerCIDROptions) } -// CheckVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions cannot be nil") +// RemoveVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions") + err = core.ValidateStruct(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *checkVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, - "id": *checkVPNGatewayConnectionLocalCIDROptions.ID, - "cidr_prefix": *checkVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, - "prefix_length": *checkVPNGatewayConnectionLocalCIDROptions.PrefixLength, + "vpn_gateway_id": *removeVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *removeVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *removeVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *removeVPNGatewayConnectionPeerCIDROptions.PrefixLength, } - 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}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range checkVPNGatewayConnectionLocalCIDROptions.Headers { + for headerName, headerValue := range removeVPNGatewayConnectionPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionLocalCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionPeerCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21153,112 +21169,56 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Cont return } -// AddVPNGatewayConnectionLocalCIDR : Set a local CIDR on a VPN gateway connection -// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified -// CIDR already exists. A request body is not required, and if provided, is ignored. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.AddVPNGatewayConnectionLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionLocalCIDROptions) +// UpdateIkePolicy : Update an IKE policy +// This request updates the properties of an existing IKE policy. +func (vpc *VpcV1) UpdateIkePolicy(updateIkePolicyOptions *UpdateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) } -// AddVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the AddVPNGatewayConnectionLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions cannot be nil") +// UpdateIkePolicyWithContext is an alternate form of the UpdateIkePolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolicyOptions *UpdateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateIkePolicyOptions, "updateIkePolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions") + err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *addVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, - "id": *addVPNGatewayConnectionLocalCIDROptions.ID, - "cidr_prefix": *addVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, - "prefix_length": *addVPNGatewayConnectionLocalCIDROptions.PrefixLength, + "id": *updateIkePolicyOptions.ID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range addVPNGatewayConnectionLocalCIDROptions.Headers { + for headerName, headerValue := range updateIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionLocalCIDR") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// ListVPNGatewayConnectionPeerCIDRs : List all peer CIDRs for a VPN gateway connection -// This request lists all peer CIDRs for a VPN gateway connection. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionPeerCIDRsOptions) -} - -// ListVPNGatewayConnectionPeerCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionPeerCIDRs method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionPeerCIDRsOptions.VPNGatewayID, - "id": *listVPNGatewayConnectionPeerCIDRsOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs`, pathParamsMap) + _, err = builder.SetBodyContentJSON(updateIkePolicyOptions.IkePolicyPatch) if err != nil { return } - for headerName, headerValue := range listVPNGatewayConnectionPeerCIDRsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionPeerCIDRs") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() if err != nil { return @@ -21270,7 +21230,7 @@ func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Conte return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionPeerCIDRs) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) if err != nil { return } @@ -21280,230 +21240,197 @@ func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Conte return } -// RemoveVPNGatewayConnectionPeerCIDR : Remove a peer CIDR from a VPN gateway connection -// This request removes a CIDR from a VPN gateway connection. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveVPNGatewayConnectionPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionPeerCIDROptions) +// UpdateIpsecPolicy : Update an IPsec policy +// This request updates the properties of an existing IPsec policy. +func (vpc *VpcV1) UpdateIpsecPolicy(updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) } -// RemoveVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions cannot be nil") +// UpdateIpsecPolicyWithContext is an alternate form of the UpdateIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateIpsecPolicyOptions, "updateIpsecPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions") + err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *removeVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, - "id": *removeVPNGatewayConnectionPeerCIDROptions.ID, - "cidr_prefix": *removeVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, - "prefix_length": *removeVPNGatewayConnectionPeerCIDROptions.PrefixLength, + "id": *updateIpsecPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range removeVPNGatewayConnectionPeerCIDROptions.Headers { + for headerName, headerValue := range updateIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionPeerCIDR") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() + _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) if err != nil { return } - response, err = vpc.Service.Request(request, nil) - - return -} - -// CheckVPNGatewayConnectionPeerCIDR : Check if the specified peer CIDR exists on a VPN gateway connection -// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.CheckVPNGatewayConnectionPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionPeerCIDROptions) -} - -// CheckVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions") + request, err := builder.Build() if err != nil { return } - pathParamsMap := map[string]string{ - "vpn_gateway_id": *checkVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, - "id": *checkVPNGatewayConnectionPeerCIDROptions.ID, - "cidr_prefix": *checkVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, - "prefix_length": *checkVPNGatewayConnectionPeerCIDROptions.PrefixLength, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } - - for headerName, headerValue := range checkVPNGatewayConnectionPeerCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionPeerCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result } - response, err = vpc.Service.Request(request, nil) - return } -// AddVPNGatewayConnectionPeerCIDR : Set a peer CIDR on a VPN gateway connection -// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified -// CIDR already exists. A request body is not required, and if provided, is ignored. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.AddVPNGatewayConnectionPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionPeerCIDROptions) +// UpdateVPNGateway : Update a VPN gateway +// This request updates the properties of an existing VPN gateway. +func (vpc *VpcV1) UpdateVPNGateway(updateVPNGatewayOptions *UpdateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) } -// AddVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the AddVPNGatewayConnectionPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions cannot be nil") +// UpdateVPNGatewayWithContext is an alternate form of the UpdateVPNGateway method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGatewayOptions *UpdateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNGatewayOptions, "updateVPNGatewayOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions") + err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *addVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, - "id": *addVPNGatewayConnectionPeerCIDROptions.ID, - "cidr_prefix": *addVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, - "prefix_length": *addVPNGatewayConnectionPeerCIDROptions.PrefixLength, + "id": *updateVPNGatewayOptions.ID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range addVPNGatewayConnectionPeerCIDROptions.Headers { + for headerName, headerValue := range updateVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionPeerCIDR") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateVPNGatewayOptions.VPNGatewayPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + return + } + response.Result = result + } return } -// ListVPNServers : List all VPN servers -// This request lists all VPN servers. -func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) +// UpdateVPNGatewayConnection : Update a VPN gateway connection +// This request updates the properties of an existing VPN gateway connection. +func (vpc *VpcV1) UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) } -// 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") +// UpdateVPNGatewayConnectionWithContext is an alternate form of the UpdateVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + 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_servers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPNServersOptions.Headers { + for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPNServersOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) - } - if listVPNServersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNServersOptions.Start)) - } - if listVPNServersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNServersOptions.Limit)) - } - if listVPNServersOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNServersOptions.ResourceGroupID)) - } - if listVPNServersOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNServersOptions.Sort)) + + _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) + if err != nil { + return } request, err := builder.Build() @@ -21517,7 +21444,7 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) if err != nil { return } @@ -21631,6 +21558,90 @@ 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. destination of the +// packet. +func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + return vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) +} + +// CreateVPNServerRouteWithContext is an alternate form of the CreateVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNServerRouteOptions, "createVPNServerRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *createVPNServerRouteOptions.VPNServerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPNServerRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPNServerRouteOptions.Destination != nil { + body["destination"] = createVPNServerRouteOptions.Destination + } + if createVPNServerRouteOptions.Action != nil { + body["action"] = createVPNServerRouteOptions.Action + } + if createVPNServerRouteOptions.Name != nil { + body["name"] = createVPNServerRouteOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + // DeleteVPNServer : Delete a VPN server // This request deletes a VPN server. This operation cannot be reversed. func (vpc *VpcV1) DeleteVPNServer(deleteVPNServerOptions *DeleteVPNServerOptions) (response *core.DetailedResponse, err error) { @@ -21687,44 +21698,46 @@ func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServe return } -// GetVPNServer : Retrieve a VPN server -// This request retrieves a single VPN server specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNServer(getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - return vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) +// DeleteVPNServerClient : Delete a VPN client +// This request disconnects and deletes the VPN client from the VPN server. The VPN client may reconnect unless its +// authentication permissions for the configured authentication methods (such as its client certificate) have been +// revoked. +func (vpc *VpcV1) DeleteVPNServerClient(deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) } -// 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") +// DeleteVPNServerClientWithContext is an alternate form of the DeleteVPNServerClient method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNServerClientOptions, "deleteVPNServerClientOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions") + err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getVPNServerOptions.ID, + "vpn_server_id": *deleteVPNServerClientOptions.VPNServerID, + "id": *deleteVPNServerClientOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPNServerOptions.Headers { + for headerName, headerValue := range deleteVPNServerClientOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -21736,136 +21749,105 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// UpdateVPNServer : Update a VPN server -// This request updates the properties of an existing VPN server. Any property changes will cause all connected VPN -// clients are disconnected from this VPN server except for the name change. -func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - return vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) +// DeleteVPNServerRoute : Delete a VPN route +// This request deletes a VPN route. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPNServerRoute(deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) } -// 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") +// DeleteVPNServerRouteWithContext is an alternate form of the DeleteVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") + err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateVPNServerOptions.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, `/vpn_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateVPNServerOptions.Headers { + for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// GetVPNServerClientConfiguration : Retrieve client configuration -// This request retrieves OpenVPN client configuration on a single VPN server specified by the identifier in the URL. -// This configuration includes directives compatible with OpenVPN releases 2.4 and 2.5. -func (vpc *VpcV1) GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) { - return vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) +// DisconnectVPNClient : Disconnect a VPN client +// This request disconnects the specified VPN client, and deletes the client according to the VPN server's auto-deletion +// policy. The VPN client may reconnect unless its authentication permissions for the configured authentication methods +// (such as its client certificate) have been revoked. +func (vpc *VpcV1) DisconnectVPNClient(disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) { + return vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) } -// 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") +// DisconnectVPNClientWithContext is an alternate form of the DisconnectVPNClient method which supports a Context parameter +func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(disconnectVPNClientOptions, "disconnectVPNClientOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") + err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getVPNServerClientConfigurationOptions.ID, + "vpn_server_id": *disconnectVPNClientOptions.VPNServerID, + "id": *disconnectVPNClientOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}/client_configuration`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}/disconnect`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { + for headerName, headerValue := range disconnectVPNClientOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "text/plain") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -21877,46 +21859,45 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context return } - response, err = vpc.Service.Request(request, &result) + response, err = vpc.Service.Request(request, nil) return } -// ListVPNServerClients : List all VPN clients for a VPN server -// This request retrieves all connected VPN clients, and any disconnected VPN clients that the VPN server has not yet -// deleted based on its auto-deletion policy. -func (vpc *VpcV1) ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) +// GetVPNServer : Retrieve a VPN server +// This request retrieves a single VPN server specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNServer(getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + return vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) } -// 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") +// GetVPNServerWithContext is an alternate form of the GetVPNServer method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerOptions, "getVPNServerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") + err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *listVPNServerClientsOptions.VPNServerID, + "id": *getVPNServerOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPNServerClientsOptions.Headers { + for headerName, headerValue := range getVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21926,15 +21907,6 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPNServerClientsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start)) - } - if listVPNServerClientsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNServerClientsOptions.Limit)) - } - if listVPNServerClientsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNServerClientsOptions.Sort)) - } request, err := builder.Build() if err != nil { @@ -21947,7 +21919,7 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { return } @@ -21957,31 +21929,29 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe return } -// DeleteVPNServerClient : Delete a VPN client -// This request disconnects and deletes the VPN client from the VPN server. The VPN client may reconnect unless its -// authentication permissions for the configured authentication methods (such as its client certificate) have been -// revoked. -func (vpc *VpcV1) DeleteVPNServerClient(deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) +// GetVPNServerClient : Retrieve a VPN client +// This request retrieves a single VPN client specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) { + return vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) } -// 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") +// GetVPNServerClientWithContext is an alternate form of the GetVPNServerClient method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerClientOptions, "getVPNServerClientOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") + err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *deleteVPNServerClientOptions.VPNServerID, - "id": *deleteVPNServerClientOptions.ID, + "vpn_server_id": *getVPNServerClientOptions.VPNServerID, + "id": *getVPNServerClientOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) @@ -21989,14 +21959,15 @@ func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVP return } - for headerName, headerValue := range deleteVPNServerClientOptions.Headers { + for headerName, headerValue := range getVPNServerClientOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") + 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("future_version", fmt.Sprint("true")) @@ -22008,50 +21979,61 @@ 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 { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) + if err != nil { + return + } + response.Result = result + } return } -// GetVPNServerClient : Retrieve a VPN client -// This request retrieves a single VPN client specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) { - return vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) +// GetVPNServerClientConfiguration : Retrieve client configuration +// This request retrieves OpenVPN client configuration on a single VPN server specified by the identifier in the URL. +// This configuration includes directives compatible with OpenVPN releases 2.4 and 2.5. +func (vpc *VpcV1) GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) { + return vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) } -// 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") +// GetVPNServerClientConfigurationWithContext is an alternate form of the GetVPNServerClientConfiguration method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context, getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") + err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *getVPNServerClientOptions.VPNServerID, - "id": *getVPNServerClientOptions.ID, + "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/{vpn_server_id}/clients/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}/client_configuration`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPNServerClientOptions.Headers { + for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + builder.AddHeader("Accept", "text/plain") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -22063,62 +22045,50 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, &result) return } -// DisconnectVPNClient : Disconnect a VPN client -// This request disconnects the specified VPN client, and deletes the client according to the VPN server's auto-deletion -// policy. The VPN client may reconnect unless its authentication permissions for the configured authentication methods -// (such as its client certificate) have been revoked. -func (vpc *VpcV1) DisconnectVPNClient(disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) { - return vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) +// GetVPNServerRoute : Retrieve a VPN route +// This request retrieves a single VPN route specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNServerRoute(getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + return vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) } -// 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") +// GetVPNServerRouteWithContext is an alternate form of the GetVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerRouteOptions, "getVPNServerRouteOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") + err = core.ValidateStruct(getVPNServerRouteOptions, "getVPNServerRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *disconnectVPNClientOptions.VPNServerID, - "id": *disconnectVPNClientOptions.ID, + "vpn_server_id": *getVPNServerRouteOptions.VPNServerID, + "id": *getVPNServerRouteOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}/disconnect`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range disconnectVPNClientOptions.Headers { + for headerName, headerValue := range getVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") + 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("future_version", fmt.Sprint("true")) @@ -22130,47 +22100,57 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + if err != nil { + return + } + response.Result = result + } return } -// ListVPNServerRoutes : List all VPN routes for a VPN server -// This request lists all VPN routes in a VPN server. All VPN routes are provided to the VPN client when the connection -// is established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN route -// matching their specified destinations. All VPN routes must be unique within the VPN server. -func (vpc *VpcV1) ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) +// ListVPNServerClients : List all VPN clients for a VPN server +// This request retrieves all connected VPN clients, and any disconnected VPN clients that the VPN server has not yet +// deleted based on its auto-deletion policy. +func (vpc *VpcV1) ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) } -// 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") +// ListVPNServerClientsWithContext is an alternate form of the ListVPNServerClients method which supports a Context parameter +func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNServerClientsOptions, "listVPNServerClientsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") + err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *listVPNServerRoutesOptions.VPNServerID, + "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}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPNServerRoutesOptions.Headers { + for headerName, headerValue := range listVPNServerClientsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22180,14 +22160,14 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPNServerRoutesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNServerRoutesOptions.Start)) + if listVPNServerClientsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start)) } - if listVPNServerRoutesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNServerRoutesOptions.Limit)) + if listVPNServerClientsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServerClientsOptions.Limit)) } - if listVPNServerRoutesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNServerRoutesOptions.Sort)) + if listVPNServerClientsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServerClientsOptions.Sort)) } request, err := builder.Build() @@ -22201,7 +22181,7 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRouteCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) if err != nil { return } @@ -22211,31 +22191,30 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer return } -// CreateVPNServerRoute : Create a VPN route for a VPN server -// This request creates a new VPN route in the VPN server. All VPN routes are provided to the VPN client when the -// connection is established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN -// route matching their specified destinations. All VPN routes must be unique within the VPN server. destination of the -// packet. -func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - return vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) +// ListVPNServerRoutes : List all VPN routes for a VPN server +// This request lists all VPN routes in a VPN server. All VPN routes are provided to the VPN client when the connection +// is established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN route +// matching their specified destinations. All VPN routes must be unique within the VPN server. +func (vpc *VpcV1) ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) } -// 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") +// ListVPNServerRoutesWithContext is an alternate form of the ListVPNServerRoutes method which supports a Context parameter +func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNServerRoutesOptions, "listVPNServerRoutesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") + err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *createVPNServerRouteOptions.VPNServerID, + "vpn_server_id": *listVPNServerRoutesOptions.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) @@ -22243,35 +22222,28 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN return } - for headerName, headerValue := range createVPNServerRouteOptions.Headers { + for headerName, headerValue := range listVPNServerRoutesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createVPNServerRouteOptions.Destination != nil { - body["destination"] = createVPNServerRouteOptions.Destination - } - if createVPNServerRouteOptions.Action != nil { - body["action"] = createVPNServerRouteOptions.Action + if listVPNServerRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServerRoutesOptions.Start)) } - if createVPNServerRouteOptions.Name != nil { - body["name"] = createVPNServerRouteOptions.Name + if listVPNServerRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServerRoutesOptions.Limit)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return + if listVPNServerRoutesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServerRoutesOptions.Sort)) } request, err := builder.Build() @@ -22285,7 +22257,7 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRouteCollection) if err != nil { return } @@ -22295,105 +22267,132 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN return } -// DeleteVPNServerRoute : Delete a VPN route -// This request deletes a VPN route. This operation cannot be reversed. -func (vpc *VpcV1) DeleteVPNServerRoute(deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) +// ListVPNServers : List all VPN servers +// This request lists all VPN servers. +func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) } -// DeleteVPNServerRouteWithContext is an alternate form of the DeleteVPNServerRoute method which supports a Context parameter -func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") +// ListVPNServersWithContext is an alternate form of the ListVPNServers method which supports a Context parameter +func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVPNServersOptions, "listVPNServersOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "vpn_server_id": *deleteVPNServerRouteOptions.VPNServerID, - "id": *deleteVPNServerRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) if err != nil { return } - for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { + for headerName, headerValue := range listVPNServersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPNServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) + } + if listVPNServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServersOptions.Start)) + } + if listVPNServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServersOptions.Limit)) + } + if listVPNServersOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNServersOptions.ResourceGroupID)) + } + if listVPNServersOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServersOptions.Sort)) + } request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) + if err != nil { + 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) { - return vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) +// UpdateVPNServer : Update a VPN server +// This request updates the properties of an existing VPN server. Any property changes will cause all connected VPN +// clients are disconnected from this VPN server except for the name change. +func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) } -// 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") +// UpdateVPNServerWithContext is an alternate form of the UpdateVPNServer method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNServerOptions, "updateVPNServerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPNServerRouteOptions, "getVPNServerRouteOptions") + err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *getVPNServerRouteOptions.VPNServerID, - "id": *getVPNServerRouteOptions.ID, + "id": *updateVPNServerOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPNServerRouteOptions.Headers { + for headerName, headerValue := range updateVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerRoute") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -22405,7 +22404,7 @@ func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServer return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { return } @@ -22488,47 +22487,87 @@ func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPN return } -// ListLoadBalancerProfiles : List all load balancer profiles -// This request lists all load balancer profiles available in the region. A load balancer profile specifies the -// performance characteristics and pricing model for a load balancer. -func (vpc *VpcV1) ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) +// CreateLoadBalancer : Create a load balancer +// This request creates and provisions a new load balancer. +func (vpc *VpcV1) CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) } -// 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") +// CreateLoadBalancerWithContext is an alternate form of the CreateLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerOptions, "createLoadBalancerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) if err != nil { return } - for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { + for headerName, headerValue := range createLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listLoadBalancerProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) + + body := make(map[string]interface{}) + if createLoadBalancerOptions.IsPublic != nil { + body["is_public"] = createLoadBalancerOptions.IsPublic } - if listLoadBalancerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerProfilesOptions.Limit)) + if createLoadBalancerOptions.Subnets != nil { + body["subnets"] = createLoadBalancerOptions.Subnets + } + if createLoadBalancerOptions.Datapath != nil { + body["datapath"] = createLoadBalancerOptions.Datapath + } + if createLoadBalancerOptions.Dns != nil { + body["dns"] = createLoadBalancerOptions.Dns + } + if createLoadBalancerOptions.Listeners != nil { + body["listeners"] = createLoadBalancerOptions.Listeners + } + if createLoadBalancerOptions.Logging != nil { + body["logging"] = createLoadBalancerOptions.Logging + } + if createLoadBalancerOptions.Name != nil { + body["name"] = createLoadBalancerOptions.Name + } + if createLoadBalancerOptions.Pools != nil { + body["pools"] = createLoadBalancerOptions.Pools + } + if createLoadBalancerOptions.Profile != nil { + body["profile"] = createLoadBalancerOptions.Profile + } + if createLoadBalancerOptions.ResourceGroup != nil { + body["resource_group"] = createLoadBalancerOptions.ResourceGroup + } + if createLoadBalancerOptions.RouteMode != nil { + body["route_mode"] = createLoadBalancerOptions.RouteMode + } + if createLoadBalancerOptions.SecurityGroups != nil { + body["security_groups"] = createLoadBalancerOptions.SecurityGroups + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return } request, err := builder.Build() @@ -22542,7 +22581,7 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) if err != nil { return } @@ -22552,50 +22591,90 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL return } -// GetLoadBalancerProfile : Retrieve a load balancer profile -// This request retrieves a load balancer profile specified by the name in the URL. -func (vpc *VpcV1) GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) +// CreateLoadBalancerListener : Create a listener for a load balancer +// This request creates a new listener for a load balancer. +func (vpc *VpcV1) CreateLoadBalancerListener(createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) } -// 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") +// CreateLoadBalancerListenerWithContext is an alternate form of the CreateLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") + err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "name": *getLoadBalancerProfileOptions.Name, + "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createLoadBalancerListenerOptions.Protocol != nil { + body["protocol"] = createLoadBalancerListenerOptions.Protocol + } + if createLoadBalancerListenerOptions.AcceptProxyProtocol != nil { + body["accept_proxy_protocol"] = createLoadBalancerListenerOptions.AcceptProxyProtocol + } + if createLoadBalancerListenerOptions.CertificateInstance != nil { + body["certificate_instance"] = createLoadBalancerListenerOptions.CertificateInstance + } + if createLoadBalancerListenerOptions.ConnectionLimit != nil { + body["connection_limit"] = createLoadBalancerListenerOptions.ConnectionLimit + } + if createLoadBalancerListenerOptions.DefaultPool != nil { + body["default_pool"] = createLoadBalancerListenerOptions.DefaultPool + } + if createLoadBalancerListenerOptions.HTTPSRedirect != nil { + body["https_redirect"] = createLoadBalancerListenerOptions.HTTPSRedirect + } + if createLoadBalancerListenerOptions.IdleConnectionTimeout != nil { + body["idle_connection_timeout"] = createLoadBalancerListenerOptions.IdleConnectionTimeout + } + if createLoadBalancerListenerOptions.Policies != nil { + body["policies"] = createLoadBalancerListenerOptions.Policies + } + if createLoadBalancerListenerOptions.Port != nil { + body["port"] = createLoadBalancerListenerOptions.Port + } + if createLoadBalancerListenerOptions.PortMax != nil { + body["port_max"] = createLoadBalancerListenerOptions.PortMax + } + if createLoadBalancerListenerOptions.PortMin != nil { + body["port_min"] = createLoadBalancerListenerOptions.PortMin + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -22607,7 +22686,7 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { return } @@ -22617,46 +22696,71 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad return } -// ListLoadBalancers : List all load balancers -// This request lists all load balancers in the region. -func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) +// CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener +// Creates a new policy for a load balancer listener. +func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) } -// 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") +// CreateLoadBalancerListenerPolicyWithContext is an alternate form of the CreateLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Context, createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + 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`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancersOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listLoadBalancersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start)) + + body := make(map[string]interface{}) + if createLoadBalancerListenerPolicyOptions.Action != nil { + body["action"] = createLoadBalancerListenerPolicyOptions.Action } - if listLoadBalancersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listLoadBalancersOptions.Limit)) + if createLoadBalancerListenerPolicyOptions.Priority != nil { + body["priority"] = createLoadBalancerListenerPolicyOptions.Priority + } + if createLoadBalancerListenerPolicyOptions.Name != nil { + body["name"] = createLoadBalancerListenerPolicyOptions.Name + } + if createLoadBalancerListenerPolicyOptions.Rules != nil { + body["rules"] = createLoadBalancerListenerPolicyOptions.Rules + } + if createLoadBalancerListenerPolicyOptions.Target != nil { + body["target"] = createLoadBalancerListenerPolicyOptions.Target + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return } request, err := builder.Build() @@ -22670,7 +22774,7 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { return } @@ -22680,36 +22784,42 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala return } -// CreateLoadBalancer : Create a load balancer -// This request creates and provisions a new load balancer. -func (vpc *VpcV1) CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) +// CreateLoadBalancerListenerPolicyRule : Create a rule for a load balancer listener policy +// Creates a new rule for the load balancer listener policy. +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) } -// 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") +// CreateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the CreateLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") + err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22722,41 +22832,17 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) - if createLoadBalancerOptions.IsPublic != nil { - body["is_public"] = createLoadBalancerOptions.IsPublic - } - if createLoadBalancerOptions.Subnets != nil { - body["subnets"] = createLoadBalancerOptions.Subnets - } - if createLoadBalancerOptions.Datapath != nil { - body["datapath"] = createLoadBalancerOptions.Datapath - } - if createLoadBalancerOptions.Dns != nil { - body["dns"] = createLoadBalancerOptions.Dns - } - if createLoadBalancerOptions.Listeners != nil { - body["listeners"] = createLoadBalancerOptions.Listeners - } - if createLoadBalancerOptions.Logging != nil { - body["logging"] = createLoadBalancerOptions.Logging - } - if createLoadBalancerOptions.Name != nil { - body["name"] = createLoadBalancerOptions.Name - } - if createLoadBalancerOptions.Pools != nil { - body["pools"] = createLoadBalancerOptions.Pools - } - if createLoadBalancerOptions.Profile != nil { - body["profile"] = createLoadBalancerOptions.Profile + if createLoadBalancerListenerPolicyRuleOptions.Condition != nil { + body["condition"] = createLoadBalancerListenerPolicyRuleOptions.Condition } - if createLoadBalancerOptions.ResourceGroup != nil { - body["resource_group"] = createLoadBalancerOptions.ResourceGroup + if createLoadBalancerListenerPolicyRuleOptions.Type != nil { + body["type"] = createLoadBalancerListenerPolicyRuleOptions.Type } - if createLoadBalancerOptions.RouteMode != nil { - body["route_mode"] = createLoadBalancerOptions.RouteMode + if createLoadBalancerListenerPolicyRuleOptions.Value != nil { + body["value"] = createLoadBalancerListenerPolicyRuleOptions.Value } - if createLoadBalancerOptions.SecurityGroups != nil { - body["security_groups"] = createLoadBalancerOptions.SecurityGroups + if createLoadBalancerListenerPolicyRuleOptions.Field != nil { + body["field"] = createLoadBalancerListenerPolicyRuleOptions.Field } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -22774,7 +22860,7 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { return } @@ -22784,106 +22870,159 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB return } -// DeleteLoadBalancer : Delete a load balancer -// This request deletes a load balancer. This operation cannot be reversed. A load balancer cannot be deleted if its -// `provisioning_status` is `delete_pending`. -func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) +// CreateLoadBalancerPool : Create a load balancer pool +// This request creates a new pool from a pool prototype object. +func (vpc *VpcV1) CreateLoadBalancerPool(createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) } -// 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") +// CreateLoadBalancerPoolWithContext is an alternate form of the CreateLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") + err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteLoadBalancerOptions.ID, + "load_balancer_id": *createLoadBalancerPoolOptions.LoadBalancerID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerOptions.Headers { + for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteLoadBalancerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteLoadBalancerOptions.IfMatch)) - } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createLoadBalancerPoolOptions.Algorithm != nil { + body["algorithm"] = createLoadBalancerPoolOptions.Algorithm + } + if createLoadBalancerPoolOptions.HealthMonitor != nil { + body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor + } + if createLoadBalancerPoolOptions.Protocol != nil { + body["protocol"] = createLoadBalancerPoolOptions.Protocol + } + if createLoadBalancerPoolOptions.Members != nil { + body["members"] = createLoadBalancerPoolOptions.Members + } + if createLoadBalancerPoolOptions.Name != nil { + body["name"] = createLoadBalancerPoolOptions.Name + } + if createLoadBalancerPoolOptions.ProxyProtocol != nil { + body["proxy_protocol"] = createLoadBalancerPoolOptions.ProxyProtocol + } + if createLoadBalancerPoolOptions.SessionPersistence != nil { + body["session_persistence"] = createLoadBalancerPoolOptions.SessionPersistence + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + 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) { - return vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) +// CreateLoadBalancerPoolMember : Create a member in a load balancer pool +// This request creates a new member and adds the member to the pool. +func (vpc *VpcV1) CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) } -// 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") +// CreateLoadBalancerPoolMemberWithContext is an alternate form of the CreateLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") + err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getLoadBalancerOptions.ID, + "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerOptions.Headers { + for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerPoolMemberOptions.Port != nil { + body["port"] = createLoadBalancerPoolMemberOptions.Port + } + if createLoadBalancerPoolMemberOptions.Target != nil { + body["target"] = createLoadBalancerPoolMemberOptions.Target + } + if createLoadBalancerPoolMemberOptions.Weight != nil { + body["weight"] = createLoadBalancerPoolMemberOptions.Weight + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } request, err := builder.Build() if err != nil { @@ -22896,7 +23035,7 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) if err != nil { return } @@ -22906,30 +23045,29 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance return } -// UpdateLoadBalancer : Update a load balancer -// This request updates a load balancer with the information in a provided load balancer patch. The load balancer patch -// object is structured in the same way as a retrieved load balancer and contains only the information to be updated. A -// load balancer can only be updated if its `provisioning_status` is `active`. -func (vpc *VpcV1) UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) +// DeleteLoadBalancer : Delete a load balancer +// This request deletes a load balancer. This operation cannot be reversed. A load balancer cannot be deleted if its +// `provisioning_status` is `delete_pending`. +func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) } -// 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") +// DeleteLoadBalancerWithContext is an alternate form of the DeleteLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerOptions, "deleteLoadBalancerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") + err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateLoadBalancerOptions.ID, + "id": *deleteLoadBalancerOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) @@ -22937,18 +23075,16 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB return } - for headerName, headerValue := range updateLoadBalancerOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateLoadBalancerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateLoadBalancerOptions.IfMatch)) + if deleteLoadBalancerOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteLoadBalancerOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) @@ -22956,70 +23092,55 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// GetLoadBalancerStatistics : List all statistics of a load balancer -// This request lists statistics of a load balancer. -func (vpc *VpcV1) GetLoadBalancerStatistics(getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) +// DeleteLoadBalancerListener : Delete a load balancer listener +// This request deletes a load balancer listener. This operation cannot be reversed. For this operation to succeed, the +// listener must not be the target of another load balancer listener. +func (vpc *VpcV1) DeleteLoadBalancerListener(deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) } -// 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") +// DeleteLoadBalancerListenerWithContext is an alternate form of the DeleteLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") + err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getLoadBalancerStatisticsOptions.ID, + "load_balancer_id": *deleteLoadBalancerListenerOptions.LoadBalancerID, + "id": *deleteLoadBalancerListenerOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}/statistics`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -23031,60 +23152,50 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListLoadBalancerListeners : List all listeners for a load balancer -// This request lists all listeners for a load balancer. -func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) +// DeleteLoadBalancerListenerPolicy : Delete a load balancer listener policy +// Deletes a policy of the load balancer listener. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) } -// 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") +// DeleteLoadBalancerListenerPolicyWithContext is an alternate form of the DeleteLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, + "load_balancer_id": *deleteLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyOptions.ListenerID, + "id": *deleteLoadBalancerListenerPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -23096,163 +23207,103 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// CreateLoadBalancerListener : Create a listener for a load balancer -// This request creates a new listener for a load balancer. -func (vpc *VpcV1) CreateLoadBalancerListener(createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) +// DeleteLoadBalancerListenerPolicyRule : Delete a load balancer listener policy rule +// Deletes a rule from the load balancer listener policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) } -// 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") +// DeleteLoadBalancerListenerPolicyRuleWithContext is an alternate form of the DeleteLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, + "load_balancer_id": *deleteLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *deleteLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *deleteLoadBalancerListenerPolicyRuleOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createLoadBalancerListenerOptions.Protocol != nil { - body["protocol"] = createLoadBalancerListenerOptions.Protocol - } - if createLoadBalancerListenerOptions.AcceptProxyProtocol != nil { - body["accept_proxy_protocol"] = createLoadBalancerListenerOptions.AcceptProxyProtocol - } - if createLoadBalancerListenerOptions.CertificateInstance != nil { - body["certificate_instance"] = createLoadBalancerListenerOptions.CertificateInstance - } - if createLoadBalancerListenerOptions.ConnectionLimit != nil { - body["connection_limit"] = createLoadBalancerListenerOptions.ConnectionLimit - } - if createLoadBalancerListenerOptions.DefaultPool != nil { - body["default_pool"] = createLoadBalancerListenerOptions.DefaultPool - } - if createLoadBalancerListenerOptions.HTTPSRedirect != nil { - body["https_redirect"] = createLoadBalancerListenerOptions.HTTPSRedirect - } - if createLoadBalancerListenerOptions.IdleConnectionTimeout != nil { - body["idle_connection_timeout"] = createLoadBalancerListenerOptions.IdleConnectionTimeout - } - if createLoadBalancerListenerOptions.Policies != nil { - body["policies"] = createLoadBalancerListenerOptions.Policies - } - if createLoadBalancerListenerOptions.Port != nil { - body["port"] = createLoadBalancerListenerOptions.Port - } - if createLoadBalancerListenerOptions.PortMax != nil { - body["port_max"] = createLoadBalancerListenerOptions.PortMax - } - if createLoadBalancerListenerOptions.PortMin != nil { - body["port_min"] = createLoadBalancerListenerOptions.PortMin - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// DeleteLoadBalancerListener : Delete a load balancer listener -// This request deletes a load balancer listener. This operation cannot be reversed. For this operation to succeed, the -// listener must not be the target of another load balancer listener. -func (vpc *VpcV1) DeleteLoadBalancerListener(deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) +// DeleteLoadBalancerPool : Delete a load balancer pool +// This request deletes a load balancer pool. This operation cannot be reversed. The pool must not currently be the +// default pool for any listener in the load balancer. +func (vpc *VpcV1) DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) } -// 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") +// DeleteLoadBalancerPoolWithContext is an alternate form of the DeleteLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") + err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerOptions.LoadBalancerID, - "id": *deleteLoadBalancerListenerOptions.ID, + "load_balancer_id": *deleteLoadBalancerPoolOptions.LoadBalancerID, + "id": *deleteLoadBalancerPoolOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23272,45 +23323,45 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, del return } -// GetLoadBalancerListener : Retrieve a load balancer listener -// This request retrieves a single listener specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerListener(getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) +// DeleteLoadBalancerPoolMember : Delete a load balancer pool member +// This request deletes a member from the pool. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) } -// 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") +// DeleteLoadBalancerPoolMemberWithContext is an alternate form of the DeleteLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") + err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerOptions.LoadBalancerID, - "id": *getLoadBalancerListenerOptions.ID, + "load_balancer_id": *deleteLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *deleteLoadBalancerPoolMemberOptions.PoolID, + "id": *deleteLoadBalancerPoolMemberOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -23322,73 +23373,55 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// UpdateLoadBalancerListener : Update a load balancer listener -// This request updates a load balancer listener from a listener patch. -func (vpc *VpcV1) UpdateLoadBalancerListener(updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) +// GetLoadBalancer : Retrieve a load balancer +// This request retrieves a single load balancer specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancer(getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) } -// 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") +// GetLoadBalancerWithContext is an alternate form of the GetLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerOptions, "getLoadBalancerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") + err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerOptions.LoadBalancerID, - "id": *updateLoadBalancerListenerOptions.ID, + "id": *getLoadBalancerOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range getLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -23400,7 +23433,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) if err != nil { return } @@ -23410,41 +23443,41 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd return } -// ListLoadBalancerListenerPolicies : List all policies for a load balancer listener -// This request lists all policies for a load balancer listener. -func (vpc *VpcV1) ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) +// GetLoadBalancerListener : Retrieve a load balancer listener +// This request retrieves a single listener specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListener(getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) } -// 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") +// GetLoadBalancerListenerWithContext is an alternate form of the GetLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") + err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenerPoliciesOptions.LoadBalancerID, - "listener_id": *listLoadBalancerListenerPoliciesOptions.ListenerID, + "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/{listener_id}/policies`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23466,7 +23499,7 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { return } @@ -23476,73 +23509,52 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex return } -// CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener -// Creates a new policy for a load balancer listener. -func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) +// GetLoadBalancerListenerPolicy : Retrieve a load balancer listener policy +// Retrieve a single policy specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) } -// 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") +// GetLoadBalancerListenerPolicyWithContext is an alternate form of the GetLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *createLoadBalancerListenerPolicyOptions.ListenerID, + "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, + "id": *getLoadBalancerListenerPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createLoadBalancerListenerPolicyOptions.Action != nil { - body["action"] = createLoadBalancerListenerPolicyOptions.Action - } - if createLoadBalancerListenerPolicyOptions.Priority != nil { - body["priority"] = createLoadBalancerListenerPolicyOptions.Priority - } - if createLoadBalancerListenerPolicyOptions.Name != nil { - body["name"] = createLoadBalancerListenerPolicyOptions.Name - } - if createLoadBalancerListenerPolicyOptions.Rules != nil { - body["rules"] = createLoadBalancerListenerPolicyOptions.Rules - } - if createLoadBalancerListenerPolicyOptions.Target != nil { - body["target"] = createLoadBalancerListenerPolicyOptions.Target - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -23564,45 +23576,47 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex return } -// DeleteLoadBalancerListenerPolicy : Delete a load balancer listener policy -// Deletes a policy of the load balancer listener. This operation cannot be reversed. -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) +// GetLoadBalancerListenerPolicyRule : Retrieve a load balancer listener policy rule +// Retrieves a single rule specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) } -// 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") +// GetLoadBalancerListenerPolicyRuleWithContext is an alternate form of the GetLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *deleteLoadBalancerListenerPolicyOptions.ListenerID, - "id": *deleteLoadBalancerListenerPolicyOptions.ID, + "load_balancer_id": *getLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *getLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *getLoadBalancerListenerPolicyRuleOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") + 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("future_version", fmt.Sprint("true")) @@ -23614,47 +23628,57 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Contex return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + response.Result = result + } return } -// GetLoadBalancerListenerPolicy : Retrieve a load balancer listener policy -// Retrieve a single policy specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) +// GetLoadBalancerPool : Retrieve a load balancer pool +// This request retrieves a single pool specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerPool(getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) } -// 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") +// GetLoadBalancerPoolWithContext is an alternate form of the GetLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, - "id": *getLoadBalancerListenerPolicyOptions.ID, + "load_balancer_id": *getLoadBalancerPoolOptions.LoadBalancerID, + "id": *getLoadBalancerPoolOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23676,7 +23700,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { return } @@ -23686,58 +23710,52 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, return } -// UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy -// Updates a policy from a policy patch. -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) +// GetLoadBalancerPoolMember : Retrieve a load balancer pool member +// This request retrieves a single member specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) } -// 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") +// GetLoadBalancerPoolMemberWithContext is an alternate form of the GetLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, - "id": *updateLoadBalancerListenerPolicyOptions.ID, + "load_balancer_id": *getLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *getLoadBalancerPoolMemberOptions.PoolID, + "id": *getLoadBalancerPoolMemberOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -23749,7 +23767,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) if err != nil { return } @@ -23759,42 +23777,40 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex return } -// ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy -// This request lists all rules of a load balancer listener policy. -func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) +// GetLoadBalancerProfile : Retrieve a load balancer profile +// This request retrieves a load balancer profile specified by the name in the URL. +func (vpc *VpcV1) GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) } -// 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") +// GetLoadBalancerProfileWithContext is an alternate form of the GetLoadBalancerProfile method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") + err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, - "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, - "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, + "name": *getLoadBalancerProfileOptions.Name, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { + for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23816,7 +23832,7 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) if err != nil { return } @@ -23826,71 +23842,50 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con return } -// CreateLoadBalancerListenerPolicyRule : Create a rule for a load balancer listener policy -// Creates a new rule for the load balancer listener policy. -func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) +// GetLoadBalancerStatistics : List all statistics of a load balancer +// This request lists statistics of a load balancer. +func (vpc *VpcV1) GetLoadBalancerStatistics(getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) } -// 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") +// GetLoadBalancerStatisticsWithContext is an alternate form of the GetLoadBalancerStatistics method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *getLoadBalancerStatisticsOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}/statistics`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createLoadBalancerListenerPolicyRuleOptions.Condition != nil { - body["condition"] = createLoadBalancerListenerPolicyRuleOptions.Condition - } - if createLoadBalancerListenerPolicyRuleOptions.Type != nil { - body["type"] = createLoadBalancerListenerPolicyRuleOptions.Type - } - if createLoadBalancerListenerPolicyRuleOptions.Value != nil { - body["value"] = createLoadBalancerListenerPolicyRuleOptions.Value - } - if createLoadBalancerListenerPolicyRuleOptions.Field != nil { - body["field"] = createLoadBalancerListenerPolicyRuleOptions.Field - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -23902,7 +23897,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics) if err != nil { return } @@ -23912,46 +23907,45 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } -// DeleteLoadBalancerListenerPolicyRule : Delete a load balancer listener policy rule -// Deletes a rule from the load balancer listener policy. This operation cannot be reversed. -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) +// ListLoadBalancerListenerPolicies : List all policies for a load balancer listener +// This request lists all policies for a load balancer listener. +func (vpc *VpcV1) ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) } -// 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") +// ListLoadBalancerListenerPoliciesWithContext is an alternate form of the ListLoadBalancerListenerPolicies method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Context, listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *deleteLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *deleteLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *deleteLoadBalancerListenerPolicyRuleOptions.ID, + "load_balancer_id": *listLoadBalancerListenerPoliciesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPoliciesOptions.ListenerID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") + 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("future_version", fmt.Sprint("true")) @@ -23963,48 +23957,58 @@ 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 { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetLoadBalancerListenerPolicyRule : Retrieve a load balancer listener policy rule -// Retrieves a single rule specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) +// ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy +// This request lists all rules of a load balancer listener policy. +func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) } -// 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") +// ListLoadBalancerListenerPolicyRulesWithContext is an alternate form of the ListLoadBalancerListenerPolicyRules method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Context, listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *getLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *getLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *getLoadBalancerListenerPolicyRuleOptions.ID, + "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, + "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24026,7 +24030,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) if err != nil { return } @@ -24036,59 +24040,50 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte return } -// UpdateLoadBalancerListenerPolicyRule : Update a load balancer listener policy rule -// Updates a rule of the load balancer listener policy. -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) +// ListLoadBalancerListeners : List all listeners for a load balancer +// This request lists all listeners for a load balancer. +func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) } -// 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") +// ListLoadBalancerListenersWithContext is an alternate form of the ListLoadBalancerListeners method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *updateLoadBalancerListenerPolicyRuleOptions.ID, + "load_balancer_id": *listLoadBalancerListenersOptions.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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -24100,7 +24095,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) if err != nil { return } @@ -24110,40 +24105,41 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } -// ListLoadBalancerPools : List all pools of a load balancer -// This request lists all pools of a load balancer. -func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) +// ListLoadBalancerPoolMembers : List all members of a load balancer pool +// This request lists all members of a load balancer pool. +func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) } -// 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") +// ListLoadBalancerPoolMembersWithContext is an alternate form of the ListLoadBalancerPoolMembers method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") + err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerPoolsOptions.LoadBalancerID, + "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`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { + for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24165,7 +24161,7 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { return } @@ -24175,28 +24171,28 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad return } -// CreateLoadBalancerPool : Create a load balancer pool -// This request creates a new pool from a pool prototype object. -func (vpc *VpcV1) CreateLoadBalancerPool(createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) +// ListLoadBalancerPools : List all pools of a load balancer +// This request lists all pools of a load balancer. +func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) } -// 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") +// ListLoadBalancerPoolsWithContext is an alternate form of the ListLoadBalancerPools method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") + err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerPoolOptions.LoadBalancerID, + "load_balancer_id": *listLoadBalancerPoolsOptions.LoadBalancerID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) @@ -24204,49 +24200,21 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL return } - for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createLoadBalancerPoolOptions.Algorithm != nil { - body["algorithm"] = createLoadBalancerPoolOptions.Algorithm - } - if createLoadBalancerPoolOptions.HealthMonitor != nil { - body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor - } - if createLoadBalancerPoolOptions.Protocol != nil { - body["protocol"] = createLoadBalancerPoolOptions.Protocol - } - if createLoadBalancerPoolOptions.Members != nil { - body["members"] = createLoadBalancerPoolOptions.Members - } - if createLoadBalancerPoolOptions.Name != nil { - body["name"] = createLoadBalancerPoolOptions.Name - } - if createLoadBalancerPoolOptions.ProxyProtocol != nil { - body["proxy_protocol"] = createLoadBalancerPoolOptions.ProxyProtocol - } - if createLoadBalancerPoolOptions.SessionPersistence != nil { - body["session_persistence"] = createLoadBalancerPoolOptions.SessionPersistence - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -24258,7 +24226,7 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) if err != nil { return } @@ -24268,96 +24236,96 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL return } -// DeleteLoadBalancerPool : Delete a load balancer pool -// This request deletes a load balancer pool. This operation cannot be reversed. The pool must not currently be the -// default pool for any listener in the load balancer. -func (vpc *VpcV1) DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) +// ListLoadBalancerProfiles : List all load balancer profiles +// This request lists all load balancer profiles available in the region. A load balancer profile specifies the +// performance characteristics and pricing model for a load balancer. +func (vpc *VpcV1) ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) } -// DeleteLoadBalancerPoolWithContext is an alternate form of the DeleteLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") +// ListLoadBalancerProfilesWithContext is an alternate form of the ListLoadBalancerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listLoadBalancerProfilesOptions, "listLoadBalancerProfilesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerPoolOptions.LoadBalancerID, - "id": *deleteLoadBalancerPoolOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles`, nil) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listLoadBalancerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) + } + if listLoadBalancerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerProfilesOptions.Limit)) + } request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetLoadBalancerPool : Retrieve a load balancer pool -// This request retrieves a single pool specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerPool(getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) +// ListLoadBalancers : List all load balancers +// This request lists all load balancers in the region. +func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) } -// GetLoadBalancerPoolWithContext is an alternate form of the GetLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") +// ListLoadBalancersWithContext is an alternate form of the ListLoadBalancers method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listLoadBalancersOptions, "listLoadBalancersOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "load_balancer_id": *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) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) if err != nil { return } - for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range listLoadBalancersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24367,6 +24335,12 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listLoadBalancersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start)) + } + if listLoadBalancersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listLoadBalancersOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -24379,7 +24353,7 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection) if err != nil { return } @@ -24389,53 +24363,58 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal return } -// UpdateLoadBalancerPool : Update a load balancer pool -// This request updates a load balancer pool from a pool patch. -func (vpc *VpcV1) UpdateLoadBalancerPool(updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) +// ReplaceLoadBalancerPoolMembers : Replace load balancer pool members +// This request replaces the existing members of the load balancer pool with new members created from the collection of +// member prototype objects. +func (vpc *VpcV1) ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + return vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) } -// 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") +// ReplaceLoadBalancerPoolMembersWithContext is an alternate form of the ReplaceLoadBalancerPoolMembers method which supports a Context parameter +func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") + err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerPoolOptions.LoadBalancerID, - "id": *updateLoadBalancerPoolOptions.ID, + "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) + body := make(map[string]interface{}) + if replaceLoadBalancerPoolMembersOptions.Members != nil { + body["members"] = replaceLoadBalancerPoolMembersOptions.Members + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } @@ -24451,7 +24430,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { return } @@ -24461,51 +24440,61 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL return } -// ListLoadBalancerPoolMembers : List all members of a load balancer pool -// This request lists all members of a load balancer pool. -func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) +// UpdateLoadBalancer : Update a load balancer +// This request updates a load balancer with the information in a provided load balancer patch. The load balancer patch +// object is structured in the same way as a retrieved load balancer and contains only the information to be updated. A +// load balancer can only be updated if its `provisioning_status` is `active`. +func (vpc *VpcV1) UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) } -// 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") +// UpdateLoadBalancerWithContext is an alternate form of the UpdateLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerOptions, "updateLoadBalancerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") + err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerPoolMembersOptions.LoadBalancerID, - "pool_id": *listLoadBalancerPoolMembersOptions.PoolID, + "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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { + for headerName, headerValue := range updateLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -24517,7 +24506,7 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) if err != nil { return } @@ -24527,63 +24516,53 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li return } -// CreateLoadBalancerPoolMember : Create a member in a load balancer pool -// This request creates a new member and adds the member to the pool. -func (vpc *VpcV1) CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) +// UpdateLoadBalancerListener : Update a load balancer listener +// This request updates a load balancer listener from a listener patch. +func (vpc *VpcV1) UpdateLoadBalancerListener(updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) } -// 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") +// UpdateLoadBalancerListenerWithContext is an alternate form of the UpdateLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, + "load_balancer_id": *updateLoadBalancerListenerOptions.LoadBalancerID, + "id": *updateLoadBalancerListenerOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createLoadBalancerPoolMemberOptions.Port != nil { - body["port"] = createLoadBalancerPoolMemberOptions.Port - } - if createLoadBalancerPoolMemberOptions.Target != nil { - body["target"] = createLoadBalancerPoolMemberOptions.Target - } - if createLoadBalancerPoolMemberOptions.Weight != nil { - body["weight"] = createLoadBalancerPoolMemberOptions.Weight - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) if err != nil { return } @@ -24599,7 +24578,7 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { return } @@ -24609,58 +24588,54 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c return } -// ReplaceLoadBalancerPoolMembers : Replace load balancer pool members -// This request replaces the existing members of the load balancer pool with new members created from the collection of -// member prototype objects. -func (vpc *VpcV1) ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - return vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) +// UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy +// Updates a policy from a policy patch. +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) } - -// 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") + +// UpdateLoadBalancerListenerPolicyWithContext is an alternate form of the UpdateLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Context, updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") + err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, - "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, + "load_balancer_id": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, + "id": *updateLoadBalancerListenerPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if replaceLoadBalancerPoolMembersOptions.Members != nil { - body["members"] = replaceLoadBalancerPoolMembersOptions.Members - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) if err != nil { return } @@ -24676,7 +24651,7 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { return } @@ -24686,107 +24661,131 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, return } -// DeleteLoadBalancerPoolMember : Delete a load balancer pool member -// This request deletes a member from the pool. This operation cannot be reversed. -func (vpc *VpcV1) DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) +// UpdateLoadBalancerListenerPolicyRule : Update a load balancer listener policy rule +// Updates a rule of the load balancer listener policy. +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) } -// 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") +// UpdateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the UpdateLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *deleteLoadBalancerPoolMemberOptions.PoolID, - "id": *deleteLoadBalancerPoolMemberOptions.ID, + "load_balancer_id": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *updateLoadBalancerListenerPolicyRuleOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + response.Result = result + } return } -// GetLoadBalancerPoolMember : Retrieve a load balancer pool member -// This request retrieves a single member specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) +// UpdateLoadBalancerPool : Update a load balancer pool +// This request updates a load balancer pool from a pool patch. +func (vpc *VpcV1) UpdateLoadBalancerPool(updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) } -// 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") +// UpdateLoadBalancerPoolWithContext is an alternate form of the UpdateLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *getLoadBalancerPoolMemberOptions.PoolID, - "id": *getLoadBalancerPoolMemberOptions.ID, + "load_balancer_id": *updateLoadBalancerPoolOptions.LoadBalancerID, + "id": *updateLoadBalancerPoolOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") + 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("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -24798,7 +24797,7 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { return } @@ -24881,33 +24880,44 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u return } -// ListEndpointGateways : List all endpoint gateways -// This request lists all endpoint gateways in the region. An endpoint gateway maps one or more reserved IPs in a VPC to -// a target outside the VPC. -func (vpc *VpcV1) ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { - return vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) +// AddEndpointGatewayIP : Bind a reserved IP to an endpoint gateway +// This request binds the specified reserved IP to the specified endpoint gateway. The reserved IP: +// +// - must currently be unbound, or not required by its target +// - must not be in the same zone as any other reserved IP bound to the endpoint gateway. +func (vpc *VpcV1) AddEndpointGatewayIP(addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) } -// ListEndpointGatewaysWithContext is an alternate form of the ListEndpointGateways method which supports a Context parameter -func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listEndpointGatewaysOptions, "listEndpointGatewaysOptions") +// AddEndpointGatewayIPWithContext is an alternate form of the AddEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, + "id": *addEndpointGatewayIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listEndpointGatewaysOptions.Headers { + for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24917,30 +24927,6 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listEndpointGatewaysOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listEndpointGatewaysOptions.Name)) - } - if listEndpointGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listEndpointGatewaysOptions.Start)) - } - if listEndpointGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewaysOptions.Limit)) - } - if listEndpointGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listEndpointGatewaysOptions.ResourceGroupID)) - } - if listEndpointGatewaysOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listEndpointGatewaysOptions.VPCID)) - } - if listEndpointGatewaysOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listEndpointGatewaysOptions.VPCCRN)) - } - if listEndpointGatewaysOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listEndpointGatewaysOptions.VPCName)) - } - if listEndpointGatewaysOptions.AllowDnsResolutionBinding != nil { - builder.AddQuery("allow_dns_resolution_binding", fmt.Sprint(*listEndpointGatewaysOptions.AllowDnsResolutionBinding)) - } request, err := builder.Build() if err != nil { @@ -24953,7 +24939,7 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { return } @@ -25053,119 +25039,100 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn return } -// ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway -// This request lists all reserved IPs bound to an endpoint gateway. -func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { - return vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) +// DeleteEndpointGateway : Delete an endpoint gateway +// This request deletes an endpoint gateway. This operation cannot be reversed. +// +// Reserved IPs that were bound to the endpoint gateway will be released if their +// `auto_delete` property is set to true. +func (vpc *VpcV1) DeleteEndpointGateway(deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) } -// ListEndpointGatewayIpsWithContext is an alternate form of the ListEndpointGatewayIps method which supports a Context parameter -func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions cannot be nil") +// DeleteEndpointGatewayWithContext is an alternate form of the DeleteEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") + err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") if err != nil { return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, + "id": *deleteEndpointGatewayOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { + for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listEndpointGatewayIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listEndpointGatewayIpsOptions.Start)) - } - if listEndpointGatewayIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewayIpsOptions.Limit)) - } - if listEndpointGatewayIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listEndpointGatewayIpsOptions.Sort)) - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// RemoveEndpointGatewayIP : Unbind a reserved IP from an endpoint gateway -// This request unbinds the specified reserved IP from the specified endpoint gateway. If the reserved IP has -// `auto_delete` set to `true`, the reserved IP will be deleted. -func (vpc *VpcV1) RemoveEndpointGatewayIP(removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) +// GetEndpointGateway : Retrieve an endpoint gateway +// This request retrieves a single endpoint gateway specified by the identifier in the URL. +func (vpc *VpcV1) GetEndpointGateway(getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + return vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) } -// RemoveEndpointGatewayIPWithContext is an alternate form of the RemoveEndpointGatewayIP method which supports a Context parameter -func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions cannot be nil") +// GetEndpointGatewayWithContext is an alternate form of the GetEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getEndpointGatewayOptions, "getEndpointGatewayOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") + err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") if err != nil { return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *removeEndpointGatewayIPOptions.EndpointGatewayID, - "id": *removeEndpointGatewayIPOptions.ID, + "id": *getEndpointGatewayOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { + for headerName, headerValue := range getEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -25177,7 +25144,18 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + } return } @@ -25248,44 +25226,40 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi return } -// AddEndpointGatewayIP : Bind a reserved IP to an endpoint gateway -// This request binds the specified reserved IP to the specified endpoint gateway. The reserved IP: -// -// - must currently be unbound, or not required by its target -// - must not be in the same zone as any other reserved IP bound to the endpoint gateway. -func (vpc *VpcV1) AddEndpointGatewayIP(addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) +// ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway +// This request lists all reserved IPs bound to an endpoint gateway. +func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { + return vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) } -// AddEndpointGatewayIPWithContext is an alternate form of the AddEndpointGatewayIP method which supports a Context parameter -func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions cannot be nil") +// ListEndpointGatewayIpsWithContext is an alternate form of the ListEndpointGatewayIps method which supports a Context parameter +func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") + err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, - "id": *addEndpointGatewayIPOptions.ID, + "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { + for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -25295,6 +25269,15 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listEndpointGatewayIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listEndpointGatewayIpsOptions.Start)) + } + if listEndpointGatewayIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewayIpsOptions.Limit)) + } + if listEndpointGatewayIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listEndpointGatewayIpsOptions.Sort)) + } request, err := builder.Build() if err != nil { @@ -25307,7 +25290,7 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext) if err != nil { return } @@ -25317,100 +25300,127 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi return } -// DeleteEndpointGateway : Delete an endpoint gateway -// This request deletes an endpoint gateway. This operation cannot be reversed. -// -// Reserved IPs that were bound to the endpoint gateway will be released if their -// `auto_delete` property is set to true. -func (vpc *VpcV1) DeleteEndpointGateway(deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) +// ListEndpointGateways : List all endpoint gateways +// This request lists all endpoint gateways in the region. An endpoint gateway maps one or more reserved IPs in a VPC to +// a target outside the VPC. +func (vpc *VpcV1) ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { + return vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) } -// DeleteEndpointGatewayWithContext is an alternate form of the DeleteEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") +// ListEndpointGatewaysWithContext is an alternate form of the ListEndpointGateways method which supports a Context parameter +func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listEndpointGatewaysOptions, "listEndpointGatewaysOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *deleteEndpointGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) if err != nil { return } - for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { + for headerName, headerValue := range listEndpointGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listEndpointGatewaysOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listEndpointGatewaysOptions.Name)) + } + if listEndpointGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listEndpointGatewaysOptions.Start)) + } + if listEndpointGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewaysOptions.Limit)) + } + if listEndpointGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listEndpointGatewaysOptions.ResourceGroupID)) + } + if listEndpointGatewaysOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listEndpointGatewaysOptions.VPCID)) + } + if listEndpointGatewaysOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listEndpointGatewaysOptions.VPCCRN)) + } + if listEndpointGatewaysOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listEndpointGatewaysOptions.VPCName)) + } + if listEndpointGatewaysOptions.AllowDnsResolutionBinding != nil { + builder.AddQuery("allow_dns_resolution_binding", fmt.Sprint(*listEndpointGatewaysOptions.AllowDnsResolutionBinding)) + } request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetEndpointGateway : Retrieve an endpoint gateway -// This request retrieves a single endpoint gateway specified by the identifier in the URL. -func (vpc *VpcV1) GetEndpointGateway(getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - return vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) +// RemoveEndpointGatewayIP : Unbind a reserved IP from an endpoint gateway +// This request unbinds the specified reserved IP from the specified endpoint gateway. If the reserved IP has +// `auto_delete` set to `true`, the reserved IP will be deleted. +func (vpc *VpcV1) RemoveEndpointGatewayIP(removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) } -// GetEndpointGatewayWithContext is an alternate form of the GetEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getEndpointGatewayOptions, "getEndpointGatewayOptions cannot be nil") +// RemoveEndpointGatewayIPWithContext is an alternate form of the RemoveEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") + err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getEndpointGatewayOptions.ID, + "endpoint_gateway_id": *removeEndpointGatewayIPOptions.EndpointGatewayID, + "id": *removeEndpointGatewayIPOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getEndpointGatewayOptions.Headers { + for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("future_version", fmt.Sprint("true")) @@ -25422,18 +25432,7 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } @@ -25509,91 +25508,6 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn return } -// ListFlowLogCollectors : List all flow log collectors -// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over the instance -// network interfaces and instance network attachments contained within its target. -func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { - return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) -} - -// ListFlowLogCollectorsWithContext is an alternate form of the ListFlowLogCollectors method which supports a Context parameter -func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listFlowLogCollectorsOptions, "listFlowLogCollectorsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listFlowLogCollectorsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("future_version", fmt.Sprint("true")) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listFlowLogCollectorsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listFlowLogCollectorsOptions.Start)) - } - if listFlowLogCollectorsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listFlowLogCollectorsOptions.Limit)) - } - if listFlowLogCollectorsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listFlowLogCollectorsOptions.ResourceGroupID)) - } - if listFlowLogCollectorsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listFlowLogCollectorsOptions.Name)) - } - if listFlowLogCollectorsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listFlowLogCollectorsOptions.VPCID)) - } - if listFlowLogCollectorsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listFlowLogCollectorsOptions.VPCCRN)) - } - if listFlowLogCollectorsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listFlowLogCollectorsOptions.VPCName)) - } - if listFlowLogCollectorsOptions.TargetID != nil { - builder.AddQuery("target.id", fmt.Sprint(*listFlowLogCollectorsOptions.TargetID)) - } - if listFlowLogCollectorsOptions.TargetResourceType != nil { - builder.AddQuery("target.resource_type", fmt.Sprint(*listFlowLogCollectorsOptions.TargetResourceType)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - // 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 @@ -25799,6 +25713,91 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog return } +// ListFlowLogCollectors : List all flow log collectors +// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over the instance +// network interfaces and instance network attachments contained within its target. +func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { + return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) +} + +// ListFlowLogCollectorsWithContext is an alternate form of the ListFlowLogCollectors method which supports a Context parameter +func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listFlowLogCollectorsOptions, "listFlowLogCollectorsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listFlowLogCollectorsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("future_version", fmt.Sprint("true")) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listFlowLogCollectorsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listFlowLogCollectorsOptions.Start)) + } + if listFlowLogCollectorsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listFlowLogCollectorsOptions.Limit)) + } + if listFlowLogCollectorsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listFlowLogCollectorsOptions.ResourceGroupID)) + } + if listFlowLogCollectorsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listFlowLogCollectorsOptions.Name)) + } + if listFlowLogCollectorsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listFlowLogCollectorsOptions.VPCID)) + } + if listFlowLogCollectorsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listFlowLogCollectorsOptions.VPCCRN)) + } + if listFlowLogCollectorsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listFlowLogCollectorsOptions.VPCName)) + } + if listFlowLogCollectorsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listFlowLogCollectorsOptions.TargetID)) + } + if listFlowLogCollectorsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listFlowLogCollectorsOptions.TargetResourceType)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + // UpdateFlowLogCollector : Update a flow log collector // This request updates a flow log collector with the information in a provided flow log collector patch. The flow log // collector patch object is structured in the same way as a retrieved flow log collector and contains only the @@ -69145,6 +69144,10 @@ type ShareMountTargetVirtualNetworkInterfacePrototype struct { // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) 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"` @@ -69197,6 +69200,10 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json if err != nil { return } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) if err != nil { return @@ -98047,6 +98054,10 @@ type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceProt // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) 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"` @@ -98086,6 +98097,10 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte if err != nil { return } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) if err != nil { return @@ -110041,25 +110056,25 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt return } -// VpcsPager can be used to simplify the use of the "ListVpcs" method. -type VpcsPager struct { +// VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. +type VPCAddressPrefixesPager struct { hasNext bool - options *ListVpcsOptions + options *ListVPCAddressPrefixesOptions client *VpcV1 pageContext struct { next *string } } -// NewVpcsPager returns a new VpcsPager instance. -func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, err error) { +// NewVPCAddressPrefixesPager returns a new VPCAddressPrefixesPager instance. +func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOptions) (pager *VPCAddressPrefixesPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListVpcsOptions = *options - pager = &VpcsPager{ + var optionsCopy ListVPCAddressPrefixesOptions = *options + pager = &VPCAddressPrefixesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -110068,19 +110083,19 @@ func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, err } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VpcsPager) HasNext() bool { +func (pager *VPCAddressPrefixesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err error) { +func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (page []AddressPrefix, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVpcsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCAddressPrefixesWithContext(ctx, pager.options) if err != nil { return } @@ -110097,16 +110112,16 @@ func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Vpcs + page = result.AddressPrefixes return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, err error) { +func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (allItems []AddressPrefix, err error) { for pager.HasNext() { - var nextPage []VPC + var nextPage []AddressPrefix nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -110117,34 +110132,34 @@ func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VpcsPager) GetNext() (page []VPC, err error) { +func (pager *VPCAddressPrefixesPager) GetNext() (page []AddressPrefix, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VpcsPager) GetAll() (allItems []VPC, err error) { +func (pager *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err error) { return pager.GetAllWithContext(context.Background()) } -// VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. -type VPCAddressPrefixesPager struct { +// VPCDnsResolutionBindingsPager can be used to simplify the use of the "ListVPCDnsResolutionBindings" method. +type VPCDnsResolutionBindingsPager struct { hasNext bool - options *ListVPCAddressPrefixesOptions + options *ListVPCDnsResolutionBindingsOptions client *VpcV1 pageContext struct { next *string } } -// NewVPCAddressPrefixesPager returns a new VPCAddressPrefixesPager instance. -func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOptions) (pager *VPCAddressPrefixesPager, err error) { +// NewVPCDnsResolutionBindingsPager returns a new VPCDnsResolutionBindingsPager instance. +func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolutionBindingsOptions) (pager *VPCDnsResolutionBindingsPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListVPCAddressPrefixesOptions = *options - pager = &VPCAddressPrefixesPager{ + var optionsCopy ListVPCDnsResolutionBindingsOptions = *options + pager = &VPCDnsResolutionBindingsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -110153,19 +110168,19 @@ func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOpti } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCAddressPrefixesPager) HasNext() bool { +func (pager *VPCDnsResolutionBindingsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (page []AddressPrefix, err error) { +func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Context) (page []VpcdnsResolutionBinding, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPCAddressPrefixesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCDnsResolutionBindingsWithContext(ctx, pager.options) if err != nil { return } @@ -110182,16 +110197,16 @@ func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (p } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.AddressPrefixes + page = result.DnsResolutionBindings return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (allItems []AddressPrefix, err error) { +func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Context) (allItems []VpcdnsResolutionBinding, err error) { for pager.HasNext() { - var nextPage []AddressPrefix + var nextPage []VpcdnsResolutionBinding nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -110202,34 +110217,34 @@ func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (al } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCAddressPrefixesPager) GetNext() (page []AddressPrefix, err error) { +func (pager *VPCDnsResolutionBindingsPager) GetNext() (page []VpcdnsResolutionBinding, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err error) { +func (pager *VPCDnsResolutionBindingsPager) GetAll() (allItems []VpcdnsResolutionBinding, err error) { return pager.GetAllWithContext(context.Background()) } -// VPCDnsResolutionBindingsPager can be used to simplify the use of the "ListVPCDnsResolutionBindings" method. -type VPCDnsResolutionBindingsPager struct { +// VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. +type VPCRoutesPager struct { hasNext bool - options *ListVPCDnsResolutionBindingsOptions + options *ListVPCRoutesOptions client *VpcV1 pageContext struct { next *string } } -// NewVPCDnsResolutionBindingsPager returns a new VPCDnsResolutionBindingsPager instance. -func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolutionBindingsOptions) (pager *VPCDnsResolutionBindingsPager, err error) { +// NewVPCRoutesPager returns a new VPCRoutesPager instance. +func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRoutesPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListVPCDnsResolutionBindingsOptions = *options - pager = &VPCDnsResolutionBindingsPager{ + var optionsCopy ListVPCRoutesOptions = *options + pager = &VPCRoutesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -110238,19 +110253,19 @@ func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolution } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCDnsResolutionBindingsPager) HasNext() bool { +func (pager *VPCRoutesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Context) (page []VpcdnsResolutionBinding, err error) { +func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []RouteCollectionVPCContextRoutesItem, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPCDnsResolutionBindingsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCRoutesWithContext(ctx, pager.options) if err != nil { return } @@ -110267,16 +110282,16 @@ func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.DnsResolutionBindings + page = result.Routes return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Context) (allItems []VpcdnsResolutionBinding, err error) { +func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems []RouteCollectionVPCContextRoutesItem, err error) { for pager.HasNext() { - var nextPage []VpcdnsResolutionBinding + var nextPage []RouteCollectionVPCContextRoutesItem nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -110287,34 +110302,34 @@ func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Contex } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCDnsResolutionBindingsPager) GetNext() (page []VpcdnsResolutionBinding, err error) { +func (pager *VPCRoutesPager) GetNext() (page []RouteCollectionVPCContextRoutesItem, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPCDnsResolutionBindingsPager) GetAll() (allItems []VpcdnsResolutionBinding, err error) { +func (pager *VPCRoutesPager) GetAll() (allItems []RouteCollectionVPCContextRoutesItem, err error) { return pager.GetAllWithContext(context.Background()) } -// VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. -type VPCRoutesPager struct { +// VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. +type VPCRoutingTableRoutesPager struct { hasNext bool - options *ListVPCRoutesOptions + options *ListVPCRoutingTableRoutesOptions client *VpcV1 pageContext struct { next *string } } -// NewVPCRoutesPager returns a new VPCRoutesPager instance. -func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRoutesPager, err error) { +// NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. +func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListVPCRoutesOptions = *options - pager = &VPCRoutesPager{ + var optionsCopy ListVPCRoutingTableRoutesOptions = *options + pager = &VPCRoutingTableRoutesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -110323,19 +110338,19 @@ func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRo } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCRoutesPager) HasNext() bool { +func (pager *VPCRoutingTableRoutesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []RouteCollectionVPCContextRoutesItem, err error) { +func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) (page []Route, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPCRoutesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(ctx, pager.options) if err != nil { return } @@ -110359,9 +110374,9 @@ func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []Rou // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems []RouteCollectionVPCContextRoutesItem, err error) { +func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { for pager.HasNext() { - var nextPage []RouteCollectionVPCContextRoutesItem + var nextPage []Route nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -110372,12 +110387,12 @@ func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems [] } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutesPager) GetNext() (page []RouteCollectionVPCContextRoutesItem, err error) { +func (pager *VPCRoutingTableRoutesPager) GetNext() (page []Route, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutesPager) GetAll() (allItems []RouteCollectionVPCContextRoutesItem, err error) { +func (pager *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { return pager.GetAllWithContext(context.Background()) } @@ -110466,25 +110481,25 @@ func (pager *VPCRoutingTablesPager) GetAll() (allItems []RoutingTable, err error return pager.GetAllWithContext(context.Background()) } -// VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. -type VPCRoutingTableRoutesPager struct { +// VpcsPager can be used to simplify the use of the "ListVpcs" method. +type VpcsPager struct { hasNext bool - options *ListVPCRoutingTableRoutesOptions + options *ListVpcsOptions client *VpcV1 pageContext struct { next *string } } -// NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. -func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, err error) { +// NewVpcsPager returns a new VpcsPager instance. +func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListVPCRoutingTableRoutesOptions = *options - pager = &VPCRoutingTableRoutesPager{ + var optionsCopy ListVpcsOptions = *options + pager = &VpcsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -110493,19 +110508,19 @@ func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRout } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCRoutingTableRoutesPager) HasNext() bool { +func (pager *VpcsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) (page []Route, err error) { +func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVpcsWithContext(ctx, pager.options) if err != nil { return } @@ -110522,16 +110537,16 @@ func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Routes + page = result.Vpcs return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { +func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, err error) { for pager.HasNext() { - var nextPage []Route + var nextPage []VPC nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -110542,12 +110557,97 @@ func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutingTableRoutesPager) GetNext() (page []Route, err error) { +func (pager *VpcsPager) GetNext() (page []VPC, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { +func (pager *VpcsPager) GetAll() (allItems []VPC, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. +type SubnetReservedIpsPager struct { + hasNext bool + options *ListSubnetReservedIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. +func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSubnetReservedIpsOptions = *options + pager = &SubnetReservedIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SubnetReservedIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSubnetReservedIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.ReservedIps + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { + for pager.HasNext() { + var nextPage []ReservedIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SubnetReservedIpsPager) GetNext() (page []ReservedIP, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { return pager.GetAllWithContext(context.Background()) } @@ -110636,91 +110736,6 @@ func (pager *SubnetsPager) GetAll() (allItems []Subnet, err error) { return pager.GetAllWithContext(context.Background()) } -// SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. -type SubnetReservedIpsPager struct { - hasNext bool - options *ListSubnetReservedIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. -func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListSubnetReservedIpsOptions = *options - pager = &SubnetReservedIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SubnetReservedIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSubnetReservedIpsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.ReservedIps - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { - for pager.HasNext() { - var nextPage []ReservedIP - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SubnetReservedIpsPager) GetNext() (page []ReservedIP, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { - return pager.GetAllWithContext(context.Background()) -} - // ImagesPager can be used to simplify the use of the "ListImages" method. type ImagesPager struct { hasNext bool @@ -110976,91 +110991,6 @@ func (pager *KeysPager) GetAll() (allItems []Key, err error) { return pager.GetAllWithContext(context.Background()) } -// InstancesPager can be used to simplify the use of the "ListInstances" method. -type InstancesPager struct { - hasNext bool - options *ListInstancesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstancesPager returns a new InstancesPager instance. -func (vpc *VpcV1) NewInstancesPager(options *ListInstancesOptions) (pager *InstancesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListInstancesOptions = *options - pager = &InstancesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstancesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstancesPager) GetNextWithContext(ctx context.Context) (page []Instance, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstancesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Instances - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstancesPager) GetAllWithContext(ctx context.Context) (allItems []Instance, err error) { - for pager.HasNext() { - var nextPage []Instance - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstancesPager) GetNext() (page []Instance, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *InstancesPager) GetAll() (allItems []Instance, err error) { - return pager.GetAllWithContext(context.Background()) -} - // InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "ListInstanceNetworkInterfaceIps" method. type InstanceNetworkInterfaceIpsPager struct { hasNext bool @@ -111146,25 +111076,25 @@ func (pager *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, return pager.GetAllWithContext(context.Background()) } -// InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. -type InstanceGroupsPager struct { +// InstancesPager can be used to simplify the use of the "ListInstances" method. +type InstancesPager struct { hasNext bool - options *ListInstanceGroupsOptions + options *ListInstancesOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupsPager returns a new InstanceGroupsPager instance. -func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, 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 = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListInstanceGroupsOptions = *options - pager = &InstanceGroupsPager{ + var optionsCopy ListInstancesOptions = *options + pager = &InstancesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -111173,19 +111103,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 *InstancesPager) 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 *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.ListInstanceGroupsWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstancesWithContext(ctx, pager.options) if err != nil { return } @@ -111202,16 +111132,16 @@ func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.InstanceGroups + page = result.Instances 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 *InstancesPager) GetAllWithContext(ctx context.Context) (allItems []Instance, err error) { for pager.HasNext() { - var nextPage []InstanceGroup + var nextPage []Instance nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -111222,34 +111152,34 @@ 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 *InstancesPager) GetNext() (page []Instance, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { +func (pager *InstancesPager) GetAll() (allItems []Instance, err error) { return pager.GetAllWithContext(context.Background()) } -// InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. -type InstanceGroupManagersPager struct { +// InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. +type InstanceGroupManagerActionsPager struct { hasNext bool - options *ListInstanceGroupManagersOptions + options *ListInstanceGroupManagerActionsOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupManagersPager returns a new InstanceGroupManagersPager instance. -func (vpc *VpcV1) NewInstanceGroupManagersPager(options *ListInstanceGroupManagersOptions) (pager *InstanceGroupManagersPager, err error) { +// NewInstanceGroupManagerActionsPager returns a new InstanceGroupManagerActionsPager instance. +func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroupManagerActionsOptions) (pager *InstanceGroupManagerActionsPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListInstanceGroupManagersOptions = *options - pager = &InstanceGroupManagersPager{ + var optionsCopy ListInstanceGroupManagerActionsOptions = *options + pager = &InstanceGroupManagerActionsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -111258,19 +111188,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 *InstanceGroupManagerActionsPager) 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 *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.ListInstanceGroupManagersWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupManagerActionsWithContext(ctx, pager.options) if err != nil { return } @@ -111287,16 +111217,16 @@ func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Managers + page = result.Actions 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 *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerActionIntf, err error) { for pager.HasNext() { - var nextPage []InstanceGroupManagerIntf + var nextPage []InstanceGroupManagerActionIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -111307,34 +111237,34 @@ 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 *InstanceGroupManagerActionsPager) GetNext() (page []InstanceGroupManagerActionIntf, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManagerIntf, err error) { +func (pager *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGroupManagerActionIntf, err error) { return pager.GetAllWithContext(context.Background()) } -// InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. -type InstanceGroupManagerActionsPager struct { +// InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. +type InstanceGroupManagerPoliciesPager struct { hasNext bool - options *ListInstanceGroupManagerActionsOptions + options *ListInstanceGroupManagerPoliciesOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupManagerActionsPager returns a new InstanceGroupManagerActionsPager instance. -func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroupManagerActionsOptions) (pager *InstanceGroupManagerActionsPager, err error) { +// NewInstanceGroupManagerPoliciesPager returns a new InstanceGroupManagerPoliciesPager instance. +func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGroupManagerPoliciesOptions) (pager *InstanceGroupManagerPoliciesPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListInstanceGroupManagerActionsOptions = *options - pager = &InstanceGroupManagerActionsPager{ + var optionsCopy ListInstanceGroupManagerPoliciesOptions = *options + pager = &InstanceGroupManagerPoliciesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -111343,19 +111273,19 @@ func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroup } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupManagerActionsPager) HasNext() bool { +func (pager *InstanceGroupManagerPoliciesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerActionIntf, err error) { +func (pager *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.ListInstanceGroupManagerActionsWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupManagerPoliciesWithContext(ctx, pager.options) if err != nil { return } @@ -111372,16 +111302,16 @@ func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Co } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Actions + page = result.Policies return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerActionIntf, err error) { +func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerPolicyIntf, err error) { for pager.HasNext() { - var nextPage []InstanceGroupManagerActionIntf + var nextPage []InstanceGroupManagerPolicyIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -111392,34 +111322,34 @@ func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Con } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagerActionsPager) GetNext() (page []InstanceGroupManagerActionIntf, err error) { +func (pager *InstanceGroupManagerPoliciesPager) GetNext() (page []InstanceGroupManagerPolicyIntf, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGroupManagerActionIntf, err error) { +func (pager *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGroupManagerPolicyIntf, err error) { return pager.GetAllWithContext(context.Background()) } -// InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. -type InstanceGroupManagerPoliciesPager struct { +// InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. +type InstanceGroupManagersPager struct { hasNext bool - options *ListInstanceGroupManagerPoliciesOptions + options *ListInstanceGroupManagersOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupManagerPoliciesPager returns a new InstanceGroupManagerPoliciesPager instance. -func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGroupManagerPoliciesOptions) (pager *InstanceGroupManagerPoliciesPager, 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 = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListInstanceGroupManagerPoliciesOptions = *options - pager = &InstanceGroupManagerPoliciesPager{ + var optionsCopy ListInstanceGroupManagersOptions = *options + pager = &InstanceGroupManagersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -111428,19 +111358,19 @@ func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGrou } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupManagerPoliciesPager) HasNext() bool { +func (pager *InstanceGroupManagersPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerPolicyIntf, err error) { +func (pager *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.ListInstanceGroupManagerPoliciesWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupManagersWithContext(ctx, pager.options) if err != nil { return } @@ -111457,16 +111387,16 @@ func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.C } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Policies + page = result.Managers return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerPolicyIntf, err error) { +func (pager *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerIntf, err error) { for pager.HasNext() { - var nextPage []InstanceGroupManagerPolicyIntf + var nextPage []InstanceGroupManagerIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -111477,12 +111407,12 @@ func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Co } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagerPoliciesPager) GetNext() (page []InstanceGroupManagerPolicyIntf, err error) { +func (pager *InstanceGroupManagersPager) GetNext() (page []InstanceGroupManagerIntf, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGroupManagerPolicyIntf, err error) { +func (pager *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManagerIntf, err error) { return pager.GetAllWithContext(context.Background()) } @@ -111571,6 +111501,91 @@ func (pager *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMe return pager.GetAllWithContext(context.Background()) } +// InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. +type InstanceGroupsPager struct { + hasNext bool + options *ListInstanceGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupsPager returns a new InstanceGroupsPager instance. +func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupsOptions = *options + pager = &InstanceGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.InstanceGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroup, err error) { + for pager.HasNext() { + var nextPage []InstanceGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupsPager) GetNext() (page []InstanceGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + // DedicatedHostGroupsPager can be used to simplify the use of the "ListDedicatedHostGroups" method. type DedicatedHostGroupsPager struct { hasNext bool @@ -112081,25 +112096,25 @@ func (pager *PlacementGroupsPager) GetAll() (allItems []PlacementGroup, err erro return pager.GetAllWithContext(context.Background()) } -// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. -type BareMetalServerProfilesPager struct { +// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. +type BareMetalServerNetworkAttachmentsPager struct { hasNext bool - options *ListBareMetalServerProfilesOptions + options *ListBareMetalServerNetworkAttachmentsOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. -func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, err error) { +// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListBareMetalServerProfilesOptions = *options - pager = &BareMetalServerProfilesPager{ + var optionsCopy ListBareMetalServerNetworkAttachmentsOptions = *options + pager = &BareMetalServerNetworkAttachmentsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -112108,19 +112123,19 @@ func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerPr } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerProfilesPager) HasNext() bool { +func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfile, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) if err != nil { return } @@ -112137,16 +112152,16 @@ func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Contex } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles + page = result.NetworkAttachments return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { for pager.HasNext() { - var nextPage []BareMetalServerProfile + var nextPage []BareMetalServerNetworkAttachmentIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -112157,34 +112172,34 @@ func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { return pager.GetAllWithContext(context.Background()) } -// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. -type BareMetalServersPager struct { +// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. +type BareMetalServerNetworkInterfacesPager struct { hasNext bool - options *ListBareMetalServersOptions + options *ListBareMetalServerNetworkInterfacesOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServersPager returns a new BareMetalServersPager instance. -func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, err error) { +// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListBareMetalServersOptions = *options - pager = &BareMetalServersPager{ + var optionsCopy ListBareMetalServerNetworkInterfacesOptions = *options + pager = &BareMetalServerNetworkInterfacesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -112193,19 +112208,19 @@ func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServersPager) HasNext() bool { +func (pager *BareMetalServerNetworkInterfacesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (page []BareMetalServer, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkInterfaceIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) if err != nil { return } @@ -112222,16 +112237,16 @@ func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.BareMetalServers + page = result.NetworkInterfaces return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { for pager.HasNext() { - var nextPage []BareMetalServer + var nextPage []BareMetalServerNetworkInterfaceIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -112242,34 +112257,34 @@ func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allI } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServersPager) GetNext() (page []BareMetalServer, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { return pager.GetAllWithContext(context.Background()) } -// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. -type BareMetalServerNetworkAttachmentsPager struct { +// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. +type BareMetalServerProfilesPager struct { hasNext bool - options *ListBareMetalServerNetworkAttachmentsOptions + options *ListBareMetalServerProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, err error) { +// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. +func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListBareMetalServerNetworkAttachmentsOptions = *options - pager = &BareMetalServerNetworkAttachmentsPager{ + var optionsCopy ListBareMetalServerProfilesOptions = *options + pager = &BareMetalServerProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -112278,19 +112293,19 @@ func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMet } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { +func (pager *BareMetalServerProfilesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfile, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) if err != nil { return } @@ -112307,16 +112322,16 @@ func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx cont } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkAttachments + page = result.Profiles return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { for pager.HasNext() { - var nextPage []BareMetalServerNetworkAttachmentIntf + var nextPage []BareMetalServerProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -112327,34 +112342,34 @@ func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx conte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { return pager.GetAllWithContext(context.Background()) } -// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. -type BareMetalServerNetworkInterfacesPager struct { +// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. +type BareMetalServersPager struct { hasNext bool - options *ListBareMetalServerNetworkInterfacesOptions + options *ListBareMetalServersOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, err error) { +// NewBareMetalServersPager returns a new BareMetalServersPager instance. +func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListBareMetalServerNetworkInterfacesOptions = *options - pager = &BareMetalServerNetworkInterfacesPager{ + var optionsCopy ListBareMetalServersOptions = *options + pager = &BareMetalServersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -112363,19 +112378,19 @@ func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMeta } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerNetworkInterfacesPager) HasNext() bool { +func (pager *BareMetalServersPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (page []BareMetalServer, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) if err != nil { return } @@ -112392,16 +112407,16 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkInterfaces + page = result.BareMetalServers return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { for pager.HasNext() { - var nextPage []BareMetalServerNetworkInterfaceIntf + var nextPage []BareMetalServer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -112412,12 +112427,12 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx contex } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetNext() (page []BareMetalServer, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { return pager.GetAllWithContext(context.Background()) } @@ -112676,6 +112691,91 @@ func (pager *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { return pager.GetAllWithContext(context.Background()) } +// ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. +type ShareMountTargetsPager struct { + hasNext bool + options *ListShareMountTargetsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewShareMountTargetsPager returns a new ShareMountTargetsPager instance. +func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOptions) (pager *ShareMountTargetsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListShareMountTargetsOptions = *options + pager = &ShareMountTargetsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ShareMountTargetsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (page []ShareMountTarget, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListShareMountTargetsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.MountTargets + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (allItems []ShareMountTarget, err error) { + for pager.HasNext() { + var nextPage []ShareMountTarget + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ShareMountTargetsPager) GetNext() (page []ShareMountTarget, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err error) { + return pager.GetAllWithContext(context.Background()) +} + // ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. type ShareProfilesPager struct { hasNext bool @@ -112846,176 +112946,6 @@ func (pager *SharesPager) GetAll() (allItems []Share, err error) { return pager.GetAllWithContext(context.Background()) } -// ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. -type ShareMountTargetsPager struct { - hasNext bool - options *ListShareMountTargetsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewShareMountTargetsPager returns a new ShareMountTargetsPager instance. -func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOptions) (pager *ShareMountTargetsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListShareMountTargetsOptions = *options - pager = &ShareMountTargetsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *ShareMountTargetsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (page []ShareMountTarget, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListShareMountTargetsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.MountTargets - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (allItems []ShareMountTarget, err error) { - for pager.HasNext() { - var nextPage []ShareMountTarget - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ShareMountTargetsPager) GetNext() (page []ShareMountTarget, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. -type VirtualNetworkInterfacesPager struct { - hasNext bool - options *ListVirtualNetworkInterfacesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. -func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVirtualNetworkInterfacesOptions = *options - pager = &VirtualNetworkInterfacesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VirtualNetworkInterfacesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []VirtualNetworkInterface, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.VirtualNetworkInterfaces - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []VirtualNetworkInterface, err error) { - for pager.HasNext() { - var nextPage []VirtualNetworkInterface - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { - return pager.GetAllWithContext(context.Background()) -} - // NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. type NetworkInterfaceFloatingIpsPager struct { hasNext bool @@ -113186,25 +113116,25 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPRef return pager.GetAllWithContext(context.Background()) } -// 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 = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListPublicGatewaysOptions = *options - pager = &PublicGatewaysPager{ + var optionsCopy ListVirtualNetworkInterfacesOptions = *options + pager = &VirtualNetworkInterfacesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -113213,19 +113143,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 { return } @@ -113242,16 +113172,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 { return @@ -113262,34 +113192,34 @@ 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) { return pager.GetNextWithContext(context.Background()) } // 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) { return pager.GetAllWithContext(context.Background()) } -// FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. -type FloatingIpsPager struct { +// PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. +type PublicGatewaysPager struct { hasNext bool - options *ListFloatingIpsOptions + options *ListPublicGatewaysOptions client *VpcV1 pageContext struct { next *string } } -// NewFloatingIpsPager returns a new FloatingIpsPager instance. -func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, err error) { +// NewPublicGatewaysPager returns a new PublicGatewaysPager instance. +func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pager *PublicGatewaysPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListFloatingIpsOptions = *options - pager = &FloatingIpsPager{ + var optionsCopy ListPublicGatewaysOptions = *options + pager = &PublicGatewaysPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -113298,19 +113228,19 @@ func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *F } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *FloatingIpsPager) HasNext() bool { +func (pager *PublicGatewaysPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIP, err error) { +func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page []PublicGateway, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListFloatingIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListPublicGatewaysWithContext(ctx, pager.options) if err != nil { return } @@ -113327,16 +113257,16 @@ func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []F } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.FloatingIps + page = result.PublicGateways return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIP, err error) { +func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []PublicGateway, err error) { for pager.HasNext() { - var nextPage []FloatingIP + var nextPage []PublicGateway nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -113347,34 +113277,34 @@ func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *FloatingIpsPager) GetNext() (page []FloatingIP, err error) { +func (pager *PublicGatewaysPager) GetNext() (page []PublicGateway, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { +func (pager *PublicGatewaysPager) GetAll() (allItems []PublicGateway, err error) { return pager.GetAllWithContext(context.Background()) } -// NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. -type NetworkAclsPager struct { +// FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. +type FloatingIpsPager struct { hasNext bool - options *ListNetworkAclsOptions + options *ListFloatingIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewNetworkAclsPager returns a new NetworkAclsPager instance. -func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *NetworkAclsPager, err error) { +// NewFloatingIpsPager returns a new FloatingIpsPager instance. +func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListNetworkAclsOptions = *options - pager = &NetworkAclsPager{ + var optionsCopy ListFloatingIpsOptions = *options + pager = &FloatingIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -113383,19 +113313,19 @@ func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *N } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *NetworkAclsPager) HasNext() bool { +func (pager *FloatingIpsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []NetworkACL, err error) { +func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIP, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListNetworkAclsWithContext(ctx, pager.options) + result, _, err := pager.client.ListFloatingIpsWithContext(ctx, pager.options) if err != nil { return } @@ -113412,16 +113342,16 @@ func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []N } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkAcls + page = result.FloatingIps return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACL, err error) { +func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIP, err error) { for pager.HasNext() { - var nextPage []NetworkACL + var nextPage []FloatingIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -113432,12 +113362,12 @@ func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *NetworkAclsPager) GetNext() (page []NetworkACL, err error) { +func (pager *FloatingIpsPager) GetNext() (page []FloatingIP, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { +func (pager *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { return pager.GetAllWithContext(context.Background()) } @@ -113526,25 +113456,25 @@ func (pager *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, return pager.GetAllWithContext(context.Background()) } -// SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. -type SecurityGroupsPager struct { +// NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. +type NetworkAclsPager struct { hasNext bool - options *ListSecurityGroupsOptions + options *ListNetworkAclsOptions client *VpcV1 pageContext struct { next *string } } -// NewSecurityGroupsPager returns a new SecurityGroupsPager instance. -func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, err error) { +// NewNetworkAclsPager returns a new NetworkAclsPager instance. +func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *NetworkAclsPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListSecurityGroupsOptions = *options - pager = &SecurityGroupsPager{ + var optionsCopy ListNetworkAclsOptions = *options + pager = &NetworkAclsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -113553,19 +113483,19 @@ func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *SecurityGroupsPager) HasNext() bool { +func (pager *NetworkAclsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroup, err error) { +func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []NetworkACL, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListSecurityGroupsWithContext(ctx, pager.options) + result, _, err := pager.client.ListNetworkAclsWithContext(ctx, pager.options) if err != nil { return } @@ -113582,16 +113512,16 @@ func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.SecurityGroups + page = result.NetworkAcls return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroup, err error) { +func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACL, err error) { for pager.HasNext() { - var nextPage []SecurityGroup + var nextPage []NetworkACL nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -113602,12 +113532,12 @@ func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allIte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SecurityGroupsPager) GetNext() (page []SecurityGroup, err error) { +func (pager *NetworkAclsPager) GetNext() (page []NetworkACL, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { +func (pager *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { return pager.GetAllWithContext(context.Background()) } @@ -113696,6 +113626,91 @@ func (pager *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTarget return pager.GetAllWithContext(context.Background()) } +// SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. +type SecurityGroupsPager struct { + hasNext bool + options *ListSecurityGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSecurityGroupsPager returns a new SecurityGroupsPager instance. +func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSecurityGroupsOptions = *options + pager = &SecurityGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SecurityGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSecurityGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.SecurityGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroup, err error) { + for pager.HasNext() { + var nextPage []SecurityGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupsPager) GetNext() (page []SecurityGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + // IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. type IkePoliciesPager struct { hasNext bool @@ -113951,25 +113966,25 @@ func (pager *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { return pager.GetAllWithContext(context.Background()) } -// VPNServersPager can be used to simplify the use of the "ListVPNServers" method. -type VPNServersPager struct { +// VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. +type VPNServerClientsPager struct { hasNext bool - options *ListVPNServersOptions + options *ListVPNServerClientsOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNServersPager returns a new VPNServersPager instance. -func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, err error) { +// NewVPNServerClientsPager returns a new VPNServerClientsPager instance. +func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListVPNServersOptions = *options - pager = &VPNServersPager{ + var optionsCopy ListVPNServerClientsOptions = *options + pager = &VPNServerClientsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -113978,19 +113993,19 @@ func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPN } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServersPager) HasNext() bool { +func (pager *VPNServerClientsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VPNServer, err error) { +func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (page []VPNServerClient, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNServersWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNServerClientsWithContext(ctx, pager.options) if err != nil { return } @@ -114007,16 +114022,16 @@ func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VP } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.VPNServers + page = result.Clients return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems []VPNServer, err error) { +func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerClient, err error) { for pager.HasNext() { - var nextPage []VPNServer + var nextPage []VPNServerClient nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -114027,34 +114042,34 @@ func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems [ } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNServersPager) GetNext() (page []VPNServer, err error) { +func (pager *VPNServerClientsPager) GetNext() (page []VPNServerClient, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPNServersPager) GetAll() (allItems []VPNServer, err error) { +func (pager *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { return pager.GetAllWithContext(context.Background()) } -// VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. -type VPNServerClientsPager struct { +// VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. +type VPNServerRoutesPager struct { hasNext bool - options *ListVPNServerClientsOptions + options *ListVPNServerRoutesOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNServerClientsPager returns a new VPNServerClientsPager instance. -func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, err error) { +// NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. +func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListVPNServerClientsOptions = *options - pager = &VPNServerClientsPager{ + var optionsCopy ListVPNServerRoutesOptions = *options + pager = &VPNServerRoutesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -114063,19 +114078,19 @@ func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServerClientsPager) HasNext() bool { +func (pager *VPNServerRoutesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (page []VPNServerClient, err error) { +func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page []VPNServerRoute, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNServerClientsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNServerRoutesWithContext(ctx, pager.options) if err != nil { return } @@ -114092,16 +114107,16 @@ func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Clients + page = result.Routes return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerClient, err error) { +func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerRoute, err error) { for pager.HasNext() { - var nextPage []VPNServerClient + var nextPage []VPNServerRoute nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -114112,34 +114127,34 @@ func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allI } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNServerClientsPager) GetNext() (page []VPNServerClient, err error) { +func (pager *VPNServerRoutesPager) GetNext() (page []VPNServerRoute, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { +func (pager *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { return pager.GetAllWithContext(context.Background()) } -// VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. -type VPNServerRoutesPager struct { +// VPNServersPager can be used to simplify the use of the "ListVPNServers" method. +type VPNServersPager struct { hasNext bool - options *ListVPNServerRoutesOptions + options *ListVPNServersOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. -func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, err error) { +// NewVPNServersPager returns a new VPNServersPager instance. +func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListVPNServerRoutesOptions = *options - pager = &VPNServerRoutesPager{ + var optionsCopy ListVPNServersOptions = *options + pager = &VPNServersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -114148,19 +114163,19 @@ func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) ( } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServerRoutesPager) HasNext() bool { +func (pager *VPNServersPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page []VPNServerRoute, err error) { +func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VPNServer, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNServerRoutesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNServersWithContext(ctx, pager.options) if err != nil { return } @@ -114177,16 +114192,16 @@ func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Routes + page = result.VPNServers return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerRoute, err error) { +func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems []VPNServer, err error) { for pager.HasNext() { - var nextPage []VPNServerRoute + var nextPage []VPNServer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -114197,12 +114212,12 @@ func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allIt } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNServerRoutesPager) GetNext() (page []VPNServerRoute, err error) { +func (pager *VPNServersPager) GetNext() (page []VPNServer, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { +func (pager *VPNServersPager) GetAll() (allItems []VPNServer, err error) { return pager.GetAllWithContext(context.Background()) } @@ -114376,25 +114391,25 @@ func (pager *LoadBalancersPager) GetAll() (allItems []LoadBalancer, err error) { return pager.GetAllWithContext(context.Background()) } -// EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. -type EndpointGatewaysPager struct { +// EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. +type EndpointGatewayIpsPager struct { hasNext bool - options *ListEndpointGatewaysOptions + options *ListEndpointGatewayIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. -func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, err error) { +// NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. +func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListEndpointGatewaysOptions = *options - pager = &EndpointGatewaysPager{ + var optionsCopy ListEndpointGatewayIpsOptions = *options + pager = &EndpointGatewayIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -114403,19 +114418,19 @@ func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *EndpointGatewaysPager) HasNext() bool { +func (pager *EndpointGatewayIpsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (page []EndpointGateway, err error) { +func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListEndpointGatewaysWithContext(ctx, pager.options) + result, _, err := pager.client.ListEndpointGatewayIpsWithContext(ctx, pager.options) if err != nil { return } @@ -114432,16 +114447,16 @@ func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.EndpointGateways + page = result.Ips return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []EndpointGateway, err error) { +func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { for pager.HasNext() { - var nextPage []EndpointGateway + var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -114452,34 +114467,34 @@ func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allI } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *EndpointGatewaysPager) GetNext() (page []EndpointGateway, err error) { +func (pager *EndpointGatewayIpsPager) GetNext() (page []ReservedIP, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { +func (pager *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { return pager.GetAllWithContext(context.Background()) } -// EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. -type EndpointGatewayIpsPager struct { +// EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. +type EndpointGatewaysPager struct { hasNext bool - options *ListEndpointGatewayIpsOptions + options *ListEndpointGatewaysOptions client *VpcV1 pageContext struct { next *string } } -// NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. -func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, err error) { +// NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. +func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, err error) { if options.Start != nil && *options.Start != "" { err = fmt.Errorf("the 'options.Start' field should not be set") return } - var optionsCopy ListEndpointGatewayIpsOptions = *options - pager = &EndpointGatewayIpsPager{ + var optionsCopy ListEndpointGatewaysOptions = *options + pager = &EndpointGatewaysPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -114488,19 +114503,19 @@ func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOpti } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *EndpointGatewayIpsPager) HasNext() bool { +func (pager *EndpointGatewaysPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { +func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (page []EndpointGateway, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListEndpointGatewayIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListEndpointGatewaysWithContext(ctx, pager.options) if err != nil { return } @@ -114517,16 +114532,16 @@ func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (p } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Ips + page = result.EndpointGateways return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { +func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []EndpointGateway, err error) { for pager.HasNext() { - var nextPage []ReservedIP + var nextPage []EndpointGateway nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -114537,12 +114552,12 @@ func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (al } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *EndpointGatewayIpsPager) GetNext() (page []ReservedIP, err error) { +func (pager *EndpointGatewaysPager) GetNext() (page []EndpointGateway, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { +func (pager *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { return pager.GetAllWithContext(context.Background()) } diff --git a/examples/ibm-is-ng/main.tf b/examples/ibm-is-ng/main.tf index 4f6319442b..a494a824b5 100644 --- a/examples/ibm-is-ng/main.tf +++ b/examples/ibm-is-ng/main.tf @@ -1257,56 +1257,6 @@ data "ibm_is_share" "is_share" { data "ibm_is_shares" "is_shares" { } - -// vni -resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instance" { - allow_ip_spoofing = var.is_virtual_network_interface_allow_ip_spoofing - auto_delete = var.is_virtual_network_interface_auto_delete - enable_infrastructure_nat = var.is_virtual_network_interface_enable_infrastructure_nat - ips { - address = "192.168.3.4" - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - name = "my-reserved-ip" - } - name = var.is_virtual_network_interface_name - primary_ip { - address = "192.168.3.4" - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - name = "my-reserved-ip" - } - resource_group { - id = "fee82deba12e4c0fb69c3b09d1f12345" - } - security_groups { - crn = "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" - id = "be5df5ca-12a0-494b-907e-aa6ec2bfa271" - name = "my-security-group" - } - subnet { - crn = "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - id = "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - } -} -resource "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { - virtual_network_interface = - floating_ip = -} - -data "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { - virtual_network_interface = - floating_ip = -} - -data "ibm_is_virtual_network_interface_floating_ips" "vni_fips" { - virtual_network_interface = -} // vpc dns resolution bindings // list all dns resolution bindings on a vpc @@ -1434,3 +1384,54 @@ resource "ibm_is_image_deprecate" "example" { resource "ibm_is_image_obsolete" "example" { image = ibm_is_image.image1.id } + + +// vni +resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instance" { + allow_ip_spoofing = true + auto_delete = true + enable_infrastructure_nat = true + ips { + address = "192.168.3.4" + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + name = "my-reserved-ip" + } + name = "my-virtual-network-interface" + primary_ip { + address = "192.168.3.4" + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + name = "my-reserved-ip" + } + resource_group { + id = "fee82deba12e4c0fb69c3b09d1f12345" + } + security_groups { + crn = "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" + id = "be5df5ca-12a0-494b-907e-aa6ec2bfa271" + name = "my-security-group" + } + subnet { + crn = "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + id = "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + } +} +resource "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { + virtual_network_interface = + floating_ip = +} + +data "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { + virtual_network_interface = + floating_ip = +} + +data "ibm_is_virtual_network_interface_floating_ips" "vni_fips" { + virtual_network_interface = +} \ No newline at end of file diff --git a/go.sum b/go.sum index 176ad812b9..ab31290b91 100644 --- a/go.sum +++ b/go.sum @@ -123,8 +123,6 @@ github.com/IBM/code-engine-go-sdk v0.0.0-20230606173928-4863db061918 h1:RfHezAVs github.com/IBM/code-engine-go-sdk v0.0.0-20230606173928-4863db061918/go.mod h1:IP6U/1NxgxzPeYdyiEwMaZyzelTw82JGHWl7bY78eQM= github.com/IBM/container-registry-go-sdk v1.1.0 h1:sYyknIod8R4RJZQqAheiduP6wbSTphE9Ag8ho28yXjc= github.com/IBM/container-registry-go-sdk v1.1.0/go.mod h1:4TwsCnQtVfZ4Vkapy/KPvQBKFc3VOyUZYkwRU4FTPrs= -github.com/IBM/continuous-delivery-go-sdk v1.1.2 h1:UHwwak2RVTSZGtIV+SjH0vALqSvA+Vwkd1PHAbGgGrc= -github.com/IBM/continuous-delivery-go-sdk v1.1.2/go.mod h1:A9rI1HPbccBBFgwJxXB999yXXpj1l+MnlE+rsxKtxw0= github.com/IBM/continuous-delivery-go-sdk v1.2.0 h1:FcgB5EvVrZLUnyR4S/mBocHHo9gJ5IQkSlCa6nqmr2A= github.com/IBM/continuous-delivery-go-sdk v1.2.0/go.mod h1:oW51tS5/MDCcEM7lUvjK1H9GFC/oKsRbyYfmvGyMGmw= github.com/IBM/event-notifications-go-admin-sdk v0.2.4 h1:WWUxwrKQxvExEK+xaAQOs6gP54LvJDPi3KatDTMfwh0= From 93275d73b86d687d65e4c1e46cb12d7bfd0aef56 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 27 Sep 2023 11:54:57 +0530 Subject: [PATCH 010/132] Update resource_ibm_is_share_mount_target.go --- ibm/service/vpc/resource_ibm_is_share_mount_target.go | 6 +++--- 1 file changed, 3 insertions(+), 3 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 d546bea8e2..c723dd3338 100644 --- a/ibm/service/vpc/resource_ibm_is_share_mount_target.go +++ b/ibm/service/vpc/resource_ibm_is_share_mount_target.go @@ -777,9 +777,9 @@ func ShareMountTargetMapToShareMountTargetPrototype(d *schema.ResourceData, vniM } } if resourceGroup := vniMap["resource_group"].(string); resourceGroup != "" { - // vniPrototype.ResourceGroup = &vpcv1.ResourceGroupIdentity{ - // ID: &resourceGroup, - // } + vniPrototype.ResourceGroup = &vpcv1.ResourceGroupIdentity{ + ID: &resourceGroup, + } } if secGrpIntf, ok := vniMap["security_groups"]; ok { secGrpSet := secGrpIntf.(*schema.Set) From bee4e7d7735ece239b53342c3b2fb8d146ff6860 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 28 Sep 2023 10:58:55 +0530 Subject: [PATCH 011/132] updated flow logs documents --- website/docs/r/is_flow_log.html.markdown | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/website/docs/r/is_flow_log.html.markdown b/website/docs/r/is_flow_log.html.markdown index 0ddd32f0ad..29f94e47eb 100644 --- a/website/docs/r/is_flow_log.html.markdown +++ b/website/docs/r/is_flow_log.html.markdown @@ -81,8 +81,15 @@ Review the argument references that you can specify for your resource. **•** For more information, about creating access tags, see [working with tags](https://cloud.ibm.com/docs/account?topic=account-tag&interface=ui#create-access-console).
**•** You must have the access listed in the [Granting users access to tag resources](https://cloud.ibm.com/docs/account?topic=account-access) for `access_tags`
**•** `access_tags` must be in the format `key:value`. -- `name` - (Required, String) The unique user-defined name for the flow log collector.No. -- `target` - (Required, Forces new resource, String) The ID of the target to collect flow logs. If the target is an instance, subnet, or VPC, flow logs is not collected for any network interfaces within the target that are more specific flow log collector. +- `name` - (Required, String) The unique user-defined name for the flow log collector. +- `target` - (Required, Forces new resource, String) The ID of the target to collect flow logs. + + -> **Note:** + **•** If the target is an instance network attachment, flow logs will be collected for that instance network attachment.
+ **•** If the target is an instance network interface, flow logs will be collected for that instance network interface.
+ **•** If the target is a virtual network interface, flow logs will be collected for the the virtual network interface's `target` resource if the resource is: - an instance network attachment.
+ **•** If the target is a virtual server instance, flow logs will be collected for all network 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 collectedfor any instance network attachments or instance network interfaces within the targetthat are themselves the target of a more specific flow log collector.
- `storage_bucket` - (Required, Forces new resource, String) The name of the IBM 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. - `active` - (Optional, String) Indicates whether the collector is active. If **false**, this collector is created in inactive mode. Default value is true. - `resource_group` - (Optional, Forces new resource, String) The resource group ID where the flow log is created. From 0ab2107d035a642e4885ba662f6ce7d964e1997c Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 28 Sep 2023 19:06:35 +0530 Subject: [PATCH 012/132] update docs --- website/docs/d/is_flow_log.html.markdown | 7 +++++++ website/docs/d/is_flow_logs.html.markdown | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/website/docs/d/is_flow_log.html.markdown b/website/docs/d/is_flow_log.html.markdown index 19e58e5bd8..b1855214b2 100644 --- a/website/docs/d/is_flow_log.html.markdown +++ b/website/docs/d/is_flow_log.html.markdown @@ -74,6 +74,13 @@ In addition to all argument references listed, you can access the following attr - `name` - (String) The user-defined name for this network interface. - `resource_type` - (String) The resource type. Allowable values are: `network_interface`. + -> **Note:** + **•** If the target is an instance network attachment, flow logs will be collected for that instance network attachment.
+ **•** If the target is an instance network interface, flow logs will be collected for that instance network interface.
+ **•** If the target is a virtual network interface, flow logs will be collected for the the virtual network interface's `target` resource if the resource is: - an instance network attachment.
+ **•** If the target is a virtual server instance, flow logs will be collected for all network 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 collectedfor any instance network attachments or instance network interfaces within the targetthat are themselves the target of a more specific flow log collector.
+ - `vpc` - (List) The VPC this flow log collector is associated with. Nested scheme for `vpc`: diff --git a/website/docs/d/is_flow_logs.html.markdown b/website/docs/d/is_flow_logs.html.markdown index c0f1040358..70e52038d1 100644 --- a/website/docs/d/is_flow_logs.html.markdown +++ b/website/docs/d/is_flow_logs.html.markdown @@ -48,7 +48,7 @@ Review the argument references that you can specify for your data source. - `vpc` - (String) The ID of the VPC this flow log collector resides in - `resource_group` - (String) The ID of the Resource group this flow log collector belongs to - `target` - (String) The ID of the target this collector is collecting flow logs for. -- `target_resource_type` - (String) The target resource type for this flow log collector. Available options are `instance`, `network_interface`, `subnet`, `vpc` +- `target_resource_type` - (String) The target resource type for this flow log collector. Available options are `instance`, `network_interface`, `subnet`, `vpc`, `virtual_network_interface` ## Attribute reference Review the attribute references that you can access after you retrieve your data source. From 4375a36bee5dc1b2ab34d12881c3e6212f7d0c12 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 4 Oct 2023 10:47:05 +0530 Subject: [PATCH 013/132] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 753 ++++++++++-------- 1 file changed, 417 insertions(+), 336 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 3185b0f1f7..b6e016babd 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 @@ -51,7 +51,7 @@ type VpcV1 struct { generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-09-27`. + // and `2023-10-04`. Version *string } @@ -68,7 +68,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-09-27`. + // and `2023-10-04`. Version *string } @@ -10541,6 +10541,9 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku if createBackupPolicyOptions.ResourceGroup != nil { body["resource_group"] = createBackupPolicyOptions.ResourceGroup } + if createBackupPolicyOptions.Scope != nil { + body["scope"] = createBackupPolicyOptions.Scope + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -12863,8 +12866,7 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB // ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server // This request lists all network attachments on a bare metal server. A network attachment represents a device on the // bare metal server to which a virtual network interface is attached. Network attachments can be `pci` or `vlan` -// devices for `amd64` based systems, or -// `hipersocket` devices for `s390x` based systems. +// devices. // // 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 @@ -26431,6 +26433,22 @@ type BackupPolicy struct { // The CRN for this backup policy. CRN *string `json:"crn" validate:"required"` + // The reasons for the current `health_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []BackupPolicyHealthReason `json:"health_reasons" validate:"required"` + + // The health of this resource. + // - `ok`: No abnormal behavior detected + // - `degraded`: Experiencing compromised performance, capacity, or connectivity + // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated + // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a + // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also + // have this state. + HealthState *string `json:"health_state" validate:"required"` + // The URL for this backup policy. Href *string `json:"href" validate:"required"` @@ -26468,8 +26486,26 @@ type BackupPolicy struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` + + // The scope for this backup policy. + Scope BackupPolicyScopeIntf `json:"scope" validate:"required"` } +// Constants associated with the BackupPolicy.HealthState property. +// The health of this resource. +// - `ok`: No abnormal behavior detected +// - `degraded`: Experiencing compromised performance, capacity, or connectivity +// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated +// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle +// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this +// state. +const ( + BackupPolicyHealthStateDegradedConst = "degraded" + BackupPolicyHealthStateFaultedConst = "faulted" + BackupPolicyHealthStateInapplicableConst = "inapplicable" + BackupPolicyHealthStateOkConst = "ok" +) + // Constants associated with the BackupPolicy.LifecycleState property. // The lifecycle state of the backup policy. const ( @@ -26505,6 +26541,14 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBackupPolicyHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -26545,6 +26589,10 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScope) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -26641,6 +26689,43 @@ func UnmarshalBackupPolicyCollectionNext(m map[string]json.RawMessage, result in return } +// BackupPolicyHealthReason : BackupPolicyHealthReason struct +type BackupPolicyHealthReason struct { + // A snake case string succinctly identifying the reason for this health state. + Code *string `json:"code" validate:"required"` + + // An explanation of the reason for this health state. + Message *string `json:"message" validate:"required"` + + // Link to documentation about the reason for this health state. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the BackupPolicyHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + BackupPolicyHealthReasonCodeMissingServiceAuthorizationPoliciesConst = "missing_service_authorization_policies" +) + +// UnmarshalBackupPolicyHealthReason unmarshals an instance of BackupPolicyHealthReason from the specified map of raw messages. +func UnmarshalBackupPolicyHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BackupPolicyJob : BackupPolicyJob struct type BackupPolicyJob struct { // Indicates whether this backup policy job will be automatically deleted after it completes. At present, this is @@ -27663,6 +27748,83 @@ func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawM return } +// BackupPolicyScope : The scope for this backup policy. +// Models which "extend" this model: +// - BackupPolicyScopeEnterpriseReference +// - BackupPolicyScopeAccountReference +type BackupPolicyScope struct { + // The CRN for this enterprise. + CRN *string `json:"crn,omitempty"` + + // The unique identifier for this enterprise. + ID *string `json:"id,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the BackupPolicyScope.ResourceType property. +// The resource type. +const ( + BackupPolicyScopeResourceTypeEnterpriseConst = "enterprise" +) + +func (*BackupPolicyScope) isaBackupPolicyScope() bool { + return true +} + +type BackupPolicyScopeIntf interface { + isaBackupPolicyScope() bool +} + +// UnmarshalBackupPolicyScope unmarshals an instance of BackupPolicyScope from the specified map of raw messages. +func UnmarshalBackupPolicyScope(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScope) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyScopePrototype : The scope to use for this backup policy. +// +// If unspecified, the policy will be scoped to the account. +// Models which "extend" this model: +// - BackupPolicyScopePrototypeEnterpriseIdentity +type BackupPolicyScopePrototype struct { + // The CRN for this enterprise. + CRN *string `json:"crn,omitempty"` +} + +func (*BackupPolicyScopePrototype) isaBackupPolicyScopePrototype() bool { + return true +} + +type BackupPolicyScopePrototypeIntf interface { + isaBackupPolicyScopePrototype() bool +} + +// UnmarshalBackupPolicyScopePrototype unmarshals an instance of BackupPolicyScopePrototype from the specified map of raw messages. +func UnmarshalBackupPolicyScopePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopePrototype) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServer : BareMetalServer struct type BareMetalServer struct { // The total bandwidth (in megabits per second) shared across the bare metal server network attachments or bare metal @@ -28466,7 +28628,6 @@ func UnmarshalBareMetalServerLifecycleReason(m map[string]json.RawMessage, resul // BareMetalServerNetworkAttachment : BareMetalServerNetworkAttachment struct // Models which "extend" this model: -// - BareMetalServerNetworkAttachmentByHiperSocket // - BareMetalServerNetworkAttachmentByPci // - BareMetalServerNetworkAttachmentByVlan type BareMetalServerNetworkAttachment struct { @@ -28480,8 +28641,6 @@ type BareMetalServerNetworkAttachment struct { ID *string `json:"id" validate:"required"` // The network attachment's interface type: - // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity - // within a `s390x` based system // - `pci`: a physical PCI device which can only be created or deleted when the bare metal // server is stopped // - Has an `allowed_vlans` property which controls the VLANs that will be permitted @@ -28537,8 +28696,6 @@ type BareMetalServerNetworkAttachment struct { // Constants associated with the BareMetalServerNetworkAttachment.InterfaceType property. // The network attachment's interface type: -// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity -// within a `s390x` based system // - `pci`: a physical PCI device which can only be created or deleted when the bare metal // server is stopped // - Has an `allowed_vlans` property which controls the VLANs that will be permitted @@ -28552,9 +28709,8 @@ type BareMetalServerNetworkAttachment struct { // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. const ( - BareMetalServerNetworkAttachmentInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerNetworkAttachmentInterfaceTypePciConst = "pci" - BareMetalServerNetworkAttachmentInterfaceTypeVlanConst = "vlan" + BareMetalServerNetworkAttachmentInterfaceTypePciConst = "pci" + BareMetalServerNetworkAttachmentInterfaceTypeVlanConst = "vlan" ) // Constants associated with the BareMetalServerNetworkAttachment.LifecycleState property. @@ -28592,26 +28748,68 @@ type BareMetalServerNetworkAttachmentIntf interface { // UnmarshalBareMetalServerNetworkAttachment unmarshals an instance of BareMetalServerNetworkAttachment from the specified map of raw messages. func UnmarshalBareMetalServerNetworkAttachment(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) + obj := new(BareMetalServerNetworkAttachment) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) return } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { return } - if discValue == "hipersocket" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkAttachmentByHiperSocket) - } else if discValue == "pci" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkAttachmentByPci) - } else if discValue == "vlan" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkAttachmentByVlan) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -28744,14 +28942,10 @@ func (bareMetalServerNetworkAttachmentPatch *BareMetalServerNetworkAttachmentPat // BareMetalServerNetworkAttachmentPrototype : BareMetalServerNetworkAttachmentPrototype struct // Models which "extend" this model: -// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype // - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype // - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype type BareMetalServerNetworkAttachmentPrototype struct { // The network attachment's interface type: - // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity - // within a `s390x` based system - // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` // - `pci`: a physical PCI device which can only be created or deleted when the bare metal // server is stopped // - Has an `allowed_vlans` property which controls the VLANs that will be permitted @@ -28791,9 +28985,6 @@ type BareMetalServerNetworkAttachmentPrototype struct { // Constants associated with the BareMetalServerNetworkAttachmentPrototype.InterfaceType property. // The network attachment's interface type: -// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity -// within a `s390x` based system -// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` // - `pci`: a physical PCI device which can only be created or deleted when the bare metal // server is stopped // - Has an `allowed_vlans` property which controls the VLANs that will be permitted @@ -28805,9 +28996,8 @@ type BareMetalServerNetworkAttachmentPrototype struct { // - Must use an IEEE 802.1q tag. // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( - BareMetalServerNetworkAttachmentPrototypeInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" - BareMetalServerNetworkAttachmentPrototypeInterfaceTypeVlanConst = "vlan" + BareMetalServerNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" + BareMetalServerNetworkAttachmentPrototypeInterfaceTypeVlanConst = "vlan" ) func (*BareMetalServerNetworkAttachmentPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { @@ -28873,9 +29063,8 @@ type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface struct { // - 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`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. + // - If the virtual network interface is attached, the target `resource_type` must be + // `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 @@ -29602,13 +29791,9 @@ func (bareMetalServerPatch *BareMetalServerPatch) AsPatch() (_patch map[string]i // BareMetalServerPrimaryNetworkAttachmentPrototype : BareMetalServerPrimaryNetworkAttachmentPrototype struct // Models which "extend" this model: -// - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype -// - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype +// - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype type BareMetalServerPrimaryNetworkAttachmentPrototype struct { // The network attachment's interface type: - // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity - // within a `s390x` based system - // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` // - `pci`: a physical PCI device which can only be created or deleted when the bare metal // server is stopped // - Has an `allowed_vlans` property which controls the VLANs that will be permitted @@ -29635,9 +29820,6 @@ type BareMetalServerPrimaryNetworkAttachmentPrototype struct { // Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototype.InterfaceType property. // The network attachment's interface type: -// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity -// within a `s390x` based system -// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` // - `pci`: a physical PCI device which can only be created or deleted when the bare metal // server is stopped // - Has an `allowed_vlans` property which controls the VLANs that will be permitted @@ -29645,8 +29827,7 @@ type BareMetalServerPrimaryNetworkAttachmentPrototype struct { // - Cannot directly use an IEEE 802.1q VLAN tag. // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( - BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" + BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" ) func (*BareMetalServerPrimaryNetworkAttachmentPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { @@ -31547,6 +31728,11 @@ type CreateBackupPolicyOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The scope to use for this backup policy. + // + // If unspecified, the policy will be scoped to the account. + Scope BackupPolicyScopePrototypeIntf `json:"scope,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -31594,6 +31780,12 @@ func (_options *CreateBackupPolicyOptions) SetResourceGroup(resourceGroup Resour return _options } +// SetScope : Allow user to set Scope +func (_options *CreateBackupPolicyOptions) SetScope(scope BackupPolicyScopePrototypeIntf) *CreateBackupPolicyOptions { + _options.Scope = scope + return _options +} + // SetHeaders : Allow user to set Headers func (options *CreateBackupPolicyOptions) SetHeaders(param map[string]string) *CreateBackupPolicyOptions { options.Headers = param @@ -34527,9 +34719,8 @@ type CreateVirtualNetworkInterfaceOptions struct { // - 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`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. + // - If the virtual network interface is attached, the target `resource_type` must be + // `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 @@ -50092,9 +50283,8 @@ type InstanceNetworkAttachmentPrototypeVirtualNetworkInterface struct { // - 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`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. + // - If the virtual network interface is attached, the target `resource_type` must be + // `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 @@ -69112,9 +69302,8 @@ type ShareMountTargetVirtualNetworkInterfacePrototype struct { // - 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`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. + // - If the virtual network interface is attached, the target `resource_type` must be + // `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 @@ -69144,8 +69333,8 @@ type ShareMountTargetVirtualNetworkInterfacePrototype struct { // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. + // The resource group to use for this virtual network interface. If unspecified, the + // share's resource group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC @@ -77700,9 +77889,8 @@ type VirtualNetworkInterface struct { // - 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`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. + // - If the virtual network interface is attached, the target `resource_type` must be + // `bare_metal_server_network_attachment`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` // The URL for this virtual network interface. @@ -78025,9 +78213,8 @@ type VirtualNetworkInterfacePatch struct { // - 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`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. + // - If the virtual network interface is attached, the target `resource_type` must be + // `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 @@ -80280,55 +80467,66 @@ func UnmarshalBackupPolicyJobSourceVolumeReference(m map[string]json.RawMessage, return } -// BareMetalServerBootTargetBareMetalServerDiskReference : BareMetalServerBootTargetBareMetalServerDiskReference struct -// This model "extends" BareMetalServerBootTarget -type BareMetalServerBootTargetBareMetalServerDiskReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` +// 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"` +} - // The URL for this bare metal server disk. - Href *string `json:"href" validate:"required"` +func (*BackupPolicyScopePrototypeEnterpriseIdentity) isaBackupPolicyScopePrototypeEnterpriseIdentity() bool { + return true +} - // The unique identifier for this bare metal server disk. - ID *string `json:"id" validate:"required"` +type BackupPolicyScopePrototypeEnterpriseIdentityIntf interface { + BackupPolicyScopePrototypeIntf + isaBackupPolicyScopePrototypeEnterpriseIdentity() bool +} - // 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"` +func (*BackupPolicyScopePrototypeEnterpriseIdentity) isaBackupPolicyScopePrototype() bool { + return true +} + +// UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity unmarshals an instance of BackupPolicyScopePrototypeEnterpriseIdentity from the specified map of raw messages. +func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopePrototypeEnterpriseIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyScopeAccountReference : BackupPolicyScopeAccountReference struct +// This model "extends" BackupPolicyScope +type BackupPolicyScopeAccountReference struct { + // The unique identifier for this account. + ID *string `json:"id" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the BareMetalServerBootTargetBareMetalServerDiskReference.ResourceType property. +// Constants associated with the BackupPolicyScopeAccountReference.ResourceType property. // The resource type. const ( - BareMetalServerBootTargetBareMetalServerDiskReferenceResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" + BackupPolicyScopeAccountReferenceResourceTypeAccountConst = "account" ) -func (*BareMetalServerBootTargetBareMetalServerDiskReference) isaBareMetalServerBootTarget() bool { +func (*BackupPolicyScopeAccountReference) isaBackupPolicyScope() bool { return true } -// UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference unmarshals an instance of BareMetalServerBootTargetBareMetalServerDiskReference from the specified map of raw messages. -func UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerBootTargetBareMetalServerDiskReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } +// UnmarshalBackupPolicyScopeAccountReference unmarshals an instance of BackupPolicyScopeAccountReference from the specified map of raw messages. +func UnmarshalBackupPolicyScopeAccountReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopeAccountReference) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return @@ -80337,40 +80535,37 @@ func UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference(m map[string 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"` +// BackupPolicyScopeEnterpriseReference : BackupPolicyScopeEnterpriseReference struct +// This model "extends" BackupPolicyScope +type BackupPolicyScopeEnterpriseReference struct { + // The CRN for this enterprise. + CRN *string `json:"crn" validate:"required"` - // The public SSH key used to encrypt the password. - EncryptionKey *KeyReference `json:"encryption_key" validate:"required"` + // The unique identifier for this enterprise. + ID *string `json:"id" 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. +// Constants associated with the BackupPolicyScopeEnterpriseReference.ResourceType property. // The resource type. const ( - BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccountResourceTypeHostUserAccountConst = "host_user_account" + BackupPolicyScopeEnterpriseReferenceResourceTypeEnterpriseConst = "enterprise" ) -func (*BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) isaBareMetalServerInitializationUserAccount() bool { +func (*BackupPolicyScopeEnterpriseReference) isaBackupPolicyScope() 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) +// UnmarshalBackupPolicyScopeEnterpriseReference unmarshals an instance of BackupPolicyScopeEnterpriseReference from the specified map of raw messages. +func UnmarshalBackupPolicyScopeEnterpriseReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopeEnterpriseReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } @@ -80378,96 +80573,44 @@ func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializat if err != nil { return } - err = core.UnmarshalPrimitive(m, "username", &obj.Username) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerNetworkAttachmentByHiperSocket : BareMetalServerNetworkAttachmentByHiperSocket struct -// This model "extends" BareMetalServerNetworkAttachment -type BareMetalServerNetworkAttachmentByHiperSocket struct { - // The date and time that the bare metal server network attachment was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` +// BareMetalServerBootTargetBareMetalServerDiskReference : BareMetalServerBootTargetBareMetalServerDiskReference struct +// This model "extends" BareMetalServerBootTarget +type BareMetalServerBootTargetBareMetalServerDiskReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` - // The URL for this bare metal server network attachment. + // The URL for this bare metal server disk. Href *string `json:"href" validate:"required"` - // The unique identifier for this bare metal server network attachment. + // The unique identifier for this bare metal server disk. 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. + // 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 port speed for this bare metal server network attachment in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - // The primary IP address of the virtual network interface for the bare metal server network attachment. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - - // The subnet of the virtual network interface for the bare metal server network attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The bare metal server network attachment type. - Type *string `json:"type" validate:"required"` - - // The virtual network interface for this bare metal server network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` - - // - `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 BareMetalServerNetworkAttachmentByHiperSocket.LifecycleState property. -// The lifecycle state of the bare metal server network attachment. -const ( - BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateDeletingConst = "deleting" - BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateFailedConst = "failed" - BareMetalServerNetworkAttachmentByHiperSocketLifecycleStatePendingConst = "pending" - BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateStableConst = "stable" - BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateSuspendedConst = "suspended" - BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateUpdatingConst = "updating" - BareMetalServerNetworkAttachmentByHiperSocketLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByHiperSocket.ResourceType property. +// Constants associated with the BareMetalServerBootTargetBareMetalServerDiskReference.ResourceType property. // The resource type. const ( - BareMetalServerNetworkAttachmentByHiperSocketResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByHiperSocket.Type property. -// The bare metal server network attachment type. -const ( - BareMetalServerNetworkAttachmentByHiperSocketTypePrimaryConst = "primary" - BareMetalServerNetworkAttachmentByHiperSocketTypeSecondaryConst = "secondary" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByHiperSocket.InterfaceType property. -// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity -// within a `s390x` based system. -const ( - BareMetalServerNetworkAttachmentByHiperSocketInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerBootTargetBareMetalServerDiskReferenceResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" ) -func (*BareMetalServerNetworkAttachmentByHiperSocket) isaBareMetalServerNetworkAttachment() bool { +func (*BareMetalServerBootTargetBareMetalServerDiskReference) isaBareMetalServerBootTarget() bool { return true } -// UnmarshalBareMetalServerNetworkAttachmentByHiperSocket unmarshals an instance of BareMetalServerNetworkAttachmentByHiperSocket from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentByHiperSocket(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentByHiperSocket) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) +// UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference unmarshals an instance of BareMetalServerBootTargetBareMetalServerDiskReference from the specified map of raw messages. +func UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerBootTargetBareMetalServerDiskReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) if err != nil { return } @@ -80479,39 +80622,60 @@ func UnmarshalBareMetalServerNetworkAttachmentByHiperSocket(m map[string]json.Ra if err != nil { return } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount : BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct +// This model "extends" BareMetalServerInitializationUserAccount +type BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct { + // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + EncryptedPassword *[]byte `json:"encrypted_password" validate:"required"` + + // The public SSH key used to encrypt the password. + EncryptionKey *KeyReference `json:"encryption_key" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The username for the account created at initialization. + Username *string `json:"username" validate:"required"` +} + +// Constants associated with the BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount.ResourceType property. +// The resource type. +const ( + BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccountResourceTypeHostUserAccountConst = "host_user_account" +) + +func (*BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) isaBareMetalServerInitializationUserAccount() bool { + return true +} + +// UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount unmarshals an instance of BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount from the specified map of raw messages. +func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) + err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) if err != nil { return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + err = core.UnmarshalPrimitive(m, "username", &obj.Username) if err != nil { return } @@ -80884,9 +81048,8 @@ type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetw // - 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`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. + // - If the virtual network interface is attached, the target `resource_type` must be + // `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 @@ -80975,62 +81138,6 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVi return } -// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype struct -// This model "extends" BareMetalServerNetworkAttachmentPrototype -type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype 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"` - - // - `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 BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype.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 ( - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototypeInterfaceTypeHipersocketConst = "hipersocket" -) - -// NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype, err error) { - _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype{ - VirtualNetworkInterface: virtualNetworkInterface, - InterfaceType: core.StringPtr(interfaceType), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct // This model "extends" BareMetalServerNetworkAttachmentPrototype type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct { @@ -81118,7 +81225,6 @@ type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentBy // - `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"` // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this attachment. @@ -81129,7 +81235,6 @@ type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentBy // - `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 ( BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototypeInterfaceTypeVlanConst = "vlan" ) @@ -82039,65 +82144,9 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte return } -// BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype : BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype struct +// BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype : BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype struct // This model "extends" BareMetalServerPrimaryNetworkAttachmentPrototype -type BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype 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"` - - // - `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 BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype.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 ( - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototypeInterfaceTypeHipersocketConst = "hipersocket" -) - -// NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype : Instantiate BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string) (_model *BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype, err error) { - _model = &BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype{ - VirtualNetworkInterface: virtualNetworkInterface, - InterfaceType: core.StringPtr(interfaceType), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { - return true -} - -// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByHiperSocketPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct -// This model "extends" BareMetalServerPrimaryNetworkAttachmentPrototype -type BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct { +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"` @@ -82113,10 +82162,10 @@ type BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttac // to use the PCI attachment // - Cannot directly use an IEEE 802.1q VLAN tag. // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type" validate:"required"` + InterfaceType *string `json:"interface_type,omitempty"` } -// Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype.InterfaceType property. +// 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 @@ -82124,26 +82173,25 @@ type BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttac // - Cannot directly use an IEEE 802.1q VLAN tag. // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototypeInterfaceTypePciConst = "pci" + BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototypeInterfaceTypePciConst = "pci" ) -// NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : Instantiate BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string) (_model *BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype, err error) { - _model = &BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype{ +// NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype : Instantiate BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) (_model *BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype, err error) { + _model = &BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype{ VirtualNetworkInterface: virtualNetworkInterface, - InterfaceType: core.StringPtr(interfaceType), } err = core.ValidateStruct(_model, "required parameters") return } -func (*BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { +func (*BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { return true } -// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) +// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -87340,9 +87388,8 @@ type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInte // - 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`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. + // - If the virtual network interface is attached, the target `resource_type` must be + // `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 @@ -98022,9 +98069,8 @@ type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceProt // - 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`. - // - If the virtual network interface is attached: - // - The target `resource_type` must be `bare_metal_server_network_attachment`. - // - The target `interface_type` must not be `hipersocket`. + // - If the virtual network interface is attached, the target `resource_type` must be + // `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 @@ -98054,8 +98100,8 @@ type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceProt // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. + // The resource group to use for this virtual network interface. If unspecified, the + // share's resource group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC @@ -102181,6 +102227,41 @@ func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{ return } +// BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN : BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct +// This model "extends" BackupPolicyScopePrototypeEnterpriseIdentity +type BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct { + // The CRN for this enterprise. + CRN *string `json:"crn" validate:"required"` +} + +// NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN : Instantiate BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN(crn string) (_model *BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN, err error) { + _model = &BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) isaBackupPolicyScopePrototypeEnterpriseIdentity() bool { + return true +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) isaBackupPolicyScopePrototype() bool { + return true +} + +// UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN unmarshals an instance of BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN from the specified map of raw messages. +func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct // This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { From eb2f598a11e6b18d087ec406cfcaf6a1c82aadee Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 4 Oct 2023 14:47:03 +0530 Subject: [PATCH 014/132] amde reserved ip changes --- examples/ibm-is-ng/main.tf | 9 + ibm/provider/provider.go | 218 +++++++++--------- .../data_source_ibm_is_bare_metal_servers.go | 13 +- .../data_source_ibm_is_share_mount_target.go | 1 + ...s_virtual_network_interface_floating_ip.go | 1 + ...tual_network_interface_floating_ip_test.go | 2 +- ..._virtual_network_interface_floating_ips.go | 21 +- ...rce_ibm_is_virtual_network_interface_ip.go | 100 ++++++++ ...bm_is_virtual_network_interface_ip_test.go | 113 +++++++++ ...ce_ibm_is_virtual_network_interface_ips.go | 130 +++++++++++ ...m_is_virtual_network_interface_ips_test.go | 123 ++++++++++ ...s_virtual_network_interface_floating_ip.go | 4 +- ...rce_ibm_is_virtual_network_interface_ip.go | 156 +++++++++++++ ...bm_is_virtual_network_interface_ip_test.go | 176 ++++++++++++++ ...virtual_network_interface_ip.html.markdown | 37 +++ ...irtual_network_interface_ips.html.markdown | 40 ++++ ...virtual_network_interface_ip.html.markdown | 54 +++++ 17 files changed, 1073 insertions(+), 125 deletions(-) create mode 100644 ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip.go create mode 100644 ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip_test.go create mode 100644 ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips.go create mode 100644 ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go create mode 100644 ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip.go create mode 100644 ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip_test.go create mode 100644 website/docs/d/is_virtual_network_interface_ip.html.markdown create mode 100644 website/docs/d/is_virtual_network_interface_ips.html.markdown create mode 100644 website/docs/r/is_virtual_network_interface_ip.html.markdown diff --git a/examples/ibm-is-ng/main.tf b/examples/ibm-is-ng/main.tf index a494a824b5..f4b4d78ee2 100644 --- a/examples/ibm-is-ng/main.tf +++ b/examples/ibm-is-ng/main.tf @@ -1257,6 +1257,7 @@ data "ibm_is_share" "is_share" { data "ibm_is_shares" "is_shares" { } + // vpc dns resolution bindings // list all dns resolution bindings on a vpc @@ -1434,4 +1435,12 @@ data "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { data "ibm_is_virtual_network_interface_floating_ips" "vni_fips" { virtual_network_interface = +} + +data "ibm_is_virtual_network_interface_ips" "is_vni_ips" { + virtual_network_interface = "0726-89789ff7-3157-4261-8aa9-75140a4710bb" +} +data "ibm_is_virtual_network_interface_ip" "is_vni_ip" { + virtual_network_interface = "0726-89789ff7-3157-4261-8aa9-75140a4710bb" + reserved_ip = "0726-9880e9da-8ef2-4088-bfd0-a260b927dc44" } \ No newline at end of file diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index 37d3a49ea6..5471ee94d0 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -444,112 +444,116 @@ func Provider() *schema.Provider { "ibm_is_instance_network_interface_reserved_ip": vpc.DataSourceIBMISInstanceNICReservedIP(), "ibm_is_instance_network_interface_reserved_ips": vpc.DataSourceIBMISInstanceNICReservedIPs(), - "ibm_is_instance_volume_attachment": vpc.DataSourceIBMISInstanceVolumeAttachment(), - "ibm_is_instance_volume_attachments": vpc.DataSourceIBMISInstanceVolumeAttachments(), - "ibm_is_ipsec_policy": vpc.DataSourceIBMIsIpsecPolicy(), - "ibm_is_ipsec_policies": vpc.DataSourceIBMIsIpsecPolicies(), - "ibm_is_ike_policies": vpc.DataSourceIBMIsIkePolicies(), - "ibm_is_ike_policy": vpc.DataSourceIBMIsIkePolicy(), - "ibm_is_lb": vpc.DataSourceIBMISLB(), - "ibm_is_lb_listener": vpc.DataSourceIBMISLBListener(), - "ibm_is_lb_listeners": vpc.DataSourceIBMISLBListeners(), - "ibm_is_lb_listener_policies": vpc.DataSourceIBMISLBListenerPolicies(), - "ibm_is_lb_listener_policy": vpc.DataSourceIBMISLBListenerPolicy(), - "ibm_is_lb_listener_policy_rule": vpc.DataSourceIBMISLBListenerPolicyRule(), - "ibm_is_lb_listener_policy_rules": vpc.DataSourceIBMISLBListenerPolicyRules(), - "ibm_is_lb_pool": vpc.DataSourceIBMISLBPool(), - "ibm_is_lb_pools": vpc.DataSourceIBMISLBPools(), - "ibm_is_lb_pool_member": vpc.DataSourceIBMIBLBPoolMember(), - "ibm_is_lb_pool_members": vpc.DataSourceIBMISLBPoolMembers(), - "ibm_is_lb_profile": vpc.DataSourceIBMISLbProfile(), - "ibm_is_lb_profiles": vpc.DataSourceIBMISLbProfiles(), - "ibm_is_lbs": vpc.DataSourceIBMISLBS(), - "ibm_is_public_gateway": vpc.DataSourceIBMISPublicGateway(), - "ibm_is_public_gateways": vpc.DataSourceIBMISPublicGateways(), - "ibm_is_region": vpc.DataSourceIBMISRegion(), - "ibm_is_regions": vpc.DataSourceIBMISRegions(), - "ibm_is_ssh_key": vpc.DataSourceIBMISSSHKey(), - "ibm_is_ssh_keys": vpc.DataSourceIBMIsSshKeys(), - "ibm_is_subnet": vpc.DataSourceIBMISSubnet(), - "ibm_is_subnets": vpc.DataSourceIBMISSubnets(), - "ibm_is_subnet_reserved_ip": vpc.DataSourceIBMISReservedIP(), - "ibm_is_subnet_reserved_ips": vpc.DataSourceIBMISReservedIPs(), - "ibm_is_security_group": vpc.DataSourceIBMISSecurityGroup(), - "ibm_is_security_groups": vpc.DataSourceIBMIsSecurityGroups(), - "ibm_is_security_group_rule": vpc.DataSourceIBMIsSecurityGroupRule(), - "ibm_is_security_group_rules": vpc.DataSourceIBMIsSecurityGroupRules(), - "ibm_is_security_group_target": vpc.DataSourceIBMISSecurityGroupTarget(), - "ibm_is_security_group_targets": vpc.DataSourceIBMISSecurityGroupTargets(), - "ibm_is_snapshot_clone": vpc.DataSourceSnapshotClone(), - "ibm_is_snapshot_clones": vpc.DataSourceSnapshotClones(), - "ibm_is_snapshot": vpc.DataSourceSnapshot(), - "ibm_is_snapshots": vpc.DataSourceSnapshots(), - "ibm_is_share": vpc.DataSourceIbmIsShare(), - "ibm_is_source_share": vpc.DataSourceIbmIsSourceShare(), - "ibm_is_shares": vpc.DataSourceIbmIsShares(), - "ibm_is_share_profile": vpc.DataSourceIbmIsShareProfile(), - "ibm_is_share_profiles": vpc.DataSourceIbmIsShareProfiles(), - "ibm_is_virtual_network_interface": vpc.DataSourceIBMIsVirtualNetworkInterface(), - "ibm_is_virtual_network_interfaces": vpc.DataSourceIBMIsVirtualNetworkInterfaces(), - "ibm_is_share_mount_target": vpc.DataSourceIBMIsShareTarget(), - "ibm_is_share_mount_targets": vpc.DataSourceIBMIsShareTargets(), - "ibm_is_volume": vpc.DataSourceIBMISVolume(), - "ibm_is_volumes": vpc.DataSourceIBMIsVolumes(), - "ibm_is_volume_profile": vpc.DataSourceIBMISVolumeProfile(), - "ibm_is_volume_profiles": vpc.DataSourceIBMISVolumeProfiles(), - "ibm_is_vpc": vpc.DataSourceIBMISVPC(), - "ibm_is_vpc_dns_resolution_binding": vpc.DataSourceIBMIsVPCDnsResolutionBinding(), - "ibm_is_vpc_dns_resolution_bindings": vpc.DataSourceIBMIsVPCDnsResolutionBindings(), - "ibm_is_vpcs": vpc.DataSourceIBMISVPCs(), - "ibm_is_vpn_gateway": vpc.DataSourceIBMISVPNGateway(), - "ibm_is_vpn_gateways": vpc.DataSourceIBMISVPNGateways(), - "ibm_is_vpc_address_prefixes": vpc.DataSourceIbmIsVpcAddressPrefixes(), - "ibm_is_vpc_address_prefix": vpc.DataSourceIBMIsVPCAddressPrefix(), - "ibm_is_vpn_gateway_connection": vpc.DataSourceIBMISVPNGatewayConnection(), - "ibm_is_vpn_gateway_connections": vpc.DataSourceIBMISVPNGatewayConnections(), - "ibm_is_vpc_default_routing_table": vpc.DataSourceIBMISVPCDefaultRoutingTable(), - "ibm_is_vpc_routing_table": vpc.DataSourceIBMIBMIsVPCRoutingTable(), - "ibm_is_vpc_routing_tables": vpc.DataSourceIBMISVPCRoutingTables(), - "ibm_is_vpc_routing_table_route": vpc.DataSourceIBMIBMIsVPCRoutingTableRoute(), - "ibm_is_vpc_routing_table_routes": vpc.DataSourceIBMISVPCRoutingTableRoutes(), - "ibm_is_vpn_server": vpc.DataSourceIBMIsVPNServer(), - "ibm_is_vpn_servers": vpc.DataSourceIBMIsVPNServers(), - "ibm_is_vpn_server_client": vpc.DataSourceIBMIsVPNServerClient(), - "ibm_is_vpn_server_client_configuration": vpc.DataSourceIBMIsVPNServerClientConfiguration(), - "ibm_is_vpn_server_clients": vpc.DataSourceIBMIsVPNServerClients(), - "ibm_is_vpn_server_route": vpc.DataSourceIBMIsVPNServerRoute(), - "ibm_is_vpn_server_routes": vpc.DataSourceIBMIsVPNServerRoutes(), - "ibm_is_zone": vpc.DataSourceIBMISZone(), - "ibm_is_zones": vpc.DataSourceIBMISZones(), - "ibm_is_operating_system": vpc.DataSourceIBMISOperatingSystem(), - "ibm_is_operating_systems": vpc.DataSourceIBMISOperatingSystems(), - "ibm_is_network_acls": vpc.DataSourceIBMIsNetworkAcls(), - "ibm_is_network_acl": vpc.DataSourceIBMIsNetworkACL(), - "ibm_is_network_acl_rule": vpc.DataSourceIBMISNetworkACLRule(), - "ibm_is_network_acl_rules": vpc.DataSourceIBMISNetworkACLRules(), - "ibm_lbaas": classicinfrastructure.DataSourceIBMLbaas(), - "ibm_network_vlan": classicinfrastructure.DataSourceIBMNetworkVlan(), - "ibm_org": cloudfoundry.DataSourceIBMOrg(), - "ibm_org_quota": cloudfoundry.DataSourceIBMOrgQuota(), - "ibm_kms_instance_policies": kms.DataSourceIBMKmsInstancePolicies(), - "ibm_kp_key": kms.DataSourceIBMkey(), - "ibm_kms_key_rings": kms.DataSourceIBMKMSkeyRings(), - "ibm_kms_key_policies": kms.DataSourceIBMKMSkeyPolicies(), - "ibm_kms_keys": kms.DataSourceIBMKMSkeys(), - "ibm_kms_key": kms.DataSourceIBMKMSkey(), - "ibm_pn_application_chrome": pushnotification.DataSourceIBMPNApplicationChrome(), - "ibm_app_config_environment": appconfiguration.DataSourceIBMAppConfigEnvironment(), - "ibm_app_config_environments": appconfiguration.DataSourceIBMAppConfigEnvironments(), - "ibm_app_config_collection": appconfiguration.DataSourceIBMAppConfigCollection(), - "ibm_app_config_collections": appconfiguration.DataSourceIBMAppConfigCollections(), - "ibm_app_config_feature": appconfiguration.DataSourceIBMAppConfigFeature(), - "ibm_app_config_features": appconfiguration.DataSourceIBMAppConfigFeatures(), - "ibm_app_config_property": appconfiguration.DataSourceIBMAppConfigProperty(), - "ibm_app_config_properties": appconfiguration.DataSourceIBMAppConfigProperties(), - "ibm_app_config_segment": appconfiguration.DataSourceIBMAppConfigSegment(), - "ibm_app_config_segments": appconfiguration.DataSourceIBMAppConfigSegments(), - "ibm_app_config_snapshot": appconfiguration.DataSourceIBMAppConfigSnapshot(), - "ibm_app_config_snapshots": appconfiguration.DataSourceIBMAppConfigSnapshots(), + "ibm_is_instance_volume_attachment": vpc.DataSourceIBMISInstanceVolumeAttachment(), + "ibm_is_instance_volume_attachments": vpc.DataSourceIBMISInstanceVolumeAttachments(), + "ibm_is_ipsec_policy": vpc.DataSourceIBMIsIpsecPolicy(), + "ibm_is_ipsec_policies": vpc.DataSourceIBMIsIpsecPolicies(), + "ibm_is_ike_policies": vpc.DataSourceIBMIsIkePolicies(), + "ibm_is_ike_policy": vpc.DataSourceIBMIsIkePolicy(), + "ibm_is_lb": vpc.DataSourceIBMISLB(), + "ibm_is_lb_listener": vpc.DataSourceIBMISLBListener(), + "ibm_is_lb_listeners": vpc.DataSourceIBMISLBListeners(), + "ibm_is_lb_listener_policies": vpc.DataSourceIBMISLBListenerPolicies(), + "ibm_is_lb_listener_policy": vpc.DataSourceIBMISLBListenerPolicy(), + "ibm_is_lb_listener_policy_rule": vpc.DataSourceIBMISLBListenerPolicyRule(), + "ibm_is_lb_listener_policy_rules": vpc.DataSourceIBMISLBListenerPolicyRules(), + "ibm_is_lb_pool": vpc.DataSourceIBMISLBPool(), + "ibm_is_lb_pools": vpc.DataSourceIBMISLBPools(), + "ibm_is_lb_pool_member": vpc.DataSourceIBMIBLBPoolMember(), + "ibm_is_lb_pool_members": vpc.DataSourceIBMISLBPoolMembers(), + "ibm_is_lb_profile": vpc.DataSourceIBMISLbProfile(), + "ibm_is_lb_profiles": vpc.DataSourceIBMISLbProfiles(), + "ibm_is_lbs": vpc.DataSourceIBMISLBS(), + "ibm_is_public_gateway": vpc.DataSourceIBMISPublicGateway(), + "ibm_is_public_gateways": vpc.DataSourceIBMISPublicGateways(), + "ibm_is_region": vpc.DataSourceIBMISRegion(), + "ibm_is_regions": vpc.DataSourceIBMISRegions(), + "ibm_is_ssh_key": vpc.DataSourceIBMISSSHKey(), + "ibm_is_ssh_keys": vpc.DataSourceIBMIsSshKeys(), + "ibm_is_subnet": vpc.DataSourceIBMISSubnet(), + "ibm_is_subnets": vpc.DataSourceIBMISSubnets(), + "ibm_is_subnet_reserved_ip": vpc.DataSourceIBMISReservedIP(), + "ibm_is_subnet_reserved_ips": vpc.DataSourceIBMISReservedIPs(), + "ibm_is_security_group": vpc.DataSourceIBMISSecurityGroup(), + "ibm_is_security_groups": vpc.DataSourceIBMIsSecurityGroups(), + "ibm_is_security_group_rule": vpc.DataSourceIBMIsSecurityGroupRule(), + "ibm_is_security_group_rules": vpc.DataSourceIBMIsSecurityGroupRules(), + "ibm_is_security_group_target": vpc.DataSourceIBMISSecurityGroupTarget(), + "ibm_is_security_group_targets": vpc.DataSourceIBMISSecurityGroupTargets(), + "ibm_is_snapshot_clone": vpc.DataSourceSnapshotClone(), + "ibm_is_snapshot_clones": vpc.DataSourceSnapshotClones(), + "ibm_is_snapshot": vpc.DataSourceSnapshot(), + "ibm_is_snapshots": vpc.DataSourceSnapshots(), + "ibm_is_share": vpc.DataSourceIbmIsShare(), + "ibm_is_source_share": vpc.DataSourceIbmIsSourceShare(), + "ibm_is_shares": vpc.DataSourceIbmIsShares(), + "ibm_is_share_profile": vpc.DataSourceIbmIsShareProfile(), + "ibm_is_share_profiles": vpc.DataSourceIbmIsShareProfiles(), + "ibm_is_virtual_network_interface": vpc.DataSourceIBMIsVirtualNetworkInterface(), + "ibm_is_virtual_network_interfaces": vpc.DataSourceIBMIsVirtualNetworkInterfaces(), + "ibm_is_virtual_network_interface_floating_ip": vpc.DataSourceIBMIsVirtualNetworkInterfaceFloatingIP(), + "ibm_is_virtual_network_interface_floating_ips": vpc.DataSourceIBMIsVirtualNetworkInterfaceFloatingIPs(), + "ibm_is_virtual_network_interface_ip": vpc.DataSourceIBMIsVirtualNetworkInterfaceIP(), + "ibm_is_virtual_network_interface_ips": vpc.DataSourceIBMIsVirtualNetworkInterfaceIPs(), + "ibm_is_share_mount_target": vpc.DataSourceIBMIsShareTarget(), + "ibm_is_share_mount_targets": vpc.DataSourceIBMIsShareTargets(), + "ibm_is_volume": vpc.DataSourceIBMISVolume(), + "ibm_is_volumes": vpc.DataSourceIBMIsVolumes(), + "ibm_is_volume_profile": vpc.DataSourceIBMISVolumeProfile(), + "ibm_is_volume_profiles": vpc.DataSourceIBMISVolumeProfiles(), + "ibm_is_vpc": vpc.DataSourceIBMISVPC(), + "ibm_is_vpc_dns_resolution_binding": vpc.DataSourceIBMIsVPCDnsResolutionBinding(), + "ibm_is_vpc_dns_resolution_bindings": vpc.DataSourceIBMIsVPCDnsResolutionBindings(), + "ibm_is_vpcs": vpc.DataSourceIBMISVPCs(), + "ibm_is_vpn_gateway": vpc.DataSourceIBMISVPNGateway(), + "ibm_is_vpn_gateways": vpc.DataSourceIBMISVPNGateways(), + "ibm_is_vpc_address_prefixes": vpc.DataSourceIbmIsVpcAddressPrefixes(), + "ibm_is_vpc_address_prefix": vpc.DataSourceIBMIsVPCAddressPrefix(), + "ibm_is_vpn_gateway_connection": vpc.DataSourceIBMISVPNGatewayConnection(), + "ibm_is_vpn_gateway_connections": vpc.DataSourceIBMISVPNGatewayConnections(), + "ibm_is_vpc_default_routing_table": vpc.DataSourceIBMISVPCDefaultRoutingTable(), + "ibm_is_vpc_routing_table": vpc.DataSourceIBMIBMIsVPCRoutingTable(), + "ibm_is_vpc_routing_tables": vpc.DataSourceIBMISVPCRoutingTables(), + "ibm_is_vpc_routing_table_route": vpc.DataSourceIBMIBMIsVPCRoutingTableRoute(), + "ibm_is_vpc_routing_table_routes": vpc.DataSourceIBMISVPCRoutingTableRoutes(), + "ibm_is_vpn_server": vpc.DataSourceIBMIsVPNServer(), + "ibm_is_vpn_servers": vpc.DataSourceIBMIsVPNServers(), + "ibm_is_vpn_server_client": vpc.DataSourceIBMIsVPNServerClient(), + "ibm_is_vpn_server_client_configuration": vpc.DataSourceIBMIsVPNServerClientConfiguration(), + "ibm_is_vpn_server_clients": vpc.DataSourceIBMIsVPNServerClients(), + "ibm_is_vpn_server_route": vpc.DataSourceIBMIsVPNServerRoute(), + "ibm_is_vpn_server_routes": vpc.DataSourceIBMIsVPNServerRoutes(), + "ibm_is_zone": vpc.DataSourceIBMISZone(), + "ibm_is_zones": vpc.DataSourceIBMISZones(), + "ibm_is_operating_system": vpc.DataSourceIBMISOperatingSystem(), + "ibm_is_operating_systems": vpc.DataSourceIBMISOperatingSystems(), + "ibm_is_network_acls": vpc.DataSourceIBMIsNetworkAcls(), + "ibm_is_network_acl": vpc.DataSourceIBMIsNetworkACL(), + "ibm_is_network_acl_rule": vpc.DataSourceIBMISNetworkACLRule(), + "ibm_is_network_acl_rules": vpc.DataSourceIBMISNetworkACLRules(), + "ibm_lbaas": classicinfrastructure.DataSourceIBMLbaas(), + "ibm_network_vlan": classicinfrastructure.DataSourceIBMNetworkVlan(), + "ibm_org": cloudfoundry.DataSourceIBMOrg(), + "ibm_org_quota": cloudfoundry.DataSourceIBMOrgQuota(), + "ibm_kms_instance_policies": kms.DataSourceIBMKmsInstancePolicies(), + "ibm_kp_key": kms.DataSourceIBMkey(), + "ibm_kms_key_rings": kms.DataSourceIBMKMSkeyRings(), + "ibm_kms_key_policies": kms.DataSourceIBMKMSkeyPolicies(), + "ibm_kms_keys": kms.DataSourceIBMKMSkeys(), + "ibm_kms_key": kms.DataSourceIBMKMSkey(), + "ibm_pn_application_chrome": pushnotification.DataSourceIBMPNApplicationChrome(), + "ibm_app_config_environment": appconfiguration.DataSourceIBMAppConfigEnvironment(), + "ibm_app_config_environments": appconfiguration.DataSourceIBMAppConfigEnvironments(), + "ibm_app_config_collection": appconfiguration.DataSourceIBMAppConfigCollection(), + "ibm_app_config_collections": appconfiguration.DataSourceIBMAppConfigCollections(), + "ibm_app_config_feature": appconfiguration.DataSourceIBMAppConfigFeature(), + "ibm_app_config_features": appconfiguration.DataSourceIBMAppConfigFeatures(), + "ibm_app_config_property": appconfiguration.DataSourceIBMAppConfigProperty(), + "ibm_app_config_properties": appconfiguration.DataSourceIBMAppConfigProperties(), + "ibm_app_config_segment": appconfiguration.DataSourceIBMAppConfigSegment(), + "ibm_app_config_segments": appconfiguration.DataSourceIBMAppConfigSegments(), + "ibm_app_config_snapshot": appconfiguration.DataSourceIBMAppConfigSnapshot(), + "ibm_app_config_snapshots": appconfiguration.DataSourceIBMAppConfigSnapshots(), "ibm_resource_quota": resourcecontroller.DataSourceIBMResourceQuota(), "ibm_resource_group": resourcemanager.DataSourceIBMResourceGroup(), @@ -1061,6 +1065,8 @@ func Provider() *schema.Provider { "ibm_is_ssh_key": vpc.ResourceIBMISSSHKey(), "ibm_is_snapshot": vpc.ResourceIBMSnapshot(), "ibm_is_virtual_network_interface": vpc.ResourceIBMIsVirtualNetworkInterface(), + "ibm_is_virtual_network_interface_floating_ip": vpc.ResourceIBMIsVirtualNetworkInterfaceFloatingIP(), + "ibm_is_virtual_network_interface_ip": vpc.ResourceIBMIsVirtualNetworkInterfaceIP(), "ibm_is_volume": vpc.ResourceIBMISVolume(), "ibm_is_vpn_gateway": vpc.ResourceIBMISVPNGateway(), "ibm_is_vpn_gateway_connection": vpc.ResourceIBMISVPNGatewayConnection(), diff --git a/ibm/service/vpc/data_source_ibm_is_bare_metal_servers.go b/ibm/service/vpc/data_source_ibm_is_bare_metal_servers.go index 8f7bbb8d8a..7edfac2e5f 100644 --- a/ibm/service/vpc/data_source_ibm_is_bare_metal_servers.go +++ b/ibm/service/vpc/data_source_ibm_is_bare_metal_servers.go @@ -485,17 +485,18 @@ func dataSourceIBMISBareMetalServersRead(context context.Context, d *schema.Reso vpcCrn := vpcCrnIntf.(string) listBareMetalServersOptions.VPCCRN = &vpcCrn } + //sdk // if subnetIntf, ok := d.GetOk("network_interfaces_subnet"); ok { - // // subnetId := subnetIntf.(string) - // // listBareMetalServersOptions.NetworkInterfacesSubnetID = &subnetId + // subnetId := subnetIntf.(string) + // listBareMetalServersOptions.NetworkInterfacesSubnetID = &subnetId // } // if subnetNameIntf, ok := d.GetOk("network_interfaces_subnet_name"); ok { - // // subnetName := subnetNameIntf.(string) - // // listBareMetalServersOptions.NetworkInterfacesSubnetName = &subnetName + // subnetName := subnetNameIntf.(string) + // listBareMetalServersOptions.NetworkInterfacesSubnetName = &subnetName // } // if subnetCrnIntf, ok := d.GetOk("network_interfaces_subnet_crn"); ok { - // // subnetCrn := subnetCrnIntf.(string) - // // listBareMetalServersOptions.NetworkInterfacesSubnetCRN = &subnetCrn + // subnetCrn := subnetCrnIntf.(string) + // listBareMetalServersOptions.NetworkInterfacesSubnetCRN = &subnetCrn // } for { 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 f397ff7ad6..0cafcb2f75 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 @@ -443,6 +443,7 @@ func dataSourceShareTargetVNIToMap(VNIItem vpcv1.VirtualNetworkInterfaceReferenc if VNIItem.CRN != nil { subnetMap["crn"] = VNIItem.CRN } + // sdk // if VNIItem.Deleted != nil { // deletedList := []map[string]interface{}{} // deletedMap := dataSourceShareTargetVNIDeletedToMap(*VNIItem.Deleted) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip.go index 37a9d19160..efb2c01ebb 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip.go @@ -89,6 +89,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceFloatingIPRead(context context.Contex log.Printf("[DEBUG] GetVirtualNetworkInterfaceFloatingIPWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterfaceFloatingIPWithContext failed %s\n%s", err, response)) } + d.SetId(*floatingIP.ID) resourceIBMIsVirtualNetworkInterfaceFloatingIPGet(d, floatingIP) return nil } diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go index 2569321c4c..575b113c8e 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go @@ -75,7 +75,7 @@ func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDataSourceConfigBasic() s data "ibm_is_virtual_network_interface_floating_ip" "is_floating_ip_instance" { virtual_network_interface = "virtual_network_interface_id" - flating_ip = "flating_ip_id" + floating_ip = "floating_ip_id" } `) } diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips.go index 227bbbe364..14ff4dd698 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips.go @@ -32,9 +32,9 @@ func DataSourceIBMIsVirtualNetworkInterfaceFloatingIPs() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "floating_ip": &schema.Schema{ + "id": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The floating IP identifier", }, "name": &schema.Schema{ @@ -44,13 +44,13 @@ func DataSourceIBMIsVirtualNetworkInterfaceFloatingIPs() *schema.Resource { }, "deleted": &schema.Schema{ Type: schema.TypeList, - Optional: true, + Computed: true, Description: "If present, this property indicates the referenced resource has been deleted, and provides some supplementary information.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "more_info": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "Link to documentation about deleted resources", }, }, @@ -106,7 +106,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceFloatingIPsRead(context context.Conte floatingIpsInfo := make([]map[string]interface{}, 0) for _, floatingIP := range allrecs { l := map[string]interface{}{} - + l["id"] = *floatingIP.ID if !core.IsNil(floatingIP.Name) { l["name"] = floatingIP.Name } @@ -114,13 +114,12 @@ func dataSourceIBMIsVirtualNetworkInterfaceFloatingIPsRead(context context.Conte l["crn"] = floatingIP.CRN l["href"] = floatingIP.Href - if deleted, err := resourceIBMIsVirtualNetworkInterfaceFloatingIPNetworkInterfaceReferenceDeletedToMap(floatingIP.Deleted); err != nil { - return diag.FromErr(fmt.Errorf("Error setting status: %s", err)) - } else { - l["deleted"] = deleted - } + // if deleted, err := resourceIBMIsVirtualNetworkInterfaceFloatingIPNetworkInterfaceReferenceDeletedToMap(floatingIP.Deleted); err != nil { + // return diag.FromErr(fmt.Errorf("[ERROR] Error setting status: %s", err)) + // } else { + // l["deleted"] = deleted + // } floatingIpsInfo = append(floatingIpsInfo, l) - } d.SetId(dataSourceIBMISVirtualNetworkInterfaceFloatingIPsID(d)) d.Set("floating_ips", floatingIpsInfo) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip.go new file mode 100644 index 0000000000..1fff5fc9c0 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip.go @@ -0,0 +1,100 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func DataSourceIBMIsVirtualNetworkInterfaceIP() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIsVirtualNetworkInterfaceIPRead, + + Schema: map[string]*schema.Schema{ + "virtual_network_interface": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The virtual network interface identifier", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The reserved IP identifier.", + }, + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "reserved_ip": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + } +} + +func dataSourceIsVirtualNetworkInterfaceIPRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + getVirtualNetworkInterfaceIPOptions := &vpcv1.GetVirtualNetworkInterfaceIPOptions{} + + getVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(d.Get("virtual_network_interface").(string)) + getVirtualNetworkInterfaceIPOptions.SetID(d.Get("reserved_ip").(string)) + + reservedIP, response, err := vpcClient.GetVirtualNetworkInterfaceIPWithContext(context, getVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] GetVirtualNetworkInterfaceIPWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterfaceIPWithContext failed %s\n%s", err, response)) + } + + d.SetId(*reservedIP.ID) + + if err = d.Set("address", reservedIP.Address); err != nil { + return diag.FromErr(fmt.Errorf("Error setting address: %s", err)) + } + if err = d.Set("href", reservedIP.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + + if err = d.Set("reserved_ip", reservedIP.ID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting reserved_ip: %s", err)) + } + + if err = d.Set("name", reservedIP.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + + if err = d.Set("resource_type", reservedIP.ResourceType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_type: %s", err)) + } + + return nil +} diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip_test.go new file mode 100644 index 0000000000..1d0309e257 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip_test.go @@ -0,0 +1,113 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIBMIsVirtualNetworkInterfaceIpDataSourceBasic(t *testing.T) { + virtualNetworkInterfaceIpSubnetID := fmt.Sprintf("tf_vni_id_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceIpDataSourceConfigBasic(virtualNetworkInterfaceIpSubnetID), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "subnet_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "address"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "auto_delete"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "reserved_ip_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "lifecycle_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "owner"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "resource_type"), + ), + }, + }, + }) +} + +func TestAccIBMIsVirtualNetworkInterfaceIpDataSourceAllArgs(t *testing.T) { + virtualNetworkInterfaceIpSubnetID := fmt.Sprintf("tf_subnet_id_%d", acctest.RandIntRange(10, 100)) + virtualNetworkInterfaceIpAddress := fmt.Sprintf("tf_address_%d", acctest.RandIntRange(10, 100)) + virtualNetworkInterfaceIpAutoDelete := "false" + virtualNetworkInterfaceIpName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceIpDataSourceConfig(virtualNetworkInterfaceIpSubnetID, virtualNetworkInterfaceIpAddress, virtualNetworkInterfaceIpAutoDelete, virtualNetworkInterfaceIpName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "subnet_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "address"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "auto_delete"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "reserved_ip_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "lifecycle_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "owner"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "target.#"), + ), + }, + }, + }) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceIpDataSourceConfigBasic(virtualNetworkInterfaceIpSubnetID string) string { + return fmt.Sprintf(` + resource "ibm_is_reserved_ip" "is_reserved_ip_instance" { + subnet_id = "%s" + } + + data "ibm_is_reserved_ip" "is_reserved_ip_instance" { + subnet_id = ibm_is_reserved_ip.is_reserved_ip.subnet_id + id = "id" + } + `, virtualNetworkInterfaceIpSubnetID) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceIpDataSourceConfig(virtualNetworkInterfaceIpSubnetID string, virtualNetworkInterfaceIpAddress string, virtualNetworkInterfaceIpAutoDelete string, virtualNetworkInterfaceIpName string) string { + return fmt.Sprintf(` + resource "ibm_is_reserved_ip" "is_reserved_ip_instance" { + subnet_id = "%s" + address = "%s" + auto_delete = %s + name = "%s" + target { + crn = "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" + id = "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" + name = "my-endpoint-gateway" + resource_type = "endpoint_gateway" + } + } + + data "ibm_is_reserved_ip" "is_reserved_ip_instance" { + subnet_id = ibm_is_reserved_ip.is_reserved_ip.subnet_id + id = "id" + } + `, virtualNetworkInterfaceIpSubnetID, virtualNetworkInterfaceIpAddress, virtualNetworkInterfaceIpAutoDelete, virtualNetworkInterfaceIpName) +} diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips.go new file mode 100644 index 0000000000..cfff1e8a3a --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips.go @@ -0,0 +1,130 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func DataSourceIBMIsVirtualNetworkInterfaceIPs() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIsVirtualNetworkInterfaceIPsRead, + + Schema: map[string]*schema.Schema{ + "virtual_network_interface": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The virtual network interface identifier", + }, + "reserved_ips": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Collection of reserved IPs for this virtual network interface.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + }, + } +} + +func dataSourceIsVirtualNetworkInterfaceIPsRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + listVirtualNetworkInterfaceIpsOptions := &vpcv1.ListVirtualNetworkInterfaceIpsOptions{} + + listVirtualNetworkInterfaceIpsOptions.SetVirtualNetworkInterfaceID(d.Get("virtual_network_interface").(string)) + var pager *vpcv1.VirtualNetworkInterfaceIpsPager + pager, err = vpcClient.NewVirtualNetworkInterfaceIpsPager(listVirtualNetworkInterfaceIpsOptions) + if err != nil { + return diag.FromErr(err) + } + + allItems, err := pager.GetAll() + if err != nil { + log.Printf("[DEBUG] VirtualNetworkInterfaceIpsPager.GetAll() failed %s", err) + return diag.FromErr(fmt.Errorf("VirtualNetworkInterfaceIpsPager.GetAll() failed %s", err)) + } + + d.SetId(dataSourceVirtualNetworkInterfaceIPsID(d)) + + mapSlice := []map[string]interface{}{} + for _, modelItem := range allItems { + modelMap, err := dataSourceIBMIsReservedIpsReservedIPToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + mapSlice = append(mapSlice, modelMap) + } + + if err = d.Set("reserved_ips", mapSlice); err != nil { + return diag.FromErr(fmt.Errorf("Error setting reserved_ips for virtual network interface datasource %s", err)) + } + + return nil +} + +// dataSourceVirtualNetworkInterfaceIPsID returns a reasonable ID for the list. +func dataSourceVirtualNetworkInterfaceIPsID(d *schema.ResourceData) string { + return time.Now().UTC().String() +} + +func dataSourceIBMIsReservedIpsReservedIPCollectionFirstToMap(model *vpcv1.ReservedIPCollectionFirst) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["href"] = model.Href + return modelMap, nil +} + +func dataSourceIBMIsReservedIpsReservedIPCollectionNextToMap(model *vpcv1.ReservedIPCollectionNext) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["href"] = model.Href + return modelMap, nil +} + +func dataSourceIBMIsReservedIpsReservedIPToMap(model *vpcv1.ReservedIPReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["address"] = model.Address + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go new file mode 100644 index 0000000000..71c2024065 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go @@ -0,0 +1,123 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIBMIsVirtualNetworkInterfaceIpsDataSourceBasic(t *testing.T) { + virtualNetworkInterfaceIpSubnetID := fmt.Sprintf("tf_subnet_id_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceIpsDataSourceConfigBasic(virtualNetworkInterfaceIpSubnetID), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "subnet_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "first.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "limit"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "total_count"), + ), + }, + }, + }) +} + +func TestAccIBMIsVirtualNetworkInterfaceIpsDataSourceAllArgs(t *testing.T) { + virtualNetworkInterfaceIpSubnetID := fmt.Sprintf("tf_subnet_id_%d", acctest.RandIntRange(10, 100)) + virtualNetworkInterfaceIpAddress := fmt.Sprintf("tf_address_%d", acctest.RandIntRange(10, 100)) + virtualNetworkInterfaceIpAutoDelete := "false" + virtualNetworkInterfaceIpName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceIpsDataSourceConfig(virtualNetworkInterfaceIpSubnetID, virtualNetworkInterfaceIpAddress, virtualNetworkInterfaceIpAutoDelete, virtualNetworkInterfaceIpName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "subnet_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "sort"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "target_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "target_crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "target_name"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "target_resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "first.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "limit"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "next.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.#"), + resource.TestCheckResourceAttr("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.address", virtualNetworkInterfaceIpAddress), + resource.TestCheckResourceAttr("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.auto_delete", virtualNetworkInterfaceIpAutoDelete), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.href"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.lifecycle_state"), + resource.TestCheckResourceAttr("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.name", virtualNetworkInterfaceIpName), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.owner"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "total_count"), + ), + }, + }, + }) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceIpsDataSourceConfigBasic(virtualNetworkInterfaceIpSubnetID string) string { + return fmt.Sprintf(` + resource "ibm_is_reserved_ip" "is_reserved_ip_instance" { + subnet_id = "%s" + } + + data "ibm_is_reserved_ips" "is_reserved_ips_instance" { + subnet_id = ibm_is_reserved_ip.is_reserved_ip.subnet_id + sort = "name" + target.id = "target.id" + target.crn = "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727" + target.name = "my-resource" + target.resource_type = "target.resource_type" + } + `, virtualNetworkInterfaceIpSubnetID) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceIpsDataSourceConfig(virtualNetworkInterfaceIpSubnetID string, virtualNetworkInterfaceIpAddress string, virtualNetworkInterfaceIpAutoDelete string, virtualNetworkInterfaceIpName string) string { + return fmt.Sprintf(` + resource "ibm_is_reserved_ip" "is_reserved_ip_instance" { + subnet_id = "%s" + address = "%s" + auto_delete = %s + name = "%s" + target { + crn = "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" + id = "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" + name = "my-endpoint-gateway" + resource_type = "endpoint_gateway" + } + } + + data "ibm_is_reserved_ips" "is_reserved_ips_instance" { + subnet_id = ibm_is_reserved_ip.is_reserved_ip.subnet_id + sort = "name" + target.id = "target.id" + target.crn = "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727" + target.name = "my-resource" + target.resource_type = "target.resource_type" + } + `, virtualNetworkInterfaceIpSubnetID, virtualNetworkInterfaceIpAddress, virtualNetworkInterfaceIpAutoDelete, virtualNetworkInterfaceIpName) +} diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go index efebff6d93..a8f059f51c 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go @@ -174,7 +174,9 @@ func resourceIBMIsVirtualNetworkInterfaceFloatingIPDelete(context context.Contex func resourceIBMIsVirtualNetworkInterfaceFloatingIPNetworkInterfaceReferenceDeletedToMap(model *vpcv1.FloatingIPReferenceDeleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) - modelMap["more_info"] = model.MoreInfo + if model != nil { + modelMap["more_info"] = model.MoreInfo + } return modelMap, nil } diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip.go new file mode 100644 index 0000000000..c02fe0554b --- /dev/null +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip.go @@ -0,0 +1,156 @@ +// Copyright IBM Corp. 2023 All Rights VirtualNetworkInterface. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func ResourceIBMIsVirtualNetworkInterfaceIP() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIBMIsVirtualNetworkInterfaceIPCreate, + ReadContext: resourceIBMIsVirtualNetworkInterfaceIPRead, + DeleteContext: resourceIBMIsVirtualNetworkInterfaceIPDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "virtual_network_interface": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The virtual network interface identifier.", + }, + "reserved_ip": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The reserved ip identifier.", + }, + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + } +} +func resourceIBMIsVirtualNetworkInterfaceIPCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + addVirtualNetworkInterfaceIPOptions := &vpcv1.AddVirtualNetworkInterfaceIPOptions{} + + addVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(d.Get("virtual_network_interface").(string)) + addVirtualNetworkInterfaceIPOptions.SetID(d.Get("reserved_ip").(string)) + + reservedIP, response, err := vpcClient.AddVirtualNetworkInterfaceIPWithContext(context, addVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] AddVirtualNetworkInterfaceIPWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("AddVirtualNetworkInterfaceIPWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s/%s", *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, *reservedIP.ID)) + + return resourceIBMIsVirtualNetworkInterfaceIPRead(context, d, meta) +} + +func resourceIBMIsVirtualNetworkInterfaceIPRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + getVirtualNetworkInterfaceIPOptions := &vpcv1.GetVirtualNetworkInterfaceIPOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + getVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(parts[0]) + getVirtualNetworkInterfaceIPOptions.SetID(parts[1]) + + reservedIP, response, err := vpcClient.GetVirtualNetworkInterfaceIPWithContext(context, getVirtualNetworkInterfaceIPOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetVirtualNetworkInterfaceIPWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterfaceIPWithContext failed %s\n%s", err, response)) + } + + if !core.IsNil(reservedIP.Address) { + if err = d.Set("address", reservedIP.Address); err != nil { + return diag.FromErr(fmt.Errorf("Error setting address: %s", err)) + } + } + if !core.IsNil(reservedIP.Name) { + if err = d.Set("name", reservedIP.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + } + if err = d.Set("href", reservedIP.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + if err = d.Set("resource_type", reservedIP.ResourceType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_type: %s", err)) + } + return nil +} + +func resourceIBMIsVirtualNetworkInterfaceIPDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + removeVirtualNetworkInterfaceIPOptions := &vpcv1.RemoveVirtualNetworkInterfaceIPOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + removeVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(parts[0]) + removeVirtualNetworkInterfaceIPOptions.SetID(parts[1]) + + response, err := vpcClient.RemoveVirtualNetworkInterfaceIPWithContext(context, removeVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] RemoveVirtualNetworkInterfaceIPWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("RemoveVirtualNetworkInterfaceIPWithContext failed %s\n%s", err, response)) + } + + d.SetId("") + + return nil +} diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip_test.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip_test.go new file mode 100644 index 0000000000..c42683590a --- /dev/null +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip_test.go @@ -0,0 +1,176 @@ +// Copyright IBM Corp. 2023 All Rights VirtualNetworkInterface. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func TestAccIBMIsVirtualNetworkInterfaceIPBasic(t *testing.T) { + var conf vpcv1.ReservedIPReference + subnetID := fmt.Sprintf("tf_subnet_id_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceIPDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceIPConfigBasic(subnetID), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIsVirtualNetworkInterfaceIPExists("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", conf), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "subnet_id", subnetID), + ), + }, + }, + }) +} + +func TestAccIBMIsVirtualNetworkInterfaceIPAllArgs(t *testing.T) { + var conf vpcv1.ReservedIPReference + subnetID := fmt.Sprintf("tf_subnet_id_%d", acctest.RandIntRange(10, 100)) + address := fmt.Sprintf("tf_address_%d", acctest.RandIntRange(10, 100)) + autoDelete := "false" + name := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) + addressUpdate := fmt.Sprintf("tf_address_%d", acctest.RandIntRange(10, 100)) + autoDeleteUpdate := "true" + nameUpdate := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceIPDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceIPConfig(subnetID, address, autoDelete, name), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIsVirtualNetworkInterfaceIPExists("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", conf), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "subnet_id", subnetID), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "address", address), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "auto_delete", autoDelete), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "name", name), + ), + }, + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceIPConfig(subnetID, addressUpdate, autoDeleteUpdate, nameUpdate), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "subnet_id", subnetID), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "address", addressUpdate), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "auto_delete", autoDeleteUpdate), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "name", nameUpdate), + ), + }, + resource.TestStep{ + ResourceName: "ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceIPConfigBasic(subnetID string) string { + return fmt.Sprintf(` + resource "ibm_is_virtual_network_interface_ip" "is_virtual_network_interface_ip_instance" { + subnet_id = "%s" + } + `, subnetID) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceIPConfig(subnetID string, address string, autoDelete string, name string) string { + return fmt.Sprintf(` + + resource "ibm_is_virtual_network_interface_ip" "is_virtual_network_interface_ip_instance" { + subnet_id = "%s" + address = "%s" + auto_delete = %s + name = "%s" + target { + crn = "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" + deleted { + more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" + } + href = "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" + id = "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" + name = "my-endpoint-gateway" + resource_type = "endpoint_gateway" + } + } + `, subnetID, address, autoDelete, name) +} + +func testAccCheckIBMIsVirtualNetworkInterfaceIPExists(n string, obj vpcv1.ReservedIPReference) resource.TestCheckFunc { + + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + vpcClient, err := vpcClient(acc.TestAccProvider.Meta()) + if err != nil { + return err + } + + getSubnetVirtualNetworkInterfaceIPOptions := &vpcv1.GetVirtualNetworkInterfaceIPOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getSubnetVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(parts[0]) + getSubnetVirtualNetworkInterfaceIPOptions.SetID(parts[1]) + + reservedIP, _, err := vpcClient.GetVirtualNetworkInterfaceIP(getSubnetVirtualNetworkInterfaceIPOptions) + if err != nil { + return err + } + + obj = *reservedIP + return nil + } +} + +func testAccCheckIBMIsVirtualNetworkInterfaceIPDestroy(s *terraform.State) error { + vpcClient, err := vpcClient(acc.TestAccProvider.Meta()) + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_is_virtual_network_interface_ip" { + continue + } + + getSubnetVirtualNetworkInterfaceIPOptions := &vpcv1.GetVirtualNetworkInterfaceIPOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getSubnetVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(parts[0]) + getSubnetVirtualNetworkInterfaceIPOptions.SetID(parts[1]) + + // Try to find the key + _, response, err := vpcClient.GetVirtualNetworkInterfaceIP(getSubnetVirtualNetworkInterfaceIPOptions) + + if err == nil { + return fmt.Errorf("VirtualNetworkInterfaceIP still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for VirtualNetworkInterfaceIP (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/website/docs/d/is_virtual_network_interface_ip.html.markdown b/website/docs/d/is_virtual_network_interface_ip.html.markdown new file mode 100644 index 0000000000..bcba4d43fb --- /dev/null +++ b/website/docs/d/is_virtual_network_interface_ip.html.markdown @@ -0,0 +1,37 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_is_virtual_network_interface_ip" +description: |- + Get information about Virtual NetworkInterface Ip +subcategory: "Virtual Private Cloud API" +--- + +# ibm_is_virtual_network_interface_ip + +Provides a read-only data source to retrieve information about a Virtual NetworkInterface Ip. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```hcl +data "ibm_is_virtual_network_interface_ip" "is_reserved_ip" { + reserved_ip = "id" + virtual_network_interface = ibm_is_virtual_network_interface_ip.is_reserved_ip.subnet_id +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +- `reserved_ip` - (Required, Forces new resource, String) The reserved IP identifier. +- `virtual_network_interface` - (Required, Forces new resource, String) The virtual network interface identifier. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +- `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. +- `href` - (String) The URL for this reserved IP. +- `id` - (String) The unique identifier for this reserved IP. +- `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. +- `resource_type` - (String) The resource type. diff --git a/website/docs/d/is_virtual_network_interface_ips.html.markdown b/website/docs/d/is_virtual_network_interface_ips.html.markdown new file mode 100644 index 0000000000..b5a5765149 --- /dev/null +++ b/website/docs/d/is_virtual_network_interface_ips.html.markdown @@ -0,0 +1,40 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_is_virtual_network_interface_ips" +description: |- + Get information about ReservedIPCollection +subcategory: "Virtual Private Cloud API" +--- + +# ibm_is_virtual_network_interface_ips + +Provides a read-only data source to retrieve information about a ReservedIP Collection bound to a virtual network interface. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```terraform +data "ibm_is_virtual_network_interface_ips" "is_reserved_ips" { + virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +- `virtual_network_interface` - (Required, Forces new resource, String) The virtual network interface identifier. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +- `id` - The unique identifier of the virtual network interface reserved IP Collection. + +- `reserved_ips` - (List) Collection of reserved IPs in this subnet. + Nested schema for **reserved_ips**: + - `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `href` - (String) The URL for this reserved IP. + - `id` - (String) The unique identifier for this reserved IP. + - `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. + diff --git a/website/docs/r/is_virtual_network_interface_ip.html.markdown b/website/docs/r/is_virtual_network_interface_ip.html.markdown new file mode 100644 index 0000000000..baa7701f94 --- /dev/null +++ b/website/docs/r/is_virtual_network_interface_ip.html.markdown @@ -0,0 +1,54 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_is_virtual_network_interface_ip" +description: |- + Manages virtual_network_interface reserved ip attachment. +subcategory: "Virtual Private Cloud API" +--- + +# ibm_is_virtual_network_interface_ip + +Create, update, and delete ReservedIP virtual network instance attachment with this resource. + +## Example Usage + +```hcl +resource "ibm_is_virtual_network_interface_ip" "is_reserved_ip_instance" { + reserved_ip = "subnet_id" + virtual_network_interface = "subnet_id" +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +- `reserved_ip` - (Required, Forces new resource, String) The reserved IP identifier. +- `virtual_network_interface` - (Required, Forces new resource, String) The virtual network interface identifier. + +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +- `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. +- `href` - (String) The URL for this reserved IP. +- `id` - (String) The unique identifier for this reserved IP. +- `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. +- `resource_type` - (String) The resource type. + + +## Import + +You can import the `ibm_is_virtual_network_interface_ip` resource by using `id`. +The `id` property can be formed from `virtual_network_interface`, and `reserved_ip` in the following format: + +``` +/ +``` +* `virtual_network_interface`: A string. The subnet identifier. +* `reserved_ip`: A string. The reserved IP identifier. + +# Syntax +``` +$ terraform import ibm_is_virtual_network_interface_ip.is_reserved_ip / +``` From d11b9f6aa27782a9e4e24535f8cad52da628e0ae Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 4 Oct 2023 14:52:38 +0530 Subject: [PATCH 015/132] missing force new --- ...resource_ibm_is_virtual_network_interface_floating_ip.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go index a8f059f51c..6aa877bdc0 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go @@ -27,10 +27,12 @@ func ResourceIBMIsVirtualNetworkInterfaceFloatingIP() *schema.Resource { "virtual_network_interface": &schema.Schema{ Type: schema.TypeString, Required: true, + ForceNew: true, Description: "The virtual network interface identifier", }, "floating_ip": &schema.Schema{ Type: schema.TypeString, + ForceNew: true, Required: true, Description: "The floating IP identifier", }, @@ -42,13 +44,13 @@ func ResourceIBMIsVirtualNetworkInterfaceFloatingIP() *schema.Resource { "deleted": &schema.Schema{ Type: schema.TypeList, - Optional: true, + Computed: true, Description: "If present, this property indicates the referenced resource has been deleted, and provides some supplementary information.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "more_info": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "Link to documentation about deleted resources", }, }, From 4af4ba2e976bcb02e927188e4b4d9fd9b67e2f2d Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 4 Oct 2023 14:58:32 +0530 Subject: [PATCH 016/132] Update main.tf --- examples/ibm-is-ng/main.tf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/ibm-is-ng/main.tf b/examples/ibm-is-ng/main.tf index f4b4d78ee2..fbc7bac6f8 100644 --- a/examples/ibm-is-ng/main.tf +++ b/examples/ibm-is-ng/main.tf @@ -1437,6 +1437,11 @@ data "ibm_is_virtual_network_interface_floating_ips" "vni_fips" { virtual_network_interface = } +resource "ibm_is_virtual_network_interface_ip" "is_floating_ip_instance" { + virtual_network_interface = "0726-89789ff7-3157-4261-8aa9-75140a4710bb" + reserved_ip = "0726-2c1ffe98-6542-4b9e-bb84-6d9efe93e68f" +} + data "ibm_is_virtual_network_interface_ips" "is_vni_ips" { virtual_network_interface = "0726-89789ff7-3157-4261-8aa9-75140a4710bb" } From 49e6002a54a7c9bb1a47aeee37269561cd22e8b1 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 4 Oct 2023 16:35:19 +0530 Subject: [PATCH 017/132] updated tests --- ..._virtual_network_interface_floating_ips.go | 11 +- ...source_ibm_is_virtual_network_interface.go | 293 ++---------------- ...s_virtual_network_interface_floating_ip.go | 29 +- ...e_ibm_is_virtual_network_interface_test.go | 49 ++- 4 files changed, 82 insertions(+), 300 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips.go index 14ff4dd698..6282d5984f 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips.go @@ -114,11 +114,12 @@ func dataSourceIBMIsVirtualNetworkInterfaceFloatingIPsRead(context context.Conte l["crn"] = floatingIP.CRN l["href"] = floatingIP.Href - // if deleted, err := resourceIBMIsVirtualNetworkInterfaceFloatingIPNetworkInterfaceReferenceDeletedToMap(floatingIP.Deleted); err != nil { - // return diag.FromErr(fmt.Errorf("[ERROR] Error setting status: %s", err)) - // } else { - // l["deleted"] = deleted - // } + deleted := make(map[string]interface{}) + + if floatingIP.Deleted != nil && floatingIP.Deleted.MoreInfo != nil { + deleted["more_info"] = floatingIP.Deleted + } + l["deleted"] = []map[string]interface{}{deleted} floatingIpsInfo = append(floatingIpsInfo, l) } d.SetId(dataSourceIBMISVirtualNetworkInterfaceFloatingIPsID(d)) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go index 5149e100d6..6a42a35fd8 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go @@ -161,126 +161,24 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { }, }, "resource_group": &schema.Schema{ - Type: schema.TypeList, - MaxItems: 1, + Type: schema.TypeString, Optional: true, Computed: true, - Description: "The resource group for this virtual network interface.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "href": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The URL for this resource group.", - }, - "id": &schema.Schema{ - Type: schema.TypeString, - Required: true, - Description: "The unique identifier for this resource group.", - }, - "name": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The name for this resource group.", - }, - }, - }, + Description: "The resource group id for this virtual network interface.", }, - "security_groups": &schema.Schema{ - Type: schema.TypeList, + "security_groups": { + Type: schema.TypeSet, Optional: true, Computed: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, Description: "The security groups for this virtual network interface.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "crn": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - Description: "The security group's CRN.", - }, - "deleted": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "more_info": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Link to documentation about deleted resources.", - }, - }, - }, - }, - "href": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - Description: "The security group's canonical URL.", - }, - "security_group": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - Description: "The unique identifier for this security group.", - }, - "name": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The name for this security group. The name is unique across all security groups for the VPC.", - }, - }, - }, }, "subnet": &schema.Schema{ - Type: schema.TypeList, - MaxItems: 1, + Type: schema.TypeString, Optional: true, - Description: "The associated subnet.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "crn": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The CRN for this subnet.", - }, - "deleted": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "more_info": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Link to documentation about deleted resources.", - }, - }, - }, - }, - "href": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The URL for this subnet.", - }, - "subnet": &schema.Schema{ - Type: schema.TypeString, - Required: true, - Description: "The unique identifier for this subnet.", - }, - "name": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The name for this subnet. The name is unique across all subnets in the VPC.", - }, - "resource_type": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The resource type.", - }, - }, - }, + Description: "The associated subnet id.", }, "created_at": &schema.Schema{ Type: schema.TypeString, @@ -404,23 +302,9 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { }, }, "zone": &schema.Schema{ - Type: schema.TypeList, + Type: schema.TypeString, Computed: true, - Description: "The zone this virtual network interface resides in.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "href": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The URL for this zone.", - }, - "name": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The globally unique name for this zone.", - }, - }, - }, + Description: "The zone name this virtual network interface resides in.", }, }, } @@ -492,20 +376,20 @@ func resourceIBMIsVirtualNetworkInterfaceCreate(context context.Context, d *sche } if _, ok := d.GetOk("security_groups"); ok { var securityGroups []vpcv1.SecurityGroupIdentityIntf - for _, v := range d.Get("security_groups").([]interface{}) { - value := v.(map[string]interface{}) - securityGroupsItem, err := resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentity(value) - if err != nil { - return diag.FromErr(err) + sg := d.Get("security_groups").(*schema.Set) + for _, v := range sg.List() { + value := v.(string) + securityGroupsItem := &vpcv1.SecurityGroupIdentity{ + ID: &value, } securityGroups = append(securityGroups, securityGroupsItem) } createVirtualNetworkInterfaceOptions.SetSecurityGroups(securityGroups) } - if _, ok := d.GetOk("subnet"); ok { - subnetModel, err := resourceIBMIsVirtualNetworkInterfaceMapToSubnetIdentity(d.Get("subnet.0").(map[string]interface{})) - if err != nil { - return diag.FromErr(err) + if subnetOk, ok := d.GetOk("subnet"); ok { + subnetid := subnetOk.(string) + subnetModel := &vpcv1.SubnetIdentity{ + ID: &subnetid, } createVirtualNetworkInterfaceOptions.SetSubnet(subnetModel) } @@ -584,35 +468,21 @@ func resourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema } } if !core.IsNil(virtualNetworkInterface.ResourceGroup) { - resourceGroupMap, err := resourceIBMIsVirtualNetworkInterfaceResourceGroupReferenceToMap(virtualNetworkInterface.ResourceGroup) - if err != nil { - return diag.FromErr(err) - } - if err = d.Set("resource_group", []map[string]interface{}{resourceGroupMap}); err != nil { - return diag.FromErr(fmt.Errorf("Error setting resource_group: %s", err)) - } + d.Set("resource_group", virtualNetworkInterface.ResourceGroup.ID) } if !core.IsNil(virtualNetworkInterface.SecurityGroups) { - securityGroups := []map[string]interface{}{} + securityGroups := make([]string, 0) for _, securityGroupsItem := range virtualNetworkInterface.SecurityGroups { - securityGroupsItemMap, err := resourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceToMap(&securityGroupsItem) - if err != nil { - return diag.FromErr(err) + if securityGroupsItem.ID != nil { + securityGroups = append(securityGroups, *securityGroupsItem.ID) } - securityGroups = append(securityGroups, securityGroupsItemMap) } if err = d.Set("security_groups", securityGroups); err != nil { - return diag.FromErr(fmt.Errorf("Error setting security_groups: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting security_groups for vni: %s", err)) } } if !core.IsNil(virtualNetworkInterface.Subnet) { - subnetMap, err := resourceIBMIsVirtualNetworkInterfaceSubnetReferenceToMap(virtualNetworkInterface.Subnet) - if err != nil { - return diag.FromErr(err) - } - if err = d.Set("subnet", []map[string]interface{}{subnetMap}); err != nil { - return diag.FromErr(fmt.Errorf("Error setting subnet: %s", err)) - } + d.Set("subnet", virtualNetworkInterface.Subnet.ID) } if err = d.Set("created_at", flex.DateTimeToString(virtualNetworkInterface.CreatedAt)); err != nil { return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) @@ -652,12 +522,9 @@ func resourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema if err = d.Set("vpc", []map[string]interface{}{vpcMap}); err != nil { return diag.FromErr(fmt.Errorf("Error setting vpc: %s", err)) } - zoneMap, err := resourceIBMIsVirtualNetworkInterfaceZoneReferenceToMap(virtualNetworkInterface.Zone) - if err != nil { - return diag.FromErr(err) - } - if err = d.Set("zone", []map[string]interface{}{zoneMap}); err != nil { - return diag.FromErr(fmt.Errorf("Error setting zone: %s", err)) + + if virtualNetworkInterface.Zone != nil { + d.Set("zone", *virtualNetworkInterface.Zone.Name) } return nil @@ -778,70 +645,6 @@ func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrototypeRe return model, nil } -func resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentity(modelMap map[string]interface{}) (vpcv1.SecurityGroupIdentityIntf, error) { - model := &vpcv1.SecurityGroupIdentity{} - if modelMap["security_group"] != nil && modelMap["security_group"].(string) != "" { - model.ID = core.StringPtr(modelMap["security_group"].(string)) - } - if modelMap["crn"] != nil && modelMap["crn"].(string) != "" { - model.CRN = core.StringPtr(modelMap["crn"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { - model.Href = core.StringPtr(modelMap["href"].(string)) - } - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentityByID(modelMap map[string]interface{}) (*vpcv1.SecurityGroupIdentityByID, error) { - model := &vpcv1.SecurityGroupIdentityByID{} - model.ID = core.StringPtr(modelMap["security_group"].(string)) - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentityByCRN(modelMap map[string]interface{}) (*vpcv1.SecurityGroupIdentityByCRN, error) { - model := &vpcv1.SecurityGroupIdentityByCRN{} - model.CRN = core.StringPtr(modelMap["crn"].(string)) - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToSecurityGroupIdentityByHref(modelMap map[string]interface{}) (*vpcv1.SecurityGroupIdentityByHref, error) { - model := &vpcv1.SecurityGroupIdentityByHref{} - model.Href = core.StringPtr(modelMap["href"].(string)) - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToSubnetIdentity(modelMap map[string]interface{}) (vpcv1.SubnetIdentityIntf, error) { - model := &vpcv1.SubnetIdentity{} - if modelMap["subnet"] != nil && modelMap["subnet"].(string) != "" { - model.ID = core.StringPtr(modelMap["subnet"].(string)) - } - if modelMap["crn"] != nil && modelMap["crn"].(string) != "" { - model.CRN = core.StringPtr(modelMap["crn"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { - model.Href = core.StringPtr(modelMap["href"].(string)) - } - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToSubnetIdentityByID(modelMap map[string]interface{}) (*vpcv1.SubnetIdentityByID, error) { - model := &vpcv1.SubnetIdentityByID{} - model.ID = core.StringPtr(modelMap["subnet"].(string)) - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToSubnetIdentityByCRN(modelMap map[string]interface{}) (*vpcv1.SubnetIdentityByCRN, error) { - model := &vpcv1.SubnetIdentityByCRN{} - model.CRN = core.StringPtr(modelMap["crn"].(string)) - return model, nil -} - -func resourceIBMIsVirtualNetworkInterfaceMapToSubnetIdentityByHref(modelMap map[string]interface{}) (*vpcv1.SubnetIdentityByHref, error) { - model := &vpcv1.SubnetIdentityByHref{} - model.Href = core.StringPtr(modelMap["href"].(string)) - return model, nil -} - func resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcv1.ReservedIPReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["address"] = model.Address @@ -865,14 +668,6 @@ func resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model * return modelMap, nil } -func resourceIBMIsVirtualNetworkInterfaceResourceGroupReferenceToMap(model *vpcv1.ResourceGroupReference) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - modelMap["href"] = model.Href - modelMap["id"] = model.ID - modelMap["name"] = model.Name - return modelMap, nil -} - func resourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceToMap(model *vpcv1.SecurityGroupReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["crn"] = model.CRN @@ -895,29 +690,6 @@ func resourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceDeletedToMap(mode return modelMap, nil } -func resourceIBMIsVirtualNetworkInterfaceSubnetReferenceToMap(model *vpcv1.SubnetReference) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - modelMap["crn"] = model.CRN - if model.Deleted != nil { - deletedMap, err := resourceIBMIsVirtualNetworkInterfaceSubnetReferenceDeletedToMap(model.Deleted) - if err != nil { - return modelMap, err - } - modelMap["deleted"] = []map[string]interface{}{deletedMap} - } - modelMap["href"] = model.Href - modelMap["subnet"] = model.ID - modelMap["name"] = model.Name - modelMap["resource_type"] = model.ResourceType - return modelMap, nil -} - -func resourceIBMIsVirtualNetworkInterfaceSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - modelMap["more_info"] = model.MoreInfo - return modelMap, nil -} - func resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetToMap(model vpcv1.VirtualNetworkInterfaceTargetIntf) (map[string]interface{}, error) { if _, ok := model.(*vpcv1.VirtualNetworkInterfaceTargetShareMountTargetReference); ok { return resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMountTargetReferenceToMap(model.(*vpcv1.VirtualNetworkInterfaceTargetShareMountTargetReference)) @@ -1041,10 +813,3 @@ func resourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcv1.V modelMap["more_info"] = model.MoreInfo return modelMap, nil } - -func resourceIBMIsVirtualNetworkInterfaceZoneReferenceToMap(model *vpcv1.ZoneReference) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - modelMap["href"] = model.Href - modelMap["name"] = model.Name - return modelMap, nil -} diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go index 6aa877bdc0..b35f21a25e 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go @@ -140,11 +140,12 @@ func resourceIBMIsVirtualNetworkInterfaceFloatingIPGet(d *schema.ResourceData, f if err := d.Set("href", floatingIP.Href); err != nil { return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) } - if deleted, err := resourceIBMIsVirtualNetworkInterfaceFloatingIPNetworkInterfaceReferenceDeletedToMap(floatingIP.Deleted); err != nil { - return diag.FromErr(fmt.Errorf("Error setting status: %s", err)) - } else { - d.Set("deleted", deleted) + deleted := make(map[string]interface{}) + + if floatingIP.Deleted != nil && floatingIP.Deleted.MoreInfo != nil { + deleted["more_info"] = floatingIP.Deleted } + d.Set("deleted", []map[string]interface{}{deleted}) return nil } @@ -174,26 +175,6 @@ func resourceIBMIsVirtualNetworkInterfaceFloatingIPDelete(context context.Contex return nil } -func resourceIBMIsVirtualNetworkInterfaceFloatingIPNetworkInterfaceReferenceDeletedToMap(model *vpcv1.FloatingIPReferenceDeleted) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - if model != nil { - modelMap["more_info"] = model.MoreInfo - } - return modelMap, nil -} - -func resourceIBMIsVirtualNetworkInterfaceFloatingIPReservedIPReferenceDeletedToMap(model *vpcv1.FloatingIPReferenceDeleted) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - if model != nil { - deletedMap, err := resourceIBMIsVirtualNetworkInterfaceFloatingIPNetworkInterfaceReferenceDeletedToMap(model) - if err != nil { - return modelMap, err - } - modelMap["deleted"] = []map[string]interface{}{deletedMap} - } - return modelMap, nil -} - func MakeTerraformVNIFloatingIpID(id1, id2 string) string { // Include both virtual network interface id and floating ip id to create a unique Terraform id. As a bonus, // we can extract the bare metal sever id as needed for API calls such as READ. diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go index 8493134d37..e3df36f87a 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go @@ -17,16 +17,35 @@ import ( func TestAccIBMIsVirtualNetworkInterfaceBasic(t *testing.T) { var conf vpcv1.VirtualNetworkInterface - + vpcname := fmt.Sprintf("tfvpngw-vpc-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfvpngw-subnet-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tfvpngw-createname-%d", acctest.RandIntRange(10, 100)) + enable_infrastructure_nat := true + allow_ip_spoofing := true resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic(), + Config: testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic(vpcname, subnetname, vniname, enable_infrastructure_nat, allow_ip_spoofing), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIBMIsVirtualNetworkInterfaceExists("ibm_is_virtual_network_interface.is_virtual_network_interface", conf), + testAccCheckIBMIsVirtualNetworkInterfaceExists("ibm_is_virtual_network_interface.testacc_vni", conf), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "subnet"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "name"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "created_at"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "crn"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "href"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "vpc.#"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "zone"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "primary_ip.#"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "ips.#"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "id"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "enable_infrastructure_nat", "true"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "lifecycle_state", "stable"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "resource_type", "virtual_network_interface"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "resource_group"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "allow_ip_spoofing", "true"), ), }, }, @@ -77,11 +96,27 @@ func TestAccIBMIsVirtualNetworkInterfaceAllArgs(t *testing.T) { }) } -func testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic() string { +func testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic(vpcname, subnetname, vniname string, enablenat, allowipspoofing bool) string { return fmt.Sprintf(` - resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instance" { - } - `) + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + total_ipv4_address_count = 16 + + } + + resource "ibm_is_virtual_network_interface" "testacc_vni"{ + name = "%s" + subnet = ibm_is_subnet.testacc_subnet.id + enable_infrastructure_nat = %t + allow_ip_spoofing = %t + } + `, vpcname, subnetname, acc.ISZoneName, vniname, enablenat, allowipspoofing) } func testAccCheckIBMIsVirtualNetworkInterfaceConfig(allowIPSpoofing string, autoDelete string, enableInfrastructureNat string, name string) string { From eb94f909654719ed246bffe3b22c6b1617ce5704 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 4 Oct 2023 17:15:29 +0530 Subject: [PATCH 018/132] updated tests --- ...tual_network_interface_floating_ip_test.go | 99 ++---------- ...ual_network_interface_floating_ips_test.go | 107 ++----------- ...bm_is_virtual_network_interface_ip_test.go | 101 +++--------- ...m_is_virtual_network_interface_ips_test.go | 110 ++----------- ...tual_network_interface_floating_ip_test.go | 146 +++++++----------- ...bm_is_virtual_network_interface_ip_test.go | 112 +++++--------- 6 files changed, 153 insertions(+), 522 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go index 575b113c8e..2bf1e0d8a8 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go @@ -14,110 +14,35 @@ import ( ) func TestAccIBMIsVirtualNetworkInterfaceFloatingIPDataSourceBasic(t *testing.T) { + vpcname := fmt.Sprintf("tfp-vpc-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfp-subnet-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tfp-createname-%d", acctest.RandIntRange(10, 100)) + floatingipname := fmt.Sprintf("tfp-reservedip-%d", acctest.RandIntRange(10, 100)) resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDataSourceConfigBasic(), + Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDataSourceConfigBasic(vpcname, subnetname, vniname, floatingipname), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "instance_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "network_interface_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "address"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "created_at"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "crn"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "href"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "name"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "resource_group.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "status"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "zone.#"), - ), - }, - }, - }) -} - -func TestAccIBMIsVirtualNetworkInterfaceFloatingIPDataSourceAllArgs(t *testing.T) { - floatingIPName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDataSourceConfig(floatingIPName), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "instance_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "network_interface_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "id"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "address"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "created_at"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "floating_ip"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "id"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "name"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "resource_group.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "status"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "target.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "zone.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ip.is_floating_ip", "virtual_network_interface"), ), }, }, }) } -func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDataSourceConfigBasic() string { - return fmt.Sprintf(` - resource "ibm_is_floating_ip" "is_floating_ip_instance" { - } - +func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDataSourceConfigBasic(vpcname, subnetname, vniname, floatingipname string) string { + return testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfigBasic(vpcname, subnetname, vniname, floatingipname) + fmt.Sprintf(` data "ibm_is_virtual_network_interface_floating_ip" "is_floating_ip_instance" { - virtual_network_interface = "virtual_network_interface_id" - floating_ip = "floating_ip_id" + virtual_network_interface = ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip.virtual_network_interface + floating_ip = ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip.floating_ip } `) } - -func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDataSourceConfig(floatingIPName string) string { - return fmt.Sprintf(` - resource "ibm_is_floating_ip" "is_floating_ip_instance" { - name = "%s" - resource_group { - href = "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345" - id = "fee82deba12e4c0fb69c3b09d1f12345" - name = "my-resource-group" - } - target { - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" - id = "10c02d81-0ecb-4dc5-897d-28392913b81e" - name = "my-instance-network-interface" - primary_ip { - address = "192.168.3.4" - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - name = "my-reserved-ip" - resource_type = "subnet_reserved_ip" - } - resource_type = "network_interface" - } - zone { - href = "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1" - name = "us-south-1" - } - } - - data "ibm_is_floating_ip" "is_floating_ip_instance" { - instance_id = "instance_id" - network_interface_id = "network_interface_id" - id = "id" - } - `, floatingIPName) -} diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips_test.go index cba2e2623b..3214930050 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips_test.go @@ -14,111 +14,32 @@ import ( ) func TestAccIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceBasic(t *testing.T) { + vpcname := fmt.Sprintf("tfp-vpc-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfp-subnet-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tfp-createname-%d", acctest.RandIntRange(10, 100)) + floatingipname := fmt.Sprintf("tfp-reservedip-%d", acctest.RandIntRange(10, 100)) resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceConfigBasic(), + Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceConfigBasic(vpcname, subnetname, vniname, floatingipname), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "instance_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "network_interface_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "address"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "created_at"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "crn"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "href"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "name"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "resource_group.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "status"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.0", "zone.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.floating_ips.0", "address"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.floating_ips.0", "crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.floating_ips.0", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.floating_ips.0", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.floating_ips.0", "name"), ), }, }, }) } -func TestAccIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceAllArgs(t *testing.T) { - floatingIPName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceConfig(floatingIPName), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "instance_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "network_interface_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "address"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "created_at"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "crn"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "href"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "name"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "resource_group.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "status"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "target.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_floating_ip.is_floating_ip", "zone.#"), - ), - }, - }, - }) -} - -func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceConfigBasic() string { - return fmt.Sprintf(` - resource "ibm_is_floating_ip" "is_floating_ip_instance" { - } - - data "ibm_is_floating_ip" "is_floating_ip_instance" { - instance_id = "instance_id" - network_interface_id = "network_interface_id" - id = "id" +func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceConfigBasic(vpcname, subnetname, vniname, floatingipname string) string { + return testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfigBasic(vpcname, subnetname, vniname, floatingipname) + fmt.Sprintf(` + data "ibm_is_virtual_network_interface_floating_ips" "is_floating_ips" { + virtual_network_interface = ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip.virtual_network_interface } `) } - -func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceConfig(floatingIPName string) string { - return fmt.Sprintf(` - resource "ibm_is_floating_ip" "is_floating_ip_instance" { - name = "%s" - resource_group { - href = "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345" - id = "fee82deba12e4c0fb69c3b09d1f12345" - name = "my-resource-group" - } - target { - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" - id = "10c02d81-0ecb-4dc5-897d-28392913b81e" - name = "my-instance-network-interface" - primary_ip { - address = "192.168.3.4" - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - name = "my-reserved-ip" - resource_type = "subnet_reserved_ip" - } - resource_type = "network_interface" - } - zone { - href = "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1" - name = "us-south-1" - } - } - - data "ibm_is_floating_ip" "is_floating_ip_instance" { - instance_id = "instance_id" - network_interface_id = "network_interface_id" - id = "id" - } - `, floatingIPName) -} diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip_test.go index 1d0309e257..3195688cd3 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip_test.go @@ -14,100 +14,35 @@ import ( ) func TestAccIBMIsVirtualNetworkInterfaceIpDataSourceBasic(t *testing.T) { - virtualNetworkInterfaceIpSubnetID := fmt.Sprintf("tf_vni_id_%d", acctest.RandIntRange(10, 100)) - + vpcname := fmt.Sprintf("tfp-vpc-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfp-subnet-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tfp-createname-%d", acctest.RandIntRange(10, 100)) + reservedipname := fmt.Sprintf("tfp-reservedip-%d", acctest.RandIntRange(10, 100)) resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceIpDataSourceConfigBasic(virtualNetworkInterfaceIpSubnetID), + Config: testAccCheckIBMIsVirtualNetworkInterfaceIpDataSourceConfigBasic(vpcname, subnetname, vniname, reservedipname), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "subnet_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "address"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "auto_delete"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "created_at"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "href"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "reserved_ip_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "lifecycle_state"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "name"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "owner"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ip.is_reserved_ip", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ip.is_reserved_ip", "address"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ip.is_reserved_ip", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ip.is_reserved_ip", "reserved_ip"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ip.is_reserved_ip", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ip.is_reserved_ip", "resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ip.is_reserved_ip", "virtual_network_interface"), ), }, }, }) } -func TestAccIBMIsVirtualNetworkInterfaceIpDataSourceAllArgs(t *testing.T) { - virtualNetworkInterfaceIpSubnetID := fmt.Sprintf("tf_subnet_id_%d", acctest.RandIntRange(10, 100)) - virtualNetworkInterfaceIpAddress := fmt.Sprintf("tf_address_%d", acctest.RandIntRange(10, 100)) - virtualNetworkInterfaceIpAutoDelete := "false" - virtualNetworkInterfaceIpName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceIpDataSourceConfig(virtualNetworkInterfaceIpSubnetID, virtualNetworkInterfaceIpAddress, virtualNetworkInterfaceIpAutoDelete, virtualNetworkInterfaceIpName), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "subnet_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "address"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "auto_delete"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "created_at"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "href"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "reserved_ip_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "lifecycle_state"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "name"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "owner"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "resource_type"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ip.is_reserved_ip", "target.#"), - ), - }, - }, - }) -} - -func testAccCheckIBMIsVirtualNetworkInterfaceIpDataSourceConfigBasic(virtualNetworkInterfaceIpSubnetID string) string { - return fmt.Sprintf(` - resource "ibm_is_reserved_ip" "is_reserved_ip_instance" { - subnet_id = "%s" - } - - data "ibm_is_reserved_ip" "is_reserved_ip_instance" { - subnet_id = ibm_is_reserved_ip.is_reserved_ip.subnet_id - id = "id" - } - `, virtualNetworkInterfaceIpSubnetID) -} - -func testAccCheckIBMIsVirtualNetworkInterfaceIpDataSourceConfig(virtualNetworkInterfaceIpSubnetID string, virtualNetworkInterfaceIpAddress string, virtualNetworkInterfaceIpAutoDelete string, virtualNetworkInterfaceIpName string) string { - return fmt.Sprintf(` - resource "ibm_is_reserved_ip" "is_reserved_ip_instance" { - subnet_id = "%s" - address = "%s" - auto_delete = %s - name = "%s" - target { - crn = "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" - id = "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" - name = "my-endpoint-gateway" - resource_type = "endpoint_gateway" - } - } - - data "ibm_is_reserved_ip" "is_reserved_ip_instance" { - subnet_id = ibm_is_reserved_ip.is_reserved_ip.subnet_id - id = "id" +func testAccCheckIBMIsVirtualNetworkInterfaceIpDataSourceConfigBasic(vpcname, subnetname, vniname, reservedipname string) string { + return testAccCheckIBMIsVirtualNetworkInterfaceIPConfigBasic(vpcname, subnetname, vniname, reservedipname) + fmt.Sprintf(` + data "ibm_is_virtual_network_interface_ip" "is_reserved_ip" { + virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id + reserved_ip = ibm_is_subnet_reserved_ip.testacc_reservedip.reserved_ip } - `, virtualNetworkInterfaceIpSubnetID, virtualNetworkInterfaceIpAddress, virtualNetworkInterfaceIpAutoDelete, virtualNetworkInterfaceIpName) + `) } diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go index 71c2024065..7ed03ea21a 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go @@ -14,110 +14,34 @@ import ( ) func TestAccIBMIsVirtualNetworkInterfaceIpsDataSourceBasic(t *testing.T) { - virtualNetworkInterfaceIpSubnetID := fmt.Sprintf("tf_subnet_id_%d", acctest.RandIntRange(10, 100)) - + vpcname := fmt.Sprintf("tfp-vpc-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfp-subnet-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tfp-createname-%d", acctest.RandIntRange(10, 100)) + reservedipname := fmt.Sprintf("tfp-reservedip-%d", acctest.RandIntRange(10, 100)) resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceIpsDataSourceConfigBasic(virtualNetworkInterfaceIpSubnetID), + Config: testAccCheckIBMIsVirtualNetworkInterfaceIpsDataSourceConfigBasic(vpcname, subnetname, vniname, reservedipname), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "subnet_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "first.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "limit"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "total_count"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "address"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "reserved_ip"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "virtual_network_interface"), ), }, }, }) } -func TestAccIBMIsVirtualNetworkInterfaceIpsDataSourceAllArgs(t *testing.T) { - virtualNetworkInterfaceIpSubnetID := fmt.Sprintf("tf_subnet_id_%d", acctest.RandIntRange(10, 100)) - virtualNetworkInterfaceIpAddress := fmt.Sprintf("tf_address_%d", acctest.RandIntRange(10, 100)) - virtualNetworkInterfaceIpAutoDelete := "false" - virtualNetworkInterfaceIpName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceIpsDataSourceConfig(virtualNetworkInterfaceIpSubnetID, virtualNetworkInterfaceIpAddress, virtualNetworkInterfaceIpAutoDelete, virtualNetworkInterfaceIpName), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "subnet_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "sort"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "target_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "target_crn"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "target_name"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "target_resource_type"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "first.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "limit"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "next.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.#"), - resource.TestCheckResourceAttr("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.address", virtualNetworkInterfaceIpAddress), - resource.TestCheckResourceAttr("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.auto_delete", virtualNetworkInterfaceIpAutoDelete), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.created_at"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.href"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.id"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.lifecycle_state"), - resource.TestCheckResourceAttr("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.name", virtualNetworkInterfaceIpName), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.owner"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "reserved_ips.0.resource_type"), - resource.TestCheckResourceAttrSet("data.ibm_is_reserved_ips.is_reserved_ips", "total_count"), - ), - }, - }, - }) -} - -func testAccCheckIBMIsVirtualNetworkInterfaceIpsDataSourceConfigBasic(virtualNetworkInterfaceIpSubnetID string) string { - return fmt.Sprintf(` - resource "ibm_is_reserved_ip" "is_reserved_ip_instance" { - subnet_id = "%s" - } - - data "ibm_is_reserved_ips" "is_reserved_ips_instance" { - subnet_id = ibm_is_reserved_ip.is_reserved_ip.subnet_id - sort = "name" - target.id = "target.id" - target.crn = "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727" - target.name = "my-resource" - target.resource_type = "target.resource_type" - } - `, virtualNetworkInterfaceIpSubnetID) -} - -func testAccCheckIBMIsVirtualNetworkInterfaceIpsDataSourceConfig(virtualNetworkInterfaceIpSubnetID string, virtualNetworkInterfaceIpAddress string, virtualNetworkInterfaceIpAutoDelete string, virtualNetworkInterfaceIpName string) string { - return fmt.Sprintf(` - resource "ibm_is_reserved_ip" "is_reserved_ip_instance" { - subnet_id = "%s" - address = "%s" - auto_delete = %s - name = "%s" - target { - crn = "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" - id = "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" - name = "my-endpoint-gateway" - resource_type = "endpoint_gateway" - } - } - - data "ibm_is_reserved_ips" "is_reserved_ips_instance" { - subnet_id = ibm_is_reserved_ip.is_reserved_ip.subnet_id - sort = "name" - target.id = "target.id" - target.crn = "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727" - target.name = "my-resource" - target.resource_type = "target.resource_type" +func testAccCheckIBMIsVirtualNetworkInterfaceIpsDataSourceConfigBasic(vpcname, subnetname, vniname, reservedipname string) string { + return testAccCheckIBMIsVirtualNetworkInterfaceIPConfigBasic(vpcname, subnetname, vniname, reservedipname) + fmt.Sprintf(` + data "ibm_is_virtual_network_interface_ips" "is_reserved_ips" { + virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id } - `, virtualNetworkInterfaceIpSubnetID, virtualNetworkInterfaceIpAddress, virtualNetworkInterfaceIpAutoDelete, virtualNetworkInterfaceIpName) + `) } diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go index fd8909099e..a079d4e28e 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go @@ -12,116 +12,68 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/vpc" "github.com/IBM/vpc-go-sdk/vpcv1" ) func TestAccIBMIsVirtualNetworkInterfaceFloatingIPBasic(t *testing.T) { var conf vpcv1.FloatingIPReference - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfigBasic(), - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPExists("ibm_is_floating_ip.is_floating_ip", conf), - ), - }, - }, - }) -} - -func TestAccIBMIsVirtualNetworkInterfaceFloatingIPAllArgs(t *testing.T) { - var conf vpcv1.FloatingIPReference - name := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - nameUpdate := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - + vpcname := fmt.Sprintf("tfp-vpc-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfp-subnet-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tfp-createname-%d", acctest.RandIntRange(10, 100)) + floatingipname := fmt.Sprintf("tfp-reservedip-%d", acctest.RandIntRange(10, 100)) resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfig(name), + Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfigBasic(vpcname, subnetname, vniname, floatingipname), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPExists("ibm_is_floating_ip.is_floating_ip", conf), - resource.TestCheckResourceAttr("ibm_is_floating_ip.is_floating_ip", "name", name), + testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPExists("ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip", conf), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip", "address"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip", "crn"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip", "href"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip", "id"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip", "name"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip", "virtual_network_interface"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip", "floating_ip"), ), }, - resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfig(nameUpdate), - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("ibm_is_floating_ip.is_floating_ip", "name", nameUpdate), - ), - }, - resource.TestStep{ - ResourceName: "ibm_is_floating_ip.is_floating_ip", - ImportState: true, - ImportStateVerify: true, - }, }, }) } -func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfigBasic() string { - return fmt.Sprintf(` - resource "ibm_is_floating_ip" "is_floating_ip_instance" { - } - `) -} - -func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfig(name string) string { +func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfigBasic(vpcname, subnetname, vniname, floatingipname string) string { return fmt.Sprintf(` - resource "ibm_is_floating_ip" "fip" { - name = "%s" - zone = "%s" - } - resource "ibm_is_virtual_network_interface" "vni" { - allow_ip_spoofing = %s - auto_delete = %s - enable_infrastructure_nat = %s - ips { - address = "192.168.3.4" - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - name = "my-reserved-ip" - } - name = "%s" - primary_ip { - address = "192.168.3.4" - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - name = "my-reserved-ip" - } - resource_group { - id = "fee82deba12e4c0fb69c3b09d1f12345" - } - security_groups { - crn = "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" - id = "be5df5ca-12a0-494b-907e-aa6ec2bfa271" - name = "my-security-group" - } - subnet { - crn = "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - id = "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - } - } - resource "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { - virtual_network_interface = ibm_is_virtual_network_interface.vni.id - flaoting_ip = ibm_is_floating_ip.fip.id - } - - `, name, acc.ISZoneName, name, acc.ISZoneName, name, acc.ISZoneName) + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + total_ipv4_address_count = 16 + + } + + resource "ibm_is_virtual_network_interface" "testacc_vni"{ + name = "%s" + subnet = ibm_is_subnet.testacc_subnet.id + } + + resource "ibm_is_floating_ip" "testacc_floatingip" { + name = "%s" + zone = ibm_is_subnet.testacc_subnet.zone + } + resource "ibm_is_virtual_network_interface_floating_ip" "testacc_vni_floatingip" { + virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id + floating_ip = ibm_is_floating_ip.testacc_floatingip.id + } + `, vpcname, subnetname, acc.ISZoneName, vniname, floatingipname) } - func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPExists(n string, obj vpcv1.FloatingIPReference) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -134,10 +86,14 @@ func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPExists(n string, obj vpcv if err != nil { return err } - + vniid, fipid, err := vpc.ParseVNIFloatingIpTerraformID(rs.Primary.ID) + if err != nil { + return err + } getVirtualNetworkInterfaceFloatingIPOptions := &vpcv1.GetNetworkInterfaceFloatingIPOptions{} - getVirtualNetworkInterfaceFloatingIPOptions.SetID(rs.Primary.ID) + getVirtualNetworkInterfaceFloatingIPOptions.SetVirtualNetworkInterfaceID(vniid) + getVirtualNetworkInterfaceFloatingIPOptions.SetID(fipid) floatingIP, _, err := sess.GetNetworkInterfaceFloatingIP(getVirtualNetworkInterfaceFloatingIPOptions) if err != nil { @@ -158,10 +114,14 @@ func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDestroy(s *terraform.Stat if rs.Type != "ibm_is_floating_ip" { continue } - + vniid, fipid, err := vpc.ParseVNIFloatingIpTerraformID(rs.Primary.ID) + if err != nil { + return err + } getVirtualNetworkInterfaceFloatingIPOptions := &vpcv1.GetNetworkInterfaceFloatingIPOptions{} - getVirtualNetworkInterfaceFloatingIPOptions.SetID(rs.Primary.ID) + getVirtualNetworkInterfaceFloatingIPOptions.SetVirtualNetworkInterfaceID(vniid) + getVirtualNetworkInterfaceFloatingIPOptions.SetID(fipid) // Try to find the key _, response, err := sess.GetNetworkInterfaceFloatingIP(getVirtualNetworkInterfaceFloatingIPOptions) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip_test.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip_test.go index c42683590a..c82531c5aa 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip_test.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip_test.go @@ -18,95 +18,61 @@ import ( func TestAccIBMIsVirtualNetworkInterfaceIPBasic(t *testing.T) { var conf vpcv1.ReservedIPReference - subnetID := fmt.Sprintf("tf_subnet_id_%d", acctest.RandIntRange(10, 100)) - + vpcname := fmt.Sprintf("tfp-vpc-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfp-subnet-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tfp-createname-%d", acctest.RandIntRange(10, 100)) + reservedipname := fmt.Sprintf("tfp-reservedip-%d", acctest.RandIntRange(10, 100)) resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceIPDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceIPConfigBasic(subnetID), + Config: testAccCheckIBMIsVirtualNetworkInterfaceIPConfigBasic(vpcname, subnetname, vniname, reservedipname), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIBMIsVirtualNetworkInterfaceIPExists("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", conf), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "subnet_id", subnetID), + testAccCheckIBMIsVirtualNetworkInterfaceIPExists("ibm_is_virtual_network_interface_ip.testacc_vni_reservedip", conf), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.testacc_vni_reservedip", "resource_type", "subnet_reserved_ip"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface_ip.testacc_vni_reservedip", "address"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface_ip.testacc_vni_reservedip", "href"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface_ip.testacc_vni_reservedip", "id"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface_ip.testacc_vni_reservedip", "name"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface_ip.testacc_vni_reservedip", "reserved_ip"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface_ip.testacc_vni_reservedip", "virtual_network_interface"), ), }, }, }) } -func TestAccIBMIsVirtualNetworkInterfaceIPAllArgs(t *testing.T) { - var conf vpcv1.ReservedIPReference - subnetID := fmt.Sprintf("tf_subnet_id_%d", acctest.RandIntRange(10, 100)) - address := fmt.Sprintf("tf_address_%d", acctest.RandIntRange(10, 100)) - autoDelete := "false" - name := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - addressUpdate := fmt.Sprintf("tf_address_%d", acctest.RandIntRange(10, 100)) - autoDeleteUpdate := "true" - nameUpdate := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceIPDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceIPConfig(subnetID, address, autoDelete, name), - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIBMIsVirtualNetworkInterfaceIPExists("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", conf), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "subnet_id", subnetID), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "address", address), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "auto_delete", autoDelete), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "name", name), - ), - }, - resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceIPConfig(subnetID, addressUpdate, autoDeleteUpdate, nameUpdate), - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "subnet_id", subnetID), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "address", addressUpdate), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "auto_delete", autoDeleteUpdate), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", "name", nameUpdate), - ), - }, - resource.TestStep{ - ResourceName: "ibm_is_virtual_network_interface_ip.is_virtual_network_interface_ip", - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func testAccCheckIBMIsVirtualNetworkInterfaceIPConfigBasic(subnetID string) string { +func testAccCheckIBMIsVirtualNetworkInterfaceIPConfigBasic(vpcname, subnetname, vniname, reservedipname string) string { return fmt.Sprintf(` - resource "ibm_is_virtual_network_interface_ip" "is_virtual_network_interface_ip_instance" { - subnet_id = "%s" - } - `, subnetID) -} + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + total_ipv4_address_count = 16 + + } + + resource "ibm_is_virtual_network_interface" "testacc_vni"{ + name = "%s" + subnet = ibm_is_subnet.testacc_subnet.id + } -func testAccCheckIBMIsVirtualNetworkInterfaceIPConfig(subnetID string, address string, autoDelete string, name string) string { - return fmt.Sprintf(` + resource "ibm_is_subnet_reserved_ip" "testacc_reservedip" { + subnet = ibm_is_subnet.testacc_subnet.id + name = "%s" + } + resource "ibm_is_virtual_network_interface_ip" "testacc_vni_reservedip" { + virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id + reserved_ip = ibm_is_subnet_reserved_ip.testacc_reservedip.reserved_ip + } - resource "ibm_is_virtual_network_interface_ip" "is_virtual_network_interface_ip_instance" { - subnet_id = "%s" - address = "%s" - auto_delete = %s - name = "%s" - target { - crn = "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" - id = "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5" - name = "my-endpoint-gateway" - resource_type = "endpoint_gateway" - } - } - `, subnetID, address, autoDelete, name) + `, vpcname, subnetname, acc.ISZoneName, vniname, reservedipname) } func testAccCheckIBMIsVirtualNetworkInterfaceIPExists(n string, obj vpcv1.ReservedIPReference) resource.TestCheckFunc { From 980f404dce1ab69fbe878f2640afb1a89e702d8e Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 4 Oct 2023 17:16:22 +0530 Subject: [PATCH 019/132] Update main.tf --- examples/ibm-is-ng/main.tf | 97 ++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 51 deletions(-) diff --git a/examples/ibm-is-ng/main.tf b/examples/ibm-is-ng/main.tf index fbc7bac6f8..1eaa046747 100644 --- a/examples/ibm-is-ng/main.tf +++ b/examples/ibm-is-ng/main.tf @@ -1388,64 +1388,59 @@ resource "ibm_is_image_obsolete" "example" { // vni -resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instance" { - allow_ip_spoofing = true - auto_delete = true - enable_infrastructure_nat = true - ips { - address = "192.168.3.4" - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - name = "my-reserved-ip" - } - name = "my-virtual-network-interface" - primary_ip { - address = "192.168.3.4" - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - name = "my-reserved-ip" - } - resource_group { - id = "fee82deba12e4c0fb69c3b09d1f12345" - } - security_groups { - crn = "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" - id = "be5df5ca-12a0-494b-907e-aa6ec2bfa271" - name = "my-security-group" - } - subnet { - crn = "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - id = "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - } + +resource "ibm_is_vpc" "testacc_vpc" { + name = "${var.name}-vpc" } -resource "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { - virtual_network_interface = - floating_ip = + +resource "ibm_is_subnet" "testacc_subnet" { + name = "${var.name}-subnet" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "${var.region}-2" + total_ipv4_address_count = 16 + } -data "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { - virtual_network_interface = - floating_ip = +resource "ibm_is_virtual_network_interface" "testacc_vni"{ + name = "${var.name}" + subnet = ibm_is_subnet.testacc_subnet.id + enable_infrastructure_nat = true + allow_ip_spoofing = true } -data "ibm_is_virtual_network_interface_floating_ips" "vni_fips" { - virtual_network_interface = +resource "ibm_is_floating_ip" "testacc_floatingip" { + name = "${var.name}-floating" + zone = ibm_is_subnet.testacc_subnet.zone +} +resource "ibm_is_virtual_network_interface_floating_ip" "testacc_vni_floatingip" { + virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id + floating_ip = ibm_is_floating_ip.testacc_floatingip.id +} +data "ibm_is_virtual_network_interface_floating_ip" "is_vni_floating_ip" { + depends_on = [ ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip ] + virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id + floating_ip = ibm_is_floating_ip.testacc_floatingip.id +} +data "ibm_is_virtual_network_interface_floating_ips" "is_vni_floating_ips" { + depends_on = [ ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip ] + virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id } -resource "ibm_is_virtual_network_interface_ip" "is_floating_ip_instance" { - virtual_network_interface = "0726-89789ff7-3157-4261-8aa9-75140a4710bb" - reserved_ip = "0726-2c1ffe98-6542-4b9e-bb84-6d9efe93e68f" +data "ibm_is_virtual_network_interface_ips" "is_vni_reservedips" { + depends_on = [ ibm_is_virtual_network_interface_ip.testacc_vni_reservedip ] + virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id +} +data "ibm_is_virtual_network_interface_ip" "is_vni_reservedip" { + depends_on = [ ibm_is_virtual_network_interface_ip.testacc_vni_reservedip ] + virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id + reserved_ip = ibm_is_subnet_reserved_ip.testacc_reservedip.reserved_ip } -data "ibm_is_virtual_network_interface_ips" "is_vni_ips" { - virtual_network_interface = "0726-89789ff7-3157-4261-8aa9-75140a4710bb" +resource "ibm_is_subnet_reserved_ip" "testacc_reservedip" { + subnet = ibm_is_subnet.testacc_subnet.id + name = "${var.name}-reserved-ip" +} +resource "ibm_is_virtual_network_interface_ip" "testacc_vni_reservedip" { + virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id + reserved_ip = ibm_is_subnet_reserved_ip.testacc_reservedip.reserved_ip } -data "ibm_is_virtual_network_interface_ip" "is_vni_ip" { - virtual_network_interface = "0726-89789ff7-3157-4261-8aa9-75140a4710bb" - reserved_ip = "0726-9880e9da-8ef2-4088-bfd0-a260b927dc44" -} \ No newline at end of file From d51243f4d86fbc1385d35e7663273c1a8a142736 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 4 Oct 2023 17:22:38 +0530 Subject: [PATCH 020/132] test update --- ..._virtual_network_interface_floating_ips_test.go | 10 +++++----- ...ce_ibm_is_virtual_network_interface_ips_test.go | 14 +++++++------- ...s_virtual_network_interface_floating_ip_test.go | 2 +- ...rce_ibm_is_virtual_network_interface_ip_test.go | 6 ------ 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips_test.go index 3214930050..bf360f604d 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ips_test.go @@ -25,11 +25,11 @@ func TestAccIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceBasic(t *testing.T) resource.TestStep{ Config: testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPsDataSourceConfigBasic(vpcname, subnetname, vniname, floatingipname), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.floating_ips.0", "address"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.floating_ips.0", "crn"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.floating_ips.0", "href"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.floating_ips.0", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips.floating_ips.0", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips", "floating_ips.0.address"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips", "floating_ips.0.crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips", "floating_ips.0.href"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips", "floating_ips.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_floating_ips.is_floating_ips", "floating_ips.0.name"), ), }, }, diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go index 7ed03ea21a..a956c21878 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go @@ -25,13 +25,13 @@ func TestAccIBMIsVirtualNetworkInterfaceIpsDataSourceBasic(t *testing.T) { resource.TestStep{ Config: testAccCheckIBMIsVirtualNetworkInterfaceIpsDataSourceConfigBasic(vpcname, subnetname, vniname, reservedipname), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "name"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "href"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "address"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "resource_type"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "reserved_ip"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips.reserved_ips.0", "virtual_network_interface"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips", "reserved_ips.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips", "reserved_ips.0.name"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips", "reserved_ips.0.href"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips", "reserved_ips.0.address"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips", "reserved_ips.0.resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips", "reserved_ips.0.reserved_ip"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips", "reserved_ips.0.virtual_network_interface"), ), }, }, diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go index a079d4e28e..ee8a5ff5e6 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip_test.go @@ -111,7 +111,7 @@ func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDestroy(s *terraform.Stat return err } for _, rs := range s.RootModule().Resources { - if rs.Type != "ibm_is_floating_ip" { + if rs.Type != "ibm_is_virtual_network_interface_floating_ip" { continue } vniid, fipid, err := vpc.ParseVNIFloatingIpTerraformID(rs.Primary.ID) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip_test.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip_test.go index c82531c5aa..3b333d5788 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip_test.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip_test.go @@ -94,7 +94,6 @@ func testAccCheckIBMIsVirtualNetworkInterfaceIPExists(n string, obj vpcv1.Reserv if err != nil { return err } - getSubnetVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(parts[0]) getSubnetVirtualNetworkInterfaceIPOptions.SetID(parts[1]) @@ -102,7 +101,6 @@ func testAccCheckIBMIsVirtualNetworkInterfaceIPExists(n string, obj vpcv1.Reserv if err != nil { return err } - obj = *reservedIP return nil } @@ -117,14 +115,11 @@ func testAccCheckIBMIsVirtualNetworkInterfaceIPDestroy(s *terraform.State) error if rs.Type != "ibm_is_virtual_network_interface_ip" { continue } - getSubnetVirtualNetworkInterfaceIPOptions := &vpcv1.GetVirtualNetworkInterfaceIPOptions{} - parts, err := flex.SepIdParts(rs.Primary.ID, "/") if err != nil { return err } - getSubnetVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(parts[0]) getSubnetVirtualNetworkInterfaceIPOptions.SetID(parts[1]) @@ -137,6 +132,5 @@ func testAccCheckIBMIsVirtualNetworkInterfaceIPDestroy(s *terraform.State) error return fmt.Errorf("Error checking for VirtualNetworkInterfaceIP (%s) has been destroyed: %s", rs.Primary.ID, err) } } - return nil } From c2e0c8b86236e82acb62129ff7722886261cbafb Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 4 Oct 2023 17:40:37 +0530 Subject: [PATCH 021/132] doc update --- ...tual_network_interface_floating_ip_test.go | 2 +- ...twork_interface_floating_ips.html.markdown | 4 +- ...virtual_network_interface_ip.html.markdown | 4 +- ...irtual_network_interface_ips.html.markdown | 2 +- ...is_virtual_network_interface.html.markdown | 218 +++++------------- 5 files changed, 58 insertions(+), 172 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go index 2bf1e0d8a8..a587cc2b2b 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_floating_ip_test.go @@ -40,7 +40,7 @@ func TestAccIBMIsVirtualNetworkInterfaceFloatingIPDataSourceBasic(t *testing.T) func testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPDataSourceConfigBasic(vpcname, subnetname, vniname, floatingipname string) string { return testAccCheckIBMIsVirtualNetworkInterfaceFloatingIPConfigBasic(vpcname, subnetname, vniname, floatingipname) + fmt.Sprintf(` - data "ibm_is_virtual_network_interface_floating_ip" "is_floating_ip_instance" { + data "ibm_is_virtual_network_interface_floating_ip" "is_floating_ip" { virtual_network_interface = ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip.virtual_network_interface floating_ip = ibm_is_virtual_network_interface_floating_ip.testacc_vni_floatingip.floating_ip } diff --git a/website/docs/d/is_virtual_network_interface_floating_ips.html.markdown b/website/docs/d/is_virtual_network_interface_floating_ips.html.markdown index dce34de700..9186b403cb 100644 --- a/website/docs/d/is_virtual_network_interface_floating_ips.html.markdown +++ b/website/docs/d/is_virtual_network_interface_floating_ips.html.markdown @@ -35,8 +35,8 @@ After your data source is created, you can read values from the following attrib - `crn` - (String) The CRN for this floating IP. - `href` - (String) The URL for this floating IP. - `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. - Nested scheme for **deleted**: - - `more_info` - (String) Link to documentation about deleted resources. + Nested scheme for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. - `name` - (String) The name for this floating IP. The name is unique across all floating IPs in the region. diff --git a/website/docs/d/is_virtual_network_interface_ip.html.markdown b/website/docs/d/is_virtual_network_interface_ip.html.markdown index bcba4d43fb..986fea5f30 100644 --- a/website/docs/d/is_virtual_network_interface_ip.html.markdown +++ b/website/docs/d/is_virtual_network_interface_ip.html.markdown @@ -2,13 +2,13 @@ layout: "ibm" page_title: "IBM : ibm_is_virtual_network_interface_ip" description: |- - Get information about Virtual NetworkInterface Ip + Get information about Virtual Network Interface Reserved Ip subcategory: "Virtual Private Cloud API" --- # ibm_is_virtual_network_interface_ip -Provides a read-only data source to retrieve information about a Virtual NetworkInterface Ip. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. +Provides a read-only data source to retrieve information about a Virtual Network Interface Reserved Ip. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. ## Example Usage diff --git a/website/docs/d/is_virtual_network_interface_ips.html.markdown b/website/docs/d/is_virtual_network_interface_ips.html.markdown index b5a5765149..97be8cae1c 100644 --- a/website/docs/d/is_virtual_network_interface_ips.html.markdown +++ b/website/docs/d/is_virtual_network_interface_ips.html.markdown @@ -2,7 +2,7 @@ layout: "ibm" page_title: "IBM : ibm_is_virtual_network_interface_ips" description: |- - Get information about ReservedIPCollection + Get information about ReservedIP Collection of a Virtual Network Interface subcategory: "Virtual Private Cloud API" --- diff --git a/website/docs/r/is_virtual_network_interface.html.markdown b/website/docs/r/is_virtual_network_interface.html.markdown index e444cc9866..d419cb6160 100644 --- a/website/docs/r/is_virtual_network_interface.html.markdown +++ b/website/docs/r/is_virtual_network_interface.html.markdown @@ -2,7 +2,7 @@ layout: "ibm" page_title: "IBM : ibm_is_virtual_network_interface" description: |- - Manages VirtualNetworkInterface. + Manages Virtual Network Interface. subcategory: "Virtual Private Cloud API" --- @@ -17,51 +17,8 @@ resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instan allow_ip_spoofing = true auto_delete = false enable_infrastructure_nat = true - ips { - address = "192.168.3.4" - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - name = "my-reserved-ip" - resource_type = "subnet_reserved_ip" - } name = "my-virtual-network-interface" - primary_ip { - address = "192.168.3.4" - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - name = "my-reserved-ip" - resource_type = "subnet_reserved_ip" - } - resource_group { - href = "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345" - id = "fee82deba12e4c0fb69c3b09d1f12345" - name = "my-resource-group" - } - security_groups { - crn = "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" - id = "be5df5ca-12a0-494b-907e-aa6ec2bfa271" - name = "my-security-group" - } - subnet { - crn = "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - id = "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - name = "my-subnet" - resource_type = "subnet" - } + subnet = "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" } ``` @@ -69,136 +26,65 @@ resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instan You can specify the following arguments for this resource. -* `allow_ip_spoofing` - (Optional, Boolean) 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. -* `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted. -* `enable_infrastructure_nat` - (Optional, Boolean) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`. -* `ips` - (Optional, List) The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`. - * Constraints: The minimum length is `0` items. -Nested schema for **ips**: - * `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. - * Constraints: The maximum length is `15` characters. The minimum length is `7` characters. The value must match regular expression `/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/`. - * `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. +- `allow_ip_spoofing` - (Optional, Boolean) 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. +- `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted. +- `enable_infrastructure_nat` - (Optional, Boolean) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`. +- `ips` - (Optional, List) The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`. + Nested schema for **ips**: + - `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. Nested schema for **deleted**: - * `more_info` - (Required, String) Link to documentation about deleted resources. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `href` - (Required, String) The URL for this reserved IP. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `id` - (Required, String) The unique identifier for this reserved IP. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. - * `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^-?([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. - * `resource_type` - (Computed, String) The resource type. - * Constraints: Allowable values are: `subnet_reserved_ip`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. -* `name` - (Optional, String) The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. -* `primary_ip` - (Optional, List) The reserved IP for this virtual network interface. -Nested schema for **primary_ip**: - * `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. - * Constraints: The maximum length is `15` characters. The minimum length is `7` characters. The value must match regular expression `/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/`. - * `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + - `more_info` - (Required, String) Link to documentation about deleted resources. + - `href` - (Required, String) The URL for this reserved IP. + - `reserved_ip` - (Required, String) The unique identifier for this reserved IP. + - `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (Computed, String) The resource type. +- `name` - (Optional, String) The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. +- `primary_ip` - (Optional, List) The reserved IP for this virtual network interface. + Nested schema for **primary_ip**: + - `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. Nested schema for **deleted**: - * `more_info` - (Required, String) Link to documentation about deleted resources. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `href` - (Required, String) The URL for this reserved IP. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `id` - (Required, String) The unique identifier for this reserved IP. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. - * `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^-?([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. - * `resource_type` - (Computed, String) The resource type. - * Constraints: Allowable values are: `subnet_reserved_ip`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. -* `resource_group` - (Optional, List) The resource group for this virtual network interface. -Nested schema for **resource_group**: - * `href` - (Computed, String) The URL for this resource group. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `id` - (Required, String) The unique identifier for this resource group. - * Constraints: The maximum length is `32` characters. The minimum length is `32` characters. The value must match regular expression `/^[0-9a-f]{32}$/`. - * `name` - (Computed, String) The name for this resource group. - * Constraints: The maximum length is `40` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9-_ ]+$/`. -* `security_groups` - (Optional, List) The security groups for this virtual network interface. - * Constraints: The minimum length is `1` item. -Nested schema for **security_groups**: - * `crn` - (Required, String) The security group's CRN. - * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. - * `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. - Nested schema for **deleted**: - * `more_info` - (Required, String) Link to documentation about deleted resources. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `href` - (Required, String) The security group's canonical URL. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `id` - (Required, String) The unique identifier for this security group. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. - * `name` - (Required, String) The name for this security group. The name is unique across all security groups for the VPC. - * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^-?([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. -* `subnet` - (Optional, List) The associated subnet. -Nested schema for **subnet**: - * `crn` - (Required, String) The CRN for this subnet. - * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. - * `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. - Nested schema for **deleted**: - * `more_info` - (Required, String) Link to documentation about deleted resources. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `href` - (Required, String) The URL for this subnet. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `id` - (Required, String) The unique identifier for this subnet. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. - * `name` - (Computed, String) The name for this subnet. The name is unique across all subnets in the VPC. - * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^-?([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. - * `resource_type` - (Computed, String) The resource type. - * Constraints: Allowable values are: `subnet`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. + - `more_info` - (Required, String) Link to documentation about deleted resources. + - `href` - (Required, String) The URL for this reserved IP. + - `reserved_ip` - (Required, String) The unique identifier for this reserved IP. + - `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (Computed, String) The resource type. +- `resource_group` - (Optional, List) The resource group id for this virtual network interface. +- `security_groups` - (Optional, Array of string) The security group ids list for this virtual network interface. +- `subnet` - (Optional, List) The associated subnet id. ## Attribute Reference After your resource is created, you can read values from the listed arguments and the following attributes. -* `id` - The unique identifier of the VirtualNetworkInterface. -* `created_at` - (String) The date and time that the virtual network interface was created. -* `crn` - (String) The CRN for this virtual network interface. - * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. -* `href` - (String) The URL for this virtual network interface. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. -* `lifecycle_state` - (String) The lifecycle state of the virtual network interface. - * Constraints: Allowable values are: `deleting`, `failed`, `pending`, `stable`, `suspended`, `updating`, `waiting`. -* `mac_address` - (String) The MAC address of the interface. Absent when the interface is not attached to a target. - * Constraints: The maximum length is `17` characters. The minimum length is `17` characters. The value must match regular expression `/^([0-9A-F]{2}:){5}[0-9A-F]{2}$/`. -* `resource_type` - (String) The resource type. - * Constraints: Allowable values are: `virtual_network_interface`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. -* `target` - (List) The target of this virtual network interface.If absent, this virtual network interface is not attached to a target. -Nested schema for **target**: - * `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. +- `id` - The unique identifier of the VirtualNetworkInterface. +- `created_at` - (String) The date and time that the virtual network interface was created. +- `crn` - (String) The CRN for this virtual network interface. +- `href` - (String) The URL for this virtual network interface. +- `lifecycle_state` - (String) The lifecycle state of the virtual network interface. Allowable values are: `deleting`, `failed`, `pending`, `stable`, `suspended`, `updating`, `waiting`. +- `mac_address` - (String) The MAC address of the interface. Absent when the interface is not attached to a target. +- `resource_type` - (String) The resource type. +- `target` - (List) The target of this virtual network interface.If absent, this virtual network interface is not attached to a target. + Nested schema for **target**: + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. Nested schema for **deleted**: - * `more_info` - (String) Link to documentation about deleted resources. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `href` - (String) The URL for this share mount target. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `id` - (String) The unique identifier for this share mount target. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. - * `name` - (String) The name for this share mount target. The name is unique across all mount targets for the file share. - * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^-?([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. - * `resource_type` - (String) The resource type. - * Constraints: Allowable values are: `share_mount_target`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. -* `vpc` - (List) The VPC this virtual network interface resides in. -Nested schema for **vpc**: - * `crn` - (String) The CRN for this VPC. - * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. - * `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this share mount target. + - `id` - (String) The unique identifier for this share mount target. + - `name` - (String) The name for this share mount target. The name is unique across all mount targets for the file share. + - `resource_type` - (String) The resource type. +- `vpc` - (List) The VPC this virtual network interface resides in. + Nested schema for **vpc**: + - `crn` - (String) The CRN for this VPC. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. Nested schema for **deleted**: - * `more_info` - (String) Link to documentation about deleted resources. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `href` - (String) The URL for this VPC. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `id` - (String) The unique identifier for this VPC. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. - * `name` - (String) The name for this VPC. The name is unique across all VPCs in the region. - * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^-?([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. - * `resource_type` - (String) The resource type. - * Constraints: Allowable values are: `vpc`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. -* `zone` - (List) The zone this virtual network interface resides in. -Nested schema for **zone**: - * `href` - (String) The URL for this zone. - * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. - * `name` - (String) The globally unique name for this zone. - * Constraints: The maximum length is `63` characters. The minimum length is `1` character. The value must match regular expression `/^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this VPC. + - `id` - (String) The unique identifier for this VPC. + - `name` - (String) The name for this VPC. The name is unique across all VPCs in the region. + - `resource_type` - (String) The resource type. +- `zone` - (String) The zone name of the zone this virtual network interface resides in. ## Import From 7284dcf512e196d4784a789599871725039f5a2c Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 4 Oct 2023 17:56:27 +0530 Subject: [PATCH 022/132] updated test --- .../vpc/data_source_ibm_is_virtual_network_interface_ip.go | 2 +- .../data_source_ibm_is_virtual_network_interface_ip_test.go | 4 ++-- .../data_source_ibm_is_virtual_network_interface_ips_test.go | 2 +- .../vpc/resource_ibm_is_virtual_network_interface_ip.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip.go index 1fff5fc9c0..105f5704f3 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip.go @@ -72,7 +72,7 @@ func dataSourceIsVirtualNetworkInterfaceIPRead(context context.Context, d *schem reservedIP, response, err := vpcClient.GetVirtualNetworkInterfaceIPWithContext(context, getVirtualNetworkInterfaceIPOptions) if err != nil { log.Printf("[DEBUG] GetVirtualNetworkInterfaceIPWithContext failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterfaceIPWithContext failed %s\n%s", err, response)) + return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterfaceIPWithContext failed for datasource %s\n%s", err, response)) } d.SetId(*reservedIP.ID) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip_test.go index 3195688cd3..99239c2bbc 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ip_test.go @@ -41,8 +41,8 @@ func TestAccIBMIsVirtualNetworkInterfaceIpDataSourceBasic(t *testing.T) { func testAccCheckIBMIsVirtualNetworkInterfaceIpDataSourceConfigBasic(vpcname, subnetname, vniname, reservedipname string) string { return testAccCheckIBMIsVirtualNetworkInterfaceIPConfigBasic(vpcname, subnetname, vniname, reservedipname) + fmt.Sprintf(` data "ibm_is_virtual_network_interface_ip" "is_reserved_ip" { - virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id - reserved_ip = ibm_is_subnet_reserved_ip.testacc_reservedip.reserved_ip + virtual_network_interface = ibm_is_virtual_network_interface_ip.testacc_vni_reservedip.virtual_network_interface + reserved_ip = ibm_is_virtual_network_interface_ip.testacc_vni_reservedip.reserved_ip } `) } diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go index a956c21878..535f90fdd4 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go @@ -41,7 +41,7 @@ func TestAccIBMIsVirtualNetworkInterfaceIpsDataSourceBasic(t *testing.T) { func testAccCheckIBMIsVirtualNetworkInterfaceIpsDataSourceConfigBasic(vpcname, subnetname, vniname, reservedipname string) string { return testAccCheckIBMIsVirtualNetworkInterfaceIPConfigBasic(vpcname, subnetname, vniname, reservedipname) + fmt.Sprintf(` data "ibm_is_virtual_network_interface_ips" "is_reserved_ips" { - virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id + virtual_network_interface = ibm_is_virtual_network_interface_ip.testacc_vni_reservedip.virtual_network_interface } `) } diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip.go index c02fe0554b..4b226ede55 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_ip.go @@ -106,7 +106,7 @@ func resourceIBMIsVirtualNetworkInterfaceIPRead(context context.Context, d *sche return nil } log.Printf("[DEBUG] GetVirtualNetworkInterfaceIPWithContext failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterfaceIPWithContext failed %s\n%s", err, response)) + return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterfaceIPWithContext failed for resource %s\n%s", err, response)) } if !core.IsNil(reservedIP.Address) { From 6cb8d3c29000a84c257340cfaed70528da903708 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 4 Oct 2023 18:22:06 +0530 Subject: [PATCH 023/132] added flow logs example --- ibm/acctest/acctest.go | 6 ++ ...ce_ibm_is_virtual_network_interface_ips.go | 6 ++ .../vpc/resource_ibm_is_flow_log_test.go | 71 +++++++++++++++++++ 3 files changed, 83 insertions(+) diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 00957a3a8d..29b2791ed5 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -75,6 +75,7 @@ var ( ISZoneName2 string ISZoneName3 string IsResourceGroupID string + ISResourceCrn string ISCIDR string ISCIDR2 string ISPublicSSHKeyFilePath string @@ -651,6 +652,11 @@ func init() { IsResourceGroupID = "c01d34dff4364763476834c990398zz8" fmt.Println("[INFO] Set the environment variable SL_RESOURCE_GROUP_ID for testing with different resource group id else it is set to default value 'c01d34dff4364763476834c990398zz8'") } + ISResourceCrn = os.Getenv("IS_RESOURCE_INSTANCE_CRN") + if ISResourceCrn == "" { + ISResourceCrn = "crn:v1:bluemix:public:cloud-object-storage:global:a/fugeggfcgjebvrburvgurgvugfr:236764224-f48fu4-f4h84-9db3-4f94fh::" + fmt.Println("[INFO] Set the environment variable IS_RESOURCE_CRN for testing with created resource instance") + } IsImage = os.Getenv("IS_IMAGE") if IsImage == "" { diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips.go index cfff1e8a3a..1a6c0395f7 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips.go @@ -46,6 +46,11 @@ func DataSourceIBMIsVirtualNetworkInterfaceIPs() *schema.Resource { Computed: true, Description: "The unique identifier for this reserved IP.", }, + "reserved_ip": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique identifier for this reserved IP.", + }, "name": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -124,6 +129,7 @@ func dataSourceIBMIsReservedIpsReservedIPToMap(model *vpcv1.ReservedIPReference) modelMap["address"] = model.Address modelMap["href"] = model.Href modelMap["id"] = model.ID + modelMap["reserved_ip"] = model.ID modelMap["name"] = model.Name modelMap["resource_type"] = model.ResourceType return modelMap, nil diff --git a/ibm/service/vpc/resource_ibm_is_flow_log_test.go b/ibm/service/vpc/resource_ibm_is_flow_log_test.go index bb1e572b3c..2ae5a35881 100644 --- a/ibm/service/vpc/resource_ibm_is_flow_log_test.go +++ b/ibm/service/vpc/resource_ibm_is_flow_log_test.go @@ -64,6 +64,37 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE }, ) } +func TestAccIBMISFlowLog_vni(t *testing.T) { + var instance string + vpcname := fmt.Sprintf("flowlog-vpc-%d", acctest.RandIntRange(10, 100)) + flowlogname := fmt.Sprintf("flowlog-instance-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("flowlog-subnet-%d", acctest.RandIntRange(10, 100)) + + vniname := fmt.Sprintf("tf-ssh-%d", acctest.RandIntRange(10, 100)) + bucketName := fmt.Sprintf("terraform%d", acctest.RandIntRange(10, 100)) + bucketRegion := "us-south" + bucketClass := "standard" + bucketRegionType := "cross_region_location" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMISFlowLogDestroy, + Steps: []resource.TestStep{ + + { + //Create test case + Config: testAccCheckIBMISFlowLogVniConfig(vpcname, vniname, flowlogname, subnetname, bucketName, bucketRegionType, bucketRegion, bucketClass, true), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMISFlowLogExists("ibm_is_flow_log.test_flow_log", instance), + resource.TestCheckResourceAttr("ibm_is_flow_log.test_flow_log", "name", flowlogname), + resource.TestCheckResourceAttr("data.ibm_is_flow_log.is_flow_log_name", "target.0.resource_type", "virtual_network_interface"), + ), + }, + }, + }, + ) +} func testAccCheckIBMISFlowLogConfig(vpcname, name, flowlogname, sshname, publicKey, subnetname, serviceName, bucketName, bucketRegionType, bucketRegion, bucketClass string, isActive bool) string { return fmt.Sprintf(` @@ -125,6 +156,46 @@ func testAccCheckIBMISFlowLogConfig(vpcname, name, flowlogname, sshname, publicK `, vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, sshname, publicKey, name, acc.IsImage, acc.InstanceProfileName, acc.ISZoneName, serviceName, bucketName, bucketRegion, bucketClass, flowlogname, isActive) +} +func testAccCheckIBMISFlowLogVniConfig(vpcname, vniname, flowlogname, subnetname, bucketName, bucketRegionType, bucketRegion, bucketClass string, isActive bool) string { + return fmt.Sprintf(` + + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + total_ipv4_address_count = 16 + } + + resource "ibm_is_virtual_network_interface" "testacc_vni"{ + name = "%s" + subnet = ibm_is_subnet.testacc_subnet.id + } + + resource "ibm_cos_bucket" "bucket2" { + bucket_name = "%s" + resource_instance_id = "%s" + region_location = "%s" + storage_class = "%s" + } + // Authorisation policy is required between vpc Flowlogs and Object Storage + + resource "ibm_is_flow_log" "test_flow_log" { + name = "%s" + target = ibm_is_virtual_network_interface.testacc_vni.id + storage_bucket = ibm_cos_bucket.bucket2.bucket_name + active = %v + } + data "ibm_is_flow_log" "is_flow_log_name" { + name = ibm_is_flow_log.test_flow_log.name + } + + `, vpcname, subnetname, acc.ISZoneName, vniname, bucketName, acc.ISResourceCrn, bucketRegion, bucketClass, flowlogname, isActive) + } func vpcClient(meta interface{}) (*vpcv1.VpcV1, error) { sess, err := meta.(conns.ClientSession).VpcV1API() From f49634548f3597f645214828e7af3e8474a8febd Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 4 Oct 2023 18:31:29 +0530 Subject: [PATCH 024/132] Update data_source_ibm_is_virtual_network_interface_ips_test.go --- .../vpc/data_source_ibm_is_virtual_network_interface_ips_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go index 535f90fdd4..48eb37b3d1 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips_test.go @@ -31,7 +31,6 @@ func TestAccIBMIsVirtualNetworkInterfaceIpsDataSourceBasic(t *testing.T) { resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips", "reserved_ips.0.address"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips", "reserved_ips.0.resource_type"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips", "reserved_ips.0.reserved_ip"), - resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface_ips.is_reserved_ips", "reserved_ips.0.virtual_network_interface"), ), }, }, From 778cab2ddbbda4cc135f49c4ed631b56127ed827 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 5 Oct 2023 20:42:13 +0530 Subject: [PATCH 025/132] vni data source changes --- ...source_ibm_is_virtual_network_interface.go | 135 +++++++++++++++--- ...e_ibm_is_virtual_network_interface_test.go | 28 ++++ ...ource_ibm_is_virtual_network_interfaces.go | 97 ++++++++++++- ..._ibm_is_virtual_network_interfaces_test.go | 31 ++++ ...is_virtual_network_interface.html.markdown | 14 ++ ...s_virtual_network_interfaces.html.markdown | 13 ++ 6 files changed, 292 insertions(+), 26 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go index 8fa399c599..90a33405aa 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go @@ -8,7 +8,7 @@ import ( "fmt" "log" - "github.com/IBM/vpc-beta-go-sdk/vpcbetav1" + "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -26,6 +26,71 @@ func DataSourceIBMIsVirtualNetworkInterface() *schema.Resource { Required: true, Description: "The network interface identifier.", }, + // vni p2 changes + "allow_ip_spoofing": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "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.", + }, + "enable_infrastructure_nat": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "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`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", + }, + "ips": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "mac_address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The MAC address of the virtual network interface. May be absent if `lifecycle_state` is `pending`.", + }, + "auto_delete": { Type: schema.TypeBool, Computed: true, @@ -339,12 +404,12 @@ func DataSourceIBMIsVirtualNetworkInterface() *schema.Resource { } func dataSourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - vpcbetaClient, err := meta.(conns.ClientSession).VpcV1BetaAPI() + vpcbetaClient, err := meta.(conns.ClientSession).VpcV1API() if err != nil { return diag.FromErr(err) } - getVirtualNetworkInterfaceOptions := &vpcbetav1.GetVirtualNetworkInterfaceOptions{} + getVirtualNetworkInterfaceOptions := &vpcv1.GetVirtualNetworkInterfaceOptions{} getVirtualNetworkInterfaceOptions.SetID(d.Get("virtual_network_interface").(string)) @@ -470,10 +535,38 @@ func dataSourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *sche return diag.FromErr(fmt.Errorf("Error setting zone %s", err)) } + // vni p2 changes + + if err = d.Set("mac_address", virtualNetworkInterface.MacAddress); err != nil { + return diag.FromErr(fmt.Errorf("Error setting mac_address: %s", err)) + } + if err = d.Set("allow_ip_spoofing", virtualNetworkInterface.AllowIPSpoofing); err != nil { + return diag.FromErr(fmt.Errorf("Error setting allow_ip_spoofing: %s", err)) + } + if err = d.Set("enable_infrastructure_nat", virtualNetworkInterface.EnableInfrastructureNat); err != nil { + return diag.FromErr(fmt.Errorf("Error setting enable_infrastructure_nat: %s", err)) + } + + ips := []map[string]interface{}{} + if virtualNetworkInterface.Ips != nil { + for _, modelItem := range virtualNetworkInterface.Ips { + if *modelItem.ID != *virtualNetworkInterface.PrimaryIP.ID { + modelMap, err := dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + ips = append(ips, modelMap) + } + } + } + if err = d.Set("ips", ips); err != nil { + return diag.FromErr(fmt.Errorf("Error setting ips %s", err)) + } + return nil } -func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcbetav1.ReservedIPReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcv1.ReservedIPReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Address != nil { modelMap["address"] = *model.Address @@ -500,7 +593,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcbe return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model *vpcbetav1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -508,7 +601,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceResourceGroupReferenceToMap(model *vpcbetav1.ResourceGroupReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceResourceGroupReferenceToMap(model *vpcv1.ResourceGroupReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Href != nil { modelMap["href"] = *model.Href @@ -522,7 +615,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceResourceGroupReferenceToMap(model *vp return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceToMap(model *vpcbetav1.SecurityGroupReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceToMap(model *vpcv1.SecurityGroupReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.CRN != nil { modelMap["crn"] = *model.CRN @@ -546,7 +639,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceToMap(model *vp return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceDeletedToMap(model *vpcbetav1.SecurityGroupReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceDeletedToMap(model *vpcv1.SecurityGroupReferenceDeleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -554,7 +647,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceDeletedToMap(mo return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceToMap(model *vpcbetav1.SubnetReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceToMap(model *vpcv1.SubnetReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.CRN != nil { modelMap["crn"] = *model.CRN @@ -581,7 +674,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceToMap(model *vpcbetav1 return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceDeletedToMap(model *vpcbetav1.SubnetReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -589,12 +682,12 @@ func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceDeletedToMap(model *vp return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetToMap(model vpcbetav1.VirtualNetworkInterfaceTargetIntf) (map[string]interface{}, error) { - if _, ok := model.(*vpcbetav1.VirtualNetworkInterfaceTargetShareMountTargetReference); ok { - return dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMountTargetReferenceToMap(model.(*vpcbetav1.VirtualNetworkInterfaceTargetShareMountTargetReference)) - } else if _, ok := model.(*vpcbetav1.VirtualNetworkInterfaceTarget); ok { +func dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetToMap(model vpcv1.VirtualNetworkInterfaceTargetIntf) (map[string]interface{}, error) { + if _, ok := model.(*vpcv1.VirtualNetworkInterfaceTargetShareMountTargetReference); ok { + return dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMountTargetReferenceToMap(model.(*vpcv1.VirtualNetworkInterfaceTargetShareMountTargetReference)) + } else if _, ok := model.(*vpcv1.VirtualNetworkInterfaceTarget); ok { modelMap := make(map[string]interface{}) - model := model.(*vpcbetav1.VirtualNetworkInterfaceTarget) + model := model.(*vpcv1.VirtualNetworkInterfaceTarget) if model.Deleted != nil { deletedMap, err := dataSourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model.Deleted) if err != nil { @@ -616,11 +709,11 @@ func dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetToMap(mo } return modelMap, nil } else { - return nil, fmt.Errorf("Unrecognized vpcbetav1.VirtualNetworkInterfaceTargetIntf subtype encountered") + return nil, fmt.Errorf("Unrecognized vpcv1.VirtualNetworkInterfaceTargetIntf subtype encountered") } } -func dataSourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model *vpcbetav1.ShareMountTargetReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model *vpcv1.ShareMountTargetReferenceDeleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -628,7 +721,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMountTargetReferenceToMap(model *vpcbetav1.VirtualNetworkInterfaceTargetShareMountTargetReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMountTargetReferenceToMap(model *vpcv1.VirtualNetworkInterfaceTargetShareMountTargetReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Deleted != nil { deletedMap, err := dataSourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model.Deleted) @@ -652,7 +745,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMou return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceToMap(model *vpcbetav1.VPCReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceToMap(model *vpcv1.VPCReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.CRN != nil { modelMap["crn"] = *model.CRN @@ -679,7 +772,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceToMap(model *vpcbetav1.VP return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcbetav1.VPCReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcv1.VPCReferenceDeleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -687,7 +780,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcbe return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceZoneReferenceToMap(model *vpcbetav1.ZoneReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceZoneReferenceToMap(model *vpcv1.ZoneReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Href != nil { modelMap["href"] = *model.Href diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_test.go index bb94209e65..1c884c9ec7 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_test.go @@ -38,6 +38,34 @@ func TestAccIBMIsVirtualNetworkInterfaceDataSourceBasic(t *testing.T) { }, }) } +func TestAccIBMIsVirtualNetworkInterfaceDataSourceVniBasic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "virtual_network_interface"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "auto_delete"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "lifecycle_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "resource_group.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "security_groups.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "subnet.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "vpc.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "zone.0.name"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "enable_infrastructure_nat"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "allow_ip_spoofing"), + ), + }, + }, + }) +} func testAccCheckIBMIsVirtualNetworkInterfaceDataSourceConfigBasic() string { return fmt.Sprintf(` diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go index de054c2c45..30d4afd347 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go @@ -9,7 +9,7 @@ import ( "log" "time" - "github.com/IBM/vpc-beta-go-sdk/vpcbetav1" + "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -28,11 +28,78 @@ func DataSourceIBMIsVirtualNetworkInterfaces() *schema.Resource { Description: "Collection of virtual network interfaces.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + + // vni p2 changes + "allow_ip_spoofing": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "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.", + }, + "enable_infrastructure_nat": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "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`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", + }, + "ips": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "mac_address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The MAC address of the virtual network interface. May be absent if `lifecycle_state` is `pending`.", + }, + "auto_delete": &schema.Schema{ Type: schema.TypeBool, Computed: true, Description: "Indicates whether this virtual network interface will be automatically deleted when`target` is deleted.", }, + "created_at": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -349,12 +416,12 @@ func DataSourceIBMIsVirtualNetworkInterfaces() *schema.Resource { } func dataSourceIBMIsVirtualNetworkInterfacesRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - vpcbetaClient, err := meta.(conns.ClientSession).VpcV1BetaAPI() + vpcbetaClient, err := meta.(conns.ClientSession).VpcV1API() if err != nil { return diag.FromErr(err) } - listVirtualNetworkInterfacesOptions := &vpcbetav1.ListVirtualNetworkInterfacesOptions{} + listVirtualNetworkInterfacesOptions := &vpcv1.ListVirtualNetworkInterfacesOptions{} vniCollection, response, err := vpcbetaClient.ListVirtualNetworkInterfacesWithContext(context, listVirtualNetworkInterfacesOptions) //log.Printf(len(vniCollection.VirtualNetworkInterfaces)) @@ -362,7 +429,7 @@ func dataSourceIBMIsVirtualNetworkInterfacesRead(context context.Context, d *sch log.Printf("[DEBUG] VirtualNetworkInterfacesPager.GetAll() failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("VirtualNetworkInterfacesPager.GetAll() failed %s\n%s", err, response)) } - // var pager *vpcbetav1.VirtualNetworkInterfacesPager + // var pager *vpcv1.VirtualNetworkInterfacesPager // pager, err = vpcbetaClient.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptions) // if err != nil { // return diag.FromErr(err) @@ -397,7 +464,7 @@ func dataSourceIBMIsVirtualNetworkInterfacesID(d *schema.ResourceData) string { return time.Now().UTC().String() } -func dataSourceIBMIsVirtualNetworkInterfacesVirtualNetworkInterfaceToMap(model *vpcbetav1.VirtualNetworkInterface) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfacesVirtualNetworkInterfaceToMap(model *vpcv1.VirtualNetworkInterface) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.AutoDelete != nil { modelMap["auto_delete"] = *model.AutoDelete @@ -476,5 +543,25 @@ func dataSourceIBMIsVirtualNetworkInterfacesVirtualNetworkInterfaceToMap(model * } modelMap["zone"] = []map[string]interface{}{zoneMap} } + // vni p2 changes + + modelMap["mac_address"] = model.MacAddress + modelMap["allow_ip_spoofing"] = model.AllowIPSpoofing + modelMap["enable_infrastructure_nat"] = model.EnableInfrastructureNat + + ips := []map[string]interface{}{} + if model.Ips != nil { + for _, modelItem := range model.Ips { + if *modelItem.ID != *model.PrimaryIP.ID { + modelMap, err := dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(&modelItem) + if err != nil { + return modelMap, err + } + ips = append(ips, modelMap) + } + } + } + modelMap["ips"] = ips + return modelMap, nil } diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces_test.go index a8fe404294..f3491a1e7e 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces_test.go @@ -41,6 +41,37 @@ func TestAccIBMIsVirtualNetworkInterfacesDataSourceBasic(t *testing.T) { }, }) } +func TestAccIBMIsVirtualNetworkInterfacesDataSourceVniBasic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfacesDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.auto_delete"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.href"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.lifecycle_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.name"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.resource_group.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.resource_group.0.href"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.resource_group.0.name"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.security_groups.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.subnet.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.vpc.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.zone.0.name"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.allow_ip_spoofing"), + resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interfaces.is_virtual_network_interfaces", "virtual_network_interfaces.0.enable_infrastructure_nat"), + ), + }, + }, + }) +} func testAccCheckIBMIsVirtualNetworkInterfacesDataSourceConfigBasic() string { return fmt.Sprintf(` diff --git a/website/docs/d/is_virtual_network_interface.html.markdown b/website/docs/d/is_virtual_network_interface.html.markdown index 9f67e78b13..6cc7ce0c8b 100644 --- a/website/docs/d/is_virtual_network_interface.html.markdown +++ b/website/docs/d/is_virtual_network_interface.html.markdown @@ -57,12 +57,26 @@ Review the argument reference that you can specify for your data source. In addition to all argument references listed, you can access the following attribute references after your data source is created. +- `allow_ip_spoofing` - (Boolean) 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. - `auto_delete` - (Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted. - `created_at` - (String) The date and time that the virtual network interface was created. - `crn` - (String) The CRN for this virtual network interface. +- `enable_infrastructure_nat` - (Boolean) 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`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`. - `href` - (String) The URL for this virtual network interface. - `id` - The unique identifier of the VirtualNetworkInterface. +- `ips` - (List) The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`. + Nested schema for **ips**: + - `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this reserved IP. + - `id` - (String) The unique identifier for this reserved IP. + - `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. + - `lifecycle_state` - (String) The lifecycle state of the virtual network interface. +- `mac_address` - (String) The MAC address of the virtual network interface. May be absent if `lifecycle_state` is `pending`. - `name` - (String) The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - `primary_ip` - (List) The reserved IP for this virtual network interface.May be absent when `lifecycle_state` is `pending`. Nested scheme for **primary_ip**: diff --git a/website/docs/d/is_virtual_network_interfaces.html.markdown b/website/docs/d/is_virtual_network_interfaces.html.markdown index 93fb780ef6..12b78c724a 100644 --- a/website/docs/d/is_virtual_network_interfaces.html.markdown +++ b/website/docs/d/is_virtual_network_interfaces.html.markdown @@ -24,12 +24,25 @@ In addition to all argument references listed, you can access the following attr - `virtual_network_interfaces` - (List) Collection of virtual network interfaces. Nested scheme for **virtual_network_interfaces**: + - `allow_ip_spoofing` - (Boolean) 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. - `auto_delete` - (Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted. - `created_at` - (String) The date and time that the virtual network interface was created. - `crn` - (String) The CRN for this virtual network interface. + - `enable_infrastructure_nat` - (Boolean) 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`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`. - `href` - (String) The URL for this virtual network interface. - `id` - (String) The unique identifier for this virtual network interface. + - `ips` - (List) The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`. + Nested schema for **ips**: + - `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this reserved IP. + - `id` - (String) The unique identifier for this reserved IP. + - `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. - `lifecycle_state` - (String) The lifecycle state of the virtual network interface. + - `mac_address` - (String) The MAC address of the virtual network interface. May be absent if `lifecycle_state` is `pending`. - `name` - (String) The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - `primary_ip` - (List) The reserved IP for this virtual network interface.May be absent when `lifecycle_state` is `pending`. Nested scheme for **primary_ip**: From f383f84729431ff71f5b580dd4be9a92d9a0eb09 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 6 Oct 2023 10:47:00 +0530 Subject: [PATCH 026/132] added test case and update scenarios --- ...source_ibm_is_virtual_network_interface.go | 224 ++++++++++++++++-- ...e_ibm_is_virtual_network_interface_test.go | 163 ++++++++----- 2 files changed, 303 insertions(+), 84 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go index 6a42a35fd8..473ebaece4 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go @@ -4,15 +4,20 @@ package vpc import ( + "bytes" "context" + "encoding/json" "fmt" "log" + "time" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" "github.com/IBM/go-sdk-core/v5/core" "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -44,9 +49,10 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", }, "ips": &schema.Schema{ - Type: schema.TypeList, + Type: schema.TypeSet, Optional: true, Computed: true, + Set: hashIpsList, Description: "The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -84,6 +90,7 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { "reserved_ip": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, Description: "The unique identifier for this reserved IP.", }, "name": &schema.Schema{ @@ -170,7 +177,6 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { Type: schema.TypeSet, Optional: true, Computed: true, - ForceNew: true, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, Description: "The security groups for this virtual network interface.", @@ -347,7 +353,7 @@ func resourceIBMIsVirtualNetworkInterfaceCreate(context context.Context, d *sche } if _, ok := d.GetOk("ips"); ok { var ips []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf - for _, v := range d.Get("ips").([]interface{}) { + for _, v := range d.Get("ips").(*schema.Set).List() { value := v.(map[string]interface{}) ipsItem, err := resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReservedIPPrototype(value) if err != nil { @@ -427,35 +433,37 @@ func resourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema if !core.IsNil(virtualNetworkInterface.AllowIPSpoofing) { if err = d.Set("allow_ip_spoofing", virtualNetworkInterface.AllowIPSpoofing); err != nil { - return diag.FromErr(fmt.Errorf("Error setting allow_ip_spoofing: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting allow_ip_spoofing: %s", err)) } } if !core.IsNil(virtualNetworkInterface.AutoDelete) { if err = d.Set("auto_delete", virtualNetworkInterface.AutoDelete); err != nil { - return diag.FromErr(fmt.Errorf("Error setting auto_delete: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting auto_delete: %s", err)) } } if !core.IsNil(virtualNetworkInterface.EnableInfrastructureNat) { if err = d.Set("enable_infrastructure_nat", virtualNetworkInterface.EnableInfrastructureNat); err != nil { - return diag.FromErr(fmt.Errorf("Error setting enable_infrastructure_nat: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting enable_infrastructure_nat: %s", err)) } } if !core.IsNil(virtualNetworkInterface.Ips) { ips := []map[string]interface{}{} for _, ipsItem := range virtualNetworkInterface.Ips { - ipsItemMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(&ipsItem) - if err != nil { - return diag.FromErr(err) + if *virtualNetworkInterface.PrimaryIP.ID != *ipsItem.ID { + ipsItemMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(&ipsItem) + if err != nil { + return diag.FromErr(err) + } + ips = append(ips, ipsItemMap) } - ips = append(ips, ipsItemMap) } if err = d.Set("ips", ips); err != nil { - return diag.FromErr(fmt.Errorf("Error setting ips: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting ips: %s", err)) } } if !core.IsNil(virtualNetworkInterface.Name) { if err = d.Set("name", virtualNetworkInterface.Name); err != nil { - return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting name: %s", err)) } } if !core.IsNil(virtualNetworkInterface.PrimaryIP) { @@ -464,7 +472,7 @@ func resourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema return diag.FromErr(err) } if err = d.Set("primary_ip", []map[string]interface{}{primaryIPMap}); err != nil { - return diag.FromErr(fmt.Errorf("Error setting primary_ip: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting primary_ip: %s", err)) } } if !core.IsNil(virtualNetworkInterface.ResourceGroup) { @@ -485,24 +493,24 @@ func resourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema d.Set("subnet", virtualNetworkInterface.Subnet.ID) } if err = d.Set("created_at", flex.DateTimeToString(virtualNetworkInterface.CreatedAt)); err != nil { - return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting created_at: %s", err)) } if err = d.Set("crn", virtualNetworkInterface.CRN); err != nil { - return diag.FromErr(fmt.Errorf("Error setting crn: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting crn: %s", err)) } if err = d.Set("href", virtualNetworkInterface.Href); err != nil { - return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting href: %s", err)) } if err = d.Set("lifecycle_state", virtualNetworkInterface.LifecycleState); err != nil { - return diag.FromErr(fmt.Errorf("Error setting lifecycle_state: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting lifecycle_state: %s", err)) } if !core.IsNil(virtualNetworkInterface.MacAddress) { if err = d.Set("mac_address", virtualNetworkInterface.MacAddress); err != nil { - return diag.FromErr(fmt.Errorf("Error setting mac_address: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting mac_address: %s", err)) } } if err = d.Set("resource_type", virtualNetworkInterface.ResourceType); err != nil { - return diag.FromErr(fmt.Errorf("Error setting resource_type: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting resource_type: %s", err)) } if !core.IsNil(virtualNetworkInterface.Target) { targetMap, err := resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetToMap(virtualNetworkInterface.Target) @@ -510,7 +518,7 @@ func resourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema return diag.FromErr(err) } if err = d.Set("target", []map[string]interface{}{targetMap}); err != nil { - return diag.FromErr(fmt.Errorf("Error setting target: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting target: %s", err)) } } else { d.Set("target", nil) @@ -520,7 +528,7 @@ func resourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema return diag.FromErr(err) } if err = d.Set("vpc", []map[string]interface{}{vpcMap}); err != nil { - return diag.FromErr(fmt.Errorf("Error setting vpc: %s", err)) + return diag.FromErr(fmt.Errorf("[ERROR] Error setting vpc: %s", err)) } if virtualNetworkInterface.Zone != nil { @@ -535,10 +543,10 @@ func resourceIBMIsVirtualNetworkInterfaceUpdate(context context.Context, d *sche if err != nil { return diag.FromErr(err) } - + id := d.Id() updateVirtualNetworkInterfaceOptions := &vpcv1.UpdateVirtualNetworkInterfaceOptions{} - updateVirtualNetworkInterfaceOptions.SetID(d.Id()) + updateVirtualNetworkInterfaceOptions.SetID(id) hasChange := false @@ -563,6 +571,130 @@ func resourceIBMIsVirtualNetworkInterfaceUpdate(context context.Context, d *sche patchVals.Name = &newName hasChange = true } + if d.HasChange("ips") { + oldips, newIPs := d.GetChange("ips") + log.Printf("[INFO] vnip2 ipsoldmap old map %s", output(oldips)) + log.Printf("[INFO] vnip2 ipsnewmap new map %s", output(newIPs)) + + ov := oldips.(*schema.Set) + nv := newIPs.(*schema.Set) + remove := (ov.Difference(nv).List()) + add := (nv.Difference(ov).List()) + log.Printf("[INFO] vnip2 add map %s", output(add)) + log.Printf("[INFO] vnip2 remove map %s", output(remove)) + + if add != nil && len(add) > 0 { + for _, ipItem := range add { + value := ipItem.(map[string]interface{}) + if value["reserved_ip"] != nil && value["reserved_ip"].(string) != "" { + reservedipid := value["reserved_ip"].(string) + addVirtualNetworkInterfaceIPOptions := &vpcv1.AddVirtualNetworkInterfaceIPOptions{} + addVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(id) + addVirtualNetworkInterfaceIPOptions.SetID(reservedipid) + _, response, err := sess.AddVirtualNetworkInterfaceIPWithContext(context, addVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response)) + } + } + } + } + if remove != nil && len(remove) > 0 { + subnetId := d.Get("subnet").(string) + for _, ipItem := range remove { + value := ipItem.(map[string]interface{}) + if value["reserved_ip"] != nil && value["reserved_ip"].(string) != "" { + reservedipid := value["reserved_ip"].(string) + removeVirtualNetworkInterfaceIPOptions := &vpcv1.RemoveVirtualNetworkInterfaceIPOptions{} + removeVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(id) + removeVirtualNetworkInterfaceIPOptions.SetID(reservedipid) + response, err := sess.RemoveVirtualNetworkInterfaceIPWithContext(context, removeVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response)) + } + } + if value["address"] != nil && value["address"].(string) != "" { + reservedipid := value["reserved_ip"].(string) + removeSubnetReservedIPOptions := &vpcv1.DeleteSubnetReservedIPOptions{} + removeSubnetReservedIPOptions.SetSubnetID(subnetId) + removeSubnetReservedIPOptions.SetID(reservedipid) + response, err := sess.DeleteSubnetReservedIPWithContext(context, removeSubnetReservedIPOptions) + if err != nil { + log.Printf("[DEBUG] DeleteSubnetReservedIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteSubnetReservedIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response)) + } + } + } + } + } + if !d.IsNewResource() && d.HasChange("primary_ip") { + subnetId := d.Get("subnet").(string) + ripId := d.Get("primary_ip.0.reserved_ip").(string) + updateripoptions := &vpcv1.UpdateSubnetReservedIPOptions{ + SubnetID: &subnetId, + ID: &ripId, + } + reservedIpPath := &vpcv1.ReservedIPPatch{} + if d.HasChange("primary_ip.0.name") { + name := d.Get("primary_ip.0.name").(string) + reservedIpPath.Name = &name + } + if d.HasChange("primary_ip.0.auto_delete") { + auto := d.Get("primary_ip.0.auto_delete").(bool) + reservedIpPath.AutoDelete = &auto + } + reservedIpPathAsPatch, err := reservedIpPath.AsPatch() + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error calling reserved ip as patch on vni patch \n%s", err)) + } + updateripoptions.ReservedIPPatch = reservedIpPathAsPatch + _, response, err := sess.UpdateSubnetReservedIP(updateripoptions) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error updating vni reserved ip(%s): %s\n%s", ripId, err, response)) + } + } + if d.HasChange("security_groups") && !d.IsNewResource() { + ovs, nvs := d.GetChange("security_groups") + vniId := d.Id() + ov := ovs.(*schema.Set) + nv := nvs.(*schema.Set) + remove := flex.ExpandStringList(ov.Difference(nv).List()) + add := flex.ExpandStringList(nv.Difference(ov).List()) + if len(add) > 0 { + for i := range add { + createsgnicoptions := &vpcv1.CreateSecurityGroupTargetBindingOptions{ + SecurityGroupID: &add[i], + ID: &vniId, + } + _, response, err := sess.CreateSecurityGroupTargetBinding(createsgnicoptions) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error while creating security group %q for virtual network interface %s\n%s: %q", add[i], d.Id(), err, response)) + } + _, err = isWaitForVirtualNetworkInterfaceAvailable(sess, vniId, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + return diag.FromErr(err) + } + } + + } + if len(remove) > 0 { + for i := range remove { + deletesgnicoptions := &vpcv1.DeleteSecurityGroupTargetBindingOptions{ + SecurityGroupID: &remove[i], + ID: &vniId, + } + response, err := sess.DeleteSecurityGroupTargetBinding(deletesgnicoptions) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error while removing security group %q for virtual network interface %s\n%s: %q", remove[i], d.Id(), err, response)) + } + _, err = isWaitForVirtualNetworkInterfaceAvailable(sess, vniId, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + return diag.FromErr(err) + } + } + } + } if hasChange { updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch, _ = patchVals.AsPatch() @@ -747,6 +879,37 @@ func resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMount return modelMap, nil } +func isWaitForVirtualNetworkInterfaceAvailable(client *vpcv1.VpcV1, id string, timeout time.Duration) (interface{}, error) { + log.Printf("Waiting for VirtualNetworkInterface (%s) to be available.", id) + + stateConf := &resource.StateChangeConf{ + Pending: []string{"", "pending"}, + Target: []string{"done", "failed", "stable"}, + Refresh: isVirtualNetworkInterfaceRefreshFunc(client, id), + Timeout: timeout, + Delay: 10 * time.Second, + MinTimeout: 10 * time.Second, + } + + return stateConf.WaitForState() +} + +func isVirtualNetworkInterfaceRefreshFunc(client *vpcv1.VpcV1, id string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + vnigetoptions := &vpcv1.GetVirtualNetworkInterfaceOptions{ + ID: &id, + } + vni, response, err := client.GetVirtualNetworkInterface(vnigetoptions) + if err != nil { + return nil, "failed", fmt.Errorf("[ERROR] Error getting vni: %s\n%s", err, response) + } + if *vni.LifecycleState == "failed" || *vni.LifecycleState == "suspended" { + return vni, *vni.LifecycleState, fmt.Errorf("[ERROR] Error VirtualNetworkInterface in : %s state", *vni.LifecycleState) + } + return vni, *vni.LifecycleState, nil + } +} + func resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextToMap(model *vpcv1.VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) // if model.Deleted != nil { @@ -813,3 +976,18 @@ func resourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcv1.V modelMap["more_info"] = model.MoreInfo return modelMap, nil } + +func hashIpsList(v interface{}) int { + var buf bytes.Buffer + a := v.(map[string]interface{}) + buf.WriteString(fmt.Sprintf("%s-", a["address"].(string))) + return conns.String(buf.String()) +} +func output(vnimap interface{}) string { + output, err := json.MarshalIndent(vnimap, "", " ") + if err == nil { + return fmt.Sprintf("block %+v\n", string(output)) + } else { + return fmt.Sprintf("block : %#v", vnimap) + } +} diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go index e3df36f87a..70cc6bb209 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go @@ -54,14 +54,14 @@ func TestAccIBMIsVirtualNetworkInterfaceBasic(t *testing.T) { func TestAccIBMIsVirtualNetworkInterfaceAllArgs(t *testing.T) { var conf vpcv1.VirtualNetworkInterface - allowIPSpoofing := "false" - autoDelete := "false" - enableInfrastructureNat := "false" - name := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - allowIPSpoofingUpdate := "true" - autoDeleteUpdate := "true" - enableInfrastructureNatUpdate := "true" - nameUpdate := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) + vpcname := fmt.Sprintf("tfvpngw-vpc-%d", acctest.RandIntRange(10, 100)) + sgname1 := fmt.Sprintf("tfvpngw-sg-%d", acctest.RandIntRange(10, 100)) + sgname2 := fmt.Sprintf("tfvpngw-sg-%d", acctest.RandIntRange(10, 100)) + reservedipname := fmt.Sprintf("tfvpngw-ip-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfvpngw-subnet-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tfvpngw-createname-%d", acctest.RandIntRange(10, 100)) + enable_infrastructure_nat := true + allow_ip_spoofing := true resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, @@ -69,29 +69,40 @@ func TestAccIBMIsVirtualNetworkInterfaceAllArgs(t *testing.T) { CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceConfig(allowIPSpoofing, autoDelete, enableInfrastructureNat, name), + Config: testAccCheckIBMIsVirtualNetworkInterfaceConfig(vpcname, subnetname, vniname, enable_infrastructure_nat, allow_ip_spoofing), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIBMIsVirtualNetworkInterfaceExists("ibm_is_virtual_network_interface.is_virtual_network_interface", conf), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "allow_ip_spoofing", allowIPSpoofing), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "auto_delete", autoDelete), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "enable_infrastructure_nat", enableInfrastructureNat), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "name", name), + testAccCheckIBMIsVirtualNetworkInterfaceExists("ibm_is_virtual_network_interface.testacc_vni", conf), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "subnet"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "name"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "created_at"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "crn"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "href"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "vpc.#"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "zone"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "primary_ip.#"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "ips.#"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "ips.#", "1"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "security_groups.#", "1"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "id"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "enable_infrastructure_nat", "true"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "lifecycle_state", "stable"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "resource_type", "virtual_network_interface"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "resource_group"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "allow_ip_spoofing", "true"), ), }, resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceConfig(allowIPSpoofingUpdate, autoDeleteUpdate, enableInfrastructureNatUpdate, nameUpdate), + Config: testAccCheckIBMIsVirtualNetworkInterfaceConfigUpdate(vpcname, subnetname, vniname, sgname1, sgname2, reservedipname, enable_infrastructure_nat, allow_ip_spoofing), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "allow_ip_spoofing", allowIPSpoofingUpdate), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "auto_delete", autoDeleteUpdate), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "enable_infrastructure_nat", enableInfrastructureNatUpdate), - resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.is_virtual_network_interface", "name", nameUpdate), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "ips.#", "2"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "security_groups.#", "2"), ), }, - resource.TestStep{ - ResourceName: "ibm_is_virtual_network_interface.is_virtual_network_interface", - ImportState: true, - ImportStateVerify: true, - }, + // resource.TestStep{ + // ResourceName: "ibm_is_virtual_network_interface.testacc_vni", + // ImportState: true, + // ImportStateVerify: true, + // }, }, }) } @@ -119,45 +130,75 @@ func testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic(vpcname, subnetname, vn `, vpcname, subnetname, acc.ISZoneName, vniname, enablenat, allowipspoofing) } -func testAccCheckIBMIsVirtualNetworkInterfaceConfig(allowIPSpoofing string, autoDelete string, enableInfrastructureNat string, name string) string { +func testAccCheckIBMIsVirtualNetworkInterfaceConfig(vpcname, subnetname, vniname string, enablenat, allowipspoofing bool) string { return fmt.Sprintf(` - - resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instance" { - allow_ip_spoofing = %s - auto_delete = %s - enable_infrastructure_nat = %s - ips { - address = "192.168.3.4" - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - name = "my-reserved-ip" - } - name = "%s" - primary_ip { - address = "192.168.3.4" - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - id = "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - name = "my-reserved-ip" - } - resource_group { - id = "fee82deba12e4c0fb69c3b09d1f12345" - } - security_groups { - crn = "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" - deleted { - more_info = "https://cloud.ibm.com/apidocs/vpc#deleted-resources" - } - href = "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" - id = "be5df5ca-12a0-494b-907e-aa6ec2bfa271" - name = "my-security-group" - } - subnet { - crn = "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - href = "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - id = "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - } + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + total_ipv4_address_count = 16 + + } + resource "ibm_is_virtual_network_interface" "testacc_vni" { + name = "%s" + subnet = ibm_is_subnet.testacc_subnet.id + enable_infrastructure_nat = %t + allow_ip_spoofing = %t + ips { + address = "10.240.64.12" + } + primary_ip { + address = "10.240.64.11" } - `, allowIPSpoofing, autoDelete, enableInfrastructureNat, name) + } + `, vpcname, subnetname, acc.ISZoneName, vniname, enablenat, allowipspoofing) +} +func testAccCheckIBMIsVirtualNetworkInterfaceConfigUpdate(vpcname, subnetname, vniname, sgname1, sgname2, reservedipname string, enablenat, allowipspoofing bool) string { + return fmt.Sprintf(` + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + total_ipv4_address_count = 16 + + } + resource "ibm_is_security_group" "testacc_security_group1" { + name = "%s" + vpc = "r134-6d509c8a-470e-4cdd-a82c-103f2353f5fc" + } + resource "ibm_is_security_group" "testacc_security_group2" { + name = "%s" + vpc ="r134-6d509c8a-470e-4cdd-a82c-103f2353f5fc" + } + resource "ibm_is_subnet_reserved_ip" "testacc_reservedips" { + subnet = ibm_is_subnet.testacc_subnet.id + name = "%s" + } + resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instance" { + name = "%s" + subnet = ibm_is_subnet.testacc_subnet.id + enable_infrastructure_nat = %t + allow_ip_spoofing = %t + ips { + address = "10.240.64.12" + } + ips { + reserved_ip = ibm_is_subnet_reserved_ip.testacc_reservedips.reserved_ip + } + primary_ip { + address = "10.240.64.11" + } + security_groups = [ibm_is_security_group.testacc_security_group2.id, ibm_is_security_group.testacc_security_group1.id] + } + `, vpcname, subnetname, acc.ISZoneName, sgname1, sgname2, reservedipname, vniname, enablenat, allowipspoofing) } func testAccCheckIBMIsVirtualNetworkInterfaceExists(n string, obj vpcv1.VirtualNetworkInterface) resource.TestCheckFunc { From 213356d5ba0c913b79c836c2412e014dfd885b09 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 6 Oct 2023 11:00:41 +0530 Subject: [PATCH 027/132] updated ips --- ...source_ibm_is_virtual_network_interface_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go index 70cc6bb209..191ec63b12 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go @@ -149,10 +149,10 @@ func testAccCheckIBMIsVirtualNetworkInterfaceConfig(vpcname, subnetname, vniname enable_infrastructure_nat = %t allow_ip_spoofing = %t ips { - address = "10.240.64.12" + address = "10.240.0.7" } primary_ip { - address = "10.240.64.11" + address = "10.240.0.9" } } `, vpcname, subnetname, acc.ISZoneName, vniname, enablenat, allowipspoofing) @@ -172,29 +172,29 @@ func testAccCheckIBMIsVirtualNetworkInterfaceConfigUpdate(vpcname, subnetname, v } resource "ibm_is_security_group" "testacc_security_group1" { name = "%s" - vpc = "r134-6d509c8a-470e-4cdd-a82c-103f2353f5fc" + vpc = ibm_is_vpc.testacc_vpc.id } resource "ibm_is_security_group" "testacc_security_group2" { name = "%s" - vpc ="r134-6d509c8a-470e-4cdd-a82c-103f2353f5fc" + vpc =ibm_is_vpc.testacc_vpc.id } resource "ibm_is_subnet_reserved_ip" "testacc_reservedips" { subnet = ibm_is_subnet.testacc_subnet.id name = "%s" } - resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instance" { + resource "ibm_is_virtual_network_interface" "testacc_vni" { name = "%s" subnet = ibm_is_subnet.testacc_subnet.id enable_infrastructure_nat = %t allow_ip_spoofing = %t ips { - address = "10.240.64.12" + address = "10.240.0.7" } ips { reserved_ip = ibm_is_subnet_reserved_ip.testacc_reservedips.reserved_ip } primary_ip { - address = "10.240.64.11" + address = "10.240.0.9" } security_groups = [ibm_is_security_group.testacc_security_group2.id, ibm_is_security_group.testacc_security_group1.id] } From 8d297e99b94a236f0e0a7c7515612c9fe271c1ed Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 6 Oct 2023 11:10:39 +0530 Subject: [PATCH 028/132] Update is_virtual_network_interface.html.markdown --- website/docs/r/is_virtual_network_interface.html.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/docs/r/is_virtual_network_interface.html.markdown b/website/docs/r/is_virtual_network_interface.html.markdown index d419cb6160..cd10346c1c 100644 --- a/website/docs/r/is_virtual_network_interface.html.markdown +++ b/website/docs/r/is_virtual_network_interface.html.markdown @@ -29,6 +29,8 @@ You can specify the following arguments for this resource. - `allow_ip_spoofing` - (Optional, Boolean) 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. - `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted. - `enable_infrastructure_nat` - (Optional, Boolean) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`. + +~> **NOTE** to update/add new `ips` only existing `reserved_ip` is supported, new reserved_ip creation on update is not supported as it leads to unmanaged(dangling) reserved ips. - `ips` - (Optional, List) The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`. Nested schema for **ips**: - `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. From 34767abc3784835503514bed8f0f241efc2e0235 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 6 Oct 2023 14:45:30 +0530 Subject: [PATCH 029/132] updated logic for vni ips name update --- ...source_ibm_is_virtual_network_interface.go | 88 +++++++++++++++---- 1 file changed, 69 insertions(+), 19 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go index 473ebaece4..d518362870 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go @@ -9,6 +9,7 @@ import ( "encoding/json" "fmt" "log" + "strings" "time" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" @@ -79,7 +80,7 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { "auto_delete": &schema.Schema{ Type: schema.TypeBool, Optional: true, - Computed: true, + Default: true, Description: "Indicates whether this reserved IP member will be automatically deleted when either target is deleted, or the reserved IP is unbound.", }, "href": &schema.Schema{ @@ -576,29 +577,56 @@ func resourceIBMIsVirtualNetworkInterfaceUpdate(context context.Context, d *sche log.Printf("[INFO] vnip2 ipsoldmap old map %s", output(oldips)) log.Printf("[INFO] vnip2 ipsnewmap new map %s", output(newIPs)) - ov := oldips.(*schema.Set) - nv := newIPs.(*schema.Set) - remove := (ov.Difference(nv).List()) - add := (nv.Difference(ov).List()) - log.Printf("[INFO] vnip2 add map %s", output(add)) - log.Printf("[INFO] vnip2 remove map %s", output(remove)) + os := oldips.(*schema.Set) + ns := newIPs.(*schema.Set) - if add != nil && len(add) > 0 { - for _, ipItem := range add { - value := ipItem.(map[string]interface{}) - if value["reserved_ip"] != nil && value["reserved_ip"].(string) != "" { - reservedipid := value["reserved_ip"].(string) - addVirtualNetworkInterfaceIPOptions := &vpcv1.AddVirtualNetworkInterfaceIPOptions{} - addVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(id) - addVirtualNetworkInterfaceIPOptions.SetID(reservedipid) - _, response, err := sess.AddVirtualNetworkInterfaceIPWithContext(context, addVirtualNetworkInterfaceIPOptions) - if err != nil { - log.Printf("[DEBUG] AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response)) + for _, nA := range ns.List() { + newPack := nA.(map[string]interface{}) + for _, oA := range os.List() { + oldPack := oA.(map[string]interface{}) + if strings.Compare(newPack["address"].(string), oldPack["address"].(string)) == 0 { + reserved_ip := oldPack["reserved_ip"].(string) + subnetId := d.Get("subnet").(string) + newName := newPack["name"].(string) + newAutoDelete := newPack["auto_delete"].(bool) + + oldName := oldPack["name"].(string) + oldAutoDelete := oldPack["auto_delete"].(bool) + + if newName != oldName || newAutoDelete != oldAutoDelete { + + updatereservedipoptions := &vpcv1.UpdateSubnetReservedIPOptions{ + SubnetID: &subnetId, + ID: &reserved_ip, + } + + reservedIpPatchModel := &vpcv1.ReservedIPPatch{} + if strings.Compare(newName, oldName) != 0 { + reservedIpPatchModel.Name = &newName + } + + if newAutoDelete != oldAutoDelete { + reservedIpPatchModel.AutoDelete = &newAutoDelete + } + + reservedIpPatch, err := reservedIpPatchModel.AsPatch() + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error calling asPatch for ReservedIPPatch: %s", err)) + } + updatereservedipoptions.ReservedIPPatch = reservedIpPatch + log.Printf("[INFO] vnip2 updatereservedipoptions %s", output(updatereservedipoptions)) + _, response, err := sess.UpdateSubnetReservedIP(updatereservedipoptions) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error while updating reserved ip(%s) of vni(%s) \n%s: %q", reserved_ip, d.Id(), err, response)) + } + ns.Remove(nA) + os.Remove(oA) } } } } + remove := os.Difference(ns).List() + log.Printf("[INFO] vnip2 remove map %s", output(remove)) if remove != nil && len(remove) > 0 { subnetId := d.Get("subnet").(string) for _, ipItem := range remove { @@ -627,6 +655,26 @@ func resourceIBMIsVirtualNetworkInterfaceUpdate(context context.Context, d *sche } } } + add := ns.Difference(os).List() + log.Printf("[INFO] vnip2 add map %s", output(add)) + + if add != nil && len(add) > 0 { + for _, ipItem := range add { + value := ipItem.(map[string]interface{}) + if value["reserved_ip"] != nil && value["reserved_ip"].(string) != "" { + reservedipid := value["reserved_ip"].(string) + addVirtualNetworkInterfaceIPOptions := &vpcv1.AddVirtualNetworkInterfaceIPOptions{} + addVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(id) + addVirtualNetworkInterfaceIPOptions.SetID(reservedipid) + _, response, err := sess.AddVirtualNetworkInterfaceIPWithContext(context, addVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response)) + } + } + } + } + } if !d.IsNewResource() && d.HasChange("primary_ip") { subnetId := d.Get("subnet").(string) @@ -981,6 +1029,8 @@ func hashIpsList(v interface{}) int { var buf bytes.Buffer a := v.(map[string]interface{}) buf.WriteString(fmt.Sprintf("%s-", a["address"].(string))) + buf.WriteString(fmt.Sprintf("%s-", a["name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", a["reserved_ip"].(string))) return conns.String(buf.String()) } func output(vnimap interface{}) string { From de6a62dc68a1e60a94f9277d4deb7b338a0c72df Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 9 Oct 2023 18:04:08 +0530 Subject: [PATCH 030/132] Update resource_ibm_is_virtual_network_interface.go --- ...source_ibm_is_virtual_network_interface.go | 314 +++++++++++------- 1 file changed, 189 insertions(+), 125 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go index d518362870..37f30a3bf6 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go @@ -9,7 +9,6 @@ import ( "encoding/json" "fmt" "log" - "strings" "time" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" @@ -50,16 +49,17 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", }, "ips": &schema.Schema{ - Type: schema.TypeSet, - Optional: true, - Computed: true, - Set: hashIpsList, + Type: schema.TypeSet, + Optional: true, + Computed: true, + Set: hashIpsList, + // DiffSuppressFunc: suppressIPsVNI, Description: "The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "address": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + // Optional: true, Computed: true, Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", }, @@ -78,9 +78,10 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { }, }, "auto_delete": &schema.Schema{ - Type: schema.TypeBool, - Optional: true, - Default: true, + Type: schema.TypeBool, + Computed: true, + // Default: true, + // DiffSuppressFunc: flex.ApplyOnce, Description: "Indicates whether this reserved IP member will be automatically deleted when either target is deleted, or the reserved IP is unbound.", }, "href": &schema.Schema{ @@ -89,14 +90,14 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { Description: "The URL for this reserved IP.", }, "reserved_ip": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Required: true, + // Computed: true, Description: "The unique identifier for this reserved IP.", }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + // Optional: true, Computed: true, Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", }, @@ -129,6 +130,12 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { Computed: true, Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "Indicates whether this reserved IP member will be automatically deleted when either target is deleted, or the reserved IP is unbound.", + }, "deleted": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -368,7 +375,11 @@ func resourceIBMIsVirtualNetworkInterfaceCreate(context context.Context, d *sche createVirtualNetworkInterfaceOptions.SetName(d.Get("name").(string)) } if _, ok := d.GetOk("primary_ip"); ok { - primaryIPModel, err := resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(d.Get("primary_ip.0").(map[string]interface{})) + autodelete := true + if autodeleteOk, ok := d.GetOkExists("primary_ip.0.auto_delete"); ok { + autodelete = autodeleteOk.(bool) + } + primaryIPModel, err := resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(d.Get("primary_ip.0").(map[string]interface{}), autodelete) if err != nil { return diag.FromErr(err) } @@ -400,6 +411,7 @@ func resourceIBMIsVirtualNetworkInterfaceCreate(context context.Context, d *sche } createVirtualNetworkInterfaceOptions.SetSubnet(subnetModel) } + // log.Printf("[INFO] vnip2 request map is %s", output(createVirtualNetworkInterfaceOptions)) virtualNetworkInterface, response, err := sess.CreateVirtualNetworkInterfaceWithContext(context, createVirtualNetworkInterfaceOptions) if err != nil { @@ -451,7 +463,7 @@ func resourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema ips := []map[string]interface{}{} for _, ipsItem := range virtualNetworkInterface.Ips { if *virtualNetworkInterface.PrimaryIP.ID != *ipsItem.ID { - ipsItemMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(&ipsItem) + ipsItemMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(&ipsItem, true) if err != nil { return diag.FromErr(err) } @@ -468,7 +480,8 @@ func resourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema } } if !core.IsNil(virtualNetworkInterface.PrimaryIP) { - primaryIPMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(virtualNetworkInterface.PrimaryIP) + autodelete := d.Get("primary_ip.0.auto_delete").(bool) + primaryIPMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(virtualNetworkInterface.PrimaryIP, autodelete) if err != nil { return diag.FromErr(err) } @@ -572,106 +585,139 @@ func resourceIBMIsVirtualNetworkInterfaceUpdate(context context.Context, d *sche patchVals.Name = &newName hasChange = true } - if d.HasChange("ips") { - oldips, newIPs := d.GetChange("ips") - log.Printf("[INFO] vnip2 ipsoldmap old map %s", output(oldips)) - log.Printf("[INFO] vnip2 ipsnewmap new map %s", output(newIPs)) + if d.HasChange("ips") { + oldips, newips := d.GetChange("ips") os := oldips.(*schema.Set) - ns := newIPs.(*schema.Set) + ns := newips.(*schema.Set) + var oldset, newset *schema.Set - for _, nA := range ns.List() { + var out = make([]interface{}, ns.Len(), ns.Len()) + for i, nA := range ns.List() { newPack := nA.(map[string]interface{}) - for _, oA := range os.List() { - oldPack := oA.(map[string]interface{}) - if strings.Compare(newPack["address"].(string), oldPack["address"].(string)) == 0 { - reserved_ip := oldPack["reserved_ip"].(string) - subnetId := d.Get("subnet").(string) - newName := newPack["name"].(string) - newAutoDelete := newPack["auto_delete"].(bool) - - oldName := oldPack["name"].(string) - oldAutoDelete := oldPack["auto_delete"].(bool) - - if newName != oldName || newAutoDelete != oldAutoDelete { - - updatereservedipoptions := &vpcv1.UpdateSubnetReservedIPOptions{ - SubnetID: &subnetId, - ID: &reserved_ip, - } - - reservedIpPatchModel := &vpcv1.ReservedIPPatch{} - if strings.Compare(newName, oldName) != 0 { - reservedIpPatchModel.Name = &newName - } - - if newAutoDelete != oldAutoDelete { - reservedIpPatchModel.AutoDelete = &newAutoDelete - } - - reservedIpPatch, err := reservedIpPatchModel.AsPatch() - if err != nil { - return diag.FromErr(fmt.Errorf("[ERROR] Error calling asPatch for ReservedIPPatch: %s", err)) - } - updatereservedipoptions.ReservedIPPatch = reservedIpPatch - log.Printf("[INFO] vnip2 updatereservedipoptions %s", output(updatereservedipoptions)) - _, response, err := sess.UpdateSubnetReservedIP(updatereservedipoptions) - if err != nil { - return diag.FromErr(fmt.Errorf("[ERROR] Error while updating reserved ip(%s) of vni(%s) \n%s: %q", reserved_ip, d.Id(), err, response)) - } - ns.Remove(nA) - os.Remove(oA) + out[i] = newPack["reserved_ip"].(string) + } + newset = schema.NewSet(schema.HashString, out) + + out = make([]interface{}, os.Len(), os.Len()) + for i, oA := range os.List() { + oldPack := oA.(map[string]interface{}) + out[i] = oldPack["reserved_ip"].(string) + } + oldset = schema.NewSet(schema.HashString, out) + + remove := flex.ExpandStringList(oldset.Difference(newset).List()) + add := flex.ExpandStringList(newset.Difference(oldset).List()) + + // log.Printf("[INFO] vnip2 during patch old set is %s", output(os)) + // log.Printf("[INFO] vnip2 during patch new set is %s", output(ns)) + + // for _, nA := range ns.List() { + // newPack := nA.(map[string]interface{}) + // for _, oA := range os.List() { + // oldPack := oA.(map[string]interface{}) + // if strings.Compare(newPack["address"].(string), oldPack["address"].(string)) == 0 { + // reserved_ip := oldPack["reserved_ip"].(string) + // subnetId := d.Get("subnet").(string) + // newName := newPack["name"].(string) + // newAutoDelete := newPack["auto_delete"].(bool) + + // oldName := oldPack["name"].(string) + // oldAutoDelete := oldPack["auto_delete"].(bool) + + // if newName != oldName || newAutoDelete != oldAutoDelete { + + // updatereservedipoptions := &vpcv1.UpdateSubnetReservedIPOptions{ + // SubnetID: &subnetId, + // ID: &reserved_ip, + // } + + // reservedIpPatchModel := &vpcv1.ReservedIPPatch{} + // if strings.Compare(newName, oldName) != 0 { + // reservedIpPatchModel.Name = &newName + // } + + // if newAutoDelete != oldAutoDelete { + // reservedIpPatchModel.AutoDelete = &newAutoDelete + // } + + // reservedIpPatch, err := reservedIpPatchModel.AsPatch() + // if err != nil { + // return diag.FromErr(fmt.Errorf("[ERROR] Error calling asPatch for ReservedIPPatch: %s", err)) + // } + // updatereservedipoptions.ReservedIPPatch = reservedIpPatch + // log.Printf("[INFO] vnip2 updatereservedipoptions %s", output(updatereservedipoptions)) + // _, response, err := sess.UpdateSubnetReservedIP(updatereservedipoptions) + // if err != nil { + // return diag.FromErr(fmt.Errorf("[ERROR] Error while updating reserved ip(%s) of vni(%s) \n%s: %q", reserved_ip, d.Id(), err, response)) + // } + // ns.Remove(nA) + // os.Remove(oA) + // } + // } + // } + // } + // remove := os.Difference(ns).List() + // log.Printf("[INFO] vnip2 remove map %s", output(remove)) + // if remove != nil && len(remove) > 0 { + // subnetId := d.Get("subnet").(string) + // for _, ipItem := range remove { + // value := ipItem.(map[string]interface{}) + // if value["reserved_ip"] != nil && value["reserved_ip"].(string) != "" { + // reservedipid := value["reserved_ip"].(string) + // removeVirtualNetworkInterfaceIPOptions := &vpcv1.RemoveVirtualNetworkInterfaceIPOptions{} + // removeVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(id) + // removeVirtualNetworkInterfaceIPOptions.SetID(reservedipid) + // response, err := sess.RemoveVirtualNetworkInterfaceIPWithContext(context, removeVirtualNetworkInterfaceIPOptions) + // if err != nil { + // log.Printf("[DEBUG] RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response) + // return diag.FromErr(fmt.Errorf("RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response)) + // } + // } + // if value["address"] != nil && value["address"].(string) != "" { + // reservedipid := value["reserved_ip"].(string) + // removeSubnetReservedIPOptions := &vpcv1.DeleteSubnetReservedIPOptions{} + // removeSubnetReservedIPOptions.SetSubnetID(subnetId) + // removeSubnetReservedIPOptions.SetID(reservedipid) + // response, err := sess.DeleteSubnetReservedIPWithContext(context, removeSubnetReservedIPOptions) + // if err != nil { + // log.Printf("[DEBUG] DeleteSubnetReservedIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response) + // return diag.FromErr(fmt.Errorf("DeleteSubnetReservedIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response)) + // } + // } + // } + // } + // add := ns.Difference(os).List() + // log.Printf("[INFO] vnip2 add map %s", output(add)) + + if add != nil && len(add) > 0 { + for _, ipItem := range add { + if ipItem != "" { + + addVirtualNetworkInterfaceIPOptions := &vpcv1.AddVirtualNetworkInterfaceIPOptions{} + addVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(id) + addVirtualNetworkInterfaceIPOptions.SetID(ipItem) + _, response, err := sess.AddVirtualNetworkInterfaceIPWithContext(context, addVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response)) } } } } - remove := os.Difference(ns).List() - log.Printf("[INFO] vnip2 remove map %s", output(remove)) if remove != nil && len(remove) > 0 { - subnetId := d.Get("subnet").(string) for _, ipItem := range remove { - value := ipItem.(map[string]interface{}) - if value["reserved_ip"] != nil && value["reserved_ip"].(string) != "" { - reservedipid := value["reserved_ip"].(string) + if ipItem != "" { + removeVirtualNetworkInterfaceIPOptions := &vpcv1.RemoveVirtualNetworkInterfaceIPOptions{} removeVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(id) - removeVirtualNetworkInterfaceIPOptions.SetID(reservedipid) + removeVirtualNetworkInterfaceIPOptions.SetID(ipItem) response, err := sess.RemoveVirtualNetworkInterfaceIPWithContext(context, removeVirtualNetworkInterfaceIPOptions) if err != nil { log.Printf("[DEBUG] RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response) return diag.FromErr(fmt.Errorf("RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response)) } } - if value["address"] != nil && value["address"].(string) != "" { - reservedipid := value["reserved_ip"].(string) - removeSubnetReservedIPOptions := &vpcv1.DeleteSubnetReservedIPOptions{} - removeSubnetReservedIPOptions.SetSubnetID(subnetId) - removeSubnetReservedIPOptions.SetID(reservedipid) - response, err := sess.DeleteSubnetReservedIPWithContext(context, removeSubnetReservedIPOptions) - if err != nil { - log.Printf("[DEBUG] DeleteSubnetReservedIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("DeleteSubnetReservedIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response)) - } - } - } - } - add := ns.Difference(os).List() - log.Printf("[INFO] vnip2 add map %s", output(add)) - - if add != nil && len(add) > 0 { - for _, ipItem := range add { - value := ipItem.(map[string]interface{}) - if value["reserved_ip"] != nil && value["reserved_ip"].(string) != "" { - reservedipid := value["reserved_ip"].(string) - addVirtualNetworkInterfaceIPOptions := &vpcv1.AddVirtualNetworkInterfaceIPOptions{} - addVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(id) - addVirtualNetworkInterfaceIPOptions.SetID(reservedipid) - _, response, err := sess.AddVirtualNetworkInterfaceIPWithContext(context, addVirtualNetworkInterfaceIPOptions) - if err != nil { - log.Printf("[DEBUG] AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch %s\n%s", err, response)) - } - } } } @@ -782,22 +828,22 @@ func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfaceIPsReserved if modelMap["reserved_ip"] != nil && modelMap["reserved_ip"].(string) != "" { model.ID = core.StringPtr(modelMap["reserved_ip"].(string)) } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { - model.Href = core.StringPtr(modelMap["href"].(string)) - } - if modelMap["address"] != nil && modelMap["address"].(string) != "" { - model.Address = core.StringPtr(modelMap["address"].(string)) - } - if modelMap["auto_delete"] != nil { - model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) - } - if modelMap["name"] != nil && modelMap["name"].(string) != "" { - model.Name = core.StringPtr(modelMap["name"].(string)) - } + // if modelMap["href"] != nil && modelMap["href"].(string) != "" { + // model.Href = core.StringPtr(modelMap["href"].(string)) + // } + // if modelMap["address"] != nil && modelMap["address"].(string) != "" { + // model.Address = core.StringPtr(modelMap["address"].(string)) + // } + // if modelMap["auto_delete"] != nil { + // model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + // } + // if modelMap["name"] != nil && modelMap["name"].(string) != "" { + // model.Name = core.StringPtr(modelMap["name"].(string)) + // } return model, nil } -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeIntf, error) { +func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(modelMap map[string]interface{}, autodelete bool) (vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeIntf, error) { model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototype{} if modelMap["reserved_ip"] != nil && modelMap["reserved_ip"].(string) != "" { model.ID = core.StringPtr(modelMap["reserved_ip"].(string)) @@ -808,9 +854,7 @@ func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPRe if modelMap["address"] != nil && modelMap["address"].(string) != "" { model.Address = core.StringPtr(modelMap["address"].(string)) } - if modelMap["auto_delete"] != nil { - model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) - } + model.AutoDelete = core.BoolPtr(autodelete) if modelMap["name"] != nil && modelMap["name"].(string) != "" { model.Name = core.StringPtr(modelMap["name"].(string)) } @@ -825,9 +869,10 @@ func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrototypeRe return model, nil } -func resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcv1.ReservedIPReference) (map[string]interface{}, error) { +func resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcv1.ReservedIPReference, autodelete bool) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["address"] = model.Address + modelMap["auto_delete"] = autodelete if model.Deleted != nil { deletedMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model.Deleted) if err != nil { @@ -1025,14 +1070,6 @@ func resourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcv1.V return modelMap, nil } -func hashIpsList(v interface{}) int { - var buf bytes.Buffer - a := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", a["address"].(string))) - buf.WriteString(fmt.Sprintf("%s-", a["name"].(string))) - buf.WriteString(fmt.Sprintf("%s-", a["reserved_ip"].(string))) - return conns.String(buf.String()) -} func output(vnimap interface{}) string { output, err := json.MarshalIndent(vnimap, "", " ") if err == nil { @@ -1041,3 +1078,30 @@ func output(vnimap interface{}) string { return fmt.Sprintf("block : %#v", vnimap) } } + +func hashIpsList(v interface{}) int { + var buf bytes.Buffer + a := v.(map[string]interface{}) + // buf.WriteString(fmt.Sprintf("%s-", a["address"].(string))) + buf.WriteString(fmt.Sprintf("%s-", a["reserved_ip"].(string))) + return conns.String(buf.String()) +} + +// func suppressIPsVNI(k, old, new string, d *schema.ResourceData) bool { +// oldips, newips := d.GetChange("ips") +// os := oldips.(*schema.Set) +// ns := newips.(*schema.Set) +// if os.Len() == ns.Len() { +// for _, nA := range ns.List() { +// newPack := nA.(map[string]interface{}) +// for _, oA := range os.List() { +// oldPack := oA.(map[string]interface{}) +// if strings.Compare(newPack["name"].(string), oldPack["address"].(string)) == 0 { +// } +// } +// } +// return true +// } else { +// return false +// } +// } From f5b5a211c832bcc4956a8471fbf9c21615c4cb53 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 11 Oct 2023 18:19:49 +0530 Subject: [PATCH 031/132] Update resource_ibm_is_virtual_network_interface_floating_ip.go --- .../resource_ibm_is_virtual_network_interface_floating_ip.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go index b35f21a25e..d1815061a7 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_floating_ip.go @@ -95,7 +95,7 @@ func resourceIBMIsVirtualNetworkInterfaceFloatingIPCreate(context context.Contex d.SetId(MakeTerraformVNIFloatingIpID(vniId, fipId)) resourceIBMIsVirtualNetworkInterfaceFloatingIPGet(d, floatingIP) - return resourceIBMIsVirtualNetworkInterfaceFloatingIPRead(context, d, meta) + return nil } func resourceIBMIsVirtualNetworkInterfaceFloatingIPRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { From a734a0052c5f526effed27c95332a4e0cae3eb80 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 11 Oct 2023 18:24:08 +0530 Subject: [PATCH 032/132] Update is_virtual_network_interface.html.markdown --- .../docs/r/is_virtual_network_interface.html.markdown | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/website/docs/r/is_virtual_network_interface.html.markdown b/website/docs/r/is_virtual_network_interface.html.markdown index cd10346c1c..e7ed1a65b9 100644 --- a/website/docs/r/is_virtual_network_interface.html.markdown +++ b/website/docs/r/is_virtual_network_interface.html.markdown @@ -30,17 +30,10 @@ You can specify the following arguments for this resource. - `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted. - `enable_infrastructure_nat` - (Optional, Boolean) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`. -~> **NOTE** to update/add new `ips` only existing `reserved_ip` is supported, new reserved_ip creation on update is not supported as it leads to unmanaged(dangling) reserved ips. +~> **NOTE** to add `ips` only existing `reserved_ip` is supported, new reserved_ip creation is not supported as it leads to unmanaged(dangling) reserved ips. Use `ibm_is_subnet_reserved_ip` to create a reserved_ip - `ips` - (Optional, List) The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`. Nested schema for **ips**: - - `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. - - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. - Nested schema for **deleted**: - - `more_info` - (Required, String) Link to documentation about deleted resources. - - `href` - (Required, String) The URL for this reserved IP. - `reserved_ip` - (Required, String) The unique identifier for this reserved IP. - - `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - - `resource_type` - (Computed, String) The resource type. - `name` - (Optional, String) The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - `primary_ip` - (Optional, List) The reserved IP for this virtual network interface. Nested schema for **primary_ip**: From 1307c0fe820830fc93b34f045a618785f25f1d26 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 25 Oct 2023 22:24:23 +0530 Subject: [PATCH 033/132] doc changes --- website/docs/d/is_flow_logs.html.markdown | 2 +- website/docs/d/is_virtual_network_interface_ip.html.markdown | 3 +++ website/docs/d/is_virtual_network_interface_ips.html.markdown | 3 +++ website/docs/r/is_flow_log.html.markdown | 3 ++- website/docs/r/is_virtual_network_interface_ip.html.markdown | 3 +++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/website/docs/d/is_flow_logs.html.markdown b/website/docs/d/is_flow_logs.html.markdown index 70e52038d1..82c158d72e 100644 --- a/website/docs/d/is_flow_logs.html.markdown +++ b/website/docs/d/is_flow_logs.html.markdown @@ -48,7 +48,7 @@ Review the argument references that you can specify for your data source. - `vpc` - (String) The ID of the VPC this flow log collector resides in - `resource_group` - (String) The ID of the Resource group this flow log collector belongs to - `target` - (String) The ID of the target this collector is collecting flow logs for. -- `target_resource_type` - (String) The target resource type for this flow log collector. Available options are `instance`, `network_interface`, `subnet`, `vpc`, `virtual_network_interface` +- `target_resource_type` - (String) The target resource type for this flow log collector. Available options are `instance`, `instance_network_attachment`, `network_interface`, `subnet`, `vpc`, `virtual_network_interface` ## Attribute reference Review the attribute references that you can access after you retrieve your data source. diff --git a/website/docs/d/is_virtual_network_interface_ip.html.markdown b/website/docs/d/is_virtual_network_interface_ip.html.markdown index 986fea5f30..c9eb2b1a07 100644 --- a/website/docs/d/is_virtual_network_interface_ip.html.markdown +++ b/website/docs/d/is_virtual_network_interface_ip.html.markdown @@ -33,5 +33,8 @@ After your data source is created, you can read values from the following attrib - `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. - `href` - (String) The URL for this reserved IP. - `id` - (String) The unique identifier for this reserved IP. +- `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. + Nested scheme for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. - `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - `resource_type` - (String) The resource type. diff --git a/website/docs/d/is_virtual_network_interface_ips.html.markdown b/website/docs/d/is_virtual_network_interface_ips.html.markdown index 97be8cae1c..913ba86a63 100644 --- a/website/docs/d/is_virtual_network_interface_ips.html.markdown +++ b/website/docs/d/is_virtual_network_interface_ips.html.markdown @@ -34,6 +34,9 @@ After your data source is created, you can read values from the following attrib Nested schema for **reserved_ips**: - `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. - `href` - (String) The URL for this reserved IP. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. + Nested scheme for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. - `id` - (String) The unique identifier for this reserved IP. - `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - `resource_type` - (String) The resource type. diff --git a/website/docs/r/is_flow_log.html.markdown b/website/docs/r/is_flow_log.html.markdown index 29f94e47eb..5a2c5fff5c 100644 --- a/website/docs/r/is_flow_log.html.markdown +++ b/website/docs/r/is_flow_log.html.markdown @@ -88,7 +88,8 @@ Review the argument references that you can specify for your resource. **•** If the target is an instance network attachment, flow logs will be collected for that instance network attachment.
**•** If the target is an instance network interface, flow logs will be collected for that instance network interface.
**•** If the target is a virtual network interface, flow logs will be collected for the the virtual network interface's `target` resource if the resource is: - an instance network attachment.
- **•** If the target is a virtual server instance, flow logs will be collected for all network 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 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 collectedfor any instance network attachments or instance network interfaces within the targetthat are themselves the target of a more specific flow log collector.
- `storage_bucket` - (Required, Forces new resource, String) The name of the IBM 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. - `active` - (Optional, String) Indicates whether the collector is active. If **false**, this collector is created in inactive mode. Default value is true. diff --git a/website/docs/r/is_virtual_network_interface_ip.html.markdown b/website/docs/r/is_virtual_network_interface_ip.html.markdown index baa7701f94..240458e95f 100644 --- a/website/docs/r/is_virtual_network_interface_ip.html.markdown +++ b/website/docs/r/is_virtual_network_interface_ip.html.markdown @@ -31,6 +31,9 @@ You can specify the following arguments for this resource. After your resource is created, you can read values from the listed arguments and the following attributes. - `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. +- `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. + Nested scheme for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. - `href` - (String) The URL for this reserved IP. - `id` - (String) The unique identifier for this reserved IP. - `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. From 649b707ee029e8801ff23c3fa3866bdfa163e569 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 25 Oct 2023 22:40:06 +0530 Subject: [PATCH 034/132] doc fix and rg addition --- ...ource_ibm_is_virtual_network_interfaces.go | 26 ++++++++++++++----- ...s_virtual_network_interfaces.html.markdown | 2 ++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go index 30d4afd347..1836a4af03 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go @@ -411,24 +411,38 @@ func DataSourceIBMIsVirtualNetworkInterfaces() *schema.Resource { }, }, }, + "resource_group": { + Type: schema.TypeString, + Optional: true, + Description: "The unique identifier of the resource group these virtual network interfaces belong to", + }, }, } } func dataSourceIBMIsVirtualNetworkInterfacesRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - vpcbetaClient, err := meta.(conns.ClientSession).VpcV1API() + vpcClient, err := meta.(conns.ClientSession).VpcV1API() if err != nil { return diag.FromErr(err) } listVirtualNetworkInterfacesOptions := &vpcv1.ListVirtualNetworkInterfacesOptions{} + if resgroupintf, ok := d.GetOk("resource_group"); ok { + resGroup := resgroupintf.(string) + listVirtualNetworkInterfacesOptions.ResourceGroupID = &resGroup + } + var pager *vpcv1.VirtualNetworkInterfacesPager + pager, err = vpcClient.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptions) + if err != nil { + return diag.FromErr(err) + } - vniCollection, response, err := vpcbetaClient.ListVirtualNetworkInterfacesWithContext(context, listVirtualNetworkInterfacesOptions) - //log.Printf(len(vniCollection.VirtualNetworkInterfaces)) + allItems, err := pager.GetAll() if err != nil { - log.Printf("[DEBUG] VirtualNetworkInterfacesPager.GetAll() failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("VirtualNetworkInterfacesPager.GetAll() failed %s\n%s", err, response)) + log.Printf("[DEBUG] VirtualNetworkInterfacesPager.GetAll() failed %s", err) + return diag.FromErr(fmt.Errorf("VirtualNetworkInterfacesPager.GetAll() failed %s", err)) } + // var pager *vpcv1.VirtualNetworkInterfacesPager // pager, err = vpcbetaClient.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptions) // if err != nil { @@ -444,7 +458,7 @@ func dataSourceIBMIsVirtualNetworkInterfacesRead(context context.Context, d *sch d.SetId(dataSourceIBMIsVirtualNetworkInterfacesID(d)) mapSlice := []map[string]interface{}{} - for _, modelItem := range vniCollection.VirtualNetworkInterfaces { + for _, modelItem := range allItems { modelMap, err := dataSourceIBMIsVirtualNetworkInterfacesVirtualNetworkInterfaceToMap(&modelItem) if err != nil { return diag.FromErr(err) diff --git a/website/docs/d/is_virtual_network_interfaces.html.markdown b/website/docs/d/is_virtual_network_interfaces.html.markdown index 12b78c724a..57e8124a3c 100644 --- a/website/docs/d/is_virtual_network_interfaces.html.markdown +++ b/website/docs/d/is_virtual_network_interfaces.html.markdown @@ -20,6 +20,8 @@ data "ibm_is_virtual_network_interfaces" "example" { ## Attribute Reference +- `resource_group` - (Optional, String) The ID of the Resource group these virtual network interfaces belong to. + In addition to all argument references listed, you can access the following attribute references after your data source is created. - `virtual_network_interfaces` - (List) Collection of virtual network interfaces. From 0eaba69efb557831d1506fdb70cba98493bfbb2c Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar <78945437+ujjwal-ibm@users.noreply.github.com> Date: Wed, 25 Oct 2023 17:43:55 +0000 Subject: [PATCH 035/132] 2 - vni phase 2 - instance changes (#279) * instance changes * vni bare metal changes * Update resource_ibm_is_instance.go * some changes * updated instance * updating tests * doc udpate * fixed show change issue * Update main.tf * reverted bm changes * added deprecation message * merge issues * Update resource_ibm_is_instance_network_attachment.go * Update data_source_ibm_is_instances_test.go * template changes * instance profile changes * test * Update resource_ibm_is_instance_template.go * doc update * updated tests * removed deprecation * Update data_source_ibm_is_instance_network_interfaces.go * network attachments test cases * doc update and test update * Update resource_ibm_is_instance_network_interface_floating_ip.go * Update resource_ibm_is_instance_network_attachment_test.go * instance template changes * it changes removed * doc cleanup * max items set * Update resource_ibm_is_instance_network_attachment.go * test changes * some code changes to fix auto delete change * Update resource_ibm_is_instance.go * Update resource_ibm_is_instance.go * Update resource_ibm_is_instance.go * doc fix * Update is_instance.html.markdown --- examples/ibm-is-ng/main.tf | 38 + ibm/provider/provider.go | 4 + .../vpc/data_source_ibm_is_instance.go | 386 ++++++- ...urce_ibm_is_instance_network_attachment.go | 342 +++++++ ...ibm_is_instance_network_attachment_test.go | 61 ++ ...rce_ibm_is_instance_network_attachments.go | 334 +++++++ ...bm_is_instance_network_attachments_test.go | 62 ++ .../data_source_ibm_is_instance_profile.go | 51 + ...ata_source_ibm_is_instance_profile_test.go | 2 + .../data_source_ibm_is_instance_profiles.go | 29 + ...ta_source_ibm_is_instance_profiles_test.go | 2 + .../vpc/data_source_ibm_is_instance_test.go | 89 ++ .../vpc/data_source_ibm_is_instances.go | 303 ++++++ .../vpc/data_source_ibm_is_instances_test.go | 48 + ibm/service/vpc/resource_ibm_is_instance.go | 940 +++++++++++++++++- ...urce_ibm_is_instance_network_attachment.go | 905 +++++++++++++++++ ...ibm_is_instance_network_attachment_test.go | 281 ++++++ .../vpc/resource_ibm_is_instance_test.go | 80 ++ website/docs/d/is_instance.html.markdown | 60 ++ ..._instance_network_attachment.html.markdown | 70 ++ ...instance_network_attachments.html.markdown | 69 ++ .../docs/d/is_instance_profile.html.markdown | 7 + .../docs/d/is_instance_profiles.html.markdown | 8 + website/docs/d/is_instances.html.markdown | 62 +- website/docs/r/is_instance.html.markdown | 118 ++- ..._instance_network_attachment.html.markdown | 88 ++ 26 files changed, 4405 insertions(+), 34 deletions(-) create mode 100644 ibm/service/vpc/data_source_ibm_is_instance_network_attachment.go create mode 100644 ibm/service/vpc/data_source_ibm_is_instance_network_attachment_test.go create mode 100644 ibm/service/vpc/data_source_ibm_is_instance_network_attachments.go create mode 100644 ibm/service/vpc/data_source_ibm_is_instance_network_attachments_test.go create mode 100644 ibm/service/vpc/resource_ibm_is_instance_network_attachment.go create mode 100644 ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go create mode 100644 website/docs/d/is_instance_network_attachment.html.markdown create mode 100644 website/docs/d/is_instance_network_attachments.html.markdown create mode 100644 website/docs/r/is_instance_network_attachment.html.markdown diff --git a/examples/ibm-is-ng/main.tf b/examples/ibm-is-ng/main.tf index 18cb47bbec..e6a283e235 100644 --- a/examples/ibm-is-ng/main.tf +++ b/examples/ibm-is-ng/main.tf @@ -1458,3 +1458,41 @@ resource "ibm_is_virtual_network_interface_ip" "testacc_vni_reservedip" { virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id reserved_ip = ibm_is_subnet_reserved_ip.testacc_reservedip.reserved_ip } + +resource "ibm_is_virtual_network_interface" "testacc_vni2"{ + name = "${var.name}-2" + subnet = ibm_is_subnet.testacc_subnet.id + enable_infrastructure_nat = true + allow_ip_spoofing = true +} +resource "ibm_is_virtual_network_interface" "testacc_vni3"{ + name = "${var.name}-3" + subnet = ibm_is_subnet.testacc_subnet.id + enable_infrastructure_nat = true + allow_ip_spoofing = true +} +resource "ibm_is_ssh_key" "testacc_sshkey" { + name = "${var.name}-ssh" + public_key = file("~/.ssh/id_rsa.pub") +} +resource "ibm_is_instance_network_attachment" "ina" { + instance = ibm_is_instance.ins.id + name = "viability-undecided-jalapeno-unbuilt" + virtual_network_interface { + id = ibm_is_virtual_network_interface.testacc_vni2.id + } +} +resource "ibm_is_instance" "ins" { + name = "${var.name}-vsi2" + profile = "bx2-2x8" + image = "r134-f47cc24c-e020-4db5-ad96-1e5be8b5853b" + primary_network_attachment { + name = "vni-test" + virtual_network_interface { + id = ibm_is_virtual_network_interface.testacc_vni3.id + } + } + vpc = ibm_is_vpc.testacc_vpc.id + zone = "${var.region}-2" + keys = [ibm_is_ssh_key.testacc_sshkey.id] +} \ No newline at end of file diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index 5471ee94d0..b0d8132f76 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -435,6 +435,8 @@ func Provider() *schema.Provider { "ibm_is_instance_profiles": vpc.DataSourceIBMISInstanceProfiles(), "ibm_is_instance": vpc.DataSourceIBMISInstance(), "ibm_is_instances": vpc.DataSourceIBMISInstances(), + "ibm_is_instance_network_attachment": vpc.DataSourceIBMIsInstanceNetworkAttachment(), + "ibm_is_instance_network_attachments": vpc.DataSourceIBMIsInstanceNetworkAttachments(), "ibm_is_instance_network_interface": vpc.DataSourceIBMIsInstanceNetworkInterface(), "ibm_is_instance_network_interfaces": vpc.DataSourceIBMIsInstanceNetworkInterfaces(), "ibm_is_instance_disk": vpc.DataSourceIbmIsInstanceDisk(), @@ -1028,6 +1030,7 @@ func Provider() *schema.Provider { "ibm_is_flow_log": vpc.ResourceIBMISFlowLog(), "ibm_is_instance": vpc.ResourceIBMISInstance(), "ibm_is_instance_action": vpc.ResourceIBMISInstanceAction(), + "ibm_is_instance_network_attachment": vpc.ResourceIBMIsInstanceNetworkAttachment(), "ibm_is_instance_network_interface": vpc.ResourceIBMIsInstanceNetworkInterface(), "ibm_is_instance_network_interface_floating_ip": vpc.ResourceIBMIsInstanceNetworkInterfaceFloatingIp(), "ibm_is_instance_disk_management": vpc.ResourceIBMISInstanceDiskManagement(), @@ -1458,6 +1461,7 @@ func Validator() validate.ValidatorDict { "ibm_is_instance_template": vpc.ResourceIBMISInstanceTemplateValidator(), "ibm_is_instance": vpc.ResourceIBMISInstanceValidator(), "ibm_is_instance_action": vpc.ResourceIBMISInstanceActionValidator(), + "ibm_is_instance_network_attachment": vpc.ResourceIBMIsInstanceNetworkAttachmentValidator(), "ibm_is_instance_network_interface": vpc.ResourceIBMIsInstanceNetworkInterfaceValidator(), "ibm_is_instance_disk_management": vpc.ResourceIBMISInstanceDiskManagementValidator(), "ibm_is_instance_volume_attachment": vpc.ResourceIBMISInstanceVolumeAttachmentValidator(), diff --git a/ibm/service/vpc/data_source_ibm_is_instance.go b/ibm/service/vpc/data_source_ibm_is_instance.go index 7eda5dac54..d1300c0075 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance.go +++ b/ibm/service/vpc/data_source_ibm_is_instance.go @@ -5,6 +5,7 @@ package vpc import ( "bytes" + "context" "crypto/rand" "crypto/rsa" "crypto/x509" @@ -18,6 +19,7 @@ import ( "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/ScaleFT/sshkeys" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "golang.org/x/crypto/ssh" ) @@ -38,7 +40,7 @@ const ( func DataSourceIBMISInstance() *schema.Resource { return &schema.Resource{ - Read: dataSourceIBMISInstanceRead, + ReadContext: dataSourceIBMISInstanceRead, Schema: map[string]*schema.Schema{ @@ -305,6 +307,7 @@ func DataSourceIBMISInstance() *schema.Resource { isInstancePrimaryNetworkInterface: { Type: schema.TypeList, Computed: true, + Deprecated: "This `primary_network_interface` attribute is deprecated`", Description: "Primary Network interface info", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -378,9 +381,149 @@ func DataSourceIBMISInstance() *schema.Resource { }, }, + "primary_network_attachment": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The primary network attachment for this virtual server instance.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this network attachment.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this network attachment.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "primary_ip": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The primary IP address of the virtual network interface for the network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "subnet": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The subnet of the virtual network interface for the network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this subnet.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this subnet.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this subnet.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this subnet. The name is unique across all subnets in the VPC.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + }, + }, + }, + isInstanceNetworkInterfaces: { Type: schema.TypeList, Computed: true, + Deprecated: "This `network_interfaces` attribute is deprecated`", Description: "Instance Network interface info", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -449,6 +592,145 @@ func DataSourceIBMISInstance() *schema.Resource { }, }, + "network_attachments": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The network attachments for this virtual server instance, including the primary network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this network attachment.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this network attachment.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "primary_ip": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The primary IP address of the virtual network interface for the network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "subnet": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The subnet of the virtual network interface for the network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this subnet.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this subnet.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this subnet.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this subnet. The name is unique across all subnets in the VPC.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + }, + }, + }, + isInstanceImage: { Type: schema.TypeString, Computed: true, @@ -695,13 +977,13 @@ func DataSourceIBMISInstance() *schema.Resource { } } -func dataSourceIBMISInstanceRead(d *schema.ResourceData, meta interface{}) error { +func dataSourceIBMISInstanceRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { name := d.Get(isInstanceName).(string) err := instanceGetByName(d, meta, name) if err != nil { - return err + return diag.FromErr(err) } return nil } @@ -858,6 +1140,17 @@ func instanceGetByName(d *schema.ResourceData, meta interface{}, name string) er primaryNicList = append(primaryNicList, currentPrimNic) d.Set(isInstancePrimaryNetworkInterface, primaryNicList) } + primaryNetworkAttachment := []map[string]interface{}{} + if instance.PrimaryNetworkAttachment != nil { + modelMap, err := dataSourceIBMIsInstanceInstanceNetworkAttachmentReferenceToMap(instance.PrimaryNetworkAttachment) + if err != nil { + return err + } + primaryNetworkAttachment = append(primaryNetworkAttachment, modelMap) + } + if err = d.Set("primary_network_attachment", primaryNetworkAttachment); err != nil { + return fmt.Errorf("Error setting primary_network_attachment %s", err) + } if instance.NetworkInterfaces != nil { interfacesList := make([]map[string]interface{}, 0) @@ -912,6 +1205,19 @@ func instanceGetByName(d *schema.ResourceData, meta interface{}, name string) er d.Set(isInstanceNetworkInterfaces, interfacesList) } + networkAttachments := []map[string]interface{}{} + if instance.NetworkAttachments != nil { + for _, modelItem := range instance.NetworkAttachments { + modelMap, err := dataSourceIBMIsInstanceInstanceNetworkAttachmentReferenceToMap(&modelItem) + if err != nil { + return err + } + networkAttachments = append(networkAttachments, modelMap) + } + } + if err = d.Set("network_attachments", networkAttachments); err != nil { + return fmt.Errorf("Error setting network_attachments %s", err) + } var rsaKey *rsa.PrivateKey if instance.Image != nil { @@ -1188,3 +1494,77 @@ func dataSourceInstanceFlattenLifecycleReasons(lifecycleReasons []vpcv1.Instance } return lifecycleReasonsList } + +func dataSourceIBMIsInstanceInstanceNetworkAttachmentReferenceToMap(model *vpcv1.InstanceNetworkAttachmentReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsInstanceInstanceNetworkAttachmentReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + primaryIPMap, err := dataSourceIBMIsInstanceReservedIPReferenceToMap(model.PrimaryIP) + if err != nil { + return modelMap, err + } + modelMap["primary_ip"] = []map[string]interface{}{primaryIPMap} + modelMap["resource_type"] = model.ResourceType + subnetMap, err := dataSourceIBMIsInstanceSubnetReferenceToMap(model.Subnet) + if err != nil { + return modelMap, err + } + modelMap["subnet"] = []map[string]interface{}{subnetMap} + return modelMap, nil +} +func dataSourceIBMIsInstanceInstanceNetworkAttachmentReferenceDeletedToMap(model *vpcv1.InstanceNetworkAttachmentReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} +func dataSourceIBMIsInstanceReservedIPReferenceToMap(model *vpcv1.ReservedIPReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["address"] = model.Address + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsInstanceReservedIPReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} +func dataSourceIBMIsInstanceSubnetReferenceToMap(model *vpcv1.SubnetReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsInstanceSubnetReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} +func dataSourceIBMIsInstanceSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func dataSourceIBMIsInstanceReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} diff --git a/ibm/service/vpc/data_source_ibm_is_instance_network_attachment.go b/ibm/service/vpc/data_source_ibm_is_instance_network_attachment.go new file mode 100644 index 0000000000..3764651581 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_instance_network_attachment.go @@ -0,0 +1,342 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func DataSourceIBMIsInstanceNetworkAttachment() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIBMIsInstanceNetworkAttachmentRead, + + Schema: map[string]*schema.Schema{ + "instance": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The virtual server instance identifier.", + }, + "network_attachment": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The instance network attachment identifier.", + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date and time that the instance network attachment was created.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this instance network attachment.", + }, + "lifecycle_state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The lifecycle state of the instance network attachment.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this instance network attachment. The name is unique across all network attachments for the instance.", + }, + "port_speed": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The port speed for this instance network attachment in Mbps.", + }, + "primary_ip": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The primary IP address of the virtual network interface for the instance networkattachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "subnet": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The subnet of the virtual network interface for the instance network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this subnet.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this subnet.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this subnet.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this subnet. The name is unique across all subnets in the VPC.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The instance network attachment type.", + }, + "virtual_network_interface": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The virtual network interface for this instance network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this virtual network interface.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this virtual network interface.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this virtual network interface.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + }, + } +} + +func dataSourceIBMIsInstanceNetworkAttachmentRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + getInstanceNetworkAttachmentOptions := &vpcv1.GetInstanceNetworkAttachmentOptions{} + + getInstanceNetworkAttachmentOptions.SetInstanceID(d.Get("instance").(string)) + getInstanceNetworkAttachmentOptions.SetID(d.Get("network_attachment").(string)) + + instanceByNetworkAttachment, response, err := vpcClient.GetInstanceNetworkAttachmentWithContext(context, getInstanceNetworkAttachmentOptions) + if err != nil { + log.Printf("[DEBUG] GetInstanceNetworkAttachmentWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetInstanceNetworkAttachmentWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s/%s", *getInstanceNetworkAttachmentOptions.InstanceID, *getInstanceNetworkAttachmentOptions.ID)) + + if err = d.Set("created_at", flex.DateTimeToString(instanceByNetworkAttachment.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting created_at: %s", err)) + } + + if err = d.Set("href", instanceByNetworkAttachment.Href); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting href: %s", err)) + } + + if err = d.Set("lifecycle_state", instanceByNetworkAttachment.LifecycleState); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting lifecycle_state: %s", err)) + } + + if err = d.Set("name", instanceByNetworkAttachment.Name); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting name: %s", err)) + } + + if err = d.Set("port_speed", flex.IntValue(instanceByNetworkAttachment.PortSpeed)); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting port_speed: %s", err)) + } + + primaryIP := []map[string]interface{}{} + if instanceByNetworkAttachment.PrimaryIP != nil { + modelMap, err := dataSourceIBMIsInstanceNetworkAttachmentReservedIPReferenceToMap(instanceByNetworkAttachment.PrimaryIP) + if err != nil { + return diag.FromErr(err) + } + primaryIP = append(primaryIP, modelMap) + } + if err = d.Set("primary_ip", primaryIP); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting primary_ip %s", err)) + } + + if err = d.Set("resource_type", instanceByNetworkAttachment.ResourceType); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting resource_type: %s", err)) + } + + subnet := []map[string]interface{}{} + if instanceByNetworkAttachment.Subnet != nil { + modelMap, err := dataSourceIBMIsInstanceNetworkAttachmentSubnetReferenceToMap(instanceByNetworkAttachment.Subnet) + if err != nil { + return diag.FromErr(err) + } + subnet = append(subnet, modelMap) + } + if err = d.Set("subnet", subnet); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting subnet %s", err)) + } + + if err = d.Set("type", instanceByNetworkAttachment.Type); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting type: %s", err)) + } + + virtualNetworkInterface := []map[string]interface{}{} + if instanceByNetworkAttachment.VirtualNetworkInterface != nil { + modelMap, err := dataSourceIBMIsInstanceNetworkAttachmentVirtualNetworkInterfaceReferenceAttachmentContextToMap(instanceByNetworkAttachment.VirtualNetworkInterface) + if err != nil { + return diag.FromErr(err) + } + virtualNetworkInterface = append(virtualNetworkInterface, modelMap) + } + if err = d.Set("virtual_network_interface", virtualNetworkInterface); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting virtual_network_interface %s", err)) + } + + return nil +} + +func dataSourceIBMIsInstanceNetworkAttachmentReservedIPReferenceToMap(model *vpcv1.ReservedIPReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["address"] = model.Address + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsInstanceNetworkAttachmentReservedIPReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsInstanceNetworkAttachmentReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func dataSourceIBMIsInstanceNetworkAttachmentSubnetReferenceToMap(model *vpcv1.SubnetReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsInstanceNetworkAttachmentSubnetReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsInstanceNetworkAttachmentSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func dataSourceIBMIsInstanceNetworkAttachmentVirtualNetworkInterfaceReferenceAttachmentContextToMap(model *vpcv1.VirtualNetworkInterfaceReferenceAttachmentContext) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} diff --git a/ibm/service/vpc/data_source_ibm_is_instance_network_attachment_test.go b/ibm/service/vpc/data_source_ibm_is_instance_network_attachment_test.go new file mode 100644 index 0000000000..73848b93bb --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_instance_network_attachment_test.go @@ -0,0 +1,61 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIBMIsInstanceNetworkAttachmentDataSourceBasic(t *testing.T) { + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-instnace-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tf-subnet-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(`ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR`) + vniname := fmt.Sprintf("tf-vni-%d", acctest.RandIntRange(10, 100)) + sshname := fmt.Sprintf("tf-ssh-%d", acctest.RandIntRange(10, 100)) + userData1 := "a" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsInstanceNetworkAttachmentDataSourceConfigBasic(vpcname, subnetname, sshname, publicKey, name, vniname, userData1), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "instance"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "network_attachment"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "lifecycle_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "port_speed"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "primary_ip.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "subnet.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "type"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.id"), + ), + }, + }, + }) +} + +func testAccCheckIBMIsInstanceNetworkAttachmentDataSourceConfigBasic(vpcname, subnetname, sshname, publicKey, name, vniname, userData1 string) string { + return testAccCheckIBMISInstanceVniConfig(vpcname, subnetname, sshname, publicKey, name, vniname, userData1) + fmt.Sprintf(` + data "ibm_is_instance_network_attachment" "is_instance_network_attachment" { + instance = ibm_is_instance.testacc_instance.id + network_attachment = ibm_is_instance.testacc_instance.primary_network_attachment.0.id + } + `) +} diff --git a/ibm/service/vpc/data_source_ibm_is_instance_network_attachments.go b/ibm/service/vpc/data_source_ibm_is_instance_network_attachments.go new file mode 100644 index 0000000000..d530da4e44 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_instance_network_attachments.go @@ -0,0 +1,334 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func DataSourceIBMIsInstanceNetworkAttachments() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIBMIsInstanceNetworkAttachmentsRead, + + Schema: map[string]*schema.Schema{ + "instance": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The virtual server instance identifier.", + }, + "network_attachments": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Collection of instance network attachments.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date and time that the instance network attachment was created.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this instance network attachment.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this instance network attachment.", + }, + "lifecycle_state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The lifecycle state of the instance network attachment.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this instance network attachment. The name is unique across all network attachments for the instance.", + }, + "port_speed": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The port speed for this instance network attachment in Mbps.", + }, + "primary_ip": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The primary IP address of the virtual network interface for the instance networkattachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "subnet": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The subnet of the virtual network interface for the instance network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this subnet.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this subnet.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this subnet.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this subnet. The name is unique across all subnets in the VPC.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The instance network attachment type.", + }, + "virtual_network_interface": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The virtual network interface for this instance network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this virtual network interface.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this virtual network interface.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this virtual network interface.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func dataSourceIBMIsInstanceNetworkAttachmentsRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + listInstanceNetworkAttachmentsOptions := &vpcv1.ListInstanceNetworkAttachmentsOptions{} + + listInstanceNetworkAttachmentsOptions.SetInstanceID(d.Get("instance").(string)) + + instanceNetworkAttachmentCollection, response, err := vpcClient.ListInstanceNetworkAttachmentsWithContext(context, listInstanceNetworkAttachmentsOptions) + if err != nil { + log.Printf("[DEBUG] ListInstanceNetworkAttachmentsWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("ListInstanceNetworkAttachmentsWithContext failed %s\n%s", err, response)) + } + + d.SetId(dataSourceIBMIsInstanceNetworkAttachmentsID(d)) + + networkAttachments := []map[string]interface{}{} + if instanceNetworkAttachmentCollection.NetworkAttachments != nil { + for _, modelItem := range instanceNetworkAttachmentCollection.NetworkAttachments { + modelMap, err := dataSourceIBMIsInstanceNetworkAttachmentsInstanceNetworkAttachmentToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + networkAttachments = append(networkAttachments, modelMap) + } + } + if err = d.Set("network_attachments", networkAttachments); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting network_attachments %s", err)) + } + + return nil +} + +// dataSourceIBMIsInstanceNetworkAttachmentsID returns a reasonable ID for the list. +func dataSourceIBMIsInstanceNetworkAttachmentsID(d *schema.ResourceData) string { + return time.Now().UTC().String() +} + +func dataSourceIBMIsInstanceNetworkAttachmentsInstanceNetworkAttachmentToMap(model *vpcv1.InstanceNetworkAttachment) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["created_at"] = model.CreatedAt.String() + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["lifecycle_state"] = model.LifecycleState + modelMap["name"] = model.Name + modelMap["port_speed"] = flex.IntValue(model.PortSpeed) + primaryIPMap, err := dataSourceIBMIsInstanceNetworkAttachmentsReservedIPReferenceToMap(model.PrimaryIP) + if err != nil { + return modelMap, err + } + modelMap["primary_ip"] = []map[string]interface{}{primaryIPMap} + modelMap["resource_type"] = model.ResourceType + subnetMap, err := dataSourceIBMIsInstanceNetworkAttachmentsSubnetReferenceToMap(model.Subnet) + if err != nil { + return modelMap, err + } + modelMap["subnet"] = []map[string]interface{}{subnetMap} + modelMap["type"] = model.Type + virtualNetworkInterfaceMap, err := dataSourceIBMIsInstanceNetworkAttachmentsVirtualNetworkInterfaceReferenceAttachmentContextToMap(model.VirtualNetworkInterface) + if err != nil { + return modelMap, err + } + modelMap["virtual_network_interface"] = []map[string]interface{}{virtualNetworkInterfaceMap} + return modelMap, nil +} + +func dataSourceIBMIsInstanceNetworkAttachmentsReservedIPReferenceToMap(model *vpcv1.ReservedIPReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["address"] = model.Address + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsInstanceNetworkAttachmentsReservedIPReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsInstanceNetworkAttachmentsReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func dataSourceIBMIsInstanceNetworkAttachmentsSubnetReferenceToMap(model *vpcv1.SubnetReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsInstanceNetworkAttachmentsSubnetReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsInstanceNetworkAttachmentsSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func dataSourceIBMIsInstanceNetworkAttachmentsVirtualNetworkInterfaceReferenceAttachmentContextToMap(model *vpcv1.VirtualNetworkInterfaceReferenceAttachmentContext) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} diff --git a/ibm/service/vpc/data_source_ibm_is_instance_network_attachments_test.go b/ibm/service/vpc/data_source_ibm_is_instance_network_attachments_test.go new file mode 100644 index 0000000000..11b77a288f --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_instance_network_attachments_test.go @@ -0,0 +1,62 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIBMIsInstanceNetworkAttachmentsDataSourceBasic(t *testing.T) { + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-instnace-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tf-subnet-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(`ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR`) + vniname := fmt.Sprintf("tf-vni-%d", acctest.RandIntRange(10, 100)) + sshname := fmt.Sprintf("tf-ssh-%d", acctest.RandIntRange(10, 100)) + userData1 := "a" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsInstanceNetworkAttachmentsDataSourceConfigBasic(vpcname, subnetname, sshname, publicKey, name, vniname, userData1), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "instance"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.href"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.lifecycle_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.name"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.port_speed"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.port_speed"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.primary_ip.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.subnet.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.type"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.virtual_network_interface.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.virtual_network_interface.0.crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_network_attachments.is_instance_network_attachments", "network_attachments.0.virtual_network_interface.0.id"), + ), + }, + }, + }) +} + +func testAccCheckIBMIsInstanceNetworkAttachmentsDataSourceConfigBasic(vpcname, subnetname, sshname, publicKey, name, vniname, userData1 string) string { + return testAccCheckIBMISInstanceVniConfig(vpcname, subnetname, sshname, publicKey, name, vniname, userData1) + fmt.Sprintf(` + data "ibm_is_instance_network_attachments" "is_instance_network_attachments" { + instance = ibm_is_instance.testacc_instance.id + } + `) +} diff --git a/ibm/service/vpc/data_source_ibm_is_instance_profile.go b/ibm/service/vpc/data_source_ibm_is_instance_profile.go index 24815b68dc..37ab63a891 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_profile.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_profile.go @@ -486,6 +486,29 @@ func DataSourceIBMISInstanceProfile() *schema.Resource { }, }, }, + "network_attachment_count": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "max": { + Type: schema.TypeInt, + Computed: true, + Description: "The maximum value for this profile field", + }, + "min": { + Type: schema.TypeInt, + Computed: true, + Description: "The minimum value for this profile field", + }, + "type": { + Type: schema.TypeString, + Computed: true, + Description: "The type for this profile field.", + }, + }, + }, + }, "port_speed": { Type: schema.TypeList, Computed: true, @@ -696,6 +719,12 @@ func instanceProfileGet(d *schema.ResourceData, meta interface{}, name string) e return err } } + if profile.NetworkAttachmentCount != nil { + err = d.Set("network_attachment_count", dataSourceInstanceProfileFlattenNetworkAttachmentCount(*profile.NetworkAttachmentCount.(*vpcv1.InstanceProfileNetworkAttachmentCount))) + if err != nil { + return err + } + } if profile.PortSpeed != nil { err = d.Set("port_speed", dataSourceInstanceProfileFlattenPortSpeed(*profile.PortSpeed.(*vpcv1.InstanceProfilePortSpeed))) if err != nil { @@ -920,6 +949,28 @@ func dataSourceInstanceProfileFlattenNetworkInterfaceCount(result vpcv1.Instance return finalList } +func dataSourceInstanceProfileFlattenNetworkAttachmentCount(result vpcv1.InstanceProfileNetworkAttachmentCount) (finalList []map[string]interface{}) { + finalList = []map[string]interface{}{} + finalMap := dataSourceInstanceProfileNetworkAttachmentCount(result) + finalList = append(finalList, finalMap) + + return finalList +} + +func dataSourceInstanceProfileNetworkAttachmentCount(networkAttachmentCountItem vpcv1.InstanceProfileNetworkAttachmentCount) (networkAttachmentCountMap map[string]interface{}) { + networkAttachmentCountMap = map[string]interface{}{} + + if networkAttachmentCountItem.Max != nil { + networkAttachmentCountMap["max"] = networkAttachmentCountItem.Max + } + if networkAttachmentCountItem.Min != nil { + networkAttachmentCountMap["min"] = networkAttachmentCountItem.Min + } + if networkAttachmentCountItem.Type != nil { + networkAttachmentCountMap["type"] = networkAttachmentCountItem.Type + } + return networkAttachmentCountMap +} func dataSourceInstanceProfileNetworkInterfaceCount(networkInterfaceCountItem vpcv1.InstanceProfileNetworkInterfaceCount) (networkInterfaceCountMap map[string]interface{}) { networkInterfaceCountMap = map[string]interface{}{} diff --git a/ibm/service/vpc/data_source_ibm_is_instance_profile_test.go b/ibm/service/vpc/data_source_ibm_is_instance_profile_test.go index 21fa13546e..9c61072347 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_profile_test.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_profile_test.go @@ -36,6 +36,8 @@ func TestAccIBMISInstanceProfileDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrSet("data.ibm_is_instance_profile.test1", "vcpu_manufacturer.0.type"), resource.TestCheckResourceAttrSet("data.ibm_is_instance_profile.test1", "vcpu_manufacturer.0.value"), resource.TestCheckResourceAttrSet("data.ibm_is_instance_profile.test1", "network_interface_count.0.type"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_profile.test1", "network_attachment_count.0.type"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_profile.test1", "network_attachment_count.#"), ), }, }, diff --git a/ibm/service/vpc/data_source_ibm_is_instance_profiles.go b/ibm/service/vpc/data_source_ibm_is_instance_profiles.go index 6fc76a2cc4..a34b432eaf 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_profiles.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_profiles.go @@ -464,6 +464,29 @@ func DataSourceIBMISInstanceProfiles() *schema.Resource { }, }, }, + "network_attachment_count": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "max": { + Type: schema.TypeInt, + Computed: true, + Description: "The maximum value for this profile field", + }, + "min": { + Type: schema.TypeInt, + Computed: true, + Description: "The minimum value for this profile field", + }, + "type": { + Type: schema.TypeString, + Computed: true, + Description: "The type for this profile field.", + }, + }, + }, + }, "network_interface_count": { Type: schema.TypeList, Computed: true, @@ -689,6 +712,12 @@ func instanceProfilesList(d *schema.ResourceData, meta interface{}) error { networkInterfaceCountList = append(networkInterfaceCountList, networkInterfaceCountMap) l["network_interface_count"] = networkInterfaceCountList } + if profile.NetworkAttachmentCount != nil { + networkAttachmentCountList := []map[string]interface{}{} + networkAttachmentCountMap := dataSourceInstanceProfileNetworkAttachmentCount(*profile.NetworkAttachmentCount.(*vpcv1.InstanceProfileNetworkAttachmentCount)) + networkAttachmentCountList = append(networkAttachmentCountList, networkAttachmentCountMap) + l["network_attachment_count"] = networkAttachmentCountList + } if profile.PortSpeed != nil { portSpeedList := []map[string]interface{}{} portSpeedMap := dataSourceInstanceProfilePortSpeedToMap(*profile.PortSpeed.(*vpcv1.InstanceProfilePortSpeed)) diff --git a/ibm/service/vpc/data_source_ibm_is_instance_profiles_test.go b/ibm/service/vpc/data_source_ibm_is_instance_profiles_test.go index 5984669fbb..60554f9024 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_profiles_test.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_profiles_test.go @@ -34,6 +34,8 @@ func TestAccIBMISInstanceProfilesDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrSet("data.ibm_is_instance_profiles.test1", "profiles.0.vcpu_count.#"), resource.TestCheckResourceAttrSet("data.ibm_is_instance_profiles.test1", "profiles.0.network_interface_count.#"), resource.TestCheckResourceAttrSet("data.ibm_is_instance_profiles.test1", "profiles.0.network_interface_count.0.type"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_profiles.test1", "profiles.0.network_attachment_count.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_instance_profiles.test1", "profiles.0.network_attachment_count.0.type"), resource.TestCheckResourceAttrSet("data.ibm_is_instance_profiles.test1", "profiles.0.vcpu_manufacturer.#"), resource.TestCheckResourceAttrSet("data.ibm_is_instance_profiles.test1", "profiles.0.vcpu_manufacturer.0.type"), resource.TestCheckResourceAttrSet("data.ibm_is_instance_profiles.test1", "profiles.0.vcpu_manufacturer.0.value"), diff --git a/ibm/service/vpc/data_source_ibm_is_instance_test.go b/ibm/service/vpc/data_source_ibm_is_instance_test.go index fe42000ab0..389e0e92dc 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_test.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_test.go @@ -50,6 +50,51 @@ func TestAccIBMISInstanceDataSource_basic(t *testing.T) { }, }) } +func TestAccIBMISInstanceDataSource_vni(t *testing.T) { + + vpcname := fmt.Sprintf("tfins-vpc-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfins-subnet-%d", acctest.RandIntRange(10, 100)) + sshname := fmt.Sprintf("tfins-ssh-%d", acctest.RandIntRange(10, 100)) + instanceName := fmt.Sprintf("tfins-name-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tfins-vni-%d", acctest.RandIntRange(10, 100)) + resName := "data.ibm_is_instance.ds_instance" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISInstanceVniDataSourceConfig(vpcname, subnetname, sshname, vniname, instanceName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + resName, "name", instanceName), + resource.TestCheckResourceAttrSet( + resName, "primary_network_interface.0.port_speed"), + resource.TestCheckResourceAttrSet( + resName, "availability_policy_host_failure"), + resource.TestCheckResourceAttrSet( + resName, "lifecycle_state"), + resource.TestCheckResourceAttr( + resName, "lifecycle_reasons.#", "0"), + resource.TestCheckResourceAttrSet( + resName, "vcpu.#"), + resource.TestCheckResourceAttrSet( + resName, "vcpu.0.manufacturer"), + resource.TestCheckResourceAttrSet( + resName, "primary_network_attachment.#"), + resource.TestCheckResourceAttrSet( + resName, "primary_network_attachment.0.id"), + resource.TestCheckResourceAttr( + resName, "primary_network_attachment.0.name", "test-vni"), + resource.TestCheckResourceAttrSet( + resName, "primary_network_attachment.0.primary_ip.#"), + resource.TestCheckResourceAttrSet( + resName, "primary_network_attachment.0.subnet.#"), + ), + }, + }, + }) +} func TestAccIBMISInstanceDataSource_PKCS8SSH(t *testing.T) { vpcname := fmt.Sprintf("tfins-vpc-%d", acctest.RandIntRange(10, 100)) @@ -165,6 +210,50 @@ data "ibm_is_instance" "ds_instance" { passphrase = "" }`, vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, sshname, instanceName, acc.IsWinImage, acc.InstanceProfileName, acc.ISZoneName) } +func testAccCheckIBMISInstanceVniDataSourceConfig(vpcname, subnetname, sshname, vniname, instanceName string) string { + return fmt.Sprintf(` +resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" +} + +resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + ipv4_cidr_block = "%s" +} + +resource "ibm_is_ssh_key" "testacc_sshkey" { + name = "%s" + public_key = file("./test-fixtures/.ssh/id_rsa.pub") +} + +resource "ibm_is_virtual_network_interface" "testacc_vni"{ + name = "%s" + allow_ip_spoofing = true + subnet = ibm_is_subnet.testacc_subnet.id +} + +resource "ibm_is_instance" "testacc_instance" { + name = "%s" + image = "%s" + profile = "%s" + primary_network_attachment { + name = "test-vni" + virtual_network_interface { + id = ibm_is_virtual_network_interface.testacc_vni.id + } + } + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + keys = [ibm_is_ssh_key.testacc_sshkey.id] +} +data "ibm_is_instance" "ds_instance" { + name = ibm_is_instance.testacc_instance.name + private_key = file("./test-fixtures/.ssh/id_rsa") + passphrase = "" +}`, vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, sshname, vniname, instanceName, acc.IsWinImage, acc.InstanceProfileName, acc.ISZoneName) +} func testAccCheckIBMISInstanceDataSourcePKCS8SSHConfig(vpcname, subnetname, sshname, instanceName string) string { return fmt.Sprintf(` resource "ibm_is_vpc" "testacc_vpc" { diff --git a/ibm/service/vpc/data_source_ibm_is_instances.go b/ibm/service/vpc/data_source_ibm_is_instances.go index cb5d92ac4d..80aecc1e01 100644 --- a/ibm/service/vpc/data_source_ibm_is_instances.go +++ b/ibm/service/vpc/data_source_ibm_is_instances.go @@ -335,6 +335,7 @@ func DataSourceIBMISInstances() *schema.Resource { "primary_network_interface": { Type: schema.TypeList, Computed: true, + Deprecated: "This `primary_network_interface` attribute is deprecated`", Description: "Instance Primary Network Interface", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -402,6 +403,145 @@ func DataSourceIBMISInstances() *schema.Resource { }, }, }, + "primary_network_attachment": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The primary network attachment for this virtual server instance.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this network attachment.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this network attachment.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "primary_ip": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The primary IP address of the virtual network interface for the network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "subnet": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The subnet of the virtual network interface for the network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this subnet.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this subnet.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this subnet.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this subnet. The name is unique across all subnets in the VPC.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + }, + }, + }, + "placement_target": { Type: schema.TypeList, Computed: true, @@ -452,6 +592,7 @@ func DataSourceIBMISInstances() *schema.Resource { }, "network_interfaces": { Type: schema.TypeList, + Deprecated: "This `network_interfaces` attribute is deprecated`", Computed: true, Description: "Instance Network Interfaces", Elem: &schema.Resource{ @@ -520,6 +661,146 @@ func DataSourceIBMISInstances() *schema.Resource { }, }, }, + + "network_attachments": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The network attachments for this virtual server instance, including the primary network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this network attachment.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this network attachment.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "primary_ip": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The primary IP address of the virtual network interface for the network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "subnet": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The subnet of the virtual network interface for the network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this subnet.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this subnet.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this subnet.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this subnet. The name is unique across all subnets in the VPC.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + }, + }, + }, + "profile": { Type: schema.TypeString, Computed: true, @@ -995,6 +1276,16 @@ func instancesList(d *schema.ResourceData, meta interface{}) error { l["primary_network_interface"] = primaryNicList } + primaryNetworkAttachment := []map[string]interface{}{} + if instance.PrimaryNetworkAttachment != nil { + modelMap, err := dataSourceIBMIsInstanceInstanceNetworkAttachmentReferenceToMap(instance.PrimaryNetworkAttachment) + if err != nil { + return err + } + primaryNetworkAttachment = append(primaryNetworkAttachment, modelMap) + } + l["primary_network_attachment"] = primaryNetworkAttachment + if instance.NetworkInterfaces != nil { interfacesList := make([]map[string]interface{}, 0) for _, intfc := range instance.NetworkInterfaces { @@ -1047,6 +1338,18 @@ func instancesList(d *schema.ResourceData, meta interface{}) error { l["network_interfaces"] = interfacesList } + networkAttachments := []map[string]interface{}{} + if instance.NetworkAttachments != nil { + for _, modelItem := range instance.NetworkAttachments { + modelMap, err := dataSourceIBMIsInstanceInstanceNetworkAttachmentReferenceToMap(&modelItem) + if err != nil { + return err + } + networkAttachments = append(networkAttachments, modelMap) + } + } + l["network_attachments"] = networkAttachments + l["profile"] = *instance.Profile.Name cpuList := make([]map[string]interface{}, 0) diff --git a/ibm/service/vpc/data_source_ibm_is_instances_test.go b/ibm/service/vpc/data_source_ibm_is_instances_test.go index feb540be9d..49b1b962cb 100644 --- a/ibm/service/vpc/data_source_ibm_is_instances_test.go +++ b/ibm/service/vpc/data_source_ibm_is_instances_test.go @@ -63,6 +63,47 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE }, }) } +func TestAccIBMISInstancesDataSource_vni(t *testing.T) { + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-instnace-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tf-subnet-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(` +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR +`) + vniname := fmt.Sprintf("tf-vni-%d", acctest.RandIntRange(10, 100)) + sshname := fmt.Sprintf("tf-ssh-%d", acctest.RandIntRange(10, 100)) + userData1 := "a" + resName := "data.ibm_is_instances.ds_instances" + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISInstancesVniDataSourceConfig(vpcname, subnetname, sshname, publicKey, name, vniname, userData1), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(resName, "instances.0.name"), + resource.TestCheckResourceAttrSet(resName, "instances.0.memory"), + resource.TestCheckResourceAttrSet(resName, "instances.0.status"), + resource.TestCheckResourceAttrSet(resName, "instances.0.resource_group"), + resource.TestCheckResourceAttrSet(resName, "instances.0.vpc"), + resource.TestCheckResourceAttrSet(resName, "instances.0.boot_volume.#"), + resource.TestCheckResourceAttrSet(resName, "instances.0.volume_attachments.#"), + resource.TestCheckResourceAttrSet(resName, "instances.0.primary_network_interface.#"), + resource.TestCheckResourceAttrSet(resName, "instances.0.network_interfaces.#"), + resource.TestCheckResourceAttrSet(resName, "instances.0.profile"), + resource.TestCheckResourceAttrSet(resName, "instances.0.vcpu.#"), + resource.TestCheckResourceAttrSet(resName, "instances.0.zone"), + resource.TestCheckResourceAttrSet(resName, "instances.0.availability_policy_host_failure"), + resource.TestCheckResourceAttrSet(resName, "instances.0.lifecycle_state"), + resource.TestCheckResourceAttr(resName, "instances.0.lifecycle_reasons.#", "0"), + resource.TestCheckResourceAttrSet(resName, "instances.0.vcpu.0.manufacturer"), + resource.TestCheckResourceAttrSet(resName, "instances.0.primary_network_attachment.#"), + resource.TestCheckResourceAttr(resName, "instances.0.primary_network_attachment.#", "1"), + ), + }, + }, + }) +} func TestAccIBMISInstancesDataSource_ReservedIp(t *testing.T) { var instance string vpcname := fmt.Sprintf("tfins-vpc-%d", acctest.RandIntRange(10, 100)) @@ -189,6 +230,13 @@ func testAccCheckIBMISInstancesDataSourceConfig() string { data "ibm_is_instances" "ds_instances" { }`) } +func testAccCheckIBMISInstancesVniDataSourceConfig(vpcname, subnetname, sshname, publicKey, name, vniname, userData string) string { + return testAccCheckIBMISInstanceVniConfig(vpcname, subnetname, sshname, publicKey, name, vniname, userData) + fmt.Sprintf(` + data "ibm_is_instances" "ds_instances" { + vpc_name = ibm_is_vpc.testacc_vpc.name + depends_on = [ ibm_is_instance.testacc_instance ] + }`) +} func testAccCheckIBMISInstancesDataSourceReservedIpConfig(vpcname string) string { return fmt.Sprintf(` diff --git a/ibm/service/vpc/resource_ibm_is_instance.go b/ibm/service/vpc/resource_ibm_is_instance.go index 27323efbc6..f139f21ece 100644 --- a/ibm/service/vpc/resource_ibm_is_instance.go +++ b/ibm/service/vpc/resource_ibm_is_instance.go @@ -14,6 +14,7 @@ import ( "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/go-sdk-core/v5/core" "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -399,12 +400,13 @@ func ResourceIBMISInstance() *schema.Resource { }, isInstancePrimaryNetworkInterface: { - Type: schema.TypeList, - MinItems: 1, - MaxItems: 1, - Optional: true, - Computed: true, - Description: "Primary Network interface info", + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Optional: true, + Computed: true, + ConflictsWith: []string{"primary_network_attachment", "network_attachments"}, + Description: "Primary Network interface info", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { @@ -503,10 +505,248 @@ func ResourceIBMISInstance() *schema.Resource { }, }, + "primary_network_attachment": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "The primary network attachment for this virtual server instance.", + ExactlyOneOf: []string{"primary_network_attachment", "primary_network_interface"}, + ConflictsWith: []string{"primary_network_interface", "network_interfaces"}, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + // pna can accept either vni id or prototype + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validate.InvokeValidator("ibm_is_instance_network_attachment", "name"), + Description: "The name for this instance network attachment. The name is unique across all network attachments for the instance.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this instance network attachment.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this instance network attachment.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + + // vni properties + "virtual_network_interface": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Computed: true, + Description: "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.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The virtual network interface id for this instance network attachment.", + }, + "allow_ip_spoofing": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "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.", + }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "Indicates whether this virtual network interface will be automatically deleted when`target` is deleted.", + }, + "enable_infrastructure_nat": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", + }, + "ips": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Computed: true, + Description: "The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + // Optional: true, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + // Optional: true, + Computed: true, + Description: "Indicates whether this reserved IP member will be automatically deleted when either target is deleted, or the reserved IP is unbound.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "reserved_ip": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + // Optional: true, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validate.InvokeValidator("ibm_is_virtual_network_interface", "vni_name"), + Description: "The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC.", + }, + "primary_ip": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Computed: true, + Description: "The primary IP address of the virtual network interface for the instance networkattachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "reserved_ip": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "Indicates whether this reserved ip will be automatically deleted when `target` is deleted.", + }, + }, + }, + }, + "resource_group": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The resource group id for this virtual network interface.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "security_groups": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "The security groups for this virtual network interface.", + }, + "subnet": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + Description: "The associated subnet id.", + }, + }, + }, + }, + }, + }, + }, + isInstanceNetworkInterfaces: { - Type: schema.TypeList, - Optional: true, - Computed: true, + Type: schema.TypeList, + Optional: true, + Computed: true, + ConflictsWith: []string{"primary_network_attachment", "network_attachments"}, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { @@ -594,6 +834,239 @@ func ResourceIBMISInstance() *schema.Resource { }, }, + "network_attachments": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Computed: true, + ConflictsWith: []string{"primary_network_interface", "network_interfaces"}, + Description: "The network attachments for this virtual server instance, including the primary network attachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + // pna can accept either vni id or prototype + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validate.InvokeValidator("ibm_is_instance_network_attachment", "name"), + Description: "The name for this instance network attachment. The name is unique across all network attachments for the instance.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this instance network attachment.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this instance network attachment.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + + "virtual_network_interface": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "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.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The virtual network interface id for this instance network attachment.", + }, + "allow_ip_spoofing": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "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.", + }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "Indicates whether this virtual network interface will be automatically deleted when`target` is deleted.", + }, + "enable_infrastructure_nat": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", + }, + "ips": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Computed: true, + Description: "The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + // Optional: true, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + // Optional: true, + Computed: true, + Description: "Indicates whether this reserved IP member will be automatically deleted when either target is deleted, or the reserved IP is unbound.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "reserved_ip": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + // Optional: true, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validate.InvokeValidator("ibm_is_virtual_network_interface", "vni_name"), + Description: "The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC.", + }, + "primary_ip": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Computed: true, + Description: "The primary IP address of the virtual network interface for the instance networkattachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "Indicates whether this reserved IP member will be automatically deleted when either target is deleted, or the reserved IP is unbound.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "reserved_ip": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "resource_group": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The resource group id for this virtual network interface.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "security_groups": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "The security groups for this virtual network interface.", + }, + "subnet": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The associated subnet id.", + }, + }, + }, + }, + }, + }, + }, + isInstanceUserData: { Type: schema.TypeString, ForceNew: true, @@ -608,7 +1081,7 @@ func ResourceIBMISInstance() *schema.Resource { Optional: true, ConflictsWith: []string{"boot_volume.0.snapshot", "catalog_offering.0.offering_crn", "catalog_offering.0.version_crn", "boot_volume.0.volume_id"}, AtLeastOneOf: []string{isInstanceImage, isInstanceSourceTemplate, "boot_volume.0.snapshot", "catalog_offering.0.offering_crn", "catalog_offering.0.version_crn", "boot_volume.0.volume_id"}, - RequiredWith: []string{isInstanceZone, isInstancePrimaryNetworkInterface, isInstanceKeys, isInstanceVPC, isInstanceProfile}, + RequiredWith: []string{isInstanceZone, isInstanceKeys, isInstanceVPC, isInstanceProfile}, Description: "image id", }, @@ -624,7 +1097,7 @@ func ResourceIBMISInstance() *schema.Resource { Optional: true, ForceNew: true, Computed: true, - RequiredWith: []string{isInstanceZone, isInstancePrimaryNetworkInterface, isInstanceProfile, isInstanceKeys, isInstanceVPC}, + RequiredWith: []string{isInstanceZone, isInstanceProfile, isInstanceKeys, isInstanceVPC}, AtLeastOneOf: []string{isInstanceImage, isInstanceSourceTemplate, "boot_volume.0.volume_id", "boot_volume.0.snapshot"}, ConflictsWith: []string{isInstanceImage, isInstanceSourceTemplate, "boot_volume.0.snapshot", "boot_volume.0.name", "boot_volume.0.encryption", "catalog_offering.0.offering_crn", "catalog_offering.0.version_crn"}, Description: "The unique identifier for this volume", @@ -644,7 +1117,7 @@ func ResourceIBMISInstance() *schema.Resource { isInstanceVolumeSnapshot: { Type: schema.TypeString, - RequiredWith: []string{isInstanceZone, isInstancePrimaryNetworkInterface, isInstanceProfile, isInstanceKeys, isInstanceVPC}, + RequiredWith: []string{isInstanceZone, isInstanceProfile, isInstanceKeys, isInstanceVPC}, AtLeastOneOf: []string{isInstanceImage, isInstanceSourceTemplate, "boot_volume.0.snapshot", "catalog_offering.0.offering_crn", "catalog_offering.0.version_crn", "boot_volume.0.volume_id"}, ConflictsWith: []string{isInstanceImage, isInstanceSourceTemplate, "catalog_offering.0.offering_crn", "catalog_offering.0.version_crn", "boot_volume.0.volume_id"}, Optional: true, @@ -1208,6 +1681,35 @@ func instanceCreateByImage(d *schema.ResourceData, meta interface{}, profile, na } + if networkattachmentsintf, ok := d.GetOk("network_attachments"); ok { + networkAttachments := []vpcv1.InstanceNetworkAttachmentPrototype{} + for i, networkAttachmentsItem := range networkattachmentsintf.([]interface{}) { + allowipspoofing := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.allow_ip_spoofing", i) + autodelete := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.auto_delete", i) + enablenat := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.enable_infrastructure_nat", i) + // allowipspoofing := "primary_network_attachment.0.allow_ip_spoofing" + // autodelete := "primary_network_attachment.0.autodelete" + // enablenat := "primary_network_attachment.0.enable_infrastructure_nat" + networkAttachmentsItemModel, err := resourceIBMIsInstanceMapToInstanceNetworkAttachmentPrototype(allowipspoofing, autodelete, enablenat, d, networkAttachmentsItem.(map[string]interface{})) + if err != nil { + return err + } + networkAttachments = append(networkAttachments, *networkAttachmentsItemModel) + } + instanceproto.NetworkAttachments = networkAttachments + } + if primnetworkattachmentintf, ok := d.GetOk("primary_network_attachment"); ok && len(primnetworkattachmentintf.([]interface{})) > 0 { + i := 0 + allowipspoofing := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.allow_ip_spoofing", i) + autodelete := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.auto_delete", i) + enablenat := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.enable_infrastructure_nat", i) + primaryNetworkAttachmentModel, err := resourceIBMIsInstanceMapToInstanceNetworkAttachmentPrototype(allowipspoofing, autodelete, enablenat, d, primnetworkattachmentintf.([]interface{})[0].(map[string]interface{})) + if err != nil { + return err + } + instanceproto.PrimaryNetworkAttachment = primaryNetworkAttachmentModel + } + if primnicintf, ok := d.GetOk(isInstancePrimaryNetworkInterface); ok { primnic := primnicintf.([]interface{})[0].(map[string]interface{}) subnetintf, _ := primnic[isInstanceNicSubnet] @@ -1449,7 +1951,7 @@ func instanceCreateByImage(d *schema.ResourceData, meta interface{}, profile, na err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, *instance.CRN, "", isInstanceUserTagType) if err != nil { log.Printf( - "Error on create of resource instance (%s) tags: %s", d.Id(), err) + "[ERROR] Error on create of resource instance (%s) tags: %s", d.Id(), err) } } if _, ok := d.GetOk(isInstanceAccessTags); ok { @@ -1457,7 +1959,7 @@ func instanceCreateByImage(d *schema.ResourceData, meta interface{}, profile, na err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, *instance.CRN, "", isInstanceAccessTagType) if err != nil { log.Printf( - "Error on create of resource instance (%s) access tags: %s", d.Id(), err) + "[ERROR] Error on create of resource instance (%s) access tags: %s", d.Id(), err) } } return nil @@ -1581,6 +2083,35 @@ func instanceCreateByCatalogOffering(d *schema.ResourceData, meta interface{}, p } + if networkattachmentsintf, ok := d.GetOk("network_attachments"); ok { + networkAttachments := []vpcv1.InstanceNetworkAttachmentPrototype{} + for i, networkAttachmentsItem := range networkattachmentsintf.([]interface{}) { + allowipspoofing := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.allow_ip_spoofing", i) + autodelete := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.auto_delete", i) + enablenat := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.enable_infrastructure_nat", i) + // allowipspoofing := "primary_network_attachment.0.allow_ip_spoofing" + // autodelete := "primary_network_attachment.0.autodelete" + // enablenat := "primary_network_attachment.0.enable_infrastructure_nat" + networkAttachmentsItemModel, err := resourceIBMIsInstanceMapToInstanceNetworkAttachmentPrototype(allowipspoofing, autodelete, enablenat, d, networkAttachmentsItem.(map[string]interface{})) + if err != nil { + return err + } + networkAttachments = append(networkAttachments, *networkAttachmentsItemModel) + } + instanceproto.NetworkAttachments = networkAttachments + } + if primnetworkattachmentintf, ok := d.GetOk("primary_network_attachment"); ok && len(primnetworkattachmentintf.([]interface{})) > 0 { + i := 0 + allowipspoofing := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.allow_ip_spoofing", i) + autodelete := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.auto_delete", i) + enablenat := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.enable_infrastructure_nat", i) + primaryNetworkAttachmentModel, err := resourceIBMIsInstanceMapToInstanceNetworkAttachmentPrototype(allowipspoofing, autodelete, enablenat, d, primnetworkattachmentintf.([]interface{})[0].(map[string]interface{})) + if err != nil { + return err + } + instanceproto.PrimaryNetworkAttachment = primaryNetworkAttachmentModel + } + if primnicintf, ok := d.GetOk(isInstancePrimaryNetworkInterface); ok { primnic := primnicintf.([]interface{})[0].(map[string]interface{}) subnetintf, _ := primnic[isInstanceNicSubnet] @@ -1822,7 +2353,7 @@ func instanceCreateByCatalogOffering(d *schema.ResourceData, meta interface{}, p err = flex.UpdateTagsUsingCRN(oldList, newList, meta, *instance.CRN) if err != nil { log.Printf( - "Error on create of resource instance (%s) tags: %s", d.Id(), err) + "[ERROR] Error on create of resource instance (%s) tags: %s", d.Id(), err) } } return nil @@ -1952,6 +2483,32 @@ func instanceCreateByTemplate(d *schema.ResourceData, meta interface{}, profile, } } + if networkattachmentsintf, ok := d.GetOk("network_attachments"); ok { + networkAttachments := []vpcv1.InstanceNetworkAttachmentPrototype{} + for i, networkAttachmentsItem := range networkattachmentsintf.([]interface{}) { + allowipspoofing := fmt.Sprintf("network_attachments.%d.allow_ip_spoofing", i) + autodelete := fmt.Sprintf("network_attachments.%d.autodelete", i) + enablenat := fmt.Sprintf("network_attachments.%d.enable_infrastructure_nat", i) + networkAttachmentsItemModel, err := resourceIBMIsInstanceMapToInstanceNetworkAttachmentPrototype(allowipspoofing, autodelete, enablenat, d, networkAttachmentsItem.(map[string]interface{})) + if err != nil { + return err + } + networkAttachments = append(networkAttachments, *networkAttachmentsItemModel) + } + instanceproto.NetworkAttachments = networkAttachments + } + if primnetworkattachmentintf, ok := d.GetOk("primary_network_attachment"); ok && len(primnetworkattachmentintf.([]interface{})) > 0 { + i := 0 + allowipspoofing := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.allow_ip_spoofing", i) + autodelete := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.auto_delete", i) + enablenat := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.enable_infrastructure_nat", i) + primaryNetworkAttachmentModel, err := resourceIBMIsInstanceMapToInstanceNetworkAttachmentPrototype(allowipspoofing, autodelete, enablenat, d, primnetworkattachmentintf.([]interface{})[0].(map[string]interface{})) + if err != nil { + return err + } + instanceproto.PrimaryNetworkAttachment = primaryNetworkAttachmentModel + } + if primnicintf, ok := d.GetOk(isInstancePrimaryNetworkInterface); ok { primnic := primnicintf.([]interface{})[0].(map[string]interface{}) subnetintf, _ := primnic[isInstanceNicSubnet] @@ -2192,7 +2749,7 @@ func instanceCreateByTemplate(d *schema.ResourceData, meta interface{}, profile, err = flex.UpdateTagsUsingCRN(oldList, newList, meta, *instance.CRN) if err != nil { log.Printf( - "Error on create of resource instance (%s) tags: %s", d.Id(), err) + "[ERROR] Error on create of resource instance (%s) tags: %s", d.Id(), err) } } if _, ok := d.GetOk(isInstanceAccessTags); ok { @@ -2200,7 +2757,7 @@ func instanceCreateByTemplate(d *schema.ResourceData, meta interface{}, profile, err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, *instance.CRN, "", isInstanceAccessTagType) if err != nil { log.Printf( - "Error on create of resource instance (%s) access tags: %s", d.Id(), err) + "[ERROR] Error on create of resource instance (%s) access tags: %s", d.Id(), err) } } return nil @@ -2320,6 +2877,32 @@ func instanceCreateBySnapshot(d *schema.ResourceData, meta interface{}, profile, instanceproto.TotalVolumeBandwidth = &totalVolBandwidthStr } + if networkattachmentsintf, ok := d.GetOk("network_attachments"); ok { + networkAttachments := []vpcv1.InstanceNetworkAttachmentPrototype{} + for i, networkAttachmentsItem := range networkattachmentsintf.([]interface{}) { + allowipspoofing := fmt.Sprintf("network_attachments.%d.allow_ip_spoofing", i) + autodelete := fmt.Sprintf("network_attachments.%d.autodelete", i) + enablenat := fmt.Sprintf("network_attachments.%d.enable_infrastructure_nat", i) + networkAttachmentsItemModel, err := resourceIBMIsInstanceMapToInstanceNetworkAttachmentPrototype(allowipspoofing, autodelete, enablenat, d, networkAttachmentsItem.(map[string]interface{})) + if err != nil { + return err + } + networkAttachments = append(networkAttachments, *networkAttachmentsItemModel) + } + instanceproto.NetworkAttachments = networkAttachments + } + if primnetworkattachmentintf, ok := d.GetOk("primary_network_attachment"); ok && len(primnetworkattachmentintf.([]interface{})) > 0 { + i := 0 + allowipspoofing := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.allow_ip_spoofing", i) + autodelete := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.auto_delete", i) + enablenat := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.enable_infrastructure_nat", i) + primaryNetworkAttachmentModel, err := resourceIBMIsInstanceMapToInstanceNetworkAttachmentPrototype(allowipspoofing, autodelete, enablenat, d, primnetworkattachmentintf.([]interface{})[0].(map[string]interface{})) + if err != nil { + return err + } + instanceproto.PrimaryNetworkAttachment = primaryNetworkAttachmentModel + } + if primnicintf, ok := d.GetOk(isInstancePrimaryNetworkInterface); ok { primnic := primnicintf.([]interface{})[0].(map[string]interface{}) subnetintf, _ := primnic[isInstanceNicSubnet] @@ -2565,7 +3148,7 @@ func instanceCreateBySnapshot(d *schema.ResourceData, meta interface{}, profile, err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, *instance.CRN, "", isInstanceUserTagType) if err != nil { log.Printf( - "Error on create of resource instance (%s) tags: %s", d.Id(), err) + "[ERROR] Error on create of resource instance (%s) tags: %s", d.Id(), err) } } if _, ok := d.GetOk(isInstanceAccessTags); ok { @@ -2573,7 +3156,7 @@ func instanceCreateBySnapshot(d *schema.ResourceData, meta interface{}, profile, err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, *instance.CRN, "", isInstanceAccessTagType) if err != nil { log.Printf( - "Error on create of resource instance (%s) access tags: %s", d.Id(), err) + "[ERROR] Error on create of resource instance (%s) access tags: %s", d.Id(), err) } } return nil @@ -2658,6 +3241,34 @@ func instanceCreateByVolume(d *schema.ResourceData, meta interface{}, profile, n totalVolBandwidthStr := int64(totalVolBandwidthIntf.(int)) instanceproto.TotalVolumeBandwidth = &totalVolBandwidthStr } + if networkattachmentsintf, ok := d.GetOk("network_attachments"); ok { + networkAttachments := []vpcv1.InstanceNetworkAttachmentPrototype{} + for i, networkAttachmentsItem := range networkattachmentsintf.([]interface{}) { + allowipspoofing := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.allow_ip_spoofing", i) + autodelete := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.auto_delete", i) + enablenat := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.enable_infrastructure_nat", i) + // allowipspoofing := "primary_network_attachment.0.allow_ip_spoofing" + // autodelete := "primary_network_attachment.0.autodelete" + // enablenat := "primary_network_attachment.0.enable_infrastructure_nat" + networkAttachmentsItemModel, err := resourceIBMIsInstanceMapToInstanceNetworkAttachmentPrototype(allowipspoofing, autodelete, enablenat, d, networkAttachmentsItem.(map[string]interface{})) + if err != nil { + return err + } + networkAttachments = append(networkAttachments, *networkAttachmentsItemModel) + } + instanceproto.NetworkAttachments = networkAttachments + } + if primnetworkattachmentintf, ok := d.GetOk("primary_network_attachment"); ok && len(primnetworkattachmentintf.([]interface{})) > 0 { + i := 0 + allowipspoofing := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.allow_ip_spoofing", i) + autodelete := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.auto_delete", i) + enablenat := fmt.Sprintf("primary_network_attachment.%d.virtual_network_interface.0.enable_infrastructure_nat", i) + primaryNetworkAttachmentModel, err := resourceIBMIsInstanceMapToInstanceNetworkAttachmentPrototype(allowipspoofing, autodelete, enablenat, d, primnetworkattachmentintf.([]interface{})[0].(map[string]interface{})) + if err != nil { + return err + } + instanceproto.PrimaryNetworkAttachment = primaryNetworkAttachmentModel + } if primnicintf, ok := d.GetOk(isInstancePrimaryNetworkInterface); ok { primnic := primnicintf.([]interface{})[0].(map[string]interface{}) @@ -2903,7 +3514,7 @@ func instanceCreateByVolume(d *schema.ResourceData, meta interface{}, profile, n err = flex.UpdateTagsUsingCRN(oldList, newList, meta, *instance.CRN) if err != nil { log.Printf( - "Error on create of resource instance (%s) tags: %s", d.Id(), err) + "[ERROR] Error on create of resource instance (%s) tags: %s", d.Id(), err) } } if _, ok := d.GetOk(isInstanceAccessTags); ok { @@ -2911,7 +3522,7 @@ func instanceCreateByVolume(d *schema.ResourceData, meta interface{}, profile, n err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, *instance.CRN, "", isInstanceAccessTagType) if err != nil { log.Printf( - "Error on create of resource instance (%s) access tags: %s", d.Id(), err) + "[ERROR] Error on create of resource instance (%s) access tags: %s", d.Id(), err) } } return nil @@ -3231,6 +3842,30 @@ func instanceGet(d *schema.ResourceData, meta interface{}, id string) error { d.Set(isInstancePrimaryNetworkInterface, primaryNicList) } + if !core.IsNil(instance.PrimaryNetworkAttachment) { + + pnaId := *instance.PrimaryNetworkAttachment.ID + getInstanceNetworkAttachment := &vpcv1.GetInstanceNetworkAttachmentOptions{ + InstanceID: &id, + ID: &pnaId, + } + autoDelete := true + if autoDeleteOk, ok := d.GetOkExists("primary_network_attachment.0.virtual_network_interface.0.primary_ip.0.auto_delete"); ok { + autoDelete = autoDeleteOk.(bool) + } + pna, response, err := instanceC.GetInstanceNetworkAttachment(getInstanceNetworkAttachment) + if err != nil { + return fmt.Errorf("[ERROR] Error on GetInstanceNetworkAttachment in instance : %s\n%s", err, response) + } + primaryNetworkAttachmentMap, err := resourceIBMIsInstanceInstanceNetworkAttachmentReferenceToMap(instance.PrimaryNetworkAttachment, pna, instanceC, autoDelete) + if err != nil { + return err + } + if err = d.Set("primary_network_attachment", []map[string]interface{}{primaryNetworkAttachmentMap}); err != nil { + return fmt.Errorf("[ERROR] Error setting primary_network_attachment: %s", err) + } + } + if instance.NetworkInterfaces != nil { interfacesList := make([]map[string]interface{}, 0) for _, intfc := range instance.NetworkInterfaces { @@ -3298,6 +3933,34 @@ func instanceGet(d *schema.ResourceData, meta interface{}, id string) error { d.Set(isInstanceNetworkInterfaces, interfacesList) } + if !core.IsNil(instance.NetworkAttachments) { + networkAttachments := []map[string]interface{}{} + for i, networkAttachmentsItem := range instance.NetworkAttachments { + naId := *networkAttachmentsItem.ID + if *instance.PrimaryNetworkAttachment.ID != naId { + autoDelete := true + if autoDeleteOk, ok := d.GetOkExists(fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.primary_ip.0.auto_delete", i)); ok { + autoDelete = autoDeleteOk.(bool) + } + getInstanceNetworkAttachment := &vpcv1.GetInstanceNetworkAttachmentOptions{ + InstanceID: &id, + ID: &naId, + } + na, response, err := instanceC.GetInstanceNetworkAttachment(getInstanceNetworkAttachment) + if err != nil { + return fmt.Errorf("[ERROR] Error on GetInstanceNetworkAttachment in instance : %s\n%s", err, response) + } + networkAttachmentsItemMap, err := resourceIBMIsInstanceInstanceNetworkAttachmentReferenceToMap(&networkAttachmentsItem, na, instanceC, autoDelete) + if err != nil { + return err + } + networkAttachments = append(networkAttachments, networkAttachmentsItemMap) + } + } + if err = d.Set("network_attachments", networkAttachments); err != nil { + return fmt.Errorf("[ERROR] Error setting network_attachments: %s", err) + } + } if instance.Image != nil { d.Set(isInstanceImage, *instance.Image.ID) } @@ -3372,7 +4035,7 @@ func instanceGet(d *schema.ResourceData, meta interface{}, id string) error { } vol, response, err := instanceC.GetVolume(options) if err != nil { - log.Printf("Error Getting Boot Volume (%s): %s\n%s", id, err, response) + log.Printf("[ERROR] Error Getting Boot Volume (%s): %s\n%s", id, err, response) } if vol != nil { bootVol[isInstanceBootSize] = *vol.Capacity @@ -3395,13 +4058,13 @@ func instanceGet(d *schema.ResourceData, meta interface{}, id string) error { tags, err := flex.GetGlobalTagsUsingCRN(meta, *instance.CRN, "", isInstanceUserTagType) if err != nil { log.Printf( - "Error on get of resource Instance (%s) tags: %s", d.Id(), err) + "[ERROR] Error on get of resource Instance (%s) tags: %s", d.Id(), err) } d.Set(isInstanceTags, tags) accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *instance.CRN, "", isInstanceAccessTagType) if err != nil { log.Printf( - "Error on get of resource Instance (%s) access tags: %s", d.Id(), err) + "[ERROR] Error on get of resource Instance (%s) access tags: %s", d.Id(), err) } d.Set(isInstanceAccessTags, accesstags) controller, err := flex.GetBaseController(meta) @@ -4027,7 +4690,7 @@ func instanceUpdate(d *schema.ResourceData, meta interface{}) error { } instancePatch, err := instancePatchModel.AsPatch() if err != nil { - return fmt.Errorf("Error calling asPatch for InstancePatch: %s", err) + return fmt.Errorf("[ERROR] Error calling asPatch for InstancePatch: %s", err) } updatedoptions.InstancePatch = instancePatch @@ -4070,7 +4733,7 @@ func instanceUpdate(d *schema.ResourceData, meta interface{}) error { instancePatch, err := instancePatchModel.AsPatch() if err != nil { - return fmt.Errorf("Error calling asPatch for InstancePatch: %s", err) + return fmt.Errorf("[ERROR] Error calling asPatch for InstancePatch: %s", err) } updatedoptions.InstancePatch = instancePatch @@ -4093,7 +4756,7 @@ func instanceUpdate(d *schema.ResourceData, meta interface{}) error { } instancePatch, err := instancePatchModel.AsPatch() if err != nil { - return fmt.Errorf("Error calling asPatch for InstancePatch: %s", err) + return fmt.Errorf("[ERROR] Error calling asPatch for InstancePatch: %s", err) } updatedoptions.InstancePatch = instancePatch @@ -4189,7 +4852,7 @@ func instanceUpdate(d *schema.ResourceData, meta interface{}) error { err = flex.UpdateTagsUsingCRN(oldList, newList, meta, *instance.CRN) if err != nil { log.Printf( - "Error on update of resource Instance (%s) tags: %s", d.Id(), err) + "[ERROR] Error on update of resource Instance (%s) tags: %s", d.Id(), err) } } if d.HasChange(isInstanceAccessTags) { @@ -4197,7 +4860,7 @@ func instanceUpdate(d *schema.ResourceData, meta interface{}) error { err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, *instance.CRN, "", isInstanceAccessTagType) if err != nil { log.Printf( - "Error on update of resource Instance (%s) access tags: %s", d.Id(), err) + "[ERROR] Error on update of resource Instance (%s) access tags: %s", d.Id(), err) } } return nil @@ -4611,3 +5274,222 @@ func GetInstanceMetadataServiceOptions(d *schema.ResourceData) (metadataService } return nil } + +func resourceIBMIsInstanceInstanceNetworkAttachmentReferenceToMap(model *vpcv1.InstanceNetworkAttachmentReference, pna *vpcv1.InstanceNetworkAttachment, instanceC *vpcv1.VpcV1, autoDelete bool) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Deleted != nil { + deletedMap, err := resourceIBMIsInstanceInstanceNetworkAttachmentReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + if model.Href != nil { + modelMap["href"] = model.Href + } + if model.ID != nil { + modelMap["id"] = model.ID + } + if model.Name != nil { + modelMap["name"] = model.Name + } + vniMap := make(map[string]interface{}) + if pna.VirtualNetworkInterface != nil { + vniMap["id"] = *pna.VirtualNetworkInterface.ID + vniMap["name"] = pna.VirtualNetworkInterface.Name + vniMap["resource_type"] = pna.VirtualNetworkInterface.ResourceType + } + getVirtualNetworkInterfaceOptions := &vpcv1.GetVirtualNetworkInterfaceOptions{ + ID: pna.VirtualNetworkInterface.ID, + } + vniDetails, response, err := instanceC.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions) + if err != nil { + return nil, fmt.Errorf("[ERROR] Error on GetInstanceNetworkAttachment in instance : %s\n%s", err, response) + } + vniMap["allow_ip_spoofing"] = vniDetails.AllowIPSpoofing + vniMap["auto_delete"] = vniDetails.AutoDelete + vniMap["enable_infrastructure_nat"] = vniDetails.EnableInfrastructureNat + vniMap["resource_group"] = vniDetails.ResourceGroup.ID + primaryipId := *vniDetails.PrimaryIP.ID + if !core.IsNil(vniDetails.Ips) { + ips := []map[string]interface{}{} + for _, ipsItem := range vniDetails.Ips { + if *ipsItem.ID != primaryipId { + ipsItemMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(&ipsItem, autoDelete) + if err != nil { + return nil, err + } + ips = append(ips, ipsItemMap) + } + } + vniMap["ips"] = ips + } + + if !core.IsNil(vniDetails.SecurityGroups) { + securityGroups := make([]string, 0) + for _, securityGroupsItem := range vniDetails.SecurityGroups { + if securityGroupsItem.ID != nil { + securityGroups = append(securityGroups, *securityGroupsItem.ID) + } + } + vniMap["security_groups"] = securityGroups + } + primaryIPMap, err := resourceIBMIsInstanceReservedIPReferenceToMap(model.PrimaryIP, autoDelete) + if err != nil { + return modelMap, err + } + vniMap["primary_ip"] = []map[string]interface{}{primaryIPMap} + if model.ResourceType != nil { + modelMap["resource_type"] = *model.ResourceType + } + if model.Subnet != nil { + vniMap["subnet"] = *model.Subnet.ID + } + modelMap["virtual_network_interface"] = []map[string]interface{}{vniMap} + return modelMap, nil +} + +func resourceIBMIsInstanceInstanceNetworkAttachmentReferenceDeletedToMap(model *vpcv1.InstanceNetworkAttachmentReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func resourceIBMIsInstanceReservedIPReferenceToMap(model *vpcv1.ReservedIPReference, autoDelete bool) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["address"] = model.Address + if model.Deleted != nil { + deletedMap, err := resourceIBMIsInstanceReservedIPReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["auto_delete"] = autoDelete + modelMap["reserved_ip"] = model.ID + modelMap["name"] = model.Name + if model.ResourceType != nil { + modelMap["resource_type"] = *model.ResourceType + } + return modelMap, nil +} + +func resourceIBMIsInstanceReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func resourceIBMIsInstanceMapToInstanceNetworkAttachmentPrototype(allowipspoofing, autodelete, enablenat string, d *schema.ResourceData, modelMap map[string]interface{}) (*vpcv1.InstanceNetworkAttachmentPrototype, error) { + model := &vpcv1.InstanceNetworkAttachmentPrototype{} + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + VirtualNetworkInterfaceModel, err := resourceIBMIsInstanceMapToVirtualNetworkInterfacePrototypeAttachmentContext(allowipspoofing, autodelete, enablenat, d, modelMap["virtual_network_interface"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.VirtualNetworkInterface = VirtualNetworkInterfaceModel + return model, nil +} +func resourceIBMIsInstanceMapToVirtualNetworkInterfacePrototypeAttachmentContext(allowipspoofing, autodelete, enablenat string, d *schema.ResourceData, modelMap map[string]interface{}) (vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, error) { + model := &vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterface{} + if allowipspoofingOk, ok := d.GetOkExists(allowipspoofing); ok { + model.AllowIPSpoofing = core.BoolPtr(allowipspoofingOk.(bool)) + } + if autodeleteOk, ok := d.GetOkExists(autodelete); ok { + model.AutoDelete = core.BoolPtr(autodeleteOk.(bool)) + } + if enablenatok, ok := d.GetOkExists(enablenat); ok { + model.EnableInfrastructureNat = core.BoolPtr(enablenatok.(bool)) + } + if modelMap["ips"] != nil { + ips := []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{} + for _, ipsItem := range modelMap["ips"].([]interface{}) { + ipsItemModel, err := resourceIBMIsInstanceMapToVirtualNetworkInterfaceIPsReservedIPPrototype(ipsItem.(map[string]interface{})) + if err != nil { + return model, err + } + ips = append(ips, ipsItemModel) + } + model.Ips = ips + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["primary_ip"] != nil && len(modelMap["primary_ip"].([]interface{})) > 0 { + PrimaryIPModel, err := resourceIBMIsInstanceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(modelMap["primary_ip"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.PrimaryIP = PrimaryIPModel + } + if modelMap["resource_group"] != nil && modelMap["resource_group"].(string) != "" { + resourcegroupid := modelMap["resource_group"].(string) + model.ResourceGroup = &vpcv1.ResourceGroupIdentity{ + ID: &resourcegroupid, + } + } + if modelMap["security_groups"] != nil { + securityGroups := []vpcv1.SecurityGroupIdentityIntf{} + sg := modelMap["security_groups"].(*schema.Set) + for _, v := range sg.List() { + value := v.(string) + securityGroupsItem := &vpcv1.SecurityGroupIdentity{ + ID: &value, + } + securityGroups = append(securityGroups, securityGroupsItem) + } + model.SecurityGroups = securityGroups + } + if modelMap["subnet"] != nil && modelMap["subnet"].(string) != "" { + subnetId := modelMap["subnet"].(string) + model.Subnet = &vpcv1.SubnetIdentityByID{ + ID: &subnetId, + } + } + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + return model, nil +} + +func resourceIBMIsInstanceMapToVirtualNetworkInterfaceIPsReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfaceIPPrototypeIntf, error) { + model := &vpcv1.VirtualNetworkInterfaceIPPrototype{} + if modelMap["reserved_ip"] != nil && modelMap["reserved_ip"].(string) != "" { + model.ID = core.StringPtr(modelMap["reserved_ip"].(string)) + } + if modelMap["href"] != nil && modelMap["href"].(string) != "" { + model.Href = core.StringPtr(modelMap["href"].(string)) + } + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + return model, nil +} +func resourceIBMIsInstanceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeIntf, error) { + model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototype{} + if modelMap["reserved_ip"] != nil && modelMap["reserved_ip"].(string) != "" { + model.ID = core.StringPtr(modelMap["reserved_ip"].(string)) + } + if modelMap["href"] != nil && modelMap["href"].(string) != "" { + model.Href = core.StringPtr(modelMap["href"].(string)) + } + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + return model, nil +} diff --git a/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go b/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go new file mode 100644 index 0000000000..992810437a --- /dev/null +++ b/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go @@ -0,0 +1,905 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func ResourceIBMIsInstanceNetworkAttachment() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIBMIsInstanceNetworkAttachmentCreate, + ReadContext: resourceIBMIsInstanceNetworkAttachmentRead, + UpdateContext: resourceIBMIsInstanceNetworkAttachmentUpdate, + DeleteContext: resourceIBMIsInstanceNetworkAttachmentDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "instance": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_is_instance_network_attachment", "instance"), + Description: "The virtual server instance identifier.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validate.InvokeValidator("ibm_is_instance_network_attachment", "name"), + Description: "The name for this instance network attachment. The name is unique across all network attachments for the instance.", + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date and time that the instance network attachment was created.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this instance network attachment.", + }, + "lifecycle_state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The lifecycle state of the instance network attachment.", + }, + "port_speed": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The port speed for this instance network attachment in Mbps.", + }, + + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The instance network attachment type.", + }, + "network_attachment": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this instance network attachment.", + }, + // vni properties + "virtual_network_interface": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "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.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ConflictsWith: []string{"virtual_network_interface.0.allow_ip_spoofing", "virtual_network_interface.0.auto_delete", "virtual_network_interface.0.enable_infrastructure_nat", "virtual_network_interface.0.ips", "virtual_network_interface.0.name", "virtual_network_interface.0.primary_ip", "virtual_network_interface.0.resource_group", "virtual_network_interface.0.security_groups", "virtual_network_interface.0.security_groups"}, + Description: "The virtual network interface id for this instance network attachment.", + }, + "allow_ip_spoofing": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + ConflictsWith: []string{"virtual_network_interface.0.id"}, + Description: "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.", + }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Default: true, + ConflictsWith: []string{"virtual_network_interface.0.id"}, + Description: "Indicates whether this virtual network interface will be automatically deleted when`target` is deleted.", + }, + "enable_infrastructure_nat": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + ConflictsWith: []string{"virtual_network_interface.0.id"}, + Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", + }, + "ips": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Computed: true, + ConflictsWith: []string{"virtual_network_interface.0.id"}, + Description: "The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + // Optional: true, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + // Optional: true, + Computed: true, + Description: "Indicates whether this reserved IP member will be automatically deleted when either target is deleted, or the reserved IP is unbound.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "reserved_ip": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + // Optional: true, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ConflictsWith: []string{"virtual_network_interface.0.id"}, + ValidateFunc: validate.InvokeValidator("ibm_is_virtual_network_interface", "name"), + Description: "The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC.", + }, + "primary_ip": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + ConflictsWith: []string{"virtual_network_interface.0.id"}, + Computed: true, + Description: "The primary IP address of the virtual network interface for the instance networkattachment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered.", + }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "Indicates whether this primary_ip will be automatically deleted when `vni` is deleted.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "reserved_ip": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The name for this reserved IP. The name is unique across all reserved IPs in a subnet.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "resource_group": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{"virtual_network_interface.0.id"}, + Computed: true, + Description: "The resource group id for this virtual network interface.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "security_groups": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + ForceNew: true, + ConflictsWith: []string{"virtual_network_interface.0.id"}, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "The security groups for this virtual network interface.", + }, + "subnet": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ConflictsWith: []string{"virtual_network_interface.0.id"}, + ForceNew: true, + Description: "The associated subnet id.", + }, + }, + }, + }, + }, + } +} + +func ResourceIBMIsInstanceNetworkAttachmentValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "instance", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^[-0-9a-z_]+$`, + MinValueLength: 1, + MaxValueLength: 64, + }, + validate.ValidateSchema{ + Identifier: "name", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Optional: true, + Regexp: `^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$`, + MinValueLength: 1, + MaxValueLength: 63, + }, + ) + + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_is_instance_network_attachment", Schema: validateSchema} + return &resourceValidator +} + +func resourceIBMIsInstanceNetworkAttachmentCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + createInstanceNetworkAttachmentOptions := &vpcv1.CreateInstanceNetworkAttachmentOptions{} + + createInstanceNetworkAttachmentOptions.SetInstanceID(d.Get("instance").(string)) + virtualNetworkInterfaceModel, err := resourceIBMIsInstanceNetworkAttachmentMapToInstanceNetworkAttachmentPrototypeVirtualNetworkInterface(d.Get("virtual_network_interface.0").(map[string]interface{})) + if err != nil { + return diag.FromErr(err) + } + createInstanceNetworkAttachmentOptions.SetVirtualNetworkInterface(virtualNetworkInterfaceModel) + if _, ok := d.GetOk("name"); ok { + createInstanceNetworkAttachmentOptions.SetName(d.Get("name").(string)) + } + + instanceNetworkAttachment, response, err := vpcClient.CreateInstanceNetworkAttachmentWithContext(context, createInstanceNetworkAttachmentOptions) + if err != nil { + log.Printf("[DEBUG] CreateInstanceNetworkAttachmentWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CreateInstanceNetworkAttachmentWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s/%s", *createInstanceNetworkAttachmentOptions.InstanceID, *instanceNetworkAttachment.ID)) + _, err = isWaitForInstanceNetworkAttachmentStable(vpcClient, *createInstanceNetworkAttachmentOptions.InstanceID, *instanceNetworkAttachment.ID, d.Timeout(schema.TimeoutCreate)) + if err != nil { + return diag.FromErr(fmt.Errorf("isWaitForInstanceNetworkAttachmentStable failed %s", err)) + } + return resourceIBMIsInstanceNetworkAttachmentRead(context, d, meta) +} + +func resourceIBMIsInstanceNetworkAttachmentRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + getInstanceNetworkAttachmentOptions := &vpcv1.GetInstanceNetworkAttachmentOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + getInstanceNetworkAttachmentOptions.SetInstanceID(parts[0]) + getInstanceNetworkAttachmentOptions.SetID(parts[1]) + + instanceNetworkAttachment, response, err := vpcClient.GetInstanceNetworkAttachmentWithContext(context, getInstanceNetworkAttachmentOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetInstanceNetworkAttachmentWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetInstanceNetworkAttachmentWithContext failed %s\n%s", err, response)) + } + // attachment details + if !core.IsNil(instanceNetworkAttachment.Name) { + if err = d.Set("name", instanceNetworkAttachment.Name); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting name: %s", err)) + } + } + if err = d.Set("created_at", flex.DateTimeToString(instanceNetworkAttachment.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting created_at: %s", err)) + } + + if err = d.Set("href", instanceNetworkAttachment.Href); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting href: %s", err)) + } + if err = d.Set("lifecycle_state", instanceNetworkAttachment.LifecycleState); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting lifecycle_state: %s", err)) + } + if err = d.Set("port_speed", flex.IntValue(instanceNetworkAttachment.PortSpeed)); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting port_speed: %s", err)) + } + if err = d.Set("resource_type", instanceNetworkAttachment.ResourceType); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting resource_type: %s", err)) + } + if err = d.Set("type", instanceNetworkAttachment.Type); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting type: %s", err)) + } + if err = d.Set("network_attachment", instanceNetworkAttachment.ID); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting network_attachment: %s", err)) + } + // vni details + vniId := *instanceNetworkAttachment.VirtualNetworkInterface.ID + vniMap := make(map[string]interface{}) + vniMap["id"] = vniId + getVniOptions := &vpcv1.GetVirtualNetworkInterfaceOptions{ + ID: &vniId, + } + vniDetails, response, err := vpcClient.GetVirtualNetworkInterface(getVniOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetVirtualNetworkInterface failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterface failed %s\n%s", err, response)) + } + vniMap["allow_ip_spoofing"] = vniDetails.AllowIPSpoofing + vniMap["auto_delete"] = vniDetails.AutoDelete + vniMap["enable_infrastructure_nat"] = vniDetails.EnableInfrastructureNat + vniMap["name"] = vniDetails.Name + vniMap["resource_group"] = vniDetails.ResourceGroup.ID + vniMap["resource_type"] = vniDetails.ResourceType + primaryipId := *instanceNetworkAttachment.PrimaryIP.ID + if !core.IsNil(vniDetails.Ips) { + ips := []map[string]interface{}{} + for _, ipsItem := range vniDetails.Ips { + if *ipsItem.ID != primaryipId { + ipsItemMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(&ipsItem, true) + if err != nil { + return diag.FromErr(err) + } + ips = append(ips, ipsItemMap) + } + } + vniMap["ips"] = ips + } + + if !core.IsNil(vniDetails.SecurityGroups) { + securityGroups := make([]string, 0) + for _, securityGroupsItem := range vniDetails.SecurityGroups { + if securityGroupsItem.ID != nil { + securityGroups = append(securityGroups, *securityGroupsItem.ID) + } + } + vniMap["security_groups"] = securityGroups + } + autoDelete := true + if autoDeleteOk, ok := d.GetOkExists("virtual_network_interface.0.primary_ip.0.auto_delete"); ok { + autoDelete = autoDeleteOk.(bool) + } + primaryIPMap, err := resourceIBMIsInstanceNetworkAttachmentReservedIPReferenceToMap(instanceNetworkAttachment.PrimaryIP, autoDelete) + if err != nil { + return diag.FromErr(err) + } + vniMap["primary_ip"] = []map[string]interface{}{primaryIPMap} + + vniMap["subnet"] = *instanceNetworkAttachment.Subnet.ID + if err = d.Set("virtual_network_interface", []map[string]interface{}{vniMap}); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting virtual_network_interface: %s", err)) + } + + return nil +} + +func resourceIBMIsInstanceNetworkAttachmentUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + updateInstanceNetworkAttachmentOptions := &vpcv1.UpdateInstanceNetworkAttachmentOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + updateInstanceNetworkAttachmentOptions.SetInstanceID(parts[0]) + updateInstanceNetworkAttachmentOptions.SetID(parts[1]) + + hasChange := false + + patchVals := &vpcv1.InstanceNetworkAttachmentPatch{} + if d.HasChange("instance") { + return diag.FromErr(fmt.Errorf("Cannot update resource property \"%s\" with the ForceNew annotation."+ + " The resource must be re-created to update this property.", "instance")) + } + if d.HasChange("name") { + newName := d.Get("name").(string) + patchVals.Name = &newName + hasChange = true + } + + if hasChange { + updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch, _ = patchVals.AsPatch() + _, response, err := vpcClient.UpdateInstanceNetworkAttachmentWithContext(context, updateInstanceNetworkAttachmentOptions) + if err != nil { + log.Printf("[DEBUG] UpdateInstanceNetworkAttachmentWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("UpdateInstanceNetworkAttachmentWithContext failed %s\n%s", err, response)) + } + } + + return resourceIBMIsInstanceNetworkAttachmentRead(context, d, meta) +} + +func resourceIBMIsInstanceNetworkAttachmentDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := vpcClient(meta) + if err != nil { + return diag.FromErr(err) + } + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + getInstanceNetworkAttachmentOptions := &vpcv1.GetInstanceNetworkAttachmentOptions{} + getInstanceNetworkAttachmentOptions.SetInstanceID(parts[0]) + getInstanceNetworkAttachmentOptions.SetID(parts[1]) + + ina, response, err := vpcClient.GetInstanceNetworkAttachmentWithContext(context, getInstanceNetworkAttachmentOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetInstanceNetworkAttachmentWithContext failed while deleting %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetInstanceNetworkAttachmentWithContext failed %s\n%s", err, response)) + } + + deleteInstanceNetworkAttachmentOptions := &vpcv1.DeleteInstanceNetworkAttachmentOptions{} + deleteInstanceNetworkAttachmentOptions.SetInstanceID(parts[0]) + deleteInstanceNetworkAttachmentOptions.SetID(parts[1]) + + response, err = vpcClient.DeleteInstanceNetworkAttachmentWithContext(context, deleteInstanceNetworkAttachmentOptions) + if err != nil { + log.Printf("[DEBUG] DeleteInstanceNetworkAttachmentWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteInstanceNetworkAttachmentWithContext failed %s\n%s", err, response)) + } + _, err = isWaitForInstanceNetworkAttachmentDeleted(vpcClient, parts[0], parts[1], ina, d.Timeout(schema.TimeoutDelete)) + if err != nil { + return diag.FromErr(fmt.Errorf("isWaitForInstanceNetworkAttachmentDeleted failed %s", err)) + } + + d.SetId("") + + return nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToInstanceNetworkAttachmentPrototypeVirtualNetworkInterface(modelMap map[string]interface{}) (vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, error) { + model := &vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterface{} + if modelMap["allow_ip_spoofing"] != nil { + model.AllowIPSpoofing = core.BoolPtr(modelMap["allow_ip_spoofing"].(bool)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["enable_infrastructure_nat"] != nil { + model.EnableInfrastructureNat = core.BoolPtr(modelMap["enable_infrastructure_nat"].(bool)) + } + if modelMap["ips"] != nil { + ips := []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{} + for _, ipsItem := range modelMap["ips"].([]interface{}) { + ipsItemModel, err := resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfaceIPPrototype(ipsItem.(map[string]interface{})) + if err != nil { + return model, err + } + ips = append(ips, ipsItemModel) + } + model.Ips = ips + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["primary_ip"] != nil && len(modelMap["primary_ip"].([]interface{})) > 0 { + PrimaryIPModel, err := resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfacePrimaryIPPrototype(modelMap["primary_ip"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.PrimaryIP = PrimaryIPModel + } + if modelMap["resource_group"] != nil && modelMap["resource_group"].(string) != "" { + rgId := modelMap["resource_group"].(string) + model.ResourceGroup = &vpcv1.ResourceGroupIdentity{ + ID: &rgId, + } + } + if modelMap["security_groups"] != nil && modelMap["security_groups"].(*schema.Set).Len() > 0 { + securityGroups := []vpcv1.SecurityGroupIdentityIntf{} + sg := modelMap["security_groups"].(*schema.Set) + for _, v := range sg.List() { + value := v.(string) + securityGroupsItem := &vpcv1.SecurityGroupIdentity{ + ID: &value, + } + securityGroups = append(securityGroups, securityGroupsItem) + } + model.SecurityGroups = securityGroups + } + if modelMap["subnet"] != nil && modelMap["subnet"].(string) != "" { + subnetid := modelMap["subnet"].(string) + model.Subnet = &vpcv1.SubnetIdentity{ + ID: &subnetid, + } + } + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfaceIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfaceIPPrototypeIntf, error) { + model := &vpcv1.VirtualNetworkInterfaceIPPrototype{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + if modelMap["href"] != nil && modelMap["href"].(string) != "" { + model.Href = core.StringPtr(modelMap["href"].(string)) + } + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextIntf, error) { + model := &vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + if modelMap["href"] != nil && modelMap["href"].(string) != "" { + model.Href = core.StringPtr(modelMap["href"].(string)) + } + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID, error) { + model := &vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID{} + model.ID = core.StringPtr(modelMap["id"].(string)) + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref, error) { + model := &vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref{} + model.Href = core.StringPtr(modelMap["href"].(string)) + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext, error) { + model := &vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext{} + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfacePrimaryIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeIntf, error) { + model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototype{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + if modelMap["href"] != nil && modelMap["href"].(string) != "" { + model.Href = core.StringPtr(modelMap["href"].(string)) + } + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextIntf, error) { + model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + if modelMap["href"] != nil && modelMap["href"].(string) != "" { + model.Href = core.StringPtr(modelMap["href"].(string)) + } + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID, error) { + model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID{} + model.ID = core.StringPtr(modelMap["id"].(string)) + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref, error) { + model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref{} + model.Href = core.StringPtr(modelMap["href"].(string)) + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext(modelMap map[string]interface{}) (*vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext, error) { + model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext{} + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + return model, nil +} +func resourceIBMIsInstanceNetworkAttachmentMapToSubnetIdentityByID(modelMap map[string]interface{}) (*vpcv1.SubnetIdentityByID, error) { + model := &vpcv1.SubnetIdentityByID{} + model.ID = core.StringPtr(modelMap["id"].(string)) + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToSubnetIdentityByCRN(modelMap map[string]interface{}) (*vpcv1.SubnetIdentityByCRN, error) { + model := &vpcv1.SubnetIdentityByCRN{} + model.CRN = core.StringPtr(modelMap["crn"].(string)) + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToSubnetIdentityByHref(modelMap map[string]interface{}) (*vpcv1.SubnetIdentityByHref, error) { + model := &vpcv1.SubnetIdentityByHref{} + model.Href = core.StringPtr(modelMap["href"].(string)) + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentMapToInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext(modelMap map[string]interface{}) (*vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext, error) { + model := &vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext{} + if modelMap["allow_ip_spoofing"] != nil { + model.AllowIPSpoofing = core.BoolPtr(modelMap["allow_ip_spoofing"].(bool)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["enable_infrastructure_nat"] != nil { + model.EnableInfrastructureNat = core.BoolPtr(modelMap["enable_infrastructure_nat"].(bool)) + } + if modelMap["ips"] != nil { + ips := []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{} + for _, ipsItem := range modelMap["ips"].([]interface{}) { + ipsItemModel, err := resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfaceIPPrototype(ipsItem.(map[string]interface{})) + if err != nil { + return model, err + } + ips = append(ips, ipsItemModel) + } + model.Ips = ips + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["primary_ip"] != nil && len(modelMap["primary_ip"].([]interface{})) > 0 { + PrimaryIPModel, err := resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfacePrimaryIPPrototype(modelMap["primary_ip"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.PrimaryIP = PrimaryIPModel + } + if modelMap["resource_group"] != nil && modelMap["resource_group"].(string) != "" { + rgId := modelMap["resource_group"].(string) + model.ResourceGroup = &vpcv1.ResourceGroupIdentity{ + ID: &rgId, + } + } + if modelMap["security_groups"] != nil && modelMap["security_groups"].(*schema.Set).Len() > 0 { + securityGroups := []vpcv1.SecurityGroupIdentityIntf{} + sg := modelMap["security_groups"].(*schema.Set) + for _, v := range sg.List() { + value := v.(string) + securityGroupsItem := &vpcv1.SecurityGroupIdentity{ + ID: &value, + } + securityGroups = append(securityGroups, securityGroupsItem) + } + model.SecurityGroups = securityGroups + } + if modelMap["subnet"] != nil && modelMap["subnet"].(string) != "" { + subnetid := modelMap["subnet"].(string) + model.Subnet = &vpcv1.SubnetIdentity{ + ID: &subnetid, + } + } + return model, nil +} + +func resourceIBMIsInstanceNetworkAttachmentReservedIPReferenceToMap(model *vpcv1.ReservedIPReference, autodelete bool) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["address"] = model.Address + if model.Deleted != nil { + deletedMap, err := resourceIBMIsInstanceNetworkAttachmentReservedIPReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["auto_delete"] = autodelete + modelMap["reserved_ip"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func resourceIBMIsInstanceNetworkAttachmentReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func resourceIBMIsInstanceNetworkAttachmentSubnetReferenceToMap(model *vpcv1.SubnetReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := resourceIBMIsInstanceNetworkAttachmentSubnetReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func resourceIBMIsInstanceNetworkAttachmentSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func isWaitForInstanceNetworkAttachmentStable(instanceC *vpcv1.VpcV1, instanceId, id string, timeout time.Duration) (interface{}, error) { + log.Printf("Waiting for instance network attachment (%s) to be stable.", id) + + stateConf := &resource.StateChangeConf{ + Pending: []string{"deleting", "waiting", "updating", "pending"}, + Target: []string{"stable", "failed", "suspended", ""}, + Refresh: isInstanceNetworkAttachmentRefreshFunc(instanceC, instanceId, id), + Timeout: timeout, + Delay: 10 * time.Second, + MinTimeout: 10 * time.Second, + } + + return stateConf.WaitForState() +} +func isInstanceNetworkAttachmentRefreshFunc(instanceC *vpcv1.VpcV1, instanceId, id string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + getInstanceNetworkAttachmentOptions := &vpcv1.GetInstanceNetworkAttachmentOptions{ + InstanceID: &instanceId, + ID: &id, + } + networkAttachment, response, err := instanceC.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions) + if err != nil { + return nil, "", fmt.Errorf("[ERROR] Error getting network attachment: %s\n%s", err, response) + } + + if *networkAttachment.LifecycleState == "failed" || *networkAttachment.LifecycleState == "suspended" { + return networkAttachment, *networkAttachment.LifecycleState, fmt.Errorf("[ERROR] Error network attachment(%s) in (%s) state", id, *networkAttachment.LifecycleState) + } + + return networkAttachment, *networkAttachment.LifecycleState, nil + } +} +func isWaitForInstanceNetworkAttachmentDeleted(instanceC *vpcv1.VpcV1, instanceId, id string, ina *vpcv1.InstanceNetworkAttachment, timeout time.Duration) (interface{}, error) { + log.Printf("Waiting for instance network attachment (%s) to be deleted.", id) + + stateConf := &resource.StateChangeConf{ + Pending: []string{"deleting", "waiting", "updating", "pending"}, + Target: []string{"deleted", "failed", "suspended", ""}, + Refresh: isInstanceNetworkAttachmentDeleteRefreshFunc(instanceC, instanceId, id, ina), + Timeout: timeout, + Delay: 10 * time.Second, + MinTimeout: 10 * time.Second, + } + + return stateConf.WaitForState() +} +func isInstanceNetworkAttachmentDeleteRefreshFunc(instanceC *vpcv1.VpcV1, instanceId, id string, ina *vpcv1.InstanceNetworkAttachment) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + getInstanceNetworkAttachmentOptions := &vpcv1.GetInstanceNetworkAttachmentOptions{ + InstanceID: &instanceId, + ID: &id, + } + networkAttachment, response, err := instanceC.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + return ina, "deleted", nil + } + return ina, "", fmt.Errorf("[ERROR] Error deleting network attachment: %s\n%s", err, response) + } + + if *networkAttachment.LifecycleState == "failed" || *networkAttachment.LifecycleState == "suspended" { + return networkAttachment, *networkAttachment.LifecycleState, fmt.Errorf("[ERROR] Error network attachment(%s) in (%s) state", id, *networkAttachment.LifecycleState) + } + + return networkAttachment, *networkAttachment.LifecycleState, nil + } +} diff --git a/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go b/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go new file mode 100644 index 0000000000..26598a9e76 --- /dev/null +++ b/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go @@ -0,0 +1,281 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func TestAccIBMIsInstanceNetworkAttachmentBasic(t *testing.T) { + var conf vpcv1.InstanceNetworkAttachment + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-vsi-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tf-vni-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tvni-subnet-%d", acctest.RandIntRange(10, 100)) + naname := fmt.Sprintf("tvni-na-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(` +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR +`) + sshname := fmt.Sprintf("tf-sshname-%d", acctest.RandIntRange(10, 100)) + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIsInstanceNetworkAttachmentDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsInstanceNetworkAttachmentConfigBasic(vpcname, subnetname, sshname, publicKey, vniname, name, naname), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIsInstanceNetworkAttachmentExists("ibm_is_instance_network_attachment.is_instance_network_attachment", conf), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "resource_type", "instance_network_attachment"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "type", "secondary"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "lifecycle_state", "stable"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "created_at"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "href"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "id"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "instance"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "network_attachment"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "name"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "port_speed"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.#"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.id"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.#"), + ), + }, + }, + }) +} + +func TestAccIBMIsInstanceNetworkAttachmentAllArgs(t *testing.T) { + var conf vpcv1.InstanceNetworkAttachment + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-vsi-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tf-vni-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tvni-subnet-%d", acctest.RandIntRange(10, 100)) + naname := fmt.Sprintf("tvni-na-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(` +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR +`) + sshname := fmt.Sprintf("tf-sshname-%d", acctest.RandIntRange(10, 100)) + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIsInstanceNetworkAttachmentDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsInstanceNetworkAttachmentConfig(vpcname, subnetname, sshname, publicKey, vniname, name, naname), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIsInstanceNetworkAttachmentExists("ibm_is_instance_network_attachment.is_instance_network_attachment", conf), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "resource_type", "instance_network_attachment"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "type", "secondary"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "lifecycle_state", "stable"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "created_at"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "href"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "id"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "instance"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "network_attachment"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "name"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "port_speed"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.#"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.id"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.allow_ip_spoofing"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.allow_ip_spoofing", "true"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.enable_infrastructure_nat"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.enable_infrastructure_nat", "true"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name", vniname+"-inline"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.#"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.0.address", "10.240.64.12"), + ), + }, + }, + }) +} + +func testAccCheckIBMIsInstanceNetworkAttachmentConfigBasic(vpcname, subnetname, sshname, publicKey, vniname, name, naname string) string { + return fmt.Sprintf(` + + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + total_ipv4_address_count = 16 + } + + resource "ibm_is_ssh_key" "testacc_sshkey" { + name = "%s" + public_key = "%s" + } + resource "ibm_is_virtual_network_interface" "testacc_vni" { + name = "%s" + subnet = ibm_is_subnet.testacc_subnet.id + enable_infrastructure_nat = true + allow_ip_spoofing = %t + } + resource "ibm_is_virtual_network_interface" "testacc_vni2" { + name = "%s2" + subnet = ibm_is_subnet.testacc_subnet.id + enable_infrastructure_nat = true + allow_ip_spoofing = %t + } + resource "ibm_is_instance" "testacc_vsi" { + profile = "%s" + name = "%s" + image = "%s" + zone = "%s" + keys = [ibm_is_ssh_key.testacc_sshkey.id] + primary_network_attachment { + name = "vni-2" + virtual_network_interface { + id = ibm_is_virtual_network_interface.testacc_vni.id + } + } + vpc = ibm_is_vpc.testacc_vpc.id + } + + resource "ibm_is_instance_network_attachment" "is_instance_network_attachment" { + instance = ibm_is_instance.testacc_vsi.id + name = "%s" + virtual_network_interface { + id = ibm_is_virtual_network_interface.testacc_vni2.id + } + } + `, vpcname, subnetname, acc.ISZoneName2, sshname, publicKey, vniname, true, vniname, true, acc.InstanceProfileName, name, acc.IsImage, acc.ISZoneName2, naname) +} + +func testAccCheckIBMIsInstanceNetworkAttachmentConfig(vpcname, subnetname, sshname, publicKey, vniname, name, naname string) string { + return fmt.Sprintf(` + + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + total_ipv4_address_count = 16 + } + + resource "ibm_is_ssh_key" "testacc_sshkey" { + name = "%s" + public_key = "%s" + } + resource "ibm_is_virtual_network_interface" "testacc_vni" { + name = "%s" + subnet = ibm_is_subnet.testacc_subnet.id + enable_infrastructure_nat = true + allow_ip_spoofing = %t + } + + resource "ibm_is_instance" "testacc_vsi" { + profile = "%s" + name = "%s" + image = "%s" + zone = "%s" + keys = [ibm_is_ssh_key.testacc_sshkey.id] + primary_network_attachment { + name = "vni-2" + virtual_network_interface { + id = ibm_is_virtual_network_interface.testacc_vni.id + } + } + vpc = ibm_is_vpc.testacc_vpc.id + } + + resource "ibm_is_instance_network_attachment" "is_instance_network_attachment" { + instance = ibm_is_instance.testacc_vsi.id + name = "%s" + virtual_network_interface { + name = "%s-inline" + allow_ip_spoofing = %t + enable_infrastructure_nat = true + primary_ip { + auto_delete = true + address = "10.240.64.12" + } + subnet = ibm_is_subnet.testacc_subnet.id + } + } + `, vpcname, subnetname, acc.ISZoneName2, sshname, publicKey, vniname, true, acc.InstanceProfileName, name, acc.IsImage, acc.ISZoneName2, naname, vniname, true) +} + +func testAccCheckIBMIsInstanceNetworkAttachmentExists(n string, obj vpcv1.InstanceNetworkAttachment) resource.TestCheckFunc { + + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + vpcClient, err := vpcClient(acc.TestAccProvider.Meta()) + if err != nil { + return err + } + + getInstanceNetworkAttachmentOptions := &vpcv1.GetInstanceNetworkAttachmentOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getInstanceNetworkAttachmentOptions.SetInstanceID(parts[0]) + getInstanceNetworkAttachmentOptions.SetID(parts[1]) + + instanceByNetworkAttachment, _, err := vpcClient.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions) + if err != nil { + return err + } + + obj = *instanceByNetworkAttachment + return nil + } +} + +func testAccCheckIBMIsInstanceNetworkAttachmentDestroy(s *terraform.State) error { + vpcClient, err := vpcClient(acc.TestAccProvider.Meta()) + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_is_instance_network_attachment" { + continue + } + + getInstanceNetworkAttachmentOptions := &vpcv1.GetInstanceNetworkAttachmentOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getInstanceNetworkAttachmentOptions.SetInstanceID(parts[0]) + getInstanceNetworkAttachmentOptions.SetID(parts[1]) + + // Try to find the key + _, response, err := vpcClient.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions) + + if err == nil { + return fmt.Errorf("InstanceByNetworkAttachment still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("[ERROR] Error checking for InstanceByNetworkAttachment (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/ibm/service/vpc/resource_ibm_is_instance_test.go b/ibm/service/vpc/resource_ibm_is_instance_test.go index 6e6dfc69aa..8795784034 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_test.go +++ b/ibm/service/vpc/resource_ibm_is_instance_test.go @@ -73,6 +73,46 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE }, }) } +func TestAccIBMISInstance_vni(t *testing.T) { + var instance string + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-instnace-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tf-subnet-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(` +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR +`) + vniname := fmt.Sprintf("tf-vni-%d", acctest.RandIntRange(10, 100)) + sshname := fmt.Sprintf("tf-ssh-%d", acctest.RandIntRange(10, 100)) + userData1 := "a" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMISInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISInstanceVniConfig(vpcname, subnetname, sshname, publicKey, name, vniname, userData1), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMISInstanceExists("ibm_is_instance.testacc_instance", instance), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "name", name), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "user_data", userData1), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "zone", acc.ISZoneName), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "vcpu.#"), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "vcpu.0.manufacturer"), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "primary_network_attachment.#"), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "primary_network_attachment.#", "1"), + ), + }, + }, + }) +} func TestAccIBMISInstance_lifecycle(t *testing.T) { var instance string vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) @@ -1046,6 +1086,46 @@ func testAccCheckIBMISInstanceConfig(vpcname, subnetname, sshname, publicKey, na } }`, vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, sshname, publicKey, name, acc.IsImage, acc.InstanceProfileName, userData, acc.ISZoneName) } +func testAccCheckIBMISInstanceVniConfig(vpcname, subnetname, sshname, publicKey, name, vniname, userData string) string { + return fmt.Sprintf(` +resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" +} + +resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + ipv4_cidr_block = "%s" +} + +resource "ibm_is_ssh_key" "testacc_sshkey" { + name = "%s" + public_key = "%s" +} + +resource "ibm_is_virtual_network_interface" "testacc_vni"{ + name = "%s" + allow_ip_spoofing = true + subnet = ibm_is_subnet.testacc_subnet.id +} + +resource "ibm_is_instance" "testacc_instance" { + name = "%s" + image = "%s" + profile = "%s" + primary_network_attachment { + name = "test-vni" + virtual_network_interface { + id = ibm_is_virtual_network_interface.testacc_vni.id + } + } + user_data = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + keys = [ibm_is_ssh_key.testacc_sshkey.id] +}`, vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, sshname, publicKey, vniname, name, acc.IsImage, acc.InstanceProfileName, userData, acc.ISZoneName) +} func testAccCheckIBMISInstanceRipConfig(vpcname, subnetname, subnetripname, sshname, publicKey, name, userData string) string { return fmt.Sprintf(` diff --git a/website/docs/d/is_instance.html.markdown b/website/docs/d/is_instance.html.markdown index eef79787eb..c86f691118 100644 --- a/website/docs/d/is_instance.html.markdown +++ b/website/docs/d/is_instance.html.markdown @@ -155,6 +155,36 @@ In addition to all argument reference list, you can access the following attribu - `enabled` - (Boolean) Indicates whether the metadata service endpoint will be available to the virtual server instance. - `protocol` - (String) The communication protocol to use for the metadata service endpoint. - `response_hop_limit` - (Integer) The hop limit (IP time to live) for IP response packets from the metadata service. + +- `network_attachments` - (List) The network attachments for this virtual server instance, including the primary network attachment. + Nested schema for **network_attachments**: + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this network attachment. + - `id` - (String) The unique identifier for this network attachment. + - `name` - (String) + - `primary_ip` - (List) The primary IP address of the virtual network interface for the network attachment. + Nested schema for **primary_ip**: + - `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this reserved IP. + - `id` - (String) The unique identifier for this reserved IP. + - `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. + - `resource_type` - (String) The resource type. + - `subnet` - (List) The subnet of the virtual network interface for the network attachment. + Nested schema for **subnet**: + - `crn` - (String) The CRN for this subnet. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this subnet. + - `id` - (String) The unique identifier for this subnet. + - `name` - (String) The name for this subnet. The name is unique across all subnets in the VPC. + - `resource_type` - (String) The resource type. - `network_interfaces`- (List) A list of more network interfaces that the instance uses. @@ -183,6 +213,36 @@ In addition to all argument reference list, you can access the following attribu - `id` - (String) The unique identifier for this placement target resource. - `name` - (String) The unique user-defined name for this placement target resource. If unspecified, the name will be a hyphenated list of randomly-selected words. - `resource_type` - (String) The type of resource referenced. +- `primary_network_attachment` - (List) The primary network attachment for this virtual server instance. + Nested schema for **primary_network_attachment**: + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this network attachment. + - `id` - (String) The unique identifier for this network attachment. + - `name` - (String) + - `primary_ip` - (List) The primary IP address of the virtual network interface for the network attachment. + Nested schema for **primary_ip**: + - `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this reserved IP. + - `id` - (String) The unique identifier for this reserved IP. + - `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. + - `resource_type` - (String) The resource type. + - `subnet` - (List) The subnet of the virtual network interface for the network attachment. + Nested schema for **subnet**: + - `crn` - (String) The CRN for this subnet. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this subnet. + - `id` - (String) The unique identifier for this subnet. + - `name` - (String) The name for this subnet. The name is unique across all subnets in the VPC. + - `resource_type` - (String) The resource type. + - `primary_network_interface`- (List) A list of primary network interfaces that were created for the instance. Nested scheme for `primary_network_interface`: diff --git a/website/docs/d/is_instance_network_attachment.html.markdown b/website/docs/d/is_instance_network_attachment.html.markdown new file mode 100644 index 0000000000..43fd11e66c --- /dev/null +++ b/website/docs/d/is_instance_network_attachment.html.markdown @@ -0,0 +1,70 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_is_instance_network_attachment" +description: |- + Get information about InstanceNetworkAttachment +subcategory: "Virtual Private Cloud API" +--- + +# ibm_is_instance_network_attachment + +Provides a read-only data source to retrieve information about an Instance NetworkAttachment. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```terraform +data "ibm_is_instance_network_attachment" "example" { + instance = ibm_is_instance.example.id + network_attachment = ibm_is_instance.example.primary_network_attachment.0.id +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +- `instance` - (Required, Forces new resource, String) The virtual server instance identifier. +- `network_attachment` - (Required, Forces new resource, String) The instance network attachment identifier. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +- `id` - The unique identifier of the Instance NetworkAttachment.`/` +- `created_at` - (String) The date and time that the instance network attachment was created. +- `href` - (String) The URL for this instance network attachment. +- `lifecycle_state` - (String) The lifecycle state of the instance network attachment. Allowable values are: `deleting`, `failed`, `pending`, `stable`, `suspended`, `updating`, `waiting`. +- `name` - (String) The name for this instance network attachment. The name is unique across all network attachments for the instance. +- `port_speed` - (Integer) The port speed for this instance network attachment in Mbps. +- `primary_ip` - (List) The primary IP address of the virtual network interface for the instance networkattachment. + Nested schema for **primary_ip**: + - `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this reserved IP. + - `id` - (String) The unique identifier for this reserved IP. + - `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. + +- `resource_type` - (String) The resource type. +- `subnet` - (List) The subnet of the virtual network interface for the instance network attachment. + Nested schema for **subnet**: + - `crn` - (String) The CRN for this subnet. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this subnet. + - `id` - (String) The unique identifier for this subnet. + - `name` - (String) The name for this subnet. The name is unique across all subnets in the VPC. + - `resource_type` - (String) The resource type. + +- `type` - (String) The instance network attachment type. +- `virtual_network_interface` - (List) The virtual network interface for this instance network attachment. + Nested schema for **virtual_network_interface**: + - `crn` - (String) The CRN for this virtual network interface. + - `href` - (String) The URL for this virtual network interface. + - `id` - (String) The unique identifier for this virtual network interface. + - `name` - (String) The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + - `resource_type` - (String) The resource type. + diff --git a/website/docs/d/is_instance_network_attachments.html.markdown b/website/docs/d/is_instance_network_attachments.html.markdown new file mode 100644 index 0000000000..128bce999e --- /dev/null +++ b/website/docs/d/is_instance_network_attachments.html.markdown @@ -0,0 +1,69 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_is_instance_network_attachments" +description: |- + Get information about InstanceNetworkAttachment Collection +subcategory: "Virtual Private Cloud API" +--- + +# ibm_is_instance_network_attachments + +Provides a read-only data source to retrieve information about an InstanceNetworkAttachment Collection. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```terraform +data "ibm_is_instance_network_attachments" "example" { + instance = ibm_is_instance.example.id +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +- `instance` - (Required, Forces new resource, String) The virtual server instance identifier. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +- `id` - The unique identifier of the InstanceNetworkAttachmentCollection. +- `network_attachments` - (List) Collection of instance network attachments. + Nested schema for **network_attachments**: + - `created_at` - (String) The date and time that the instance network attachment was created. + - `href` - (String) The URL for this instance network attachment. + - `id` - (String) The unique identifier for this instance network attachment. + - `lifecycle_state` - (String) The lifecycle state of the instance network attachment. + - `name` - (String) The name for this instance network attachment. The name is unique across all network attachments for the instance. + - `port_speed` - (Integer) The port speed for this instance network attachment in Mbps. + - `primary_ip` - (List) The primary IP address of the virtual network interface for the instance networkattachment. + Nested schema for **primary_ip**: + - `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this reserved IP. + - `id` - (String) The unique identifier for this reserved IP. + - `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. + - `resource_type` - (String) The resource type. + - `subnet` - (List) The subnet of the virtual network interface for the instance network attachment. + Nested schema for **subnet**: + - `crn` - (String) The CRN for this subnet. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this subnet. + - `id` - (String) The unique identifier for this subnet. + - `name` - (String) The name for this subnet. The name is unique across all subnets in the VPC. + - `resource_type` - (String) The resource type. + - `type` - (String) The instance network attachment type. + - `virtual_network_interface` - (List) The virtual network interface for this instance network attachment. + Nested schema for **virtual_network_interface**: + - `crn` - (String) The CRN for this virtual network interface. + - `href` - (String) The URL for this virtual network interface. + - `id` - (String) The unique identifier for this virtual network interface. + - `name` - (String) The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + - `resource_type` - (String) The resource type. + diff --git a/website/docs/d/is_instance_profile.html.markdown b/website/docs/d/is_instance_profile.html.markdown index 3350195366..085cc251fd 100644 --- a/website/docs/d/is_instance_profile.html.markdown +++ b/website/docs/d/is_instance_profile.html.markdown @@ -127,6 +127,13 @@ In addition to the argument reference list, you can access the following attribu - `type` - (String) The type for this profile field. - `value` - (String) The value for this profile field. - `values` - (String) The permitted values for this profile field. +- `network_attachment_count` - (List) The number of network attachments supported on an instance with this profile + + Nested scheme for `network_attachment_count`: + - `max` - (Integer) The maximum number of network attachments supported by an instance using this profile. + - `min` - (Integer) The minimum number of network attachments supported by an instance using this profile. + - `type` - (String) The type for this profile field, Ex: range or dependent. + - `network_interface_count` - (List) Nested scheme for `network_interface_count`: diff --git a/website/docs/d/is_instance_profiles.html.markdown b/website/docs/d/is_instance_profiles.html.markdown index 2b0a8ba980..07bcba8d78 100644 --- a/website/docs/d/is_instance_profiles.html.markdown +++ b/website/docs/d/is_instance_profiles.html.markdown @@ -128,6 +128,14 @@ You can access the following attribute references after your data source is crea - `value` - (String) The value for this profile field. - `values` - (String) The permitted values for this profile field. + - `network_attachment_count` - (List) The number of network attachments supported on an instance with this profile + + Nested scheme for `network_attachment_count`: + - `max` - (Integer) The maximum number of network attachments supported by an instance using this profile. + - `min` - (Integer) The minimum number of network attachments supported by an instance using this profile. + - `type` - (String) The type for this profile field, Ex: range or dependent. + + - `network_interface_count` - (List) Nested scheme for `network_interface_count`: diff --git a/website/docs/d/is_instances.html.markdown b/website/docs/d/is_instances.html.markdown index 94a14a428d..a1b6d974ec 100644 --- a/website/docs/d/is_instances.html.markdown +++ b/website/docs/d/is_instances.html.markdown @@ -111,7 +111,37 @@ In addition to all argument reference list, you can access the following attribu - `enabled` - (Boolean) Indicates whether the metadata service endpoint will be available to the virtual server instance. - `protocol` - (String) The communication protocol to use for the metadata service endpoint. - `response_hop_limit` - (Integer) The hop limit (IP time to live) for IP response packets from the metadata service. - + + - `network_attachments` - (List) The network attachments for this virtual server instance, including the primary network attachment. + Nested schema for **network_attachments**: + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this network attachment. + - `id` - (String) The unique identifier for this network attachment. + - `name` - (String) + - `primary_ip` - (List) The primary IP address of the virtual network interface for the network attachment. + Nested schema for **primary_ip**: + - `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this reserved IP. + - `id` - (String) The unique identifier for this reserved IP. + - `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. + - `resource_type` - (String) The resource type. + - `subnet` - (List) The subnet of the virtual network interface for the network attachment. + Nested schema for **subnet**: + - `crn` - (String) The CRN for this subnet. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this subnet. + - `id` - (String) The unique identifier for this subnet. + - `name` - (String) The name for this subnet. The name is unique across all subnets in the VPC. + - `resource_type` - (String) The resource type. + - `network_interfaces`- (List) A list of more network interfaces that the instance uses. Nested scheme for `network_interfaces`: @@ -138,6 +168,36 @@ In addition to all argument reference list, you can access the following attribu - `id` - (String) The unique identifier for this placement target resource. - `name` - (String) The unique user-defined name for this placement target resource. If unspecified, the name will be a hyphenated list of randomly-selected words. - `resource_type` - (String) The type of resource referenced. + - `primary_network_attachment` - (List) The primary network attachment for this virtual server instance. + Nested schema for **primary_network_attachment**: + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this network attachment. + - `id` - (String) The unique identifier for this network attachment. + - `name` - (String) + - `primary_ip` - (List) The primary IP address of the virtual network interface for the network attachment. + Nested schema for **primary_ip**: + - `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this reserved IP. + - `id` - (String) The unique identifier for this reserved IP. + - `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. + - `resource_type` - (String) The resource type. + - `subnet` - (List) The subnet of the virtual network interface for the network attachment. + Nested schema for **subnet**: + - `crn` - (String) The CRN for this subnet. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this subnet. + - `id` - (String) The unique identifier for this subnet. + - `name` - (String) The name for this subnet. The name is unique across all subnets in the VPC. + - `resource_type` - (String) The resource type. + - `primary_network_interface`- (List) A list of primary network interfaces that were created for the instance. Nested scheme for `primary_network_interface`: diff --git a/website/docs/r/is_instance.html.markdown b/website/docs/r/is_instance.html.markdown index 83a28e4b31..da26047f43 100644 --- a/website/docs/r/is_instance.html.markdown +++ b/website/docs/r/is_instance.html.markdown @@ -24,7 +24,7 @@ Create, update, or delete a Virtual Servers for VPC instance. For more informati ## Example usage -### Sample for creating an instance in a VPC. +### Sample for creating an instance in a VPC using virtual network interface and network attachments. ```terraform resource "ibm_is_vpc" "example" { @@ -43,6 +43,63 @@ resource "ibm_is_ssh_key" "example" { public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR" } +resource "ibm_is_virtual_network_interface" "example"{ + name = "example-vni" + allow_ip_spoofing = false + enable_infrastructure_nat = true + primary_ip { + auto_delete = false + address = "10.240.0.8" + } + subnet = ibm_is_subnet.example.id +} + +resource "ibm_is_instance" "example" { + name = "example-instance" + image = ibm_is_image.example.id + profile = "bx2-2x8" + metadata_service_enabled = false + + boot_volume { + encryption = "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179" + } + + primary_network_attachment { + name = "vexample-primary-att" + virtual_network_interface { + id = ibm_is_virtual_network_interface.example.id + } + } + + network_attachments { + name = "example-network-att" + virtual_network_interface { + name = "example-net-vni" + auto_delete = true + enable_infrastructure_nat = true + primary_ip { + auto_delete = true + address = "10.240.0.6" + } + subnet = ibm_is_subnet.example.id + } + } + vpc = ibm_is_vpc.example.id + zone = ibm_is_subnet.example.zone + keys = [ibm_is_ssh_key.example.id] + + //User can configure timeouts + timeouts { + create = "15m" + update = "15m" + delete = "15m" + } +} +``` + +### Sample for creating an instance in a VPC. + +```terraform resource "ibm_is_instance" "example" { name = "example-instance" image = ibm_is_image.example.id @@ -474,6 +531,36 @@ Review the argument references that you can specify for your resource. - `protocol` - (Optional, String) The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is enabled. Default is **http** - `response_hop_limit` - (Optional, Integer) The hop limit (IP time to live) for IP response packets from the metadata service. Default is **1** - `name` - (Optional, String) The instance name. +- `network_attachments` - (Optional, List) The network attachments for this virtual server instance, including the primary network attachment. + Nested schema for **network_attachments**: + - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (Required, String) Link to documentation about deleted resources. + - `href` - (String) The URL for this network attachment. + ~> **NOTE** to add `ips` only existing `reserved_ip` is supported, new reserved_ip creation is not supported as it leads to unmanaged(dangling) reserved ips. Use `ibm_is_subnet_reserved_ip` to create a reserved_ip + - `id` - (String) The unique identifier for this network attachment. + - `name` - (Required, String) + - `primary_ip` - (Required, List) The primary IP address of the virtual network interface for the network attachment. + Nested schema for **primary_ip**: + - `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (Required, String) Link to documentation about deleted resources. + - `href` - (Required, String) The URL for this reserved IP. + - `id` - (Required, String) The unique identifier for this reserved IP. + - `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. + - `resource_type` - (String) The resource type. + - `subnet` - (Required, List) The subnet of the virtual network interface for the network attachment. + Nested schema for **subnet**: + - `crn` - (Required, String) The CRN for this subnet. + - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (Required, String) Link to documentation about deleted resources. + - `href` - (Required, String) The URL for this subnet. + - `id` - (Required, String) The unique identifier for this subnet. + - `name` - (String) The name for this subnet. The name is unique across all subnets in the VPC. + - `resource_type` - (String) The resource type. - `network_interfaces` (Optional, Forces new resource, List) A list of more network interfaces that are set up for the instance. -> **Allowed vNIC per profile.** Follow the vNIC count as per the instance profile's `network_interface_count`. For details see [`is_instance_profile`](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/is_instance_profile) or [`is_instance_profiles`](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/is_instance_profiles). @@ -496,6 +583,35 @@ Review the argument references that you can specify for your resource. - `subnet` - (Required, String) The ID of the subnet. - `security_groups`- (Optional, List of strings)A comma separated list of security groups to add to the primary network interface. - `placement_group` - (Optional, string) Unique Identifier of the Placement Group for restricting the placement of the instance +- `primary_network_attachment` - (Optional, List) The primary network attachment for this virtual server instance. + Nested schema for **primary_network_attachment**: + - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (Required, String) Link to documentation about deleted resources. + - `href` - (String) The URL for this network attachment. + - `id` - (String) The unique identifier for this network attachment. + - `name` - (Required, String) + - `primary_ip` - (Required, List) The primary IP address of the virtual network interface for the network attachment. + Nested schema for **primary_ip**: + - `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (Required, String) Link to documentation about deleted resources. + - `href` - (Required, String) The URL for this reserved IP. + - `id` - (Required, String) The unique identifier for this reserved IP. + - `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. + - `resource_type` - (String) The resource type. + - `subnet` - (Required, List) The subnet of the virtual network interface for the network attachment. + Nested schema for **subnet**: + - `crn` - (Required, String) The CRN for this subnet. + - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (Required, String) Link to documentation about deleted resources. + - `href` - (Required, String) The URL for this subnet. + - `id` - (Required, String) The unique identifier for this subnet. + - `name` - (String) The name for this subnet. The name is unique across all subnets in the VPC. + - `resource_type` - (String) The resource type. - `primary_network_interface` - (Required, List) A nested block describes the primary network interface of this instance. Only one primary network interface can be specified for an instance. When using `instance_template`, `primary_network_interface` is not required. Nested scheme for `primary_network_interface`: diff --git a/website/docs/r/is_instance_network_attachment.html.markdown b/website/docs/r/is_instance_network_attachment.html.markdown new file mode 100644 index 0000000000..26976587f8 --- /dev/null +++ b/website/docs/r/is_instance_network_attachment.html.markdown @@ -0,0 +1,88 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_is_instance_network_attachment" +description: |- + Manages Instance NetworkAttachment. +subcategory: "Virtual Private Cloud API" +--- + +# ibm_is_instance_network_attachment + +Create, update, and delete Instance NetworkAttachment with this resource. + +## Example Usage + +```terraform +resource "ibm_is_instance_network_attachment" "example" { + instance = "" + virtual_network_interface { + id = "" + } +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +- `instance` - (Required, Forces new resource, String) The virtual server instance identifier. +- `name` - (Optional, String) The name for this instance network attachment. The name is unique across all network attachments for the instance. +- `virtual_network_interface` - (Required, List) The virtual network interface for this instance network attachment. + Nested schema for **virtual_network_interface**: + - `crn` - (Required, String) The CRN for this virtual network interface. + - `href` - (Required, String) The URL for this virtual network interface. + - `id` - (Required, String) The unique identifier for this virtual network interface. + ~> **NOTE** to add `ips` only existing `reserved_ip` is supported, new reserved_ip creation is not supported as it leads to unmanaged(dangling) reserved ips. Use `ibm_is_subnet_reserved_ip` to create a reserved_ip + - `name` - (Required, String) The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + - `resource_type` - (Computed, String) The resource type. + +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +- `id` - The unique identifier of the Instance NetworkAttachment. +- `created_at` - (String) The date and time that the instance network attachment was created. +- `href` - (String) The URL for this instance network attachment. +- `lifecycle_state` - (String) The lifecycle state of the instance network attachment. + * Allowable values are: `deleting`, `failed`, `pending`, `stable`, `suspended`, `updating`, `waiting`. +- `network_attachment` - (String) The id of the network attachment. +- `port_speed` - (Integer) The port speed for this instance network attachment in Mbps. +- `primary_ip` - (List) The primary IP address of the virtual network interface for the instance networkattachment. + Nested schema for **primary_ip**: + - `address` - (String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this reserved IP. + - `id` - (String) The unique identifier for this reserved IP. + - `name` - (String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. +- `resource_type` - (String) The resource type. +- `subnet` - (List) The subnet of the virtual network interface for the instance network attachment. + Nested schema for **subnet**: + - `crn` - (String) The CRN for this subnet. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this subnet. + - `id` - (String) The unique identifier for this subnet. + - `name` - (String) The name for this subnet. The name is unique across all subnets in the VPC. + - `resource_type` - (String) The resource type. +- `type` - (String) The instance network attachment type. + + +## Import + +You can import the `ibm_is_instance_network_attachment` resource by using `id`. +The `id` property can be formed from `instance`, and `id` in the following format: + +``` +/ +``` +- `instance`: A string. The virtual server instance identifier. +- `id`: A string. The instance network attachment identifier. + +# Syntax +``` +$ terraform import ibm_is_instance_network_attachment.is_instance_network_attachment / +``` From 7b844895443ffaa2f59f2334912d4160f4a2c89d Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Wed, 25 Oct 2023 23:15:17 +0530 Subject: [PATCH 036/132] Vni phase 2 shares enhancement (#283) * vni crud changes * sdk update * beta sdk updates * Removed share target resources and datasources following deprecation * ips validation * share inline ips schema * read update * bm sdk fix * build error fix * vni id enhancement * removed beta * minor data source additions * replica doc update * test update * dummy * updated mount target and shares * updates to schema * added development maturity * added development maturity * sdk update * Revert "sdk update" This reverts commit b50f59ec7f0eabc69e55b22f6ba2da478655b38a. * ga * vni auto delete patch * fixed review comments * test updates * doc updates * added notes --------- Co-authored-by: Ujjwal Kumar --- .../data_source_ibm_is_share_mount_target.go | 102 +++++++++++ .../data_source_ibm_is_share_mount_targets.go | 52 ++++++ ibm/service/vpc/resource_ibm_is_share.go | 79 ++++++-- .../vpc/resource_ibm_is_share_mount_target.go | 172 ++++++++++++++---- ...resource_ibm_is_share_mount_target_test.go | 62 +++++++ ibm/service/vpc/resource_ibm_is_share_test.go | 61 +++++++ .../d/is_share_mount_target.html.markdown | 22 +++ .../d/is_share_mount_targets.html.markdown | 22 +++ website/docs/r/is_share.html.markdown | 41 +++++ .../r/is_share_mount_target.html.markdown | 38 +++- 10 files changed, 596 insertions(+), 55 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 f1da5dd2bf..577f223188 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 @@ -80,6 +80,54 @@ func DataSourceIBMIsShareTarget() *schema.Resource { Computed: true, Description: "The type of resource referenced.", }, + "primary_ip": { + Type: schema.TypeList, + Computed: true, + Description: "The primary IP address of the virtual network interface for the share mount target.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": { + Type: schema.TypeString, + Computed: true, + Description: "The IP address..", + }, + "deleted": { + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": { + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "The user-defined name for this reserved IP.", + }, + "resource_type": { + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, "subnet": { Type: schema.TypeList, Computed: true, @@ -311,6 +359,13 @@ func dataSourceIBMIsShareTargetRead(context context.Context, d *schema.ResourceD } } + if shareTarget.PrimaryIP != nil { + err = d.Set("primary_ip", dataSourceShareMountTargetFlattenPrimaryIP(*shareTarget.PrimaryIP)) + if err != nil { + return diag.FromErr(fmt.Errorf("Error setting vpc %s", err)) + } + } + if shareTarget.VPC != nil { err = d.Set("vpc", dataSourceShareMountTargetFlattenVpc(*shareTarget.VPC)) if err != nil { @@ -382,6 +437,53 @@ func dataSourceShareMountTargetVpcDeletedToMap(deletedItem vpcv1.VPCReferenceDel return deletedMap } +func dataSourceShareMountTargetFlattenPrimaryIP(result vpcv1.ReservedIPReference) (finalList []map[string]interface{}) { + finalList = []map[string]interface{}{} + finalMap := dataSourceShareTargetPrimaryIPToMap(result) + finalList = append(finalList, finalMap) + + return finalList +} + +func dataSourceShareTargetPrimaryIPToMap(primaryIPItem vpcv1.ReservedIPReference) (primaryIPMap map[string]interface{}) { + primaryIPMap = map[string]interface{}{} + + if primaryIPItem.Address != nil { + primaryIPMap["address"] = primaryIPItem.Address + } + if primaryIPItem.Deleted != nil { + deletedList := []map[string]interface{}{} + deletedMap := dataSourceShareTargetPrimaryIPDeletedToMap(*primaryIPItem.Deleted) + deletedList = append(deletedList, deletedMap) + primaryIPMap["deleted"] = deletedList + } + if primaryIPItem.Href != nil { + primaryIPMap["href"] = primaryIPItem.Href + } + if primaryIPItem.ID != nil { + primaryIPMap["id"] = primaryIPItem.ID + } + if primaryIPItem.Name != nil { + primaryIPMap["name"] = primaryIPItem.Name + } + + if primaryIPItem.ResourceType != nil { + primaryIPMap["resource_type"] = primaryIPItem.ResourceType + } + + return primaryIPMap +} + +func dataSourceShareTargetPrimaryIPDeletedToMap(deletedItem vpcv1.ReservedIPReferenceDeleted) (deletedMap map[string]interface{}) { + deletedMap = map[string]interface{}{} + + if deletedItem.MoreInfo != nil { + deletedMap["more_info"] = deletedItem.MoreInfo + } + + return deletedMap +} + func dataSourceShareMountTargetFlattenSubnet(result vpcv1.SubnetReference) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceShareTargetSubnetToMap(result) 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 44d70ccdd6..6a8645360f 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 @@ -78,6 +78,54 @@ func DataSourceIBMIsShareTargets() *schema.Resource { Computed: true, Description: "The type of resource referenced.", }, + "primary_ip": { + Type: schema.TypeList, + Computed: true, + Description: "The primary IP address of the virtual network interface for the share mount target.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": { + Type: schema.TypeString, + Computed: true, + Description: "The IP address..", + }, + "deleted": { + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": { + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this reserved IP.", + }, + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this reserved IP.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "The user-defined name for this reserved IP.", + }, + "resource_type": { + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, "subnet": { Type: schema.TypeList, Computed: true, @@ -319,6 +367,10 @@ func dataSourceShareMountTargetCollectionTargetsToMap(targetsItem vpcv1.ShareMou targetsMap["transit_encryption"] = *targetsItem.TransitEncryption } + if targetsItem.PrimaryIP != nil { + targetsMap["primary_ip"] = dataSourceShareMountTargetFlattenPrimaryIP(*targetsItem.PrimaryIP) + } + if targetsItem.VPC != nil { targetsMap["vpc"] = dataSourceShareMountTargetFlattenVpc(*targetsItem.VPC) } diff --git a/ibm/service/vpc/resource_ibm_is_share.go b/ibm/service/vpc/resource_ibm_is_share.go index 487479fd42..bd7751b7cf 100644 --- a/ibm/service/vpc/resource_ibm_is_share.go +++ b/ibm/service/vpc/resource_ibm_is_share.go @@ -156,6 +156,7 @@ func ResourceIbmIsShare() *schema.Resource { }, "id": { Type: schema.TypeString, + Optional: true, Computed: true, Description: "ID of this VNI", }, @@ -165,6 +166,22 @@ func ResourceIbmIsShare() *schema.Resource { Computed: true, Description: "Name of this VNI", }, + "allow_ip_spoofing": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "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.", + }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "Indicates whether this virtual network interface will be automatically deleted when`target` is deleted.", + }, + "enable_infrastructure_nat": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", + }, "primary_ip": { Type: schema.TypeList, Optional: true, @@ -231,6 +248,7 @@ func ResourceIbmIsShare() *schema.Resource { "subnet": { Type: schema.TypeString, Optional: true, + Computed: true, Description: "The associated subnet. Required if primary_ip is not specified.", }, }, @@ -389,6 +407,7 @@ func ResourceIbmIsShare() *schema.Resource { }, "id": { Type: schema.TypeString, + Optional: true, Computed: true, Description: "ID of this VNI", }, @@ -398,6 +417,22 @@ func ResourceIbmIsShare() *schema.Resource { Computed: true, Description: "Name of this VNI", }, + "allow_ip_spoofing": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "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.", + }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "Indicates whether this virtual network interface will be automatically deleted when`target` is deleted.", + }, + "enable_infrastructure_nat": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", + }, "primary_ip": { Type: schema.TypeList, Optional: true, @@ -464,6 +499,7 @@ func ResourceIbmIsShare() *schema.Resource { "subnet": { Type: schema.TypeString, Optional: true, + Computed: true, Description: "The associated subnet. Required if primary_ip is not specified.", }, }, @@ -786,9 +822,10 @@ func resourceIbmIsShareCreate(context context.Context, d *schema.ResourceData, m if ok { var targets []vpcv1.ShareMountTargetPrototypeIntf targetsIntf := replicaTargets.([]interface{}) - for _, targetIntf := range targetsIntf { + for tergetIdx, targetIntf := range targetsIntf { target := targetIntf.(map[string]interface{}) - targetsItem, err := resourceIbmIsShareMapToShareMountTargetPrototype(d, target) + autoDeleteSchema := fmt.Sprintf("replica_share.0.mount_targets.%d.virtual_network_interface.0.auto_delete", tergetIdx) + targetsItem, err := resourceIbmIsShareMapToShareMountTargetPrototype(d, target, autoDeleteSchema) if err != nil { return diag.FromErr(err) } @@ -846,9 +883,10 @@ func resourceIbmIsShareCreate(context context.Context, d *schema.ResourceData, m if shareTargetPrototypeIntf, ok := d.GetOk("mount_targets"); ok { var targets []vpcv1.ShareMountTargetPrototypeIntf - for _, e := range shareTargetPrototypeIntf.([]interface{}) { + for targetIdx, e := range shareTargetPrototypeIntf.([]interface{}) { value := e.(map[string]interface{}) - targetsItem, err := resourceIbmIsShareMapToShareMountTargetPrototype(d, value) + autoDeleteSchema := fmt.Sprintf("mount_targets.%d.virtual_network_interface.0.auto_delete", targetIdx) + targetsItem, err := resourceIbmIsShareMapToShareMountTargetPrototype(d, value, autoDeleteSchema) if err != nil { return diag.FromErr(err) } @@ -921,7 +959,7 @@ func resourceIbmIsShareCreate(context context.Context, d *schema.ResourceData, m return resourceIbmIsShareRead(context, d, meta) } -func resourceIbmIsShareMapToShareMountTargetPrototype(d *schema.ResourceData, shareTargetPrototypeMap map[string]interface{}) (vpcv1.ShareMountTargetPrototype, error) { +func resourceIbmIsShareMapToShareMountTargetPrototype(d *schema.ResourceData, shareTargetPrototypeMap map[string]interface{}, autoDeleteSchema string) (vpcv1.ShareMountTargetPrototype, error) { shareTargetPrototype := vpcv1.ShareMountTargetPrototype{} if nameIntf, ok := shareTargetPrototypeMap["name"]; ok && nameIntf != "" { @@ -936,11 +974,20 @@ func resourceIbmIsShareMapToShareMountTargetPrototype(d *schema.ResourceData, sh } else if vniIntf, ok := shareTargetPrototypeMap["virtual_network_interface"]; ok { vniPrototype := vpcv1.ShareMountTargetVirtualNetworkInterfacePrototype{} vniMap := vniIntf.([]interface{})[0].(map[string]interface{}) - vniPrototype, err := ShareMountTargetMapToShareMountTargetPrototype(d, vniMap) - if err != nil { - return shareTargetPrototype, err + + VNIIdIntf, ok := vniMap["id"] + VNIId := VNIIdIntf.(string) + if ok && VNIId != "" { + vniPrototype.ID = &VNIId + shareTargetPrototype.VirtualNetworkInterface = &vniPrototype + } else { + vniPrototype, err := ShareMountTargetMapToShareMountTargetPrototype(d, vniMap, autoDeleteSchema) + if err != nil { + return shareTargetPrototype, err + } + shareTargetPrototype.VirtualNetworkInterface = &vniPrototype } - shareTargetPrototype.VirtualNetworkInterface = &vniPrototype + } if transitEncryptionIntf, ok := shareTargetPrototypeMap["transit_encryption"]; ok && transitEncryptionIntf != "" { transitEncryption := transitEncryptionIntf.(string) @@ -1614,6 +1661,7 @@ func shareUpdate(vpcClient *vpcv1.VpcV1, context context.Context, d *schema.Reso for targetIdx := range target_prototype { targetName := fmt.Sprintf("%s.%d.name", shareMountTargetSchema, targetIdx) vniName := fmt.Sprintf("%s.%d.virtual_network_interface.0.name", shareMountTargetSchema, targetIdx) + vniAutoDelete := fmt.Sprintf("%s.%d.virtual_network_interface.0.auto_delete", shareMountTargetSchema, targetIdx) vniId := fmt.Sprintf("%s.%d.virtual_network_interface.0.id", shareMountTargetSchema, targetIdx) targetId := fmt.Sprintf("%s.%d.id", shareMountTargetSchema, targetIdx) securityGroups := fmt.Sprintf("%s.%d.virtual_network_interface.0.security_groups", shareMountTargetSchema, targetIdx) @@ -1650,10 +1698,15 @@ func shareUpdate(vpcClient *vpcv1.VpcV1, context context.Context, d *schema.Reso } } - if d.HasChange(vniName) { - vniNameStr := d.Get(vniName).(string) - vniPatchModel := &vpcv1.VirtualNetworkInterfacePatch{ - Name: &vniNameStr, + if d.HasChange(vniName) || d.HasChange(vniAutoDelete) { + vniPatchModel := &vpcv1.VirtualNetworkInterfacePatch{} + if d.HasChange(vniName) { + vniNameStr := d.Get(vniName).(string) + vniPatchModel.Name = &vniNameStr + } + if d.HasChange(vniAutoDelete) { + autoDelete := d.Get(vniAutoDelete).(bool) + vniPatchModel.AutoDelete = &autoDelete } vniPatch, err := vniPatchModel.AsPatch() if err != nil { 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 c723dd3338..536e378303 100644 --- a/ibm/service/vpc/resource_ibm_is_share_mount_target.go +++ b/ibm/service/vpc/resource_ibm_is_share_mount_target.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/IBM/go-sdk-core/v5/core" "github.com/IBM/vpc-go-sdk/vpcv1" ) @@ -69,9 +70,11 @@ func ResourceIBMIsShareMountTarget() *schema.Resource { Description: "href of virtual network interface", }, "id": { - Type: schema.TypeString, - Computed: true, - Description: "ID of this VNI", + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{"virtual_network_interface.0.primary_ip", "virtual_network_interface.0.subnet"}, + Computed: true, + Description: "ID of this VNI", }, "crn": { Type: schema.TypeString, @@ -80,9 +83,26 @@ func ResourceIBMIsShareMountTarget() *schema.Resource { }, "name": { Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, Description: "Name of this VNI", }, + "allow_ip_spoofing": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "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.", + }, + "auto_delete": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "Indicates whether this virtual network interface will be automatically deleted when`target` is deleted.", + }, + "enable_infrastructure_nat": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", + }, "primary_ip": { Type: schema.TypeList, MinItems: 0, @@ -161,12 +181,14 @@ func ResourceIBMIsShareMountTarget() *schema.Resource { "subnet": { Type: schema.TypeString, Optional: true, + Computed: true, //ConflictsWith: []string{"virtual_network_interface.0.primary_ip"}, Description: "The associated subnet. Required if primary_ip is not specified.", }, }, }, }, + "vpc": { Type: schema.TypeString, Optional: true, @@ -294,9 +316,16 @@ func resourceIBMIsShareMountTargetCreate(context context.Context, d *schema.Reso } else if vniIntf, ok := d.GetOk("virtual_network_interface"); ok { vniPrototype := vpcv1.ShareMountTargetVirtualNetworkInterfacePrototype{} vniMap := vniIntf.([]interface{})[0].(map[string]interface{}) - vniPrototype, err = ShareMountTargetMapToShareMountTargetPrototype(d, vniMap) - if err != nil { - return diag.FromErr(err) + + VNIIdIntf, ok := vniMap["id"] + VNIId := VNIIdIntf.(string) + if ok && VNIId != "" { + vniPrototype.ID = &VNIId + } else { + vniPrototype, err = ShareMountTargetMapToShareMountTargetPrototype(d, vniMap, "virtual_network_interface.0.auto_delete") + if err != nil { + return diag.FromErr(err) + } } shareMountTargetPrototype.VirtualNetworkInterface = &vniPrototype } @@ -428,10 +457,15 @@ func resourceIBMIsShareMountTargetUpdate(context context.Context, d *schema.Reso hasChange = true } - if d.HasChange("virtual_network_interface.0.name") { - vniName := d.Get("virtual_network_interface.0.name").(string) - vniPatchModel := &vpcv1.VirtualNetworkInterfacePatch{ - Name: &vniName, + if d.HasChange("virtual_network_interface.0.name") || d.HasChange("virtual_network_interface.0.auto_delete") { + vniPatchModel := &vpcv1.VirtualNetworkInterfacePatch{} + if d.HasChange("virtual_network_interface.0.name") { + vniName := d.Get("virtual_network_interface.0.name").(string) + vniPatchModel.Name = &vniName + } + if d.HasChange("virtual_network_interface.0.auto_delete") { + autoDelete := d.Get("virtual_network_interface.0.auto_delete").(bool) + vniPatchModel.AutoDelete = &autoDelete } vniPatch, err := vniPatchModel.AsPatch() if err != nil { @@ -669,6 +703,39 @@ func isWaitForMountTargetDelete(context context.Context, vpcClient *vpcv1.VpcV1, return stateConf.WaitForState() } +func ShareMountTargetVNIReservedIPInterfaceToMap(context context.Context, vpcClient *vpcv1.VpcV1, d *schema.ResourceData, ripRef *vpcv1.ReservedIPReference, subnetId string) (map[string]interface{}, error) { + + currentPrimIp := map[string]interface{}{} + if ripRef.Address != nil { + currentPrimIp["address"] = ripRef.Address + } + if ripRef.Name != nil { + currentPrimIp["name"] = *ripRef.Name + } + if ripRef.ID != nil { + currentPrimIp["reserved_ip"] = *ripRef.ID + } + if ripRef.Href != nil { + currentPrimIp["href"] = *ripRef.Href + } + + if ripRef.ResourceType != nil { + currentPrimIp["resource_type"] = *ripRef.ResourceType + } + + rIpOptions := &vpcv1.GetSubnetReservedIPOptions{ + SubnetID: &subnetId, + ID: ripRef.ID, + } + rIp, response, err := vpcClient.GetSubnetReservedIP(rIpOptions) + if err != nil { + return nil, fmt.Errorf("[ERROR] Error getting network interface reserved ip(%s) from the subnet(%s): %s\n%s", *ripRef.ID, *&subnetId, err, response) + } + currentPrimIp["auto_delete"] = rIp.AutoDelete + + return currentPrimIp, nil +} + func ShareMountTargetVirtualNetworkInterfaceToMap(context context.Context, vpcClient *vpcv1.VpcV1, d *schema.ResourceData, vniId string) ([]map[string]interface{}, error) { vniSlice := make([]map[string]interface{}, 0) @@ -690,39 +757,27 @@ func ShareMountTargetVirtualNetworkInterfaceToMap(context context.Context, vpcCl vniMap["name"] = vni.Name vniMap["href"] = vni.Href - primaryIpList := make([]map[string]interface{}, 0) - currentPrimIp := map[string]interface{}{} - if vni.PrimaryIP != nil { - if vni.PrimaryIP.Address != nil { - currentPrimIp["address"] = vni.PrimaryIP.Address - } - if vni.PrimaryIP.Name != nil { - currentPrimIp["name"] = *vni.PrimaryIP.Name - } - if vni.PrimaryIP.ID != nil { - currentPrimIp["reserved_ip"] = *vni.PrimaryIP.ID - } - if vni.PrimaryIP.Href != nil { - currentPrimIp["href"] = *vni.PrimaryIP.Href - } + if vni.AllowIPSpoofing != nil { + vniMap["allow_ip_spoofing"] = *vni.AllowIPSpoofing + } + if vni.AutoDelete != nil { + vniMap["auto_delete"] = *vni.AutoDelete + } + if vni.EnableInfrastructureNat != nil { + vniMap["enable_infrastructure_nat"] = *vni.EnableInfrastructureNat + } - if vni.PrimaryIP.ResourceType != nil { - currentPrimIp["resource_type"] = *vni.PrimaryIP.ResourceType - } + if vni.PrimaryIP != nil { + primaryIpList := make([]map[string]interface{}, 0) - rIpOptions := &vpcv1.GetSubnetReservedIPOptions{ - SubnetID: vni.Subnet.ID, - ID: vni.PrimaryIP.ID, - } - rIp, response, err := vpcClient.GetSubnetReservedIP(rIpOptions) + currentPrimIp, err := ShareMountTargetVNIReservedIPInterfaceToMap(context, vpcClient, d, vni.PrimaryIP, *vni.Subnet.ID) if err != nil { - return nil, fmt.Errorf("[ERROR] Error getting network interface reserved ip(%s) attached to the virtual instance network interface(%s): %s\n%s", *vni.PrimaryIP.ID, *vni.ID, err, response) + return nil, err } - currentPrimIp["auto_delete"] = rIp.AutoDelete - primaryIpList = append(primaryIpList, currentPrimIp) vniMap["primary_ip"] = primaryIpList } + vniMap["subnet"] = vni.Subnet.ID vniMap["resource_type"] = vni.ResourceType vniMap["resource_group"] = vni.ResourceGroup.ID @@ -737,7 +792,7 @@ func ShareMountTargetVirtualNetworkInterfaceToMap(context context.Context, vpcCl return vniSlice, nil } -func ShareMountTargetMapToShareMountTargetPrototype(d *schema.ResourceData, vniMap map[string]interface{}) (vpcv1.ShareMountTargetVirtualNetworkInterfacePrototype, error) { +func ShareMountTargetMapToShareMountTargetPrototype(d *schema.ResourceData, vniMap map[string]interface{}, autoDeleteSchema string) (vpcv1.ShareMountTargetVirtualNetworkInterfacePrototype, error) { vniPrototype := vpcv1.ShareMountTargetVirtualNetworkInterfacePrototype{} name, _ := vniMap["name"].(string) if name != "" { @@ -771,6 +826,12 @@ func ShareMountTargetMapToShareMountTargetPrototype(d *schema.ResourceData, vniM } vniPrototype.PrimaryIP = primaryIpPrototype } + + if autoDeleteIntf, ok := d.GetOkExists(autoDeleteSchema); ok { + autoDeleteBool := autoDeleteIntf.(bool) + vniPrototype.AutoDelete = &autoDeleteBool + } + if subnet := vniMap["subnet"].(string); subnet != "" { vniPrototype.Subnet = &vpcv1.SubnetIdentity{ ID: &subnet, @@ -895,3 +956,38 @@ func mountTargetRefreshFunc(context context.Context, vpcClient *vpcv1.VpcV1, sha return target, "pending", nil } } +func virtualNetworkInterfaceIPsReservedIPPrototypeMapToModel(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfaceIPPrototypeIntf, error) { + model := &vpcv1.VirtualNetworkInterfaceIPPrototype{} + + reservedIp := modelMap["reserved_ip"].(string) + reservedIpAddress := modelMap["address"].(string) + reservedIpName := modelMap["name"].(string) + reservedIpAutoDelete, autoDeleteOk := modelMap["auto_delete"] + if reservedIp != "" && (reservedIpAddress != "" || reservedIpName != "" || autoDeleteOk) { + return model, fmt.Errorf("[ERROR] Error creating mount target, virtual_network_interface, reserved_ip(%s) is mutually exclusive with other primary_ip attributes", reservedIp) + } + if reservedIp != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } else { + if reservedIpAddress != "" { + model.Address = &reservedIpAddress + } + if reservedIpName != "" { + model.Name = &reservedIpName + } + if autoDeleteOk { + reservedIpAutoDeleteBool := reservedIpAutoDelete.(bool) + model.AutoDelete = &reservedIpAutoDeleteBool + } + } + + return model, nil +} + +func virtualNetworkInterfaceIPsToReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfaceIPPrototypeIntf, error) { + model := &vpcv1.VirtualNetworkInterfaceIPPrototype{} + if modelMap["reserved_ip"] != nil && modelMap["reserved_ip"].(string) != "" { + model.ID = core.StringPtr(modelMap["reserved_ip"].(string)) + } + return model, nil +} 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 3001e5b8e9..fb4a0d6597 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 @@ -176,6 +176,68 @@ func TestAccIbmIsShareMountTargetVNI(t *testing.T) { }) } +func TestAccIbmIsShareMountTargetVNIID(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)) + subnetname := fmt.Sprintf("tfvpngw-subnet-%d", acctest.RandIntRange(10, 100)) + sname := fmt.Sprintf("tf-fs-name-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tf-vni-name-%d", acctest.RandIntRange(10, 100)) + + allowIPSpoofing := true + enableInfrastructureNat := false + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmIsShareMountTargetDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmIsShareMountTargetConfigVNIID(vpcname, sname, targetName, subnetname, vniname, allowIPSpoofing, enableInfrastructureNat), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmIsShareMountTargetExists("ibm_is_share_mount_target.is_share_target", conf), + resource.TestCheckResourceAttr("ibm_is_share_mount_target.is_share_target", "name", targetName), + ), + }, + }, + }) +} + +func testAccCheckIbmIsShareMountTargetConfigVNIID(vpcName, sname, targetName, subnetName, vniName string, enablenat, allowipspoofing bool) string { + return fmt.Sprintf(` + data "ibm_resource_group" "group" { + is_default = "true" + } + resource "ibm_is_share" "is_share" { + 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_virtual_network_interface" "testacc_vni"{ + name = "%s" + subnet = ibm_is_subnet.testacc_subnet.id + enable_infrastructure_nat = %t + allow_ip_spoofing = %t + } + resource "ibm_is_share_mount_target" "is_share_target" { + share = ibm_is_share.is_share.id + virtual_network_interface { + id = ibm_is_virtual_network_interface.testacc_vni.id + } + + name = "%s" + } + `, sname, acc.ShareProfileName, vpcName, subnetName, acc.ISCIDR, vniName, enablenat, allowipspoofing, targetName) +} func testAccCheckIbmIsShareMountTargetConfigVNISubnet(vpcName, sname, targetName, subnetName, vniName string) string { return fmt.Sprintf(` data "ibm_resource_group" "group" { diff --git a/ibm/service/vpc/resource_ibm_is_share_test.go b/ibm/service/vpc/resource_ibm_is_share_test.go index 353e1fe570..56704b4d99 100644 --- a/ibm/service/vpc/resource_ibm_is_share_test.go +++ b/ibm/service/vpc/resource_ibm_is_share_test.go @@ -147,6 +147,67 @@ func TestAccIbmIsShareReplicaInline(t *testing.T) { }) } +func TestAccIbmIsShareVNIID(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: testAccCheckIbmIsShareConfigVNIID(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.TestCheckResourceAttrSet("ibm_is_share.is_share", "mount_targets.0.virtual_network_interface.0.name"), + ), + }, + }, + }) +} + +func testAccCheckIbmIsShareConfigVNIID(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" { + zone = "us-south-1" + size = 220 + name = "%s" + profile = "dp2" + mount_targets { + name = "%s" + virtual_network_interface { + id = ibm_is_virtual_network_interface.testacc_vni.id + } + } + } + `, vpcName, sname, acc.ISCIDR, vniName, shareName, targetName) +} + func testAccCheckIbmIsShareConfigBasic(name string) string { return fmt.Sprintf(` resource "ibm_is_share" "is_share" { diff --git a/website/docs/d/is_share_mount_target.html.markdown b/website/docs/d/is_share_mount_target.html.markdown index b9c4e1a5b4..00cb4fab2f 100644 --- a/website/docs/d/is_share_mount_target.html.markdown +++ b/website/docs/d/is_share_mount_target.html.markdown @@ -62,4 +62,26 @@ The following attributes are exported: - `id` - The unique identifier for this VPC. - `name` - The unique user-defined name for this VPC. - `resource_type` - The resource type. +- `primary_ip` - The primary IP address of the virtual network interface for the share mount target. Nested `primary_ip` blocks have the following structure: + - `address` - The IP address. + - `deleted` - If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: + - `more_info` - Link to documentation about deleted resources. + - `href` - The URL for this reserved IP. + - `id` - The unique identifier for this reserved IP. + - `name` - The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - The resource type. +- `subnet` - The subnet of the virtual network interface for the share mount target. Nested `vpc` blocks have the following structure: + - `crn` - The CRN for this subnet. + - `deleted` - If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: + - `more_info` - Link to documentation about deleted resources. + - `href` - The URL for this subnet. + - `id` - The unique identifier for this subnet. + - `name` - The unique user-defined name for this subnet. + - `resource_type` - The resource type. +- `virtual_network_interface` - The virtual network interface for this file share mount target.. Nested `subnet` blocks have the following structure: + - `crn` - The CRN for this virtual network interface. + - `href` - The URL for this virtual network interface. + - `id` - The unique identifier for this virtual network interface. + - `name` - The unique user-defined name for this virtual network interface. + - `resource_type` - The resource type. diff --git a/website/docs/d/is_share_mount_targets.html.markdown b/website/docs/d/is_share_mount_targets.html.markdown index 830530bae3..2cb13d4b10 100644 --- a/website/docs/d/is_share_mount_targets.html.markdown +++ b/website/docs/d/is_share_mount_targets.html.markdown @@ -56,4 +56,26 @@ The following attributes are exported: - `id` - The unique identifier for this VPC. - `name` - The unique user-defined name for this VPC. - `resource_type` - The resource type. + - `primary_ip` - The primary IP address of the virtual network interface for the share mount target. Nested `primary_ip` blocks have the following structure: + - `address` - The IP address. + - `deleted` - If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: + - `more_info` - Link to documentation about deleted resources. + - `href` - The URL for this reserved IP. + - `id` - The unique identifier for this reserved IP. + - `name` - The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - The resource type. + - `subnet` - The subnet of the virtual network interface for the share mount target. Nested `vpc` blocks have the following structure: + - `crn` - The CRN for this subnet. + - `deleted` - If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: + - `more_info` - Link to documentation about deleted resources. + - `href` - The URL for this subnet. + - `id` - The unique identifier for this subnet. + - `name` - The unique user-defined name for this subnet. + - `resource_type` - The resource type. + - `virtual_network_interface` - The virtual network interface for this file share mount target.. Nested `subnet` blocks have the following structure: + - `crn` - The CRN for this virtual network interface. + - `href` - The URL for this virtual network interface. + - `id` - The unique identifier for this virtual network interface. + - `name` - The unique user-defined name for this virtual network interface. + - `resource_type` - The resource type. diff --git a/website/docs/r/is_share.html.markdown b/website/docs/r/is_share.html.markdown index ffaa72f235..187a4f1011 100644 --- a/website/docs/r/is_share.html.markdown +++ b/website/docs/r/is_share.html.markdown @@ -51,6 +51,33 @@ resource "ibm_is_share" "example-2" { } } ``` +## Example Usage (Create a file share with inline mount target with a VNI) + +```terraform +resource "ibm_is_subnet" "example" { + name = "my-subnet" + vpc = ibm_is_vpc.vpc2.id + zone = "br-sao-2" + total_ipv4_address_count = 16 +} +resource "ibm_is_virtual_network_interface" "example" { + name = "my-example-vni" + subnet = ibm_is_subnet.example.id +} +resource "ibm_is_share" "example-3" { + zone = "us-south-1" + size = 220 + name = "my-share-1" + profile = "dp2" + mount_targets { + name = "my-mount-target" + virtual_network_interface { + id = ibm_is_virtual_network_interface.example.id + } + } +} +``` + ## Argument Reference The following arguments are supported: @@ -70,6 +97,13 @@ The following arguments are supported: Nested scheme for `virtual_network_interface`: - `name` - (Required, String) Name for this virtual network interface. + - `id` - (Optional) The ID for virtual network interface. Mutually exclusive with other `virtual_network_interface` arguments. + + ~> **Note** + `id` is mutually exclusive with other `virtual_network_interface` prototype arguments + - `allow_ip_spoofing` - (Optional, Bool) 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. + - `auto_delete` - (Optional, Bool) Indicates whether this virtual network interface will be automatically deleted when target is deleted + - `enable_infrastructure_nat` - (Optional, Bool) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`. - `primary_ip` - (Optional, List) 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. Nested scheme for `primary_ip`: @@ -106,6 +140,13 @@ The following arguments are supported: - `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`. Nested scheme for `virtual_network_interface`: - `name` - (Required, String) Name for this virtual network interface. + - `id` - (Optional) The ID for virtual network interface. Mutually exclusive with other `virtual_network_interface` arguments. + + ~> **Note** + `id` is mutually exclusive with other `virtual_network_interface` prototype arguments + - `allow_ip_spoofing` - (Optional, Bool) 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. + - `auto_delete` - (Optional, Bool) Indicates whether this virtual network interface will be automatically deleted when target is deleted + - `enable_infrastructure_nat` - (Optional, Bool) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`. - `primary_ip` - (Optional, List) 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. Nested scheme for `primary_ip`: - `auto_delete` - (Optional, Bool) Indicates whether this reserved IP member will be automatically deleted when either target is deleted, or the reserved IP is unbound. Defaults to `true` diff --git a/website/docs/r/is_share_mount_target.html.markdown b/website/docs/r/is_share_mount_target.html.markdown index 2d432673d9..6fa787e197 100644 --- a/website/docs/r/is_share_mount_target.html.markdown +++ b/website/docs/r/is_share_mount_target.html.markdown @@ -90,6 +90,25 @@ resource "ibm_is_share_mount_target" "mtarget1" { } name = "my-example-mount-target" } + +//Create mount target with VNI ID +resource "ibm_is_subnet" "example" { + name = "my-subnet" + vpc = ibm_is_vpc.vpc2.id + zone = "br-sao-2" + total_ipv4_address_count = 16 +} +resource "ibm_is_virtual_network_interface" "example" { + name = "my-example-vni" + subnet = ibm_is_subnet.example.id +} +resource "ibm_is_share_mount_target" "mtarget1" { + share = ibm_is_share.share.id + virtual_network_interface { + id = ibm_is_virtual_network_interface.example.id + } + name = "my-example-mount-target" +} ``` ## Argument Reference @@ -99,19 +118,28 @@ The following arguments are supported: - `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. Nested scheme for `virtual_network_interface`: + - `id` - (Optional) The ID for virtual network interface. Mutually exclusive with other `virtual_network_interface` arguments. + + ~> **Note** + `id` is mutually exclusive with other `virtual_network_interface` prototype arguments - `primary_ip` - (Optional, List) 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. Nested scheme for `primary_ip`: + - `auto_delete` - (Optional, Bool) Indicates whether this reserved IP member will be automatically deleted when either target is deleted, or the reserved IP is unbound. Defaults to `true` - `address` - (Optional, Forces new resource, String) The IP address to reserve. If unspecified, an available address on the subnet will automatically be selected. + - `name`- (Optional, String) 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. - - `reserved_ip`- (Optional, String) The unique identifier for this reserved IP + - `reserved_ip`- (Optional, String) The unique identifier for this reserved IP. + + ~> **Note** + Within `primary_ip`, `reserved_ip` is mutually exclusive to `auto_delete`, `address` and `name` + - `resource_group` - (Optional, String) The ID of the resource group to use. - `security_groups`- (Optional, List of string) The security groups to use for this virtual network interface. - `subnet` - (Optional, string) The associated subnet. - ~> **Note** - Within `primary_ip`, `reserved_ip` is mutually exclusive to `auto_delete`, `address` and `name` + - `vpc` - (Optional, string) The VPC in which instances can mount the file share using this share target. Required if the share's `access_control_mode` is vpc. ~> **Note** @@ -126,7 +154,9 @@ The following arguments are supported: The following attributes are exported: - +- `allow_ip_spoofing` - (Bool) 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. + - `auto_delete` - (Bool) Indicates whether this virtual network interface will be automatically deleted when target is deleted + - `enable_infrastructure_nat` - (Bool) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`. - `mount_target` - The unique identifier of the share target - `created_at` - The date and time that the share target was created. - `href` - The URL for this share target. From fdc346afe9bd5506e67f69d217670a3bc7711c3e Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar <78945437+ujjwal-ibm@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:06:31 +0530 Subject: [PATCH 037/132] added target reference, doc fix and tests for vni (#305) * added target reference, doc fix and tests * removed default auto delete from instance network attachment * doc fix and changed list to set for ips * removed spaces and added tab --- ...ource_ibm_is_security_group_target_test.go | 160 +++++++++ ...urce_ibm_is_security_group_targets_test.go | 74 ++++- .../data_source_ibm_is_subnet_reserved_ip.go | 96 +++--- ...a_source_ibm_is_subnet_reserved_ip_test.go | 75 ++++- .../data_source_ibm_is_subnet_reserved_ips.go | 310 +++++++++++++++--- ibm/service/vpc/resource_ibm_is_instance.go | 8 +- ...urce_ibm_is_instance_network_attachment.go | 9 +- .../d/is_subnet_reserved_ip.html.markdown | 12 + .../d/is_subnet_reserved_ips.html.markdown | 13 +- ...etwork_interface_floating_ip.html.markdown | 4 +- ...virtual_network_interface_ip.html.markdown | 4 +- 11 files changed, 674 insertions(+), 91 deletions(-) create mode 100644 ibm/service/vpc/data_source_ibm_is_security_group_target_test.go diff --git a/ibm/service/vpc/data_source_ibm_is_security_group_target_test.go b/ibm/service/vpc/data_source_ibm_is_security_group_target_test.go new file mode 100644 index 0000000000..5d63eb31a5 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_security_group_target_test.go @@ -0,0 +1,160 @@ +// Copyright IBM Corp. 2017, 2021 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + + "github.com/IBM/vpc-go-sdk/vpcv1" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" +) + +func TestAccIBMISSecurityGroupTargetDataSource_vni(t *testing.T) { + var securityGroup string + terraformTag := "data.ibm_is_security_group_target.testacc_security_group_target" + vpcname := fmt.Sprintf("tfsg-vpc-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfsg-subnet-%d", acctest.RandIntRange(10, 100)) + lbname := fmt.Sprintf("tfsg-lb-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tfsg-one-%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMISSecurityGroupDataSourceTargetDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISsecurityGroupTargetDataSourceVniConfig(vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, lbname, name), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMISSecurityGroupDataSourceTargetExists("ibm_is_security_group_target.testacc_security_group_target", &securityGroup), + resource.TestCheckResourceAttrSet( + terraformTag, "crn"), + resource.TestCheckResourceAttr( + terraformTag, "resource_type", "virtual_network_interface"), + resource.TestCheckResourceAttrSet( + terraformTag, "target"), + ), + }, + }, + }) +} + +func testAccCheckIBMISSecurityGroupDataSourceTargetDestroy(s *terraform.State) error { + + sess, err := acc.TestAccProvider.Meta().(conns.ClientSession).VpcV1API() + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_is_security_group_target" { + continue + } + parts, err := flex.IdParts(rs.Primary.ID) + if err != nil { + return err + } + securityGroupID := parts[0] + targetID := parts[1] + + deleteSecurityGroupTargetBindingOptions := &vpcv1.DeleteSecurityGroupTargetBindingOptions{ + SecurityGroupID: &securityGroupID, + ID: &targetID, + } + + response, err := sess.DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptions) + if err == nil { + return fmt.Errorf("Security Group Targets still exists: %v", response) + } + } + return nil +} + +func testAccCheckIBMISSecurityGroupDataSourceTargetExists(n string, securityGroupID *string) resource.TestCheckFunc { + + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + if rs.Primary.ID == "" { + return fmt.Errorf("[ERROR] No Security Group Target ID is set") + } + + sess, err := acc.TestAccProvider.Meta().(conns.ClientSession).VpcV1API() + if err != nil { + return err + } + + parts, err := flex.IdParts(rs.Primary.ID) + if err != nil { + return err + } + securityGroupId := parts[0] + targetID := parts[1] + + getSecurityGroupTargetOptions := &vpcv1.GetSecurityGroupTargetOptions{ + SecurityGroupID: &securityGroupId, + ID: &targetID, + } + + _, response, err := sess.GetSecurityGroupTarget(getSecurityGroupTargetOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + *securityGroupID = "" + return nil + } + return fmt.Errorf("[ERROR] Error getting Security Group Target : %s\n%s", err, response) + } + + *securityGroupID = fmt.Sprintf("%s/%s", securityGroupId, targetID) + return nil + } +} +func testAccCheckIBMISsecurityGroupTargetDataSourceVniConfig(vpcname, subnetname, zoneName, cidr, vniname, name string) string { + return fmt.Sprintf(` + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + ipv4_cidr_block = "%s" + } + + resource "ibm_is_security_group" "testacc_security_group_one" { + name = "%s" + vpc = "${ibm_is_vpc.testacc_vpc.id}" + } + + resource "ibm_is_virtual_network_interface" "testacc_vni"{ + name = "%s" + allow_ip_spoofing = false + enable_infrastructure_nat = true + primary_ip { + auto_delete = false + address = cidrhost(cidrsubnet(ibm_is_subnet.testacc_subnet.ipv4_cidr_block, 4, 6), 0) + } + subnet = ibm_is_subnet.testacc_subnet.id + } + + resource "ibm_is_security_group_target" "testacc_security_group_target" { + security_group = ibm_is_security_group.testacc_security_group_one.id + target = ibm_is_virtual_network_interface.testacc_vni.id + } + + data "ibm_is_security_group_target" "testacc_security_group_target" { + security_group = ibm_is_security_group_target.testacc_security_group_target.security_group + name = ibm_is_security_group_target.testacc_security_group_target.name + } + + `, vpcname, subnetname, zoneName, cidr, name, vniname) +} diff --git a/ibm/service/vpc/data_source_ibm_is_security_group_targets_test.go b/ibm/service/vpc/data_source_ibm_is_security_group_targets_test.go index 693e5e9bae..c55e429aec 100644 --- a/ibm/service/vpc/data_source_ibm_is_security_group_targets_test.go +++ b/ibm/service/vpc/data_source_ibm_is_security_group_targets_test.go @@ -43,6 +43,35 @@ func TestAccIBMISSecurityGroupTargets_basic(t *testing.T) { }, }) } +func TestAccIBMISSecurityGroupTargets_vni(t *testing.T) { + var securityGroup string + terraformTag := "data.ibm_is_security_group_targets.testacc_security_group_targets" + + vpcname := fmt.Sprintf("tfsg-vpc-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfsg-subnet-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tfsg-vni-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tfsg-one-%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMISSecurityGroupTargetsDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISsecurityGroupTargetsVniConfig(vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, vniname, name), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMISSecurityGroupTargetsExists("ibm_is_security_group_target.testacc_security_group_target", &securityGroup), + resource.TestCheckResourceAttrSet( + terraformTag, "targets.0.crn"), + resource.TestCheckResourceAttr( + terraformTag, "targets.0.resource_type", "virtual_network_interface"), + resource.TestCheckResourceAttrSet( + terraformTag, "targets.0.target"), + ), + }, + }, + }) +} func testAccCheckIBMISSecurityGroupTargetsDestroy(s *terraform.State) error { @@ -141,12 +170,53 @@ func testAccCheckIBMISsecurityGroupTargetsConfig(vpcname, subnetname, zoneName, resource "ibm_is_security_group_target" "testacc_security_group_target" { security_group = ibm_is_security_group.testacc_security_group_one.id - target = ibm_is_lb.testacc_LB.id + target = ibm_is_lb.testacc_LB.id } data "ibm_is_security_group_targets" "testacc_security_group_targets" { - security_group = ibm_is_security_group.testacc_security_group_one.id + security_group = ibm_is_security_group_target.testacc_security_group_target.security_group } `, vpcname, subnetname, zoneName, cidr, name, lbname) } + +func testAccCheckIBMISsecurityGroupTargetsVniConfig(vpcname, subnetname, zoneName, cidr, vniname, name string) string { + return fmt.Sprintf(` + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + ipv4_cidr_block = "%s" + } + + resource "ibm_is_security_group" "testacc_security_group_one" { + name = "%s" + vpc = "${ibm_is_vpc.testacc_vpc.id}" + } + + resource "ibm_is_virtual_network_interface" "testacc_vni"{ + name = "%s" + allow_ip_spoofing = false + enable_infrastructure_nat = true + primary_ip { + auto_delete = false + address = cidrhost(cidrsubnet(ibm_is_subnet.testacc_subnet.ipv4_cidr_block, 4, 6), 0) + } + subnet = ibm_is_subnet.testacc_subnet.id + } + + resource "ibm_is_security_group_target" "testacc_security_group_target" { + security_group = ibm_is_security_group.testacc_security_group_one.id + target = ibm_is_virtual_network_interface.testacc_vni.id + } + + data "ibm_is_security_group_targets" "testacc_security_group_targets" { + security_group = ibm_is_security_group_target.testacc_security_group_target.security_group + } + + `, vpcname, subnetname, zoneName, cidr, name, vniname) +} diff --git a/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ip.go b/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ip.go index aac3fc75cc..3c87e9d3bf 100644 --- a/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ip.go +++ b/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ip.go @@ -5,9 +5,7 @@ package vpc import ( "fmt" - "reflect" - "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -104,6 +102,54 @@ func DataSourceIBMISReservedIP() *schema.Resource { Computed: true, Description: "The crn for target.", }, + "target_reference": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The target this reserved IP is bound to.If absent, this reserved IP is provider-owned or unbound.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this endpoint gateway.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this endpoint gateway.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this endpoint gateway.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, }, } } @@ -137,44 +183,18 @@ func dataSdataSourceIBMISReservedIPRead(d *schema.ResourceData, meta interface{} d.Set(isReservedIPLifecycleState, *reserveIP.LifecycleState) } d.Set(isReservedIPType, *reserveIP.ResourceType) + target := []map[string]interface{}{} if reserveIP.Target != nil { - targetIntf := reserveIP.Target - switch reflect.TypeOf(targetIntf).String() { - case "*vpcv1.ReservedIPTargetEndpointGatewayReference": - { - target := targetIntf.(*vpcv1.ReservedIPTargetEndpointGatewayReference) - d.Set(isReservedIPTargetCrn, target.CRN) - d.Set(isReservedIPTarget, target.ID) - } - case "*vpcv1.ReservedIPTargetNetworkInterfaceReferenceTargetContext": - { - target := targetIntf.(*vpcv1.ReservedIPTargetNetworkInterfaceReferenceTargetContext) - d.Set(isReservedIPTarget, target.ID) - } - case "*vpcv1.ReservedIPTargetLoadBalancerReference": - { - target := targetIntf.(*vpcv1.ReservedIPTargetLoadBalancerReference) - d.Set(isReservedIPTargetCrn, target.CRN) - d.Set(isReservedIPTarget, target.ID) - } - case "*vpcv1.ReservedIPTargetVPNGatewayReference": - { - target := targetIntf.(*vpcv1.ReservedIPTargetVPNGatewayReference) - d.Set(isReservedIPTargetCrn, target.CRN) - d.Set(isReservedIPTarget, target.ID) - } - case "*vpcv1.ReservedIPTarget": - { - target := targetIntf.(*vpcv1.ReservedIPTarget) - d.Set(isReservedIPTargetCrn, target.CRN) - d.Set(isReservedIPTarget, target.ID) - } - case "*vpcv1.ReservedIPTargetGenericResourceReference": - { - target := targetIntf.(*vpcv1.ReservedIPTargetGenericResourceReference) - d.Set(isReservedIPTargetCrn, target.CRN) - } + modelMap, err := dataSourceIBMIsReservedIPReservedIPTargetToMap(reserveIP.Target) + if err != nil { + return err } + target = append(target, modelMap) + } + d.Set("target_reference", target) + if len(target) > 0 { + d.Set(isReservedIPTarget, target[0]["id"]) + d.Set(isReservedIPTargetCrn, target[0]["crn"]) } return nil // By default there should be no error } diff --git a/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ip_test.go b/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ip_test.go index 384267613f..7ec18f8d23 100644 --- a/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ip_test.go +++ b/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ip_test.go @@ -48,10 +48,45 @@ func TestAccIBMISSubnetReservedIP_targetCrn(t *testing.T) { terraformTag, "target_crn"), resource.TestCheckResourceAttrSet( terraformTag, "target"), + ), + }, + }, + }) +} +func TestAccIBMISSubnetReservedIP_targetVni(t *testing.T) { + vpcName := fmt.Sprintf("tfresip-vpc-%d", acctest.RandIntRange(10, 100)) + subnetName := fmt.Sprintf("tfresip-subnet-%d", acctest.RandIntRange(10, 100)) + resIPName := fmt.Sprintf("tfresip-reservedip-%d", acctest.RandIntRange(10, 100)) + vni := fmt.Sprintf("tfresip-vni-%d", acctest.RandIntRange(10, 100)) + terraformTag := "data.ibm_is_subnet_reserved_ip.data_resip1" + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccIBMISReservedIPdataSoruceTargetVniConfig(vpcName, subnetName, resIPName, vni), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(terraformTag, "name", resIPName), + resource.TestCheckResourceAttrSet( + terraformTag, "target_crn"), + resource.TestCheckResourceAttrSet( + terraformTag, "target"), + resource.TestCheckResourceAttrSet( + terraformTag, "target_reference.#"), + resource.TestCheckResourceAttrSet( + terraformTag, "target_reference.0.href"), + resource.TestCheckResourceAttr( + terraformTag, "target_reference.0.resource_type", "virtual_network_interface"), + resource.TestCheckResourceAttrSet( + terraformTag, "target_reference.0.name"), + resource.TestCheckResourceAttrSet( + terraformTag, "target_reference.0.id"), + resource.TestCheckResourceAttrSet( + terraformTag, "target_reference.0.crn"), resource.TestCheckResourceAttrSet( - "ibm_is_virtual_endpoint_gateway_ip.example", "target.#"), + "ibm_is_virtual_network_interface.testacc_vni", "id"), resource.TestCheckResourceAttrSet( - "ibm_is_virtual_endpoint_gateway.example", "target.#"), + "ibm_is_virtual_network_interface.testacc_vni", "name"), ), }, }, @@ -126,3 +161,39 @@ func testAccIBMISReservedIPdataSoruceTargetCrnConfig(vpcName, subnetName, reserv `, vpcName, subnetName, reservedIPName, gatewayName) } +func testAccIBMISReservedIPdataSoruceTargetVniConfig(vpcName, subnetName, reservedIPName, vniname string) string { + return fmt.Sprintf(` + resource "ibm_is_vpc" "vpc1" { + name = "%s" + } + + resource "ibm_is_subnet" "subnet1" { + name = "%s" + vpc = ibm_is_vpc.vpc1.id + zone = "%s" + total_ipv4_address_count = 256 + } + resource "ibm_is_virtual_network_interface" "testacc_vni"{ + name = "%s" + allow_ip_spoofing = false + enable_infrastructure_nat = true + primary_ip { + auto_delete = false + address = cidrhost(cidrsubnet(ibm_is_subnet.subnet1.ipv4_cidr_block, 4, 6), 0) + } + subnet = ibm_is_subnet.subnet1.id + } + + resource "ibm_is_subnet_reserved_ip" "resip1" { + subnet = ibm_is_subnet.subnet1.id + name = "%s" + target = ibm_is_virtual_network_interface.testacc_vni.id + } + + data "ibm_is_subnet_reserved_ip" "data_resip1" { + subnet = ibm_is_subnet.subnet1.id + reserved_ip = ibm_is_subnet_reserved_ip.resip1.reserved_ip + } + + `, vpcName, subnetName, acc.ISZoneName, vniname, reservedIPName) +} diff --git a/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ips.go b/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ips.go index 5bd8104608..7777bb175d 100644 --- a/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ips.go +++ b/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ips.go @@ -5,7 +5,6 @@ package vpc import ( "fmt" - "reflect" "time" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" @@ -104,6 +103,54 @@ func DataSourceIBMISReservedIPs() *schema.Resource { Computed: true, Description: "The crn for target.", }, + "target_reference": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The target this reserved IP is bound to.If absent, this reserved IP is provider-owned or unbound.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this endpoint gateway.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this endpoint gateway.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this endpoint gateway.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, }, }, }, @@ -158,45 +205,20 @@ func dataSdataSourceIBMISReservedIPsRead(d *schema.ResourceData, meta interface{ ipsOutput[isReservedIPName] = *data.Name ipsOutput[isReservedIPOwner] = *data.Owner ipsOutput[isReservedIPType] = *data.ResourceType + target := []map[string]interface{}{} if data.Target != nil { - targetIntf := data.Target - switch reflect.TypeOf(targetIntf).String() { - case "*vpcv1.ReservedIPTargetEndpointGatewayReference": - { - target := targetIntf.(*vpcv1.ReservedIPTargetEndpointGatewayReference) - ipsOutput[isReservedIPTarget] = target.ID - ipsOutput[isReservedIPTargetCrn] = target.CRN - } - case "*vpcv1.ReservedIPTargetNetworkInterfaceReferenceTargetContext": - { - target := targetIntf.(*vpcv1.ReservedIPTargetNetworkInterfaceReferenceTargetContext) - ipsOutput[isReservedIPTarget] = target.ID - } - case "*vpcv1.ReservedIPTargetGenericResourceReference": - { - target := targetIntf.(*vpcv1.ReservedIPTargetGenericResourceReference) - ipsOutput[isReservedIPTargetCrn] = target.CRN - } - case "*vpcv1.ReservedIPTargetLoadBalancerReference": - { - target := targetIntf.(*vpcv1.ReservedIPTargetLoadBalancerReference) - ipsOutput[isReservedIPTarget] = target.ID - ipsOutput[isReservedIPTargetCrn] = target.CRN - } - case "*vpcv1.ReservedIPTargetVPNGatewayReference": - { - target := targetIntf.(*vpcv1.ReservedIPTargetVPNGatewayReference) - ipsOutput[isReservedIPTarget] = target.ID - ipsOutput[isReservedIPTargetCrn] = target.CRN - } - case "*vpcv1.ReservedIPTarget": - { - target := targetIntf.(*vpcv1.ReservedIPTarget) - ipsOutput[isReservedIPTarget] = target.ID - ipsOutput[isReservedIPTargetCrn] = target.CRN - } + modelMap, err := dataSourceIBMIsReservedIPReservedIPTargetToMap(data.Target) + if err != nil { + return err } + target = append(target, modelMap) } + ipsOutput["target_reference"] = target + if len(target) > 0 { + ipsOutput[isReservedIPTarget] = target[0]["id"] + ipsOutput[isReservedIPTargetCrn] = target[0]["crn"] + } + reservedIPs = append(reservedIPs, ipsOutput) } @@ -206,3 +228,217 @@ func dataSdataSourceIBMISReservedIPsRead(d *schema.ResourceData, meta interface{ d.Set(isSubNetID, subnetID) return nil } + +func dataSourceIBMIsReservedIPReservedIPTargetToMap(model vpcv1.ReservedIPTargetIntf) (map[string]interface{}, error) { + if _, ok := model.(*vpcv1.ReservedIPTargetEndpointGatewayReference); ok { + return dataSourceIBMIsReservedIPReservedIPTargetEndpointGatewayReferenceToMap(model.(*vpcv1.ReservedIPTargetEndpointGatewayReference)) + } else if _, ok := model.(*vpcv1.ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext); ok { + return dataSourceIBMIsReservedIPReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContextToMap(model.(*vpcv1.ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext)) + } else if _, ok := model.(*vpcv1.ReservedIPTargetNetworkInterfaceReferenceTargetContext); ok { + return dataSourceIBMIsReservedIPReservedIPTargetNetworkInterfaceReferenceTargetContextToMap(model.(*vpcv1.ReservedIPTargetNetworkInterfaceReferenceTargetContext)) + } else if _, ok := model.(*vpcv1.ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext); ok { + return dataSourceIBMIsReservedIPReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContextToMap(model.(*vpcv1.ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext)) + } else if _, ok := model.(*vpcv1.ReservedIPTargetLoadBalancerReference); ok { + return dataSourceIBMIsReservedIPReservedIPTargetLoadBalancerReferenceToMap(model.(*vpcv1.ReservedIPTargetLoadBalancerReference)) + } else if _, ok := model.(*vpcv1.ReservedIPTargetVPNGatewayReference); ok { + return dataSourceIBMIsReservedIPReservedIPTargetVPNGatewayReferenceToMap(model.(*vpcv1.ReservedIPTargetVPNGatewayReference)) + } else if _, ok := model.(*vpcv1.ReservedIPTargetVPNServerReference); ok { + return dataSourceIBMIsReservedIPReservedIPTargetVPNServerReferenceToMap(model.(*vpcv1.ReservedIPTargetVPNServerReference)) + } else if _, ok := model.(*vpcv1.ReservedIPTargetGenericResourceReference); ok { + return dataSourceIBMIsReservedIPReservedIPTargetGenericResourceReferenceToMap(model.(*vpcv1.ReservedIPTargetGenericResourceReference)) + } else if _, ok := model.(*vpcv1.ReservedIPTarget); ok { + modelMap := make(map[string]interface{}) + model := model.(*vpcv1.ReservedIPTarget) + if model.CRN != nil { + modelMap["crn"] = model.CRN + } + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsReservedIPEndpointGatewayReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + if model.Href != nil { + modelMap["href"] = model.Href + } + if model.ID != nil { + modelMap["id"] = model.ID + } + if model.Name != nil { + modelMap["name"] = model.Name + } + if model.ResourceType != nil { + modelMap["resource_type"] = model.ResourceType + } + return modelMap, nil + } else { + return nil, fmt.Errorf("Unrecognized vpcv1.ReservedIPTargetIntf subtype encountered") + } +} + +func dataSourceIBMIsReservedIPEndpointGatewayReferenceDeletedToMap(model *vpcv1.EndpointGatewayReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func dataSourceIBMIsReservedIPReservedIPTargetEndpointGatewayReferenceToMap(model *vpcv1.ReservedIPTargetEndpointGatewayReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsReservedIPEndpointGatewayReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsReservedIPReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContextToMap(model *vpcv1.ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsReservedIPReservedIPTargetNetworkInterfaceReferenceTargetContextToMap(model *vpcv1.ReservedIPTargetNetworkInterfaceReferenceTargetContext) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsReservedIPNetworkInterfaceReferenceTargetContextDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsReservedIPNetworkInterfaceReferenceTargetContextDeletedToMap(model *vpcv1.NetworkInterfaceReferenceTargetContextDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func dataSourceIBMIsReservedIPReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContextToMap(model *vpcv1.ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsReservedIPBareMetalServerNetworkInterfaceReferenceTargetContextDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsReservedIPBareMetalServerNetworkInterfaceReferenceTargetContextDeletedToMap(model *vpcv1.BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func dataSourceIBMIsReservedIPReservedIPTargetLoadBalancerReferenceToMap(model *vpcv1.ReservedIPTargetLoadBalancerReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsReservedIPLoadBalancerReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsReservedIPLoadBalancerReferenceDeletedToMap(model *vpcv1.LoadBalancerReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func dataSourceIBMIsReservedIPReservedIPTargetVPNGatewayReferenceToMap(model *vpcv1.ReservedIPTargetVPNGatewayReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsReservedIPVPNGatewayReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsReservedIPVPNGatewayReferenceDeletedToMap(model *vpcv1.VPNGatewayReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func dataSourceIBMIsReservedIPReservedIPTargetVPNServerReferenceToMap(model *vpcv1.ReservedIPTargetVPNServerReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsReservedIPVPNServerReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsReservedIPVPNServerReferenceDeletedToMap(model *vpcv1.VPNServerReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func dataSourceIBMIsReservedIPReservedIPTargetGenericResourceReferenceToMap(model *vpcv1.ReservedIPTargetGenericResourceReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsReservedIPGenericResourceReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsReservedIPGenericResourceReferenceDeletedToMap(model *vpcv1.GenericResourceReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} diff --git a/ibm/service/vpc/resource_ibm_is_instance.go b/ibm/service/vpc/resource_ibm_is_instance.go index a54a22758c..cd573cbfdc 100644 --- a/ibm/service/vpc/resource_ibm_is_instance.go +++ b/ibm/service/vpc/resource_ibm_is_instance.go @@ -587,9 +587,10 @@ func ResourceIBMISInstance() *schema.Resource { Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", }, "ips": &schema.Schema{ - Type: schema.TypeList, + Type: schema.TypeSet, Optional: true, Computed: true, + Set: hashIpsList, Description: "The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -914,9 +915,10 @@ func ResourceIBMISInstance() *schema.Resource { Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", }, "ips": &schema.Schema{ - Type: schema.TypeList, + Type: schema.TypeSet, Optional: true, Computed: true, + Set: hashIpsList, Description: "The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -5414,7 +5416,7 @@ func resourceIBMIsInstanceMapToVirtualNetworkInterfacePrototypeAttachmentContext } if modelMap["ips"] != nil { ips := []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{} - for _, ipsItem := range modelMap["ips"].([]interface{}) { + for _, ipsItem := range modelMap["ips"].(*schema.Set).List() { ipsItemModel, err := resourceIBMIsInstanceMapToVirtualNetworkInterfaceIPsReservedIPPrototype(ipsItem.(map[string]interface{})) if err != nil { return model, err diff --git a/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go b/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go index 992810437a..82f1a7d53b 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go +++ b/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go @@ -104,7 +104,7 @@ func ResourceIBMIsInstanceNetworkAttachment() *schema.Resource { "auto_delete": &schema.Schema{ Type: schema.TypeBool, Optional: true, - Default: true, + Computed: true, ConflictsWith: []string{"virtual_network_interface.0.id"}, Description: "Indicates whether this virtual network interface will be automatically deleted when`target` is deleted.", }, @@ -116,9 +116,10 @@ func ResourceIBMIsInstanceNetworkAttachment() *schema.Resource { Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", }, "ips": &schema.Schema{ - Type: schema.TypeList, + Type: schema.TypeSet, Optional: true, Computed: true, + Set: hashIpsList, ConflictsWith: []string{"virtual_network_interface.0.id"}, Description: "The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.", Elem: &schema.Resource{ @@ -550,7 +551,7 @@ func resourceIBMIsInstanceNetworkAttachmentMapToInstanceNetworkAttachmentPrototy } if modelMap["ips"] != nil { ips := []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{} - for _, ipsItem := range modelMap["ips"].([]interface{}) { + for _, ipsItem := range modelMap["ips"].(*schema.Set).List() { ipsItemModel, err := resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfaceIPPrototype(ipsItem.(map[string]interface{})) if err != nil { return model, err @@ -743,7 +744,7 @@ func resourceIBMIsInstanceNetworkAttachmentMapToInstanceNetworkAttachmentPrototy } if modelMap["ips"] != nil { ips := []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{} - for _, ipsItem := range modelMap["ips"].([]interface{}) { + for _, ipsItem := range modelMap["ips"].(*schema.Set).List() { ipsItemModel, err := resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfaceIPPrototype(ipsItem.(map[string]interface{})) if err != nil { return model, err diff --git a/website/docs/d/is_subnet_reserved_ip.html.markdown b/website/docs/d/is_subnet_reserved_ip.html.markdown index 1287448158..8d3d27dbd6 100644 --- a/website/docs/d/is_subnet_reserved_ip.html.markdown +++ b/website/docs/d/is_subnet_reserved_ip.html.markdown @@ -50,3 +50,15 @@ In addition to all argument reference list, you can access the following attribu - `subnet` - (String) The ID of the subnet for the reserved IP. - `target` - (String) The ID of the target for the reserved IP. - `target_crn` - (String) The crn of the target for the reserved IP. +- `target_reference` - (List) The target this reserved IP is bound to. If absent, this reserved IP is provider-owned or unbound. + + Nested schema for **target_reference**: + - `crn` - (String) The CRN for this endpoint gateway. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this endpoint gateway. + - `id` - (String) The unique identifier for this endpoint gateway. + - `name` - (String) The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + - `resource_type` - (String) The resource type. diff --git a/website/docs/d/is_subnet_reserved_ips.html.markdown b/website/docs/d/is_subnet_reserved_ips.html.markdown index 5df436b48d..4f60192d89 100644 --- a/website/docs/d/is_subnet_reserved_ips.html.markdown +++ b/website/docs/d/is_subnet_reserved_ips.html.markdown @@ -50,5 +50,16 @@ In addition to the argument reference list, you can access the following attribu - `resource_type` - (String) The resource type. - `target` - (String) The ID of the target for the reserved IP. - `target_crn` - (String) The crn of the target for the reserved IP. -- `total_count` - (String) The total number of resources across all pages. + - `target_reference` - (List) The target this reserved IP is bound to. If absent, this reserved IP is provider-owned or unbound. + + Nested schema for **target_reference**: + - `crn` - (String) The CRN for this endpoint gateway. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this endpoint gateway. + - `id` - (String) The unique identifier for this endpoint gateway. + - `name` - (String) The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + - `resource_type` - (String) The resource type. +- `total_count` - (String) The total number of resources across all pages. \ No newline at end of file diff --git a/website/docs/r/is_virtual_network_interface_floating_ip.html.markdown b/website/docs/r/is_virtual_network_interface_floating_ip.html.markdown index 55eae68e72..e278455e7d 100644 --- a/website/docs/r/is_virtual_network_interface_floating_ip.html.markdown +++ b/website/docs/r/is_virtual_network_interface_floating_ip.html.markdown @@ -14,8 +14,8 @@ Create, read, and delete Virtual Network Interface Floating IP with this resourc ```terrform resource "ibm_is_virtual_network_interface_floating_ip" "vni_fip" { - virtual_network_interface = - floating_ip = + virtual_network_interface = ibm_is_virtual_network_interface.example.id + floating_ip = ibm_is_floating_ip.example.id } ``` diff --git a/website/docs/r/is_virtual_network_interface_ip.html.markdown b/website/docs/r/is_virtual_network_interface_ip.html.markdown index 240458e95f..d8de88e0d3 100644 --- a/website/docs/r/is_virtual_network_interface_ip.html.markdown +++ b/website/docs/r/is_virtual_network_interface_ip.html.markdown @@ -14,8 +14,8 @@ Create, update, and delete ReservedIP virtual network instance attachment with t ```hcl resource "ibm_is_virtual_network_interface_ip" "is_reserved_ip_instance" { - reserved_ip = "subnet_id" - virtual_network_interface = "subnet_id" + reserved_ip = ibm_is_subnet_reserved_ip.example.reserved_ip + virtual_network_interface = ibm_is_virtual_network_interface.example.id } ``` From bbe8fd54a82d15ff2699adf73d1be6151c2f3694 Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:27:54 +0530 Subject: [PATCH 038/132] resolved doc conflcts --- .../d/is_share_mount_target.html.markdown | 70 +++++++++--------- .../d/is_share_mount_targets.html.markdown | 71 ++++++++++--------- .../r/is_share_mount_target.html.markdown | 46 +++++++++--- 3 files changed, 110 insertions(+), 77 deletions(-) diff --git a/website/docs/d/is_share_mount_target.html.markdown b/website/docs/d/is_share_mount_target.html.markdown index 2b67534486..00cb4fab2f 100644 --- a/website/docs/d/is_share_mount_target.html.markdown +++ b/website/docs/d/is_share_mount_target.html.markdown @@ -47,39 +47,41 @@ The following arguments are supported: The following attributes are exported: -- `access_control_mode` - (String) The access control mode for the share. -- `created_at` - (String) The date and time that the share target was created. -- `href` - (String) The URL for this share target. -- `lifecycle_state` - (String) The lifecycle state of the mount target. -- `mount_path` - (String) 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.
+- `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. +- `mount_path` - The mount path for the share.The IP addresses used in the mount path are currently within the IBM services IP range, but are expected to change to be within one of the VPC's subnets in the future. - `name` - The user-defined name for this share target. -- `resource_type` - (String) The type of resource referenced. +- `resource_type` - The type of resource referenced. - `transit_encryption` - (String) The transit encryption mode for this share target. -- `vpc` - (List) The VPC to which this share target is allowing to mount the file share. Nested `vpc` blocks have the following structure: - - `crn` - (String) The CRN for this VPC. - - `deleted` - (String) If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: - - `more_info` - (String) Link to documentation about deleted resources. - - `href` - (String) The URL for this VPC. - - `id` - (String) The unique identifier for this VPC. - - `name` - (String) The unique user-defined name for this VPC. - - `resource_type` - (String) The resource type. -- `subnet` - (List) The subnet of the virtual network interface for the share mount target. Nested `subnet` blocks have the following structure: - - `crn` - (String) The CRN for this subnet. - - `deleted` - (String) If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: - - `more_info` - (String) Link to documentation about deleted resources. - - `href` - (String) The URL for this subnet. - - `id` - (String) The unique identifier for this subnet. - - `name` - (String) The unique user-defined name for this subnet. - - `resource_type` - (String) The resource type. -- `virtual_network_interface` - (List) The virtual network interface for this file share mount target.. Nested `virtual_network_interface` blocks have the following structure: - - `crn` - (String) The CRN for this virtual network interface. - - `href` - (String) The URL for this virtual network interface. - - `id` - (String) The unique identifier for this virtual network interface. - - `name` - (String) The unique user-defined name for this virtual network interface. - - `resource_type` - (String) The resource type. +- `vpc` - The VPC to which this share target is allowing to mount the file share. Nested `vpc` blocks have the following structure: + - `crn` - The CRN for this VPC. + - `deleted` - If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: + - `more_info` - Link to documentation about deleted resources. + - `href` - The URL for this VPC. + - `id` - The unique identifier for this VPC. + - `name` - The unique user-defined name for this VPC. + - `resource_type` - The resource type. +- `primary_ip` - The primary IP address of the virtual network interface for the share mount target. Nested `primary_ip` blocks have the following structure: + - `address` - The IP address. + - `deleted` - If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: + - `more_info` - Link to documentation about deleted resources. + - `href` - The URL for this reserved IP. + - `id` - The unique identifier for this reserved IP. + - `name` - The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - The resource type. +- `subnet` - The subnet of the virtual network interface for the share mount target. Nested `vpc` blocks have the following structure: + - `crn` - The CRN for this subnet. + - `deleted` - If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: + - `more_info` - Link to documentation about deleted resources. + - `href` - The URL for this subnet. + - `id` - The unique identifier for this subnet. + - `name` - The unique user-defined name for this subnet. + - `resource_type` - The resource type. +- `virtual_network_interface` - The virtual network interface for this file share mount target.. Nested `subnet` blocks have the following structure: + - `crn` - The CRN for this virtual network interface. + - `href` - The URL for this virtual network interface. + - `id` - The unique identifier for this virtual network interface. + - `name` - The unique user-defined name for this virtual network interface. + - `resource_type` - The resource type. + diff --git a/website/docs/d/is_share_mount_targets.html.markdown b/website/docs/d/is_share_mount_targets.html.markdown index 17d59f25f4..2cb13d4b10 100644 --- a/website/docs/d/is_share_mount_targets.html.markdown +++ b/website/docs/d/is_share_mount_targets.html.markdown @@ -40,41 +40,42 @@ 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_control_mode` - (String) The access control mode for the share. - - `created_at` - (String) The date and time that the share target was created. - - `href` - (String) The URL for this share target. - - `id` - (String) The unique identifier for this share target. - - `lifecycle_state` - (String) The lifecycle state of the mount target. - - `mount_path` - (String) 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.
- - `name` - (String) The user-defined name for this share target. - - `resource_type` - (String) The type of resource referenced. + - `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. + - `lifecycle_state` - The lifecycle state of the mount target. + - `mount_path` - The mount path for the share.The IP addresses used in the mount path are currently within the IBM services IP range, but are expected to change to be within one of the VPC's subnets in the future. + - `name` - The user-defined name for this share target. + - `resource_type` - The type of resource referenced. - `transit_encryption` - (String) The transit encryption mode for this share target. - `vpc` - The VPC to which this share target is allowing to mount the file share. Nested `vpc` blocks have the following structure: - - `crn` - (String) The CRN for this VPC. - - `deleted` - (String) If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: - - `more_info` - (String) Link to documentation about deleted resources. - - `href` - (String) The URL for this VPC. - - `id` - (String) The unique identifier for this VPC. - - `name` - (String) The unique user-defined name for this VPC. - - `resource_type` - (String) The resource type. - - `subnet` - (List) The subnet of the virtual network interface for the share mount target. Nested `subnet` blocks have the following structure: - - `crn` - (String) The CRN for this subnet. - - `deleted` - (String) If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: - - `more_info` - (String) Link to documentation about deleted resources. - - `href` - (String) The URL for this subnet. - - `id` - (String) The unique identifier for this subnet. - - `name` - (String) The unique user-defined name for this subnet. - - `resource_type` - (String) The resource type. - - `virtual_network_interface` - (List) The virtual network interface for this file share mount target.. Nested `virtual_network_interface` blocks have the following structure: - - `crn` - (String) The CRN for this virtual network interface. - - `href` - (String) The URL for this virtual network interface. - - `id` - (String) The unique identifier for this virtual network interface. - - `name` - (String) The unique user-defined name for this virtual network interface. - - `resource_type` - (String) The resource type. + - `crn` - The CRN for this VPC. + - `deleted` - If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: + - `more_info` - Link to documentation about deleted resources. + - `href` - The URL for this VPC. + - `id` - The unique identifier for this VPC. + - `name` - The unique user-defined name for this VPC. + - `resource_type` - The resource type. + - `primary_ip` - The primary IP address of the virtual network interface for the share mount target. Nested `primary_ip` blocks have the following structure: + - `address` - The IP address. + - `deleted` - If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: + - `more_info` - Link to documentation about deleted resources. + - `href` - The URL for this reserved IP. + - `id` - The unique identifier for this reserved IP. + - `name` - The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - The resource type. + - `subnet` - The subnet of the virtual network interface for the share mount target. Nested `vpc` blocks have the following structure: + - `crn` - The CRN for this subnet. + - `deleted` - If present, this property indicates the referenced resource has been deleted and providessome supplementary information. Nested `deleted` blocks have the following structure: + - `more_info` - Link to documentation about deleted resources. + - `href` - The URL for this subnet. + - `id` - The unique identifier for this subnet. + - `name` - The unique user-defined name for this subnet. + - `resource_type` - The resource type. + - `virtual_network_interface` - The virtual network interface for this file share mount target.. Nested `subnet` blocks have the following structure: + - `crn` - The CRN for this virtual network interface. + - `href` - The URL for this virtual network interface. + - `id` - The unique identifier for this virtual network interface. + - `name` - The unique user-defined name for this virtual network interface. + - `resource_type` - The resource type. diff --git a/website/docs/r/is_share_mount_target.html.markdown b/website/docs/r/is_share_mount_target.html.markdown index 15039a137a..4be05cc820 100644 --- a/website/docs/r/is_share_mount_target.html.markdown +++ b/website/docs/r/is_share_mount_target.html.markdown @@ -90,6 +90,25 @@ resource "ibm_is_share_mount_target" "mtarget1" { } name = "my-example-mount-target" } + +//Create mount target with VNI ID +resource "ibm_is_subnet" "example" { + name = "my-subnet" + vpc = ibm_is_vpc.vpc2.id + zone = "br-sao-2" + total_ipv4_address_count = 16 +} +resource "ibm_is_virtual_network_interface" "example" { + name = "my-example-vni" + subnet = ibm_is_subnet.example.id +} +resource "ibm_is_share_mount_target" "mtarget1" { + share = ibm_is_share.share.id + virtual_network_interface { + id = ibm_is_virtual_network_interface.example.id + } + name = "my-example-mount-target" +} ``` ## Argument Reference @@ -99,19 +118,28 @@ The following arguments are supported: - `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. Nested scheme for `virtual_network_interface`: + - `id` - (Optional) The ID for virtual network interface. Mutually exclusive with other `virtual_network_interface` arguments. + + ~> **Note** + `id` is mutually exclusive with other `virtual_network_interface` prototype arguments - `primary_ip` - (Optional, List) 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. Nested scheme for `primary_ip`: + - `auto_delete` - (Optional, Bool) Indicates whether this reserved IP member will be automatically deleted when either target is deleted, or the reserved IP is unbound. Defaults to `true` - `address` - (Optional, Forces new resource, String) The IP address to reserve. If unspecified, an available address on the subnet will automatically be selected. + - `name`- (Optional, String) 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. - - `reserved_ip`- (Optional, String) The unique identifier for this reserved IP + - `reserved_ip`- (Optional, String) The unique identifier for this reserved IP. + + ~> **Note** + Within `primary_ip`, `reserved_ip` is mutually exclusive to `auto_delete`, `address` and `name` + - `resource_group` - (Optional, String) The ID of the resource group to use. - `security_groups`- (Optional, List of string) The security groups to use for this virtual network interface. - `subnet` - (Optional, string) The associated subnet. - ~> **Note** - Within `primary_ip`, `reserved_ip` is mutually exclusive to `auto_delete`, `address` and `name` + - `vpc` - (Optional, string) The VPC in which instances can mount the file share using this share target. Required if the share's `access_control_mode` is vpc. ~> **Note** @@ -127,11 +155,9 @@ The following arguments are supported: The following attributes are exported: - `access_control_mode` - (String) The access control mode for the share. -- `mount_target` - (String) The unique identifier of the share target -- `created_at` - (String) The date and time that the share target was created. -- `href` - (String) The URL for this share target. -- `id` - (String) The unique identifier of the ShareTarget. The id is composed of \/\ -- `lifecycle_state` - (String) The lifecycle state of the mount target. +- `allow_ip_spoofing` - (Bool) 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. +- `auto_delete` - (Bool) Indicates whether this virtual network interface will be automatically deleted when target is deleted +- `enable_infrastructure_nat` - (Bool) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`. - `mount_path` - (String) 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. @@ -139,6 +165,10 @@ The following attributes are exported: -> **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.
+- `created_at` - (String)The date and time that the share target was created. +- `href` - (String)The URL for this share target. +- `id` - (String)The unique identifier of the ShareTarget. The id is composed of \/\ +- `lifecycle_state` - (String)The lifecycle state of the mount target. - `resource_type` - (String) The type of resource referenced. - `transit_encryption` - (String) The transit encryption mode for this share target. From bf3909f1a1aaa07eb7e6cfd2870c368402548c51 Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Mon, 30 Oct 2023 16:46:19 +0530 Subject: [PATCH 039/132] remove vpc beta sdk reference (#309) --- .../data_source_ibm_is_virtual_network_interface.go | 4 ++-- .../data_source_ibm_is_virtual_network_interfaces.go | 12 ------------ .../vpc/resource_ibm_is_security_group_target.go | 9 ++++----- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go index 90a33405aa..293f2ab5ef 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go @@ -404,7 +404,7 @@ func DataSourceIBMIsVirtualNetworkInterface() *schema.Resource { } func dataSourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - vpcbetaClient, err := meta.(conns.ClientSession).VpcV1API() + vpcClient, err := meta.(conns.ClientSession).VpcV1API() if err != nil { return diag.FromErr(err) } @@ -413,7 +413,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *sche getVirtualNetworkInterfaceOptions.SetID(d.Get("virtual_network_interface").(string)) - virtualNetworkInterface, response, err := vpcbetaClient.GetVirtualNetworkInterfaceWithContext(context, getVirtualNetworkInterfaceOptions) + virtualNetworkInterface, response, err := vpcClient.GetVirtualNetworkInterfaceWithContext(context, getVirtualNetworkInterfaceOptions) if err != nil { log.Printf("[DEBUG] GetVirtualNetworkInterfaceWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterfaceWithContext failed %s\n%s", err, response)) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go index 1836a4af03..9c372095d4 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go @@ -443,18 +443,6 @@ func dataSourceIBMIsVirtualNetworkInterfacesRead(context context.Context, d *sch return diag.FromErr(fmt.Errorf("VirtualNetworkInterfacesPager.GetAll() failed %s", err)) } - // var pager *vpcv1.VirtualNetworkInterfacesPager - // pager, err = vpcbetaClient.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptions) - // if err != nil { - // return diag.FromErr(err) - // } - - // allItems, err := pager.GetAll() - // if err != nil { - // log.Printf("[DEBUG] VirtualNetworkInterfacesPager.GetAll() failed %s", err) - // return diag.FromErr(fmt.Errorf("VirtualNetworkInterfacesPager.GetAll() failed %s", err)) - // } - d.SetId(dataSourceIBMIsVirtualNetworkInterfacesID(d)) mapSlice := []map[string]interface{}{} diff --git a/ibm/service/vpc/resource_ibm_is_security_group_target.go b/ibm/service/vpc/resource_ibm_is_security_group_target.go index 857ebccbf9..43f6a5754c 100644 --- a/ibm/service/vpc/resource_ibm_is_security_group_target.go +++ b/ibm/service/vpc/resource_ibm_is_security_group_target.go @@ -12,7 +12,6 @@ import ( "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" - "github.com/IBM/vpc-beta-go-sdk/vpcbetav1" "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -127,7 +126,7 @@ func resourceIBMISSecurityGroupTargetCreate(d *schema.ResourceData, meta interfa return errsgt } } else if crn != nil && *crn != "" && strings.Contains(*crn, "virtual_network_interfaces") { - vpcClient, err := meta.(conns.ClientSession).VpcV1BetaAPI() + vpcClient, err := meta.(conns.ClientSession).VpcV1API() if err != nil { return err } @@ -338,7 +337,7 @@ func isLBSgTargetRefreshFunc(sess *vpcv1.VpcV1, lbId string) resource.StateRefre } } -func isWaitForVNISgTargetCreateAvailable(sess *vpcbetav1.VpcbetaV1, vniId string, timeout time.Duration) (interface{}, error) { +func isWaitForVNISgTargetCreateAvailable(sess *vpcv1.VpcV1, vniId string, timeout time.Duration) (interface{}, error) { log.Printf("Waiting for virtual network interface (%s) to be available.", vniId) stateConf := &resource.StateChangeConf{ @@ -353,10 +352,10 @@ func isWaitForVNISgTargetCreateAvailable(sess *vpcbetav1.VpcbetaV1, vniId string return stateConf.WaitForState() } -func isVNISgTargetRefreshFunc(vpcClient *vpcbetav1.VpcbetaV1, vniId string) resource.StateRefreshFunc { +func isVNISgTargetRefreshFunc(vpcClient *vpcv1.VpcV1, vniId string) resource.StateRefreshFunc { return func() (interface{}, string, error) { - getVNIOptions := &vpcbetav1.GetVirtualNetworkInterfaceOptions{ + getVNIOptions := &vpcv1.GetVirtualNetworkInterfaceOptions{ ID: &vniId, } vni, response, err := vpcClient.GetVirtualNetworkInterface(getVNIOptions) From 86e1396126ab2d0cf7fa43ecd1a59fdc80976bfd Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar <78945437+ujjwal-ibm@users.noreply.github.com> Date: Tue, 7 Nov 2023 19:23:05 +0530 Subject: [PATCH 040/132] fixed resource group issue on vni (#314) --- ...source_ibm_is_virtual_network_interface.go | 17 ++---- ...e_ibm_is_virtual_network_interface_test.go | 61 +++++++++++++++++++ ...is_virtual_network_interface.html.markdown | 2 +- 3 files changed, 66 insertions(+), 14 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go index 37f30a3bf6..3de73ef8bd 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go @@ -385,12 +385,11 @@ func resourceIBMIsVirtualNetworkInterfaceCreate(context context.Context, d *sche } createVirtualNetworkInterfaceOptions.SetPrimaryIP(primaryIPModel) } - if _, ok := d.GetOk("resource_group"); ok { - resourceGroupModel, err := resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrototypeResourceGroup(d.Get("resource_group.0").(map[string]interface{})) - if err != nil { - return diag.FromErr(err) + if rgOk, ok := d.GetOk("resource_group"); ok { + rg := rgOk.(string) + createVirtualNetworkInterfaceOptions.ResourceGroup = &vpcv1.ResourceGroupIdentity{ + ID: &rg, } - createVirtualNetworkInterfaceOptions.SetResourceGroup(resourceGroupModel) } if _, ok := d.GetOk("security_groups"); ok { var securityGroups []vpcv1.SecurityGroupIdentityIntf @@ -861,14 +860,6 @@ func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPRe return model, nil } -func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrototypeResourceGroup(modelMap map[string]interface{}) (vpcv1.ResourceGroupIdentityIntf, error) { - model := &vpcv1.ResourceGroupIdentity{} - if modelMap["id"] != nil && modelMap["id"].(string) != "" { - model.ID = core.StringPtr(modelMap["id"].(string)) - } - return model, nil -} - func resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcv1.ReservedIPReference, autodelete bool) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["address"] = model.Address diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go index 191ec63b12..780ca1a912 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go @@ -51,6 +51,43 @@ func TestAccIBMIsVirtualNetworkInterfaceBasic(t *testing.T) { }, }) } +func TestAccIBMIsVirtualNetworkInterfaceResourceGroup(t *testing.T) { + var conf vpcv1.VirtualNetworkInterface + vpcname := fmt.Sprintf("tfvpngw-vpc-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfvpngw-subnet-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tfvpngw-createname-%d", acctest.RandIntRange(10, 100)) + enable_infrastructure_nat := true + allow_ip_spoofing := true + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceConfigResourceGroup(vpcname, subnetname, vniname, enable_infrastructure_nat, allow_ip_spoofing), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIsVirtualNetworkInterfaceExists("ibm_is_virtual_network_interface.testacc_vni", conf), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "subnet"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "name"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "created_at"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "crn"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "href"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "vpc.#"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "zone"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "primary_ip.#"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "ips.#"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "id"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "enable_infrastructure_nat", "true"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "lifecycle_state", "stable"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "resource_type", "virtual_network_interface"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "resource_group", acc.IsResourceGroupID), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "resource_group"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "allow_ip_spoofing", "true"), + ), + }, + }, + }) +} func TestAccIBMIsVirtualNetworkInterfaceAllArgs(t *testing.T) { var conf vpcv1.VirtualNetworkInterface @@ -130,6 +167,30 @@ func testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic(vpcname, subnetname, vn `, vpcname, subnetname, acc.ISZoneName, vniname, enablenat, allowipspoofing) } +func testAccCheckIBMIsVirtualNetworkInterfaceConfigResourceGroup(vpcname, subnetname, vniname string, enablenat, allowipspoofing bool) string { + return fmt.Sprintf(` + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + total_ipv4_address_count = 16 + + } + + resource "ibm_is_virtual_network_interface" "testacc_vni"{ + name = "%s" + subnet = ibm_is_subnet.testacc_subnet.id + enable_infrastructure_nat = %t + allow_ip_spoofing = %t + resource_group = "%s" + } + `, vpcname, subnetname, acc.ISZoneName, vniname, enablenat, allowipspoofing, acc.IsResourceGroupID) +} + func testAccCheckIBMIsVirtualNetworkInterfaceConfig(vpcname, subnetname, vniname string, enablenat, allowipspoofing bool) string { return fmt.Sprintf(` resource "ibm_is_vpc" "testacc_vpc" { diff --git a/website/docs/r/is_virtual_network_interface.html.markdown b/website/docs/r/is_virtual_network_interface.html.markdown index e7ed1a65b9..8f4cf388d1 100644 --- a/website/docs/r/is_virtual_network_interface.html.markdown +++ b/website/docs/r/is_virtual_network_interface.html.markdown @@ -45,7 +45,7 @@ You can specify the following arguments for this resource. - `reserved_ip` - (Required, String) The unique identifier for this reserved IP. - `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - `resource_type` - (Computed, String) The resource type. -- `resource_group` - (Optional, List) The resource group id for this virtual network interface. +- `resource_group` - (Optional, String) The resource group id for this virtual network interface. - `security_groups` - (Optional, Array of string) The security group ids list for this virtual network interface. - `subnet` - (Optional, List) The associated subnet id. From 7a79f08776f41ae32e973e8dc904980eaf591d2f Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 6 Nov 2023 11:15:38 +0530 Subject: [PATCH 041/132] resolved nil pointer issue on vpn gateway resource --- ibm/service/vpc/resource_ibm_is_vpn_gateway.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway.go index d2d25a5e20..96a617ff0f 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway.go @@ -566,8 +566,8 @@ func vpngwGet(d *schema.ResourceData, meta interface{}, id string) error { d.Set(flex.ResourceCRN, *vpnGateway.CRN) d.Set(isVPNGatewayCRN, *vpnGateway.CRN) if vpnGateway.ResourceGroup != nil { - d.Set(flex.ResourceGroupName, *vpnGateway.ResourceGroup.Name) - d.Set(isVPNGatewayResourceGroup, *vpnGateway.ResourceGroup.ID) + d.Set(flex.ResourceGroupName, vpnGateway.ResourceGroup.Name) + d.Set(isVPNGatewayResourceGroup, vpnGateway.ResourceGroup.ID) } d.Set(isVPNGatewayMode, *vpnGateway.Mode) if vpnGateway.Members != nil { From eb965c0d3dc8b3bcc761372279f97f03bab7c4b4 Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Tue, 7 Nov 2023 20:07:59 +0530 Subject: [PATCH 042/132] Remove VPC Beta SDK references (#4895) * Removing VPC Beta references from few resources and data sources * example update --- ...source_ibm_is_virtual_network_interface.go | 44 +++++++++---------- ...ource_ibm_is_virtual_network_interfaces.go | 42 +++++++++--------- .../resource_ibm_is_security_group_target.go | 9 ++-- .../r/is_share_mount_target.html.markdown | 20 ++++----- 4 files changed, 58 insertions(+), 57 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go index 8fa399c599..181428db5f 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go @@ -8,7 +8,7 @@ import ( "fmt" "log" - "github.com/IBM/vpc-beta-go-sdk/vpcbetav1" + "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -339,16 +339,16 @@ func DataSourceIBMIsVirtualNetworkInterface() *schema.Resource { } func dataSourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - vpcbetaClient, err := meta.(conns.ClientSession).VpcV1BetaAPI() + vpcClient, err := meta.(conns.ClientSession).VpcV1API() if err != nil { return diag.FromErr(err) } - getVirtualNetworkInterfaceOptions := &vpcbetav1.GetVirtualNetworkInterfaceOptions{} + getVirtualNetworkInterfaceOptions := &vpcv1.GetVirtualNetworkInterfaceOptions{} getVirtualNetworkInterfaceOptions.SetID(d.Get("virtual_network_interface").(string)) - virtualNetworkInterface, response, err := vpcbetaClient.GetVirtualNetworkInterfaceWithContext(context, getVirtualNetworkInterfaceOptions) + virtualNetworkInterface, response, err := vpcClient.GetVirtualNetworkInterfaceWithContext(context, getVirtualNetworkInterfaceOptions) if err != nil { log.Printf("[DEBUG] GetVirtualNetworkInterfaceWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterfaceWithContext failed %s\n%s", err, response)) @@ -473,7 +473,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *sche return nil } -func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcbetav1.ReservedIPReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcv1.ReservedIPReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Address != nil { modelMap["address"] = *model.Address @@ -500,7 +500,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcbe return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model *vpcbetav1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -508,7 +508,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceResourceGroupReferenceToMap(model *vpcbetav1.ResourceGroupReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceResourceGroupReferenceToMap(model *vpcv1.ResourceGroupReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Href != nil { modelMap["href"] = *model.Href @@ -522,7 +522,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceResourceGroupReferenceToMap(model *vp return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceToMap(model *vpcbetav1.SecurityGroupReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceToMap(model *vpcv1.SecurityGroupReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.CRN != nil { modelMap["crn"] = *model.CRN @@ -546,7 +546,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceToMap(model *vp return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceDeletedToMap(model *vpcbetav1.SecurityGroupReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceDeletedToMap(model *vpcv1.SecurityGroupReferenceDeleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -554,7 +554,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceDeletedToMap(mo return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceToMap(model *vpcbetav1.SubnetReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceToMap(model *vpcv1.SubnetReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.CRN != nil { modelMap["crn"] = *model.CRN @@ -581,7 +581,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceToMap(model *vpcbetav1 return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceDeletedToMap(model *vpcbetav1.SubnetReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -589,12 +589,12 @@ func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceDeletedToMap(model *vp return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetToMap(model vpcbetav1.VirtualNetworkInterfaceTargetIntf) (map[string]interface{}, error) { - if _, ok := model.(*vpcbetav1.VirtualNetworkInterfaceTargetShareMountTargetReference); ok { - return dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMountTargetReferenceToMap(model.(*vpcbetav1.VirtualNetworkInterfaceTargetShareMountTargetReference)) - } else if _, ok := model.(*vpcbetav1.VirtualNetworkInterfaceTarget); ok { +func dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetToMap(model vpcv1.VirtualNetworkInterfaceTargetIntf) (map[string]interface{}, error) { + if _, ok := model.(*vpcv1.VirtualNetworkInterfaceTargetShareMountTargetReference); ok { + return dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMountTargetReferenceToMap(model.(*vpcv1.VirtualNetworkInterfaceTargetShareMountTargetReference)) + } else if _, ok := model.(*vpcv1.VirtualNetworkInterfaceTarget); ok { modelMap := make(map[string]interface{}) - model := model.(*vpcbetav1.VirtualNetworkInterfaceTarget) + model := model.(*vpcv1.VirtualNetworkInterfaceTarget) if model.Deleted != nil { deletedMap, err := dataSourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model.Deleted) if err != nil { @@ -616,11 +616,11 @@ func dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetToMap(mo } return modelMap, nil } else { - return nil, fmt.Errorf("Unrecognized vpcbetav1.VirtualNetworkInterfaceTargetIntf subtype encountered") + return nil, fmt.Errorf("Unrecognized vpcv1.VirtualNetworkInterfaceTargetIntf subtype encountered") } } -func dataSourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model *vpcbetav1.ShareMountTargetReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model *vpcv1.ShareMountTargetReferenceDeleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -628,7 +628,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMountTargetReferenceToMap(model *vpcbetav1.VirtualNetworkInterfaceTargetShareMountTargetReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMountTargetReferenceToMap(model *vpcv1.VirtualNetworkInterfaceTargetShareMountTargetReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Deleted != nil { deletedMap, err := dataSourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model.Deleted) @@ -652,7 +652,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetShareMou return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceToMap(model *vpcbetav1.VPCReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceToMap(model *vpcv1.VPCReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.CRN != nil { modelMap["crn"] = *model.CRN @@ -679,7 +679,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceToMap(model *vpcbetav1.VP return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcbetav1.VPCReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcv1.VPCReferenceDeleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -687,7 +687,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcbe return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceZoneReferenceToMap(model *vpcbetav1.ZoneReference) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceZoneReferenceToMap(model *vpcv1.ZoneReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Href != nil { modelMap["href"] = *model.Href diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go index de054c2c45..8705e323cb 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go @@ -9,7 +9,7 @@ import ( "log" "time" - "github.com/IBM/vpc-beta-go-sdk/vpcbetav1" + "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -344,40 +344,42 @@ func DataSourceIBMIsVirtualNetworkInterfaces() *schema.Resource { }, }, }, + "resource_group": { + Type: schema.TypeString, + Optional: true, + Description: "The unique identifier of the resource group these virtual network interfaces belong to", + }, }, } } func dataSourceIBMIsVirtualNetworkInterfacesRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - vpcbetaClient, err := meta.(conns.ClientSession).VpcV1BetaAPI() + vpcClient, err := meta.(conns.ClientSession).VpcV1API() if err != nil { return diag.FromErr(err) } - listVirtualNetworkInterfacesOptions := &vpcbetav1.ListVirtualNetworkInterfacesOptions{} - - vniCollection, response, err := vpcbetaClient.ListVirtualNetworkInterfacesWithContext(context, listVirtualNetworkInterfacesOptions) - //log.Printf(len(vniCollection.VirtualNetworkInterfaces)) + listVirtualNetworkInterfacesOptions := &vpcv1.ListVirtualNetworkInterfacesOptions{} + if resgroupintf, ok := d.GetOk("resource_group"); ok { + resGroup := resgroupintf.(string) + listVirtualNetworkInterfacesOptions.ResourceGroupID = &resGroup + } + var pager *vpcv1.VirtualNetworkInterfacesPager + pager, err = vpcClient.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptions) if err != nil { - log.Printf("[DEBUG] VirtualNetworkInterfacesPager.GetAll() failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("VirtualNetworkInterfacesPager.GetAll() failed %s\n%s", err, response)) + return diag.FromErr(err) } - // var pager *vpcbetav1.VirtualNetworkInterfacesPager - // pager, err = vpcbetaClient.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptions) - // if err != nil { - // return diag.FromErr(err) - // } - // allItems, err := pager.GetAll() - // if err != nil { - // log.Printf("[DEBUG] VirtualNetworkInterfacesPager.GetAll() failed %s", err) - // return diag.FromErr(fmt.Errorf("VirtualNetworkInterfacesPager.GetAll() failed %s", err)) - // } + allItems, err := pager.GetAll() + if err != nil { + log.Printf("[DEBUG] VirtualNetworkInterfacesPager.GetAll() failed %s", err) + return diag.FromErr(fmt.Errorf("VirtualNetworkInterfacesPager.GetAll() failed %s", err)) + } d.SetId(dataSourceIBMIsVirtualNetworkInterfacesID(d)) mapSlice := []map[string]interface{}{} - for _, modelItem := range vniCollection.VirtualNetworkInterfaces { + for _, modelItem := range allItems { modelMap, err := dataSourceIBMIsVirtualNetworkInterfacesVirtualNetworkInterfaceToMap(&modelItem) if err != nil { return diag.FromErr(err) @@ -397,7 +399,7 @@ func dataSourceIBMIsVirtualNetworkInterfacesID(d *schema.ResourceData) string { return time.Now().UTC().String() } -func dataSourceIBMIsVirtualNetworkInterfacesVirtualNetworkInterfaceToMap(model *vpcbetav1.VirtualNetworkInterface) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfacesVirtualNetworkInterfaceToMap(model *vpcv1.VirtualNetworkInterface) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.AutoDelete != nil { modelMap["auto_delete"] = *model.AutoDelete diff --git a/ibm/service/vpc/resource_ibm_is_security_group_target.go b/ibm/service/vpc/resource_ibm_is_security_group_target.go index 857ebccbf9..43f6a5754c 100644 --- a/ibm/service/vpc/resource_ibm_is_security_group_target.go +++ b/ibm/service/vpc/resource_ibm_is_security_group_target.go @@ -12,7 +12,6 @@ import ( "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" - "github.com/IBM/vpc-beta-go-sdk/vpcbetav1" "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -127,7 +126,7 @@ func resourceIBMISSecurityGroupTargetCreate(d *schema.ResourceData, meta interfa return errsgt } } else if crn != nil && *crn != "" && strings.Contains(*crn, "virtual_network_interfaces") { - vpcClient, err := meta.(conns.ClientSession).VpcV1BetaAPI() + vpcClient, err := meta.(conns.ClientSession).VpcV1API() if err != nil { return err } @@ -338,7 +337,7 @@ func isLBSgTargetRefreshFunc(sess *vpcv1.VpcV1, lbId string) resource.StateRefre } } -func isWaitForVNISgTargetCreateAvailable(sess *vpcbetav1.VpcbetaV1, vniId string, timeout time.Duration) (interface{}, error) { +func isWaitForVNISgTargetCreateAvailable(sess *vpcv1.VpcV1, vniId string, timeout time.Duration) (interface{}, error) { log.Printf("Waiting for virtual network interface (%s) to be available.", vniId) stateConf := &resource.StateChangeConf{ @@ -353,10 +352,10 @@ func isWaitForVNISgTargetCreateAvailable(sess *vpcbetav1.VpcbetaV1, vniId string return stateConf.WaitForState() } -func isVNISgTargetRefreshFunc(vpcClient *vpcbetav1.VpcbetaV1, vniId string) resource.StateRefreshFunc { +func isVNISgTargetRefreshFunc(vpcClient *vpcv1.VpcV1, vniId string) resource.StateRefreshFunc { return func() (interface{}, string, error) { - getVNIOptions := &vpcbetav1.GetVirtualNetworkInterfaceOptions{ + getVNIOptions := &vpcv1.GetVirtualNetworkInterfaceOptions{ ID: &vniId, } vni, response, err := vpcClient.GetVirtualNetworkInterface(getVNIOptions) diff --git a/website/docs/r/is_share_mount_target.html.markdown b/website/docs/r/is_share_mount_target.html.markdown index 15039a137a..3bc0c11a3d 100644 --- a/website/docs/r/is_share_mount_target.html.markdown +++ b/website/docs/r/is_share_mount_target.html.markdown @@ -27,39 +27,39 @@ resource "ibm_is_share" "example" { } resource "ibm_is_share_mount_target" "example" { - share = ibm_is_share.is_share.id - vpc = ibm_is_vpc.vpc.id + share = ibm_is_share.example.id + vpc = ibm_is_vpc.example.id name = "my-share-target" }` ``` ``` //Create mount target with virtual network interface that has primary ip name and subnet id -resource "ibm_is_vpc" "example" { +resource "ibm_is_vpc" "example1" { name = "my-vpc" } -resource "ibm_is_share" "example" { +resource "ibm_is_share" "example1" { access_control_mode = "security_group" zone = "br-sao-2" size = 9600 name = "my-example-share1" profile = "dp2" } -resource "ibm_is_subnet" "example" { +resource "ibm_is_subnet" "example1" { # provider = ibm.sao name = "my-subnet" - vpc = ibm_is_vpc.vpc2.id + vpc = ibm_is_vpc.example1.id zone = "br-sao-2" total_ipv4_address_count = 16 } resource "ibm_is_share_mount_target" "example1" { - share = ibm_is_share.example.id + share = ibm_is_share.example1.id virtual_network_interface { primary_ip { name = "my-example-pip" } - subnet = ibm_is_subnet.example.id + subnet = ibm_is_subnet.example1.id name = "my-example-vni" } name = "my-example-mount-target" @@ -80,8 +80,8 @@ resource "ibm_is_subnet_reserved_ip" "example" { subnet = ibm_is_subnet.example.id name = "my-example-resip" } -resource "ibm_is_share_mount_target" "mtarget1" { - share = ibm_is_share.share.id +resource "ibm_is_share_mount_target" "example" { + share = ibm_is_share.example.id virtual_network_interface { primary_ip { reserved_ip = ibm_is_subnet_reserved_ip.example.reserved_ip From 822d08af6cff8d93eeb8840f153765cff77a59e9 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar <78945437+ujjwal-ibm@users.noreply.github.com> Date: Tue, 7 Nov 2023 20:29:31 +0530 Subject: [PATCH 043/132] added tags support for vni resource (#310) --- ...source_ibm_is_virtual_network_interface.go | 30 +++++++ ...e_ibm_is_virtual_network_interface_test.go | 36 ++++++-- ...ource_ibm_is_virtual_network_interfaces.go | 29 ++++++ ...source_ibm_is_virtual_network_interface.go | 88 ++++++++++++++++++- ...e_ibm_is_virtual_network_interface_test.go | 33 ++++++- ...is_virtual_network_interface.html.markdown | 2 + ...s_virtual_network_interfaces.html.markdown | 2 + ...is_virtual_network_interface.html.markdown | 10 +++ 8 files changed, 220 insertions(+), 10 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go index 293f2ab5ef..cfd0945afb 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go @@ -37,6 +37,21 @@ func DataSourceIBMIsVirtualNetworkInterface() *schema.Resource { Computed: true, Description: "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`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", }, + "tags": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: flex.ResourceIBMVPCHash, + Description: "UserTags for the vni instance", + }, + "access_tags": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: flex.ResourceIBMVPCHash, + Description: "Access management tags for the vni instance", + }, + "ips": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -537,6 +552,21 @@ func dataSourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *sche // vni p2 changes + tags, err := flex.GetGlobalTagsUsingCRN(meta, *virtualNetworkInterface.CRN, "", isUserTagType) + if err != nil { + log.Printf( + "Error on get of datasource vni (%s) tags: %s", *virtualNetworkInterface.ID, err) + } + + accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *virtualNetworkInterface.CRN, "", isAccessTagType) + if err != nil { + log.Printf( + "Error on get of datasource vni (%s) access tags: %s", *virtualNetworkInterface.ID, err) + } + + d.Set("tags", tags) + d.Set("access_tags", accesstags) + if err = d.Set("mac_address", virtualNetworkInterface.MacAddress); err != nil { return diag.FromErr(fmt.Errorf("Error setting mac_address: %s", err)) } diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_test.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_test.go index 1c884c9ec7..cb62f06806 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_test.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_test.go @@ -7,19 +7,31 @@ import ( "fmt" "testing" + "github.com/IBM/vpc-go-sdk/vpcv1" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" ) func TestAccIBMIsVirtualNetworkInterfaceDataSourceBasic(t *testing.T) { + var conf vpcv1.VirtualNetworkInterface + vpcname := fmt.Sprintf("tfvpngw-vpc-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfvpngw-subnet-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tfvpngw-createname-%d", acctest.RandIntRange(10, 100)) + tag1 := "env:test" + tag2 := "env:dev" + tag3 := "env:prod" + enable_infrastructure_nat := true + allow_ip_spoofing := true resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceDataSourceConfigBasic(), + Config: testAccCheckIBMIsVirtualNetworkInterfaceDataSourceConfigBasic(vpcname, subnetname, vniname, tag1, tag2, tag3, enable_infrastructure_nat, allow_ip_spoofing, false), Check: resource.ComposeTestCheckFunc( + testAccCheckIBMIsVirtualNetworkInterfaceExists("ibm_is_virtual_network_interface.testacc_vni", conf), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "virtual_network_interface"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "auto_delete"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "created_at"), @@ -32,6 +44,7 @@ func TestAccIBMIsVirtualNetworkInterfaceDataSourceBasic(t *testing.T) { resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "security_groups.0.id"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "subnet.0.id"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "vpc.0.id"), + resource.TestCheckResourceAttr("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "tags.#", "3"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "zone.0.name"), ), }, @@ -39,13 +52,23 @@ func TestAccIBMIsVirtualNetworkInterfaceDataSourceBasic(t *testing.T) { }) } func TestAccIBMIsVirtualNetworkInterfaceDataSourceVniBasic(t *testing.T) { + var conf vpcv1.VirtualNetworkInterface + vpcname := fmt.Sprintf("tfvpngw-vpc-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tfvpngw-subnet-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tfvpngw-createname-%d", acctest.RandIntRange(10, 100)) + tag1 := "env:test" + tag2 := "env:dev" + tag3 := "env:prod" + enable_infrastructure_nat := true + allow_ip_spoofing := true resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceDataSourceConfigBasic(), + Config: testAccCheckIBMIsVirtualNetworkInterfaceDataSourceConfigBasic(vpcname, subnetname, vniname, tag1, tag2, tag3, enable_infrastructure_nat, allow_ip_spoofing, false), Check: resource.ComposeTestCheckFunc( + testAccCheckIBMIsVirtualNetworkInterfaceExists("ibm_is_virtual_network_interface.testacc_vni", conf), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "virtual_network_interface"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "auto_delete"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "created_at"), @@ -58,6 +81,7 @@ func TestAccIBMIsVirtualNetworkInterfaceDataSourceVniBasic(t *testing.T) { resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "security_groups.0.id"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "subnet.0.id"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "vpc.0.id"), + resource.TestCheckResourceAttr("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "tags.#", "3"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "zone.0.name"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "enable_infrastructure_nat"), resource.TestCheckResourceAttrSet("data.ibm_is_virtual_network_interface.is_virtual_network_interface", "allow_ip_spoofing"), @@ -67,10 +91,10 @@ func TestAccIBMIsVirtualNetworkInterfaceDataSourceVniBasic(t *testing.T) { }) } -func testAccCheckIBMIsVirtualNetworkInterfaceDataSourceConfigBasic() string { - return fmt.Sprintf(` +func testAccCheckIBMIsVirtualNetworkInterfaceDataSourceConfigBasic(vpcname, subnetname, vniname, tag1, tag2, tag3 string, enablenat, allowipspoofing, isUpdate bool) string { + return testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic(vpcname, subnetname, vniname, tag1, tag2, tag3, enablenat, allowipspoofing, false) + fmt.Sprintf(` data "ibm_is_virtual_network_interface" "is_virtual_network_interface" { - virtual_network_interface = "%s" + virtual_network_interface = ibm_is_virtual_network_interface.testacc_vni.id } - `, acc.VNIId) + `) } diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go index 9c372095d4..4db5bee907 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go @@ -35,6 +35,20 @@ func DataSourceIBMIsVirtualNetworkInterfaces() *schema.Resource { Computed: true, Description: "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.", }, + "tags": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: flex.ResourceIBMVPCHash, + Description: "UserTags for the vni instance", + }, + "access_tags": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: flex.ResourceIBMVPCHash, + Description: "Access management tags for the vni instance", + }, "enable_infrastructure_nat": &schema.Schema{ Type: schema.TypeBool, Computed: true, @@ -451,6 +465,21 @@ func dataSourceIBMIsVirtualNetworkInterfacesRead(context context.Context, d *sch if err != nil { return diag.FromErr(err) } + + tags, err := flex.GetGlobalTagsUsingCRN(meta, *modelItem.CRN, "", isUserTagType) + if err != nil { + log.Printf( + "Error on get of datasources vni (%s) tags: %s", *modelItem.ID, err) + } + + accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *modelItem.CRN, "", isAccessTagType) + if err != nil { + log.Printf( + "Error on get of datasources vni (%s) access tags: %s", *modelItem.ID, err) + } + + modelMap["tags"] = tags + modelMap["access_tags"] = accesstags mapSlice = append(mapSlice, modelMap) } diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go index 3de73ef8bd..0b77c30bf1 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go @@ -9,6 +9,7 @@ import ( "encoding/json" "fmt" "log" + "os" "time" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" @@ -17,6 +18,7 @@ import ( "github.com/IBM/go-sdk-core/v5/core" "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -29,6 +31,24 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { DeleteContext: resourceIBMIsVirtualNetworkInterfaceDelete, Importer: &schema.ResourceImporter{}, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Update: schema.DefaultTimeout(10 * time.Minute), + Delete: schema.DefaultTimeout(10 * time.Minute), + }, + + CustomizeDiff: customdiff.All( + customdiff.Sequence( + func(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { + return flex.ResourceTagsCustomizeDiff(diff) + }, + ), + customdiff.Sequence( + func(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { + return flex.ResourceValidateAccessTags(diff, v) + }), + ), + Schema: map[string]*schema.Schema{ "allow_ip_spoofing": &schema.Schema{ Type: schema.TypeBool, @@ -48,6 +68,23 @@ func ResourceIBMIsVirtualNetworkInterface() *schema.Resource { Computed: true, Description: "If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.", }, + "tags": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString, ValidateFunc: validate.InvokeValidator("ibm_is_volume", "tags")}, + Set: flex.ResourceIBMVPCHash, + Description: "UserTags for the vni instance", + }, + "access_tags": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString, ValidateFunc: validate.InvokeValidator("ibm_is_volume", "accesstag")}, + Set: flex.ResourceIBMVPCHash, + Description: "Access management tags for the vni instance", + }, + "ips": &schema.Schema{ Type: schema.TypeSet, Optional: true, @@ -419,7 +456,23 @@ func resourceIBMIsVirtualNetworkInterfaceCreate(context context.Context, d *sche } d.SetId(*virtualNetworkInterface.ID) - + v := os.Getenv("IC_ENV_TAGS") + if _, ok := d.GetOk("tags"); ok || v != "" { + oldList, newList := d.GetChange("tags") + err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, *virtualNetworkInterface.CRN, "", isUserTagType) + if err != nil { + log.Printf( + "Error on create of resource vni (%s) tags: %s", d.Id(), err) + } + } + if _, ok := d.GetOk("access_tags"); ok { + oldList, newList := d.GetChange("access_tags") + err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, *virtualNetworkInterface.CRN, "", isAccessTagType) + if err != nil { + log.Printf( + "Error on create of resource vni (%s) access tags: %s", d.Id(), err) + } + } return resourceIBMIsVirtualNetworkInterfaceRead(context, d, meta) } @@ -548,6 +601,21 @@ func resourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema d.Set("zone", *virtualNetworkInterface.Zone.Name) } + tags, err := flex.GetGlobalTagsUsingCRN(meta, *virtualNetworkInterface.CRN, "", isUserTagType) + if err != nil { + log.Printf( + "Error on get of resource vni (%s) tags: %s", d.Id(), err) + } + + accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *virtualNetworkInterface.CRN, "", isAccessTagType) + if err != nil { + log.Printf( + "Error on get of resource vni (%s) access tags: %s", d.Id(), err) + } + + d.Set("tags", tags) + d.Set("access_tags", accesstags) + return nil } @@ -557,6 +625,24 @@ func resourceIBMIsVirtualNetworkInterfaceUpdate(context context.Context, d *sche return diag.FromErr(err) } id := d.Id() + + if d.HasChange("tags") { + oldList, newList := d.GetChange("tags") + err := flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, d.Get("crn").(string), "", isUserTagType) + if err != nil { + log.Printf( + "Error on update of resource vni (%s) tags: %s", d.Id(), err) + } + } + + if d.HasChange("access_tags") { + oldList, newList := d.GetChange("access_tags") + err := flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, d.Get("crn").(string), "", isAccessTagType) + if err != nil { + log.Printf( + "Error on update of resource vni (%s) access tags: %s", d.Id(), err) + } + } updateVirtualNetworkInterfaceOptions := &vpcv1.UpdateVirtualNetworkInterfaceOptions{} updateVirtualNetworkInterfaceOptions.SetID(id) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go index 780ca1a912..021e95a510 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface_test.go @@ -20,6 +20,9 @@ func TestAccIBMIsVirtualNetworkInterfaceBasic(t *testing.T) { vpcname := fmt.Sprintf("tfvpngw-vpc-%d", acctest.RandIntRange(10, 100)) subnetname := fmt.Sprintf("tfvpngw-subnet-%d", acctest.RandIntRange(10, 100)) vniname := fmt.Sprintf("tfvpngw-createname-%d", acctest.RandIntRange(10, 100)) + tag1 := "env:test" + tag2 := "env:dev" + tag3 := "env:prod" enable_infrastructure_nat := true allow_ip_spoofing := true resource.Test(t, resource.TestCase{ @@ -28,7 +31,7 @@ func TestAccIBMIsVirtualNetworkInterfaceBasic(t *testing.T) { CheckDestroy: testAccCheckIBMIsVirtualNetworkInterfaceDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic(vpcname, subnetname, vniname, enable_infrastructure_nat, allow_ip_spoofing), + Config: testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic(vpcname, subnetname, vniname, tag1, tag2, tag3, enable_infrastructure_nat, allow_ip_spoofing, false), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckIBMIsVirtualNetworkInterfaceExists("ibm_is_virtual_network_interface.testacc_vni", conf), resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "subnet"), @@ -45,6 +48,29 @@ func TestAccIBMIsVirtualNetworkInterfaceBasic(t *testing.T) { resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "lifecycle_state", "stable"), resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "resource_type", "virtual_network_interface"), resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "resource_group"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "tags.#", "3"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "allow_ip_spoofing", "true"), + ), + }, + resource.TestStep{ + Config: testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic(vpcname, subnetname, vniname, tag1, tag2, tag3, enable_infrastructure_nat, allow_ip_spoofing, true), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIsVirtualNetworkInterfaceExists("ibm_is_virtual_network_interface.testacc_vni", conf), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "subnet"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "name"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "created_at"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "crn"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "href"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "vpc.#"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "zone"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "primary_ip.#"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "ips.#"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "tags.#", "2"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "id"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "enable_infrastructure_nat", "true"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "lifecycle_state", "stable"), + resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "resource_type", "virtual_network_interface"), + resource.TestCheckResourceAttrSet("ibm_is_virtual_network_interface.testacc_vni", "resource_group"), resource.TestCheckResourceAttr("ibm_is_virtual_network_interface.testacc_vni", "allow_ip_spoofing", "true"), ), }, @@ -144,7 +170,7 @@ func TestAccIBMIsVirtualNetworkInterfaceAllArgs(t *testing.T) { }) } -func testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic(vpcname, subnetname, vniname string, enablenat, allowipspoofing bool) string { +func testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic(vpcname, subnetname, vniname, tag1, tag2, tag3 string, enablenat, allowipspoofing, isUpdate bool) string { return fmt.Sprintf(` resource "ibm_is_vpc" "testacc_vpc" { name = "%s" @@ -163,8 +189,9 @@ func testAccCheckIBMIsVirtualNetworkInterfaceConfigBasic(vpcname, subnetname, vn subnet = ibm_is_subnet.testacc_subnet.id enable_infrastructure_nat = %t allow_ip_spoofing = %t + tags = %t ? ["%s", "%s"] : ["%s", "%s", "%s"] } - `, vpcname, subnetname, acc.ISZoneName, vniname, enablenat, allowipspoofing) + `, vpcname, subnetname, acc.ISZoneName, vniname, enablenat, allowipspoofing, isUpdate, tag1, tag2, tag1, tag2, tag3) } func testAccCheckIBMIsVirtualNetworkInterfaceConfigResourceGroup(vpcname, subnetname, vniname string, enablenat, allowipspoofing bool) string { diff --git a/website/docs/d/is_virtual_network_interface.html.markdown b/website/docs/d/is_virtual_network_interface.html.markdown index 6cc7ce0c8b..7dd5cd5ace 100644 --- a/website/docs/d/is_virtual_network_interface.html.markdown +++ b/website/docs/d/is_virtual_network_interface.html.markdown @@ -57,6 +57,7 @@ Review the argument reference that you can specify for your data source. In addition to all argument references listed, you can access the following attribute references after your data source is created. +- `access_tags` - (Array of Strings) Access management tags associated for the virtual network interface. - `allow_ip_spoofing` - (Boolean) 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. - `auto_delete` - (Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted. - `created_at` - (String) The date and time that the virtual network interface was created. @@ -113,6 +114,7 @@ In addition to all argument references listed, you can access the following attr - `id` - (String) The unique identifier for this subnet. - `name` - (String) The name for this subnet. The name is unique across all subnets in the VPC. - `resource_type` - (String) The resource type. +- `tags` - (Array of Strings) The tags associated with the virtual netork interface. - `target` - (List) The target of this virtual network interface.If absent, this virtual network interface is not attached to a target. Nested scheme for **target**: - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. diff --git a/website/docs/d/is_virtual_network_interfaces.html.markdown b/website/docs/d/is_virtual_network_interfaces.html.markdown index 57e8124a3c..21a80e52ca 100644 --- a/website/docs/d/is_virtual_network_interfaces.html.markdown +++ b/website/docs/d/is_virtual_network_interfaces.html.markdown @@ -26,6 +26,7 @@ In addition to all argument references listed, you can access the following attr - `virtual_network_interfaces` - (List) Collection of virtual network interfaces. Nested scheme for **virtual_network_interfaces**: + - `access_tags` - (Array of Strings) Access management tags associated for the virtual network interface. - `allow_ip_spoofing` - (Boolean) 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. - `auto_delete` - (Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted. - `created_at` - (String) The date and time that the virtual network interface was created. @@ -81,6 +82,7 @@ In addition to all argument references listed, you can access the following attr - `id` - (String) The unique identifier for this subnet. - `name` - (String) The name for this subnet. The name is unique across all subnets in the VPC. - `resource_type` - (String) The resource type. + - `tags` - (Array of Strings) The tags associated with the virtual netork interface. - `target` - (List) The target of this virtual network interface.If absent, this virtual network interface is not attached to a target. Nested scheme for **target**: - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. diff --git a/website/docs/r/is_virtual_network_interface.html.markdown b/website/docs/r/is_virtual_network_interface.html.markdown index 8f4cf388d1..210300c2db 100644 --- a/website/docs/r/is_virtual_network_interface.html.markdown +++ b/website/docs/r/is_virtual_network_interface.html.markdown @@ -26,6 +26,15 @@ resource "ibm_is_virtual_network_interface" "is_virtual_network_interface_instan You can specify the following arguments for this resource. + +- `access_tags` - (Optional, List of Strings) A list of access management tags to attach to the virtual network interface. + + ~> **Note:** + **•** You can attach only those access tags that already exists.
+ **•** For more information, about creating access tags, see [working with tags](https://cloud.ibm.com/docs/account?topic=account-tag&interface=ui#create-access-console).
+ **•** You must have the access listed in the [Granting users access to tag resources](https://cloud.ibm.com/docs/account?topic=account-access) for `access_tags`
+ **•** `access_tags` must be in the format `key:value`. + - `allow_ip_spoofing` - (Optional, Boolean) 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. - `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted. - `enable_infrastructure_nat` - (Optional, Boolean) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`. @@ -48,6 +57,7 @@ You can specify the following arguments for this resource. - `resource_group` - (Optional, String) The resource group id for this virtual network interface. - `security_groups` - (Optional, Array of string) The security group ids list for this virtual network interface. - `subnet` - (Optional, List) The associated subnet id. +- `tags` (Optional, Array of Strings) Enter any tags that you want to associate with your VPC. Tags might help you find your VPC more easily after it is created. Separate multiple tags with a comma (`,`). ## Attribute Reference From 323c934e5d03e282d3c4b476cab512cc18208464 Mon Sep 17 00:00:00 2001 From: Massimo Caprinali Date: Thu, 2 Nov 2023 10:54:22 +0100 Subject: [PATCH 044/132] Update README.md Fix Code Engine Go SDK url --- ibm/service/codeengine/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ibm/service/codeengine/README.md b/ibm/service/codeengine/README.md index ba10429863..e4283df92a 100644 --- a/ibm/service/codeengine/README.md +++ b/ibm/service/codeengine/README.md @@ -8,4 +8,4 @@ This area is primarily for IBM provider contributors and maintainers. For inform * IBM Provider Docs: [Home](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs) * IBM Provider Docs: [One of the resources](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/code_engine_app) * IBM API Docs: [IBM API Docs for ]() -* IBM SDK: [IBM SDK for ](https://github.com/IBM/appconfiguration-go-admin-sdk/tree/master/codeenginev2) +* IBM SDK: [IBM SDK for ](https://github.com/IBM/code-engine-go-sdk/tree/main/codeenginev2) From a85a3c908ba9dd777e7d11525969d172d4382024 Mon Sep 17 00:00:00 2001 From: Riccardo Angelilli Date: Thu, 9 Nov 2023 15:58:35 +0100 Subject: [PATCH 045/132] Update terraform to the latest API level for Project service (#4813) * fix: generate project code Signed-off-by: dvesperini * fix: fix build Signed-off-by: dvesperini * fix: add examples and markdown files Signed-off-by: dvesperini * fix: mark new false positive secrets Signed-off-by: dvesperini * fix: fix review Signed-off-by: dvesperini * fix: fix links Signed-off-by: dvesperini * fix: fix test Signed-off-by: dvesperini * fix: remove regex check Signed-off-by: dvesperini * fix: fix id to project_id Signed-off-by: dvesperini * fix: fix integration test project Signed-off-by: dvesperini * fix: fix resource_group values Signed-off-by: dvesperini * fix: last changes Signed-off-by: dvesperini * fix integration test * fix integration test * fix integration test * fix integration test * fix integration test * fix integration test * fix name * pr comments * pr comments * fix doc * fix doc * new version * new version * new version * new version * update code to the latest SDK level * fix integration tests * fix integration tests * fix integration tests * fix integration tests * address PR comment * typo * typo * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * add wait for create and delete * add wait for create and delete * . * fix integration tests * fix integration tests * fix integration tests * fix integration tests * fix integration tests * regenerate * new code generation * new generated code * point to latest sdk * point to latest sdk * adjust test cases and doc * adjust samples * update to latest node sdk * merge with master * Update project_instance.html.markdown Fixing formatting issues * Update project_event_notification.html.markdown * Update README.md * Update variables.tf * Update project_event_notification.html.markdown * new version * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * feat: projects graph fragment pattern * align with origin/master * update test cases * restore README.md and versions.tf to master branch * remove duplicated entries * feat: graph fragment pattern poc * feat: restore definition blocks * regenerate the terraform code based on latest YAML * regenerate the terraform code based on latest YAML * regenerate the terraform code based on latest YAML * update doc * update doc * fix test cases * commit generated code * commit fix * commit fix * test cases * test cases * test cases * test cases * updates * upgrade to latest go sdk * update generated doc * update generated code * updated secrets baseline * update code to latest API changes * secrets * fix secrets * update samples with real values * update secrets * update secrets * update generated code to the latest API definition * update secrets baseline * merge with master * merge with master * merge with master * update code to the latest SDK level * address some review comments * address PR comments * address PR comments * update to latest sdk level * update to latest sdk level * update to latest sdk level * merge with master * update to the latest sdk level * format test case * regenerate the code with generator fixes --------- Signed-off-by: dvesperini Co-authored-by: dvesperini Co-authored-by: knee-na <130502432+knee-na@users.noreply.github.com> Co-authored-by: Mark-Kulube --- .secrets.baseline | 176 ++-- examples/ibm-project/README.md | 58 +- examples/ibm-project/main.tf | 43 +- examples/ibm-project/outputs.tf | 16 +- examples/ibm-project/variables.tf | 41 +- examples/ibm-project/versions.tf | 2 +- go.mod | 2 +- go.sum | 4 +- ibm/acctest/acctest.go | 8 + ibm/provider/provider.go | 9 +- .../project/data_source_ibm_project.go | 532 ++++++++++++ .../project/data_source_ibm_project_config.go | 494 +++++++++++ .../data_source_ibm_project_config_test.go | 74 ++ ...a_source_ibm_project_event_notification.go | 444 ---------- ...rce_ibm_project_event_notification_test.go | 99 --- .../project/data_source_ibm_project_test.go | 56 ++ ibm/service/project/resource_ibm_project.go | 787 ++++++++++++++++++ .../project/resource_ibm_project_config.go | 757 +++++++++++++++++ .../resource_ibm_project_config_test.go | 138 +++ .../project/resource_ibm_project_instance.go | 646 -------------- .../resource_ibm_project_instance_test.go | 187 ----- .../project/resource_ibm_project_test.go | 111 +++ website/docs/d/project.html.markdown | 129 +++ website/docs/d/project_config.html.markdown | 117 +++ .../project_event_notification.html.markdown | 107 --- website/docs/r/project.html.markdown | 132 +++ website/docs/r/project_config.html.markdown | 138 +++ website/docs/r/project_instance.html.markdown | 117 --- 28 files changed, 3706 insertions(+), 1718 deletions(-) create mode 100644 ibm/service/project/data_source_ibm_project.go create mode 100644 ibm/service/project/data_source_ibm_project_config.go create mode 100644 ibm/service/project/data_source_ibm_project_config_test.go delete mode 100644 ibm/service/project/data_source_ibm_project_event_notification.go delete mode 100644 ibm/service/project/data_source_ibm_project_event_notification_test.go create mode 100644 ibm/service/project/data_source_ibm_project_test.go create mode 100644 ibm/service/project/resource_ibm_project.go create mode 100644 ibm/service/project/resource_ibm_project_config.go create mode 100644 ibm/service/project/resource_ibm_project_config_test.go delete mode 100644 ibm/service/project/resource_ibm_project_instance.go delete mode 100644 ibm/service/project/resource_ibm_project_instance_test.go create mode 100644 ibm/service/project/resource_ibm_project_test.go create mode 100644 website/docs/d/project.html.markdown create mode 100644 website/docs/d/project_config.html.markdown delete mode 100644 website/docs/d/project_event_notification.html.markdown create mode 100644 website/docs/r/project.html.markdown create mode 100644 website/docs/r/project_config.html.markdown delete mode 100644 website/docs/r/project_instance.html.markdown diff --git a/.secrets.baseline b/.secrets.baseline index abde119aa3..0d60faf91f 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.mod|go.sum|.*.map|^.secrets.baseline$", "lines": null }, - "generated_at": "2023-10-18T18:46:12Z", + "generated_at": "2023-10-30T15:56:24Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -472,7 +472,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 44, + "line_number": 51, "type": "Secret Keyword", "verified_result": null } @@ -547,6 +547,16 @@ "verified_result": null } ], + "examples/ibm-project/main.tf": [ + { + "hashed_secret": "06d988e96c3d9325c9fbc7c0ef3c6c0f2b4eb8e7", + "is_secret": false, + "is_verified": false, + "line_number": 13, + "type": "Secret Keyword", + "verified_result": null + } + ], "examples/ibm-satellite/README.md": [ { "hashed_secret": "91199272d5d6a574a51722ca6f3d1148edb1a0e7", @@ -742,7 +752,7 @@ "hashed_secret": "731438016c5ab94431f61820f35e3ae5f8ad6004", "is_secret": false, "is_verified": false, - "line_number": 383, + "line_number": 401, "type": "Secret Keyword", "verified_result": null }, @@ -750,7 +760,7 @@ "hashed_secret": "12da2e35d6b50c902c014f1ab9e3032650368df7", "is_secret": false, "is_verified": false, - "line_number": 389, + "line_number": 407, "type": "Secret Keyword", "verified_result": null }, @@ -758,7 +768,7 @@ "hashed_secret": "813274ccae5b6b509379ab56982d862f7b5969b6", "is_secret": false, "is_verified": false, - "line_number": 1100, + "line_number": 1118, "type": "Base64 High Entropy String", "verified_result": null } @@ -768,7 +778,7 @@ "hashed_secret": "9184b0c38101bf24d78b2bb0d044deb1d33696fc", "is_secret": false, "is_verified": false, - "line_number": 130, + "line_number": 131, "type": "Secret Keyword", "verified_result": null }, @@ -776,7 +786,7 @@ "hashed_secret": "c427f185ddcb2440be9b77c8e45f1cd487a2e790", "is_secret": false, "is_verified": false, - "line_number": 1427, + "line_number": 1438, "type": "Base64 High Entropy String", "verified_result": null }, @@ -784,7 +794,7 @@ "hashed_secret": "1f7e33de15e22de9d2eaf502df284ed25ca40018", "is_secret": false, "is_verified": false, - "line_number": 1494, + "line_number": 1505, "type": "Secret Keyword", "verified_result": null }, @@ -792,7 +802,7 @@ "hashed_secret": "1f614c2eb6b3da22d89bd1b9fd47d7cb7c8fc670", "is_secret": false, "is_verified": false, - "line_number": 3250, + "line_number": 3298, "type": "Secret Keyword", "verified_result": null }, @@ -800,7 +810,7 @@ "hashed_secret": "7abfce65b8504403afc25c9790f358d513dfbcc6", "is_secret": false, "is_verified": false, - "line_number": 3263, + "line_number": 3311, "type": "Secret Keyword", "verified_result": null }, @@ -808,7 +818,7 @@ "hashed_secret": "0c2d85bf9a9b1579b16f220a4ea8c3d62b2e24b1", "is_secret": false, "is_verified": false, - "line_number": 3304, + "line_number": 3352, "type": "Secret Keyword", "verified_result": null } @@ -846,7 +856,7 @@ "hashed_secret": "c8b6f5ef11b9223ac35a5663975a466ebe7ebba9", "is_secret": false, "is_verified": false, - "line_number": 1779, + "line_number": 1800, "type": "Secret Keyword", "verified_result": null }, @@ -854,7 +864,7 @@ "hashed_secret": "8abf4899c01104241510ba87685ad4de76b0c437", "is_secret": false, "is_verified": false, - "line_number": 1785, + "line_number": 1806, "type": "Secret Keyword", "verified_result": null } @@ -2070,7 +2080,7 @@ "hashed_secret": "deab23f996709b4e3d14e5499d1cc2de677bfaa8", "is_secret": false, "is_verified": false, - "line_number": 1559, + "line_number": 1340, "type": "Secret Keyword", "verified_result": null }, @@ -2078,7 +2088,7 @@ "hashed_secret": "20a25bac21219ffff1904bde871ded4027eca2f8", "is_secret": false, "is_verified": false, - "line_number": 2212, + "line_number": 1927, "type": "Secret Keyword", "verified_result": null }, @@ -2086,7 +2096,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 2231, + "line_number": 1946, "type": "Secret Keyword", "verified_result": null }, @@ -2094,7 +2104,7 @@ "hashed_secret": "1f5e25be9b575e9f5d39c82dfd1d9f4d73f1975c", "is_secret": false, "is_verified": false, - "line_number": 2496, + "line_number": 2186, "type": "Secret Keyword", "verified_result": null } @@ -2104,7 +2114,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 726, + "line_number": 731, "type": "Secret Keyword", "verified_result": null } @@ -2114,7 +2124,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 189, + "line_number": 205, "type": "Secret Keyword", "verified_result": null } @@ -2124,7 +2134,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 779, + "line_number": 823, "type": "Secret Keyword", "verified_result": null } @@ -2144,7 +2154,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 199, + "line_number": 213, "type": "Secret Keyword", "verified_result": null } @@ -2154,7 +2164,7 @@ "hashed_secret": "68ab9ef0953865fef0558010a9f7afcef110d5b8", "is_secret": false, "is_verified": false, - "line_number": 199, + "line_number": 215, "type": "Secret Keyword", "verified_result": null }, @@ -2162,7 +2172,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 257, + "line_number": 280, "type": "Secret Keyword", "verified_result": null } @@ -2172,7 +2182,7 @@ "hashed_secret": "5667b8489a17faa9ef54941db31ed762be280bec", "is_secret": false, "is_verified": false, - "line_number": 141, + "line_number": 157, "type": "Secret Keyword", "verified_result": null }, @@ -2180,7 +2190,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 173, + "line_number": 189, "type": "Secret Keyword", "verified_result": null } @@ -2190,7 +2200,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 200, + "line_number": 214, "type": "Secret Keyword", "verified_result": null } @@ -2200,7 +2210,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 134, + "line_number": 150, "type": "Secret Keyword", "verified_result": null } @@ -2210,7 +2220,7 @@ "hashed_secret": "e407cbe1c64cadb886be6f42907e2dd1c06ca080", "is_secret": false, "is_verified": false, - "line_number": 626, + "line_number": 490, "type": "Secret Keyword", "verified_result": null }, @@ -2218,7 +2228,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 991, + "line_number": 658, "type": "Secret Keyword", "verified_result": null } @@ -2228,7 +2238,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 209, + "line_number": 223, "type": "Secret Keyword", "verified_result": null } @@ -2238,7 +2248,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 251, + "line_number": 272, "type": "Secret Keyword", "verified_result": null } @@ -2512,7 +2522,7 @@ "hashed_secret": "b02fa7fd7ca08b5dc86c2548e40f8a21171ef977", "is_secret": false, "is_verified": false, - "line_number": 259, + "line_number": 265, "type": "Secret Keyword", "verified_result": null }, @@ -2520,7 +2530,7 @@ "hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030", "is_secret": false, "is_verified": false, - "line_number": 296, + "line_number": 302, "type": "Secret Keyword", "verified_result": null } @@ -2782,7 +2792,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 403, + "line_number": 402, "type": "Secret Keyword", "verified_result": null } @@ -2792,7 +2802,7 @@ "hashed_secret": "5df29b80b97dab81130058ac9af4a9b9d1c091b4", "is_secret": false, "is_verified": false, - "line_number": 247, + "line_number": 276, "type": "Secret Keyword", "verified_result": null } @@ -2802,7 +2812,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 292, + "line_number": 291, "type": "Secret Keyword", "verified_result": null } @@ -2812,7 +2822,7 @@ "hashed_secret": "5df29b80b97dab81130058ac9af4a9b9d1c091b4", "is_secret": false, "is_verified": false, - "line_number": 216, + "line_number": 239, "type": "Secret Keyword", "verified_result": null } @@ -2827,6 +2837,62 @@ "verified_result": null } ], + "ibm/service/project/data_source_ibm_project_config.go": [ + { + "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", + "is_secret": false, + "is_verified": false, + "line_number": 190, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", + "is_secret": false, + "is_verified": false, + "line_number": 461, + "type": "Secret Keyword", + "verified_result": null + } + ], + "ibm/service/project/data_source_ibm_project_config_test.go": [ + { + "hashed_secret": "347cd9c53ff77d41a7b22aa56c7b4efaf54658e3", + "is_secret": false, + "is_verified": false, + "line_number": 58, + "type": "Secret Keyword", + "verified_result": null + } + ], + "ibm/service/project/resource_ibm_project_config.go": [ + { + "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", + "is_secret": false, + "is_verified": false, + "line_number": 92, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", + "is_secret": false, + "is_verified": false, + "line_number": 693, + "type": "Secret Keyword", + "verified_result": null + } + ], + "ibm/service/project/resource_ibm_project_config_test.go": [ + { + "hashed_secret": "347cd9c53ff77d41a7b22aa56c7b4efaf54658e3", + "is_secret": false, + "is_verified": false, + "line_number": 61, + "type": "Secret Keyword", + "verified_result": null + } + ], "ibm/service/pushnotification/resource_ibm_push_notification_chrome.go": [ { "hashed_secret": "8a4036fbf3e13c7a84bac77ddae25de1cdfc4d43", @@ -3676,7 +3742,7 @@ "hashed_secret": "f855f5027fd8fdb2df3f6a6f1cf858fffcbedb0c", "is_secret": false, "is_verified": false, - "line_number": 93883, + "line_number": 96615, "type": "Secret Keyword", "verified_result": null }, @@ -3684,7 +3750,7 @@ "hashed_secret": "5fb0fa884132a8724a8d7cba55853737e442adbd", "is_secret": false, "is_verified": false, - "line_number": 116309, + "line_number": 119404, "type": "Secret Keyword", "verified_result": null }, @@ -3692,7 +3758,7 @@ "hashed_secret": "1e5c2f367f02e47a8c160cda1cd9d91decbac441", "is_secret": false, "is_verified": false, - "line_number": 147225, + "line_number": 151612, "type": "Secret Keyword", "verified_result": null } @@ -3962,7 +4028,7 @@ "hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e", "is_secret": false, "is_verified": false, - "line_number": 153, + "line_number": 152, "type": "Secret Keyword", "verified_result": null }, @@ -3970,7 +4036,7 @@ "hashed_secret": "e66e7d67fdf3c596c435fc7828b13205e4950a0f", "is_secret": false, "is_verified": false, - "line_number": 155, + "line_number": 154, "type": "Secret Keyword", "verified_result": null } @@ -4172,7 +4238,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 488, + "line_number": 494, "type": "Secret Keyword", "verified_result": null }, @@ -4180,7 +4246,7 @@ "hashed_secret": "e407cbe1c64cadb886be6f42907e2dd1c06ca080", "is_secret": false, "is_verified": false, - "line_number": 553, + "line_number": 559, "type": "Secret Keyword", "verified_result": null }, @@ -4188,7 +4254,7 @@ "hashed_secret": "91199272d5d6a574a51722ca6f3d1148edb1a0e7", "is_secret": false, "is_verified": false, - "line_number": 577, + "line_number": 583, "type": "Secret Keyword", "verified_result": null } @@ -4223,16 +4289,6 @@ "verified_result": null } ], - "website/docs/r/en_destination_huawei.html.markdown": [ - { - "hashed_secret": "167a06dbc64c344aeb0bd749d1962d2ef9731f06", - "is_secret": false, - "is_verified": false, - "line_number": 24, - "type": "Secret Keyword", - "verified_result": null - } - ], "website/docs/r/en_destination_ios.html.markdown": [ { "hashed_secret": "e1e03a31507ee39abca8fc86cf37b8347dc32002", @@ -4413,6 +4469,16 @@ "verified_result": null } ], + "website/docs/r/project_config.html.markdown": [ + { + "hashed_secret": "06d988e96c3d9325c9fbc7c0ef3c6c0f2b4eb8e7", + "is_secret": false, + "is_verified": false, + "line_number": 23, + "type": "Secret Keyword", + "verified_result": null + } + ], "website/docs/r/resource_instance.html.markdown": [ { "hashed_secret": "d62552e3d0606ac398b6ee5cbd49e763ac9c3933", diff --git a/examples/ibm-project/README.md b/examples/ibm-project/README.md index 010899110e..2c985f19d0 100644 --- a/examples/ibm-project/README.md +++ b/examples/ibm-project/README.md @@ -2,13 +2,14 @@ This example illustrates how to use the ProjectV1 -These types of resources are supported: +The following types of resources are supported: -* Project definition +* project_config +* project ## Usage -To run this example you need to execute: +To run this example, execute the following commands: ```bash $ terraform init @@ -21,25 +22,39 @@ Run `terraform destroy` when you don't need these resources. ## ProjectV1 resources -project_instance resource: +project_config resource: ```hcl -resource "project_instance" "project_instance" { - name = var.project_instance_name - description = var.project_instance_description - configs = var.project_instance_configs - resource_group = var.project_instance_resource_group - location = var.project_instance_location +resource "project_config" "project_config_instance" { + project_id = ibm_project.project_instance.project_id + definition = var.project_config_definition } ``` +project resource: -## ProjectV1 Data sources +```hcl +resource "project" "project_instance" { + location = var.project_location + resource_group = var.project_resource_group + definition = var.project_definition +} +``` + +## ProjectV1 data sources + +project_config data source: -project_event_notification data source: +```hcl +data "project_config" "project_config_instance" { + project_id = ibm_project.project_instance.id + project_config_id = ibm_project_config.project_config_instance.project_config_id +} +``` +project data source: ```hcl -data "project_event_notification" "project_event_notification_instance" { - id = var.project_event_notification_id +data "project" "project_instance" { + project_id = ibm_project.project_instance.id } ``` @@ -68,16 +83,19 @@ data "project_event_notification" "project_event_notification_instance" { | Name | Description | Type | Required | |------|-------------|------|---------| | ibmcloud\_api\_key | IBM Cloud API key | `string` | true | -| name | The project name. | `string` | true | -| description | A project's descriptive text. | `string` | false | -| configs | The project configurations. | `list()` | false | +| project_id | The unique project ID. | `string` | true | +| schematics | A schematics workspace associated to a project configuration. | `` | false | +| definition | The type and output of a project configuration. | `` | true | +| location | The IBM Cloud location where a resource is deployed. | `string` | true | | resource_group | The resource group where the project's data and tools are created. | `string` | true | -| location | The location where the project's data and tools are created. | `string` | true | +| definition | The definition of the project. | `` | true | +| project_id | The unique project ID. | `string` | true | +| project_config_id | The unique config ID. | `string` | true | | project_id | The unique project ID. | `string` | true | ## Outputs | Name | Description | |------|-------------| -| project_instance | project_instance object | -| project_event_notification | project_event_notification object | +| project_config | project_config object | +| project | project object | diff --git a/examples/ibm-project/main.tf b/examples/ibm-project/main.tf index d3348263c7..79837ee3fb 100644 --- a/examples/ibm-project/main.tf +++ b/examples/ibm-project/main.tf @@ -2,14 +2,16 @@ provider "ibm" { ibmcloud_api_key = var.ibmcloud_api_key } -// Provision project_instance resource instance -resource "ibm_project_instance" "project_instance" { - name = "My static website" - description = "Sample static website test using the IBM catalog deployable architecture" - configs { +// Provision project_config resource instance +resource "ibm_project_config" "project_config_instance" { + project_id = ibm_project.project_instance.project_id + definition { name = "static-website-dev" - labels = [ "env:dev", "billing:internal" ] description = "Website - development" + authorizations { + method = "api_key" + api_key = "" + } locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.145be7c1-9ec4-4719-b586-584ee52fbed0-global" input { name = "app_repo_name" @@ -19,15 +21,26 @@ resource "ibm_project_instance" "project_instance" { value = "static-website-dev-app-repo" } } - resource_group = "Default" - location = "us-south" } -// Data source is not linked to a resource instance -// Uncomment if an existing data source instance exists -/* -// Create project_event_notification data source -data "ibm_project_event_notification" "project_event_notification_instance" { - project_id = var.project_event_notification_id +// Provision project resource instance +resource "ibm_project" "project_instance" { + location = var.project_location + resource_group = var.project_resource_group + definition { + name = "My static website" + description = "Sample static website test using the IBM catalog deployable architecture" + destroy_on_delete = true + } +} + +// Create project_config data source +data "ibm_project_config" "project_config_instance" { + project_id = ibm_project_config.project_config_instance.project_id + project_config_id = ibm_project_config.project_config_instance.project_config_id +} + +// Create project data source +data "ibm_project" "project_instance" { + project_id = ibm_project.project_instance.id } -*/ diff --git a/examples/ibm-project/outputs.tf b/examples/ibm-project/outputs.tf index 8a59bbf786..277309cbec 100644 --- a/examples/ibm-project/outputs.tf +++ b/examples/ibm-project/outputs.tf @@ -1,6 +1,12 @@ -// This allows project_instance data to be referenced by other resources and the terraform CLI -// Modify this if only certain data should be exposed -output "ibm_project_instance" { - value = ibm_project_instance.project_instance - description = "project_instance resource instance" +// This output allows project_config data to be referenced by other resources and the terraform CLI +// Modify this output if only certain data should be exposed +output "ibm_project_config" { + value = ibm_project_config.project_config_instance + description = "project_config resource instance" +} +// This output allows project data to be referenced by other resources and the terraform CLI +// Modify this output if only certain data should be exposed +output "ibm_project" { + value = ibm_project.project_instance + description = "project resource instance" } diff --git a/examples/ibm-project/variables.tf b/examples/ibm-project/variables.tf index 240c070647..b32094d31b 100644 --- a/examples/ibm-project/variables.tf +++ b/examples/ibm-project/variables.tf @@ -3,31 +3,40 @@ variable "ibmcloud_api_key" { type = string } -// Resource arguments for project_instance -variable "project_instance_name" { - description = "The project name." +// Resource arguments for project_config +variable "project_config_project_id" { + description = "The unique project ID." + type = string + default = "project_id" +} + +// Resource arguments for project +variable "project_location" { + description = "The IBM Cloud location where a resource is deployed." type = string - default = "acme-microservice" + default = "us-south" } -variable "project_instance_description" { - description = "A project's descriptive text." +variable "project_resource_group" { + description = "The resource group where the project's data and tools are created." type = string - default = "A microservice to deploy on top of ACME infrastructure." + default = "Default" } -variable "project_instance_resource_group" { - description = "Group name of the customized collection of resources." + +// Data source arguments for project_config +variable "project_config_project_id" { + description = "The unique project ID." type = string - default = "resource_group" + default = "project_id" } -variable "project_instance_location" { - description = "Data center locations for resource deployment." +variable "project_config_id" { + description = "The unique config ID." type = string - default = "location" + default = "project_config_id" } -// Data source arguments for project_event_notification -variable "project_event_notification_id" { +// Data source arguments for project +variable "project_id" { description = "The unique project ID." type = string - default = "id" + default = "project_id" } diff --git a/examples/ibm-project/versions.tf b/examples/ibm-project/versions.tf index ee0f9705a2..d9b6f790b9 100644 --- a/examples/ibm-project/versions.tf +++ b/examples/ibm-project/versions.tf @@ -1,3 +1,3 @@ terraform { required_version = ">= 0.12" -} \ No newline at end of file +} diff --git a/go.mod b/go.mod index 8f6c7bf23a..8cec155f12 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/IBM/keyprotect-go-client v0.12.2 github.com/IBM/networking-go-sdk v0.42.2 github.com/IBM/platform-services-go-sdk v0.52.0 - github.com/IBM/project-go-sdk v0.0.10 + github.com/IBM/project-go-sdk v0.0.99 github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 github.com/IBM/scc-go-sdk/v5 v5.1.3 github.com/IBM/schematics-go-sdk v0.2.2 diff --git a/go.sum b/go.sum index c6cc71647e..e1f9e3e9ff 100644 --- a/go.sum +++ b/go.sum @@ -157,8 +157,8 @@ github.com/IBM/networking-go-sdk v0.42.2 h1:caqjx4jyFHi10Vlf3skHvlL6K3YJRVstsmCB github.com/IBM/networking-go-sdk v0.42.2/go.mod h1:lTUZwtUkMANMnrLHFIgRhHrkBfwASY/Iho1fabaPHxo= github.com/IBM/platform-services-go-sdk v0.52.0 h1:hbf640xE8T0Rwy2IUf5Pu4OATabGS4IDMnEInXUXs4o= github.com/IBM/platform-services-go-sdk v0.52.0/go.mod h1:6LxcUhIaSLP4SuQJXF9oLXBamSQogs5D9BcVwr4hmfU= -github.com/IBM/project-go-sdk v0.0.10 h1:vHSuemwZ4S4c6BEb22tzsEcPTs/5LnZ0yKpP3GG/GL8= -github.com/IBM/project-go-sdk v0.0.10/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig= +github.com/IBM/project-go-sdk v0.0.99 h1:rQU/uQLW83OsAUfP/d8fFSIjp8ooEQIFjalYQD4i4aY= +github.com/IBM/project-go-sdk v0.0.99/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig= github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 h1:NPUhkoOCRuv3OFWt19PmwjXGGTKlvmbuPg9fUrBUNe4= github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5/go.mod h1:b07XHUVh0XYnQE9s2mqgjYST1h9buaQNqN4EcKhOsX0= github.com/IBM/sarama v1.41.2 h1:ZDBZfGPHAD4uuAtSv4U22fRZBgst0eEwGFzLj0fb85c= diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 19b72beb82..7ca53ec073 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -309,6 +309,9 @@ var ( // for IAM Identity var IamIdentityAssignmentTargetAccountId string +// Projects +var ProjectsConfigApiKey string + func init() { testlogger := os.Getenv("TF_LOG") if testlogger != "" { @@ -317,6 +320,11 @@ func init() { IamIdentityAssignmentTargetAccountId = os.Getenv("IAM_IDENTITY_ASSIGNMENT_TARGET_ACCOUNT") + ProjectsConfigApiKey = os.Getenv("IBM_PROJECTS_CONFIG_APIKEY") + if ProjectsConfigApiKey == "" { + fmt.Println("[WARN] Set the environment variable IBM_PROJECTS_CONFIG_APIKEY for testing IBM Projects Config resources, the tests will fail if this is not set") + } + AppIDTenantID = os.Getenv("IBM_APPID_TENANT_ID") if AppIDTenantID == "" { fmt.Println("[WARN] Set the environment variable IBM_APPID_TENANT_ID for testing AppID resources, AppID tests will fail if this is not set") diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index 7f33857001..bdc22fc9a5 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -857,7 +857,8 @@ func Provider() *schema.Provider { "ibm_code_engine_secret": codeengine.DataSourceIbmCodeEngineSecret(), // Added for Project - "ibm_project_event_notification": project.DataSourceIbmProjectEventNotification(), + "ibm_project": project.DataSourceIbmProject(), + "ibm_project_config": project.DataSourceIbmProjectConfig(), }, ResourcesMap: map[string]*schema.Resource{ @@ -1369,7 +1370,8 @@ func Provider() *schema.Provider { "ibm_code_engine_secret": codeengine.ResourceIbmCodeEngineSecret(), // Added for Project - "ibm_project_instance": project.ResourceIbmProjectInstance(), + "ibm_project": project.ResourceIbmProject(), + "ibm_project_config": project.ResourceIbmProjectConfig(), }, ConfigureFunc: providerConfigure, @@ -1625,7 +1627,8 @@ func Validator() validate.ValidatorDict { "ibm_code_engine_secret": codeengine.ResourceIbmCodeEngineSecretValidator(), // Added for Project - "ibm_project_instance": project.ResourceIbmProjectInstanceValidator(), + "ibm_project": project.ResourceIbmProjectValidator(), + "ibm_project_config": project.ResourceIbmProjectConfigValidator(), }, DataSourceValidatorDictionary: map[string]*validate.ResourceValidator{ "ibm_is_subnet": vpc.DataSourceIBMISSubnetValidator(), diff --git a/ibm/service/project/data_source_ibm_project.go b/ibm/service/project/data_source_ibm_project.go new file mode 100644 index 0000000000..277d769e3a --- /dev/null +++ b/ibm/service/project/data_source_ibm_project.go @@ -0,0 +1,532 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package project + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/project-go-sdk/projectv1" +) + +func DataSourceIbmProject() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmProjectRead, + + Schema: map[string]*schema.Schema{ + "project_id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique project ID.", + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "An IBM Cloud resource name, which uniquely identifies a resource.", + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "cumulative_needs_attention_view": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The cumulative list of needs attention items for a project. If the view is successfully retrieved, an array which could be empty is returned.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "event": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The event name.", + }, + "event_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A unique ID for that individual event.", + }, + "config_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A unique ID for the configuration.", + }, + "config_version": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The version number of the configuration.", + }, + }, + }, + }, + "cumulative_needs_attention_view_error": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "True indicates that the fetch of the needs attention items failed. It only exists if there was an error while retrieving the cumulative needs attention view.", + }, + "location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IBM Cloud location where a resource is deployed.", + }, + "resource_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource group where the project's data and tools are created.", + }, + "state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The project status value.", + }, + "event_notifications_crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN of the event notifications instance if one is connected to this project.", + }, + "configs": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The project configurations. These configurations are only included in the response of creating a project if a configs array is specified in the request payload.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration.", + }, + "version": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The version of the configuration.", + }, + "state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The state of the configuration.", + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "modified_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A URL.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The name and description of a project configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The configuration name.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A project configuration description.", + }, + }, + }, + }, + "project": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The project referenced by this resource.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique ID.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The definition of the project reference.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the project.", + }, + }, + }, + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "An IBM Cloud resource name, which uniquely identifies a resource.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A URL.", + }, + }, + }, + }, + }, + }, + }, + "environments": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The project environments. These environments are only included in the response if project environments were created on the project.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The environment id as a friendly name.", + }, + "project": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The project referenced by this resource.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique ID.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The definition of the project reference.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the project.", + }, + }, + }, + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "An IBM Cloud resource name, which uniquely identifies a resource.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A URL.", + }, + }, + }, + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A URL.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The environment definition used in the project collection.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the environment.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The description of the environment.", + }, + }, + }, + }, + }, + }, + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The definition of the project.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the project.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A brief explanation of the project's use in the configuration of a deployable architecture. It is possible to create a project without providing a description.", + }, + "destroy_on_delete": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "The policy that indicates whether the resources are destroyed or not when a project is deleted.", + }, + }, + }, + }, + }, + } +} + +func dataSourceIbmProjectRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + getProjectOptions := &projectv1.GetProjectOptions{} + + getProjectOptions.SetID(d.Get("project_id").(string)) + + project, response, err := projectClient.GetProjectWithContext(context, getProjectOptions) + if err != nil { + log.Printf("[DEBUG] GetProjectWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetProjectWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s", *getProjectOptions.ID)) + + if err = d.Set("crn", project.Crn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting crn: %s", err)) + } + + if err = d.Set("created_at", flex.DateTimeToString(project.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + + cumulativeNeedsAttentionView := []map[string]interface{}{} + if project.CumulativeNeedsAttentionView != nil { + for _, modelItem := range project.CumulativeNeedsAttentionView { + modelMap, err := dataSourceIbmProjectCumulativeNeedsAttentionToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + cumulativeNeedsAttentionView = append(cumulativeNeedsAttentionView, modelMap) + } + } + if err = d.Set("cumulative_needs_attention_view", cumulativeNeedsAttentionView); err != nil { + return diag.FromErr(fmt.Errorf("Error setting cumulative_needs_attention_view %s", err)) + } + + if err = d.Set("cumulative_needs_attention_view_error", project.CumulativeNeedsAttentionViewError); err != nil { + return diag.FromErr(fmt.Errorf("Error setting cumulative_needs_attention_view_error: %s", err)) + } + + if err = d.Set("location", project.Location); err != nil { + return diag.FromErr(fmt.Errorf("Error setting location: %s", err)) + } + + if err = d.Set("resource_group", project.ResourceGroup); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_group: %s", err)) + } + + if err = d.Set("state", project.State); err != nil { + return diag.FromErr(fmt.Errorf("Error setting state: %s", err)) + } + + if err = d.Set("event_notifications_crn", project.EventNotificationsCrn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting event_notifications_crn: %s", err)) + } + + configs := []map[string]interface{}{} + if project.Configs != nil { + for _, modelItem := range project.Configs { + modelMap, err := dataSourceIbmProjectProjectConfigCollectionMemberToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + configs = append(configs, modelMap) + } + } + if err = d.Set("configs", configs); err != nil { + return diag.FromErr(fmt.Errorf("Error setting configs %s", err)) + } + + environments := []map[string]interface{}{} + if project.Environments != nil { + for _, modelItem := range project.Environments { + modelMap, err := dataSourceIbmProjectProjectEnvironmentCollectionMemberToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + environments = append(environments, modelMap) + } + } + if err = d.Set("environments", environments); err != nil { + return diag.FromErr(fmt.Errorf("Error setting environments %s", err)) + } + + definition := []map[string]interface{}{} + if project.Definition != nil { + modelMap, err := dataSourceIbmProjectProjectDefinitionPropertiesToMap(project.Definition) + if err != nil { + return diag.FromErr(err) + } + definition = append(definition, modelMap) + } + if err = d.Set("definition", definition); err != nil { + return diag.FromErr(fmt.Errorf("Error setting definition %s", err)) + } + + return nil +} + +func dataSourceIbmProjectCumulativeNeedsAttentionToMap(model *projectv1.CumulativeNeedsAttention) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Event != nil { + modelMap["event"] = model.Event + } + if model.EventID != nil { + modelMap["event_id"] = model.EventID + } + if model.ConfigID != nil { + modelMap["config_id"] = model.ConfigID + } + if model.ConfigVersion != nil { + modelMap["config_version"] = flex.IntValue(model.ConfigVersion) + } + return modelMap, nil +} + +func dataSourceIbmProjectProjectConfigCollectionMemberToMap(model *projectv1.ProjectConfigCollectionMember) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ApprovedVersion != nil { + approvedVersionMap, err := dataSourceIbmProjectProjectConfigVersionSummaryToMap(model.ApprovedVersion) + if err != nil { + return modelMap, err + } + modelMap["approved_version"] = []map[string]interface{}{approvedVersionMap} + } + if model.DeployedVersion != nil { + deployedVersionMap, err := dataSourceIbmProjectProjectConfigVersionSummaryToMap(model.DeployedVersion) + if err != nil { + return modelMap, err + } + modelMap["deployed_version"] = []map[string]interface{}{deployedVersionMap} + } + modelMap["id"] = model.ID + modelMap["version"] = flex.IntValue(model.Version) + modelMap["state"] = model.State + if model.CreatedAt != nil { + modelMap["created_at"] = model.CreatedAt.String() + } + if model.ModifiedAt != nil { + modelMap["modified_at"] = model.ModifiedAt.String() + } + modelMap["href"] = model.Href + definitionMap, err := dataSourceIbmProjectProjectConfigDefinitionNameDescriptionToMap(model.Definition) + if err != nil { + return modelMap, err + } + modelMap["definition"] = []map[string]interface{}{definitionMap} + projectMap, err := dataSourceIbmProjectProjectReferenceToMap(model.Project) + if err != nil { + return modelMap, err + } + modelMap["project"] = []map[string]interface{}{projectMap} + return modelMap, nil +} + +func dataSourceIbmProjectProjectConfigVersionSummaryToMap(model *projectv1.ProjectConfigVersionSummary) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["state"] = model.State + modelMap["version"] = flex.IntValue(model.Version) + modelMap["href"] = model.Href + return modelMap, nil +} + +func dataSourceIbmProjectProjectConfigDefinitionNameDescriptionToMap(model *projectv1.ProjectConfigDefinitionNameDescription) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Name != nil { + modelMap["name"] = model.Name + } + if model.Description != nil { + modelMap["description"] = model.Description + } + return modelMap, nil +} + +func dataSourceIbmProjectProjectReferenceToMap(model *projectv1.ProjectReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + definitionMap, err := dataSourceIbmProjectProjectDefinitionReferenceToMap(model.Definition) + if err != nil { + return modelMap, err + } + modelMap["definition"] = []map[string]interface{}{definitionMap} + modelMap["crn"] = model.Crn + modelMap["href"] = model.Href + return modelMap, nil +} + +func dataSourceIbmProjectProjectDefinitionReferenceToMap(model *projectv1.ProjectDefinitionReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + return modelMap, nil +} + +func dataSourceIbmProjectProjectEnvironmentCollectionMemberToMap(model *projectv1.ProjectEnvironmentCollectionMember) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + projectMap, err := dataSourceIbmProjectProjectReferenceToMap(model.Project) + if err != nil { + return modelMap, err + } + modelMap["project"] = []map[string]interface{}{projectMap} + modelMap["created_at"] = model.CreatedAt.String() + modelMap["href"] = model.Href + definitionMap, err := dataSourceIbmProjectEnvironmentDefinitionNameDescriptionToMap(model.Definition) + if err != nil { + return modelMap, err + } + modelMap["definition"] = []map[string]interface{}{definitionMap} + return modelMap, nil +} + +func dataSourceIbmProjectEnvironmentDefinitionNameDescriptionToMap(model *projectv1.EnvironmentDefinitionNameDescription) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Name != nil { + modelMap["name"] = model.Name + } + if model.Description != nil { + modelMap["description"] = model.Description + } + return modelMap, nil +} + +func dataSourceIbmProjectProjectDefinitionPropertiesToMap(model *projectv1.ProjectDefinitionProperties) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + if model.Description != nil { + modelMap["description"] = model.Description + } + modelMap["destroy_on_delete"] = model.DestroyOnDelete + return modelMap, nil +} diff --git a/ibm/service/project/data_source_ibm_project_config.go b/ibm/service/project/data_source_ibm_project_config.go new file mode 100644 index 0000000000..e064294568 --- /dev/null +++ b/ibm/service/project/data_source_ibm_project_config.go @@ -0,0 +1,494 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package project + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/project-go-sdk/projectv1" +) + +func DataSourceIbmProjectConfig() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmProjectConfigRead, + + Schema: map[string]*schema.Schema{ + "project_id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique project ID.", + }, + "project_config_id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique config ID.", + }, + "version": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The version of the configuration.", + }, + "is_draft": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "The flag that indicates whether the version of the configuration is draft, or active.", + }, + "needs_attention_state": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The needs attention state of a configuration.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "modified_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "last_saved_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "outputs": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The outputs of a Schematics template property.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The variable name.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A short explanation of the output value.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Can be any value - a string, number, boolean, array, or object.", + }, + }, + }, + }, + "project": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The project referenced by this resource.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique ID.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The definition of the project reference.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the project.", + }, + }, + }, + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "An IBM Cloud resource name, which uniquely identifies a resource.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A URL.", + }, + }, + }, + }, + "schematics": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A schematics workspace associated to a project configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "workspace_crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "An existing schematics workspace CRN.", + }, + }, + }, + }, + "state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The state of the configuration.", + }, + "update_available": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "The flag that indicates whether a configuration update is available.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The type and output of a project configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The configuration name.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A project configuration description.", + }, + "environment": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The ID of the project environment.", + }, + "authorizations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "trusted_profile_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The trusted profile ID.", + }, + "method": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The authorization method. You can authorize by using a trusted profile or an API key in Secrets Manager.", + }, + "api_key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IBM Cloud API Key.", + }, + }, + }, + }, + "compliance_profile": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The profile required for compliance.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique ID.", + }, + "instance_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique ID.", + }, + "instance_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The location of the compliance instance.", + }, + "attachment_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique ID.", + }, + "profile_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the compliance profile.", + }, + }, + }, + }, + "locator_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A dotted value of catalogID.versionID.", + }, + "inputs": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The input variables for configuration definition and environment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, + }, + }, + "settings": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Schematics environment variables to use to deploy the configuration.Settings are only available if they were specified when the configuration was initially created.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of a project configuration manual property.", + }, + }, + }, + }, + }, + } +} + +func dataSourceIbmProjectConfigRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + getConfigOptions := &projectv1.GetConfigOptions{} + + getConfigOptions.SetProjectID(d.Get("project_id").(string)) + getConfigOptions.SetID(d.Get("project_config_id").(string)) + + projectConfig, response, err := projectClient.GetConfigWithContext(context, getConfigOptions) + if err != nil { + log.Printf("[DEBUG] GetConfigWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetConfigWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s/%s", *getConfigOptions.ProjectID, *getConfigOptions.ID)) + + if err = d.Set("version", flex.IntValue(projectConfig.Version)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting version: %s", err)) + } + + if err = d.Set("is_draft", projectConfig.IsDraft); err != nil { + return diag.FromErr(fmt.Errorf("Error setting is_draft: %s", err)) + } + + if err = d.Set("needs_attention_state", projectConfig.NeedsAttentionState); err != nil { + return diag.FromErr(fmt.Errorf("Error setting needs_attention_state: %s", err)) + } + + if err = d.Set("created_at", flex.DateTimeToString(projectConfig.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + + if err = d.Set("modified_at", flex.DateTimeToString(projectConfig.ModifiedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting modified_at: %s", err)) + } + + if err = d.Set("last_saved_at", flex.DateTimeToString(projectConfig.LastSavedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting last_saved_at: %s", err)) + } + + outputs := []map[string]interface{}{} + if projectConfig.Outputs != nil { + for _, modelItem := range projectConfig.Outputs { + modelMap, err := dataSourceIbmProjectConfigOutputValueToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + outputs = append(outputs, modelMap) + } + } + if err = d.Set("outputs", outputs); err != nil { + return diag.FromErr(fmt.Errorf("Error setting outputs %s", err)) + } + + project := []map[string]interface{}{} + if projectConfig.Project != nil { + modelMap, err := dataSourceIbmProjectConfigProjectReferenceToMap(projectConfig.Project) + if err != nil { + return diag.FromErr(err) + } + project = append(project, modelMap) + } + if err = d.Set("project", project); err != nil { + return diag.FromErr(fmt.Errorf("Error setting project %s", err)) + } + + schematics := []map[string]interface{}{} + if projectConfig.Schematics != nil { + modelMap, err := dataSourceIbmProjectConfigSchematicsWorkspaceToMap(projectConfig.Schematics) + if err != nil { + return diag.FromErr(err) + } + schematics = append(schematics, modelMap) + } + if err = d.Set("schematics", schematics); err != nil { + return diag.FromErr(fmt.Errorf("Error setting schematics %s", err)) + } + + if err = d.Set("state", projectConfig.State); err != nil { + return diag.FromErr(fmt.Errorf("Error setting state: %s", err)) + } + + if err = d.Set("update_available", projectConfig.UpdateAvailable); err != nil { + return diag.FromErr(fmt.Errorf("Error setting update_available: %s", err)) + } + + definition := []map[string]interface{}{} + if projectConfig.Definition != nil { + modelMap, err := dataSourceIbmProjectConfigProjectConfigResponseDefinitionToMap(projectConfig.Definition) + if err != nil { + return diag.FromErr(err) + } + definition = append(definition, modelMap) + } + if err = d.Set("definition", definition); err != nil { + return diag.FromErr(fmt.Errorf("Error setting definition %s", err)) + } + + return nil +} + +func dataSourceIbmProjectConfigOutputValueToMap(model *projectv1.OutputValue) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + if model.Description != nil { + modelMap["description"] = model.Description + } + if model.Value != nil { + modelMap["value"] = model.Value + } + return modelMap, nil +} + +func dataSourceIbmProjectConfigProjectReferenceToMap(model *projectv1.ProjectReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + definitionMap, err := dataSourceIbmProjectConfigProjectDefinitionReferenceToMap(model.Definition) + if err != nil { + return modelMap, err + } + modelMap["definition"] = []map[string]interface{}{definitionMap} + modelMap["crn"] = model.Crn + modelMap["href"] = model.Href + return modelMap, nil +} + +func dataSourceIbmProjectConfigProjectDefinitionReferenceToMap(model *projectv1.ProjectDefinitionReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + return modelMap, nil +} + +func dataSourceIbmProjectConfigSchematicsWorkspaceToMap(model *projectv1.SchematicsWorkspace) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.WorkspaceCrn != nil { + modelMap["workspace_crn"] = model.WorkspaceCrn + } + return modelMap, nil +} + +func dataSourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *projectv1.ProjectConfigResponseDefinition) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + if model.Description != nil { + modelMap["description"] = model.Description + } + if model.Environment != nil { + modelMap["environment"] = model.Environment + } + if model.Authorizations != nil { + authorizationsMap, err := dataSourceIbmProjectConfigProjectConfigAuthToMap(model.Authorizations) + if err != nil { + return modelMap, err + } + modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} + } + if model.ComplianceProfile != nil { + complianceProfileMap, err := dataSourceIbmProjectConfigProjectComplianceProfileToMap(model.ComplianceProfile) + if err != nil { + return modelMap, err + } + modelMap["compliance_profile"] = []map[string]interface{}{complianceProfileMap} + } + modelMap["locator_id"] = model.LocatorID + if model.Inputs != nil { + inputsMap, err := dataSourceIbmProjectConfigInputVariableToMap(model.Inputs) + if err != nil { + return modelMap, err + } + modelMap["inputs"] = []map[string]interface{}{inputsMap} + } + if model.Settings != nil { + settingsMap, err := dataSourceIbmProjectConfigProjectConfigSettingToMap(model.Settings) + if err != nil { + return modelMap, err + } + modelMap["settings"] = []map[string]interface{}{settingsMap} + } + if model.Type != nil { + modelMap["type"] = model.Type + } + return modelMap, nil +} + +func dataSourceIbmProjectConfigProjectConfigAuthToMap(model *projectv1.ProjectConfigAuth) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.TrustedProfileID != nil { + modelMap["trusted_profile_id"] = model.TrustedProfileID + } + if model.Method != nil { + modelMap["method"] = model.Method + } + if model.ApiKey != nil { + modelMap["api_key"] = model.ApiKey + } + return modelMap, nil +} + +func dataSourceIbmProjectConfigProjectComplianceProfileToMap(model *projectv1.ProjectComplianceProfile) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ID != nil { + modelMap["id"] = model.ID + } + if model.InstanceID != nil { + modelMap["instance_id"] = model.InstanceID + } + if model.InstanceLocation != nil { + modelMap["instance_location"] = model.InstanceLocation + } + if model.AttachmentID != nil { + modelMap["attachment_id"] = model.AttachmentID + } + if model.ProfileName != nil { + modelMap["profile_name"] = model.ProfileName + } + return modelMap, nil +} + +func dataSourceIbmProjectConfigInputVariableToMap(model *projectv1.InputVariable) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + return modelMap, nil +} + +func dataSourceIbmProjectConfigProjectConfigSettingToMap(model *projectv1.ProjectConfigSetting) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + return modelMap, nil +} diff --git a/ibm/service/project/data_source_ibm_project_config_test.go b/ibm/service/project/data_source_ibm_project_config_test.go new file mode 100644 index 0000000000..785e6ff684 --- /dev/null +++ b/ibm/service/project/data_source_ibm_project_config_test.go @@ -0,0 +1,74 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package project_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmProjectConfigDataSourceBasic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmProjectConfigDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "project_id"), + resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "project_config_id"), + resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "version"), + resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "is_draft"), + resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "modified_at"), + resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "project.#"), + resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "state"), + resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "update_available"), + resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "definition.#"), + ), + }, + }, + }) +} + +func testAccCheckIbmProjectConfigDataSourceConfigBasic() string { + return fmt.Sprintf(` + resource "ibm_project" "project_instance" { + location = "us-south" + resource_group = "Default" + definition { + name = "acme-microservice" + description = "acme-microservice description" + destroy_on_delete = true + } + } + + resource "ibm_project_config" "project_config_instance" { + project_id = ibm_project.project_instance.id + definition { + name = "stage-environment" + authorizations { + method = "api_key" + api_key = "%s" + } + locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.cd596f95-95a2-4f21-9b84-477f21fd1e95-global" + } + lifecycle { + ignore_changes = [ + definition[0].authorizations[0].api_key, + ] + } + } + + data "ibm_project_config" "project_config_instance" { + project_id = ibm_project_config.project_config_instance.project_id + project_config_id = ibm_project_config.project_config_instance.project_config_id + } + `, acc.ProjectsConfigApiKey) +} diff --git a/ibm/service/project/data_source_ibm_project_event_notification.go b/ibm/service/project/data_source_ibm_project_event_notification.go deleted file mode 100644 index 7ffac8fd48..0000000000 --- a/ibm/service/project/data_source_ibm_project_event_notification.go +++ /dev/null @@ -1,444 +0,0 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package project - -import ( - "context" - "fmt" - "log" - - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" - "github.com/IBM/project-go-sdk/projectv1" -) - -func DataSourceIbmProjectEventNotification() *schema.Resource { - return &schema.Resource{ - ReadContext: dataSourceIbmProjectEventNotificationRead, - - Schema: map[string]*schema.Schema{ - "project_id": &schema.Schema{ - Type: schema.TypeString, - Required: true, - Description: "The unique project ID.", - }, - "name": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The project name.", - }, - "description": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "A project descriptive text.", - }, - "crn": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "An IBM Cloud resource name, which uniquely identifies a resource.", - }, - "configs": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "The project configurations.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration.", - }, - "name": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The configuration name.", - }, - "labels": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "A collection of configuration labels.", - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "description": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The project configuration description.", - }, - "locator_id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "A dotted value of catalogID.versionID.", - }, - "type": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The type of a project configuration manual property.", - }, - "input": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "The outputs of a Schematics template property.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The variable name.", - }, - "type": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The variable type.", - }, - "value": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Can be any value - a string, number, boolean, array, or object.", - }, - "required": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Whether the variable is required or not.", - }, - }, - }, - }, - "output": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "The outputs of a Schematics template property.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The variable name.", - }, - "description": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "A short explanation of the output value.", - }, - "value": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Can be any value - a string, number, boolean, array, or object.", - }, - }, - }, - }, - "setting": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "Schematics environment variables to use to deploy the configuration.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The name of the configuration setting.", - }, - "value": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The value of the configuration setting.", - }, - }, - }, - }, - }, - }, - }, - "metadata": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "The metadata of the project.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "crn": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "An IBM Cloud resource name, which uniquely identifies a resource.", - }, - "created_at": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", - }, - "cumulative_needs_attention_view": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "The cumulative list of needs attention items for a project.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "event": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The event name.", - }, - "event_id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The unique ID of a project.", - }, - "config_id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The unique ID of a project.", - }, - "config_version": &schema.Schema{ - Type: schema.TypeInt, - Computed: true, - Description: "The version number of the configuration.", - }, - }, - }, - }, - "cumulative_needs_attention_view_err": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "True indicates that the fetch of the needs attention items failed.", - }, - "location": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The IBM Cloud location where a resource is deployed.", - }, - "resource_group": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The resource group where the project's data and tools are created.", - }, - "state": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The project status value.", - }, - "event_notifications_crn": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The CRN of the event notifications instance if one is connected to this project.", - }, - }, - }, - }, - }, - } -} - -func dataSourceIbmProjectEventNotificationRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - projectClient, err := meta.(conns.ClientSession).ProjectV1() - if err != nil { - return diag.FromErr(err) - } - - getProjectOptions := &projectv1.GetProjectOptions{} - - getProjectOptions.SetID(d.Get("project_id").(string)) - - project, response, err := projectClient.GetProjectWithContext(context, getProjectOptions) - if err != nil { - log.Printf("[DEBUG] GetProjectWithContext failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("GetProjectWithContext failed %s\n%s", err, response)) - } - - d.SetId(fmt.Sprintf("%s", *getProjectOptions.ID)) - - if err = d.Set("name", project.Name); err != nil { - return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) - } - - if err = d.Set("description", project.Description); err != nil { - return diag.FromErr(fmt.Errorf("Error setting description: %s", err)) - } - - if err = d.Set("crn", project.Crn); err != nil { - return diag.FromErr(fmt.Errorf("Error setting crn: %s", err)) - } - - configs := []map[string]interface{}{} - if project.Configs != nil { - for _, modelItem := range project.Configs { - modelMap, err := dataSourceIbmProjectEventNotificationProjectConfigToMap(&modelItem) - if err != nil { - return diag.FromErr(err) - } - configs = append(configs, modelMap) - } - } - if err = d.Set("configs", configs); err != nil { - return diag.FromErr(fmt.Errorf("Error setting configs %s", err)) - } - - metadata := []map[string]interface{}{} - if project.Metadata != nil { - modelMap, err := dataSourceIbmProjectEventNotificationProjectMetadataToMap(project.Metadata) - if err != nil { - return diag.FromErr(err) - } - metadata = append(metadata, modelMap) - } - if err = d.Set("metadata", metadata); err != nil { - return diag.FromErr(fmt.Errorf("Error setting metadata %s", err)) - } - - return nil -} - -func dataSourceIbmProjectEventNotificationProjectConfigToMap(model *projectv1.ProjectConfig) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - if model.ID != nil { - modelMap["project_id"] = model.ID - } - if model.Name != nil { - modelMap["name"] = model.Name - } - if model.Labels != nil { - modelMap["labels"] = model.Labels - } - if model.Description != nil { - modelMap["description"] = model.Description - } - if model.LocatorID != nil { - modelMap["locator_id"] = model.LocatorID - } - if model.Type != nil { - modelMap["type"] = model.Type - } - if model.Input != nil { - input := []map[string]interface{}{} - for _, inputItem := range model.Input { - inputItemMap, err := dataSourceIbmProjectEventNotificationInputVariableToMap(&inputItem) - if err != nil { - return modelMap, err - } - input = append(input, inputItemMap) - } - modelMap["input"] = input - } - if model.Output != nil { - output := []map[string]interface{}{} - for _, outputItem := range model.Output { - outputItemMap, err := dataSourceIbmProjectEventNotificationOutputValueToMap(&outputItem) - if err != nil { - return modelMap, err - } - output = append(output, outputItemMap) - } - modelMap["output"] = output - } - if model.Setting != nil { - setting := []map[string]interface{}{} - for _, settingItem := range model.Setting { - settingItemMap, err := dataSourceIbmProjectEventNotificationProjectConfigSettingCollectionToMap(&settingItem) - if err != nil { - return modelMap, err - } - setting = append(setting, settingItemMap) - } - modelMap["setting"] = setting - } - return modelMap, nil -} - -func dataSourceIbmProjectEventNotificationInputVariableToMap(model *projectv1.InputVariable) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - if model.Name != nil { - modelMap["name"] = model.Name - } - if model.Type != nil { - modelMap["type"] = model.Type - } - if model.Value != nil { - modelMap["value"] = model.Value - } - if model.Required != nil { - modelMap["required"] = model.Required - } - return modelMap, nil -} - -func dataSourceIbmProjectEventNotificationOutputValueToMap(model *projectv1.OutputValue) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - if model.Name != nil { - modelMap["name"] = model.Name - } - if model.Description != nil { - modelMap["description"] = model.Description - } - if model.Value != nil { - modelMap["value"] = model.Value - } - return modelMap, nil -} - -func dataSourceIbmProjectEventNotificationProjectConfigSettingCollectionToMap(model *projectv1.ProjectConfigSettingCollection) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - if model.Name != nil { - modelMap["name"] = model.Name - } - if model.Value != nil { - modelMap["value"] = model.Value - } - return modelMap, nil -} - -func dataSourceIbmProjectEventNotificationProjectMetadataToMap(model *projectv1.ProjectMetadata) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - if model.Crn != nil { - modelMap["crn"] = model.Crn - } - if model.CreatedAt != nil { - modelMap["created_at"] = model.CreatedAt.String() - } - if model.CumulativeNeedsAttentionView != nil { - cumulativeNeedsAttentionView := []map[string]interface{}{} - for _, cumulativeNeedsAttentionViewItem := range model.CumulativeNeedsAttentionView { - cumulativeNeedsAttentionViewItemMap, err := dataSourceIbmProjectEventNotificationCumulativeNeedsAttentionToMap(&cumulativeNeedsAttentionViewItem) - if err != nil { - return modelMap, err - } - cumulativeNeedsAttentionView = append(cumulativeNeedsAttentionView, cumulativeNeedsAttentionViewItemMap) - } - modelMap["cumulative_needs_attention_view"] = cumulativeNeedsAttentionView - } - if model.CumulativeNeedsAttentionViewErr != nil { - modelMap["cumulative_needs_attention_view_err"] = model.CumulativeNeedsAttentionViewErr - } - if model.Location != nil { - modelMap["location"] = model.Location - } - if model.ResourceGroup != nil { - modelMap["resource_group"] = model.ResourceGroup - } - if model.State != nil { - modelMap["state"] = model.State - } - if model.EventNotificationsCrn != nil { - modelMap["event_notifications_crn"] = model.EventNotificationsCrn - } - return modelMap, nil -} - -func dataSourceIbmProjectEventNotificationCumulativeNeedsAttentionToMap(model *projectv1.CumulativeNeedsAttention) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - if model.Event != nil { - modelMap["event"] = model.Event - } - if model.EventID != nil { - modelMap["event_id"] = model.EventID - } - if model.ConfigID != nil { - modelMap["config_id"] = model.ConfigID - } - if model.ConfigVersion != nil { - modelMap["config_version"] = flex.IntValue(model.ConfigVersion) - } - return modelMap, nil -} diff --git a/ibm/service/project/data_source_ibm_project_event_notification_test.go b/ibm/service/project/data_source_ibm_project_event_notification_test.go deleted file mode 100644 index a4bb083448..0000000000 --- a/ibm/service/project/data_source_ibm_project_event_notification_test.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package project_test - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - - acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" -) - -func TestAccIbmProjectEventNotificationDataSourceBasic(t *testing.T) { - projectName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - projectResourceGroup := fmt.Sprintf("Default") - projectLocation := fmt.Sprintf("us-south") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIbmProjectEventNotificationDataSourceConfigBasic(projectResourceGroup, projectLocation, projectName), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_project_event_notification.project_event_notification", "project_id"), - resource.TestCheckResourceAttrSet("data.ibm_project_event_notification.project_event_notification", "name"), - ), - }, - }, - }) -} - -func TestAccIbmProjectEventNotificationDataSourceAllArgs(t *testing.T) { - projectName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - projectDescription := fmt.Sprintf("tf_description_%d", acctest.RandIntRange(10, 100)) - projectResourceGroup := fmt.Sprintf("Default") - projectLocation := fmt.Sprintf("us-south") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIbmProjectEventNotificationDataSourceConfig(projectName, projectDescription, projectResourceGroup, projectLocation), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_project_event_notification.project_event_notification", "project_id"), - resource.TestCheckResourceAttrSet("data.ibm_project_event_notification.project_event_notification", "name"), - resource.TestCheckResourceAttrSet("data.ibm_project_event_notification.project_event_notification", "description"), - resource.TestCheckResourceAttrSet("data.ibm_project_event_notification.project_event_notification", "metadata.#"), - ), - }, - }, - }) -} - -func testAccCheckIbmProjectEventNotificationDataSourceConfigBasic(projectResourceGroup string, projectLocation string, projectName string) string { - return fmt.Sprintf(` - resource "ibm_project_instance" "project_instance" { - resource_group = "%s" - location = "%s" - name = "%s" - } - - data "ibm_project_event_notification" "project_event_notification" { - project_id = ibm_project_instance.project_instance.id - } - `, projectResourceGroup, projectLocation, projectName) -} - -func testAccCheckIbmProjectEventNotificationDataSourceConfig(projectName string, projectDescription string, projectResourceGroup string, projectLocation string) string { - return fmt.Sprintf(` - resource "ibm_project_instance" "project_instance" { - name = "%s" - description = "%s" - configs { - name = "name" - labels = [ "labels" ] - description = "description" - locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.cd596f95-95a2-4f21-9b84-477f21fd1e95-global" - input { - name = "name" - } - setting { - name = "name" - value = "value" - } - } - resource_group = "%s" - location = "%s" - } - - data "ibm_project_event_notification" "project_event_notification" { - project_id = ibm_project_instance.project_instance.id - } - `, projectName, projectDescription, projectResourceGroup, projectLocation) -} diff --git a/ibm/service/project/data_source_ibm_project_test.go b/ibm/service/project/data_source_ibm_project_test.go new file mode 100644 index 0000000000..062bc5fefe --- /dev/null +++ b/ibm/service/project/data_source_ibm_project_test.go @@ -0,0 +1,56 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package project_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmProjectDataSourceBasic(t *testing.T) { + projectLocation := fmt.Sprintf("us-south") + projectResourceGroup := fmt.Sprintf("Default") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmProjectDataSourceConfigBasic(projectLocation, projectResourceGroup), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "project_id"), + resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "crn"), + resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "location"), + resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "resource_group"), + resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "state"), + resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "definition.#"), + ), + }, + }, + }) +} + +func testAccCheckIbmProjectDataSourceConfigBasic(projectLocation string, projectResourceGroup string) string { + return fmt.Sprintf(` + resource "ibm_project" "project_instance" { + location = "%s" + resource_group = "%s" + definition { + name = "acme-microservice" + description = "acme-microservice description" + destroy_on_delete = true + } + } + + data "ibm_project" "project_instance" { + project_id = ibm_project.project_instance.id + } + `, projectLocation, projectResourceGroup) +} diff --git a/ibm/service/project/resource_ibm_project.go b/ibm/service/project/resource_ibm_project.go new file mode 100644 index 0000000000..9b5242752d --- /dev/null +++ b/ibm/service/project/resource_ibm_project.go @@ -0,0 +1,787 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package project + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/project-go-sdk/projectv1" +) + +func ResourceIbmProject() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIbmProjectCreate, + ReadContext: resourceIbmProjectRead, + UpdateContext: resourceIbmProjectUpdate, + DeleteContext: resourceIbmProjectDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "location": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_project", "location"), + Description: "The IBM Cloud location where a resource is deployed.", + }, + "resource_group": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The resource group where the project's data and tools are created.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Required: true, + Description: "The definition of the project.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The name of the project.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "A brief explanation of the project's use in the configuration of a deployable architecture. It is possible to create a project without providing a description.", + }, + "destroy_on_delete": &schema.Schema{ + Type: schema.TypeBool, + Required: true, + Description: "The policy that indicates whether the resources are destroyed or not when a project is deleted.", + }, + }, + }, + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "An IBM Cloud resource name, which uniquely identifies a resource.", + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "cumulative_needs_attention_view": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The cumulative list of needs attention items for a project. If the view is successfully retrieved, an array which could be empty is returned.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "event": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The event name.", + }, + "event_id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "A unique ID for that individual event.", + }, + "config_id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "A unique ID for the configuration.", + }, + "config_version": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + Description: "The version number of the configuration.", + }, + }, + }, + }, + "cumulative_needs_attention_view_error": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "True indicates that the fetch of the needs attention items failed. It only exists if there was an error while retrieving the cumulative needs attention view.", + }, + "state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The project status value.", + }, + "event_notifications_crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN of the event notifications instance if one is connected to this project.", + }, + "configs": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The project configurations. These configurations are only included in the response of creating a project if a configs array is specified in the request payload.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration.", + }, + "version": &schema.Schema{ + Type: schema.TypeInt, + Required: true, + Description: "The version of the configuration.", + }, + "state": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The state of the configuration.", + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "modified_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "A URL.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Required: true, + Description: "The name and description of a project configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The configuration name.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "A project configuration description.", + }, + }, + }, + }, + "project": &schema.Schema{ + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Required: true, + Description: "The project referenced by this resource.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique ID.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Required: true, + Description: "The definition of the project reference.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The name of the project.", + }, + }, + }, + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "An IBM Cloud resource name, which uniquely identifies a resource.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "A URL.", + }, + }, + }, + }, + }, + }, + }, + "environments": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The project environments. These environments are only included in the response if project environments were created on the project.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The environment id as a friendly name.", + }, + "project": &schema.Schema{ + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Required: true, + Description: "The project referenced by this resource.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique ID.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Required: true, + Description: "The definition of the project reference.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The name of the project.", + }, + }, + }, + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "An IBM Cloud resource name, which uniquely identifies a resource.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "A URL.", + }, + }, + }, + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "A URL.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Required: true, + Description: "The environment definition used in the project collection.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the environment.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The description of the environment.", + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func ResourceIbmProjectValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "location", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^$|^(us-south|us-east|eu-gb|eu-de)$`, + MinValueLength: 0, + MaxValueLength: 12, + }, + validate.ValidateSchema{ + Identifier: "resource_group", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^(?!\s)(?!.*\s$)[^'"` + "`" + `<>{}\x00-\x1F]*$`, + MinValueLength: 0, + MaxValueLength: 64, + }, + ) + + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_project", Schema: validateSchema} + return &resourceValidator +} + +func resourceIbmProjectCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + createProjectOptions := &projectv1.CreateProjectOptions{} + + definitionModel, err := resourceIbmProjectMapToProjectPrototypeDefinition(d.Get("definition.0").(map[string]interface{})) + if err != nil { + return diag.FromErr(err) + } + createProjectOptions.SetDefinition(definitionModel) + createProjectOptions.SetLocation(d.Get("location").(string)) + createProjectOptions.SetResourceGroup(d.Get("resource_group").(string)) + + project, response, err := projectClient.CreateProjectWithContext(context, createProjectOptions) + if err != nil { + log.Printf("[DEBUG] CreateProjectWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CreateProjectWithContext failed %s\n%s", err, response)) + } + + d.SetId(*project.ID) + + return resourceIbmProjectRead(context, d, meta) +} + +func resourceIbmProjectRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + getProjectOptions := &projectv1.GetProjectOptions{} + + getProjectOptions.SetID(d.Id()) + + project, response, err := projectClient.GetProjectWithContext(context, getProjectOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetProjectWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetProjectWithContext failed %s\n%s", err, response)) + } + + if err = d.Set("location", project.Location); err != nil { + return diag.FromErr(fmt.Errorf("Error setting location: %s", err)) + } + if err = d.Set("resource_group", project.ResourceGroup); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_group: %s", err)) + } + definitionMap, err := resourceIbmProjectProjectDefinitionPropertiesToMap(project.Definition) + if err != nil { + return diag.FromErr(err) + } + if err = d.Set("definition", []map[string]interface{}{definitionMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting definition: %s", err)) + } + if err = d.Set("crn", project.Crn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting crn: %s", err)) + } + if err = d.Set("created_at", flex.DateTimeToString(project.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + if !core.IsNil(project.CumulativeNeedsAttentionView) { + cumulativeNeedsAttentionView := []map[string]interface{}{} + for _, cumulativeNeedsAttentionViewItem := range project.CumulativeNeedsAttentionView { + cumulativeNeedsAttentionViewItemMap, err := resourceIbmProjectCumulativeNeedsAttentionToMap(&cumulativeNeedsAttentionViewItem) + if err != nil { + return diag.FromErr(err) + } + cumulativeNeedsAttentionView = append(cumulativeNeedsAttentionView, cumulativeNeedsAttentionViewItemMap) + } + if err = d.Set("cumulative_needs_attention_view", cumulativeNeedsAttentionView); err != nil { + return diag.FromErr(fmt.Errorf("Error setting cumulative_needs_attention_view: %s", err)) + } + } + if !core.IsNil(project.CumulativeNeedsAttentionViewError) { + if err = d.Set("cumulative_needs_attention_view_error", project.CumulativeNeedsAttentionViewError); err != nil { + return diag.FromErr(fmt.Errorf("Error setting cumulative_needs_attention_view_error: %s", err)) + } + } + if err = d.Set("state", project.State); err != nil { + return diag.FromErr(fmt.Errorf("Error setting state: %s", err)) + } + if !core.IsNil(project.EventNotificationsCrn) { + if err = d.Set("event_notifications_crn", project.EventNotificationsCrn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting event_notifications_crn: %s", err)) + } + } + if !core.IsNil(project.Configs) { + configs := []map[string]interface{}{} + for _, configsItem := range project.Configs { + configsItemMap, err := resourceIbmProjectProjectConfigCollectionMemberToMap(&configsItem) + if err != nil { + return diag.FromErr(err) + } + configs = append(configs, configsItemMap) + } + if err = d.Set("configs", configs); err != nil { + return diag.FromErr(fmt.Errorf("Error setting configs: %s", err)) + } + } + if !core.IsNil(project.Environments) { + environments := []map[string]interface{}{} + for _, environmentsItem := range project.Environments { + environmentsItemMap, err := resourceIbmProjectProjectEnvironmentCollectionMemberToMap(&environmentsItem) + if err != nil { + return diag.FromErr(err) + } + environments = append(environments, environmentsItemMap) + } + if err = d.Set("environments", environments); err != nil { + return diag.FromErr(fmt.Errorf("Error setting environments: %s", err)) + } + } + + return nil +} + +func resourceIbmProjectUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + updateProjectOptions := &projectv1.UpdateProjectOptions{} + + updateProjectOptions.SetID(d.Id()) + + hasChange := false + + if d.HasChange("definition") { + definition, err := resourceIbmProjectMapToProjectPrototypePatchDefinitionBlock(d.Get("definition.0").(map[string]interface{})) + if err != nil { + return diag.FromErr(err) + } + updateProjectOptions.SetDefinition(definition) + hasChange = true + } + + if hasChange { + _, response, err := projectClient.UpdateProjectWithContext(context, updateProjectOptions) + if err != nil { + log.Printf("[DEBUG] UpdateProjectWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("UpdateProjectWithContext failed %s\n%s", err, response)) + } + } + + return resourceIbmProjectRead(context, d, meta) +} + +func resourceIbmProjectDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + deleteProjectOptions := &projectv1.DeleteProjectOptions{} + + deleteProjectOptions.SetID(d.Id()) + + response, err := projectClient.DeleteProjectWithContext(context, deleteProjectOptions) + if err != nil { + log.Printf("[DEBUG] DeleteProjectWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteProjectWithContext failed %s\n%s", err, response)) + } + + d.SetId("") + + return nil +} + +func resourceIbmProjectMapToProjectPrototypeDefinition(modelMap map[string]interface{}) (*projectv1.ProjectPrototypeDefinition, error) { + model := &projectv1.ProjectPrototypeDefinition{} + model.Name = core.StringPtr(modelMap["name"].(string)) + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["destroy_on_delete"] != nil { + model.DestroyOnDelete = core.BoolPtr(modelMap["destroy_on_delete"].(bool)) + } + return model, nil +} + +func resourceIbmProjectMapToProjectConfigPrototype(modelMap map[string]interface{}) (*projectv1.ProjectConfigPrototype, error) { + model := &projectv1.ProjectConfigPrototype{} + DefinitionModel, err := resourceIbmProjectMapToProjectConfigPrototypeDefinitionBlock(modelMap["definition"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Definition = DefinitionModel + if modelMap["schematics"] != nil && len(modelMap["schematics"].([]interface{})) > 0 { + SchematicsModel, err := resourceIbmProjectMapToSchematicsWorkspace(modelMap["schematics"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Schematics = SchematicsModel + } + return model, nil +} + +func resourceIbmProjectMapToProjectConfigPrototypeDefinitionBlock(modelMap map[string]interface{}) (*projectv1.ProjectConfigPrototypeDefinitionBlock, error) { + model := &projectv1.ProjectConfigPrototypeDefinitionBlock{} + model.Name = core.StringPtr(modelMap["name"].(string)) + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["environment"] != nil && modelMap["environment"].(string) != "" { + model.Environment = core.StringPtr(modelMap["environment"].(string)) + } + if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { + AuthorizationsModel, err := resourceIbmProjectMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Authorizations = AuthorizationsModel + } + if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { + ComplianceProfileModel, err := resourceIbmProjectMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.ComplianceProfile = ComplianceProfileModel + } + if modelMap["locator_id"] != nil && modelMap["locator_id"].(string) != "" { + model.LocatorID = core.StringPtr(modelMap["locator_id"].(string)) + } + if modelMap["inputs"] != nil && len(modelMap["inputs"].([]interface{})) > 0 { + InputsModel, err := resourceIbmProjectMapToInputVariable(modelMap["inputs"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Inputs = InputsModel + } + if modelMap["settings"] != nil && len(modelMap["settings"].([]interface{})) > 0 { + SettingsModel, err := resourceIbmProjectMapToProjectConfigSetting(modelMap["settings"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Settings = SettingsModel + } + return model, nil +} + +func resourceIbmProjectMapToProjectConfigAuth(modelMap map[string]interface{}) (*projectv1.ProjectConfigAuth, error) { + model := &projectv1.ProjectConfigAuth{} + if modelMap["trusted_profile_id"] != nil && modelMap["trusted_profile_id"].(string) != "" { + model.TrustedProfileID = core.StringPtr(modelMap["trusted_profile_id"].(string)) + } + if modelMap["method"] != nil && modelMap["method"].(string) != "" { + model.Method = core.StringPtr(modelMap["method"].(string)) + } + if modelMap["api_key"] != nil && modelMap["api_key"].(string) != "" { + model.ApiKey = core.StringPtr(modelMap["api_key"].(string)) + } + return model, nil +} + +func resourceIbmProjectMapToProjectComplianceProfile(modelMap map[string]interface{}) (*projectv1.ProjectComplianceProfile, error) { + model := &projectv1.ProjectComplianceProfile{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + if modelMap["instance_id"] != nil && modelMap["instance_id"].(string) != "" { + model.InstanceID = core.StringPtr(modelMap["instance_id"].(string)) + } + if modelMap["instance_location"] != nil && modelMap["instance_location"].(string) != "" { + model.InstanceLocation = core.StringPtr(modelMap["instance_location"].(string)) + } + if modelMap["attachment_id"] != nil && modelMap["attachment_id"].(string) != "" { + model.AttachmentID = core.StringPtr(modelMap["attachment_id"].(string)) + } + if modelMap["profile_name"] != nil && modelMap["profile_name"].(string) != "" { + model.ProfileName = core.StringPtr(modelMap["profile_name"].(string)) + } + return model, nil +} + +func resourceIbmProjectMapToInputVariable(modelMap map[string]interface{}) (*projectv1.InputVariable, error) { + model := &projectv1.InputVariable{} + return model, nil +} + +func resourceIbmProjectMapToProjectConfigSetting(modelMap map[string]interface{}) (*projectv1.ProjectConfigSetting, error) { + model := &projectv1.ProjectConfigSetting{} + return model, nil +} + +func resourceIbmProjectMapToSchematicsWorkspace(modelMap map[string]interface{}) (*projectv1.SchematicsWorkspace, error) { + model := &projectv1.SchematicsWorkspace{} + if modelMap["workspace_crn"] != nil && modelMap["workspace_crn"].(string) != "" { + model.WorkspaceCrn = core.StringPtr(modelMap["workspace_crn"].(string)) + } + return model, nil +} + +func resourceIbmProjectMapToProjectPrototypePatchDefinitionBlock(modelMap map[string]interface{}) (*projectv1.ProjectPrototypePatchDefinitionBlock, error) { + model := &projectv1.ProjectPrototypePatchDefinitionBlock{} + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["destroy_on_delete"] != nil { + model.DestroyOnDelete = core.BoolPtr(modelMap["destroy_on_delete"].(bool)) + } + return model, nil +} + +func resourceIbmProjectProjectDefinitionPropertiesToMap(model *projectv1.ProjectDefinitionProperties) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + if model.Description != nil { + modelMap["description"] = model.Description + } + modelMap["destroy_on_delete"] = model.DestroyOnDelete + return modelMap, nil +} + +func resourceIbmProjectCumulativeNeedsAttentionToMap(model *projectv1.CumulativeNeedsAttention) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Event != nil { + modelMap["event"] = model.Event + } + if model.EventID != nil { + modelMap["event_id"] = model.EventID + } + if model.ConfigID != nil { + modelMap["config_id"] = model.ConfigID + } + if model.ConfigVersion != nil { + modelMap["config_version"] = flex.IntValue(model.ConfigVersion) + } + return modelMap, nil +} + +func resourceIbmProjectProjectConfigCollectionMemberToMap(model *projectv1.ProjectConfigCollectionMember) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ApprovedVersion != nil { + approvedVersionMap, err := resourceIbmProjectProjectConfigVersionSummaryToMap(model.ApprovedVersion) + if err != nil { + return modelMap, err + } + modelMap["approved_version"] = []map[string]interface{}{approvedVersionMap} + } + if model.DeployedVersion != nil { + deployedVersionMap, err := resourceIbmProjectProjectConfigVersionSummaryToMap(model.DeployedVersion) + if err != nil { + return modelMap, err + } + modelMap["deployed_version"] = []map[string]interface{}{deployedVersionMap} + } + modelMap["id"] = model.ID + modelMap["version"] = flex.IntValue(model.Version) + modelMap["state"] = model.State + if model.CreatedAt != nil { + modelMap["created_at"] = model.CreatedAt.String() + } + if model.ModifiedAt != nil { + modelMap["modified_at"] = model.ModifiedAt.String() + } + modelMap["href"] = model.Href + definitionMap, err := resourceIbmProjectProjectConfigDefinitionNameDescriptionToMap(model.Definition) + if err != nil { + return modelMap, err + } + modelMap["definition"] = []map[string]interface{}{definitionMap} + projectMap, err := resourceIbmProjectProjectReferenceToMap(model.Project) + if err != nil { + return modelMap, err + } + modelMap["project"] = []map[string]interface{}{projectMap} + return modelMap, nil +} + +func resourceIbmProjectProjectConfigVersionSummaryToMap(model *projectv1.ProjectConfigVersionSummary) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["state"] = model.State + modelMap["version"] = flex.IntValue(model.Version) + modelMap["href"] = model.Href + return modelMap, nil +} + +func resourceIbmProjectProjectConfigDefinitionNameDescriptionToMap(model *projectv1.ProjectConfigDefinitionNameDescription) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Name != nil { + modelMap["name"] = model.Name + } + if model.Description != nil { + modelMap["description"] = model.Description + } + return modelMap, nil +} + +func resourceIbmProjectProjectReferenceToMap(model *projectv1.ProjectReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + definitionMap, err := resourceIbmProjectProjectDefinitionReferenceToMap(model.Definition) + if err != nil { + return modelMap, err + } + modelMap["definition"] = []map[string]interface{}{definitionMap} + modelMap["crn"] = model.Crn + modelMap["href"] = model.Href + return modelMap, nil +} + +func resourceIbmProjectProjectDefinitionReferenceToMap(model *projectv1.ProjectDefinitionReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + return modelMap, nil +} + +func resourceIbmProjectProjectEnvironmentCollectionMemberToMap(model *projectv1.ProjectEnvironmentCollectionMember) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + projectMap, err := resourceIbmProjectProjectReferenceToMap(model.Project) + if err != nil { + return modelMap, err + } + modelMap["project"] = []map[string]interface{}{projectMap} + modelMap["created_at"] = model.CreatedAt.String() + modelMap["href"] = model.Href + definitionMap, err := resourceIbmProjectEnvironmentDefinitionNameDescriptionToMap(model.Definition) + if err != nil { + return modelMap, err + } + modelMap["definition"] = []map[string]interface{}{definitionMap} + return modelMap, nil +} + +func resourceIbmProjectEnvironmentDefinitionNameDescriptionToMap(model *projectv1.EnvironmentDefinitionNameDescription) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Name != nil { + modelMap["name"] = model.Name + } + if model.Description != nil { + modelMap["description"] = model.Description + } + return modelMap, nil +} diff --git a/ibm/service/project/resource_ibm_project_config.go b/ibm/service/project/resource_ibm_project_config.go new file mode 100644 index 0000000000..ef7fb404c3 --- /dev/null +++ b/ibm/service/project/resource_ibm_project_config.go @@ -0,0 +1,757 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package project + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/project-go-sdk/projectv1" +) + +func ResourceIbmProjectConfig() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIbmProjectConfigCreate, + ReadContext: resourceIbmProjectConfigRead, + UpdateContext: resourceIbmProjectConfigUpdate, + DeleteContext: resourceIbmProjectConfigDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "project_id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_project_config", "project_id"), + Description: "The unique project ID.", + }, + "schematics": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "A schematics workspace associated to a project configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "workspace_crn": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "An existing schematics workspace CRN.", + }, + }, + }, + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Required: true, + Description: "The type and output of a project configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The configuration name.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "A project configuration description.", + }, + "environment": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The ID of the project environment.", + }, + "authorizations": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "trusted_profile_id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The trusted profile ID.", + }, + "method": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The authorization method. You can authorize by using a trusted profile or an API key in Secrets Manager.", + }, + "api_key": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The IBM Cloud API Key.", + }, + }, + }, + }, + "compliance_profile": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "The profile required for compliance.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The unique ID.", + }, + "instance_id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The unique ID.", + }, + "instance_location": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The location of the compliance instance.", + }, + "attachment_id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The unique ID.", + }, + "profile_name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the compliance profile.", + }, + }, + }, + }, + "locator_id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "A dotted value of catalogID.versionID.", + }, + "inputs": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "The input variables for configuration definition and environment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, + }, + }, + "settings": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Schematics environment variables to use to deploy the configuration.Settings are only available if they were specified when the configuration was initially created.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of a project configuration manual property.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The version of the configuration.", + }, + "is_draft": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "The flag that indicates whether the version of the configuration is draft, or active.", + }, + "needs_attention_state": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The needs attention state of a configuration.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "modified_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "last_saved_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "outputs": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The outputs of a Schematics template property.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The variable name.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "A short explanation of the output value.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "Can be any value - a string, number, boolean, array, or object.", + }, + }, + }, + }, + "project": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The project referenced by this resource.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique ID.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Required: true, + Description: "The definition of the project reference.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The name of the project.", + }, + }, + }, + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "An IBM Cloud resource name, which uniquely identifies a resource.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "A URL.", + }, + }, + }, + }, + "state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The state of the configuration.", + }, + "update_available": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "The flag that indicates whether a configuration update is available.", + }, + "project_config_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration.", + }, + }, + } +} + +func ResourceIbmProjectConfigValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "project_id", + ValidateFunctionIdentifier: validate.ValidateRegexp, + Type: validate.TypeString, + Required: true, + Regexp: `^[\.\-0-9a-zA-Z]+$`, + MaxValueLength: 128, + }, + ) + + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_project_config", Schema: validateSchema} + return &resourceValidator +} + +func resourceIbmProjectConfigCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + createConfigOptions := &projectv1.CreateConfigOptions{} + + createConfigOptions.SetProjectID(d.Get("project_id").(string)) + definitionModel, err := resourceIbmProjectConfigMapToProjectConfigPrototypeDefinitionBlock(d.Get("definition.0").(map[string]interface{})) + if err != nil { + return diag.FromErr(err) + } + createConfigOptions.SetDefinition(definitionModel) + if _, ok := d.GetOk("schematics"); ok { + schematicsModel, err := resourceIbmProjectConfigMapToSchematicsWorkspace(d.Get("schematics.0").(map[string]interface{})) + if err != nil { + return diag.FromErr(err) + } + createConfigOptions.SetSchematics(schematicsModel) + } + + projectConfig, response, err := projectClient.CreateConfigWithContext(context, createConfigOptions) + if err != nil { + log.Printf("[DEBUG] CreateConfigWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CreateConfigWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s/%s", *createConfigOptions.ProjectID, *projectConfig.ID)) + + return resourceIbmProjectConfigRead(context, d, meta) +} + +func resourceIbmProjectConfigRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + getConfigOptions := &projectv1.GetConfigOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + getConfigOptions.SetProjectID(parts[0]) + getConfigOptions.SetID(parts[1]) + + projectConfig, response, err := projectClient.GetConfigWithContext(context, getConfigOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetConfigWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetConfigWithContext failed %s\n%s", err, response)) + } + + definitionMap, err := resourceIbmProjectConfigProjectConfigResponseDefinitionToMap(projectConfig.Definition) + if err != nil { + return diag.FromErr(err) + } + if err = d.Set("definition", []map[string]interface{}{definitionMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting definition: %s", err)) + } + if err = d.Set("version", flex.IntValue(projectConfig.Version)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting version: %s", err)) + } + if err = d.Set("is_draft", projectConfig.IsDraft); err != nil { + return diag.FromErr(fmt.Errorf("Error setting is_draft: %s", err)) + } + if !core.IsNil(projectConfig.NeedsAttentionState) { + needsAttentionState := []interface{}{} + for _, needsAttentionStateItem := range projectConfig.NeedsAttentionState { + needsAttentionState = append(needsAttentionState, needsAttentionStateItem) + } + if err = d.Set("needs_attention_state", needsAttentionState); err != nil { + return diag.FromErr(fmt.Errorf("Error setting needs_attention_state: %s", err)) + } + } + if err = d.Set("created_at", flex.DateTimeToString(projectConfig.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + if err = d.Set("modified_at", flex.DateTimeToString(projectConfig.ModifiedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting modified_at: %s", err)) + } + if !core.IsNil(projectConfig.LastSavedAt) { + if err = d.Set("last_saved_at", flex.DateTimeToString(projectConfig.LastSavedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting last_saved_at: %s", err)) + } + } + if !core.IsNil(projectConfig.Outputs) { + outputs := []map[string]interface{}{} + for _, outputsItem := range projectConfig.Outputs { + outputsItemMap, err := resourceIbmProjectConfigOutputValueToMap(&outputsItem) + if err != nil { + return diag.FromErr(err) + } + outputs = append(outputs, outputsItemMap) + } + if err = d.Set("outputs", outputs); err != nil { + return diag.FromErr(fmt.Errorf("Error setting outputs: %s", err)) + } + } + projectMap, err := resourceIbmProjectConfigProjectReferenceToMap(projectConfig.Project) + if err != nil { + return diag.FromErr(err) + } + if err = d.Set("project", []map[string]interface{}{projectMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting project: %s", err)) + } + if err = d.Set("state", projectConfig.State); err != nil { + return diag.FromErr(fmt.Errorf("Error setting state: %s", err)) + } + if err = d.Set("update_available", projectConfig.UpdateAvailable); err != nil { + return diag.FromErr(fmt.Errorf("Error setting update_available: %s", err)) + } + if err = d.Set("project_config_id", projectConfig.ID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting project_config_id: %s", err)) + } + + return nil +} + +func resourceIbmProjectConfigUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + updateConfigOptions := &projectv1.UpdateConfigOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + updateConfigOptions.SetProjectID(parts[0]) + updateConfigOptions.SetID(parts[1]) + + hasChange := false + + if d.HasChange("definition") { + definition, err := resourceIbmProjectConfigMapToProjectConfigPrototypePatchDefinitionBlock(d.Get("definition.0").(map[string]interface{})) + if err != nil { + return diag.FromErr(err) + } + updateConfigOptions.SetDefinition(definition) + hasChange = true + } + + if hasChange { + _, response, err := projectClient.UpdateConfigWithContext(context, updateConfigOptions) + if err != nil { + log.Printf("[DEBUG] UpdateConfigWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("UpdateConfigWithContext failed %s\n%s", err, response)) + } + } + + return resourceIbmProjectConfigRead(context, d, meta) +} + +func resourceIbmProjectConfigDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + deleteConfigOptions := &projectv1.DeleteConfigOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + deleteConfigOptions.SetProjectID(parts[0]) + deleteConfigOptions.SetID(parts[1]) + + _, response, err := projectClient.DeleteConfigWithContext(context, deleteConfigOptions) + if err != nil { + log.Printf("[DEBUG] DeleteConfigWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteConfigWithContext failed %s\n%s", err, response)) + } + + d.SetId("") + + return nil +} + +func resourceIbmProjectConfigMapToProjectConfigPrototypeDefinitionBlock(modelMap map[string]interface{}) (*projectv1.ProjectConfigPrototypeDefinitionBlock, error) { + model := &projectv1.ProjectConfigPrototypeDefinitionBlock{} + model.Name = core.StringPtr(modelMap["name"].(string)) + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["environment"] != nil && modelMap["environment"].(string) != "" { + model.Environment = core.StringPtr(modelMap["environment"].(string)) + } + if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { + AuthorizationsModel, err := resourceIbmProjectConfigMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Authorizations = AuthorizationsModel + } + if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { + ComplianceProfileModel, err := resourceIbmProjectConfigMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.ComplianceProfile = ComplianceProfileModel + } + if modelMap["locator_id"] != nil && modelMap["locator_id"].(string) != "" { + model.LocatorID = core.StringPtr(modelMap["locator_id"].(string)) + } + if modelMap["inputs"] != nil && len(modelMap["inputs"].([]interface{})) > 0 { + InputsModel, err := resourceIbmProjectConfigMapToInputVariable(modelMap["inputs"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Inputs = InputsModel + } + if modelMap["settings"] != nil && len(modelMap["settings"].([]interface{})) > 0 { + SettingsModel, err := resourceIbmProjectConfigMapToProjectConfigSetting(modelMap["settings"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Settings = SettingsModel + } + return model, nil +} + +func resourceIbmProjectConfigMapToProjectConfigAuth(modelMap map[string]interface{}) (*projectv1.ProjectConfigAuth, error) { + model := &projectv1.ProjectConfigAuth{} + if modelMap["trusted_profile_id"] != nil && modelMap["trusted_profile_id"].(string) != "" { + model.TrustedProfileID = core.StringPtr(modelMap["trusted_profile_id"].(string)) + } + if modelMap["method"] != nil && modelMap["method"].(string) != "" { + model.Method = core.StringPtr(modelMap["method"].(string)) + } + if modelMap["api_key"] != nil && modelMap["api_key"].(string) != "" { + model.ApiKey = core.StringPtr(modelMap["api_key"].(string)) + } + return model, nil +} + +func resourceIbmProjectConfigMapToProjectComplianceProfile(modelMap map[string]interface{}) (*projectv1.ProjectComplianceProfile, error) { + model := &projectv1.ProjectComplianceProfile{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + if modelMap["instance_id"] != nil && modelMap["instance_id"].(string) != "" { + model.InstanceID = core.StringPtr(modelMap["instance_id"].(string)) + } + if modelMap["instance_location"] != nil && modelMap["instance_location"].(string) != "" { + model.InstanceLocation = core.StringPtr(modelMap["instance_location"].(string)) + } + if modelMap["attachment_id"] != nil && modelMap["attachment_id"].(string) != "" { + model.AttachmentID = core.StringPtr(modelMap["attachment_id"].(string)) + } + if modelMap["profile_name"] != nil && modelMap["profile_name"].(string) != "" { + model.ProfileName = core.StringPtr(modelMap["profile_name"].(string)) + } + return model, nil +} + +func resourceIbmProjectConfigMapToInputVariable(modelMap map[string]interface{}) (*projectv1.InputVariable, error) { + model := &projectv1.InputVariable{} + return model, nil +} + +func resourceIbmProjectConfigMapToProjectConfigSetting(modelMap map[string]interface{}) (*projectv1.ProjectConfigSetting, error) { + model := &projectv1.ProjectConfigSetting{} + return model, nil +} + +func resourceIbmProjectConfigMapToSchematicsWorkspace(modelMap map[string]interface{}) (*projectv1.SchematicsWorkspace, error) { + model := &projectv1.SchematicsWorkspace{} + if modelMap["workspace_crn"] != nil && modelMap["workspace_crn"].(string) != "" { + model.WorkspaceCrn = core.StringPtr(modelMap["workspace_crn"].(string)) + } + return model, nil +} + +func resourceIbmProjectConfigMapToProjectConfigPrototypePatchDefinitionBlock(modelMap map[string]interface{}) (*projectv1.ProjectConfigPrototypePatchDefinitionBlock, error) { + model := &projectv1.ProjectConfigPrototypePatchDefinitionBlock{} + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["environment"] != nil && modelMap["environment"].(string) != "" { + model.Environment = core.StringPtr(modelMap["environment"].(string)) + } + if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { + AuthorizationsModel, err := resourceIbmProjectConfigMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Authorizations = AuthorizationsModel + } + if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { + ComplianceProfileModel, err := resourceIbmProjectConfigMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.ComplianceProfile = ComplianceProfileModel + } + if modelMap["locator_id"] != nil && modelMap["locator_id"].(string) != "" { + model.LocatorID = core.StringPtr(modelMap["locator_id"].(string)) + } + if modelMap["inputs"] != nil && len(modelMap["inputs"].([]interface{})) > 0 { + InputsModel, err := resourceIbmProjectConfigMapToInputVariable(modelMap["inputs"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Inputs = InputsModel + } + if modelMap["settings"] != nil && len(modelMap["settings"].([]interface{})) > 0 { + SettingsModel, err := resourceIbmProjectConfigMapToProjectConfigSetting(modelMap["settings"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Settings = SettingsModel + } + return model, nil +} + +func resourceIbmProjectConfigSchematicsWorkspaceToMap(model *projectv1.SchematicsWorkspace) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.WorkspaceCrn != nil { + modelMap["workspace_crn"] = model.WorkspaceCrn + } + return modelMap, nil +} + +func resourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *projectv1.ProjectConfigResponseDefinition) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + if model.Description != nil { + modelMap["description"] = model.Description + } + if model.Environment != nil { + modelMap["environment"] = model.Environment + } + if model.Authorizations != nil { + authorizationsMap, err := resourceIbmProjectConfigProjectConfigAuthToMap(model.Authorizations) + if err != nil { + return modelMap, err + } + modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} + } + if model.ComplianceProfile != nil { + complianceProfileMap, err := resourceIbmProjectConfigProjectComplianceProfileToMap(model.ComplianceProfile) + if err != nil { + return modelMap, err + } + if len(complianceProfileMap) > 0 { + modelMap["compliance_profile"] = []map[string]interface{}{complianceProfileMap} + } + } + modelMap["locator_id"] = model.LocatorID + if model.Inputs != nil { + inputsMap, err := resourceIbmProjectConfigInputVariableToMap(model.Inputs) + if err != nil { + return modelMap, err + } + if len(inputsMap) > 0 { + modelMap["inputs"] = []map[string]interface{}{inputsMap} + } + } + if model.Settings != nil { + settingsMap, err := resourceIbmProjectConfigProjectConfigSettingToMap(model.Settings) + if err != nil { + return modelMap, err + } + modelMap["settings"] = []map[string]interface{}{settingsMap} + } + if model.Type != nil { + modelMap["type"] = model.Type + } + return modelMap, nil +} + +func resourceIbmProjectConfigProjectConfigAuthToMap(model *projectv1.ProjectConfigAuth) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.TrustedProfileID != nil { + modelMap["trusted_profile_id"] = model.TrustedProfileID + } + if model.Method != nil { + modelMap["method"] = model.Method + } + if model.ApiKey != nil { + modelMap["api_key"] = model.ApiKey + } + return modelMap, nil +} + +func resourceIbmProjectConfigProjectComplianceProfileToMap(model *projectv1.ProjectComplianceProfile) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ID != nil { + modelMap["id"] = model.ID + } + if model.InstanceID != nil { + modelMap["instance_id"] = model.InstanceID + } + if model.InstanceLocation != nil { + modelMap["instance_location"] = model.InstanceLocation + } + if model.AttachmentID != nil { + modelMap["attachment_id"] = model.AttachmentID + } + if model.ProfileName != nil { + modelMap["profile_name"] = model.ProfileName + } + return modelMap, nil +} + +func resourceIbmProjectConfigInputVariableToMap(model *projectv1.InputVariable) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + return modelMap, nil +} + +func resourceIbmProjectConfigProjectConfigSettingToMap(model *projectv1.ProjectConfigSetting) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + return modelMap, nil +} + +func resourceIbmProjectConfigOutputValueToMap(model *projectv1.OutputValue) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + if model.Description != nil { + modelMap["description"] = model.Description + } + if model.Value != nil { + modelMap["value"] = model.Value + } + return modelMap, nil +} + +func resourceIbmProjectConfigProjectReferenceToMap(model *projectv1.ProjectReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + definitionMap, err := resourceIbmProjectConfigProjectDefinitionReferenceToMap(model.Definition) + if err != nil { + return modelMap, err + } + modelMap["definition"] = []map[string]interface{}{definitionMap} + modelMap["crn"] = model.Crn + modelMap["href"] = model.Href + return modelMap, nil +} + +func resourceIbmProjectConfigProjectDefinitionReferenceToMap(model *projectv1.ProjectDefinitionReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + return modelMap, nil +} diff --git a/ibm/service/project/resource_ibm_project_config_test.go b/ibm/service/project/resource_ibm_project_config_test.go new file mode 100644 index 0000000000..8a827c81f1 --- /dev/null +++ b/ibm/service/project/resource_ibm_project_config_test.go @@ -0,0 +1,138 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package project_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/project-go-sdk/projectv1" +) + +func TestAccIbmProjectConfigBasic(t *testing.T) { + var conf projectv1.ProjectConfig + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmProjectConfigDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmProjectConfigConfigBasic(), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmProjectConfigExists("ibm_project_config.project_config_instance", conf), + ), + }, + resource.TestStep{ + ResourceName: "ibm_project_config.project_config_instance", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"project_id"}, + }, + }, + }) +} + +func testAccCheckIbmProjectConfigConfigBasic() string { + return fmt.Sprintf(` + resource "ibm_project" "project_instance" { + location = "us-south" + resource_group = "Default" + definition { + name = "acme-microservice" + description = "acme-microservice description" + destroy_on_delete = true + } + } + + resource "ibm_project_config" "project_config_instance" { + project_id = ibm_project.project_instance.id + definition { + name = "stage-environment" + authorizations { + method = "api_key" + api_key = "%s" + } + locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.cd596f95-95a2-4f21-9b84-477f21fd1e95-global" + } + lifecycle { + ignore_changes = [ + definition[0].authorizations[0].api_key, + ] + } + } + `, acc.ProjectsConfigApiKey) +} + +func testAccCheckIbmProjectConfigExists(n string, obj projectv1.ProjectConfig) resource.TestCheckFunc { + + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + projectClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).ProjectV1() + if err != nil { + return err + } + + getConfigOptions := &projectv1.GetConfigOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getConfigOptions.SetProjectID(parts[0]) + getConfigOptions.SetID(parts[1]) + + projectConfig, _, err := projectClient.GetConfig(getConfigOptions) + if err != nil { + return err + } + + obj = *projectConfig + return nil + } +} + +func testAccCheckIbmProjectConfigDestroy(s *terraform.State) error { + projectClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).ProjectV1() + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_project_config" { + continue + } + + getConfigOptions := &projectv1.GetConfigOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getConfigOptions.SetProjectID(parts[0]) + getConfigOptions.SetID(parts[1]) + + // Try to find the key + _, response, err := projectClient.GetConfig(getConfigOptions) + + if err == nil { + return fmt.Errorf("project_config still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for project_config (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/ibm/service/project/resource_ibm_project_instance.go b/ibm/service/project/resource_ibm_project_instance.go deleted file mode 100644 index 2d4c5af5a4..0000000000 --- a/ibm/service/project/resource_ibm_project_instance.go +++ /dev/null @@ -1,646 +0,0 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package project - -import ( - "context" - "fmt" - "log" - "time" - - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" - "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/project-go-sdk/projectv1" -) - -func ResourceIbmProjectInstance() *schema.Resource { - return &schema.Resource{ - CreateContext: resourceIbmProjectInstanceCreate, - ReadContext: resourceIbmProjectInstanceRead, - UpdateContext: resourceIbmProjectInstanceUpdate, - DeleteContext: resourceIbmProjectInstanceDelete, - Importer: &schema.ResourceImporter{}, - Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(1 * time.Minute), - Delete: schema.DefaultTimeout(1 * time.Minute), - }, - - Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: "The project name.", - }, - "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Description: "A project's descriptive text.", - }, - "configs": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - Description: "The project configurations.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Description: "The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration.", - }, - "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - Description: "The configuration name.", - }, - "labels": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - Description: "A collection of configuration labels.", - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Description: "The project configuration description.", - }, - "locator_id": &schema.Schema{ - Type: schema.TypeString, - Required: true, - Description: "A dotted value of catalogID.versionID.", - }, - "input": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - Description: "The input values to use to deploy the configuration.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - Description: "The variable name.", - }, - "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Description: "Can be any value - a string, number, boolean, array, or object.", - }, - }, - }, - }, - "setting": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - Description: "Schematics environment variables to use to deploy the configuration.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - Description: "The name of the configuration setting.", - }, - "value": &schema.Schema{ - Type: schema.TypeString, - Required: true, - Description: "The value of the configuration setting.", - }, - }, - }, - }, - }, - }, - }, - "resource_group": &schema.Schema{ - Type: schema.TypeString, - Required: true, - Description: "The resource group where the project's data and tools are created.", - }, - "location": &schema.Schema{ - Type: schema.TypeString, - Required: true, - Description: "The location where the project's data and tools are created.", - }, - "crn": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "An IBM Cloud resource name, which uniquely identifies a resource.", - }, - "metadata": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "The metadata of the project.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "crn": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "An IBM Cloud resource name, which uniquely identifies a resource.", - }, - "created_at": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", - }, - "cumulative_needs_attention_view": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "The cumulative list of needs attention items for a project.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "event": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The event name.", - }, - "event_id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The unique ID of a project.", - }, - "config_id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The unique ID of a project.", - }, - "config_version": &schema.Schema{ - Type: schema.TypeInt, - Computed: true, - Description: "The version number of the configuration.", - }, - }, - }, - }, - "cumulative_needs_attention_view_err": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "True indicates that the fetch of the needs attention items failed.", - }, - "location": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The IBM Cloud location where a resource is deployed.", - }, - "resource_group": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The resource group where the project's data and tools are created.", - }, - "state": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The project status value.", - }, - "event_notifications_crn": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The CRN of the event notifications instance if one is connected to this project.", - }, - }, - }, - }, - }, - } -} - -func ResourceIbmProjectInstanceValidator() *validate.ResourceValidator { - validateSchema := make([]validate.ValidateSchema, 0) - validateSchema = append(validateSchema, - validate.ValidateSchema{ - Identifier: "name", - Type: validate.TypeString, - Required: true, - Regexp: `^(?!\s)(?!.*\s$)[^'"<>{}\x00-\x1F]+$`, - MinValueLength: 1, - MaxValueLength: 64, - }, - validate.ValidateSchema{ - Identifier: "description", - Type: validate.TypeString, - Optional: true, - Regexp: `^$|^(?!\s).*\S$`, - MinValueLength: 0, - MaxValueLength: 1024, - }, - validate.ValidateSchema{ - Identifier: "resource_group", - Type: validate.TypeString, - Required: true, - Regexp: `^$|^(?!\s)(?!.*\s$)[^'"<>{}\x00-\x1F]*$`, - MinValueLength: 0, - MaxValueLength: 40, - }, - validate.ValidateSchema{ - Identifier: "location", - Type: validate.TypeString, - Required: true, - Regexp: `^$|^(us-south|us-east|eu-gb|eu-de)$`, - MinValueLength: 0, - MaxValueLength: 12, - }, - ) - - resourceValidator := validate.ResourceValidator{ResourceName: "ibm_project_instance", Schema: validateSchema} - return &resourceValidator -} - -func resourceIbmProjectInstanceCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - projectClient, err := meta.(conns.ClientSession).ProjectV1() - if err != nil { - return diag.FromErr(err) - } - - createProjectOptions := &projectv1.CreateProjectOptions{} - - createProjectOptions.SetName(d.Get("name").(string)) - if _, ok := d.GetOk("description"); ok { - createProjectOptions.SetDescription(d.Get("description").(string)) - } - if _, ok := d.GetOk("configs"); ok { - var configs []projectv1.ProjectConfigPrototype - for _, v := range d.Get("configs").([]interface{}) { - value := v.(map[string]interface{}) - configsItem, err := resourceIbmProjectInstanceMapToProjectConfigPrototype(value) - if err != nil { - return diag.FromErr(err) - } - configs = append(configs, *configsItem) - } - createProjectOptions.SetConfigs(configs) - } - if _, ok := d.GetOk("resource_group"); ok { - createProjectOptions.SetResourceGroup(d.Get("resource_group").(string)) - } - if _, ok := d.GetOk("location"); ok { - createProjectOptions.SetLocation(d.Get("location").(string)) - } - - project, response, err := projectClient.CreateProjectWithContext(context, createProjectOptions) - if err != nil { - log.Printf("[DEBUG] CreateProjectWithContext failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("CreateProjectWithContext failed %s\n%s", err, response)) - } - - d.SetId(*project.ID) - - _, err = waitForProjectInstanceCreate(d, meta) - if err != nil { - return diag.FromErr(fmt.Errorf("[ERROR] Error waiting for create project instance (%s) to be succeeded: %s", d.Id(), err)) - } - - return resourceIbmProjectInstanceRead(context, d, meta) -} - -func waitForProjectInstanceCreate(d *schema.ResourceData, meta interface{}) (interface{}, error) { - projectClient, err := meta.(conns.ClientSession).ProjectV1() - if err != nil { - return false, err - } - instanceID := d.Id() - getProjectOptions := &projectv1.GetProjectOptions{} - getProjectOptions.SetID(instanceID) - - stateConf := &resource.StateChangeConf{ - Pending: []string{"not_exists"}, - Target: []string{"exists"}, - Refresh: func() (interface{}, string, error) { - _, resp, err := projectClient.GetProject(getProjectOptions) - if err == nil { - if resp != nil && resp.StatusCode == 200 { - return resp, "exists", nil - } else { - return resp, "not_exists", nil - } - } else { - return nil, "", fmt.Errorf("[ERROR] Get the project instance %s failed with resp code: %d, err: %v", d.Id(), resp.StatusCode, err) - } - }, - Timeout: d.Timeout(schema.TimeoutCreate), - Delay: 2 * time.Second, - MinTimeout: 10 * time.Second, - } - - return stateConf.WaitForState() -} - -func resourceIbmProjectInstanceRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - projectClient, err := meta.(conns.ClientSession).ProjectV1() - if err != nil { - return diag.FromErr(err) - } - - getProjectOptions := &projectv1.GetProjectOptions{} - - getProjectOptions.SetID(d.Id()) - - project, response, err := projectClient.GetProjectWithContext(context, getProjectOptions) - if err != nil { - if response != nil && response.StatusCode == 404 { - d.SetId("") - return nil - } - log.Printf("[DEBUG] GetProjectWithContext failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("GetProjectWithContext failed %s\n%s", err, response)) - } - - if !core.IsNil(project.Crn) { - if err = d.Set("crn", project.Crn); err != nil { - return diag.FromErr(fmt.Errorf("Error setting crn: %s", err)) - } - } - if err = d.Set("name", project.Name); err != nil { - return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) - } - if !core.IsNil(project.Description) { - if err = d.Set("description", project.Description); err != nil { - return diag.FromErr(fmt.Errorf("Error setting description: %s", err)) - } - } - if !core.IsNil(project.Configs) { - configs := []map[string]interface{}{} - if err = d.Set("configs", configs); err != nil { - return diag.FromErr(fmt.Errorf("Error setting configs: %s", err)) - } - } - if !core.IsNil(project.Metadata) { - metadataMap, err := resourceIbmProjectInstanceProjectMetadataToMap(project.Metadata) - if err != nil { - return diag.FromErr(err) - } - if err = d.Set("metadata", []map[string]interface{}{metadataMap}); err != nil { - return diag.FromErr(fmt.Errorf("Error setting metadata: %s", err)) - } - } - - return nil -} - -func resourceIbmProjectInstanceUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - projectClient, err := meta.(conns.ClientSession).ProjectV1() - if err != nil { - return diag.FromErr(err) - } - - updateProjectOptions := &projectv1.UpdateProjectOptions{} - - updateProjectOptions.SetID(d.Id()) - - hasChange := false - - if d.HasChange("name") { - updateProjectOptions.SetName(d.Get("name").(string)) - hasChange = true - } - if d.HasChange("description") { - updateProjectOptions.SetDescription(d.Get("description").(string)) - hasChange = true - } - if d.HasChange("configs") { - var configs []projectv1.ProjectConfigPrototype - for _, v := range d.Get("configs").([]interface{}) { - value := v.(map[string]interface{}) - configsItem, err := resourceIbmProjectInstanceMapToProjectConfigPrototype(value) - if err != nil { - return diag.FromErr(err) - } - configs = append(configs, *configsItem) - } - hasChange = true - } - - if hasChange { - _, response, err := projectClient.UpdateProjectWithContext(context, updateProjectOptions) - if err != nil { - log.Printf("[DEBUG] UpdateProjectWithContext failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("UpdateProjectWithContext failed %s\n%s", err, response)) - } - } - - return resourceIbmProjectInstanceRead(context, d, meta) -} - -func resourceIbmProjectInstanceDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - projectClient, err := meta.(conns.ClientSession).ProjectV1() - if err != nil { - return diag.FromErr(err) - } - - deleteProjectOptions := &projectv1.DeleteProjectOptions{} - - deleteProjectOptions.SetID(d.Id()) - - response, err := projectClient.DeleteProjectWithContext(context, deleteProjectOptions) - if err != nil { - log.Printf("[DEBUG] DeleteProjectWithContext failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("DeleteProjectWithContext failed %s\n%s", err, response)) - } - - _, err = waitForProjectInstanceDelete(d, meta) - if err != nil { - return diag.FromErr(fmt.Errorf("[ERROR] Error waiting for delete project instance (%s) to be succeeded: %s", d.Id(), err)) - } - - d.SetId("") - - return nil -} - -func waitForProjectInstanceDelete(d *schema.ResourceData, meta interface{}) (interface{}, error) { - projectClient, err := meta.(conns.ClientSession).ProjectV1() - if err != nil { - return false, err - } - instanceID := d.Id() - getProjectOptions := &projectv1.GetProjectOptions{} - getProjectOptions.SetID(instanceID) - - stateConf := &resource.StateChangeConf{ - Pending: []string{"exists"}, - Target: []string{"not_exists"}, - Refresh: func() (interface{}, string, error) { - _, resp, err := projectClient.GetProject(getProjectOptions) - if err != nil { - if resp != nil && resp.StatusCode == 404 { - return resp, "not_exists", nil - } else { - return resp, "exists", nil - } - } else { - return resp, "exists", nil - } - }, - Timeout: d.Timeout(schema.TimeoutDelete), - Delay: 2 * time.Second, - MinTimeout: 10 * time.Second, - } - - return stateConf.WaitForState() -} - -func resourceIbmProjectInstanceMapToProjectConfigPrototype(modelMap map[string]interface{}) (*projectv1.ProjectConfigPrototype, error) { - model := &projectv1.ProjectConfigPrototype{} - if modelMap["id"] != nil && modelMap["id"].(string) != "" { - model.ID = core.StringPtr(modelMap["id"].(string)) - } - model.Name = core.StringPtr(modelMap["name"].(string)) - if modelMap["labels"] != nil { - labels := []string{} - for _, labelsItem := range modelMap["labels"].([]interface{}) { - labels = append(labels, labelsItem.(string)) - } - model.Labels = labels - } - if modelMap["description"] != nil && modelMap["description"].(string) != "" { - model.Description = core.StringPtr(modelMap["description"].(string)) - } - model.LocatorID = core.StringPtr(modelMap["locator_id"].(string)) - if modelMap["input"] != nil { - input := []projectv1.ProjectConfigInputVariable{} - for _, inputItem := range modelMap["input"].([]interface{}) { - inputItemModel, err := resourceIbmProjectInstanceMapToProjectConfigInputVariable(inputItem.(map[string]interface{})) - if err != nil { - return model, err - } - input = append(input, *inputItemModel) - } - model.Input = input - } - if modelMap["setting"] != nil { - setting := []projectv1.ProjectConfigSettingCollection{} - for _, settingItem := range modelMap["setting"].([]interface{}) { - settingItemModel, err := resourceIbmProjectInstanceMapToProjectConfigSettingCollection(settingItem.(map[string]interface{})) - if err != nil { - return model, err - } - setting = append(setting, *settingItemModel) - } - model.Setting = setting - } - return model, nil -} - -func resourceIbmProjectInstanceMapToProjectConfigInputVariable(modelMap map[string]interface{}) (*projectv1.ProjectConfigInputVariable, error) { - model := &projectv1.ProjectConfigInputVariable{} - model.Name = core.StringPtr(modelMap["name"].(string)) - if modelMap["value"] != nil { - model.Value = modelMap["value"].(string) - } - return model, nil -} - -func resourceIbmProjectInstanceMapToProjectConfigSettingCollection(modelMap map[string]interface{}) (*projectv1.ProjectConfigSettingCollection, error) { - model := &projectv1.ProjectConfigSettingCollection{} - model.Name = core.StringPtr(modelMap["name"].(string)) - model.Value = core.StringPtr(modelMap["value"].(string)) - return model, nil -} - -func resourceIbmProjectInstanceProjectConfigPrototypeToMap(model *projectv1.ProjectConfigPrototype) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - if model.ID != nil { - modelMap["id"] = model.ID - } - modelMap["name"] = model.Name - if model.Labels != nil { - modelMap["labels"] = model.Labels - } - if model.Description != nil { - modelMap["description"] = model.Description - } - modelMap["locator_id"] = model.LocatorID - if model.Input != nil { - input := []map[string]interface{}{} - for _, inputItem := range model.Input { - inputItemMap, err := resourceIbmProjectInstanceProjectConfigInputVariableToMap(&inputItem) - if err != nil { - return modelMap, err - } - input = append(input, inputItemMap) - } - modelMap["input"] = input - } - if model.Setting != nil { - setting := []map[string]interface{}{} - for _, settingItem := range model.Setting { - settingItemMap, err := resourceIbmProjectInstanceProjectConfigSettingCollectionToMap(&settingItem) - if err != nil { - return modelMap, err - } - setting = append(setting, settingItemMap) - } - modelMap["setting"] = setting - } - return modelMap, nil -} - -func resourceIbmProjectInstanceProjectConfigInputVariableToMap(model *projectv1.ProjectConfigInputVariable) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - modelMap["name"] = model.Name - if model.Value != nil { - modelMap["value"] = model.Value - } - return modelMap, nil -} - -func resourceIbmProjectInstanceProjectConfigSettingCollectionToMap(model *projectv1.ProjectConfigSettingCollection) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - modelMap["name"] = model.Name - modelMap["value"] = model.Value - return modelMap, nil -} - -func resourceIbmProjectInstanceProjectMetadataToMap(model *projectv1.ProjectMetadata) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - if model.Crn != nil { - modelMap["crn"] = model.Crn - } - if model.CreatedAt != nil { - modelMap["created_at"] = model.CreatedAt.String() - } - if model.CumulativeNeedsAttentionView != nil { - cumulativeNeedsAttentionView := []map[string]interface{}{} - for _, cumulativeNeedsAttentionViewItem := range model.CumulativeNeedsAttentionView { - cumulativeNeedsAttentionViewItemMap, err := resourceIbmProjectInstanceCumulativeNeedsAttentionToMap(&cumulativeNeedsAttentionViewItem) - if err != nil { - return modelMap, err - } - cumulativeNeedsAttentionView = append(cumulativeNeedsAttentionView, cumulativeNeedsAttentionViewItemMap) - } - modelMap["cumulative_needs_attention_view"] = cumulativeNeedsAttentionView - } - if model.CumulativeNeedsAttentionViewErr != nil { - modelMap["cumulative_needs_attention_view_err"] = model.CumulativeNeedsAttentionViewErr - } - if model.Location != nil { - modelMap["location"] = model.Location - } - if model.ResourceGroup != nil { - modelMap["resource_group"] = model.ResourceGroup - } - if model.State != nil { - modelMap["state"] = model.State - } - if model.EventNotificationsCrn != nil { - modelMap["event_notifications_crn"] = model.EventNotificationsCrn - } - return modelMap, nil -} - -func resourceIbmProjectInstanceCumulativeNeedsAttentionToMap(model *projectv1.CumulativeNeedsAttention) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - if model.Event != nil { - modelMap["event"] = model.Event - } - if model.EventID != nil { - modelMap["event_id"] = model.EventID - } - if model.ConfigID != nil { - modelMap["config_id"] = model.ConfigID - } - return modelMap, nil -} diff --git a/ibm/service/project/resource_ibm_project_instance_test.go b/ibm/service/project/resource_ibm_project_instance_test.go deleted file mode 100644 index 088784f11b..0000000000 --- a/ibm/service/project/resource_ibm_project_instance_test.go +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package project_test - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - - acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" - "github.com/IBM/project-go-sdk/projectv1" -) - -func TestAccIbmProjectInstanceBasic(t *testing.T) { - var conf projectv1.Project - name := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - nameUpdate := fmt.Sprintf("tf_name_update_%d", acctest.RandIntRange(10, 100)) - resourceGroup := fmt.Sprintf("Default") - location := fmt.Sprintf("us-south") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - CheckDestroy: testAccCheckIbmProjectInstanceDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIbmProjectInstanceConfigBasic(resourceGroup, location, name), - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIbmProjectInstanceExists("ibm_project_instance.project_instance", conf), - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "resource_group", resourceGroup), - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "location", location), - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "name", name), - ), - }, - resource.TestStep{ - Config: testAccCheckIbmProjectInstanceConfigBasic(resourceGroup, location, nameUpdate), - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "resource_group", resourceGroup), - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "location", location), - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "name", nameUpdate), - ), - }, - }, - }) -} - -func TestAccIbmProjectInstanceAllArgs(t *testing.T) { - var conf projectv1.Project - name := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - nameUpdate := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - description := fmt.Sprintf("tf_description_%d", acctest.RandIntRange(10, 100)) - descriptionUpdate := fmt.Sprintf("tf_description_%d", acctest.RandIntRange(10, 100)) - resourceGroup := fmt.Sprintf("Default") - location := fmt.Sprintf("us-south") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - CheckDestroy: testAccCheckIbmProjectInstanceDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIbmProjectInstanceConfig(name, description, resourceGroup, location), - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIbmProjectInstanceExists("ibm_project_instance.project_instance", conf), - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "resource_group", resourceGroup), - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "location", location), - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "name", name), - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "description", description), - ), - }, - resource.TestStep{ - Config: testAccCheckIbmProjectInstanceConfig(nameUpdate, descriptionUpdate, resourceGroup, location), - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "resource_group", resourceGroup), - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "location", location), - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "name", nameUpdate), - resource.TestCheckResourceAttr("ibm_project_instance.project_instance", "description", descriptionUpdate), - ), - }, - resource.TestStep{ - ResourceName: "ibm_project_instance.project_instance", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{ - "location", - "resource_group", - "configs", - }, - }, - }, - }) -} - -func testAccCheckIbmProjectInstanceConfigBasic(resourceGroup string, location string, name string) string { - return fmt.Sprintf(` - - resource "ibm_project_instance" "project_instance" { - resource_group = "%s" - location = "%s" - name = "%s" - } - `, resourceGroup, location, name) -} - -func testAccCheckIbmProjectInstanceConfig(name string, description string, resourceGroup string, location string) string { - return fmt.Sprintf(` - - resource "ibm_project_instance" "project_instance" { - name = "%s" - description = "%s" - resource_group = "%s" - location = "%s" - configs { - name = "name" - labels = [ "labels" ] - description = "description" - locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.cd596f95-95a2-4f21-9b84-477f21fd1e95-global" - input { - name = "name" - } - setting { - name = "name" - value = "value" - } - } - } - `, name, description, resourceGroup, location) -} - -func testAccCheckIbmProjectInstanceExists(n string, obj projectv1.Project) resource.TestCheckFunc { - - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Not found: %s", n) - } - - projectClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).ProjectV1() - if err != nil { - return err - } - - getProjectOptions := &projectv1.GetProjectOptions{} - - getProjectOptions.SetID(rs.Primary.ID) - - project, _, err := projectClient.GetProject(getProjectOptions) - if err != nil { - return err - } - - obj = *project - return nil - } -} - -func testAccCheckIbmProjectInstanceDestroy(s *terraform.State) error { - projectClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).ProjectV1() - if err != nil { - return err - } - for _, rs := range s.RootModule().Resources { - if rs.Type != "ibm_project_instance" { - continue - } - - getProjectOptions := &projectv1.GetProjectOptions{} - - getProjectOptions.SetID(rs.Primary.ID) - - // Try to find the key - _, response, err := projectClient.GetProject(getProjectOptions) - - if err == nil { - return fmt.Errorf("Project definition still exists: %s", rs.Primary.ID) - } else if response.StatusCode != 404 { - return fmt.Errorf("Error checking for Project definition (%s) has been destroyed: %s", rs.Primary.ID, err) - } - } - - return nil -} diff --git a/ibm/service/project/resource_ibm_project_test.go b/ibm/service/project/resource_ibm_project_test.go new file mode 100644 index 0000000000..20174656ec --- /dev/null +++ b/ibm/service/project/resource_ibm_project_test.go @@ -0,0 +1,111 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package project_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM/project-go-sdk/projectv1" +) + +func TestAccIbmProjectBasic(t *testing.T) { + var conf projectv1.Project + location := fmt.Sprintf("us-south") + resourceGroup := fmt.Sprintf("Default") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmProjectDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmProjectConfigBasic(location, resourceGroup), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmProjectExists("ibm_project.project_instance", conf), + resource.TestCheckResourceAttr("ibm_project.project_instance", "location", location), + resource.TestCheckResourceAttr("ibm_project.project_instance", "resource_group", resourceGroup), + ), + }, + resource.TestStep{ + ResourceName: "ibm_project.project_instance", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccCheckIbmProjectConfigBasic(location string, resourceGroup string) string { + return fmt.Sprintf(` + resource "ibm_project" "project_instance" { + location = "%s" + resource_group = "%s" + definition { + name = "acme-microservice" + description = "acme-microservice description" + destroy_on_delete = true + } + } + `, location, resourceGroup) +} + +func testAccCheckIbmProjectExists(n string, obj projectv1.Project) resource.TestCheckFunc { + + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + projectClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).ProjectV1() + if err != nil { + return err + } + + getProjectOptions := &projectv1.GetProjectOptions{} + + getProjectOptions.SetID(rs.Primary.ID) + + project, _, err := projectClient.GetProject(getProjectOptions) + if err != nil { + return err + } + + obj = *project + return nil + } +} + +func testAccCheckIbmProjectDestroy(s *terraform.State) error { + projectClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).ProjectV1() + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_project" { + continue + } + + getProjectOptions := &projectv1.GetProjectOptions{} + + getProjectOptions.SetID(rs.Primary.ID) + + // Try to find the key + _, response, err := projectClient.GetProject(getProjectOptions) + + if err == nil { + return fmt.Errorf("project still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for project (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/website/docs/d/project.html.markdown b/website/docs/d/project.html.markdown new file mode 100644 index 0000000000..3ac6b811d3 --- /dev/null +++ b/website/docs/d/project.html.markdown @@ -0,0 +1,129 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_project" +description: |- + Get information about project +subcategory: "Projects" +--- + +# ibm_project + +Provides a read-only data source to retrieve information about a project. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```hcl +data "ibm_project" "project" { + project_id = ibm_project.project_instance.id +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +* `project_id` - (Required, Forces new resource, String) The unique project ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +* `id` - The unique identifier of the project. +* `configs` - (List) The project configurations. These configurations are only included in the response of creating a project if a configs array is specified in the request payload. + * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. +Nested schema for **configs**: + * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. + * `definition` - (List) The name and description of a project configuration. + Nested schema for **definition**: + * `description` - (String) A project configuration description. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * `name` - (String) The configuration name. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. + * `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `id` - (String) The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `modified_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. + * `project` - (List) The project referenced by this resource. + Nested schema for **project**: + * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * `definition` - (List) The definition of the project reference. + Nested schema for **definition**: + * `name` - (String) The name of the project. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `id` - (String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `state` - (String) The state of the configuration. + * Constraints: Allowable values are: `approved`, `deleted`, `deleting`, `deleting_failed`, `discarded`, `draft`, `deployed`, `deploying_failed`, `deploying`, `superseded`, `undeploying`, `undeploying_failed`, `validated`, `validating`, `validating_failed`. + * `version` - (Integer) The version of the configuration. + +* `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. + +* `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + +* `cumulative_needs_attention_view` - (List) The cumulative list of needs attention items for a project. If the view is successfully retrieved, an array which could be empty is returned. + * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. +Nested schema for **cumulative_needs_attention_view**: + * `config_id` - (String) A unique ID for the configuration. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `config_version` - (Integer) The version number of the configuration. + * `event` - (String) The event name. + * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]*$/`. + * `event_id` - (String) A unique ID for that individual event. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + +* `cumulative_needs_attention_view_error` - (Boolean) True indicates that the fetch of the needs attention items failed. It only exists if there was an error while retrieving the cumulative needs attention view. + * Constraints: The default value is `false`. + +* `definition` - (List) The definition of the project. +Nested schema for **definition**: + * `description` - (String) A brief explanation of the project's use in the configuration of a deployable architecture. It is possible to create a project without providing a description. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * `destroy_on_delete` - (Boolean) The policy that indicates whether the resources are destroyed or not when a project is deleted. + * `name` - (String) The name of the project. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + +* `environments` - (List) The project environments. These environments are only included in the response if project environments were created on the project. + * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. +Nested schema for **environments**: + * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. + * `definition` - (List) The environment definition used in the project collection. + Nested schema for **definition**: + * `description` - (String) The description of the environment. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * `name` - (String) The name of the environment. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `id` - (String) The environment id as a friendly name. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. + * `project` - (List) The project referenced by this resource. + Nested schema for **project**: + * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * `definition` - (List) The definition of the project reference. + Nested schema for **definition**: + * `name` - (String) The name of the project. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `id` - (String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + +* `event_notifications_crn` - (String) The CRN of the event notifications instance if one is connected to this project. + * Constraints: The maximum length is `512` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + +* `location` - (Forces new resource, String) The IBM Cloud location where a resource is deployed. + * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]*$/`. + +* `resource_group` - (Forces new resource, String) The resource group where the project's data and tools are created. + * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]*$/`. + +* `state` - (String) The project status value. + * Constraints: Allowable values are: `ready`, `deleting`, `deleting_failed`. + diff --git a/website/docs/d/project_config.html.markdown b/website/docs/d/project_config.html.markdown new file mode 100644 index 0000000000..5cfedd0d20 --- /dev/null +++ b/website/docs/d/project_config.html.markdown @@ -0,0 +1,117 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_project_config" +description: |- + Get information about project_config +subcategory: "Projects" +--- + +# ibm_project_config + +Provides a read-only data source to retrieve information about a project_config. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```hcl +data "ibm_project_config" "project_config" { + project_config_id = ibm_project_config.project_config_instance.project_config_id + project_id = ibm_project_config.project_config_instance.project_id +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +* `project_config_id` - (Required, Forces new resource, String) The unique config ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. +* `project_id` - (Required, Forces new resource, String) The unique project ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +* `id` - The unique identifier of the project_config. +* `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. + +* `definition` - (List) The type and output of a project configuration. +Nested schema for **definition**: + * `authorizations` - (List) The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. + Nested schema for **authorizations**: + * `api_key` - (String) The IBM Cloud API Key. + * Constraints: The maximum length is `512` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^`<>\\x00-\\x1F]*$/`. + * `method` - (String) The authorization method. You can authorize by using a trusted profile or an API key in Secrets Manager. + * Constraints: Allowable values are: `api_key`, `trusted_profile`. + * `trusted_profile_id` - (String) The trusted profile ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `compliance_profile` - (List) The profile required for compliance. + Nested schema for **compliance_profile**: + * `attachment_id` - (String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `id` - (String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `instance_id` - (String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `instance_location` - (String) The location of the compliance instance. + * Constraints: The maximum length is `12` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(us-south|us-east|eu-gb|eu-de)$/`. + * `profile_name` - (String) The name of the compliance profile. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^`<>\\x00-\\x1F]*$/`. + * `description` - (String) A project configuration description. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * `environment` - (String) The ID of the project environment. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `inputs` - (List) The input variables for configuration definition and environment. + Nested schema for **inputs**: + * `locator_id` - (Forces new resource, String) A dotted value of catalogID.versionID. + * Constraints: The maximum length is `512` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/`. + * `name` - (String) The configuration name. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. + * `settings` - (List) Schematics environment variables to use to deploy the configuration.Settings are only available if they were specified when the configuration was initially created. + Nested schema for **settings**: + * `type` - (String) The type of a project configuration manual property. + * Constraints: Allowable values are: `terraform_template`, `schematics_blueprint`. + +* `is_draft` - (Boolean) The flag that indicates whether the version of the configuration is draft, or active. + +* `last_saved_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. + +* `modified_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. + +* `needs_attention_state` - (List) The needs attention state of a configuration. + * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. + +* `outputs` - (List) The outputs of a Schematics template property. + * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. +Nested schema for **outputs**: + * `description` - (String) A short explanation of the output value. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * `name` - (String) The variable name. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. + * `value` - (String) Can be any value - a string, number, boolean, array, or object. + +* `project` - (List) The project referenced by this resource. +Nested schema for **project**: + * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * `definition` - (List) The definition of the project reference. + Nested schema for **definition**: + * `name` - (String) The name of the project. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `id` - (String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + +* `schematics` - (List) A schematics workspace associated to a project configuration. +Nested schema for **schematics**: + * `workspace_crn` - (String) An existing schematics workspace CRN. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + +* `state` - (String) The state of the configuration. + * Constraints: Allowable values are: `approved`, `deleted`, `deleting`, `deleting_failed`, `discarded`, `draft`, `deployed`, `deploying_failed`, `deploying`, `superseded`, `undeploying`, `undeploying_failed`, `validated`, `validating`, `validating_failed`. + +* `update_available` - (Boolean) The flag that indicates whether a configuration update is available. + +* `version` - (Integer) The version of the configuration. + diff --git a/website/docs/d/project_event_notification.html.markdown b/website/docs/d/project_event_notification.html.markdown deleted file mode 100644 index 6818a34bc8..0000000000 --- a/website/docs/d/project_event_notification.html.markdown +++ /dev/null @@ -1,107 +0,0 @@ ---- -layout: "ibm" -page_title: "IBM : ibm_project_event_notification" -description: |- - Get information about Project definition -subcategory: "Project" ---- - -# ibm_project_event_notification - -Provides a read-only data source for Project definition. You can then reference the fields of the data source in other resources within the same configuration using interpolation syntax. - -## Example Usage - -```hcl -data "ibm_project_event_notification" "project_event_notification" { - id = "072b70cb-4db7-4c5c-bf1b-8d93d422537d" -} -``` - -## Argument Reference - -Review the argument reference that you can specify for your data source. - -* `id` - (Required, Forces new resource, String) The unique project ID. - * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. - -## Attribute Reference - -In addition to all argument references listed, you can access the following attribute references after your data source is created. - -* `id` - The unique identifier of the Project definition. -* `configs` - (List) The project configurations. - * Constraints: The maximum length is `10000` items. The minimum length is `0` items. -Nested scheme for **configs**: - * `description` - (String) The project configuration description. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. - * `id` - (String) The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. - * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. - * `input` - (List) The outputs of a Schematics template property. - * Constraints: The maximum length is `10000` items. The minimum length is `0` items. - Nested scheme for **input**: - * `name` - (String) The variable name. - * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. - * `required` - (Boolean) Whether the variable is required or not. - * `type` - (String) The variable type. - * Constraints: Allowable values are: `array`, `boolean`, `float`, `int`, `number`, `password`, `string`, `object`. - * `value` - (String) Can be any value - a string, number, boolean, array, or object. - * `labels` - (List) A collection of configuration labels. - * Constraints: The list items must match regular expression `/^[_\\-a-z0-9:\/=]+$/`. The maximum length is `10000` items. The minimum length is `0` items. - * `locator_id` - (String) A dotted value of catalogID.versionID. - * Constraints: The maximum length is `512` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/`. - * `name` - (String) The configuration name. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. - * `output` - (List) The outputs of a Schematics template property. - * Constraints: The maximum length is `10000` items. The minimum length is `0` items. - Nested scheme for **output**: - * `description` - (String) A short explanation of the output value. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. - * `name` - (String) The variable name. - * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. - * `value` - (String) Can be any value - a string, number, boolean, array, or object. - * `setting` - (List) Schematics environment variables to use to deploy the configuration. - * Constraints: The maximum length is `10000` items. The minimum length is `0` items. - Nested scheme for **setting**: - * `name` - (String) The name of the configuration setting. - * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. - * `value` - (String) The value of the configuration setting. - * Constraints: The maximum length is `1024` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. - * `type` - (String) The type of a project configuration manual property. - * Constraints: Allowable values are: `terraform_template`, `schematics_blueprint`. - -* `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. - * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. - -* `description` - (String) A project descriptive text. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. - -* `metadata` - (List) The metadata of the project. -Nested scheme for **metadata**: - * `created_at` - (String) A date and time value in the format `YYYY-MM-DDTHH:mm:ssZ` or `YYYY-MM-DDTHH:mm:ss.sssZ`, matching the date and time format as specified by RFC 3339. - * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. - * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. - * `cumulative_needs_attention_view` - (List) The cumulative list of needs attention items for a project. - * Constraints: The maximum length is `10000` items. The minimum length is `0` items. - Nested scheme for **cumulative_needs_attention_view**: - * `config_id` - (String) The unique ID of a project. - * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. - * `config_version` - (Integer) The version number of the configuration. - * `event` - (String) The event name. - * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"<>{}\\x00-\\x1F]*$/`. - * `event_id` - (String) The unique ID of a project. - * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. - * `cumulative_needs_attention_view_err` - (String) `True` indicates that the fetch of the needs attention items failed. - * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"<>{}\\x00-\\x1F]*$/`. - * `event_notifications_crn` - (String) The CRN of the event notifications instance if one is connected to this project. - * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. - * `location` - (String) The IBM Cloud location where a resource is deployed. - * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"<>{}\\x00-\\x1F]*$/`. - * `resource_group` - (String) The resource group where the project's data and tools are created. - * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"<>{}\\x00-\\x1F]*$/`. - * `state` - (String) The project status value. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(CREATING|CREATING_FAILED|UPDATING|UPDATING_FAILED|READY)$/`. - -* `name` - (String) The project name. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"<>{}\\x00-\\x1F]+$/`. - diff --git a/website/docs/r/project.html.markdown b/website/docs/r/project.html.markdown new file mode 100644 index 0000000000..98926aaffd --- /dev/null +++ b/website/docs/r/project.html.markdown @@ -0,0 +1,132 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_project" +description: |- + Manages project. +subcategory: "Projects" +--- + +# ibm_project + +Create, update, and delete projects with this resource. + +## Example Usage + +```hcl +resource "ibm_project" "project_instance" { + definition { + name = "My static website" + description = "Sample static website test using the IBM catalog deployable architecture" + destroy_on_delete = true + } + location = "us-south" + resource_group = "Default" +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +* `definition` - (Required, List) The definition of the project. +Nested schema for **definition**: + * `description` - (Optional, String) A brief explanation of the project's use in the configuration of a deployable architecture. It is possible to create a project without providing a description. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * `destroy_on_delete` - (Required, Boolean) The policy that indicates whether the resources are destroyed or not when a project is deleted. + * `name` - (Required, String) The name of the project. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. +* `location` - (Required, Forces new resource, String) The IBM Cloud location where a resource is deployed. + * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]*$/`. +* `resource_group` - (Required, Forces new resource, String) The resource group where the project's data and tools are created. + * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]*$/`. + +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +* `id` - The unique identifier of the project. +* `configs` - (List) The project configurations. These configurations are only included in the response of creating a project if a configs array is specified in the request payload. + * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. +Nested schema for **configs**: + * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. + * `definition` - (List) The name and description of a project configuration. + Nested schema for **definition**: + * `description` - (String) A project configuration description. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * `name` - (String) The configuration name. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. + * `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `id` - (String) The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `modified_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. + * `project` - (List) The project referenced by this resource. + Nested schema for **project**: + * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * `definition` - (List) The definition of the project reference. + Nested schema for **definition**: + * `name` - (String) The name of the project. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `id` - (String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `state` - (String) The state of the configuration. + * Constraints: Allowable values are: `approved`, `deleted`, `deleting`, `deleting_failed`, `discarded`, `draft`, `deployed`, `deploying_failed`, `deploying`, `superseded`, `undeploying`, `undeploying_failed`, `validated`, `validating`, `validating_failed`. + * `version` - (Integer) The version of the configuration. +* `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. +* `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. +* `cumulative_needs_attention_view` - (List) The cumulative list of needs attention items for a project. If the view is successfully retrieved, an array which could be empty is returned. + * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. +Nested schema for **cumulative_needs_attention_view**: + * `config_id` - (String) A unique ID for the configuration. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `config_version` - (Integer) The version number of the configuration. + * `event` - (String) The event name. + * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]*$/`. + * `event_id` - (String) A unique ID for that individual event. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. +* `cumulative_needs_attention_view_error` - (Boolean) True indicates that the fetch of the needs attention items failed. It only exists if there was an error while retrieving the cumulative needs attention view. + * Constraints: The default value is `false`. +* `environments` - (List) The project environments. These environments are only included in the response if project environments were created on the project. + * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. +Nested schema for **environments**: + * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. + * `definition` - (List) The environment definition used in the project collection. + Nested schema for **definition**: + * `description` - (String) The description of the environment. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * `name` - (String) The name of the environment. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `id` - (String) The environment id as a friendly name. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. + * `project` - (List) The project referenced by this resource. + Nested schema for **project**: + * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * `definition` - (List) The definition of the project reference. + Nested schema for **definition**: + * `name` - (String) The name of the project. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `id` - (String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. +* `event_notifications_crn` - (String) The CRN of the event notifications instance if one is connected to this project. + * Constraints: The maximum length is `512` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. +* `state` - (String) The project status value. + * Constraints: Allowable values are: `ready`, `deleting`, `deleting_failed`. + + +## Import + +You can import the `ibm_project` resource by using `id`. The unique ID. + +# Syntax +``` +$ terraform import ibm_project.project +``` diff --git a/website/docs/r/project_config.html.markdown b/website/docs/r/project_config.html.markdown new file mode 100644 index 0000000000..db20dac197 --- /dev/null +++ b/website/docs/r/project_config.html.markdown @@ -0,0 +1,138 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_project_config" +description: |- + Manages project_config. +subcategory: "Projects" +--- + +# ibm_project_config + +Create, update, and delete project_configs with this resource. + +## Example Usage + +```hcl +resource "ibm_project_config" "project_config_instance" { + definition { + name = "static-website-dev" + labels = [ "env:dev", "billing:internal" ] + description = "Website - development" + authorizations { + method = "api_key" + api_key = "" + } + locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.145be7c1-9ec4-4719-b586-584ee52fbed0-global" + input { + name = "app_repo_name" + } + setting { + name = "app_repo_name" + value = "static-website-dev-app-repo" + } + } + project_id = ibm_project.project_instance.id +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +* `definition` - (Required, List) The type and output of a project configuration. +Nested schema for **definition**: + * `authorizations` - (Optional, List) The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. + Nested schema for **authorizations**: + * `api_key` - (Optional, String) The IBM Cloud API Key. + * Constraints: The maximum length is `512` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^`<>\\x00-\\x1F]*$/`. + * `method` - (Optional, String) The authorization method. You can authorize by using a trusted profile or an API key in Secrets Manager. + * Constraints: Allowable values are: `api_key`, `trusted_profile`. + * `trusted_profile_id` - (Optional, String) The trusted profile ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `compliance_profile` - (Optional, List) The profile required for compliance. + Nested schema for **compliance_profile**: + * `attachment_id` - (Optional, String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `id` - (Optional, String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `instance_id` - (Optional, String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `instance_location` - (Optional, String) The location of the compliance instance. + * Constraints: The maximum length is `12` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(us-south|us-east|eu-gb|eu-de)$/`. + * `profile_name` - (Optional, String) The name of the compliance profile. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^`<>\\x00-\\x1F]*$/`. + * `description` - (Optional, String) A project configuration description. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * `environment` - (Optional, String) The ID of the project environment. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `inputs` - (Optional, List) The input variables for configuration definition and environment. + Nested schema for **inputs**: + * `locator_id` - (Required, Forces new resource, String) A dotted value of catalogID.versionID. + * Constraints: The maximum length is `512` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/`. + * `name` - (Required, String) The configuration name. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. + * `settings` - (Optional, List) Schematics environment variables to use to deploy the configuration.Settings are only available if they were specified when the configuration was initially created. + Nested schema for **settings**: + * `type` - (Computed, String) The type of a project configuration manual property. + * Constraints: Allowable values are: `terraform_template`, `schematics_blueprint`. +* `project_id` - (Required, Forces new resource, String) The unique project ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. +* `schematics` - (Optional, List) A schematics workspace associated to a project configuration. +Nested schema for **schematics**: + * `workspace_crn` - (Optional, String) An existing schematics workspace CRN. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +* `id` - The unique identifier of the project_config. +* `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. +* `is_draft` - (Boolean) The flag that indicates whether the version of the configuration is draft, or active. +* `last_saved_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. +* `modified_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. +* `needs_attention_state` - (List) The needs attention state of a configuration. + * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. +* `outputs` - (List) The outputs of a Schematics template property. + * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. +Nested schema for **outputs**: + * `description` - (String) A short explanation of the output value. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * `name` - (String) The variable name. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. + * `value` - (String) Can be any value - a string, number, boolean, array, or object. +* `project` - (List) The project referenced by this resource. +Nested schema for **project**: + * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * `definition` - (List) The definition of the project reference. + Nested schema for **definition**: + * `name` - (String) The name of the project. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `id` - (String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. +* `project_config_id` - (String) The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. +* `state` - (String) The state of the configuration. + * Constraints: Allowable values are: `approved`, `deleted`, `deleting`, `deleting_failed`, `discarded`, `draft`, `deployed`, `deploying_failed`, `deploying`, `superseded`, `undeploying`, `undeploying_failed`, `validated`, `validating`, `validating_failed`. +* `update_available` - (Boolean) The flag that indicates whether a configuration update is available. +* `version` - (Integer) The version of the configuration. + + +## Import + +You can import the `ibm_project_config` resource by using `id`. +The `id` property can be formed from `project_id`, and `id` in the following format: + +``` +/ +``` +* `project_id`: A string. The unique project ID. +* `id`: A string. The unique config ID. + +# Syntax +``` +$ terraform import ibm_project_config.project_config / +``` diff --git a/website/docs/r/project_instance.html.markdown b/website/docs/r/project_instance.html.markdown deleted file mode 100644 index 5193113914..0000000000 --- a/website/docs/r/project_instance.html.markdown +++ /dev/null @@ -1,117 +0,0 @@ ---- -layout: "ibm" -page_title: "IBM : ibm_project_instance" -description: |- - Manages Project definition. -subcategory: "Project" ---- - -# ibm_project_instance - -Provides a resource for Project definition. This allows Project definition to be created, updated and deleted. - -## Example Usage - -```hcl -resource "ibm_project_instance" "project_instance" { - configs { - id = "0013790d-6cb5-4adc-8927-a725a1261d0c" - name = "static-website-dev" - labels = [ "env:dev", "billing:internal" ] - description = "Website - development" - locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.145be7c1-9ec4-4719-b586-584ee52fbed0-global" - input { - name = "app_repo_name" - } - setting { - name = "app_repo_name" - value = "static-website-dev-app-repo" - } - } - description = "Sample static website test using the IBM catalog deployable architecture" - name = "My static website" - location = "us-south" - resource_group = "Default" -} -``` - -## Argument Reference - -Review the argument reference that you can specify for your resource. - -* `configs` - (Optional, List) The project configurations. - * Constraints: The maximum length is `10000` items. The minimum length is `0` items. -Nested scheme for **configs**: - * `description` - (Optional, String) The project configuration description. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. - * `id` - (Optional, String) The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. - * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. - * `input` - (Optional, List) The input values to use to deploy the configuration. - * Constraints: The maximum length is `10000` items. The minimum length is `0` items. - Nested scheme for **input**: - * `name` - (Required, String) The variable name. - * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. - * `value` - (Optional, String) Can be any value - a string, number, boolean, array, or object. - * `labels` - (Optional, List) A collection of configuration labels. - * Constraints: The list items must match regular expression `/^[_\\-a-z0-9:\/=]+$/`. The maximum length is `10000` items. The minimum length is `0` items. - * `locator_id` - (Required, String) A dotted value of catalogID.versionID. - * Constraints: The maximum length is `512` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/`. - * `name` - (Required, String) The configuration name. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. - * `setting` - (Optional, List) Schematics environment variables to use to deploy the configuration. - * Constraints: The maximum length is `10000` items. The minimum length is `0` items. - Nested scheme for **setting**: - * `name` - (Required, String) The name of the configuration setting. - * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. - * `value` - (Required, String) The value of the configuration setting. - * Constraints: The maximum length is `1024` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. -* `description` - (Optional, String) A project's descriptive text. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. -* `location` - (Required, String) The location where the project's data and tools are created. - * Constraints: The maximum length is `12` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(us-south|us-east|eu-gb|eu-de)$/`. -* `name` - (Required, String) The project name. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"<>{}\\x00-\\x1F]+$/`. -* `resource_group` - (Required, String) The resource group where the project's data and tools are created. - * Constraints: The maximum length is `40` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^'"<>{}\\x00-\\x1F]*$/`. - -## Attribute Reference - -In addition to all argument references listed, you can access the following attribute references after your resource is created. - -* `id` - The unique identifier of the Project definition. -* `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. - * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. -* `metadata` - (List) The metadata of the project. -Nested scheme for **metadata**: - * `created_at` - (String) A date and time value in the format `YYYY-MM-DDTHH:mm:ssZ` or `YYYY-MM-DDTHH:mm:ss.sssZ`, matching the date and time format as specified by RFC 3339. - * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. - * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. - * `cumulative_needs_attention_view` - (List) The cumulative list of needs attention items for a project. - * Constraints: The maximum length is `10000` items. The minimum length is `0` items. - Nested scheme for **cumulative_needs_attention_view**: - * `config_id` - (String) The unique ID of a project. - * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. - * `config_version` - (Integer) The version number of the configuration. - * `event` - (String) The event name. - * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"<>{}\\x00-\\x1F]*$/`. - * `event_id` - (String) The unique ID of a project. - * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. - * `cumulative_needs_attention_view_err` - (String) `True` indicates that the fetch of the needs attention items failed. - * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"<>{}\\x00-\\x1F]*$/`. - * `event_notifications_crn` - (String) The CRN of the event notifications instance if one is connected to this project. - * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. - * `location` - (String) The IBM Cloud location where a resource is deployed. - * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"<>{}\\x00-\\x1F]*$/`. - * `resource_group` - (String) The resource group where the project's data and tools are created. - * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"<>{}\\x00-\\x1F]*$/`. - * `state` - (String) The project status value. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(CREATING|CREATING_FAILED|UPDATING|UPDATING_FAILED|READY)$/`. - -## Import - -You can import the `ibm_project_instance` resource by using `id`. The unique ID of a project. - -# Syntax -``` -$ terraform import ibm_project_instance.project_instance -``` From cf3b4e272fc4549dbdce33919275d1331a600bac Mon Sep 17 00:00:00 2001 From: alex hemard Date: Fri, 10 Nov 2023 14:22:57 -0600 Subject: [PATCH 046/132] feat(Cloud Database): support offline restore for MongoDB EE PITR (#4601) * feature(Cloud Database): support Offline Restore for MongoDB EE * add documentation * cross region tests * replace IcdDbRegion with region set in provider * revert to v4 api --- .secrets.baseline | 24 ++-- ibm/acctest/acctest.go | 75 +++++++++-- ...bm_database_point_in_time_recovery_test.go | 2 +- .../data_source_ibm_database_remotes_test.go | 4 +- .../database/data_source_ibm_database_test.go | 4 +- ibm/service/database/resource_ibm_database.go | 18 ++- .../resource_ibm_database_cassandra_test.go | 56 ++++---- .../resource_ibm_database_edb_test.go | 18 +-- ...bm_database_elasticsearch_platinum_test.go | 54 ++++---- ...esource_ibm_database_elasticsearch_test.go | 52 ++++---- .../resource_ibm_database_etcd_test.go | 26 ++-- ...ce_ibm_database_mongodb_enterprise_test.go | 124 ++++++++++++++++-- ...urce_ibm_database_mongodb_sharding_test.go | 12 +- .../resource_ibm_database_mongodb_test.go | 28 ++-- .../resource_ibm_database_mysql_test.go | 8 +- .../resource_ibm_database_postgresql_test.go | 36 ++--- .../resource_ibm_database_rabbitmq_test.go | 16 +-- .../resource_ibm_database_redis_test.go | 22 ++-- website/docs/r/database.html.markdown | 1 + 19 files changed, 382 insertions(+), 198 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index 0d60faf91f..c4309547fd 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.mod|go.sum|.*.map|^.secrets.baseline$", "lines": null }, - "generated_at": "2023-10-30T15:56:24Z", + "generated_at": "2023-11-09T17:56:16Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -752,7 +752,7 @@ "hashed_secret": "731438016c5ab94431f61820f35e3ae5f8ad6004", "is_secret": false, "is_verified": false, - "line_number": 401, + "line_number": 402, "type": "Secret Keyword", "verified_result": null }, @@ -760,7 +760,7 @@ "hashed_secret": "12da2e35d6b50c902c014f1ab9e3032650368df7", "is_secret": false, "is_verified": false, - "line_number": 407, + "line_number": 408, "type": "Secret Keyword", "verified_result": null }, @@ -768,7 +768,7 @@ "hashed_secret": "813274ccae5b6b509379ab56982d862f7b5969b6", "is_secret": false, "is_verified": false, - "line_number": 1118, + "line_number": 1120, "type": "Base64 High Entropy String", "verified_result": null } @@ -856,7 +856,7 @@ "hashed_secret": "c8b6f5ef11b9223ac35a5663975a466ebe7ebba9", "is_secret": false, "is_verified": false, - "line_number": 1800, + "line_number": 1797, "type": "Secret Keyword", "verified_result": null }, @@ -864,7 +864,7 @@ "hashed_secret": "8abf4899c01104241510ba87685ad4de76b0c437", "is_secret": false, "is_verified": false, - "line_number": 1806, + "line_number": 1803, "type": "Secret Keyword", "verified_result": null } @@ -2080,7 +2080,7 @@ "hashed_secret": "deab23f996709b4e3d14e5499d1cc2de677bfaa8", "is_secret": false, "is_verified": false, - "line_number": 1340, + "line_number": 1357, "type": "Secret Keyword", "verified_result": null }, @@ -2088,7 +2088,7 @@ "hashed_secret": "20a25bac21219ffff1904bde871ded4027eca2f8", "is_secret": false, "is_verified": false, - "line_number": 1927, + "line_number": 1944, "type": "Secret Keyword", "verified_result": null }, @@ -2096,7 +2096,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 1946, + "line_number": 1963, "type": "Secret Keyword", "verified_result": null }, @@ -2104,7 +2104,7 @@ "hashed_secret": "1f5e25be9b575e9f5d39c82dfd1d9f4d73f1975c", "is_secret": false, "is_verified": false, - "line_number": 2186, + "line_number": 2203, "type": "Secret Keyword", "verified_result": null } @@ -2164,7 +2164,7 @@ "hashed_secret": "68ab9ef0953865fef0558010a9f7afcef110d5b8", "is_secret": false, "is_verified": false, - "line_number": 215, + "line_number": 270, "type": "Secret Keyword", "verified_result": null }, @@ -2172,7 +2172,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 280, + "line_number": 335, "type": "Secret Keyword", "verified_result": null } diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 7ca53ec073..65e4440b75 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -4,16 +4,25 @@ package acctest import ( + "context" "fmt" "os" "strconv" + "strings" + "sync" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + terraformsdk "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/provider" ) +const ( + ProviderName = "ibm" + ProviderNameAlternate = "ibmalternate" +) + var ( AppIDTenantID string AppIDTestUserEmail string @@ -146,7 +155,6 @@ var ( IksClusterVpcID string IksClusterSubnetID string IksClusterResourceGroupID string - IcdDbRegion string IcdDbDeploymentId string IcdDbBackupId string IcdDbTaskId string @@ -858,12 +866,6 @@ func init() { fmt.Println("[INFO] Set the environment variable ISSnapshotCRN for ibm_is_snapshot resource else it is set to default value 'crn:v1:bluemix:public:is:ca-tor:a/xxxxxxxx::snapshot:xxxx-xxxxc-xxx-xxxx-xxxx-xxxxxxxxxx'") } - IcdDbRegion = os.Getenv("ICD_DB_REGION") - if IcdDbRegion == "" { - IcdDbRegion = "eu-gb" - fmt.Println("[INFO] Set the environment variable ICD_DB_REGION for testing ibm_cloud_databases else it is set to default value 'eu-gb'") - } - IcdDbDeploymentId = os.Getenv("ICD_DB_DEPLOYMENT_ID") if IcdDbDeploymentId == "" { IcdDbDeploymentId = "crn:v1:bluemix:public:databases-for-redis:au-syd:a/40ddc34a953a8c02f10987b59085b60e:5042afe1-72c2-4231-89cc-c949e5d56251::" @@ -1530,10 +1532,18 @@ var ( TestAccProvider *schema.Provider ) +// testAccProviderConfigure ensures Provider is only configured once +// +// The PreCheck(t) function is invoked for every test and this prevents +// extraneous reconfiguration to the same values each time. However, this does +// not prevent reconfiguration that may happen should the address of +// Provider be errantly reused in ProviderFactories. +var testAccProviderConfigure sync.Once + func init() { TestAccProvider = provider.Provider() TestAccProviders = map[string]*schema.Provider{ - "ibm": TestAccProvider, + ProviderName: TestAccProvider, } } @@ -1557,6 +1567,13 @@ func TestAccPreCheck(t *testing.T) { if v := os.Getenv("IAAS_CLASSIC_USERNAME"); v == "" { t.Fatal("IAAS_CLASSIC_USERNAME must be set for acceptance tests") } + + testAccProviderConfigure.Do(func() { + diags := TestAccProvider.Configure(context.Background(), terraformsdk.NewResourceConfigRaw(nil)) + if diags.HasError() { + t.Fatalf("configuring provider: %s", diags[0].Summary) + } + }) } func TestAccPreCheckEnterprise(t *testing.T) { @@ -1696,3 +1713,45 @@ func TestAccPreCheckScc(t *testing.T) { t.Fatal("IBMCLOUD_SCC_REPORT_ID missing. Set the environment variable IBMCLOUD_SCC_REPORT_ID with a VALID REPORT_ID") } } + +func TestAccProviderFactories() map[string]func() (*schema.Provider, error) { + return map[string]func() (*schema.Provider, error){ + ProviderName: func() (*schema.Provider, error) { return provider.Provider(), nil }, + ProviderNameAlternate: func() (*schema.Provider, error) { return provider.Provider(), nil }, + } +} + +func Region() string { + region, _ := schema.MultiEnvDefaultFunc([]string{"IC_REGION", "IBMCLOUD_REGION", "BM_REGION", "BLUEMIX_REGION"}, "us-south")() + + return region.(string) +} + +func RegionAlternate() string { + region, _ := schema.MultiEnvDefaultFunc([]string{"IC_REGION_ALTERNATE", "IBMCLOUD_REGION_ALTERNATE"}, "eu-gb")() + + return region.(string) +} + +func ConfigAlternateRegionProvider() string { + return configNamedRegionalProvider(ProviderNameAlternate, RegionAlternate()) +} + +// ConfigCompose can be called to concatenate multiple strings to build test configurations +func ConfigCompose(config ...string) string { + var str strings.Builder + + for _, conf := range config { + str.WriteString(conf) + } + + return str.String() +} + +func configNamedRegionalProvider(providerName string, region string) string { + return fmt.Sprintf(` +provider %[1]q { + region = %[2]q +} +`, providerName, region) +} diff --git a/ibm/service/database/data_source_ibm_database_point_in_time_recovery_test.go b/ibm/service/database/data_source_ibm_database_point_in_time_recovery_test.go index 43f0cd691c..0a95020e99 100644 --- a/ibm/service/database/data_source_ibm_database_point_in_time_recovery_test.go +++ b/ibm/service/database/data_source_ibm_database_point_in_time_recovery_test.go @@ -49,7 +49,7 @@ func testAccCheckIBMDatabaseDataSourceConfig3(name string) string { tags = ["one:two"] } - `, name, acc.IcdDbRegion) + `, name, acc.Region()) } func testAccCheckIBMDatabasePitrDataSourceConfigBasic(name string) string { diff --git a/ibm/service/database/data_source_ibm_database_remotes_test.go b/ibm/service/database/data_source_ibm_database_remotes_test.go index 7b8cd000bf..b1cb0cd6da 100644 --- a/ibm/service/database/data_source_ibm_database_remotes_test.go +++ b/ibm/service/database/data_source_ibm_database_remotes_test.go @@ -67,7 +67,7 @@ func testAccCheckIBMDatabaseDataSourceConfig4(name string) string { ] } - `, name, acc.IcdDbRegion) + `, name, acc.Region()) } func testAccCheckIBMDatabaseRemotesDataSourceConfigBasic(name string) string { @@ -82,7 +82,7 @@ func testAccCheckIBMDatabaseRemotesDataSourceConfigBasic(name string) string { data "ibm_database_remotes" "database_remotes" { deployment_id = ibm_database.db.id - + depends_on = [ ibm_database.db_replica, ] diff --git a/ibm/service/database/data_source_ibm_database_test.go b/ibm/service/database/data_source_ibm_database_test.go index 500ff603c7..950d9fc14b 100644 --- a/ibm/service/database/data_source_ibm_database_test.go +++ b/ibm/service/database/data_source_ibm_database_test.go @@ -34,7 +34,7 @@ func TestAccIBMDatabaseDataSource_basic(t *testing.T) { resource.TestCheckResourceAttr(dataName, "name", testName), resource.TestCheckResourceAttr(dataName, "service", "databases-for-postgresql"), resource.TestCheckResourceAttr(dataName, "plan", "standard"), - resource.TestCheckResourceAttr(dataName, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(dataName, "location", acc.Region()), resource.TestCheckResourceAttr(dataName, "adminuser", "admin"), resource.TestCheckResourceAttr(dataName, "groups.0.memory.0.allocation_mb", "2048"), resource.TestCheckResourceAttr(dataName, "groups.0.disk.0.allocation_mb", "10240"), @@ -66,5 +66,5 @@ func testAccCheckIBMDatabaseDataSourceConfig(databaseResourceGroup string, name tags = ["one:two"] } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } diff --git a/ibm/service/database/resource_ibm_database.go b/ibm/service/database/resource_ibm_database.go index 1cbe4913cf..ee2a9d09fa 100644 --- a/ibm/service/database/resource_ibm_database.go +++ b/ibm/service/database/resource_ibm_database.go @@ -242,6 +242,12 @@ func ResourceIBMDatabaseInstance() *schema.Resource { Optional: true, DiffSuppressFunc: flex.ApplyOnce, }, + "offline_restore": { + Description: "Set offline restore mode for MongoDB Enterprise Edition", + Type: schema.TypeBool, + Optional: true, + DiffSuppressFunc: flex.ApplyOnce, + }, "users": { Type: schema.TypeSet, Optional: true, @@ -872,6 +878,7 @@ type Params struct { RemoteLeaderID string `json:"remote_leader_id,omitempty"` PITRDeploymentID string `json:"point_in_time_recovery_deployment_id,omitempty"` PITRTimeStamp *string `json:"point_in_time_recovery_time,omitempty"` + OfflineRestore bool `json:"offline_restore,omitempty"` } type Group struct { @@ -1030,6 +1037,7 @@ func resourceIBMDatabaseInstanceDiff(_ context.Context, diff *schema.ResourceDif } service := diff.Get("service").(string) + plan := diff.Get("plan").(string) _, logicalReplicationSet := diff.GetOk("logical_replication_slot") @@ -1086,6 +1094,11 @@ func resourceIBMDatabaseInstanceDiff(_ context.Context, diff *schema.ResourceDif } } + _, offlineRestoreOk := diff.GetOk("offline_restore") + if offlineRestoreOk && service != "databases-for-mongodb" && plan != "enterprise" { + return fmt.Errorf("[ERROR] offline_restore is only supported for databases-for-mongodb enterprise") + } + return nil } @@ -1219,6 +1232,10 @@ func resourceIBMDatabaseInstanceCreate(context context.Context, d *schema.Resour params.PITRTimeStamp = &pitrTimeTrimmed } + if offlineRestore, ok := d.GetOk("offline_restore"); ok { + params.OfflineRestore = offlineRestore.(bool) + } + serviceEndpoint := d.Get("service_endpoints").(string) params.ServiceEndpoints = serviceEndpoint parameters, _ := json.Marshal(params) @@ -2330,7 +2347,6 @@ func waitForDatabaseInstanceCreate(d *schema.ResourceData, meta interface{}, ins waitErr := waitForICDReady(meta, instanceID) if waitErr != nil { return false, fmt.Errorf("[ERROR] Error ICD interface not ready after create: %s with error %s\n", instanceID, waitErr) - } return stateConf.WaitForState() diff --git a/ibm/service/database/resource_ibm_database_cassandra_test.go b/ibm/service/database/resource_ibm_database_cassandra_test.go index 5c5b703e03..831d52752b 100644 --- a/ibm/service/database/resource_ibm_database_cassandra_test.go +++ b/ibm/service/database/resource_ibm_database_cassandra_test.go @@ -33,7 +33,7 @@ func TestAccIBMCassandraDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-cassandra"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "allowlist.#", "1"), resource.TestCheckResourceAttr(name, "users.#", "1"), @@ -49,7 +49,7 @@ func TestAccIBMCassandraDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-cassandra"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "2"), resource.TestCheckResourceAttr(name, "users.#", "2"), resource.TestCheckResourceAttr(name, "connectionstrings.#", "3"), @@ -63,7 +63,7 @@ func TestAccIBMCassandraDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-cassandra"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), resource.TestCheckResourceAttr(name, "users.#", "0"), resource.TestCheckResourceAttr(name, "connectionstrings.#", "1"), @@ -93,7 +93,7 @@ func TestAccIBMDatabaseInstance_Cassandra_Node(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-cassandra"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "allowlist.#", "1"), @@ -111,7 +111,7 @@ func TestAccIBMDatabaseInstance_Cassandra_Node(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-cassandra"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "2"), resource.TestCheckResourceAttr(name, "users.#", "2"), resource.TestCheckResourceAttr(name, "connectionstrings.#", "3"), @@ -125,7 +125,7 @@ func TestAccIBMDatabaseInstance_Cassandra_Node(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-cassandra"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), resource.TestCheckResourceAttr(name, "users.#", "0"), resource.TestCheckResourceAttr(name, "connectionstrings.#", "1"), @@ -138,7 +138,7 @@ func TestAccIBMDatabaseInstance_Cassandra_Node(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-cassandra"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), resource.TestCheckResourceAttr(name, "users.#", "0"), resource.TestCheckResourceAttr(name, "connectionstrings.#", "1"), @@ -173,7 +173,7 @@ func TestAccIBMDatabaseInstance_Cassandra_Group(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-cassandra"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "groups.0.count", "3"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "36864"), @@ -194,7 +194,7 @@ func TestAccIBMDatabaseInstance_Cassandra_Group(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-cassandra"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.count", "3"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "37248"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "61440"), @@ -212,7 +212,7 @@ func TestAccIBMDatabaseInstance_Cassandra_Group(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-cassandra"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.count", "3"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "36864"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "61440"), @@ -229,7 +229,7 @@ func TestAccIBMDatabaseInstance_Cassandra_Group(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-cassandra"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.count", "4"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "49152"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "81920"), @@ -266,7 +266,7 @@ func TestAccIBMDatabaseInstanceCassandraImport(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "name", serviceName), resource.TestCheckResourceAttr(resourceName, "service", "databases-for-cassandra"), resource.TestCheckResourceAttr(resourceName, "plan", "enterprise"), - resource.TestCheckResourceAttr(resourceName, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(resourceName, "location", acc.Region()), ), }, { @@ -311,7 +311,7 @@ func testAccCheckIBMDatabaseInstanceCassandraBasic(databaseResourceGroup string, delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceCassandraFullyspecified(databaseResourceGroup string, name string) string { @@ -351,7 +351,7 @@ func testAccCheckIBMDatabaseInstanceCassandraFullyspecified(databaseResourceGrou delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceCassandraReduced(databaseResourceGroup string, name string) string { @@ -375,7 +375,7 @@ func testAccCheckIBMDatabaseInstanceCassandraReduced(databaseResourceGroup strin delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceCassandraNodeBasic(databaseResourceGroup string, name string) string { @@ -395,15 +395,15 @@ func testAccCheckIBMDatabaseInstanceCassandraNodeBasic(databaseResourceGroup str group { group_id = "member" - + memory { allocation_mb = 12288 } - + disk { allocation_mb = 20480 } - + cpu { allocation_count = 6 } @@ -424,7 +424,7 @@ func testAccCheckIBMDatabaseInstanceCassandraNodeBasic(databaseResourceGroup str delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceCassandraNodeFullyspecified(databaseResourceGroup string, name string) string { @@ -454,7 +454,7 @@ func testAccCheckIBMDatabaseInstanceCassandraNodeFullyspecified(databaseResource disk { allocation_mb = 20480 } - + cpu { allocation_count = 6 } @@ -483,7 +483,7 @@ func testAccCheckIBMDatabaseInstanceCassandraNodeFullyspecified(databaseResource delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceCassandraNodeReduced(databaseResourceGroup string, name string) string { @@ -524,7 +524,7 @@ func testAccCheckIBMDatabaseInstanceCassandraNodeReduced(databaseResourceGroup s delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceCassandraNodeScaleOut(databaseResourceGroup string, name string) string { @@ -564,7 +564,7 @@ func testAccCheckIBMDatabaseInstanceCassandraNodeScaleOut(databaseResourceGroup delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceCassandraGroupBasic(databaseResourceGroup string, name string) string { @@ -613,7 +613,7 @@ func testAccCheckIBMDatabaseInstanceCassandraGroupBasic(databaseResourceGroup st delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceCassandraGroupFullyspecified(databaseResourceGroup string, name string) string { @@ -671,7 +671,7 @@ func testAccCheckIBMDatabaseInstanceCassandraGroupFullyspecified(databaseResourc } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceCassandraGroupReduced(databaseResourceGroup string, name string) string { @@ -711,7 +711,7 @@ func testAccCheckIBMDatabaseInstanceCassandraGroupReduced(databaseResourceGroup delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceCassandraGroupScaleOut(databaseResourceGroup string, name string) string { @@ -759,7 +759,7 @@ func testAccCheckIBMDatabaseInstanceCassandraGroupScaleOut(databaseResourceGroup delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceCassandraImport(databaseResourceGroup string, name string) string { @@ -783,5 +783,5 @@ func testAccCheckIBMDatabaseInstanceCassandraImport(databaseResourceGroup string } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } diff --git a/ibm/service/database/resource_ibm_database_edb_test.go b/ibm/service/database/resource_ibm_database_edb_test.go index d554fe943e..2f7a639e25 100644 --- a/ibm/service/database/resource_ibm_database_edb_test.go +++ b/ibm/service/database/resource_ibm_database_edb_test.go @@ -34,7 +34,7 @@ func TestAccIBMEDBDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-enterprisedb"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "3072"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "61440"), @@ -55,7 +55,7 @@ func TestAccIBMEDBDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-enterprisedb"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "6144"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "92160"), resource.TestCheckResourceAttr(name, "service_endpoints", "public-and-private"), @@ -78,7 +78,7 @@ func TestAccIBMEDBDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-enterprisedb"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "3072"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "92160"), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), @@ -103,7 +103,7 @@ func testAccCheckIBMDatabaseInstanceEDBBasic(databaseResourceGroup string, name data "ibm_resource_group" "test_acc" { name = "%[1]s" } - + resource "ibm_database" "%[2]s" { resource_group_id = data.ibm_resource_group.test_acc.id name = "%[2]s" @@ -135,7 +135,7 @@ func testAccCheckIBMDatabaseInstanceEDBBasic(databaseResourceGroup string, name delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceEDBFullyspecified(databaseResourceGroup string, name string) string { @@ -143,7 +143,7 @@ func testAccCheckIBMDatabaseInstanceEDBFullyspecified(databaseResourceGroup stri data "ibm_resource_group" "test_acc" { name = "%[1]s" } - + resource "ibm_database" "%[2]s" { resource_group_id = data.ibm_resource_group.test_acc.id name = "%[2]s" @@ -187,7 +187,7 @@ func testAccCheckIBMDatabaseInstanceEDBFullyspecified(databaseResourceGroup stri delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceEDBReduced(databaseResourceGroup string, name string) string { @@ -195,7 +195,7 @@ func testAccCheckIBMDatabaseInstanceEDBReduced(databaseResourceGroup string, nam data "ibm_resource_group" "test_acc" { name = "%[1]s" } - + resource "ibm_database" "%[2]s" { resource_group_id = data.ibm_resource_group.test_acc.id name = "%[2]s" @@ -220,5 +220,5 @@ func testAccCheckIBMDatabaseInstanceEDBReduced(databaseResourceGroup string, nam delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } diff --git a/ibm/service/database/resource_ibm_database_elasticsearch_platinum_test.go b/ibm/service/database/resource_ibm_database_elasticsearch_platinum_test.go index 1027e878da..e1cefb491d 100644 --- a/ibm/service/database/resource_ibm_database_elasticsearch_platinum_test.go +++ b/ibm/service/database/resource_ibm_database_elasticsearch_platinum_test.go @@ -33,7 +33,7 @@ func TestAccIBMDatabaseInstance_ElasticsearchPlatinum_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "platinum"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "allowlist.#", "1"), resource.TestCheckResourceAttr(name, "users.#", "1"), @@ -50,7 +50,7 @@ func TestAccIBMDatabaseInstance_ElasticsearchPlatinum_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "platinum"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "2"), resource.TestCheckResourceAttr(name, "users.#", "2"), resource.TestCheckResourceAttr(name, "connectionstrings.#", "3"), @@ -64,7 +64,7 @@ func TestAccIBMDatabaseInstance_ElasticsearchPlatinum_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "platinum"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "3072"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "18432"), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), @@ -79,7 +79,7 @@ func TestAccIBMDatabaseInstance_ElasticsearchPlatinum_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "platinum"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "3072"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "18432"), resource.TestCheckResourceAttr(name, "whitelist.#", "0"), @@ -116,7 +116,7 @@ func TestAccIBMDatabaseInstance_ElasticsearchPlatinum_Node(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "platinum"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "node_count", "3"), resource.TestCheckResourceAttr(name, "node_memory_allocation_mb", "1024"), @@ -138,7 +138,7 @@ func TestAccIBMDatabaseInstance_ElasticsearchPlatinum_Node(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "platinum"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "node_count", "3"), resource.TestCheckResourceAttr(name, "node_memory_allocation_mb", "1024"), resource.TestCheckResourceAttr(name, "node_disk_allocation_mb", "6144"), @@ -156,7 +156,7 @@ func TestAccIBMDatabaseInstance_ElasticsearchPlatinum_Node(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "platinum"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "node_count", "3"), resource.TestCheckResourceAttr(name, "node_memory_allocation_mb", "1024"), resource.TestCheckResourceAttr(name, "node_disk_allocation_mb", "6144"), @@ -173,7 +173,7 @@ func TestAccIBMDatabaseInstance_ElasticsearchPlatinum_Node(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "platinum"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "node_count", "4"), resource.TestCheckResourceAttr(name, "node_memory_allocation_mb", "1024"), resource.TestCheckResourceAttr(name, "node_disk_allocation_mb", "6144"), @@ -212,7 +212,7 @@ func TestAccIBMDatabaseInstance_ElasticsearchPlatinum_Group(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "platinum"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "node_count", "3"), resource.TestCheckResourceAttr(name, "node_memory_allocation_mb", "1024"), @@ -234,7 +234,7 @@ func TestAccIBMDatabaseInstance_ElasticsearchPlatinum_Group(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "platinum"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "node_count", "3"), resource.TestCheckResourceAttr(name, "node_memory_allocation_mb", "1024"), resource.TestCheckResourceAttr(name, "node_disk_allocation_mb", "6144"), @@ -256,7 +256,7 @@ func TestAccIBMDatabaseInstance_ElasticsearchPlatinum_Group(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "platinum"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "node_count", "3"), resource.TestCheckResourceAttr(name, "node_memory_allocation_mb", "1024"), resource.TestCheckResourceAttr(name, "node_disk_allocation_mb", "6144"), @@ -277,7 +277,7 @@ func TestAccIBMDatabaseInstance_ElasticsearchPlatinum_Group(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "platinum"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "node_count", "4"), resource.TestCheckResourceAttr(name, "node_memory_allocation_mb", "1024"), resource.TestCheckResourceAttr(name, "node_disk_allocation_mb", "6144"), @@ -322,7 +322,7 @@ func TestAccIBMDatabaseInstanceElasticsearchPlatinumImport(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "name", serviceName), resource.TestCheckResourceAttr(resourceName, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(resourceName, "plan", "platinum"), - resource.TestCheckResourceAttr(resourceName, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(resourceName, "location", acc.Region()), ), }, { @@ -354,7 +354,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumBasic(databaseResourceG adminpassword = "password12" group { group_id = "member" - + memory { allocation_mb = 1024 } @@ -377,7 +377,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumBasic(databaseResourceG delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumFullyspecified(databaseResourceGroup string, name string) string { @@ -418,7 +418,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumFullyspecified(database } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumReduced(databaseResourceGroup string, name string) string { @@ -442,7 +442,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumReduced(databaseResourc delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupMigration(databaseResourceGroup string, name string) string { @@ -477,7 +477,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupMigration(database delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeBasic(databaseResourceGroup string, name string) string { @@ -525,7 +525,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeBasic(databaseResou delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeFullyspecified(databaseResourceGroup string, name string) string { @@ -580,7 +580,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeFullyspecified(data delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeReduced(databaseResourceGroup string, name string) string { @@ -619,7 +619,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeReduced(databaseRes delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeScaleOut(databaseResourceGroup string, name string) string { @@ -658,7 +658,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeScaleOut(databaseRe delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupBasic(databaseResourceGroup string, name string) string { @@ -707,7 +707,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupBasic(databaseReso delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupFullyspecified(databaseResourceGroup string, name string) string { @@ -764,7 +764,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupFullyspecified(dat } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupReduced(databaseResourceGroup string, name string) string { @@ -804,7 +804,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupReduced(databaseRe delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupScaleOut(databaseResourceGroup string, name string) string { @@ -843,7 +843,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupScaleOut(databaseR delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumImport(databaseResourceGroup string, name string) string { @@ -867,5 +867,5 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumImport(databaseResource } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } diff --git a/ibm/service/database/resource_ibm_database_elasticsearch_test.go b/ibm/service/database/resource_ibm_database_elasticsearch_test.go index cb5fb613c1..400e61b7b9 100644 --- a/ibm/service/database/resource_ibm_database_elasticsearch_test.go +++ b/ibm/service/database/resource_ibm_database_elasticsearch_test.go @@ -33,7 +33,7 @@ func TestAccIBMDatabaseInstance_Elasticsearch_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "allowlist.#", "1"), resource.TestCheckResourceAttr(name, "users.#", "1"), @@ -50,7 +50,7 @@ func TestAccIBMDatabaseInstance_Elasticsearch_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "2"), resource.TestCheckResourceAttr(name, "users.#", "2"), resource.TestCheckResourceAttr(name, "connectionstrings.#", "3"), @@ -64,7 +64,7 @@ func TestAccIBMDatabaseInstance_Elasticsearch_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), resource.TestCheckResourceAttr(name, "users.#", "0"), resource.TestCheckResourceAttr(name, "connectionstrings.#", "1"), @@ -77,7 +77,7 @@ func TestAccIBMDatabaseInstance_Elasticsearch_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "3072"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "18432"), resource.TestCheckResourceAttr(name, "users.#", "0"), @@ -113,7 +113,7 @@ func TestAccIBMDatabaseInstance_Elasticsearch_Node(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "allowlist.#", "1"), @@ -131,7 +131,7 @@ func TestAccIBMDatabaseInstance_Elasticsearch_Node(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "2"), resource.TestCheckResourceAttr(name, "users.#", "2"), resource.TestCheckResourceAttr(name, "connectionstrings.#", "3"), @@ -145,7 +145,7 @@ func TestAccIBMDatabaseInstance_Elasticsearch_Node(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), resource.TestCheckResourceAttr(name, "users.#", "0"), resource.TestCheckResourceAttr(name, "connectionstrings.#", "1"), @@ -158,7 +158,7 @@ func TestAccIBMDatabaseInstance_Elasticsearch_Node(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), resource.TestCheckResourceAttr(name, "users.#", "0"), resource.TestCheckResourceAttr(name, "connectionstrings.#", "1"), @@ -193,7 +193,7 @@ func TestAccIBMDatabaseInstance_Elasticsearch_Group(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "allowlist.#", "1"), @@ -211,7 +211,7 @@ func TestAccIBMDatabaseInstance_Elasticsearch_Group(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.count", "3"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "3072"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "18432"), @@ -229,7 +229,7 @@ func TestAccIBMDatabaseInstance_Elasticsearch_Group(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.count", "3"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "3072"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "18432"), @@ -246,7 +246,7 @@ func TestAccIBMDatabaseInstance_Elasticsearch_Group(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.count", "4"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "4096"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "24576"), @@ -287,7 +287,7 @@ func TestAccIBMDatabaseInstanceElasticsearchImport(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "name", serviceName), resource.TestCheckResourceAttr(resourceName, "service", "databases-for-elasticsearch"), resource.TestCheckResourceAttr(resourceName, "plan", "standard"), - resource.TestCheckResourceAttr(resourceName, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(resourceName, "location", acc.Region()), ), }, { @@ -332,7 +332,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchBasic(databaseResourceGroup str delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchFullyspecified(databaseResourceGroup string, name string) string { @@ -373,7 +373,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchFullyspecified(databaseResource } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchReduced(databaseResourceGroup string, name string) string { @@ -397,7 +397,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchReduced(databaseResourceGroup s delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchGroupMigration(databaseResourceGroup string, name string) string { @@ -432,7 +432,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchGroupMigration(databaseResource delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchNodeBasic(databaseResourceGroup string, name string) string { @@ -480,7 +480,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchNodeBasic(databaseResourceGroup delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchNodeFullyspecified(databaseResourceGroup string, name string) string { @@ -535,7 +535,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchNodeFullyspecified(databaseReso delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchNodeReduced(databaseResourceGroup string, name string) string { @@ -574,7 +574,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchNodeReduced(databaseResourceGro delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchNodeScaleOut(databaseResourceGroup string, name string) string { @@ -613,7 +613,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchNodeScaleOut(databaseResourceGr delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchGroupBasic(databaseResourceGroup string, name string) string { @@ -662,7 +662,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchGroupBasic(databaseResourceGrou delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchGroupFullyspecified(databaseResourceGroup string, name string) string { @@ -719,7 +719,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchGroupFullyspecified(databaseRes } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchGroupReduced(databaseResourceGroup string, name string) string { @@ -759,7 +759,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchGroupReduced(databaseResourceGr delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchGroupScaleOut(databaseResourceGroup string, name string) string { @@ -798,7 +798,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchGroupScaleOut(databaseResourceG delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceElasticsearchImport(databaseResourceGroup string, name string) string { @@ -822,5 +822,5 @@ func testAccCheckIBMDatabaseInstanceElasticsearchImport(databaseResourceGroup st } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } diff --git a/ibm/service/database/resource_ibm_database_etcd_test.go b/ibm/service/database/resource_ibm_database_etcd_test.go index 42d7a83c0c..90ae1134d9 100644 --- a/ibm/service/database/resource_ibm_database_etcd_test.go +++ b/ibm/service/database/resource_ibm_database_etcd_test.go @@ -34,7 +34,7 @@ func TestAccIBMDatabaseInstance_Etcd_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-etcd"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "root"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "9216"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "184320"), @@ -54,7 +54,7 @@ func TestAccIBMDatabaseInstance_Etcd_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-etcd"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "18432"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "193536"), resource.TestCheckResourceAttr(name, "allowlist.#", "2"), @@ -68,7 +68,7 @@ func TestAccIBMDatabaseInstance_Etcd_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-etcd"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "9216"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "193536"), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), @@ -102,7 +102,7 @@ func TestAccIBMDatabaseInstanceEtcdImport(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "name", serviceName), resource.TestCheckResourceAttr(resourceName, "service", "databases-for-etcd"), resource.TestCheckResourceAttr(resourceName, "plan", "standard"), - resource.TestCheckResourceAttr(resourceName, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(resourceName, "location", acc.Region()), ), }, { @@ -124,7 +124,7 @@ func testAccCheckIBMDatabaseInstanceEtcdBasic(databaseResourceGroup string, name is_default = true # name = "%[1]s" } - + resource "ibm_database" "%[2]s" { resource_group_id = data.ibm_resource_group.test_acc.id name = "%[2]s" @@ -150,7 +150,7 @@ func testAccCheckIBMDatabaseInstanceEtcdBasic(databaseResourceGroup string, name description = "desc1" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceEtcdFullyspecified(databaseResourceGroup string, name string) string { @@ -159,7 +159,7 @@ func testAccCheckIBMDatabaseInstanceEtcdFullyspecified(databaseResourceGroup str is_default = true # name = "%[1]s" } - + resource "ibm_database" "%[2]s" { resource_group_id = data.ibm_resource_group.test_acc.id name = "%[2]s" @@ -193,8 +193,8 @@ func testAccCheckIBMDatabaseInstanceEtcdFullyspecified(databaseResourceGroup str description = "desc" } } - - `, databaseResourceGroup, name, acc.IcdDbRegion) + + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceEtcdReduced(databaseResourceGroup string, name string) string { @@ -203,7 +203,7 @@ func testAccCheckIBMDatabaseInstanceEtcdReduced(databaseResourceGroup string, na is_default = true # name = "%[1]s" } - + resource "ibm_database" "%[2]s" { resource_group_id = data.ibm_resource_group.test_acc.id name = "%[2]s" @@ -221,7 +221,7 @@ func testAccCheckIBMDatabaseInstanceEtcdReduced(databaseResourceGroup string, na } } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceEtcdImport(databaseResourceGroup string, name string) string { @@ -230,7 +230,7 @@ func testAccCheckIBMDatabaseInstanceEtcdImport(databaseResourceGroup string, nam is_default = true # name = "%[1]s" } - + resource "ibm_database" "%[2]s" { resource_group_id = data.ibm_resource_group.test_acc.id name = "%[2]s" @@ -238,5 +238,5 @@ func testAccCheckIBMDatabaseInstanceEtcdImport(databaseResourceGroup string, nam plan = "standard" location = "%[3]s" } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } diff --git a/ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go b/ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go index e8a11917ae..0993877628 100644 --- a/ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go +++ b/ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go @@ -34,7 +34,7 @@ func TestAccIBMMongoDBEnterpriseDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-mongodb"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "service_endpoints", "public"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "43008"), @@ -55,7 +55,7 @@ func TestAccIBMMongoDBEnterpriseDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-mongodb"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "service_endpoints", "public"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "86016"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "122880"), @@ -79,7 +79,7 @@ func TestAccIBMMongoDBEnterpriseDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-mongodb"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "43008"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "122880"), @@ -119,7 +119,7 @@ func TestAccIBMMongoDBEnterpriseDatabaseInstanceGroupBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-mongodb"), resource.TestCheckResourceAttr(name, "plan", "enterprise"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "service_endpoints", "public"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "43008"), @@ -138,6 +138,62 @@ func TestAccIBMMongoDBEnterpriseDatabaseInstanceGroupBasic(t *testing.T) { }) } +func TestAccIBMMongoDBEnterpriseDatabaseInstancePITR(t *testing.T) { + t.Parallel() + databaseResourceGroup := "Default" + var databaseInstanceOne string + var databaseInstanceTwo string + serviceName := fmt.Sprintf("tf-mongodbee-%d", acctest.RandIntRange(10, 100)) + pitrServiceName := serviceName + "-pitr" + resourceName := "ibm_database." + serviceName + pitrResourceName := "ibm_database." + pitrServiceName + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + ExternalProviders: map[string]resource.ExternalProvider{ + "time": { + Source: "hashicorp/time", + VersionConstraint: ">=0.9.1", + }, + }, + ProviderFactories: acc.TestAccProviderFactories(), + CheckDestroy: testAccCheckIBMDatabaseInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMDatabaseInstanceMongoDBEnterpriseMinimal(databaseResourceGroup, serviceName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMDatabaseInstanceExists(resourceName, &databaseInstanceOne), + resource.TestCheckResourceAttr(resourceName, "name", serviceName), + resource.TestCheckResourceAttr(resourceName, "service", "databases-for-mongodb"), + resource.TestCheckResourceAttr(resourceName, "plan", "enterprise"), + resource.TestCheckResourceAttr(resourceName, "location", acc.Region()), + + resource.TestCheckResourceAttr(resourceName, "groups.0.count", "3"), + resource.TestCheckResourceAttr(resourceName, "groups.1.count", "0"), + resource.TestCheckResourceAttr(resourceName, "groups.2.count", "0"), + ), + }, + { + Config: acc.ConfigCompose(acc.ConfigAlternateRegionProvider(), + testAccCheckIBMDatabaseInstanceMongoDBEnterpriseMinimal(databaseResourceGroup, serviceName), + testAccCheckIBMDatabaseInstanceMongoDBEnterpriseMinimal_PITR(databaseResourceGroup, serviceName)), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMDatabaseInstanceExists(resourceName, &databaseInstanceOne), + testAccCheckIBMDatabaseInstanceExists(pitrResourceName, &databaseInstanceTwo), + resource.TestCheckResourceAttr(pitrResourceName, "name", pitrServiceName), + resource.TestCheckResourceAttr(pitrResourceName, "service", "databases-for-mongodb"), + resource.TestCheckResourceAttr(pitrResourceName, "plan", "enterprise"), + resource.TestCheckResourceAttr(pitrResourceName, "location", acc.RegionAlternate()), + resource.TestCheckResourceAttr(pitrResourceName, "adminuser", "admin"), + resource.TestCheckResourceAttr(pitrResourceName, "groups.0.count", "3"), + resource.TestCheckResourceAttr(pitrResourceName, "groups.1.count", "0"), + resource.TestCheckResourceAttr(pitrResourceName, "groups.2.count", "0"), + ), + }, + }, + }) +} + func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseBasic(databaseResourceGroup string, name string) string { return fmt.Sprintf(` data "ibm_resource_group" "test_acc" { @@ -176,7 +232,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseBasic(databaseResourceGroup delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseFullyspecified(databaseResourceGroup string, name string) string { @@ -229,7 +285,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseFullyspecified(databaseReso delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseReduced(databaseResourceGroup string, name string) string { @@ -262,7 +318,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseReduced(databaseResourceGro delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseGroupBasic(databaseResourceGroup string, name string) string { @@ -313,5 +369,57 @@ func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseGroupBasic(databaseResource delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) +} + +func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseMinimal(databaseResourceGroup string, name string) string { + return fmt.Sprintf(` + data "ibm_resource_group" "test_acc" { + is_default = true + } + + resource "ibm_database" "%[2]s" { + resource_group_id = data.ibm_resource_group.test_acc.id + name = "%[2]s" + service = "databases-for-mongodb" + plan = "enterprise" + location = "%[3]s" + + timeouts { + create = "4h" + update = "4h" + delete = "15m" + } + } + `, databaseResourceGroup, name, acc.Region()) +} + +func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseMinimal_PITR(databaseResourceGroup string, name string) string { + return fmt.Sprintf(` + resource "time_sleep" "wait_time" { + create_duration = "1h" + depends_on = [ibm_database.%[2]s] + } + + resource "ibm_database" "%[2]s-pitr" { + provider = "%[1]s" + depends_on = [time_sleep.wait_time, ibm_database.%[2]s] + + resource_group_id = data.ibm_resource_group.test_acc.id + name = "%[2]s-pitr" + service = "databases-for-mongodb" + plan = "enterprise" + location = "%[3]s" + point_in_time_recovery_deployment_id = ibm_database.%[2]s.id + point_in_time_recovery_time = "" + offline_restore = true + + timeouts { + create = "4h" + update = "4h" + delete = "15m" + } + } + + `, acc.ProviderNameAlternate, name, acc.RegionAlternate()) } diff --git a/ibm/service/database/resource_ibm_database_mongodb_sharding_test.go b/ibm/service/database/resource_ibm_database_mongodb_sharding_test.go index 3b8a8e7dbb..dad9d64ff0 100644 --- a/ibm/service/database/resource_ibm_database_mongodb_sharding_test.go +++ b/ibm/service/database/resource_ibm_database_mongodb_sharding_test.go @@ -34,7 +34,7 @@ func TestAccIBMMongoDBShardingDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-mongodb"), resource.TestCheckResourceAttr(name, "plan", "enterprise-sharding"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "43008"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "61440"), @@ -53,7 +53,7 @@ func TestAccIBMMongoDBShardingDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-mongodb"), resource.TestCheckResourceAttr(name, "plan", "enterprise-sharding"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "86016"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "122880"), resource.TestCheckResourceAttr(name, "allowlist.#", "2"), @@ -70,7 +70,7 @@ func TestAccIBMMongoDBShardingDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-mongodb"), resource.TestCheckResourceAttr(name, "plan", "enterprise-sharding"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "43008"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "122880"), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), @@ -119,7 +119,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBShardingBasic(databaseResourceGroup s delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceMongoDBShardingFullyspecified(databaseResourceGroup string, name string) string { @@ -171,7 +171,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBShardingFullyspecified(databaseResour delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceMongoDBShardingReduced(databaseResourceGroup string, name string) string { @@ -203,5 +203,5 @@ func testAccCheckIBMDatabaseInstanceMongoDBShardingReduced(databaseResourceGroup delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } diff --git a/ibm/service/database/resource_ibm_database_mongodb_test.go b/ibm/service/database/resource_ibm_database_mongodb_test.go index 683d02fa14..3bbfae9e52 100644 --- a/ibm/service/database/resource_ibm_database_mongodb_test.go +++ b/ibm/service/database/resource_ibm_database_mongodb_test.go @@ -34,7 +34,7 @@ func TestAccIBMDatabaseInstanceMongodbBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-mongodb"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "allowlist.#", "1"), resource.TestCheckResourceAttr(name, "users.#", "1"), @@ -53,7 +53,7 @@ func TestAccIBMDatabaseInstanceMongodbBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-mongodb"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "2"), resource.TestCheckResourceAttr(name, "users.#", "2"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "6144"), @@ -70,7 +70,7 @@ func TestAccIBMDatabaseInstanceMongodbBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-mongodb"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "3072"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "30720"), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), @@ -109,7 +109,7 @@ func TestAccIBMDatabaseInstanceMongodbImport(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "name", serviceName), resource.TestCheckResourceAttr(resourceName, "service", "databases-for-mongodb"), resource.TestCheckResourceAttr(resourceName, "plan", "standard"), - resource.TestCheckResourceAttr(resourceName, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(resourceName, "location", acc.Region()), ), }, { @@ -128,7 +128,7 @@ func testAccCheckIBMDatabaseInstanceMongodbBasic(databaseResourceGroup string, n data "ibm_resource_group" "test_acc" { name = "%[1]s" } - + resource "ibm_database" "%[2]s" { resource_group_id = data.ibm_resource_group.test_acc.id name = "%[2]s" @@ -154,7 +154,7 @@ func testAccCheckIBMDatabaseInstanceMongodbBasic(databaseResourceGroup string, n description = "desc1" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceMongodbFullyspecified(databaseResourceGroup string, name string) string { @@ -162,7 +162,7 @@ func testAccCheckIBMDatabaseInstanceMongodbFullyspecified(databaseResourceGroup data "ibm_resource_group" "test_acc" { name = "%[1]s" } - + resource "ibm_database" "%[2]s" { resource_group_id = data.ibm_resource_group.test_acc.id name = "%[2]s" @@ -196,7 +196,7 @@ func testAccCheckIBMDatabaseInstanceMongodbFullyspecified(databaseResourceGroup description = "desc" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceMongodbReduced(databaseResourceGroup string, name string) string { @@ -204,7 +204,7 @@ func testAccCheckIBMDatabaseInstanceMongodbReduced(databaseResourceGroup string, data "ibm_resource_group" "test_acc" { name = "%[1]s" } - + resource "ibm_database" "%[2]s" { resource_group_id = data.ibm_resource_group.test_acc.id name = "%[2]s" @@ -222,8 +222,8 @@ func testAccCheckIBMDatabaseInstanceMongodbReduced(databaseResourceGroup string, } } } - - `, databaseResourceGroup, name, acc.IcdDbRegion) + + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceMongodbImport(databaseResourceGroup string, name string) string { @@ -232,7 +232,7 @@ func testAccCheckIBMDatabaseInstanceMongodbImport(databaseResourceGroup string, is_default = true # name = "%[1]s" } - + resource "ibm_database" "%[2]s" { resource_group_id = data.ibm_resource_group.test_acc.id name = "%[2]s" @@ -240,6 +240,6 @@ func testAccCheckIBMDatabaseInstanceMongodbImport(databaseResourceGroup string, plan = "standard" location = "%[3]s" } - - `, databaseResourceGroup, name, acc.IcdDbRegion) + + `, databaseResourceGroup, name, acc.Region()) } diff --git a/ibm/service/database/resource_ibm_database_mysql_test.go b/ibm/service/database/resource_ibm_database_mysql_test.go index d88873886a..a1291df54d 100644 --- a/ibm/service/database/resource_ibm_database_mysql_test.go +++ b/ibm/service/database/resource_ibm_database_mysql_test.go @@ -33,7 +33,7 @@ func TestAccIBMMysqlDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-mysql"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "3072"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "61440"), @@ -54,7 +54,7 @@ func TestAccIBMMysqlDatabaseInstanceBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-mysql"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "6144"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "92160"), resource.TestCheckResourceAttr(name, "service_endpoints", "public-and-private"), @@ -111,7 +111,7 @@ func testAccCheckIBMDatabaseInstanceMysqlBasic(databaseResourceGroup string, nam delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceMysqlFullyspecified(databaseResourceGroup string, name string) string { @@ -169,5 +169,5 @@ func testAccCheckIBMDatabaseInstanceMysqlFullyspecified(databaseResourceGroup st delete = "15m" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } diff --git a/ibm/service/database/resource_ibm_database_postgresql_test.go b/ibm/service/database/resource_ibm_database_postgresql_test.go index 15866b186c..56769cba61 100644 --- a/ibm/service/database/resource_ibm_database_postgresql_test.go +++ b/ibm/service/database/resource_ibm_database_postgresql_test.go @@ -55,7 +55,7 @@ func TestAccIBMDatabaseInstancePostgresBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-postgresql"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "4096"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "20480"), @@ -78,7 +78,7 @@ func TestAccIBMDatabaseInstancePostgresBasic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-postgresql"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "8192"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "28672"), resource.TestCheckResourceAttr(name, "service_endpoints", "public-and-private"), @@ -124,7 +124,7 @@ func TestAccIBMDatabaseInstancePostgresGroup(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-postgresql"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "groups.0.count", "2"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "4096"), @@ -147,7 +147,7 @@ func TestAccIBMDatabaseInstancePostgresGroup(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-postgresql"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.count", "2"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "4608"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "28672"), @@ -172,7 +172,7 @@ func TestAccIBMDatabaseInstancePostgresGroup(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-postgresql"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.count", "2"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "4096"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "28672"), @@ -190,7 +190,7 @@ func TestAccIBMDatabaseInstancePostgresGroup(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-postgresql"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.count", "3"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "6144"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "43008"), @@ -227,7 +227,7 @@ func TestAccIBMDatabaseInstancePostgresImport(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "name", serviceName), resource.TestCheckResourceAttr(resourceName, "service", "databases-for-postgresql"), resource.TestCheckResourceAttr(resourceName, "plan", "standard"), - resource.TestCheckResourceAttr(resourceName, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(resourceName, "location", acc.Region()), ), }, { @@ -264,7 +264,7 @@ func TestAccIBMDatabaseInstancePostgresPITR(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "name", serviceName), resource.TestCheckResourceAttr(resourceName, "service", "databases-for-postgresql"), resource.TestCheckResourceAttr(resourceName, "plan", "standard"), - resource.TestCheckResourceAttr(resourceName, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(resourceName, "location", acc.Region()), ), }, { @@ -274,7 +274,7 @@ func TestAccIBMDatabaseInstancePostgresPITR(t *testing.T) { resource.TestCheckResourceAttr(pitrResource, "name", pitrServiceName), resource.TestCheckResourceAttr(pitrResource, "service", "databases-for-postgresql"), resource.TestCheckResourceAttr(pitrResource, "plan", "standard"), - resource.TestCheckResourceAttr(pitrResource, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(pitrResource, "location", acc.Region()), ), }, }, @@ -447,7 +447,7 @@ func testAccCheckIBMDatabaseInstancePostgresBasic(databaseResourceGroup string, plugin_type = "wal2json" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstancePostgresFullyspecified(databaseResourceGroup string, name string) string { @@ -515,7 +515,7 @@ func testAccCheckIBMDatabaseInstancePostgresFullyspecified(databaseResourceGroup plugin_type = "wal2json" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstancePostgresGroupBasic(databaseResourceGroup string, name string) string { @@ -556,7 +556,7 @@ func testAccCheckIBMDatabaseInstancePostgresGroupBasic(databaseResourceGroup str description = "desc1" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstancePostgresGroupFullyspecified(databaseResourceGroup string, name string) string { @@ -606,7 +606,7 @@ func testAccCheckIBMDatabaseInstancePostgresGroupFullyspecified(databaseResource description = "desc" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstancePostgresGroupReduced(databaseResourceGroup string, name string) string { @@ -640,7 +640,7 @@ func testAccCheckIBMDatabaseInstancePostgresGroupReduced(databaseResourceGroup s } } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstancePostgresGroupScaleOut(databaseResourceGroup string, name string) string { @@ -674,7 +674,7 @@ func testAccCheckIBMDatabaseInstancePostgresGroupScaleOut(databaseResourceGroup service_endpoints = "public" tags = ["one:two"] } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstancePostgresImport(databaseResourceGroup string, name string) string { @@ -691,7 +691,7 @@ func testAccCheckIBMDatabaseInstancePostgresImport(databaseResourceGroup string, plan = "standard" location = "%[3]s" } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstancePostgresMinimal(databaseResourceGroup string, name string) string { @@ -708,7 +708,7 @@ func testAccCheckIBMDatabaseInstancePostgresMinimal(databaseResourceGroup string plan = "standard" location = "%[3]s" } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstancePostgresMinimal_PITR(databaseResourceGroup string, name string) string { @@ -735,5 +735,5 @@ func testAccCheckIBMDatabaseInstancePostgresMinimal_PITR(databaseResourceGroup s point_in_time_recovery_deployment_id = ibm_database.%[2]s.id point_in_time_recovery_time = "" } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } diff --git a/ibm/service/database/resource_ibm_database_rabbitmq_test.go b/ibm/service/database/resource_ibm_database_rabbitmq_test.go index 93a4bc0456..5b55cac784 100644 --- a/ibm/service/database/resource_ibm_database_rabbitmq_test.go +++ b/ibm/service/database/resource_ibm_database_rabbitmq_test.go @@ -33,7 +33,7 @@ func TestAccIBMDatabaseInstance_Rabbitmq_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "messages-for-rabbitmq"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "3072"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "3072"), @@ -52,7 +52,7 @@ func TestAccIBMDatabaseInstance_Rabbitmq_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "messages-for-rabbitmq"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "6144"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "6144"), resource.TestCheckResourceAttr(name, "allowlist.#", "2"), @@ -68,7 +68,7 @@ func TestAccIBMDatabaseInstance_Rabbitmq_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "messages-for-rabbitmq"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "3072"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "6144"), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), @@ -107,7 +107,7 @@ func TestAccIBMDatabaseInstanceRabbitmqImport(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "name", serviceName), resource.TestCheckResourceAttr(resourceName, "service", "messages-for-rabbitmq"), resource.TestCheckResourceAttr(resourceName, "plan", "standard"), - resource.TestCheckResourceAttr(resourceName, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(resourceName, "location", acc.Region()), ), }, { @@ -160,7 +160,7 @@ func testAccCheckIBMDatabaseInstanceRabbitmqBasic(databaseResourceGroup string, } CONFIGURATION } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceRabbitmqFullyspecified(databaseResourceGroup string, name string) string { @@ -204,7 +204,7 @@ func testAccCheckIBMDatabaseInstanceRabbitmqFullyspecified(databaseResourceGroup } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceRabbitmqReduced(databaseResourceGroup string, name string) string { @@ -231,7 +231,7 @@ func testAccCheckIBMDatabaseInstanceRabbitmqReduced(databaseResourceGroup string } } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceRabbitmqImport(databaseResourceGroup string, name string) string { @@ -248,5 +248,5 @@ func testAccCheckIBMDatabaseInstanceRabbitmqImport(databaseResourceGroup string, plan = "standard" location = "%[3]s" } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } diff --git a/ibm/service/database/resource_ibm_database_redis_test.go b/ibm/service/database/resource_ibm_database_redis_test.go index 3a0f4cd85a..869643aab5 100644 --- a/ibm/service/database/resource_ibm_database_redis_test.go +++ b/ibm/service/database/resource_ibm_database_redis_test.go @@ -34,7 +34,7 @@ func TestAccIBMDatabaseInstance_Redis_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-redis"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "adminuser", "admin"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "2048"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "2048"), @@ -51,7 +51,7 @@ func TestAccIBMDatabaseInstance_Redis_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-redis"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "2304"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "4096"), resource.TestCheckResourceAttr(name, "allowlist.#", "2"), @@ -63,7 +63,7 @@ func TestAccIBMDatabaseInstance_Redis_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-redis"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "2048"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "4096"), @@ -75,7 +75,7 @@ func TestAccIBMDatabaseInstance_Redis_Basic(t *testing.T) { resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-redis"), resource.TestCheckResourceAttr(name, "plan", "standard"), - resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(name, "location", acc.Region()), resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "2048"), resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "4096"), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), @@ -106,7 +106,7 @@ func TestAccIBMDatabaseInstanceRedisImport(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "name", serviceName), resource.TestCheckResourceAttr(resourceName, "service", "databases-for-redis"), resource.TestCheckResourceAttr(resourceName, "plan", "standard"), - resource.TestCheckResourceAttr(resourceName, "location", acc.IcdDbRegion), + resource.TestCheckResourceAttr(resourceName, "location", acc.Region()), resource.TestCheckResourceAttr(resourceName, "auto_scaling.#", "1"), resource.TestCheckResourceAttr(resourceName, "auto_scaling.0.disk.0.capacity_enabled", "true"), resource.TestCheckResourceAttr(resourceName, "auto_scaling.0.memory.0.io_enabled", "true"), @@ -192,7 +192,7 @@ func testAccCheckIBMDatabaseInstanceRedisBasic(databaseResourceGroup string, nam } CONFIGURATION } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceRedisFullyspecified(databaseResourceGroup string, name string) string { @@ -227,7 +227,7 @@ func testAccCheckIBMDatabaseInstanceRedisFullyspecified(databaseResourceGroup st description = "desc" } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceRedisReduced(databaseResourceGroup string, name string) string { @@ -254,7 +254,7 @@ func testAccCheckIBMDatabaseInstanceRedisReduced(databaseResourceGroup string, n } } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceRedisGroupMigration(databaseResourceGroup string, name string) string { @@ -282,7 +282,7 @@ func testAccCheckIBMDatabaseInstanceRedisGroupMigration(databaseResourceGroup st } } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceRedisImport(databaseResourceGroup string, name string) string { @@ -321,7 +321,7 @@ func testAccCheckIBMDatabaseInstanceRedisImport(databaseResourceGroup string, na } } } - `, databaseResourceGroup, name, acc.IcdDbRegion) + `, databaseResourceGroup, name, acc.Region()) } func testAccCheckIBMDatabaseInstanceRedisKPEncrypt(databaseResourceGroup string, kpInstanceName, kpKeyName, kpByokName, name string) string { return fmt.Sprintf(` @@ -360,5 +360,5 @@ func testAccCheckIBMDatabaseInstanceRedisKPEncrypt(databaseResourceGroup string, delete = "15m" } } - `, databaseResourceGroup, kpInstanceName, kpKeyName, kpByokName, name, acc.IcdDbRegion) + `, databaseResourceGroup, kpInstanceName, kpKeyName, kpByokName, name, acc.Region()) } diff --git a/website/docs/r/database.html.markdown b/website/docs/r/database.html.markdown index 00645a693f..04248090bb 100644 --- a/website/docs/r/database.html.markdown +++ b/website/docs/r/database.html.markdown @@ -668,6 +668,7 @@ Review the argument reference that you can specify for your resource. - `allocation_count` - (Optional, Integer) Allocated dedicated CPU per-member. - `name` - (Required, String) A descriptive name that is used to identify the database instance. The name must not include spaces. +- `offline_restore` - (Optional, Boolean) Enable or disable the Offline Restore option while performing a Point-in-time Recovery for MongoDB EE in a disaster recovery scenario when the source region is unavailable, see [Point-in-time Recovery](https://cloud.ibm.com/docs/databases-for-mongodb?topic=databases-for-mongodb-pitr&interface=api#pitr-offline-restore) - `plan` - (Required, Forces new resource, String) The name of the service plan that you choose for your instance. All databases use `standard`. `enterprise` is supported only for elasticsearch (`databases-for-elasticsearch`), cassandra (`databases-for-cassandra`), and mongodb(`databases-for-mongodb`). `platinum` is supported for elasticsearch (`databases-for-elasticsearch`). - `point_in_time_recovery_deployment_id` - (Optional, String) The ID of the source deployment that you want to recover back to. - `point_in_time_recovery_time` - (Optional, String) The timestamp in UTC format that you want to restore to. To retrieve the timestamp, run the `ibmcloud cdb postgresql earliest-pitr-timestamp ` command. To restore to the latest available time, use a blank string `""` as the timestamp. For more information, see [Point-in-time Recovery](https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-pitr). From f7e3945d40f480cc4c367ca8a0d3941c9d75591e Mon Sep 17 00:00:00 2001 From: Brian Gleeson Date: Tue, 14 Nov 2023 08:42:55 +0000 Subject: [PATCH 047/132] feat(tekton): bump ContinuousDelivery Go SDK version (#4918) * feat(tekton): bump ContinuousDelivery Go SDK version * Update SCC acceptance test --------- Co-authored-by: Gary Marjoram --- go.mod | 2 +- go.sum | 4 ++-- ...ource_ibm_cd_toolchain_tool_securitycompliance_test.go | 8 -------- ...ource_ibm_cd_toolchain_tool_securitycompliance_test.go | 8 -------- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index 8cec155f12..005d813e9e 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/IBM/cloudant-go-sdk v0.0.43 github.com/IBM/code-engine-go-sdk v0.0.0-20230606173928-4863db061918 github.com/IBM/container-registry-go-sdk v1.1.0 - github.com/IBM/continuous-delivery-go-sdk v1.2.1 + github.com/IBM/continuous-delivery-go-sdk v1.3.0 github.com/IBM/event-notifications-go-admin-sdk v0.2.7 github.com/IBM/eventstreams-go-sdk v1.4.0 github.com/IBM/go-sdk-core/v3 v3.2.4 diff --git a/go.sum b/go.sum index e1f9e3e9ff..58fc42d295 100644 --- a/go.sum +++ b/go.sum @@ -123,8 +123,8 @@ github.com/IBM/code-engine-go-sdk v0.0.0-20230606173928-4863db061918 h1:RfHezAVs github.com/IBM/code-engine-go-sdk v0.0.0-20230606173928-4863db061918/go.mod h1:IP6U/1NxgxzPeYdyiEwMaZyzelTw82JGHWl7bY78eQM= github.com/IBM/container-registry-go-sdk v1.1.0 h1:sYyknIod8R4RJZQqAheiduP6wbSTphE9Ag8ho28yXjc= github.com/IBM/container-registry-go-sdk v1.1.0/go.mod h1:4TwsCnQtVfZ4Vkapy/KPvQBKFc3VOyUZYkwRU4FTPrs= -github.com/IBM/continuous-delivery-go-sdk v1.2.1 h1:MVclWmjW6LevbYgrA7PGJzS+Dmqy3/JBYUpBp/ct+Vk= -github.com/IBM/continuous-delivery-go-sdk v1.2.1/go.mod h1:oW51tS5/MDCcEM7lUvjK1H9GFC/oKsRbyYfmvGyMGmw= +github.com/IBM/continuous-delivery-go-sdk v1.3.0 h1:WsILMVpNWD/5G40ltWeXbOj4y5ODQSq1hKXAnDJuNjw= +github.com/IBM/continuous-delivery-go-sdk v1.3.0/go.mod h1:oW51tS5/MDCcEM7lUvjK1H9GFC/oKsRbyYfmvGyMGmw= github.com/IBM/event-notifications-go-admin-sdk v0.2.7 h1:Y6YPiXZO3/oAhs7rY6ekowJAsf9J05g2UFq3wjFkuCs= github.com/IBM/event-notifications-go-admin-sdk v0.2.7/go.mod h1:iI6/TJt4GQBDsl8NYzoIYGnsNjMG0kOVIEl7mcM5v1E= github.com/IBM/eventstreams-go-sdk v1.4.0 h1:yS/Ns29sBOe8W2tynQmz9HTKqQZ0ckse4Py5Oy/F2rM= diff --git a/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance_test.go b/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance_test.go index 2f1d8428b3..280fa471cb 100644 --- a/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance_test.go +++ b/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance_test.go @@ -87,10 +87,6 @@ func testAccCheckIBMCdToolchainToolSecuritycomplianceDataSourceConfigBasic(tcNam parameters { name = "compliance" evidence_namespace = "cd" - trigger_scan = "disabled" - api_key = "api_key" - scope = "my-scope" - profile = "IBM Cloud Security Best Practices v1.0.0" evidence_repo_url = "https://github.example.com//compliance-evidence-" } } @@ -118,10 +114,6 @@ func testAccCheckIBMCdToolchainToolSecuritycomplianceDataSourceConfig(tcName str parameters { name = "compliance" evidence_namespace = "cd" - trigger_scan = "disabled" - api_key = "api_key" - scope = "my-scope" - profile = "IBM Cloud Security Best Practices v1.0.0" evidence_repo_url = "https://github.example.com//compliance-evidence-" } name = "%s" diff --git a/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance_test.go b/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance_test.go index 59e4162c65..a2ed43f81b 100644 --- a/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance_test.go +++ b/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance_test.go @@ -90,10 +90,6 @@ func testAccCheckIBMCdToolchainToolSecuritycomplianceConfigBasic(tcName string, parameters { name = "compliance" evidence_namespace = "cd" - trigger_scan = "disabled" - api_key = "api_key" - scope = "my-scope" - profile = "IBM Cloud Security Best Practices v1.0.0" evidence_repo_url = "https://github.example.com//compliance-evidence-" } } @@ -116,10 +112,6 @@ func testAccCheckIBMCdToolchainToolSecuritycomplianceConfig(tcName string, rgNam parameters { name = "compliance" evidence_namespace = "cd" - trigger_scan = "disabled" - api_key = "api_key" - scope = "my-scope" - profile = "IBM Cloud Security Best Practices v1.0.0" evidence_repo_url = "https://github.example.com//compliance-evidence-" } name = "%s" From 588d5d98d3e99e85740d5d76089f4d5754f42412 Mon Sep 17 00:00:00 2001 From: Shaun Colley <80714407+swcolley@users.noreply.github.com> Date: Tue, 14 Nov 2023 03:43:17 -0500 Subject: [PATCH 048/132] fix(IAM Policy Management): Added nest conditions to rule.conditions (#4896) * fix(IAM Policy Management): Added nest conditions to rule.conditions Signed-off-by: Shaun Colley * fix(IAM Policy Management): Updated go.mod and go.sum with latest go SDK Signed-off-by: Shaun Colley * fix(IAM Policy Management): Updated based on incoming sdk changes Signed-off-by: Shaun Colley * fix(IAM Policy Management): update based on sdk change Signed-off-by: Shaun Colley * fix(IAM Policy Management): update based on sdk change Signed-off-by: Shaun Colley * fix(IAM Policy Management): Fix commented out test case Signed-off-by: Shaun Colley --------- Signed-off-by: Shaun Colley --- go.mod | 2 +- go.sum | 4 + ibm/flex/structures.go | 146 ++++++++++------ ...data_source_ibm_iam_access_group_policy.go | 29 ++- .../data_source_ibm_iam_policy_template.go | 29 ++- ..._source_ibm_iam_policy_template_version.go | 29 ++- .../data_source_ibm_iam_service_policy.go | 29 ++- ...a_source_ibm_iam_trusted_profile_policy.go | 29 ++- .../data_source_ibm_iam_user_policy.go | 29 ++- .../resource_ibm_iam_access_group_policy.go | 29 ++- ...source_ibm_iam_access_group_policy_test.go | 165 ++++++++++++++++++ .../resource_ibm_iam_policy_template.go | 40 ++++- ...esource_ibm_iam_policy_template_version.go | 29 ++- .../resource_ibm_iam_service_policy.go | 29 ++- .../resource_ibm_iam_service_policy_test.go | 165 ++++++++++++++++++ ...resource_ibm_iam_trusted_profile_policy.go | 29 ++- ...rce_ibm_iam_trusted_profile_policy_test.go | 165 ++++++++++++++++++ .../iampolicy/resource_ibm_iam_user_policy.go | 29 ++- .../resource_ibm_iam_user_policy_test.go | 156 +++++++++++++++++ .../d/iam_access_group_policy.html.markdown | 8 +- .../docs/d/iam_service_policy.html.markdown | 8 +- .../iam_trusted_profile_policy.html.markdown | 8 +- website/docs/d/iam_user_policy.html.markdown | 8 +- .../r/iam_access_group_policy.html.markdown | 77 +++++++- .../docs/r/iam_service_policy.html.markdown | 77 +++++++- .../iam_trusted_profile_policy.html.markdown | 77 +++++++- website/docs/r/iam_user_policy.html.markdown | 74 +++++++- 27 files changed, 1403 insertions(+), 96 deletions(-) diff --git a/go.mod b/go.mod index 005d813e9e..ee7a35fb38 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/IBM/ibm-hpcs-uko-sdk v0.0.20-beta github.com/IBM/keyprotect-go-client v0.12.2 github.com/IBM/networking-go-sdk v0.42.2 - github.com/IBM/platform-services-go-sdk v0.52.0 + github.com/IBM/platform-services-go-sdk v0.53.1 github.com/IBM/project-go-sdk v0.0.99 github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 github.com/IBM/scc-go-sdk/v5 v5.1.3 diff --git a/go.sum b/go.sum index 58fc42d295..558bb22653 100644 --- a/go.sum +++ b/go.sum @@ -157,6 +157,10 @@ github.com/IBM/networking-go-sdk v0.42.2 h1:caqjx4jyFHi10Vlf3skHvlL6K3YJRVstsmCB github.com/IBM/networking-go-sdk v0.42.2/go.mod h1:lTUZwtUkMANMnrLHFIgRhHrkBfwASY/Iho1fabaPHxo= github.com/IBM/platform-services-go-sdk v0.52.0 h1:hbf640xE8T0Rwy2IUf5Pu4OATabGS4IDMnEInXUXs4o= github.com/IBM/platform-services-go-sdk v0.52.0/go.mod h1:6LxcUhIaSLP4SuQJXF9oLXBamSQogs5D9BcVwr4hmfU= +github.com/IBM/platform-services-go-sdk v0.52.1 h1:fUCtYMAekzsWO/ylZi31j6BpyJ1xKb39NG62zBXePbg= +github.com/IBM/platform-services-go-sdk v0.52.1/go.mod h1:6LxcUhIaSLP4SuQJXF9oLXBamSQogs5D9BcVwr4hmfU= +github.com/IBM/platform-services-go-sdk v0.53.1 h1:axpK4dzlf+C+KgHQZWXoKSUMoV2t6OrR5kGGumUEXrI= +github.com/IBM/platform-services-go-sdk v0.53.1/go.mod h1:CWSprvsCsXWvujmBzbtoJSmbRZS9FVV3O594b0t/GiM= github.com/IBM/project-go-sdk v0.0.99 h1:rQU/uQLW83OsAUfP/d8fFSIjp8ooEQIFjalYQD4i4aY= github.com/IBM/project-go-sdk v0.0.99/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig= github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 h1:NPUhkoOCRuv3OFWt19PmwjXGGTKlvmbuPg9fUrBUNe4= diff --git a/ibm/flex/structures.go b/ibm/flex/structures.go index 5f89a520a6..f4370020f9 100644 --- a/ibm/flex/structures.go +++ b/ibm/flex/structures.go @@ -1641,42 +1641,55 @@ func FlattenV2PolicyResourceTags(resource iampolicymanagementv1.V2PolicyResource return result } +func getConditionValues(v interface{}) []string { + var values []string + switch value := v.(type) { + case string: + values = append(values, value) + case []interface{}: + for _, v := range value { + values = append(values, fmt.Sprint(v)) + } + case nil: + default: + values = append(values, fmt.Sprintf("%v", value)) + } + return values +} + func FlattenRuleConditions(rule iampolicymanagementv1.V2PolicyRule) []map[string]interface{} { result := make([]map[string]interface{}, 0) if len(rule.Conditions) > 0 { - for _, c := range rule.Conditions { - var values []string - switch value := c.Value.(type) { - case string: - values = append(values, value) - case []interface{}: - for _, v := range value { - values = append(values, fmt.Sprint(v)) + for _, cIntf := range rule.Conditions { + c := cIntf.(*iampolicymanagementv1.NestedCondition) + if len(c.Conditions) > 0 { + nestedConditions := make([]map[string]interface{}, 0) + for _, nc := range c.Conditions { + values := getConditionValues(nc.Value) + nestedCondition := map[string]interface{}{ + "key": nc.Key, + "value": values, + "operator": nc.Operator, + } + nestedConditions = append(nestedConditions, nestedCondition) } - default: - values = append(values, value.(string)) - } - - condition := map[string]interface{}{ - "key": c.Key, - "value": values, - "operator": c.Operator, + condition := map[string]interface{}{ + "operator": c.Operator, + "conditions": nestedConditions, + } + result = append(result, condition) + } else { + values := getConditionValues(c.Value) + condition := map[string]interface{}{ + "key": c.Key, + "value": values, + "operator": c.Operator, + } + result = append(result, condition) } - result = append(result, condition) } } else { - var values []string - switch value := rule.Value.(type) { - case string: - values = append(values, value) - case []interface{}: - for _, v := range value { - values = append(values, fmt.Sprint(v)) - } - default: - values = append(values, value.(string)) - } - + values := getConditionValues(rule.Value) condition := map[string]interface{}{ "key": rule.Key, "value": values, @@ -3932,39 +3945,64 @@ func GenerateV2PolicyOptions(d *schema.ResourceData, meta interface{}) (iampolic return iampolicymanagementv1.CreateV2PolicyOptions{Control: policyControl, Resource: &policyResource}, nil } -func GeneratePolicyRule(d *schema.ResourceData, ruleConditions interface{}) *iampolicymanagementv1.V2PolicyRule { - conditions := []iampolicymanagementv1.RuleAttribute{} +func generatePolicyRuleCondition(c map[string]interface{}) iampolicymanagementv1.RuleAttribute { + key := c["key"].(string) + operator := c["operator"].(string) + r := iampolicymanagementv1.RuleAttribute{ + Key: &key, + Operator: &operator, + } - for _, condition := range ruleConditions.(*schema.Set).List() { - c := condition.(map[string]interface{}) - key := c["key"].(string) - operator := c["operator"].(string) - r := iampolicymanagementv1.RuleAttribute{ - Key: &key, - Operator: &operator, - } + interfaceValues := c["value"].([]interface{}) + values := make([]string, len(interfaceValues)) + for i, v := range interfaceValues { + values[i] = fmt.Sprint(v) + } - interfaceValues := c["value"].([]interface{}) - values := make([]string, len(interfaceValues)) - for i, v := range interfaceValues { - values[i] = fmt.Sprint(v) - } + if len(values) > 1 { + r.Value = &values + } else if operator == "stringExists" && values[0] == "true" { + r.Value = true + } else if operator == "stringExists" && values[0] == "false" { + r.Value = false + } else { + r.Value = &values[0] + } + return r +} - if len(values) > 1 { - r.Value = &values - } else if operator == "stringExists" && values[0] == "true" { - r.Value = true +func GeneratePolicyRule(d *schema.ResourceData, ruleConditions interface{}) *iampolicymanagementv1.V2PolicyRule { + conditions := []iampolicymanagementv1.NestedConditionIntf{} + + for _, ruleCondition := range ruleConditions.(*schema.Set).List() { + rc := ruleCondition.(map[string]interface{}) + con := rc["conditions"].([]interface{}) + if len(con) > 0 { + nestedConditions := []iampolicymanagementv1.RuleAttribute{} + for _, nc := range con { + nestedConditions = append(nestedConditions, generatePolicyRuleCondition(nc.(map[string]interface{}))) + } + nestedCondition := &iampolicymanagementv1.NestedCondition{} + nestedConditionsOperator := rc["operator"].(string) + nestedCondition.Operator = &nestedConditionsOperator + nestedCondition.Conditions = nestedConditions + conditions = append(conditions, nestedCondition) } else { - r.Value = &values[0] + ruleAttribute := generatePolicyRuleCondition(rc) + nestedCondition := &iampolicymanagementv1.NestedCondition{ + Key: ruleAttribute.Key, + Operator: ruleAttribute.Operator, + Value: ruleAttribute.Value, + } + conditions = append(conditions, nestedCondition) } - - conditions = append(conditions, r) } rule := new(iampolicymanagementv1.V2PolicyRule) if len(conditions) == 1 { - rule.Key = conditions[0].Key - rule.Operator = conditions[0].Operator - rule.Value = conditions[0].Value + ruleCondition := conditions[0].(*iampolicymanagementv1.NestedCondition) + rule.Key = ruleCondition.Key + rule.Operator = ruleCondition.Operator + rule.Value = ruleCondition.Value } else { ruleOperator := d.Get("rule_operator").(string) rule.Operator = &ruleOperator diff --git a/ibm/service/iampolicy/data_source_ibm_iam_access_group_policy.go b/ibm/service/iampolicy/data_source_ibm_iam_access_group_policy.go index a82b5632af..aa16b62557 100644 --- a/ibm/service/iampolicy/data_source_ibm_iam_access_group_policy.go +++ b/ibm/service/iampolicy/data_source_ibm_iam_access_group_policy.go @@ -145,7 +145,7 @@ func DataSourceIBMIAMAccessGroupPolicy() *schema.Resource { Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, - Required: true, + Optional: true, Description: "Key of the condition", }, "operator": { @@ -155,10 +155,35 @@ func DataSourceIBMIAMAccessGroupPolicy() *schema.Resource { }, "value": { Type: schema.TypeList, - Required: true, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Value of the condition", }, + "conditions": { + Type: schema.TypeList, + Optional: true, + Description: "Additional Rule conditions enforced by the policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + Description: "Key of the condition", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Operator of the condition", + }, + "value": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Value of the condition", + }, + }, + }, + }, }, }, }, diff --git a/ibm/service/iampolicy/data_source_ibm_iam_policy_template.go b/ibm/service/iampolicy/data_source_ibm_iam_policy_template.go index 1262ceb0a1..8062107d9a 100644 --- a/ibm/service/iampolicy/data_source_ibm_iam_policy_template.go +++ b/ibm/service/iampolicy/data_source_ibm_iam_policy_template.go @@ -137,7 +137,7 @@ func DataSourceIBMIAMPolicyTemplate() *schema.Resource { Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, - Required: true, + Optional: true, Description: "Key of the condition", }, "operator": { @@ -147,10 +147,35 @@ func DataSourceIBMIAMPolicyTemplate() *schema.Resource { }, "value": { Type: schema.TypeList, - Required: true, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Value of the condition", }, + "conditions": { + Type: schema.TypeList, + Optional: true, + Description: "Additional Rule conditions enforced by the policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + Description: "Key of the condition", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Operator of the condition", + }, + "value": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Value of the condition", + }, + }, + }, + }, }, }, }, diff --git a/ibm/service/iampolicy/data_source_ibm_iam_policy_template_version.go b/ibm/service/iampolicy/data_source_ibm_iam_policy_template_version.go index f6d87e3321..0b7ab07234 100644 --- a/ibm/service/iampolicy/data_source_ibm_iam_policy_template_version.go +++ b/ibm/service/iampolicy/data_source_ibm_iam_policy_template_version.go @@ -136,7 +136,7 @@ func DataSourceIBMIAMPolicyTemplateVersion() *schema.Resource { Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, - Required: true, + Optional: true, Description: "Key of the condition", }, "operator": { @@ -146,10 +146,35 @@ func DataSourceIBMIAMPolicyTemplateVersion() *schema.Resource { }, "value": { Type: schema.TypeList, - Required: true, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Value of the condition", }, + "conditions": { + Type: schema.TypeList, + Optional: true, + Description: "Additional Rule conditions enforced by the policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + Description: "Key of the condition", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Operator of the condition", + }, + "value": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Value of the condition", + }, + }, + }, + }, }, }, }, diff --git a/ibm/service/iampolicy/data_source_ibm_iam_service_policy.go b/ibm/service/iampolicy/data_source_ibm_iam_service_policy.go index 2f1f8d8f97..caf69db640 100644 --- a/ibm/service/iampolicy/data_source_ibm_iam_service_policy.go +++ b/ibm/service/iampolicy/data_source_ibm_iam_service_policy.go @@ -154,7 +154,7 @@ func DataSourceIBMIAMServicePolicy() *schema.Resource { Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, - Required: true, + Optional: true, Description: "Key of the condition", }, "operator": { @@ -164,10 +164,35 @@ func DataSourceIBMIAMServicePolicy() *schema.Resource { }, "value": { Type: schema.TypeList, - Required: true, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Value of the condition", }, + "conditions": { + Type: schema.TypeList, + Optional: true, + Description: "Additional Rule conditions enforced by the policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + Description: "Key of the condition", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Operator of the condition", + }, + "value": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Value of the condition", + }, + }, + }, + }, }, }, }, diff --git a/ibm/service/iampolicy/data_source_ibm_iam_trusted_profile_policy.go b/ibm/service/iampolicy/data_source_ibm_iam_trusted_profile_policy.go index ae0b425627..328eab1d08 100644 --- a/ibm/service/iampolicy/data_source_ibm_iam_trusted_profile_policy.go +++ b/ibm/service/iampolicy/data_source_ibm_iam_trusted_profile_policy.go @@ -154,7 +154,7 @@ func DataSourceIBMIAMTrustedProfilePolicy() *schema.Resource { Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, - Required: true, + Optional: true, Description: "Key of the condition", }, "operator": { @@ -164,10 +164,35 @@ func DataSourceIBMIAMTrustedProfilePolicy() *schema.Resource { }, "value": { Type: schema.TypeList, - Required: true, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Value of the condition", }, + "conditions": { + Type: schema.TypeList, + Optional: true, + Description: "Additional Rule conditions enforced by the policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + Description: "Key of the condition", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Operator of the condition", + }, + "value": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Value of the condition", + }, + }, + }, + }, }, }, }, diff --git a/ibm/service/iampolicy/data_source_ibm_iam_user_policy.go b/ibm/service/iampolicy/data_source_ibm_iam_user_policy.go index 4cf9652fe8..1f13f5638e 100644 --- a/ibm/service/iampolicy/data_source_ibm_iam_user_policy.go +++ b/ibm/service/iampolicy/data_source_ibm_iam_user_policy.go @@ -142,7 +142,7 @@ func DataSourceIBMIAMUserPolicy() *schema.Resource { Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, - Required: true, + Optional: true, Description: "Key of the condition", }, "operator": { @@ -152,10 +152,35 @@ func DataSourceIBMIAMUserPolicy() *schema.Resource { }, "value": { Type: schema.TypeList, - Required: true, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Value of the condition", }, + "conditions": { + Type: schema.TypeList, + Optional: true, + Description: "Additional Rule conditions enforced by the policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + Description: "Key of the condition", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Operator of the condition", + }, + "value": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Value of the condition", + }, + }, + }, + }, }, }, }, diff --git a/ibm/service/iampolicy/resource_ibm_iam_access_group_policy.go b/ibm/service/iampolicy/resource_ibm_iam_access_group_policy.go index 2c9ae69836..5bfcaf2be9 100644 --- a/ibm/service/iampolicy/resource_ibm_iam_access_group_policy.go +++ b/ibm/service/iampolicy/resource_ibm_iam_access_group_policy.go @@ -211,7 +211,7 @@ func ResourceIBMIAMAccessGroupPolicy() *schema.Resource { Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, - Required: true, + Optional: true, Description: "Key of the condition", }, "operator": { @@ -221,10 +221,35 @@ func ResourceIBMIAMAccessGroupPolicy() *schema.Resource { }, "value": { Type: schema.TypeList, - Required: true, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Value of the condition", }, + "conditions": { + Type: schema.TypeList, + Optional: true, + Description: "Additional Rule conditions enforced by the policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + Description: "Key of the condition", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Operator of the condition", + }, + "value": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Value of the condition", + }, + }, + }, + }, }, }, }, diff --git a/ibm/service/iampolicy/resource_ibm_iam_access_group_policy_test.go b/ibm/service/iampolicy/resource_ibm_iam_access_group_policy_test.go index 3a17f77b47..2e3d5e70e9 100644 --- a/ibm/service/iampolicy/resource_ibm_iam_access_group_policy_test.go +++ b/ibm/service/iampolicy/resource_ibm_iam_access_group_policy_test.go @@ -513,6 +513,37 @@ func TestAccIBMIAMAccessGroupPolicy_With_ServiceGroupID(t *testing.T) { }) } +func TestAccIBMIAMAccessGroupPolicy_With_Attribute_Based_Condition(t *testing.T) { + var conf iampolicymanagementv1.V2PolicyTemplateMetaData + name := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIAMAccessGroupPolicyDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMIAMAccessGroupPolicyAttributeBasedCondition(name), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIAMAccessGroupPolicyExists("ibm_iam_access_group_policy.policy", conf), + resource.TestCheckResourceAttr("ibm_iam_access_group.accgrp", "name", name), + resource.TestCheckResourceAttr("ibm_iam_access_group_policy.policy", "roles.#", "1"), + resource.TestCheckResourceAttr("ibm_iam_access_group_policy.policy", "pattern", "attribute-based-condition:resource:literal-and-wildcard"), + resource.TestCheckResourceAttr("ibm_iam_access_group_policy.policy", "description", "IAM Access Group Policy Attribute Based Condition Creation for test scenario"), + ), + }, + { + Config: testAccCheckIBMIAMAccessGroupPolicyUpdateAttributeBasedCondition(name), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ibm_iam_access_group.accgrp", "name", name), + resource.TestCheckResourceAttr("ibm_iam_access_group_policy.policy", "pattern", "attribute-based-condition:resource:literal-and-wildcard"), + resource.TestCheckResourceAttr("ibm_iam_access_group_policy.policy", "description", "IAM Access Group Policy Attribute Based Condition Update for test scenario"), + ), + }, + }, + }) +} + func testAccCheckIBMIAMAccessGroupPolicyDestroy(s *terraform.State) error { iamPolicyManagementClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).IAMPolicyManagementV1API() if err != nil { @@ -1126,3 +1157,137 @@ func testAccCheckIBMIAMAccessGroupPolicyUpdateWithServiceGroupId(name string) st } `, name) } + +func testAccCheckIBMIAMAccessGroupPolicyAttributeBasedCondition(name string) string { + return fmt.Sprintf(` + resource "ibm_iam_access_group" "accgrp" { + name = "%s" + } + + resource "ibm_iam_access_group_policy" "policy" { + access_group_id = ibm_iam_access_group.accgrp.id + roles = ["Writer"] + resource_attributes { + value = "cloud-object-storage" + operator = "stringEquals" + name = "serviceName" + } + resource_attributes { + value = "cos-instance" + operator = "stringEquals" + name = "serviceInstance" + } + resource_attributes { + value = "bucket" + operator = "stringEquals" + name = "resourceType" + } + resource_attributes { + value = "fgac-tf-test" + operator = "stringEquals" + name = "resource" + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringEqualsAnyOf" + value = ["/",""] + } + } + rule_conditions { + key = "{{resource.attributes.path}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringExists" + value = ["false"] + } + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringExists" + value = ["false"] + } + } + rule_operator = "or" + pattern = "attribute-based-condition:resource:literal-and-wildcard" + description = "IAM Access Group Policy Attribute Based Condition Creation for test scenario" + } + `, name) +} + +func testAccCheckIBMIAMAccessGroupPolicyUpdateAttributeBasedCondition(name string) string { + return fmt.Sprintf(` + resource "ibm_iam_access_group" "accgrp" { + name = "%s" + } + + resource "ibm_iam_access_group_policy" "policy" { + access_group_id = ibm_iam_access_group.accgrp.id + roles = ["Reader", "Writer"] + resource_attributes { + value = "cloud-object-storage" + operator = "stringEquals" + name = "serviceName" + } + resource_attributes { + value = "cos-instance" + operator = "stringEquals" + name = "serviceInstance" + } + resource_attributes { + value = "bucket" + operator = "stringEquals" + name = "resourceType" + } + resource_attributes { + value = "fgac-tf-test" + operator = "stringEquals" + name = "resource" + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringEqualsAnyOf" + value = ["/",""] + } + } + rule_conditions { + key = "{{resource.attributes.path}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringExists" + value = ["false"] + } + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringExists" + value = ["false"] + } + } + rule_operator = "or" + pattern = "attribute-based-condition:resource:literal-and-wildcard" + description = "IAM Access Group Policy Attribute Based Condition Update for test scenario" + } + `, name) +} diff --git a/ibm/service/iampolicy/resource_ibm_iam_policy_template.go b/ibm/service/iampolicy/resource_ibm_iam_policy_template.go index 62ec4e8712..a2c5018389 100644 --- a/ibm/service/iampolicy/resource_ibm_iam_policy_template.go +++ b/ibm/service/iampolicy/resource_ibm_iam_policy_template.go @@ -125,7 +125,7 @@ func ResourceIBMIAMPolicyTemplate() *schema.Resource { Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, - Required: true, + Optional: true, Description: "Key of the condition", }, "operator": { @@ -135,10 +135,35 @@ func ResourceIBMIAMPolicyTemplate() *schema.Resource { }, "value": { Type: schema.TypeList, - Required: true, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Value of the condition", }, + "conditions": { + Type: schema.TypeList, + Optional: true, + Description: "Additional Rule conditions enforced by the policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + Description: "Key of the condition", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Operator of the condition", + }, + "value": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Value of the condition", + }, + }, + }, + }, }, }, }, @@ -268,12 +293,12 @@ func generateTemplatePolicy(modelMap map[string]interface{}, iamPolicyManagement } if modelMap["rule_conditions"] != nil && len(modelMap["rule_conditions"].(*schema.Set).List()) > 0 { - conditions := []iampolicymanagementv1.RuleAttribute{} + conditions := []iampolicymanagementv1.NestedConditionIntf{} for _, condition := range modelMap["rule_conditions"].(*schema.Set).List() { c := condition.(map[string]interface{}) key := c["key"].(string) operator := c["operator"].(string) - r := iampolicymanagementv1.RuleAttribute{ + r := &iampolicymanagementv1.NestedCondition{ Key: &key, Operator: &operator, } @@ -296,9 +321,10 @@ func generateTemplatePolicy(modelMap map[string]interface{}, iamPolicyManagement } rule := new(iampolicymanagementv1.V2PolicyRule) if len(conditions) == 1 { - rule.Key = conditions[0].Key - rule.Operator = conditions[0].Operator - rule.Value = conditions[0].Value + ruleCondition := conditions[0].(*iampolicymanagementv1.NestedCondition) + rule.Key = ruleCondition.Key + rule.Operator = ruleCondition.Operator + rule.Value = ruleCondition.Value } else { ruleOperator := modelMap["rule_operator"].(string) rule.Operator = &ruleOperator diff --git a/ibm/service/iampolicy/resource_ibm_iam_policy_template_version.go b/ibm/service/iampolicy/resource_ibm_iam_policy_template_version.go index 1f34e5d8f5..819ab07014 100644 --- a/ibm/service/iampolicy/resource_ibm_iam_policy_template_version.go +++ b/ibm/service/iampolicy/resource_ibm_iam_policy_template_version.go @@ -123,7 +123,7 @@ func ResourceIBMIAMPolicyTemplateVersion() *schema.Resource { Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, - Required: true, + Optional: true, Description: "Key of the condition", }, "operator": { @@ -133,10 +133,35 @@ func ResourceIBMIAMPolicyTemplateVersion() *schema.Resource { }, "value": { Type: schema.TypeList, - Required: true, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Value of the condition", }, + "conditions": { + Type: schema.TypeList, + Optional: true, + Description: "Additional Rule conditions enforced by the policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + Description: "Key of the condition", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Operator of the condition", + }, + "value": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Value of the condition", + }, + }, + }, + }, }, }, }, diff --git a/ibm/service/iampolicy/resource_ibm_iam_service_policy.go b/ibm/service/iampolicy/resource_ibm_iam_service_policy.go index cb428e6c40..9b14ed0696 100644 --- a/ibm/service/iampolicy/resource_ibm_iam_service_policy.go +++ b/ibm/service/iampolicy/resource_ibm_iam_service_policy.go @@ -214,7 +214,7 @@ func ResourceIBMIAMServicePolicy() *schema.Resource { Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, - Required: true, + Optional: true, Description: "Key of the condition", }, "operator": { @@ -224,10 +224,35 @@ func ResourceIBMIAMServicePolicy() *schema.Resource { }, "value": { Type: schema.TypeList, - Required: true, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Value of the condition", }, + "conditions": { + Type: schema.TypeList, + Optional: true, + Description: "Additional Rule conditions enforced by the policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + Description: "Key of the condition", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Operator of the condition", + }, + "value": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Value of the condition", + }, + }, + }, + }, }, }, }, diff --git a/ibm/service/iampolicy/resource_ibm_iam_service_policy_test.go b/ibm/service/iampolicy/resource_ibm_iam_service_policy_test.go index 27d18b638e..93bdf6ddb6 100644 --- a/ibm/service/iampolicy/resource_ibm_iam_service_policy_test.go +++ b/ibm/service/iampolicy/resource_ibm_iam_service_policy_test.go @@ -474,6 +474,37 @@ func TestAccIBMIAMServicePolicy_With_ServiceGroupID(t *testing.T) { }) } +func TestAccIBMIAMServicePolicy_With_Attribute_Based_Condition(t *testing.T) { + var conf iampolicymanagementv1.V2PolicyTemplateMetaData + name := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIAMServicePolicyDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMIAMServicePolicyAttributeBasedCondition(name), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIAMServicePolicyExists("ibm_iam_service_policy.policy", conf), + resource.TestCheckResourceAttr("ibm_iam_service_id.serviceID", "name", name), + resource.TestCheckResourceAttr("ibm_iam_service_policy.policy", "roles.#", "1"), + resource.TestCheckResourceAttr("ibm_iam_service_policy.policy", "pattern", "attribute-based-condition:resource:literal-and-wildcard"), + resource.TestCheckResourceAttr("ibm_iam_service_policy.policy", "description", "IAM Service Policy Attribute Based Condition Creation for test scenario"), + ), + }, + { + Config: testAccCheckIBMIAMServicePolicyUpdateAttributeBasedCondition(name), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ibm_iam_service_id.serviceID", "name", name), + resource.TestCheckResourceAttr("ibm_iam_service_policy.policy", "pattern", "attribute-based-condition:resource:literal-and-wildcard"), + resource.TestCheckResourceAttr("ibm_iam_service_policy.policy", "description", "IAM Service Policy Attribute Based Condition Update for test scenario"), + ), + }, + }, + }) +} + func testAccCheckIBMIAMServicePolicyDestroy(s *terraform.State) error { rsContClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).IAMPolicyManagementV1API() if err != nil { @@ -1073,3 +1104,137 @@ func testAccCheckIBMIAMServiceUpdatePolicyWithServiceGroupId(name string) string } `, name) } + +func testAccCheckIBMIAMServicePolicyAttributeBasedCondition(name string) string { + return fmt.Sprintf(` + resource "ibm_iam_service_id" "serviceID" { + name = "%s" + } + + resource "ibm_iam_service_policy" "policy" { + iam_service_id = ibm_iam_service_id.serviceID.id + roles = ["Writer"] + resource_attributes { + value = "cloud-object-storage" + operator = "stringEquals" + name = "serviceName" + } + resource_attributes { + value = "cos-instance" + operator = "stringEquals" + name = "serviceInstance" + } + resource_attributes { + value = "bucket" + operator = "stringEquals" + name = "resourceType" + } + resource_attributes { + value = "fgac-tf-test" + operator = "stringEquals" + name = "resource" + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringEqualsAnyOf" + value = ["/",""] + } + } + rule_conditions { + key = "{{resource.attributes.path}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringExists" + value = ["false"] + } + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringExists" + value = ["false"] + } + } + rule_operator = "or" + pattern = "attribute-based-condition:resource:literal-and-wildcard" + description = "IAM Service Policy Attribute Based Condition Creation for test scenario" + } + `, name) +} + +func testAccCheckIBMIAMServicePolicyUpdateAttributeBasedCondition(name string) string { + return fmt.Sprintf(` + resource "ibm_iam_service_id" "serviceID" { + name = "%s" + } + + resource "ibm_iam_service_policy" "policy" { + iam_service_id = ibm_iam_service_id.serviceID.id + roles = ["Reader", "Writer"] + resource_attributes { + value = "cloud-object-storage" + operator = "stringEquals" + name = "serviceName" + } + resource_attributes { + value = "cos-instance" + operator = "stringEquals" + name = "serviceInstance" + } + resource_attributes { + value = "bucket" + operator = "stringEquals" + name = "resourceType" + } + resource_attributes { + value = "fgac-tf-test" + operator = "stringEquals" + name = "resource" + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringEqualsAnyOf" + value = ["/",""] + } + } + rule_conditions { + key = "{{resource.attributes.path}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringExists" + value = ["false"] + } + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringExists" + value = ["false"] + } + } + rule_operator = "or" + pattern = "attribute-based-condition:resource:literal-and-wildcard" + description = "IAM Service Policy Attribute Based Condition Update for test scenario" + } + `, name) +} diff --git a/ibm/service/iampolicy/resource_ibm_iam_trusted_profile_policy.go b/ibm/service/iampolicy/resource_ibm_iam_trusted_profile_policy.go index 16fe0f9499..f3631f38ae 100644 --- a/ibm/service/iampolicy/resource_ibm_iam_trusted_profile_policy.go +++ b/ibm/service/iampolicy/resource_ibm_iam_trusted_profile_policy.go @@ -214,7 +214,7 @@ func ResourceIBMIAMTrustedProfilePolicy() *schema.Resource { Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, - Required: true, + Optional: true, Description: "Key of the condition", }, "operator": { @@ -224,10 +224,35 @@ func ResourceIBMIAMTrustedProfilePolicy() *schema.Resource { }, "value": { Type: schema.TypeList, - Required: true, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Value of the condition", }, + "conditions": { + Type: schema.TypeList, + Optional: true, + Description: "Additional Rule conditions enforced by the policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + Description: "Key of the condition", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Operator of the condition", + }, + "value": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Value of the condition", + }, + }, + }, + }, }, }, }, diff --git a/ibm/service/iampolicy/resource_ibm_iam_trusted_profile_policy_test.go b/ibm/service/iampolicy/resource_ibm_iam_trusted_profile_policy_test.go index 662eb71ee4..ba0d80e5f7 100644 --- a/ibm/service/iampolicy/resource_ibm_iam_trusted_profile_policy_test.go +++ b/ibm/service/iampolicy/resource_ibm_iam_trusted_profile_policy_test.go @@ -465,6 +465,37 @@ func TestAccIBMIAMTrustedProfilePolicy_With_ServiceGroupID(t *testing.T) { }) } +func TestAccIBMIAMTrustedProfilePolicy_With_Attribute_Based_Condition(t *testing.T) { + var conf iampolicymanagementv1.V2PolicyTemplateMetaData + name := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIAMTrustedProfilePolicyDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMIAMTrustedProfilePolicyAttributeBasedCondition(name), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIAMTrustedProfilePolicyExists("ibm_iam_trusted_profile_policy.policy", conf), + resource.TestCheckResourceAttr("ibm_iam_trusted_profile.profileID", "name", name), + resource.TestCheckResourceAttr("ibm_iam_trusted_profile_policy.policy", "roles.#", "1"), + resource.TestCheckResourceAttr("ibm_iam_trusted_profile_policy.policy", "pattern", "attribute-based-condition:resource:literal-and-wildcard"), + resource.TestCheckResourceAttr("ibm_iam_trusted_profile_policy.policy", "description", "IAM Trusted Profile Policy Attribute Based Condition Creation for test scenario"), + ), + }, + { + Config: testAccCheckIBMIAMTrustedProfilePolicyUpdateAttributeBasedCondition(name), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ibm_iam_trusted_profile.profileID", "name", name), + resource.TestCheckResourceAttr("ibm_iam_trusted_profile_policy.policy", "pattern", "attribute-based-condition:resource:literal-and-wildcard"), + resource.TestCheckResourceAttr("ibm_iam_trusted_profile_policy.policy", "description", "IAM Trusted Profile Policy Attribute Based Condition Update for test scenario"), + ), + }, + }, + }) +} + func testAccCheckIBMIAMTrustedProfilePolicyDestroy(s *terraform.State) error { rsContClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).IAMPolicyManagementV1API() if err != nil { @@ -1033,3 +1064,137 @@ func testAccCheckIBMIAMTrustedProfilePolicyUpdateWithServiceGroupId(name string) } `, name) } + +func testAccCheckIBMIAMTrustedProfilePolicyAttributeBasedCondition(name string) string { + return fmt.Sprintf(` + resource "ibm_iam_trusted_profile" "profileID" { + name = "%s" + } + + resource "ibm_iam_trusted_profile_policy" "policy" { + profile_id = ibm_iam_trusted_profile.profileID.id + roles = ["Writer"] + resource_attributes { + value = "cloud-object-storage" + operator = "stringEquals" + name = "serviceName" + } + resource_attributes { + value = "cos-instance" + operator = "stringEquals" + name = "serviceInstance" + } + resource_attributes { + value = "bucket" + operator = "stringEquals" + name = "resourceType" + } + resource_attributes { + value = "fgac-tf-test" + operator = "stringEquals" + name = "resource" + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringEqualsAnyOf" + value = ["/",""] + } + } + rule_conditions { + key = "{{resource.attributes.path}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringExists" + value = ["false"] + } + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringExists" + value = ["false"] + } + } + rule_operator = "or" + pattern = "attribute-based-condition:resource:literal-and-wildcard" + description = "IAM Trusted Profile Policy Attribute Based Condition Creation for test scenario" + } + `, name) +} + +func testAccCheckIBMIAMTrustedProfilePolicyUpdateAttributeBasedCondition(name string) string { + return fmt.Sprintf(` + resource "ibm_iam_trusted_profile" "profileID" { + name = "%s" + } + + resource "ibm_iam_trusted_profile_policy" "policy" { + profile_id = ibm_iam_trusted_profile.profileID.id + roles = ["Reader", "Writer"] + resource_attributes { + value = "cloud-object-storage" + operator = "stringEquals" + name = "serviceName" + } + resource_attributes { + value = "cos-instance" + operator = "stringEquals" + name = "serviceInstance" + } + resource_attributes { + value = "bucket" + operator = "stringEquals" + name = "resourceType" + } + resource_attributes { + value = "fgac-tf-test" + operator = "stringEquals" + name = "resource" + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringEqualsAnyOf" + value = ["/",""] + } + } + rule_conditions { + key = "{{resource.attributes.path}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringExists" + value = ["false"] + } + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringExists" + value = ["false"] + } + } + rule_operator = "or" + pattern = "attribute-based-condition:resource:literal-and-wildcard" + description = "IAM Trusted Profile Policy Attribute Based Condition Update for test scenario" + } + `, name) +} diff --git a/ibm/service/iampolicy/resource_ibm_iam_user_policy.go b/ibm/service/iampolicy/resource_ibm_iam_user_policy.go index a30e0ab2bf..c3c3529ada 100644 --- a/ibm/service/iampolicy/resource_ibm_iam_user_policy.go +++ b/ibm/service/iampolicy/resource_ibm_iam_user_policy.go @@ -202,7 +202,7 @@ func ResourceIBMIAMUserPolicy() *schema.Resource { Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, - Required: true, + Optional: true, Description: "Key of the condition", }, "operator": { @@ -212,10 +212,35 @@ func ResourceIBMIAMUserPolicy() *schema.Resource { }, "value": { Type: schema.TypeList, - Required: true, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Value of the condition", }, + "conditions": { + Type: schema.TypeList, + Optional: true, + Description: "Additional Rule conditions enforced by the policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + Description: "Key of the condition", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Operator of the condition", + }, + "value": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Value of the condition", + }, + }, + }, + }, }, }, }, diff --git a/ibm/service/iampolicy/resource_ibm_iam_user_policy_test.go b/ibm/service/iampolicy/resource_ibm_iam_user_policy_test.go index f3f6acb1d3..46be011f8e 100644 --- a/ibm/service/iampolicy/resource_ibm_iam_user_policy_test.go +++ b/ibm/service/iampolicy/resource_ibm_iam_user_policy_test.go @@ -205,6 +205,7 @@ func TestAccIBMIAMUserPolicy_With_Resource_Attributes(t *testing.T) { }, }) } + func TestAccIBMIAMUserPolicy_account_management(t *testing.T) { var conf iampolicymanagementv1.V2PolicyTemplateMetaData name := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) @@ -479,6 +480,34 @@ func TestAccIBMIAMUSerPolicy_With_ServiceGroupID(t *testing.T) { }) } +func TestAccIBMIAMUserPolicy_With_Attribute_Based_Condition(t *testing.T) { + var conf iampolicymanagementv1.V2PolicyTemplateMetaData + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIAMUserPolicyDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMIAMUserPolicyAttributeBasedCondition(), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIAMUserPolicyExists("ibm_iam_user_policy.policy", conf), + resource.TestCheckResourceAttr("ibm_iam_user_policy.policy", "roles.#", "1"), + resource.TestCheckResourceAttr("ibm_iam_user_policy.policy", "pattern", "attribute-based-condition:resource:literal-and-wildcard"), + resource.TestCheckResourceAttr("ibm_iam_user_policy.policy", "description", "IAM User Policy Attribute Based Condition Creation for test scenario"), + ), + }, + { + Config: testAccCheckIBMIAMUserPolicyUpdateAttributeBasedCondition(), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ibm_iam_user_policy.policy", "pattern", "attribute-based-condition:resource:literal-and-wildcard"), + resource.TestCheckResourceAttr("ibm_iam_user_policy.policy", "description", "IAM User Policy Attribute Based Condition Update for test scenario"), + ), + }, + }, + }) +} + func testAccCheckIBMIAMUserPolicyDestroy(s *terraform.State) error { rsContClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).IAMPolicyManagementV1API() if err != nil { @@ -1008,3 +1037,130 @@ func testAccCheckIBMIAMUserPolicyWithServiceGroupId(name string) string { } `, acc.IAMUser) } + +func testAccCheckIBMIAMUserPolicyAttributeBasedCondition() string { + return fmt.Sprintf(` + + resource "ibm_iam_user_policy" "policy" { + ibm_id = "%s" + roles = ["Writer"] + resource_attributes { + value = "cloud-object-storage" + operator = "stringEquals" + name = "serviceName" + } + resource_attributes { + value = "cos-instance" + operator = "stringEquals" + name = "serviceInstance" + } + resource_attributes { + value = "bucket" + operator = "stringEquals" + name = "resourceType" + } + resource_attributes { + value = "fgac-tf-test" + operator = "stringEquals" + name = "resource" + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringEqualsAnyOf" + value = ["/",""] + } + } + rule_conditions { + key = "{{resource.attributes.path}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringExists" + value = ["false"] + } + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringExists" + value = ["false"] + } + } + rule_operator = "or" + pattern = "attribute-based-condition:resource:literal-and-wildcard" + description = "IAM User Policy Attribute Based Condition Creation for test scenario" + } + `, acc.IAMUser) +} + +func testAccCheckIBMIAMUserPolicyUpdateAttributeBasedCondition() string { + return fmt.Sprintf(` + resource "ibm_iam_user_policy" "policy" { + ibm_id = "%s" + roles = ["Reader", "Writer"] + resource_attributes { + value = "cloud-object-storage" + operator = "stringEquals" + name = "serviceName" + } + resource_attributes { + value = "cos-instance" + operator = "stringEquals" + name = "serviceInstance" + } + resource_attributes { + value = "bucket" + operator = "stringEquals" + name = "resourceType" + } + resource_attributes { + value = "fgac-tf-test" + operator = "stringEquals" + name = "resource" + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringEqualsAnyOf" + value = ["/",""] + } + } + rule_conditions { + key = "{{resource.attributes.path}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringExists" + value = ["false"] + } + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringExists" + value = ["false"] + } + } + rule_operator = "or" + pattern = "attribute-based-condition:resource:literal-and-wildcard" + description = "IAM User Policy Attribute Based Condition Update for test scenario" + } + `, acc.IAMUser) +} diff --git a/website/docs/d/iam_access_group_policy.html.markdown b/website/docs/d/iam_access_group_policy.html.markdown index cc6c9c6308..147f408b13 100644 --- a/website/docs/d/iam_access_group_policy.html.markdown +++ b/website/docs/d/iam_access_group_policy.html.markdown @@ -76,7 +76,13 @@ In addition to all argument reference list, you can access the following attribu Nested schema for `rule_conditions`: - `key` - (String) The key of a rule condition. - `operator` - (String) The operator of a rule condition. - - `value` - (List of Strings) The valjue of a rule condition. + - `value` - (List of Strings) The value of a rule condition. + - `conditions` - (List of Objects) A nested block describing additional rule conditions of this policy. + + Nested schema for `conditions`: + - `key` - (String) The key of a condition. + - `operator` - (String) The operator of a condition. + - `value` - (List of Strings) The value of a condition. - `rule_operator` - (String) The operator used to evaluate multiple rule conditions, e.g., all must be satisfied with `and`. - `pattern` - (String) The pattern that the rule follows, e.g., `time-based-conditions:weekly:all-day`. diff --git a/website/docs/d/iam_service_policy.html.markdown b/website/docs/d/iam_service_policy.html.markdown index d3b66757bc..ce36e8d94a 100644 --- a/website/docs/d/iam_service_policy.html.markdown +++ b/website/docs/d/iam_service_policy.html.markdown @@ -74,7 +74,13 @@ In addition to all argument reference list, you can access the following attribu Nested schema for `rule_conditions`: - `key` - (String) The key of a rule condition. - `operator` - (String) The operator of a rule condition. - - `value` - (List of Strings) The valjue of a rule condition. + - `value` - (List of Strings) The value of a rule condition. + - `conditions` - (List of Objects) A nested block describing additional rule conditions of this policy. + + Nested schema for `conditions`: + - `key` - (String) The key of a condition. + - `operator` - (String) The operator of a condition. + - `value` - (List of Strings) The value of a condition. - `rule_operator` - (String) The operator used to evaluate multiple rule conditions, e.g., all must be satisfied with `and`. - `pattern` - (String) The pattern that the rule follows, e.g., `time-based-conditions:weekly:all-day`. diff --git a/website/docs/d/iam_trusted_profile_policy.html.markdown b/website/docs/d/iam_trusted_profile_policy.html.markdown index d6cf4346b1..0a1c93d222 100644 --- a/website/docs/d/iam_trusted_profile_policy.html.markdown +++ b/website/docs/d/iam_trusted_profile_policy.html.markdown @@ -75,7 +75,13 @@ In addition to all argument reference list, you can access the following attribu Nested schema for `rule_conditions`: - `key` - (String) The key of a rule condition. - `operator` - (String) The operator of a rule condition. - - `value` - (List of Strings) The valjue of a rule condition. + - `value` - (List of Strings) The value of a rule condition. + - `conditions` - (List of Objects) A nested block describing additional rule conditions of this policy. + + Nested schema for `conditions`: + - `key` - (String) The key of a condition. + - `operator` - (String) The operator of a condition. + - `value` - (List of Strings) The value of a condition. - `rule_operator` - (String) The operator used to evaluate multiple rule conditions, e.g., all must be satisfied with `and`. - `pattern` - (String) The pattern that the rule follows, e.g., `time-based-conditions:weekly:all-day`. diff --git a/website/docs/d/iam_user_policy.html.markdown b/website/docs/d/iam_user_policy.html.markdown index 8a9cfb2a36..78110fcdbc 100644 --- a/website/docs/d/iam_user_policy.html.markdown +++ b/website/docs/d/iam_user_policy.html.markdown @@ -72,7 +72,13 @@ In addition to all argument reference list, you can access the following attribu Nested schema for `rule_conditions`: - `key` - (String) The key of a rule condition. - `operator` - (String) The operator of a rule condition. - - `value` - (List of Strings) The valjue of a rule condition. + - `value` - (List of Strings) The value of a rule condition. + - `conditions` - (List of Objects) A nested block describing additional rule conditions of this policy. + + Nested schema for `conditions`: + - `key` - (String) The key of a condition. + - `operator` - (String) The operator of a condition. + - `value` - (List of Strings) The value of a condition. - `rule_operator` - (String) The operator used to evaluate multiple rule conditions, e.g., all must be satisfied with `and`. - `pattern` - (String) The pattern that the rule follows, e.g., `time-based-conditions:weekly:all-day`. diff --git a/website/docs/r/iam_access_group_policy.html.markdown b/website/docs/r/iam_access_group_policy.html.markdown index c54692b0c9..550dca2d88 100644 --- a/website/docs/r/iam_access_group_policy.html.markdown +++ b/website/docs/r/iam_access_group_policy.html.markdown @@ -267,6 +267,73 @@ resource "ibm_iam_access_group_policy" "policy" { } ``` +### Access Group Policy by using Attribute Based Condition +`rule_conditions` can be used in conjunction with `pattern = attribute-based-condition:resource:literal-and-wildcard` and `rule_operator` to implement more complex policy conditions. **Note** Currently, a policy resource created without `rule_conditions`, `pattern`, and `rule_operator` cannot be updated including those conditions on update. + +```terraform +resource "ibm_iam_access_group" "accgrp" { + name = "access_group" +} +resource "ibm_iam_access_group_policy" "policy" { + access_group_id = ibm_iam_access_group.accgrp.id + roles = ["Writer"] + resource_attributes { + value = "cloud-object-storage" + operator = "stringEquals" + name = "serviceName" + } + resource_attributes { + value = "cos-instance" + operator = "stringEquals" + name = "serviceInstance" + } + resource_attributes { + value = "bucket" + operator = "stringEquals" + name = "resourceType" + } + resource_attributes { + value = "fgac-tf-test" + operator = "stringEquals" + name = "resource" + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringEqualsAnyOf" + value = ["/",""] + } + } + rule_conditions { + key = "{{resource.attributes.path}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringExists" + value = ["false"] + } + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringExists" + value = ["false"] + } + } + rule_operator = "or" + pattern = "attribute-based-condition:resource:literal-and-wildcard" + description = "IAM User Policy Attribute Based Condition Creation for test scenario" +} +``` + ## Argument reference Review the argument references that you can specify for your resource. @@ -304,9 +371,15 @@ Review the argument references that you can specify for your resource. - `rule_conditions` - (Optional, List) A nested block describing the rule conditions of this policy. Nested schema for `rule_conditions`: - - `key` - (Required, String) The key of a rule condition. + - `key` - (Optional, String) The key of a rule condition. - `operator` - (Required, String) The operator of a rule condition. - - `value` - (Required, List) The valjue of a rule condition. + - `value` - (Optional, List) The value of a rule condition. + - `conditions` - (Optional, List) A nested block describing additional conditions of this policy. + + Nested schema for `conditions`: + - `key` - (Required, String) The key of a condition. + - `operator` - (Required, String) The operator of a condition. + - `value` - (Required, List) The value of a condition. - `rule_operator` - (Optional, String) The operator used to evaluate multiple rule conditions, e.g., all must be satisfied with `and`. diff --git a/website/docs/r/iam_service_policy.html.markdown b/website/docs/r/iam_service_policy.html.markdown index dc9b0ec664..99291b2c01 100644 --- a/website/docs/r/iam_service_policy.html.markdown +++ b/website/docs/r/iam_service_policy.html.markdown @@ -268,6 +268,73 @@ resource "ibm_iam_service_policy" "policy" { } ``` +### Service Policy by using Attribute Based Condition +`rule_conditions` can be used in conjunction with `pattern = attribute-based-condition:resource:literal-and-wildcard` and `rule_operator` to implement more complex policy conditions. **Note** Currently, a policy resource created without `rule_conditions`, `pattern`, and `rule_operator` cannot be updated including those conditions on update. + +```terraform +resource "ibm_iam_service_id" "service_id" { + name = "test" +} +resource "ibm_iam_service_policy" "policy" { + iam_service_id = ibm_iam_service_id.service_id.id + roles = ["Writer"] + resource_attributes { + value = "cloud-object-storage" + operator = "stringEquals" + name = "serviceName" + } + resource_attributes { + value = "cos-instance" + operator = "stringEquals" + name = "serviceInstance" + } + resource_attributes { + value = "bucket" + operator = "stringEquals" + name = "resourceType" + } + resource_attributes { + value = "fgac-tf-test" + operator = "stringEquals" + name = "resource" + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringEqualsAnyOf" + value = ["/",""] + } + } + rule_conditions { + key = "{{resource.attributes.path}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringExists" + value = ["false"] + } + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringExists" + value = ["false"] + } + } + rule_operator = "or" + pattern = "attribute-based-condition:resource:literal-and-wildcard" + description = "IAM User Policy Attribute Based Condition Creation for test scenario" +} +``` + ## Argument reference Review the argument references that you can specify for your resource. @@ -307,9 +374,15 @@ Review the argument references that you can specify for your resource. - `rule_conditions` - (Optional, List) A nested block describing the rule conditions of this policy. Nested schema for `rule_conditions`: - - `key` - (Required, String) The key of a rule condition. + - `key` - (Optional, String) The key of a rule condition. - `operator` - (Required, String) The operator of a rule condition. - - `value` - (Required, List) The valjue of a rule condition. + - `value` - (Optional, List) The value of a rule condition. + - `conditions` - (Optional, List) A nested block describing additional conditions of this policy. + + Nested schema for `conditions`: + - `key` - (Required, String) The key of a condition. + - `operator` - (Required, String) The operator of a condition. + - `value` - (Required, List) The value of a condition. - `rule_operator` - (Optional, String) The operator used to evaluate multiple rule conditions, e.g., all must be satisfied with `and`. diff --git a/website/docs/r/iam_trusted_profile_policy.html.markdown b/website/docs/r/iam_trusted_profile_policy.html.markdown index e987c0feb9..79e59ada80 100644 --- a/website/docs/r/iam_trusted_profile_policy.html.markdown +++ b/website/docs/r/iam_trusted_profile_policy.html.markdown @@ -261,6 +261,73 @@ resource "ibm_iam_trusted_profile_policy" "policy" { ``` +### Trusted Profile Policy by using Attribute Based Condition +`rule_conditions` can be used in conjunction with `pattern = attribute-based-condition:resource:literal-and-wildcard` and `rule_operator` to implement more complex policy conditions. **Note** Currently, a policy resource created without `rule_conditions`, `pattern`, and `rule_operator` cannot be updated including those conditions on update. + +```terraform +resource "ibm_iam_trusted_profile" "profile_id" { + name = "test" +} +resource "ibm_iam_trusted_profile_policy" "policy" { + profile_id = ibm_iam_trusted_profile.profile_id.id + roles = ["Writer"] + resource_attributes { + value = "cloud-object-storage" + operator = "stringEquals" + name = "serviceName" + } + resource_attributes { + value = "cos-instance" + operator = "stringEquals" + name = "serviceInstance" + } + resource_attributes { + value = "bucket" + operator = "stringEquals" + name = "resourceType" + } + resource_attributes { + value = "fgac-tf-test" + operator = "stringEquals" + name = "resource" + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringEqualsAnyOf" + value = ["/",""] + } + } + rule_conditions { + key = "{{resource.attributes.path}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringExists" + value = ["false"] + } + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringExists" + value = ["false"] + } + } + rule_operator = "or" + pattern = "attribute-based-condition:resource:literal-and-wildcard" + description = "IAM User Policy Attribute Based Condition Creation for test scenario" +} +``` + ## Argument reference Review the argument references that you can specify for your resource. @@ -301,9 +368,15 @@ Review the argument references that you can specify for your resource. - `rule_conditions` - (Optional, List) A nested block describing the rule conditions of this policy. Nested schema for `rule_conditions`: - - `key` - (Required, String) The key of a rule condition. + - `key` - (Optional, String) The key of a rule condition. - `operator` - (Required, String) The operator of a rule condition. - - `value` - (Required, List) The valjue of a rule condition. + - `value` - (Optional, List) The value of a rule condition. + - `conditions` - (Optional, List) A nested block describing additional conditions of this policy. + + Nested schema for `conditions`: + - `key` - (Required, String) The key of a condition. + - `operator` - (Required, String) The operator of a condition. + - `value` - (Required, List) The value of a condition. - `rule_operator` - (Optional, String) The operator used to evaluate multiple rule conditions, e.g., all must be satisfied with `and`. diff --git a/website/docs/r/iam_user_policy.html.markdown b/website/docs/r/iam_user_policy.html.markdown index ef551b1c77..1a17ab207d 100644 --- a/website/docs/r/iam_user_policy.html.markdown +++ b/website/docs/r/iam_user_policy.html.markdown @@ -202,8 +202,72 @@ resource "ibm_iam_user_policy" "policy" { value = "IAM" } } +``` + +### User Policy by using Attribute Based Condition +`rule_conditions` can be used in conjunction with `pattern = attribute-based-condition:resource:literal-and-wildcard` and `rule_operator` to implement more complex policy conditions. **Note** Currently, a policy resource created without `rule_conditions`, `pattern`, and `rule_operator` cannot be updated including those conditions on update. +```terraform +resource "ibm_iam_user_policy" "policy" { + ibm_id = "test@in.ibm.com" + roles = ["Writer"] + resource_attributes { + value = "cloud-object-storage" + operator = "stringEquals" + name = "serviceName" + } + resource_attributes { + value = "cos-instance" + operator = "stringEquals" + name = "serviceInstance" + } + resource_attributes { + value = "bucket" + operator = "stringEquals" + name = "resourceType" + } + resource_attributes { + value = "fgac-tf-test" + operator = "stringEquals" + name = "resource" + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringEqualsAnyOf" + value = ["/",""] + } + } + rule_conditions { + key = "{{resource.attributes.path}}" + operator = "stringMatch" + value = ["folder1/subfolder1/*"] + } + rule_conditions { + operator = "and" + conditions { + key = "{{resource.attributes.delimiter}}" + operator = "stringExists" + value = ["false"] + } + conditions { + key = "{{resource.attributes.prefix}}" + operator = "stringExists" + value = ["false"] + } + } + rule_operator = "or" + pattern = "attribute-based-condition:resource:literal-and-wildcard" + description = "IAM User Policy Attribute Based Condition Creation for test scenario" +} ``` + ## Argument reference Review the argument references that you can specify for your resource. @@ -242,9 +306,15 @@ Review the argument references that you can specify for your resource. - `rule_conditions` - (Optional, List) A nested block describing the rule conditions of this policy. Nested schema for `rule_conditions`: - - `key` - (Required, String) The key of a rule condition. + - `key` - (Optional, String) The key of a rule condition. - `operator` - (Required, String) The operator of a rule condition. - - `value` - (Required, List) The valjue of a rule condition. + - `value` - (Optional, List) The value of a rule condition. + - `conditions` - (Optional, List) A nested block describing additional conditions of this policy. + + Nested schema for `conditions`: + - `key` - (Required, String) The key of a condition. + - `operator` - (Required, String) The operator of a condition. + - `value` - (Required, List) The value of a condition. - `rule_operator` - (Optional, String) The operator used to evaluate multiple rule conditions, e.g., all must be satisfied with `and`. From 19f1bb122a9b9acad067e63132531f1c6db30b54 Mon Sep 17 00:00:00 2001 From: Gary Marjoram Date: Mon, 13 Nov 2023 12:04:08 +0000 Subject: [PATCH 049/132] Updates to SCC tool --- ...bm_cd_toolchain_tool_securitycompliance.go | 28 +--------------- ...bm_cd_toolchain_tool_securitycompliance.go | 33 ++----------------- ...hain_tool_securitycompliance.html.markdown | 8 +---- ...hain_tool_securitycompliance.html.markdown | 10 ++---- 4 files changed, 6 insertions(+), 73 deletions(-) diff --git a/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance.go b/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance.go index 11cf10dc7d..143fe95bb7 100644 --- a/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance.go +++ b/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance.go @@ -96,31 +96,6 @@ func DataSourceIBMCdToolchainToolSecuritycompliance() *schema.Resource { Computed: true, Description: "The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment pipeline, or `cc` which will use evidence generated by a Continuous Compliance pipeline.", }, - "trigger_scan": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Deprecated: "This argument is deprecated and may be removed in a future release", - Description: "Set to `enabled` to indicate that a DevSecOps pipeline task should trigger a Security and Compliance Center run of a Hybrid cloud validation scan. Note, each scan may incur charges. When enabled, other parameters become relevant that are needed to trigger that scan; `api_key`, `scope`, `profile`. Hybrid cloud scans are deprecated and are planned to be removed. This option will stop working at that time. For more information see the [Security and Compliance Center Release Notes](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-release-notes#security-compliance-march312023).", - }, - "api_key": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Sensitive: true, - Deprecated: "This argument is deprecated and may be removed in a future release", - Description: "The IBM Cloud API key used to access the Security and Compliance Center API. This parameter is only relevant when the `trigger_scan` parameter is `enabled`. For information about the deprecation see the `trigger_scan` parameter. You can use a toolchain secret reference for this parameter. For more information, see [Protecting your sensitive data in Continuous Delivery](https://cloud.ibm.com/docs/ContinuousDelivery?topic=ContinuousDelivery-cd_data_security#cd_secure_credentials).", - }, - "scope": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Deprecated: "This argument is deprecated and may be removed in a future release", - Description: "The name of a Security and Compliance Center scope, which has previously been created in that service. When the `trigger_scan` parameter is set to `enabled`, then the Validation scan will scan all the resources in that scope. Select a scope that contains this toolchain, so that the scan will find the evidence that has been recently updated by the DevSecOps pipeline-run. This parameter is only relevant when the `trigger_scan` parameter is `enabled`. For information about the deprecation see the `trigger_scan` parameter.", - }, - "profile": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Deprecated: "This argument is deprecated and may be removed in a future release", - Description: "The name of a Security and Compliance Center, Hybrid cloud profile. Usually, use the predefined profile \"IBM Cloud Security Best Practices v1.0.0\", which contains the DevSecOps toolchain goals. Or use a user-authored customized profile that has been configured to contain those goals. When the `trigger_scan` parameter is set to `enabled`, then the Validation scan will use the controls and goals in the configured profile. If configured with a profile that does not check the DevSecOps toolchain goals, it might incorrectly indicate that the toolchain status is passed even though some of the DevSecOps scans had actually failed. This parameter is only relevant when the `trigger_scan` parameter is `enabled`. For information about the deprecation see the `trigger_scan` parameter.", - }, "use_profile_attachment": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -140,7 +115,7 @@ func DataSourceIBMCdToolchainToolSecuritycompliance() *schema.Resource { "profile_name": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "The name of a Security and Compliance Center profile. Usually, use one of the predefined profiles \"IBM Cloud Security Best Practices\" or \"IBM Cloud for Financial Services\", which contain the DevSecOps Toolchain rules. Or use a user-authored customized profile that has been configured to contain those rules. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`.", + Description: "The name of a Security and Compliance Center profile. Usually, use the \"IBM Cloud Framework for Financial Services\" predefined profile, which contains the DevSecOps Toolchain rules. Or use a user-authored customized profile that has been configured to contain those rules. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`.", }, "profile_version": &schema.Schema{ Type: schema.TypeString, @@ -232,7 +207,6 @@ func dataSourceIBMCdToolchainToolSecuritycomplianceRead(context context.Context, if toolchainTool.Parameters != nil { remapFields := map[string]string{ "evidence_repo_url": "evidence_repo_name", - "api_key": "api-key", } modelMap := GetParametersFromRead(toolchainTool.Parameters, DataSourceIBMCdToolchainToolSecuritycompliance(), remapFields) parameters = append(parameters, modelMap) diff --git a/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance.go b/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance.go index 1da7eaadfe..be80157483 100644 --- a/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance.go +++ b/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance.go @@ -56,35 +56,9 @@ func ResourceIBMCdToolchainToolSecuritycompliance() *schema.Resource { Description: "The name for this tool integration, shown on the toolchain page.", }, "evidence_namespace": &schema.Schema{ - Type: schema.TypeString, - Required: true, - Description: "The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment pipeline, or `cc` which will use evidence generated by a Continuous Compliance pipeline.", - }, - "trigger_scan": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Deprecated: "This argument is deprecated and may be removed in a future release", - Description: "Set to `enabled` to indicate that a DevSecOps pipeline task should trigger a Security and Compliance Center run of a Hybrid cloud validation scan. Note, each scan may incur charges. When enabled, other parameters become relevant that are needed to trigger that scan; `api_key`, `scope`, `profile`. Hybrid cloud scans are deprecated and are planned to be removed. This option will stop working at that time. For more information see the [Security and Compliance Center Release Notes](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-release-notes#security-compliance-march312023).", - }, - "api_key": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - DiffSuppressFunc: flex.SuppressHashedRawSecret, - Sensitive: true, - Deprecated: "This argument is deprecated and may be removed in a future release", - Description: "The IBM Cloud API key used to access the Security and Compliance Center API. This parameter is only relevant when the `trigger_scan` parameter is `enabled`. For information about the deprecation see the `trigger_scan` parameter. You can use a toolchain secret reference for this parameter. For more information, see [Protecting your sensitive data in Continuous Delivery](https://cloud.ibm.com/docs/ContinuousDelivery?topic=ContinuousDelivery-cd_data_security#cd_secure_credentials).", - }, - "scope": &schema.Schema{ Type: schema.TypeString, Optional: true, - Deprecated: "This argument is deprecated and may be removed in a future release", - Description: "The name of a Security and Compliance Center scope, which has previously been created in that service. When the `trigger_scan` parameter is set to `enabled`, then the Validation scan will scan all the resources in that scope. Select a scope that contains this toolchain, so that the scan will find the evidence that has been recently updated by the DevSecOps pipeline-run. This parameter is only relevant when the `trigger_scan` parameter is `enabled`. For information about the deprecation see the `trigger_scan` parameter.", - }, - "profile": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Deprecated: "This argument is deprecated and may be removed in a future release", - Description: "The name of a Security and Compliance Center, Hybrid cloud profile. Usually, use the predefined profile \"IBM Cloud Security Best Practices v1.0.0\", which contains the DevSecOps toolchain goals. Or use a user-authored customized profile that has been configured to contain those goals. When the `trigger_scan` parameter is set to `enabled`, then the Validation scan will use the controls and goals in the configured profile. If configured with a profile that does not check the DevSecOps toolchain goals, it might incorrectly indicate that the toolchain status is passed even though some of the DevSecOps scans had actually failed. This parameter is only relevant when the `trigger_scan` parameter is `enabled`. For information about the deprecation see the `trigger_scan` parameter.", + Description: "The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment pipeline, or `cc` which will use evidence generated by a Continuous Compliance pipeline.", }, "use_profile_attachment": &schema.Schema{ Type: schema.TypeString, @@ -106,7 +80,7 @@ func ResourceIBMCdToolchainToolSecuritycompliance() *schema.Resource { "profile_name": &schema.Schema{ Type: schema.TypeString, Optional: true, - Description: "The name of a Security and Compliance Center profile. Usually, use one of the predefined profiles \"IBM Cloud Security Best Practices\" or \"IBM Cloud for Financial Services\", which contain the DevSecOps Toolchain rules. Or use a user-authored customized profile that has been configured to contain those rules. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`.", + Description: "The name of a Security and Compliance Center profile. Usually, use the \"IBM Cloud Framework for Financial Services\" predefined profile, which contains the DevSecOps Toolchain rules. Or use a user-authored customized profile that has been configured to contain those rules. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`.", }, "profile_version": &schema.Schema{ Type: schema.TypeString, @@ -223,7 +197,6 @@ func resourceIBMCdToolchainToolSecuritycomplianceCreate(context context.Context, createToolOptions.SetToolTypeID("security_compliance") remapFields := map[string]string{ "evidence_repo_url": "evidence_repo_name", - "api_key": "api-key", } parametersModel := GetParametersForCreate(d, ResourceIBMCdToolchainToolSecuritycompliance(), remapFields) createToolOptions.SetParameters(parametersModel) @@ -292,7 +265,6 @@ func resourceIBMCdToolchainToolSecuritycomplianceRead(context context.Context, d } remapFields := map[string]string{ "evidence_repo_url": "evidence_repo_name", - "api_key": "api-key", } parametersMap := GetParametersFromRead(toolchainTool.Parameters, ResourceIBMCdToolchainToolSecuritycompliance(), remapFields) if err = d.Set("parameters", []map[string]interface{}{parametersMap}); err != nil { @@ -361,7 +333,6 @@ func resourceIBMCdToolchainToolSecuritycomplianceUpdate(context context.Context, if d.HasChange("parameters") { remapFields := map[string]string{ "evidence_repo_url": "evidence_repo_name", - "api_key": "api-key", } parameters := GetParametersForUpdate(d, ResourceIBMCdToolchainToolSecuritycompliance(), remapFields) patchVals.Parameters = parameters diff --git a/website/docs/d/cd_toolchain_tool_securitycompliance.html.markdown b/website/docs/d/cd_toolchain_tool_securitycompliance.html.markdown index 81fdc56c58..bf3493ad3e 100644 --- a/website/docs/d/cd_toolchain_tool_securitycompliance.html.markdown +++ b/website/docs/d/cd_toolchain_tool_securitycompliance.html.markdown @@ -44,8 +44,6 @@ After your data source is created, you can read values from the following attrib * `parameters` - (List) Unique key-value pairs representing parameters to be used to create the tool. A list of parameters for each tool integration can be found in the Configuring tool integrations page. Nested schema for **parameters**: - * `api_key` - (Deprecated, String) The IBM Cloud API key used to access the Security and Compliance Center API. This parameter is only relevant when the `trigger_scan` parameter is `enabled`. For information about the deprecation see the `trigger_scan` parameter. You can use a toolchain secret reference for this parameter. For more information, see [Protecting your sensitive data in Continuous Delivery](https://cloud.ibm.com/docs/ContinuousDelivery?topic=ContinuousDelivery-cd_data_security#cd_secure_credentials). - * Constraints: The value must match regular expression `/\\S/`. * `attachment_id` - (String) An attachment ID. An attachment is configured under a profile to define how a scan will be run. To find the attachment ID, in the browser, in the attachments list, click on the attachment link, and a panel appears with a button to copy the attachment ID. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. * Constraints: The value must match regular expression `/^[-0-9a-f]{32,36}$/`. * `evidence_namespace` - (String) The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment pipeline, or `cc` which will use evidence generated by a Continuous Compliance pipeline. @@ -54,13 +52,9 @@ Nested schema for **parameters**: * `instance_crn` - (String) The Security and Compliance Center service instance CRN (Cloud Resource Name). It is recommended to provide an instance CRN, but when absent, the oldest service instance will be used. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. * Constraints: The value must match regular expression `/^crn:v1:(?:bluemix|staging):public:compliance:[a-zA-Z0-9-]*\\b:a\/[0-9a-fA-F]*\\b:[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}\\b::$/`. * `name` - (String) The name for this tool integration, shown on the toolchain page. - * `profile` - (Deprecated, String) The name of a Security and Compliance Center, Hybrid cloud profile. Usually, use the predefined profile "IBM Cloud Security Best Practices v1.0.0", which contains the DevSecOps toolchain goals. Or use a user-authored customized profile that has been configured to contain those goals. When the `trigger_scan` parameter is set to `enabled`, then the Validation scan will use the controls and goals in the configured profile. If configured with a profile that does not check the DevSecOps toolchain goals, it might incorrectly indicate that the toolchain status is passed even though some of the DevSecOps scans had actually failed. This parameter is only relevant when the `trigger_scan` parameter is `enabled`. For information about the deprecation see the `trigger_scan` parameter. - * `profile_name` - (String) The name of a Security and Compliance Center profile. Usually, use one of the predefined profiles "IBM Cloud Security Best Practices" or "IBM Cloud for Financial Services", which contain the DevSecOps Toolchain rules. Or use a user-authored customized profile that has been configured to contain those rules. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. + * `profile_name` - (String) The name of a Security and Compliance Center profile. Usually, use the "IBM Cloud Framework for Financial Services" predefined profile, which contains the DevSecOps Toolchain rules. Or use a user-authored customized profile that has been configured to contain those rules. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. * `profile_version` - (String) The version of a Security and Compliance Center profile, in SemVer format, like '0.0.0'. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. * `scc_api_key` - (String) The IBM Cloud API key used to access the Security and Compliance Center service, for the use profile with attachment setting. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. You can use a toolchain secret reference for this parameter. For more information, see [Protecting your sensitive data in Continuous Delivery](https://cloud.ibm.com/docs/ContinuousDelivery?topic=ContinuousDelivery-cd_data_security#cd_secure_credentials). - * `scope` - (Deprecated, String) The name of a Security and Compliance Center scope, which has previously been created in that service. When the `trigger_scan` parameter is set to `enabled`, then the Validation scan will scan all the resources in that scope. Select a scope that contains this toolchain, so that the scan will find the evidence that has been recently updated by the DevSecOps pipeline-run. This parameter is only relevant when the `trigger_scan` parameter is `enabled`. For information about the deprecation see the `trigger_scan` parameter. - * `trigger_scan` - (Deprecated, String) Set to `enabled` to indicate that a DevSecOps pipeline task should trigger a Security and Compliance Center run of a Hybrid cloud validation scan. Note, each scan may incur charges. When enabled, other parameters become relevant that are needed to trigger that scan; `api_key`, `scope`, `profile`. Hybrid cloud scans are deprecated and are planned to be removed. This option will stop working at that time. For more information see the [Security and Compliance Center Release Notes](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-release-notes#security-compliance-march312023). - * Constraints: Allowable values are: `disabled`, `enabled`. * `use_profile_attachment` - (String) Set to `enabled` to enable use profile with attachment, so that the scripts in the pipeline can interact with the Security and Compliance Center service. When enabled, other parameters become relevant; `scc_api_key`, `instance_crn`, `profile_name`, `profile_version`, `attachment_id`. * Constraints: Allowable values are: `disabled`, `enabled`. diff --git a/website/docs/r/cd_toolchain_tool_securitycompliance.html.markdown b/website/docs/r/cd_toolchain_tool_securitycompliance.html.markdown index 477862aeb4..47011c756e 100644 --- a/website/docs/r/cd_toolchain_tool_securitycompliance.html.markdown +++ b/website/docs/r/cd_toolchain_tool_securitycompliance.html.markdown @@ -33,23 +33,17 @@ You can specify the following arguments for this resource. * Constraints: The maximum length is `128` characters. The minimum length is `0` characters. The value must match regular expression `/^([^\\x00-\\x7F]|[a-zA-Z0-9-._ ])+$/`. * `parameters` - (Required, List) Unique key-value pairs representing parameters to be used to create the tool. A list of parameters for each tool integration can be found in the Configuring tool integrations page. Nested schema for **parameters**: - * `api_key` - (Deprecated, Optional, String) The IBM Cloud API key used to access the Security and Compliance Center API. This parameter is only relevant when the `trigger_scan` parameter is `enabled`. For information about the deprecation see the `trigger_scan` parameter. You can use a toolchain secret reference for this parameter. For more information, see [Protecting your sensitive data in Continuous Delivery](https://cloud.ibm.com/docs/ContinuousDelivery?topic=ContinuousDelivery-cd_data_security#cd_secure_credentials). - * Constraints: The value must match regular expression `/\\S/`. * `attachment_id` - (Optional, String) An attachment ID. An attachment is configured under a profile to define how a scan will be run. To find the attachment ID, in the browser, in the attachments list, click on the attachment link, and a panel appears with a button to copy the attachment ID. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. * Constraints: The value must match regular expression `/^[-0-9a-f]{32,36}$/`. - * `evidence_namespace` - (Required, String) The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment pipeline, or `cc` which will use evidence generated by a Continuous Compliance pipeline. + * `evidence_namespace` - (Optional, String) The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment pipeline, or `cc` which will use evidence generated by a Continuous Compliance pipeline. * Constraints: Allowable values are: `cd`, `cc`. * `evidence_repo_url` - (Required, String) The URL to a Git repository evidence locker. The DevSecOps toolchain templates will collect and store evidence for scans and tasks in an evidence repository. This evidence URL should match the `repo_url` for a Git tool integration in this toolchain. The DevSecOps toolchain goals in the Security and Compliance Center will check the evidence repository for the pass or fail results for those goals. * `instance_crn` - (Optional, String) The Security and Compliance Center service instance CRN (Cloud Resource Name). It is recommended to provide an instance CRN, but when absent, the oldest service instance will be used. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. * Constraints: The value must match regular expression `/^crn:v1:(?:bluemix|staging):public:compliance:[a-zA-Z0-9-]*\\b:a\/[0-9a-fA-F]*\\b:[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}\\b::$/`. * `name` - (Required, String) The name for this tool integration, shown on the toolchain page. - * `profile` - (Deprecated, Optional, String) The name of a Security and Compliance Center, Hybrid cloud profile. Usually, use the predefined profile "IBM Cloud Security Best Practices v1.0.0", which contains the DevSecOps toolchain goals. Or use a user-authored customized profile that has been configured to contain those goals. When the `trigger_scan` parameter is set to `enabled`, then the Validation scan will use the controls and goals in the configured profile. If configured with a profile that does not check the DevSecOps toolchain goals, it might incorrectly indicate that the toolchain status is passed even though some of the DevSecOps scans had actually failed. This parameter is only relevant when the `trigger_scan` parameter is `enabled`. For information about the deprecation see the `trigger_scan` parameter. - * `profile_name` - (Optional, String) The name of a Security and Compliance Center profile. Usually, use one of the predefined profiles "IBM Cloud Security Best Practices" or "IBM Cloud for Financial Services", which contain the DevSecOps Toolchain rules. Or use a user-authored customized profile that has been configured to contain those rules. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. + * `profile_name` - (Optional, String) The name of a Security and Compliance Center profile. Usually, use the "IBM Cloud Framework for Financial Services" predefined profile, which contains the DevSecOps Toolchain rules. Or use a user-authored customized profile that has been configured to contain those rules. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. * `profile_version` - (Optional, String) The version of a Security and Compliance Center profile, in SemVer format, like '0.0.0'. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. * `scc_api_key` - (Optional, String) The IBM Cloud API key used to access the Security and Compliance Center service, for the use profile with attachment setting. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. You can use a toolchain secret reference for this parameter. For more information, see [Protecting your sensitive data in Continuous Delivery](https://cloud.ibm.com/docs/ContinuousDelivery?topic=ContinuousDelivery-cd_data_security#cd_secure_credentials). - * `scope` - (Deprecated, Optional, String) The name of a Security and Compliance Center scope, which has previously been created in that service. When the `trigger_scan` parameter is set to `enabled`, then the Validation scan will scan all the resources in that scope. Select a scope that contains this toolchain, so that the scan will find the evidence that has been recently updated by the DevSecOps pipeline-run. This parameter is only relevant when the `trigger_scan` parameter is `enabled`. For information about the deprecation see the `trigger_scan` parameter. - * `trigger_scan` - (Deprecated, Optional, String) Set to `enabled` to indicate that a DevSecOps pipeline task should trigger a Security and Compliance Center run of a Hybrid cloud validation scan. Note, each scan may incur charges. When enabled, other parameters become relevant that are needed to trigger that scan; `api_key`, `scope`, `profile`. Hybrid cloud scans are deprecated and are planned to be removed. This option will stop working at that time. For more information see the [Security and Compliance Center Release Notes](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-release-notes#security-compliance-march312023). - * Constraints: Allowable values are: `disabled`, `enabled`. * `use_profile_attachment` - (Optional, String) Set to `enabled` to enable use profile with attachment, so that the scripts in the pipeline can interact with the Security and Compliance Center service. When enabled, other parameters become relevant; `scc_api_key`, `instance_crn`, `profile_name`, `profile_version`, `attachment_id`. * Constraints: Allowable values are: `disabled`, `enabled`. * `toolchain_id` - (Required, Forces new resource, String) ID of the toolchain to bind the tool to. From 6dfccd7a1b874995281b9eb929c015cdd0281d45 Mon Sep 17 00:00:00 2001 From: Diksha Mali Date: Sun, 12 Nov 2023 03:30:02 +0530 Subject: [PATCH 050/132] Fix for COS issue 4844 and changing teh static webhosting bucket name in the test cases --- ibm/service/cos/data_source_ibm_cos_bucket.go | 3 +++ ibm/service/cos/resource_ibm_cos_bucket.go | 6 +++++ ...m_cos_bucket_website_configuration_test.go | 24 +++++++++---------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/ibm/service/cos/data_source_ibm_cos_bucket.go b/ibm/service/cos/data_source_ibm_cos_bucket.go index e45744b986..22c54e1c96 100644 --- a/ibm/service/cos/data_source_ibm_cos_bucket.go +++ b/ibm/service/cos/data_source_ibm_cos_bucket.go @@ -720,6 +720,9 @@ func dataSourceIBMCosBucketRead(d *schema.ResourceData, meta interface{}) error if endpointType == "private" { sess.SetServiceURL("https://config.private.cloud-object-storage.cloud.ibm.com/v1") } + if endpointType == "direct" { + sess.SetServiceURL("https://config.direct.cloud-object-storage.cloud.ibm.com/v1") + } if bucketType == "sl" { satconfig := fmt.Sprintf("https://config.%s.%s.cloud-object-storage.appdomain.cloud/v1", serviceID, satlc_id) diff --git a/ibm/service/cos/resource_ibm_cos_bucket.go b/ibm/service/cos/resource_ibm_cos_bucket.go index d21f73c77b..abcc543635 100644 --- a/ibm/service/cos/resource_ibm_cos_bucket.go +++ b/ibm/service/cos/resource_ibm_cos_bucket.go @@ -924,6 +924,9 @@ func resourceIBMCOSBucketUpdate(d *schema.ResourceData, meta interface{}) error if endpointType == "private" { sess.SetServiceURL("https://config.private.cloud-object-storage.cloud.ibm.com/v1") } + if endpointType == "direct" { + sess.SetServiceURL("https://config.direct.cloud-object-storage.cloud.ibm.com/v1") + } if apiType == "sl" { satconfig := fmt.Sprintf("https://config.%s.%s.cloud-object-storage.appdomain.cloud/v1", serviceID, bLocation) @@ -1153,6 +1156,9 @@ func resourceIBMCOSBucketRead(d *schema.ResourceData, meta interface{}) error { if endpointType == "private" { sess.SetServiceURL("https://config.private.cloud-object-storage.cloud.ibm.com/v1") } + if endpointType == "direct" { + sess.SetServiceURL("https://config.direct.cloud-object-storage.cloud.ibm.com/v1") + } if apiType == "sl" { diff --git a/ibm/service/cos/resource_ibm_cos_bucket_website_configuration_test.go b/ibm/service/cos/resource_ibm_cos_bucket_website_configuration_test.go index 5959dc2c0b..2988811df5 100644 --- a/ibm/service/cos/resource_ibm_cos_bucket_website_configuration_test.go +++ b/ibm/service/cos/resource_ibm_cos_bucket_website_configuration_test.go @@ -12,7 +12,7 @@ import ( func TestAccIBMCosBucket_Website_Configuration_Bucket_Basic(t *testing.T) { serviceName := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) - bucketName := fmt.Sprintf("terraformStaticWebHosting%d", acctest.RandIntRange(10, 100)) + bucketName := fmt.Sprintf("terraform-static-web-hosting%d", acctest.RandIntRange(10, 100)) bucketRegion := "us" bucketClass := "standard" bucketRegionType := "cross_region_location" @@ -41,7 +41,7 @@ func TestAccIBMCosBucket_Website_Configuration_Bucket_Basic(t *testing.T) { func TestAccIBMCosBucket_Website_Configuration_Bucket_Without_Public_Access(t *testing.T) { serviceName := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) - bucketName := fmt.Sprintf("terraformStaticWebHosting%d", acctest.RandIntRange(10, 100)) + bucketName := fmt.Sprintf("terraform-static-web-hosting%d", acctest.RandIntRange(10, 100)) bucketRegion := "us" bucketClass := "standard" bucketRegionType := "cross_region_location" @@ -69,7 +69,7 @@ func TestAccIBMCosBucket_Website_Configuration_Bucket_Without_Public_Access(t *t } func TestAccIBMCosBucket_Website_Configuration_Bucket_Index_Document_Only(t *testing.T) { serviceName := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) - bucketName := fmt.Sprintf("terraformStaticWebHosting%d", acctest.RandIntRange(10, 100)) + bucketName := fmt.Sprintf("terraform-static-web-hosting%d", acctest.RandIntRange(10, 100)) bucketRegion := "us" bucketClass := "standard" bucketRegionType := "cross_region_location" @@ -96,7 +96,7 @@ func TestAccIBMCosBucket_Website_Configuration_Bucket_Index_Document_Only(t *tes func TestAccIBMCosBucket_Website_Configuration_Bucket_With_Routing_Rule(t *testing.T) { serviceName := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) - bucketName := fmt.Sprintf("terraformStaticWebHosting%d", acctest.RandIntRange(10, 100)) + bucketName := fmt.Sprintf("terraform-static-web-hosting%d", acctest.RandIntRange(10, 100)) bucketRegion := "us" bucketClass := "standard" bucketRegionType := "cross_region_location" @@ -133,7 +133,7 @@ func TestAccIBMCosBucket_Website_Configuration_Bucket_With_Routing_Rule(t *testi func TestAccIBMCosBucket_Website_Configuration_Bucket_With_JSON_Routing_Rule(t *testing.T) { serviceName := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) - bucketName := fmt.Sprintf("terraformStaticWebHosting%d", acctest.RandIntRange(10, 100)) + bucketName := fmt.Sprintf("terraform-static-web-hosting%d", acctest.RandIntRange(10, 100)) bucketRegion := "us" bucketClass := "standard" bucketRegionType := "cross_region_location" @@ -163,7 +163,7 @@ func TestAccIBMCosBucket_Website_Configuration_Bucket_With_JSON_Routing_Rule(t * } func TestAccIBMCosBucket_Website_Configuration_Bucket_With_Routing_Rule_Condition_Only(t *testing.T) { serviceName := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) - bucketName := fmt.Sprintf("terraformStaticWebHosting%d", acctest.RandIntRange(10, 100)) + bucketName := fmt.Sprintf("terraform-static-web-hosting%d", acctest.RandIntRange(10, 100)) bucketRegion := "us" bucketClass := "standard" bucketRegionType := "cross_region_location" @@ -192,7 +192,7 @@ func TestAccIBMCosBucket_Website_Configuration_Bucket_With_Routing_Rule_Conditio func TestAccIBMCosBucket_Website_Configuration_Bucket_With_Routing_Rule_Redirect_Only(t *testing.T) { serviceName := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) - bucketName := fmt.Sprintf("terraformStaticWebHosting%d", acctest.RandIntRange(10, 100)) + bucketName := fmt.Sprintf("terraform-static-web-hosting%d", acctest.RandIntRange(10, 100)) bucketRegion := "us" bucketClass := "standard" bucketRegionType := "cross_region_location" @@ -227,7 +227,7 @@ func TestAccIBMCosBucket_Website_Configuration_Bucket_With_Routing_Rule_Redirect func TestAccIBMCosBucket_Website_Configuration_Bucket_With_Multiple_Routing_Rules(t *testing.T) { serviceName := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) - bucketName := fmt.Sprintf("terraformStaticWebHosting%d", acctest.RandIntRange(10, 100)) + bucketName := fmt.Sprintf("terraform-static-web-hosting%d", acctest.RandIntRange(10, 100)) bucketRegion := "us" bucketClass := "standard" bucketRegionType := "cross_region_location" @@ -263,7 +263,7 @@ func TestAccIBMCosBucket_Website_Configuration_Bucket_With_Multiple_Routing_Rule func TestAccIBMCosBucket_Website_Configuration_Bucket_Upload_Object_With_Redirect(t *testing.T) { serviceName := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) - bucketName := fmt.Sprintf("terraformStaticWebHosting%d", acctest.RandIntRange(10, 100)) + bucketName := fmt.Sprintf("terraform-static-web-hosting%d", acctest.RandIntRange(10, 100)) bucketRegion := "us" bucketClass := "standard" bucketRegionType := "cross_region_location" @@ -293,7 +293,7 @@ func TestAccIBMCosBucket_Website_Configuration_Bucket_Upload_Object_With_Redirec func TestAccIBMCosBucket_Website_Configuration_Bucket_Empty_Config(t *testing.T) { serviceName := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) - bucketName := fmt.Sprintf("terraformStaticWebHosting%d", acctest.RandIntRange(10, 100)) + bucketName := fmt.Sprintf("terraform-static-web-hosting%d", acctest.RandIntRange(10, 100)) bucketRegion := "us" bucketClass := "standard" bucketRegionType := "cross_region_location" @@ -312,7 +312,7 @@ func TestAccIBMCosBucket_Website_Configuration_Bucket_Empty_Config(t *testing.T) func TestAccIBMCosBucket_Website_Configuration_Bucket_Index_And_Redirect_Together(t *testing.T) { serviceName := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) - bucketName := fmt.Sprintf("terraformStaticWebHosting%d", acctest.RandIntRange(10, 100)) + bucketName := fmt.Sprintf("terraform-static-web-hosting%d", acctest.RandIntRange(10, 100)) bucketRegion := "us" bucketClass := "standard" bucketRegionType := "cross_region_location" @@ -333,7 +333,7 @@ func TestAccIBMCosBucket_Website_Configuration_Bucket_Index_And_Redirect_Togethe func TestAccIBMCosBucket_Website_Configuration_Bucket_No_Config(t *testing.T) { serviceName := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) - bucketName := fmt.Sprintf("terraformStaticWebHosting%d", acctest.RandIntRange(10, 100)) + bucketName := fmt.Sprintf("terraform-static-web-hosting%d", acctest.RandIntRange(10, 100)) bucketRegion := "us" bucketClass := "standard" bucketRegionType := "cross_region_location" From 73008069bf5a543088f2b9eaf7c1ed26680af826 Mon Sep 17 00:00:00 2001 From: Simone Rodigari <32323373+SRodi@users.noreply.github.com> Date: Tue, 14 Nov 2023 14:15:15 +0000 Subject: [PATCH 051/132] add missing required argument name to the doc (#4909) --- .secrets.baseline | 4 ++-- website/docs/r/sm_arbitrary_secret.html.markdown | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index c4309547fd..e66f38481c 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -4504,7 +4504,7 @@ "hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e", "is_secret": false, "is_verified": false, - "line_number": 104, + "line_number": 105, "type": "Secret Keyword", "verified_result": null }, @@ -4512,7 +4512,7 @@ "hashed_secret": "e66e7d67fdf3c596c435fc7828b13205e4950a0f", "is_secret": false, "is_verified": false, - "line_number": 106, + "line_number": 107, "type": "Secret Keyword", "verified_result": null } diff --git a/website/docs/r/sm_arbitrary_secret.html.markdown b/website/docs/r/sm_arbitrary_secret.html.markdown index 0a5d5ae144..aadaef107d 100644 --- a/website/docs/r/sm_arbitrary_secret.html.markdown +++ b/website/docs/r/sm_arbitrary_secret.html.markdown @@ -14,6 +14,7 @@ Provides a resource for ArbitrarySecret. This allows ArbitrarySecret to be creat ```hcl resource "ibm_sm_arbitrary_secret" "sm_arbitrary_secret" { + name = "secret-name" instance_id = ibm_resource_instance.sm_instance.guid region = "us-south" custom_metadata = {"key":"value"} From 24cc7f62bab5a0fea50899656ef768271c27e4b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 21:05:16 +0000 Subject: [PATCH 052/132] dependabot: bump github/issue-labeler from 3.2 to 3.3 Bumps [github/issue-labeler](https://github.com/github/issue-labeler) from 3.2 to 3.3. - [Release notes](https://github.com/github/issue-labeler/releases) - [Commits](https://github.com/github/issue-labeler/compare/v3.2...v3.3) --- updated-dependencies: - dependency-name: github/issue-labeler dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 2f84d395ef..1e0c34e13c 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -8,7 +8,7 @@ jobs: steps: - uses: actions/checkout@v4.1.1 - name: Apply Issue Labels - uses: github/issue-labeler@v3.2 + uses: github/issue-labeler@v3.3 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" configuration-path: .github/labeler-issue.yml From 8ff0e8abf51af31659f88aef49d4ddd8f82f30e5 Mon Sep 17 00:00:00 2001 From: hkantare Date: Wed, 15 Nov 2023 13:55:25 +0530 Subject: [PATCH 053/132] update CHANGELOG --- CHANGELOG.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf3fc33d49..f833c365fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ +# 1.60.0-beta0 (Nov 15, 2023) +Features +* Support for Projects + - **Datasources** + - ibm_project + - ibm_project_config + - **Resources** + - ibm_project + - ibm_project_config +Enhancements +* support offline restore for MongoDB EE PITR ([4601](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4601)) +* bump ContinuousDelivery Go SDK version ([4918](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4918)) +* Added nest conditions to rule.conditions IAM Policies ([4896](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4896)) +* Updates to SCC tool ([4920](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4920)) + +BugFixes +* resolved nil pointer issue on vpn gateway resource ([4903](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4903)) +* Private/direct COS endpoint settings conflicts with IBM Cloud docs, VPE options, and COS config endpoint ([4919](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4919)) +* add missing required argument name to the doc ([4909](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4909)) + + # 1.59.0 (Oct 30, 2023) Features From 2bcce90172cf51e224be36a2ebdea46371aa105d Mon Sep 17 00:00:00 2001 From: hkantare Date: Wed, 15 Nov 2023 13:56:04 +0530 Subject: [PATCH 054/132] Bump up version to 1.60.0-beta0 --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index df2bae8a6f..f1071a21bf 100644 --- a/version/version.go +++ b/version/version.go @@ -5,7 +5,7 @@ import ( ) // Version is the current provider main version -const Version = "1.59.0" +const Version = "1.60.0-beta0" // GitCommit is the git commit that was compiled. This will be filled in by the compiler. var GitCommit string From 2aad24a78870d50f86b87335c51020c00224dffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Szepesi?= <2dcube01@gmail.com> Date: Thu, 16 Nov 2023 06:51:11 +0100 Subject: [PATCH 055/132] Add entitlement option to Satellite cluster/workerpool create (#4894) * Add entitlement option to Satellite cluster/workerpool create * SSH pub key from env var * Use release github.com/IBM-Cloud/container-services-go-sdk --- go.mod | 2 +- go.sum | 2 + ibm/acctest/acctest.go | 17 ++ ...ource_ibm_satellite_cluster_worker_pool.go | 6 + .../resource_ibm_satellite_cluster.go | 11 ++ .../resource_ibm_satellite_cluster_test.go | 139 ++++++++++++++++ ...ource_ibm_satellite_cluster_worker_pool.go | 11 +- ..._ibm_satellite_cluster_worker_pool_test.go | 156 ++++++++++++++++++ ...atellite_cluster_worker_pool.html.markdown | 1 + .../docs/r/satellite_cluster.html.markdown | 1 + 10 files changed, 343 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index ee7a35fb38..9412a594f3 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/IBM-Cloud/bluemix-go v0.0.0-20231017073329-75ebe90c98ba - github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20230822142550-30562e113de9 + github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c github.com/IBM-Cloud/power-go-client v1.5.2 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca github.com/IBM/appconfiguration-go-admin-sdk v0.3.0 diff --git a/go.sum b/go.sum index 558bb22653..ea0d957ea6 100644 --- a/go.sum +++ b/go.sum @@ -104,6 +104,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20231017073329-75ebe90c98ba h1:8U4HByOYJi github.com/IBM-Cloud/bluemix-go v0.0.0-20231017073329-75ebe90c98ba/go.mod h1:mt+O8ryLVANrBKlA4RxKdENp3q6Q7mKQIi2nkiibZbU= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20230822142550-30562e113de9 h1:sXRzCK3Glxpyu66Tu2NjztLdT5sDwj4qly+MJKRhdWY= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20230822142550-30562e113de9/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= +github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c h1:tRS4VuOG3lHNG+yrsh3vZZQDVNLuFJB0oZbTJp9YXds= +github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs= github.com/IBM-Cloud/power-go-client v1.5.2 h1:p8+vY9+wtr4BIa2+Y4EVI0jlvRg+FLWsbOpWYNlKXDw= github.com/IBM-Cloud/power-go-client v1.5.2/go.mod h1:Vd8aSxWA30soUhE2U+tmzaYDUVNOmQE3/npny7BsN6Y= diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 65e4440b75..7335b4bdeb 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -314,6 +314,11 @@ var ( CeResourceKeyID string ) +// Satellite tests +var ( + SatelliteSSHPubKey string +) + // for IAM Identity var IamIdentityAssignmentTargetAccountId string @@ -1525,6 +1530,11 @@ func init() { CeResourceKeyID = "" fmt.Println("[WARN] Set the environment variable IBM_CODE_ENGINE_RESOURCE_KEY_ID with the ID of a resource key to access a service instance") } + + SatelliteSSHPubKey = os.Getenv("IBM_SATELLITE_SSH_PUB_KEY") + if SatelliteSSHPubKey == "" { + fmt.Println("[WARN] Set the environment variable IBM_SATELLITE_SSH_PUB_KEY with a ssh public key or ibm_satellite_* tests may fail") + } } var ( @@ -1714,6 +1724,13 @@ func TestAccPreCheckScc(t *testing.T) { } } +func TestAccPreCheckSatelliteSSH(t *testing.T) { + TestAccPreCheck(t) + if SatelliteSSHPubKey == "" { + t.Fatal("IBM_SATELLITE_SSH_PUB_KEY missing. Set the environment variable IBM_SATELLITE_SSH_PUB_KEY with a VALID ssh public key") + } +} + func TestAccProviderFactories() map[string]func() (*schema.Provider, error) { return map[string]func() (*schema.Provider, error){ ProviderName: func() (*schema.Provider, error) { return provider.Provider(), nil }, diff --git a/ibm/service/satellite/data_source_ibm_satellite_cluster_worker_pool.go b/ibm/service/satellite/data_source_ibm_satellite_cluster_worker_pool.go index ccffa17cea..e56f585ea9 100644 --- a/ibm/service/satellite/data_source_ibm_satellite_cluster_worker_pool.go +++ b/ibm/service/satellite/data_source_ibm_satellite_cluster_worker_pool.go @@ -97,6 +97,11 @@ func DataSourceIBMSatelliteClusterWorkerPool() *schema.Resource { Computed: true, Description: "Enable auto scalling for worker pool", }, + "openshift_license_source": { + Type: schema.TypeString, + Computed: true, + Description: "License source for Openshift", + }, }, } } @@ -154,6 +159,7 @@ func dataSourceIBMSatelliteClusterWorkerPoolRead(d *schema.ResourceData, meta in d.Set("auto_scale_enabled", *workerPool.AutoscaleEnabled) d.Set("state", *workerPool.Lifecycle.ActualState) d.Set("isolation", *workerPool.Isolation) + d.Set("openshift_license_source", *workerPool.OpenshiftLicense) d.SetId(*workerPool.ID) return nil diff --git a/ibm/service/satellite/resource_ibm_satellite_cluster.go b/ibm/service/satellite/resource_ibm_satellite_cluster.go index 27ad6d268b..98177e1b0c 100644 --- a/ibm/service/satellite/resource_ibm_satellite_cluster.go +++ b/ibm/service/satellite/resource_ibm_satellite_cluster.go @@ -124,6 +124,12 @@ func ResourceIBMSatelliteCluster() *schema.Resource { }, Description: "The OpenShift Container Platform version", }, + "entitlement": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: flex.ApplyOnce, + Description: "Entitlement option reduces additional OCP Licence cost in Openshift Clusters", + }, "operating_system": { Type: schema.TypeString, Optional: true, @@ -390,6 +396,11 @@ func resourceIBMSatelliteClusterCreate(d *schema.ResourceData, meta interface{}) createClusterOptions.Labels = hostLabels } + if v, ok := d.GetOk("entitlement"); ok { + entitlement := v.(string) + createClusterOptions.DefaultWorkerPoolEntitlement = &entitlement + } + if v, ok := d.GetOk("crn_token"); ok { crnToken := v.(string) createRemoteClusterOptions := &kubernetesserviceapiv1.CreateSatelliteClusterRemoteOptions{} diff --git a/ibm/service/satellite/resource_ibm_satellite_cluster_test.go b/ibm/service/satellite/resource_ibm_satellite_cluster_test.go index 548ae6b18d..76752e640c 100644 --- a/ibm/service/satellite/resource_ibm_satellite_cluster_test.go +++ b/ibm/service/satellite/resource_ibm_satellite_cluster_test.go @@ -81,6 +81,36 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE }) } +func TestAccSatelliteCluster_Entitlement(t *testing.T) { + var instance string + clusterName := fmt.Sprintf("tf-satellitecluster-%d", acctest.RandIntRange(10, 100)) + locationName := fmt.Sprintf("tf-satellitelocation-%d", acctest.RandIntRange(10, 100)) + managed_from := "dal10" + operatingSystem := "REDHAT_8_64" + zones := []string{"us-south-1", "us-south-2", "us-south-3"} + resource_group := "default" + region := "us-south" + resource_prefix := "tf-satellite" + host_provider := "ibm" + publicKey := acc.SatelliteSSHPubKey + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckSatelliteSSH(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckSatelliteClusterDestroy, + Steps: []resource.TestStep{ + + { + Config: testAccCheckSatelliteEntitlementClusterCreate(clusterName, locationName, managed_from, operatingSystem, resource_group, resource_prefix, region, publicKey, host_provider, zones), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckSatelliteClusterExists("ibm_satellite_cluster.create_cluster", instance), + resource.TestCheckResourceAttr("data.ibm_satellite_cluster_worker_pool.read_default_wp", "openshift_license_source", "cloud_pak"), + ), + }, + }, + }) +} + func TestAccSatelliteCluster_Import(t *testing.T) { var instance string clusterName := fmt.Sprintf("tf-satellitecluster-%d", acctest.RandIntRange(10, 100)) @@ -382,3 +412,112 @@ func testAccCheckSatelliteSingleNodeClusterCreate(clusterName, locationName, man `, locationName, managed_from, resource_group, resource_prefix, resource_prefix, region, resource_prefix, publicKey, resource_prefix, region, resource_prefix, host_provider, clusterName) } + +func testAccCheckSatelliteEntitlementClusterCreate(clusterName, locationName, managed_from, operatingSystem, resource_group, resource_prefix, region, publicKey, host_provider string, zones []string) string { + return fmt.Sprintf(` + + variable "location_zones" { + description = "Allocate your hosts across these three zones" + type = list(string) + default = ["us-south-1", "us-south-2", "us-south-3"] + } + + data "ibm_is_image" "rhel8" { + name = "ibm-redhat-8-8-minimal-amd64-2" + } + + resource "ibm_satellite_location" "location" { + location = "%s" + managed_from = "%s" + zones = var.location_zones + coreos_enabled = true + } + + data "ibm_satellite_attach_host_script" "script" { + location = ibm_satellite_location.location.id + labels = ["env:prod"] + host_provider = "ibm" + } + + data "ibm_resource_group" "resource_group" { + name = "%s" + } + + resource "ibm_is_vpc" "satellite_vpc" { + name = "%s-vpc-1" + } + + resource "ibm_is_subnet" "satellite_subnet" { + count = 3 + + name = "%s-subnet-${count.index}" + vpc = ibm_is_vpc.satellite_vpc.id + total_ipv4_address_count = 256 + zone = "%s-${count.index + 1}" + } + + resource "ibm_is_ssh_key" "satellite_ssh" { + name = "%s-ibm-ssh" + public_key = "%s" + } + + resource "ibm_is_instance" "satellite_instance" { + count = 3 + + name = "%s-instance-${count.index}" + vpc = ibm_is_vpc.satellite_vpc.id + zone = "%s-${count.index + 1}" + image = data.ibm_is_image.rhel8.id + profile = "mx2-8x64" + keys = [ibm_is_ssh_key.satellite_ssh.id] + resource_group = data.ibm_resource_group.resource_group.id + user_data = data.ibm_satellite_attach_host_script.script.host_script + + primary_network_interface { + subnet = ibm_is_subnet.satellite_subnet[count.index].id + } + } + + resource "ibm_is_floating_ip" "satellite_ip" { + count = 3 + + name = "%s-fip-${count.index}" + target = ibm_is_instance.satellite_instance[count.index].primary_network_interface[0].id + } + + resource "ibm_satellite_host" "assign_host" { + count = 3 + + location = ibm_satellite_location.location.id + host_id = element(ibm_is_instance.satellite_instance[*].name, count.index) + labels = ["env:prod"] + zone = element(var.location_zones, count.index) + host_provider = "%s" + } + + resource "ibm_satellite_cluster" "create_cluster" { + name = "%s" + location = ibm_satellite_host.assign_host.0.location + enable_config_admin = true + kube_version = "4.13_openshift" + operating_system = "%s" + entitlement = "cloud_pak" + wait_for_worker_update = true + dynamic "zones" { + for_each = var.location_zones + content { + id = zones.value + } + } + default_worker_pool_labels = { + "test" = "test-pool1" + "test1" = "test-pool2" + } + } + + data "ibm_satellite_cluster_worker_pool" "read_default_wp" { + name = "default" + cluster = ibm_satellite_cluster.create_cluster.id + } +`, locationName, managed_from, resource_group, resource_prefix, resource_prefix, region, resource_prefix, publicKey, resource_prefix, region, resource_prefix, host_provider, clusterName, operatingSystem) +} diff --git a/ibm/service/satellite/resource_ibm_satellite_cluster_worker_pool.go b/ibm/service/satellite/resource_ibm_satellite_cluster_worker_pool.go index e94f270b59..e02f41ed12 100644 --- a/ibm/service/satellite/resource_ibm_satellite_cluster_worker_pool.go +++ b/ibm/service/satellite/resource_ibm_satellite_cluster_worker_pool.go @@ -109,8 +109,10 @@ func ResourceIBMSatelliteClusterWorkerPool() *schema.Resource { Computed: true, }, "entitlement": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: flex.ApplyOnce, + Description: "Entitlement option reduces additional OCP Licence cost in Openshift Clusters", }, "operating_system": { Type: schema.TypeString, @@ -261,6 +263,11 @@ func resourceIBMSatelliteClusterWorkerPoolCreate(d *schema.ResourceData, meta in createWorkerPoolOptions.Isolation = &isolation } + if v, ok := d.GetOk("entitlement"); ok { + entitlement := v.(string) + createWorkerPoolOptions.Entitlement = &entitlement + } + instance, response, err := satClient.CreateSatelliteWorkerPool(createWorkerPoolOptions) if err != nil { return fmt.Errorf("[ERROR] Error Creating Satellite cluster worker pool: %s\n%s", err, response) diff --git a/ibm/service/satellite/resource_ibm_satellite_cluster_worker_pool_test.go b/ibm/service/satellite/resource_ibm_satellite_cluster_worker_pool_test.go index 9b7d163091..6b79c1c144 100644 --- a/ibm/service/satellite/resource_ibm_satellite_cluster_worker_pool_test.go +++ b/ibm/service/satellite/resource_ibm_satellite_cluster_worker_pool_test.go @@ -44,6 +44,35 @@ func TestAccSatelliteClusterWorkerPool_Basic(t *testing.T) { }) } +func TestAccSatelliteClusterWorkerPool_Entitlement(t *testing.T) { + var instance string + clusterName := fmt.Sprintf("tf-satellitecluster-%d", acctest.RandIntRange(10, 100)) + locationName := fmt.Sprintf("tf-satellitelocation-%d", acctest.RandIntRange(10, 100)) + operatingSystem := "REDHAT_8_64" + workerPoolName := fmt.Sprintf("tf-wp-%d", acctest.RandIntRange(10, 100)) + resource_prefix := "tf-satellite" + publicKey := acc.SatelliteSSHPubKey + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckSatelliteSSH(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckSatelliteClusterWorkerPoolDestroy, + Steps: []resource.TestStep{ + + { + Config: testAccCheckSatelliteClusterWorkerPoolCreateEntitlement(clusterName, locationName, operatingSystem, workerPoolName, resource_prefix, publicKey), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckSatelliteClusterWorkerPoolExists("ibm_satellite_cluster_worker_pool.create_wp", instance), + resource.TestCheckResourceAttr("ibm_satellite_cluster.create_cluster", "name", clusterName), + resource.TestCheckResourceAttr("ibm_satellite_cluster_worker_pool.create_wp", "name", workerPoolName), + resource.TestCheckResourceAttr("ibm_satellite_cluster_worker_pool.create_wp", "operating_system", operatingSystem), + resource.TestCheckResourceAttr("data.ibm_satellite_cluster_worker_pool.read_created_wp", "openshift_license_source", "cloud_pak"), + ), + }, + }, + }) +} + func TestAccSatelliteClusterWorkerPool_Import(t *testing.T) { var instance string clusterName := fmt.Sprintf("tf-satellitecluster-%d", acctest.RandIntRange(10, 100)) @@ -262,3 +291,130 @@ func testAccCheckSatelliteClusterWorkerPoolCreate(clusterName, locationName, ope `, locationName, resource_prefix, resource_prefix, resource_prefix, resource_prefix, resource_prefix, clusterName, workerPoolName, operatingSystem) } + +func testAccCheckSatelliteClusterWorkerPoolCreateEntitlement(clusterName, locationName, operatingSystem, workerPoolName, resource_prefix, publicKey string) string { + return fmt.Sprintf(` + + variable "location_zones" { + description = "Allocate your hosts across these three zones" + type = list(string) + default = ["us-south-1", "us-south-2", "us-south-3"] + } + + resource "ibm_satellite_location" "location" { + location = "%s" + managed_from = "dal10" + zones = var.location_zones + coreos_enabled = true + } + + data "ibm_is_image" "rhel8" { + name = "ibm-redhat-8-8-minimal-amd64-2" + } + + data "ibm_satellite_attach_host_script" "script" { + location = ibm_satellite_location.location.id + labels = ["env:prod"] + host_provider = "ibm" + } + + data "ibm_resource_group" "resource_group" { + is_default = true + } + + resource "ibm_is_vpc" "satellite_vpc" { + name = "%s-vpc-1" + } + + resource "ibm_is_subnet" "satellite_subnet" { + count = 3 + + name = "%s-subnet-${count.index}" + vpc = ibm_is_vpc.satellite_vpc.id + total_ipv4_address_count = 256 + zone = "us-south-${count.index + 1}" + } + + resource "ibm_is_ssh_key" "satellite_ssh" { + name = "%s-ibm-ssh" + public_key = "%s" + } + + resource "ibm_is_instance" "satellite_instance" { + count = 3 + + name = "%s-instance-${count.index}" + vpc = ibm_is_vpc.satellite_vpc.id + zone = "us-south-${count.index + 1}" + image = data.ibm_is_image.rhel8.id + profile = "mx2-8x64" + keys = [ibm_is_ssh_key.satellite_ssh.id] + resource_group = data.ibm_resource_group.resource_group.id + user_data = data.ibm_satellite_attach_host_script.script.host_script + + primary_network_interface { + subnet = ibm_is_subnet.satellite_subnet[count.index].id + } + } + + resource "ibm_is_floating_ip" "satellite_ip" { + count = 3 + + name = "%s-fip-${count.index}" + target = ibm_is_instance.satellite_instance[count.index].primary_network_interface[0].id + } + + resource "ibm_satellite_host" "assign_host" { + count = 3 + + location = ibm_satellite_location.location.id + host_id = element(ibm_is_instance.satellite_instance[*].name, count.index) + labels = ["env:prod"] + zone = element(var.location_zones, count.index) + host_provider = "ibm" + } + + resource "ibm_satellite_cluster" "create_cluster" { + name = "%s" + location = ibm_satellite_location.location.id + enable_config_admin = true + kube_version = "4.13_openshift" + wait_for_worker_update = true + dynamic "zones" { + for_each = var.location_zones + content { + id = zones.value + } + } + default_worker_pool_labels = { + "test" = "test-pool1" + "test1" = "test-pool2" + } + } + + resource "ibm_satellite_cluster_worker_pool" "create_wp" { + name = "%s" + cluster = ibm_satellite_cluster.create_cluster.id + worker_count = 1 + host_labels = ["env:dev"] + operating_system = "%s" + entitlement = "cloud_pak" + dynamic "zones" { + for_each = var.location_zones + content { + id = zones.value + } + } + worker_pool_labels = { + "test" = "test-pool1" + "test1" = "test-pool2" + } + } + + data "ibm_satellite_cluster_worker_pool" "read_created_wp" { + name = ibm_satellite_cluster_worker_pool.create_wp.name + cluster = ibm_satellite_cluster.create_cluster.id + } + +`, locationName, resource_prefix, resource_prefix, resource_prefix, publicKey, resource_prefix, resource_prefix, clusterName, workerPoolName, operatingSystem) +} diff --git a/website/docs/d/satellite_cluster_worker_pool.html.markdown b/website/docs/d/satellite_cluster_worker_pool.html.markdown index e8030c7eec..b1b4be49e0 100644 --- a/website/docs/d/satellite_cluster_worker_pool.html.markdown +++ b/website/docs/d/satellite_cluster_worker_pool.html.markdown @@ -49,3 +49,4 @@ In addition to all argument references list, you can access the following attrib - `isolation` - (String) Isolation of the worker node. - `auto_scale_enabled` - (String) Enable auto scalling for worker pool. - `worker_count` - (String) The number of workers that are attached. +- `openshift_license_source` - (String) The license source for OpenShift. diff --git a/website/docs/r/satellite_cluster.html.markdown b/website/docs/r/satellite_cluster.html.markdown index b01648bd64..b4d8a42038 100644 --- a/website/docs/r/satellite_cluster.html.markdown +++ b/website/docs/r/satellite_cluster.html.markdown @@ -50,6 +50,7 @@ Review the argument references that you can specify for your resource. - `location` - (Required, String) The name or ID of the Satellite location. - `kube_version` - (Optional, String) The Red Hart OpenShift Container Platform version. - `operating_system` - (Optional, String) Operating system of the default worker pool. Options are REDHAT_7_64, REDHAT_8_64, or RHCOS. +- `entitlement` - (Optional, String) Entitlement reduces additional OCP Licence cost in OpenShift clusters. Use Cloud Pak with OCP Licence entitlement to create the OpenShift cluster. **Note**
  • It is set only when the first time creation of the cluster, further modifications are not impacted.
  • Set this argument to `cloud_pak` only if you use the cluster with a Cloud Pak that has an OpenShift entitlement.
. - `zones` - (Optional, Array of Strings) The name of the zones to create the default worker pool. - `worker_count` - (Optional, String) The number of worker nodes to create per zone in the default worker pool. - `enable_config_admin` - (Optional, Bool) User provided value to indicate opt-in agreement to SatCon admin agent. From 6116678d272e43d9a8b631d3d3c173a6cb0b7605 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 16 Nov 2023 19:41:42 +0530 Subject: [PATCH 056/132] Update is_virtual_network_interface.html.markdown --- website/docs/r/is_virtual_network_interface.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/is_virtual_network_interface.html.markdown b/website/docs/r/is_virtual_network_interface.html.markdown index 210300c2db..1f71d22ce2 100644 --- a/website/docs/r/is_virtual_network_interface.html.markdown +++ b/website/docs/r/is_virtual_network_interface.html.markdown @@ -36,7 +36,7 @@ You can specify the following arguments for this resource. **•** `access_tags` must be in the format `key:value`. - `allow_ip_spoofing` - (Optional, Boolean) 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. -- `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted. +- `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted. Must be false if the virtual network interface is unbound. - `enable_infrastructure_nat` - (Optional, Boolean) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`. ~> **NOTE** to add `ips` only existing `reserved_ip` is supported, new reserved_ip creation is not supported as it leads to unmanaged(dangling) reserved ips. Use `ibm_is_subnet_reserved_ip` to create a reserved_ip From b5aebaff7fdb41996652c9b4267ad1b0d8232f0c Mon Sep 17 00:00:00 2001 From: Jason Peterson Date: Thu, 16 Nov 2023 23:39:27 -0500 Subject: [PATCH 057/132] Add Code Engine domain mapping (#4912) * Add Code Engine domain mapping * fixed formatting by running gofmt * some test cleanup --- .secrets.baseline | 42 +- examples/ibm-code-engine/README.md | 28 +- examples/ibm-code-engine/main.tf | 19 +- examples/ibm-code-engine/outputs.tf | 6 + examples/ibm-code-engine/variables.tf | 6 + go.mod | 15 +- go.sum | 38 +- ibm/acctest/acctest.go | 39 +- ibm/provider/provider.go | 45 +- ...a_source_ibm_code_engine_domain_mapping.go | 219 +++++++++ ...rce_ibm_code_engine_domain_mapping_test.go | 107 ++++ ...data_source_ibm_code_engine_secret_test.go | 46 +- ...resource_ibm_code_engine_domain_mapping.go | 457 ++++++++++++++++++ ...rce_ibm_code_engine_domain_mapping_test.go | 220 +++++++++ .../resource_ibm_code_engine_secret_test.go | 51 +- .../code_engine_domain_mapping.html.markdown | 75 +++ .../code_engine_domain_mapping.html.markdown | 92 ++++ 17 files changed, 1407 insertions(+), 98 deletions(-) create mode 100644 ibm/service/codeengine/data_source_ibm_code_engine_domain_mapping.go create mode 100644 ibm/service/codeengine/data_source_ibm_code_engine_domain_mapping_test.go create mode 100644 ibm/service/codeengine/resource_ibm_code_engine_domain_mapping.go create mode 100644 ibm/service/codeengine/resource_ibm_code_engine_domain_mapping_test.go create mode 100644 website/docs/d/code_engine_domain_mapping.html.markdown create mode 100644 website/docs/r/code_engine_domain_mapping.html.markdown diff --git a/.secrets.baseline b/.secrets.baseline index e66f38481c..c90644602f 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.mod|go.sum|.*.map|^.secrets.baseline$", "lines": null }, - "generated_at": "2023-11-09T17:56:16Z", + "generated_at": "2023-11-10T20:51:53Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -428,7 +428,15 @@ "hashed_secret": "dc61ac50e6f36d09340d8ca062da1f0d4215004f", "is_secret": false, "is_verified": false, - "line_number": 61, + "line_number": 62, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "f4adb76dda1dc36da0e225b8477887a30e7346c9", + "is_secret": false, + "is_verified": false, + "line_number": 131, "type": "Secret Keyword", "verified_result": null } @@ -752,7 +760,7 @@ "hashed_secret": "731438016c5ab94431f61820f35e3ae5f8ad6004", "is_secret": false, "is_verified": false, - "line_number": 402, + "line_number": 412, "type": "Secret Keyword", "verified_result": null }, @@ -760,7 +768,7 @@ "hashed_secret": "12da2e35d6b50c902c014f1ab9e3032650368df7", "is_secret": false, "is_verified": false, - "line_number": 408, + "line_number": 418, "type": "Secret Keyword", "verified_result": null }, @@ -768,7 +776,7 @@ "hashed_secret": "813274ccae5b6b509379ab56982d862f7b5969b6", "is_secret": false, "is_verified": false, - "line_number": 1120, + "line_number": 1123, "type": "Base64 High Entropy String", "verified_result": null } @@ -856,7 +864,7 @@ "hashed_secret": "c8b6f5ef11b9223ac35a5663975a466ebe7ebba9", "is_secret": false, "is_verified": false, - "line_number": 1797, + "line_number": 1803, "type": "Secret Keyword", "verified_result": null }, @@ -864,7 +872,7 @@ "hashed_secret": "8abf4899c01104241510ba87685ad4de76b0c437", "is_secret": false, "is_verified": false, - "line_number": 1803, + "line_number": 1809, "type": "Secret Keyword", "verified_result": null } @@ -1803,14 +1811,6 @@ "line_number": 75, "type": "Secret Keyword", "verified_result": null - }, - { - "hashed_secret": "1348b145fa1a555461c1b790a2f66614781091e9", - "is_secret": false, - "is_verified": false, - "line_number": 153, - "type": "Private Key", - "verified_result": null } ], "ibm/service/codeengine/resource_ibm_code_engine_app.go": [ @@ -1941,14 +1941,6 @@ "line_number": 135, "type": "Secret Keyword", "verified_result": null - }, - { - "hashed_secret": "1348b145fa1a555461c1b790a2f66614781091e9", - "is_secret": false, - "is_verified": false, - "line_number": 276, - "type": "Private Key", - "verified_result": null } ], "ibm/service/contextbasedrestrictions/data_source_ibm_cbr_rule_test.go": [ @@ -2164,7 +2156,7 @@ "hashed_secret": "68ab9ef0953865fef0558010a9f7afcef110d5b8", "is_secret": false, "is_verified": false, - "line_number": 270, + "line_number": 271, "type": "Secret Keyword", "verified_result": null }, @@ -2172,7 +2164,7 @@ "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", "is_secret": false, "is_verified": false, - "line_number": 335, + "line_number": 336, "type": "Secret Keyword", "verified_result": null } diff --git a/examples/ibm-code-engine/README.md b/examples/ibm-code-engine/README.md index 7e02d44418..952868955c 100644 --- a/examples/ibm-code-engine/README.md +++ b/examples/ibm-code-engine/README.md @@ -8,6 +8,7 @@ The following types of resources are supported: * code_engine_binding * code_engine_build * code_engine_config_map +* code_engine_domain_mapping * code_engine_job * code_engine_project * code_engine_secret @@ -117,6 +118,20 @@ resource "ibm_code_engine_binding" "code_engine_secret_instance" { } ``` +code_engine_domain_mapping resource: + +```hcl +resource "ibm_code_engine_domain_mapping" "code_engine_domain_mapping_instance" { + project_id = var.code_engine_project_id + name = var.code_engine_domain_mapping_name + component { + name = var.code_engine_domain_mapping_component_name + resource_type = var.code_engine_domain_mapping_component_resource_type + } + tls_secret = var.code_engine_binding_secret_name +} +``` + ## CodeEngineV2 Data sources code_engine_project data source: @@ -176,12 +191,21 @@ data "ibm_code_engine_secret" "code_engine_secret_instance" { code_engine_binding data source: ```hcl -data "ibm_code_engine_secret" "code_engine_secret_instance" { +data "ibm_code_engine_binding" "code_engine_binding_instance" { project_id = var.code_engine_project_id binding_id = var.code_engine_binding_id } ``` +code_engine_domain_mapping data source: + +```hcl +data "ibm_code_engine_domain_mapping" "code_engine_domain_mapping_instance" { + project_id = var.code_engine_project_id + name = var.code_engine_domain_mapping_name +} +``` + ## Inputs | Name | Description | Type | Required | @@ -234,6 +258,7 @@ data "ibm_code_engine_secret" "code_engine_secret_instance" { | resource_group_id | Optional ID of the resource group for your project deployment. If this field is not defined, the default resource group of the account will be used. | `string` | false | | format | Specify the format of the secret. | `string` | true | | service_access | Properties for Service Access Secret Prototypes. | `` | false | +| tls_secret | The name of the TLS secret that holds the certificate and private key of the domain mapping. | `string` | true | ## Outputs @@ -244,5 +269,6 @@ data "ibm_code_engine_secret" "code_engine_secret_instance" { | code_engine_binding | code_engine_binding object | | code_engine_build | code_engine_build object | | code_engine_config_map | code_engine_config_map object | +| code_engine_domain_mapping | code_engine_domain_mapping object | | code_engine_job | code_engine_job object | | code_engine_secret | code_engine_secret object | diff --git a/examples/ibm-code-engine/main.tf b/examples/ibm-code-engine/main.tf index ffb78487b2..e196dbfd81 100644 --- a/examples/ibm-code-engine/main.tf +++ b/examples/ibm-code-engine/main.tf @@ -65,7 +65,6 @@ resource "ibm_code_engine_job" "code_engine_job_instance" { } // Provision code_engine_secret resource instance for format service_access - resource "ibm_code_engine_secret" "code_engine_secret_service_access" { project_id = ibm_code_engine_project.code_engine_project_instance.project_id name = var.code_engine_secret_service_access_name @@ -85,7 +84,6 @@ resource "ibm_code_engine_secret" "code_engine_secret_service_access" { } // Provision code_engine_binding resource instance - resource "ibm_code_engine_binding" "code_engine_binding_instance" { project_id = ibm_code_engine_project.code_engine_project_instance.project_id component { @@ -96,6 +94,17 @@ resource "ibm_code_engine_binding" "code_engine_binding_instance" { secret_name = ibm_code_engine_secret.code_engine_secret_instance.name } +// Provision code_engine_domain_mapping resource instance +resource "ibm_code_engine_domain_mapping" "code_engine_domain_mapping_instance" { + project_id = ibm_code_engine_project.code_engine_project_instance.project_id + name = var.code_engine_domain_mapping_name + component { + name = ibm_code_engine_app.code_engine_app_instance.name + resource_type = ibm_code_engine_app.code_engine_app_instance.resource_type + } + tls_secret = ibm_code_engine_secret.code_engine_secret_instance.name +} + ////////////////// // Data sources @@ -139,3 +148,9 @@ data "ibm_code_engine_binding" "code_engine_binding_data" { project_id = data.ibm_code_engine_project.code_engine_project_data.project_id binding_id = ibm_code_engine_binding.code_engine_binding_instance.binding_id } + +// Create code_engine_domain_mapping data source +data "ibm_code_engine_domain_mapping" "code_engine_domain_mapping_data" { + project_id = data.ibm_code_engine_project.code_engine_project_data.project_id + name = var.code_engine_domain_mapping_name +} diff --git a/examples/ibm-code-engine/outputs.tf b/examples/ibm-code-engine/outputs.tf index 5e06c6750b..7126482655 100644 --- a/examples/ibm-code-engine/outputs.tf +++ b/examples/ibm-code-engine/outputs.tf @@ -42,3 +42,9 @@ output "ibm_code_engine_binding" { value = ibm_code_engine_binding.code_engine_binding_instance description = "code_engine_binding resource instance" } +// This allows code_engine_domain_mapping data to be referenced by other resources and the terraform CLI +// Modify this if only certain data should be exposed +output "ibm_code_engine_domain_mapping" { + value = ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance + description = "code_engine_domain_mapping resource instance" +} diff --git a/examples/ibm-code-engine/variables.tf b/examples/ibm-code-engine/variables.tf index 15621a89fe..86f1b0a770 100644 --- a/examples/ibm-code-engine/variables.tf +++ b/examples/ibm-code-engine/variables.tf @@ -119,6 +119,12 @@ variable "code_engine_binding_prefix" { default = "MY_PREFIX" } +// Resource arguments for code_engine_domain_mapping +variable "code_engine_domain_mapping_name" { + description = "The name of the domain mapping." + type = string +} + // Data source arguments for code_engine_project variable "code_engine_project_id" { description = "The ID of the project." diff --git a/go.mod b/go.mod index 9412a594f3..db250f0b40 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f github.com/IBM/cloud-databases-go-sdk v0.3.2 github.com/IBM/cloudant-go-sdk v0.0.43 - github.com/IBM/code-engine-go-sdk v0.0.0-20230606173928-4863db061918 + github.com/IBM/code-engine-go-sdk v0.0.0-20231106200405-99e81b3ee752 github.com/IBM/container-registry-go-sdk v1.1.0 github.com/IBM/continuous-delivery-go-sdk v1.3.0 github.com/IBM/event-notifications-go-admin-sdk v0.2.7 @@ -40,7 +40,7 @@ require ( github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 github.com/go-openapi/strfmt v0.21.7 github.com/golang-jwt/jwt v3.2.2+incompatible - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.3.0 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.6.0 @@ -94,7 +94,8 @@ require ( github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/fatih/color v1.15.0 // indirect github.com/frankban/quicktest v1.14.3 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/go-jose/go-jose/v3 v3.0.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -110,7 +111,7 @@ require ( github.com/go-ozzo/ozzo-validation/v4 v4.3.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.13.0 // indirect + github.com/go-playground/validator/v10 v10.15.5 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect @@ -125,7 +126,7 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-plugin v1.5.0 // indirect - github.com/hashicorp/go-retryablehttp v0.7.2 // indirect + github.com/hashicorp/go-retryablehttp v0.7.4 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect @@ -159,7 +160,7 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.16.7 // indirect github.com/kube-object-storage/lib-bucket-provisioner v0.0.0-20221122204822-d1a8c34382f1 // indirect - github.com/leodido/go-urn v1.2.3 // indirect + github.com/leodido/go-urn v1.2.4 // indirect github.com/libopenstorage/secrets v0.0.0-20220823020833-2ecadaf59d8a // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -198,7 +199,7 @@ require ( github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect github.com/vmihailenco/tagparser v0.1.1 // indirect github.com/zclconf/go-cty v1.11.0 // indirect - go.mongodb.org/mongo-driver v1.11.6 // indirect + go.mongodb.org/mongo-driver v1.12.1 // indirect go.opentelemetry.io/otel v1.14.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect go.uber.org/ratelimit v0.2.0 // indirect diff --git a/go.sum b/go.sum index ea0d957ea6..958008a15c 100644 --- a/go.sum +++ b/go.sum @@ -121,8 +121,8 @@ github.com/IBM/cloud-databases-go-sdk v0.3.2 h1:AUi7/xswqCwuXIlSyuXtDZJIm4d0ZicU github.com/IBM/cloud-databases-go-sdk v0.3.2/go.mod h1:nCIVfeZnhBYIiwByT959dFP4VWUeNLxomDYy63tTC6M= github.com/IBM/cloudant-go-sdk v0.0.43 h1:YxTy4RpAEezX32YIWnds76hrBREmO4u6IkBz1WylNuQ= github.com/IBM/cloudant-go-sdk v0.0.43/go.mod h1:WeYrJPaHTw19943ndWnVfwMIlZ5z0XUM2uEXNBrwZ1M= -github.com/IBM/code-engine-go-sdk v0.0.0-20230606173928-4863db061918 h1:RfHezAVs3HegiGOcMmTXqsBPqZqfwZZHqje1EMriHBQ= -github.com/IBM/code-engine-go-sdk v0.0.0-20230606173928-4863db061918/go.mod h1:IP6U/1NxgxzPeYdyiEwMaZyzelTw82JGHWl7bY78eQM= +github.com/IBM/code-engine-go-sdk v0.0.0-20231106200405-99e81b3ee752 h1:S5NT0aKKUqd9hnIrPN/qUijKx9cZjJi3kfFpog0ByDA= +github.com/IBM/code-engine-go-sdk v0.0.0-20231106200405-99e81b3ee752/go.mod h1:noWxHQUgW9msjOrDpV17gnwWbTbUlSmWMGq7/Vi/n9I= github.com/IBM/container-registry-go-sdk v1.1.0 h1:sYyknIod8R4RJZQqAheiduP6wbSTphE9Ag8ho28yXjc= github.com/IBM/container-registry-go-sdk v1.1.0/go.mod h1:4TwsCnQtVfZ4Vkapy/KPvQBKFc3VOyUZYkwRU4FTPrs= github.com/IBM/continuous-delivery-go-sdk v1.3.0 h1:WsILMVpNWD/5G40ltWeXbOj4y5ODQSq1hKXAnDJuNjw= @@ -448,9 +448,11 @@ github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3 github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= +github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= +github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/gammazero/deque v0.0.0-20190130191400-2afb3858e9c7/go.mod h1:GeIq9qoE43YdGnDXURnmKTnGg15pQz4mYkXSTChbneI= github.com/gammazero/workerpool v0.0.0-20190406235159-88d534f22b56/go.mod h1:w9RqFVO2BM3xwWEcAB8Fwp0OviTBBEiRmSBDfbXnd3w= github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= @@ -598,8 +600,8 @@ github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+ github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.13.0 h1:cFRQdfaSMCOSfGCCLB20MHvuoHb/s5G8L5pu2ppK5AQ= -github.com/go-playground/validator/v10 v10.13.0/go.mod h1:dwu7+CG8/CtBiJFZDz4e+5Upb6OLw04gtBYw0mcG/z4= +github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7NLylN+x8TTueE24= +github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= @@ -711,8 +713,9 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-metrics-stackdriver v0.2.0 h1:rbs2sxHAPn2OtUj9JdR/Gij1YKGl0BTVD0augB+HEjE= github.com/google/go-metrics-stackdriver v0.2.0/go.mod h1:KLcPyp3dWJAFD+yHisGlJSZktIsTjb50eB72U2YZ9K0= @@ -856,8 +859,8 @@ github.com/hashicorp/go-retryablehttp v0.6.2/go.mod h1:gEx6HMUGxYYhJScX7W1Il64m6 github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= -github.com/hashicorp/go-retryablehttp v0.7.2 h1:AcYqCvkpalPnPF2pn0KamgwamS42TqUDDYFRKq/RAd0= -github.com/hashicorp/go-retryablehttp v0.7.2/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/hashicorp/go-retryablehttp v0.7.4 h1:ZQgVdpTdAL7WpMIwLzCfbalOcSUdkDZnpUv3/+BxzFA= +github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= @@ -1112,8 +1115,8 @@ github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LE github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/leodido/go-urn v1.2.3 h1:6BE2vPT0lqoz3fmOesHZiaiFh7889ssCo2GMvLCfiuA= -github.com/leodido/go-urn v1.2.3/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= +github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= +github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/libopenstorage/autopilot-api v0.6.1-0.20210128210103-5fbb67948648/go.mod h1:6JLrPbR3ZJQFbUY/+QJMl/aF00YdIrLf8/GWAplgvJs= github.com/libopenstorage/openstorage v8.0.0+incompatible/go.mod h1:Sp1sIObHjat1BeXhfMqLZ14wnOzEhNx2YQedreMcUyc= @@ -1232,8 +1235,8 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758= github.com/nwaples/rardecode v1.0.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= @@ -1304,8 +1307,8 @@ github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+q github.com/onsi/gomega v1.27.7/go.mod h1:1p8OOlwo2iUUDsHnOrjE5UKYJ+e3W8eQ3qSlRahPmr4= github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= -github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c= github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8= +github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= @@ -1516,7 +1519,6 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tencentcloud/tencentcloud-sdk-go v3.0.171+incompatible h1:K3fcS92NS8cRntIdu8Uqy2ZSePvX73nNhOkKuPGJLXQ= -github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tj/assert v0.0.0-20171129193455-018094318fb0/go.mod h1:mZ9/Rh9oLWpLLDRpvE+3b7gP/C2YyLFYxNmcLnPTMe0= github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk= @@ -1549,8 +1551,10 @@ github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6e github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= @@ -1593,8 +1597,8 @@ go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R7 go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= go.mongodb.org/mongo-driver v1.11.3/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g= -go.mongodb.org/mongo-driver v1.11.6 h1:XM7G6PjiGAO5betLF13BIa5TlLUUE3uJ/2Ox3Lz1K+o= -go.mongodb.org/mongo-driver v1.11.6/go.mod h1:G9TgswdsWjX4tmDA5zfs2+6AEPpYJwqblyjsfuh8oXY= +go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE= +go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ= go.opencensus.io v0.19.1/go.mod h1:gug0GbSHa8Pafr0d2urOSgoXHZ6x/RUlaiT0d9pqb4A= go.opencensus.io v0.19.2/go.mod h1:NO/8qkisMZLZ1FCsKNqtJPwc8/TaclWyY0B6wcYNg9M= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1927,7 +1931,6 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1966,6 +1969,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 7335b4bdeb..5e411830a7 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -12,10 +12,9 @@ import ( "sync" "testing" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/provider" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" terraformsdk "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/provider" ) const ( @@ -312,6 +311,9 @@ var ( CeProjectId string CeServiceInstanceID string CeResourceKeyID string + CeDomainMappingName string + CeTLSCert string + CeTLSKey string ) // Satellite tests @@ -1531,6 +1533,24 @@ func init() { fmt.Println("[WARN] Set the environment variable IBM_CODE_ENGINE_RESOURCE_KEY_ID with the ID of a resource key to access a service instance") } + CeDomainMappingName = os.Getenv("IBM_CODE_ENGINE_DOMAIN_MAPPING_NAME") + if CeDomainMappingName == "" { + CeDomainMappingName = "" + fmt.Println("[WARN] Set the environment variable IBM_CODE_ENGINE_DOMAIN_MAPPING_NAME with the name of a domain mapping") + } + + CeTLSCert = os.Getenv("IBM_CODE_ENGINE_TLS_CERT") + if CeTLSCert == "" { + CeTLSCert = "" + fmt.Println("[WARN] Set the environment variable IBM_CODE_ENGINE_TLS_CERT with the TLS certificate in base64 format") + } + + CeTLSKey = os.Getenv("IBM_CODE_ENGINE_TLS_KEY") + if CeTLSKey == "" { + CeTLSKey = "" + fmt.Println("[WARN] Set the environment variable IBM_CODE_ENGINE_TLS_KEY with a TLS key in base64 format") + } + SatelliteSSHPubKey = os.Getenv("IBM_SATELLITE_SSH_PUB_KEY") if SatelliteSSHPubKey == "" { fmt.Println("[WARN] Set the environment variable IBM_SATELLITE_SSH_PUB_KEY with a ssh public key or ibm_satellite_* tests may fail") @@ -1697,6 +1717,21 @@ func TestAccPreCheckCodeEngine(t *testing.T) { if CeProjectId == "" { t.Fatal("IBM_CODE_ENGINE_PROJECT_INSTANCE_ID must be set for acceptance tests") } + if CeServiceInstanceID == "" { + t.Fatal("IBM_CODE_ENGINE_SERVICE_INSTANCE_ID must be set for acceptance tests") + } + if CeResourceKeyID == "" { + t.Fatal("IBM_CODE_ENGINE_RESOURCE_KEY_ID must be set for acceptance tests") + } + if CeDomainMappingName == "" { + t.Fatal("IBM_CODE_ENGINE_DOMAIN_MAPPING_NAME must be set for acceptance tests") + } + if CeTLSCert == "" { + t.Fatal("IBM_CODE_ENGINE_DOMAIN_MAPPING_TLS_CERT must be set for acceptance tests") + } + if CeTLSKey == "" { + t.Fatal("IBM_CODE_ENGINE_DOMAIN_MAPPING_TLS_KEY must be set for acceptance tests") + } } func TestAccPreCheckUsage(t *testing.T) { diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index bdc22fc9a5..422dddc3e1 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -848,13 +848,14 @@ func Provider() *schema.Provider { "ibm_cd_tekton_pipeline": cdtektonpipeline.DataSourceIBMCdTektonPipeline(), // Added for Code Engine - "ibm_code_engine_app": codeengine.DataSourceIbmCodeEngineApp(), - "ibm_code_engine_binding": codeengine.DataSourceIbmCodeEngineBinding(), - "ibm_code_engine_build": codeengine.DataSourceIbmCodeEngineBuild(), - "ibm_code_engine_config_map": codeengine.DataSourceIbmCodeEngineConfigMap(), - "ibm_code_engine_job": codeengine.DataSourceIbmCodeEngineJob(), - "ibm_code_engine_project": codeengine.DataSourceIbmCodeEngineProject(), - "ibm_code_engine_secret": codeengine.DataSourceIbmCodeEngineSecret(), + "ibm_code_engine_app": codeengine.DataSourceIbmCodeEngineApp(), + "ibm_code_engine_binding": codeengine.DataSourceIbmCodeEngineBinding(), + "ibm_code_engine_build": codeengine.DataSourceIbmCodeEngineBuild(), + "ibm_code_engine_config_map": codeengine.DataSourceIbmCodeEngineConfigMap(), + "ibm_code_engine_domain_mapping": codeengine.DataSourceIbmCodeEngineDomainMapping(), + "ibm_code_engine_job": codeengine.DataSourceIbmCodeEngineJob(), + "ibm_code_engine_project": codeengine.DataSourceIbmCodeEngineProject(), + "ibm_code_engine_secret": codeengine.DataSourceIbmCodeEngineSecret(), // Added for Project "ibm_project": project.DataSourceIbmProject(), @@ -1361,13 +1362,14 @@ func Provider() *schema.Provider { "ibm_cd_tekton_pipeline": cdtektonpipeline.ResourceIBMCdTektonPipeline(), // Added for Code Engine - "ibm_code_engine_app": codeengine.ResourceIbmCodeEngineApp(), - "ibm_code_engine_binding": codeengine.ResourceIbmCodeEngineBinding(), - "ibm_code_engine_build": codeengine.ResourceIbmCodeEngineBuild(), - "ibm_code_engine_config_map": codeengine.ResourceIbmCodeEngineConfigMap(), - "ibm_code_engine_job": codeengine.ResourceIbmCodeEngineJob(), - "ibm_code_engine_project": codeengine.ResourceIbmCodeEngineProject(), - "ibm_code_engine_secret": codeengine.ResourceIbmCodeEngineSecret(), + "ibm_code_engine_app": codeengine.ResourceIbmCodeEngineApp(), + "ibm_code_engine_binding": codeengine.ResourceIbmCodeEngineBinding(), + "ibm_code_engine_build": codeengine.ResourceIbmCodeEngineBuild(), + "ibm_code_engine_config_map": codeengine.ResourceIbmCodeEngineConfigMap(), + "ibm_code_engine_domain_mapping": codeengine.ResourceIbmCodeEngineDomainMapping(), + "ibm_code_engine_job": codeengine.ResourceIbmCodeEngineJob(), + "ibm_code_engine_project": codeengine.ResourceIbmCodeEngineProject(), + "ibm_code_engine_secret": codeengine.ResourceIbmCodeEngineSecret(), // Added for Project "ibm_project": project.ResourceIbmProject(), @@ -1618,13 +1620,14 @@ func Validator() validate.ValidatorDict { "ibm_sm_public_certificate_configuration_dns_classic_infrastructure": secretsmanager.ResourceIbmSmPublicCertificateConfigurationDNSClassicInfrastructureValidator(), // // Added for Code Engine - "ibm_code_engine_app": codeengine.ResourceIbmCodeEngineAppValidator(), - "ibm_code_engine_binding": codeengine.ResourceIbmCodeEngineBindingValidator(), - "ibm_code_engine_build": codeengine.ResourceIbmCodeEngineBuildValidator(), - "ibm_code_engine_config_map": codeengine.ResourceIbmCodeEngineConfigMapValidator(), - "ibm_code_engine_job": codeengine.ResourceIbmCodeEngineJobValidator(), - "ibm_code_engine_project": codeengine.ResourceIbmCodeEngineProjectValidator(), - "ibm_code_engine_secret": codeengine.ResourceIbmCodeEngineSecretValidator(), + "ibm_code_engine_app": codeengine.ResourceIbmCodeEngineAppValidator(), + "ibm_code_engine_binding": codeengine.ResourceIbmCodeEngineBindingValidator(), + "ibm_code_engine_build": codeengine.ResourceIbmCodeEngineBuildValidator(), + "ibm_code_engine_config_map": codeengine.ResourceIbmCodeEngineConfigMapValidator(), + "ibm_code_engine_domain_mapping": codeengine.ResourceIbmCodeEngineDomainMappingValidator(), + "ibm_code_engine_job": codeengine.ResourceIbmCodeEngineJobValidator(), + "ibm_code_engine_project": codeengine.ResourceIbmCodeEngineProjectValidator(), + "ibm_code_engine_secret": codeengine.ResourceIbmCodeEngineSecretValidator(), // Added for Project "ibm_project": project.ResourceIbmProjectValidator(), diff --git a/ibm/service/codeengine/data_source_ibm_code_engine_domain_mapping.go b/ibm/service/codeengine/data_source_ibm_code_engine_domain_mapping.go new file mode 100644 index 0000000000..af313eb1fd --- /dev/null +++ b/ibm/service/codeengine/data_source_ibm_code_engine_domain_mapping.go @@ -0,0 +1,219 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package codeengine + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM/code-engine-go-sdk/codeenginev2" +) + +func DataSourceIbmCodeEngineDomainMapping() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmCodeEngineDomainMappingRead, + + Schema: map[string]*schema.Schema{ + "project_id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The ID of the project.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The name of your domain mapping.", + }, + "cname_target": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Exposes the value of the CNAME record that needs to be configured in the DNS settings of the domain, to route traffic properly to the target Code Engine region.", + }, + "component": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A reference to another component.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the referenced component.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the referenced resource.", + }, + }, + }, + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The timestamp when the resource was created.", + }, + "domain_mapping_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The identifier of the resource.", + }, + "entity_tag": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version of the domain mapping instance, which is used to achieve optimistic locking.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "When you provision a new domain mapping, a URL is created identifying the location of the instance.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the CE Resource.", + }, + "status": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The current status of the domain mapping.", + }, + "status_details": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The detailed status of the domain mapping.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "reason": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Optional information to provide more context in case of a 'failed' or 'warning' status.", + }, + }, + }, + }, + "tls_secret": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the TLS secret that holds the certificate and private key of this domain mapping.", + }, + "user_managed": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Exposes whether the domain mapping is managed by the user or by Code Engine.", + }, + "visibility": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Exposes whether the domain mapping is reachable through the public internet, or private IBM network, or only through other components within the same Code Engine project.", + }, + }, + } +} + +func dataSourceIbmCodeEngineDomainMappingRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + codeEngineClient, err := meta.(conns.ClientSession).CodeEngineV2() + if err != nil { + return diag.FromErr(err) + } + + getDomainMappingOptions := &codeenginev2.GetDomainMappingOptions{} + + getDomainMappingOptions.SetProjectID(d.Get("project_id").(string)) + getDomainMappingOptions.SetName(d.Get("name").(string)) + + domainMapping, response, err := codeEngineClient.GetDomainMappingWithContext(context, getDomainMappingOptions) + if err != nil { + log.Printf("[DEBUG] GetDomainMappingWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetDomainMappingWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s/%s", *getDomainMappingOptions.ProjectID, *getDomainMappingOptions.Name)) + + if err = d.Set("cname_target", domainMapping.CnameTarget); err != nil { + return diag.FromErr(fmt.Errorf("Error setting cname_target: %s", err)) + } + + component := []map[string]interface{}{} + if domainMapping.Component != nil { + modelMap, err := dataSourceIbmCodeEngineDomainMappingComponentRefToMap(domainMapping.Component) + if err != nil { + return diag.FromErr(err) + } + component = append(component, modelMap) + } + if err = d.Set("component", component); err != nil { + return diag.FromErr(fmt.Errorf("Error setting component %s", err)) + } + + if err = d.Set("created_at", domainMapping.CreatedAt); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + + if err = d.Set("entity_tag", domainMapping.EntityTag); err != nil { + return diag.FromErr(fmt.Errorf("Error setting entity_tag: %s", err)) + } + + if err = d.Set("href", domainMapping.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + + if err = d.Set("domain_mapping_id", domainMapping.ID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting domain_mapping_id: %s", err)) + } + + if err = d.Set("resource_type", domainMapping.ResourceType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_type: %s", err)) + } + + if err = d.Set("status", domainMapping.Status); err != nil { + return diag.FromErr(fmt.Errorf("Error setting status: %s", err)) + } + + statusDetails := []map[string]interface{}{} + if domainMapping.StatusDetails != nil { + modelMap, err := dataSourceIbmCodeEngineDomainMappingDomainMappingStatusToMap(domainMapping.StatusDetails) + if err != nil { + return diag.FromErr(err) + } + statusDetails = append(statusDetails, modelMap) + } + if err = d.Set("status_details", statusDetails); err != nil { + return diag.FromErr(fmt.Errorf("Error setting status_details %s", err)) + } + + if err = d.Set("tls_secret", domainMapping.TlsSecret); err != nil { + return diag.FromErr(fmt.Errorf("Error setting tls_secret: %s", err)) + } + + if err = d.Set("user_managed", domainMapping.UserManaged); err != nil { + return diag.FromErr(fmt.Errorf("Error setting user_managed: %s", err)) + } + + if err = d.Set("visibility", domainMapping.Visibility); err != nil { + return diag.FromErr(fmt.Errorf("Error setting visibility: %s", err)) + } + + return nil +} + +func dataSourceIbmCodeEngineDomainMappingComponentRefToMap(model *codeenginev2.ComponentRef) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIbmCodeEngineDomainMappingDomainMappingStatusToMap(model *codeenginev2.DomainMappingStatus) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Reason != nil { + modelMap["reason"] = model.Reason + } + return modelMap, nil +} diff --git a/ibm/service/codeengine/data_source_ibm_code_engine_domain_mapping_test.go b/ibm/service/codeengine/data_source_ibm_code_engine_domain_mapping_test.go new file mode 100644 index 0000000000..9a852e3f14 --- /dev/null +++ b/ibm/service/codeengine/data_source_ibm_code_engine_domain_mapping_test.go @@ -0,0 +1,107 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package codeengine_test + +import ( + "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmCodeEngineDomainMappingDataSourceBasic(t *testing.T) { + appName := fmt.Sprintf("tf-app-domain-mapping-%d", acctest.RandIntRange(10, 1000)) + secretName := fmt.Sprintf("tf-secret-domain-mapping-%d", acctest.RandIntRange(10, 1000)) + + projectID := acc.CeProjectId + domainMappingName := acc.CeDomainMappingName + domainMappingTLSKey := decodeBase64EnvVar(acc.CeTLSKey, CeTlsKey) + domainMappingTLSCert := decodeBase64EnvVar(acc.CeTLSCert, CeTlsCert) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckCodeEngine(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmCodeEngineDomainMappingDataSourceConfigBasic(projectID, appName, domainMappingTLSKey, domainMappingTLSCert, secretName, domainMappingName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "href"), + resource.TestCheckResourceAttrSet("data.ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "status"), + resource.TestCheckResourceAttrSet("data.ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "cname_target"), + resource.TestCheckResourceAttrSet("data.ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "user_managed"), + resource.TestCheckResourceAttrSet("data.ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "visibility"), + resource.TestCheckResourceAttr("data.ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "project_id", projectID), + resource.TestCheckResourceAttr("data.ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "name", domainMappingName), + resource.TestCheckResourceAttr("data.ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "resource_type", "domain_mapping_v2"), + resource.TestCheckResourceAttr("data.ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "component.0.resource_type", "app_v2"), + resource.TestCheckResourceAttr("data.ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "component.0.name", appName), + resource.TestCheckResourceAttr("data.ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "tls_secret", secretName), + ), + }, + }, + }) +} + +func testAccCheckIbmCodeEngineDomainMappingDataSourceConfigBasic(projectID string, appName string, tlsKey string, tslCert string, secretName string, domainMappingName string) string { + return fmt.Sprintf(` + data "ibm_code_engine_project" "code_engine_project_instance" { + project_id = "%s" + } + + resource "ibm_code_engine_app" "code_engine_app_instance" { + project_id = data.ibm_code_engine_project.code_engine_project_instance.project_id + image_reference = "icr.io/codeengine/helloworld" + name = "%s" + + lifecycle { + ignore_changes = [ + run_env_variables + ] + } + } + + variable "tls_secret_data" { + type = map(string) + default = { + "tls_key" = </ +``` +* `project_id`: A string in the format `15314cc3-85b4-4338-903f-c28cdee6d005`. The ID of the project. +* `name`: A string in the format `www.example.com`. The name of the domain mapping. + +# Syntax +``` +$ terraform import ibm_code_engine_domain_mapping.code_engine_domain_mapping / +``` From 11bf7d01aac1e278a3f44c83d95a19a6935099c0 Mon Sep 17 00:00:00 2001 From: Bob Fang <7771298+bobfang@users.noreply.github.com> Date: Tue, 14 Nov 2023 14:28:36 -0800 Subject: [PATCH 058/132] Add IC_REGION to readme and tip on env vars Add IC_REGION because it is easy to miss out on when setting up the test environment. Add a tip on how to locate the required environment variables that need to be set for each specific test --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index f02c0b8005..5678123644 100644 --- a/README.md +++ b/README.md @@ -124,11 +124,19 @@ Issuing `make testacc` will now run the testcase with names matching `TestAccIBM You will also need to export the following environment variables for running the Acceptance tests. * `IC_API_KEY`- The IBM Cloud API Key +* `IC_REGION` - The IBM Cloud [region](https://cloud.ibm.com/docs/overview?topic=overview-locations) used by test resources - defaults to `us-south` * `IAAS_CLASSIC_API_KEY` - The IBM Cloud Classic Infrastructure API Key * `IAAS_CLASSIC_USERNAME` - The IBM Cloud Classic Infrastructure username associated with the Classic InfrastAPI Key. Additional environment variables may be required depending on the tests being run. Check console log for warning messages about required variables. +Alternatively, look for the name of the function by PreCheck under the specific test case and inspect [ibm/acctest/acctest.go](https://github.com/IBM-Cloud/terraform-provider-ibm/blob/master/ibm/acctest/acctest.go) to find the list of environment variables required for the test. + +``` + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, +``` # IBM Cloud Ansible Modules From 16d47489be560c0907ab74139b0ae0f55aa1e66c Mon Sep 17 00:00:00 2001 From: SunithaGudisagar Date: Mon, 30 Oct 2023 11:49:08 +0530 Subject: [PATCH 059/132] VPC ID Filter is added when Subnet Name is specified --- ibm/service/vpc/data_source_ibm_is_subnet.go | 12 +++- ibm/service/vpc/data_source_ibm_is_subnets.go | 69 +++++++++++++++++-- website/docs/d/is_subnet.html.markdown | 1 + website/docs/d/is_subnets.html.markdown | 10 ++- 4 files changed, 79 insertions(+), 13 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_subnet.go b/ibm/service/vpc/data_source_ibm_is_subnet.go index 6a2503e06a..92154b1759 100644 --- a/ibm/service/vpc/data_source_ibm_is_subnet.go +++ b/ibm/service/vpc/data_source_ibm_is_subnet.go @@ -87,8 +87,11 @@ func DataSourceIBMISSubnet() *schema.Resource { }, isSubnetVPC: { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + RequiredWith: []string{isSubnetName}, + ValidateFunc: validate.InvokeDataSourceValidator("ibm_is_subnet", "identifier"), }, isSubnetVPCName: { @@ -229,11 +232,14 @@ func subnetGetByNameOrID(d *schema.ResourceData, meta interface{}) error { start := "" allrecs := []vpcv1.Subnet{} getSubnetsListOptions := &vpcv1.ListSubnetsOptions{} - for { if start != "" { getSubnetsListOptions.Start = &start } + if vpcIdOk, ok := d.GetOk(isSubnetVPC); ok { + vpcIDOk := vpcIdOk.(string) + getSubnetsListOptions.VPCID = &vpcIDOk + } subnetsCollection, response, err := sess.ListSubnets(getSubnetsListOptions) if err != nil { return fmt.Errorf("[ERROR] Error Fetching subnets List %s\n%s", err, response) diff --git a/ibm/service/vpc/data_source_ibm_is_subnets.go b/ibm/service/vpc/data_source_ibm_is_subnets.go index 395a64bf39..09950f0026 100644 --- a/ibm/service/vpc/data_source_ibm_is_subnets.go +++ b/ibm/service/vpc/data_source_ibm_is_subnets.go @@ -17,6 +17,10 @@ const ( isSubnets = "subnets" isSubnetResourceGroupID = "resource_group" isSubnetRoutingTableName = "routing_table_name" + isSubnetResourceZone = "zone" + isSubnetResourceVpc = "vpc" + isSubnetResourceVpcCrn = "vpc_crn" + isSubnetResourceVpcName = "vpc_name" ) func DataSourceIBMISSubnets() *schema.Resource { @@ -24,6 +28,26 @@ func DataSourceIBMISSubnets() *schema.Resource { Read: dataSourceIBMISSubnetsRead, Schema: map[string]*schema.Schema{ + isSubnetResourceVpc: { + Type: schema.TypeString, + Description: "ID of the VPC", + Optional: true, + }, + isSubnetResourceVpcName: { + Type: schema.TypeString, + Description: "Name of the VPC", + Optional: true, + }, + isSubnetResourceVpcCrn: { + Type: schema.TypeString, + Description: "CRN of the VPC", + Optional: true, + }, + isSubnetResourceZone: { + Type: schema.TypeString, + Description: "Name of the Zone ", + Optional: true, + }, isSubnetResourceGroupID: { Type: schema.TypeString, Description: "Resource Group ID", @@ -177,18 +201,49 @@ func subnetList(d *schema.ResourceData, meta interface{}) error { resourceTableName = v.(string) } - options := &vpcv1.ListSubnetsOptions{} - if resourceGroup != "" { - options.SetResourceGroupID(resourceGroup) + var zone string + if v, ok := d.GetOk(isSubnetResourceZone); ok { + zone = v.(string) } - if routingTable != "" { - options.SetRoutingTableID(routingTable) + + var vpc string + if v, ok := d.GetOk(isSubnetResourceVpc); ok { + vpc = v.(string) + } + + var vpcName string + if v, ok := d.GetOk(isSubnetResourceVpcName); ok { + vpcName = v.(string) } - if resourceTableName != "" { - options.SetRoutingTableName(resourceTableName) + + var vpcCrn string + if v, ok := d.GetOk(isSubnetResourceVpcCrn); ok { + vpcCrn = v.(string) } for { + options := &vpcv1.ListSubnetsOptions{} + if resourceGroup != "" { + options.SetResourceGroupID(resourceGroup) + } + if routingTable != "" { + options.SetRoutingTableID(routingTable) + } + if resourceTableName != "" { + options.SetRoutingTableName(resourceTableName) + } + if zone != "" { + options.SetZoneName(zone) + } + if vpc != "" { + options.SetVPCID(vpc) + } + if vpcName != "" { + options.SetVPCName(vpcName) + } + if vpcCrn != "" { + options.SetVPCCRN(vpcCrn) + } if start != "" { options.Start = &start } diff --git a/website/docs/d/is_subnet.html.markdown b/website/docs/d/is_subnet.html.markdown index 9021976fe7..62cb8405b8 100644 --- a/website/docs/d/is_subnet.html.markdown +++ b/website/docs/d/is_subnet.html.markdown @@ -65,6 +65,7 @@ Review the argument references that you can specify for your data source. - `identifier` - (Optional, String) The ID of the subnet,`name` and `identifier` are mutually exclusive. - `name` - (Optional, String) The name of the subnet,`name` and `identifier` are mutually exclusive. +- `vpc` - (Optional, String) Filters the collection to resources with a vpc property matching the specified identifier. Subnet `name` must be specified with `vpc` filter. ## Attribute reference In addition to all argument reference list, you can access the following attribute references after your data source is created. diff --git a/website/docs/d/is_subnets.html.markdown b/website/docs/d/is_subnets.html.markdown index b85935f8c3..1ff061f5eb 100644 --- a/website/docs/d/is_subnets.html.markdown +++ b/website/docs/d/is_subnets.html.markdown @@ -65,9 +65,13 @@ data "ibm_is_subnets" "example4" { Review the argument references that you can specify for your data source. -* `resource_group` - (Optional, string) The id of the resource group. -* `routing_table` - (Optional, string) The id of the routing table. -* `routing_table_name` - (Optional, string) The name of the routing table. +- `resource_group` - (Optional, string) The id of the resource group. +- `routing_table` - (Optional, string) The id of the routing table. +- `routing_table_name` - (Optional, string) The name of the routing table. +- `vpc` - (Optional, string) The id of the vpc. +- `vpc_crn` - (Optional, string) The crn of the vpc. +- `vpc_name` - (Optional, string) The name of vpc. +- `zone` - (Optional, string) The name of the zone. ## Attribute reference You can access the following attribute references after your data source is created. From e69b93c39fc9d3a6702bdd9d53ff18c43b834442 Mon Sep 17 00:00:00 2001 From: Simone-Rodigari Date: Fri, 10 Nov 2023 13:10:43 +0000 Subject: [PATCH 060/132] Fix wrong sintax in doc for Ingress Secret Opaque --- website/docs/r/container_ingress_secret_opaque.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/r/container_ingress_secret_opaque.html.markdown b/website/docs/r/container_ingress_secret_opaque.html.markdown index 3dac4048f5..4d94d9ab59 100644 --- a/website/docs/r/container_ingress_secret_opaque.html.markdown +++ b/website/docs/r/container_ingress_secret_opaque.html.markdown @@ -17,10 +17,10 @@ resource "ibm_container_ingress_secret_opaque" "secret" { secret_name="mySecretName" secret_namespace="mySecretNamespace" persistence = true - fields = { + fields { crn = "cert:region:crn" } - fields = { + fields { field_name = "myFieldName" crn = "cert:region:crn" } From 1142c27bd8bfee92a34d4284fb6b544359857e29 Mon Sep 17 00:00:00 2001 From: VaishnaviGopal Date: Fri, 17 Nov 2023 19:03:07 +0530 Subject: [PATCH 061/132] Added fields name,default to workspace template_values_metadata --- .../data_source_ibm_schematics_workspace.go | 13 +++++++------ .../resource_ibm_schematics_workspace.go | 19 ++++++++++++------- .../docs/d/schematics_workspace.html.markdown | 3 ++- .../docs/r/schematics_workspace.html.markdown | 3 ++- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/ibm/service/schematics/data_source_ibm_schematics_workspace.go b/ibm/service/schematics/data_source_ibm_schematics_workspace.go index d6855d253f..69408e2c12 100644 --- a/ibm/service/schematics/data_source_ibm_schematics_workspace.go +++ b/ibm/service/schematics/data_source_ibm_schematics_workspace.go @@ -300,6 +300,11 @@ func DataSourceIBMSchematicsWorkspace() *schema.Resource { Description: "A list of input variables that are associated with the workspace.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Name of the variable.", + }, "type": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -323,7 +328,7 @@ func DataSourceIBMSchematicsWorkspace() *schema.Resource { Computed: true, Description: "Cloud data type of the variable. eg. resource_group_id, region, vpc_id.", }, - "default_value": &schema.Schema{ + "default": &schema.Schema{ Type: schema.TypeString, Computed: true, Description: "Default value for the variable only if the override value is not specified.", @@ -915,11 +920,7 @@ func dataSourceWorkspaceResponseTemplateDataToMap(templateDataItem schematicsv1. templateDataMap["values"] = templateDataItem.Values } if templateDataItem.ValuesMetadata != nil { - valuesMetadata := []map[string]interface{}{} - for _, valuesMetadataItem := range templateDataItem.ValuesMetadata { - valuesMetadata = append(valuesMetadata, valuesMetadataItem) - } - templateDataMap["values_metadata"] = valuesMetadata + templateDataMap["values_metadata"] = templateDataItem.ValuesMetadata } if templateDataItem.ValuesURL != nil { templateDataMap["values_url"] = templateDataItem.ValuesURL diff --git a/ibm/service/schematics/resource_ibm_schematics_workspace.go b/ibm/service/schematics/resource_ibm_schematics_workspace.go index b6309bf51d..f4c87066b6 100644 --- a/ibm/service/schematics/resource_ibm_schematics_workspace.go +++ b/ibm/service/schematics/resource_ibm_schematics_workspace.go @@ -226,6 +226,11 @@ func ResourceIBMSchematicsWorkspace() *schema.Resource { Description: "List of values metadata.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Name of the variable.", + }, "type": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -249,7 +254,7 @@ func ResourceIBMSchematicsWorkspace() *schema.Resource { Computed: true, Description: "Cloud data type of the variable. eg. resource_group_id, region, vpc_id.", }, - "default_value": &schema.Schema{ + "default": &schema.Schema{ Type: schema.TypeString, Computed: true, Description: "Default value for the variable only if the override value is not specified.", @@ -808,8 +813,8 @@ func resourceIBMSchematicsWorkspaceMapToSharedTargetData(sharedTargetDataMap map } if sharedTargetDataMap["entitlement_keys"] != nil { entitlementKeys := []map[string]interface{}{} - for _, entitlementKeysItem := range sharedTargetDataMap["entitlement_keys"].([]map[string]interface{}) { - entitlementKeys = append(entitlementKeys, entitlementKeysItem) + for _, entitlementKeysItem := range sharedTargetDataMap["entitlement_keys"].([]interface{}) { + entitlementKeys = append(entitlementKeys, entitlementKeysItem.(map[string]interface{})) } sharedTargetData.EntitlementKeys = entitlementKeys } @@ -837,8 +842,8 @@ func resourceIBMSchematicsWorkspaceMapToTemplateSourceDataRequest(templateSource if templateSourceDataRequestMap["env_values"] != nil { envValues := []map[string]interface{}{} - for _, envValuesItem := range templateSourceDataRequestMap["env_values"].([]map[string]interface{}) { - envValues = append(envValues, envValuesItem) + for _, envValuesItem := range templateSourceDataRequestMap["env_values"].([]interface{}) { + envValues = append(envValues, envValuesItem.(map[string]interface{})) } templateSourceDataRequest.EnvValues = envValues } @@ -862,8 +867,8 @@ func resourceIBMSchematicsWorkspaceMapToTemplateSourceDataRequest(templateSource } if templateSourceDataRequestMap["values_metadata"] != nil { valuesMetadata := []map[string]interface{}{} - for _, valuesMetadataItem := range templateSourceDataRequestMap["values_metadata"].([]map[string]interface{}) { - valuesMetadata = append(valuesMetadata, valuesMetadataItem) + for _, valuesMetadataItem := range templateSourceDataRequestMap["values_metadata"].([]interface{}) { + valuesMetadata = append(valuesMetadata, valuesMetadataItem.(map[string]interface{})) } templateSourceDataRequest.ValuesMetadata = valuesMetadata } diff --git a/website/docs/d/schematics_workspace.html.markdown b/website/docs/d/schematics_workspace.html.markdown index 7b5e7aa29c..dfadec7f5c 100644 --- a/website/docs/d/schematics_workspace.html.markdown +++ b/website/docs/d/schematics_workspace.html.markdown @@ -105,7 +105,7 @@ Nested scheme for **env_values**: Nested scheme for **values_metadata**: * `aliases` - (List) The list of aliases for the variable name. * `cloud_data_type` - (String) Cloud data type of the variable. eg. resource_group_id, region, vpc_id. - * `default_value` - (String) Default value for the variable only if the override value is not specified. + * `default` - (String) Default value for the variable only if the override value is not specified. * `description` - (String) The description of the meta data. * `group_by` - (String) The display name of the group this variable belongs to. * `hidden` - (Boolean) If **true**, the variable is not displayed on UI or Command line. @@ -117,6 +117,7 @@ Nested scheme for **env_values**: * `max_value` - (Integer) The maximum value of the variable. Applicable for the integer type. * `min_length` - (Integer) The minimum length of the variable value. Applicable for the string type. * `min_value` - (Integer) The minimum value of the variable. Applicable for the integer type. + * `name` - (String) Name of the variable. * `options` - (List) The list of possible values for this variable. If type is **integer** or **date**, then the array of string is converted to array of integers or date during the runtime. * `position` - (Integer) The relative position of this variable in a list. * `required` - (Boolean) If the variable required?. diff --git a/website/docs/r/schematics_workspace.html.markdown b/website/docs/r/schematics_workspace.html.markdown index 69d51cd954..4e3a390a4c 100644 --- a/website/docs/r/schematics_workspace.html.markdown +++ b/website/docs/r/schematics_workspace.html.markdown @@ -67,7 +67,7 @@ Nested scheme for **shared_data**: Nested scheme for **template_values_metadata**: * `aliases` - (Optional, List) The list of aliases for the variable name. * `cloud_data_type` - (Optional, String) Cloud data type of the variable. eg. resource_group_id, region, vpc_id. - * `default_value` - (Optional, String) Default value for the variable only if the override value is not specified. + * `default` - (Optional, String) Default value for the variable only if the override value is not specified. * `description` - (Optional, String) The description of the meta data. * `group_by` - (Optional, String) The display name of the group this variable belongs to. * `hidden` - (Optional, Boolean) If **true**, the variable is not displayed on UI or Command line. @@ -79,6 +79,7 @@ Nested scheme for **template_values_metadata**: * `max_value` - (Optional, Integer) The maximum value of the variable. Applicable for the integer type. * `min_length` - (Optional, Integer) The minimum length of the variable value. Applicable for the string type. * `min_value` - (Optional, Integer) The minimum value of the variable. Applicable for the integer type. + * `name` - (String) Name of the variable. * `options` - (Optional, List) The list of possible values for this variable. If type is **integer** or **date**, then the array of string is converted to array of integers or date during the runtime. * `position` - (Optional, Integer) The relative position of this variable in a list. * `required` - (Optional, Boolean) If the variable required?. From 2e8ac03a75327653bd41c04ef2ba921742a238ee Mon Sep 17 00:00:00 2001 From: hkantare Date: Mon, 20 Nov 2023 14:59:20 +0530 Subject: [PATCH 062/132] fix the build --- .../resource_ibm_code_engine_domain_mapping_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ibm/service/codeengine/resource_ibm_code_engine_domain_mapping_test.go b/ibm/service/codeengine/resource_ibm_code_engine_domain_mapping_test.go index 3ee8f9aeb4..d6178fb825 100644 --- a/ibm/service/codeengine/resource_ibm_code_engine_domain_mapping_test.go +++ b/ibm/service/codeengine/resource_ibm_code_engine_domain_mapping_test.go @@ -6,9 +6,10 @@ package codeengine_test import ( "encoding/base64" "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -40,7 +41,7 @@ func TestAccIbmCodeEngineDomainMappingBasic(t *testing.T) { Providers: acc.TestAccProviders, CheckDestroy: testAccCheckIbmCodeEngineDomainMappingDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccCheckIbmCodeEngineDomainMappingConfigBasic(projectID, app1Name, app2Name, domainMappingTLSKey, domainMappingTLSCert, secretName, app1Name, domainMappingName, "app1_instance"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckIbmCodeEngineDomainMappingExists("ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", conf), @@ -58,7 +59,7 @@ func TestAccIbmCodeEngineDomainMappingBasic(t *testing.T) { resource.TestCheckResourceAttr("ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "tls_secret", secretName), ), }, - resource.TestStep{ + { Config: testAccCheckIbmCodeEngineDomainMappingConfigBasic(projectID, app1Name, app2Name, domainMappingTLSKey, domainMappingTLSCert, secretName, app2Name, domainMappingName, "app2_instance"), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet("ibm_code_engine_domain_mapping.code_engine_domain_mapping_instance", "id"), @@ -213,7 +214,7 @@ func testAccCheckIbmCodeEngineDomainMappingDestroy(s *terraform.State) error { func decodeBase64EnvVar(base64Text string, envVar string) string { decodedText, err := base64.StdEncoding.DecodeString(base64Text) if err != nil { - fmt.Errorf("Error decoding environment variable %s: %s", envVar, err) + fmt.Printf("Error decoding environment variable %s: %s", envVar, err) return "" } return string(decodedText) From c48aced738b1b382a0b00127f8db05e7d74ef6ed Mon Sep 17 00:00:00 2001 From: VaishnaviGopal Date: Sat, 18 Nov 2023 01:38:26 +0530 Subject: [PATCH 063/132] schematics agent doc fixes --- website/docs/d/schematics_agent.html.markdown | 31 -------- .../docs/d/schematics_agents.html.markdown | 2 +- website/docs/r/schematics_agent.html.markdown | 72 +------------------ 3 files changed, 3 insertions(+), 102 deletions(-) diff --git a/website/docs/d/schematics_agent.html.markdown b/website/docs/d/schematics_agent.html.markdown index 442d89280f..debcc2afe7 100644 --- a/website/docs/d/schematics_agent.html.markdown +++ b/website/docs/d/schematics_agent.html.markdown @@ -42,37 +42,6 @@ Nested scheme for **agent_infrastructure**: * `cos_instance_name` - (String) The COS instance name to store the agent logs. * `infra_type` - (String) Type of target agent infrastructure. * Constraints: Allowable values are: `ibm_kubernetes`, `ibm_openshift`, `ibm_satellite`. - -* `agent_inputs` - (List) Additional input variables for the agent. -Nested scheme for **agent_inputs**: - * `link` - (String) The reference link to the variable value By default the expression points to `$self.value`. - * `metadata` - (List) An user editable metadata for the variables. - Nested scheme for **metadata**: - * `aliases` - (List) The list of aliases for the variable name. - * `cloud_data_type` - (String) Cloud data type of the variable. eg. resource_group_id, region, vpc_id. - * `default_value` - (String) Default value for the variable only if the override value is not specified. - * `description` - (String) The description of the meta data. - * `group_by` - (String) The display name of the group this variable belongs to. - * `hidden` - (Boolean) If **true**, the variable is not displayed on UI or Command line. - * `immutable` - (Boolean) Is the variable readonly ?. - * `link_status` - (String) The status of the link. - * Constraints: Allowable values are: `normal`, `broken`. - * `matches` - (String) The regex for the variable value. - * `max_length` - (Integer) The maximum length of the variable value. Applicable for the string type. - * `max_value` - (Integer) The maximum value of the variable. Applicable for the integer type. - * `min_length` - (Integer) The minimum length of the variable value. Applicable for the string type. - * `min_value` - (Integer) The minimum value of the variable. Applicable for the integer type. - * `options` - (List) The list of possible values for this variable. If type is **integer** or **date**, then the array of string is converted to array of integers or date during the runtime. - * `position` - (Integer) The relative position of this variable in a list. - * `required` - (Boolean) If the variable required?. - * `secure` - (Boolean) Is the variable secure or sensitive ?. - * `source` - (String) The source of this meta-data. - * `type` - (String) Type of the variable. - * Constraints: Allowable values are: `boolean`, `string`, `integer`, `date`, `array`, `list`, `map`, `complex`, `link`. - * `name` - (String) The name of the variable. For example, `name = "inventory username"`. - * `use_default` - (Boolean) True, will ignore the data in the value attribute, instead the data in metadata.default_value will be used. - * `value` - (String) The value for the variable or reference to the value. For example, `value = ""`. **Note** The SSH key should contain `\n` at the end of the key details in case of command line or API calls. - * `agent_kpi` - (List) Schematics Agent key performance indicators. Nested scheme for **agent_kpi**: * `application_indicators` - (List) Agent application key performance indicators. diff --git a/website/docs/d/schematics_agents.html.markdown b/website/docs/d/schematics_agents.html.markdown index 08f7532d09..14b0034b40 100644 --- a/website/docs/d/schematics_agents.html.markdown +++ b/website/docs/d/schematics_agents.html.markdown @@ -44,7 +44,7 @@ Nested scheme for **agents**: * `id` - (String) The Agent registration id. * `location` - (String) List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, provisioned using Schematics. * Constraints: Allowable values are: `us-south`, `us-east`, `eu-gb`, `eu-de`. - * `name` - (String) The name of the agent (must be unique, for an account). + * `name` - (String) The name of the agent. * `profile_id` - (String) The IAM trusted profile id, used by the Agent instance. * `registered_at` - (String) The Agent registration date-time. * `registered_by` - (String) The email address of an user who registered the Agent. diff --git a/website/docs/r/schematics_agent.html.markdown b/website/docs/r/schematics_agent.html.markdown index af12fb8c26..4b04b38e6a 100644 --- a/website/docs/r/schematics_agent.html.markdown +++ b/website/docs/r/schematics_agent.html.markdown @@ -24,40 +24,6 @@ resource "ibm_schematics_agent" "schematics_agent_instance" { cos_bucket_name = "cos_bucket_name" cos_bucket_region = "cos_bucket_region" } - agent_inputs { - name = "name" - value = "value" - use_default = true - metadata { - type = "boolean" - aliases = [ "aliases" ] - description = "description" - cloud_data_type = "cloud_data_type" - default_value = "default_value" - link_status = "normal" - secure = true - immutable = true - hidden = true - required = true - options = [ "options" ] - min_value = 1 - max_value = 1 - min_length = 1 - max_length = 1 - matches = "matches" - position = 1 - group_by = "group_by" - source = "source" - } - link = "link" - } - agent_kpi { - availability_indicator = "available" - lifecycle_indicator = "consistent" - percent_usage_indicator = "percent_usage_indicator" - application_indicators = [ null ] - infra_indicators = [ null ] - } agent_location = "us-south" agent_metadata { name = "purpose" @@ -67,12 +33,7 @@ resource "ibm_schematics_agent" "schematics_agent_instance" { name = "MyDevAgent" resource_group = "Default" schematics_location = "us-south" - user_state { - state = "enable" - set_by = "set_by" - set_at = "2021-01-31T09:44:12Z" - } - version = "v1.0.0" + version = "1.0.0-beta2" } ``` @@ -89,35 +50,6 @@ Nested scheme for **agent_infrastructure**: * `cos_instance_name` - (Optional, String) The COS instance name to store the agent logs. * `infra_type` - (Optional, String) Type of target agent infrastructure. * Constraints: Allowable values are: `ibm_kubernetes`, `ibm_openshift`, `ibm_satellite`. -* `agent_inputs` - (Optional, List) Additional input variables for the agent. -Nested scheme for **agent_inputs**: - * `link` - (Computed, String) The reference link to the variable value By default the expression points to `$self.value`. - * `metadata` - (Optional, List) An user editable metadata for the variables. - Nested scheme for **metadata**: - * `aliases` - (Optional, List) The list of aliases for the variable name. - * `cloud_data_type` - (Optional, String) Cloud data type of the variable. eg. resource_group_id, region, vpc_id. - * `default_value` - (Optional, String) Default value for the variable only if the override value is not specified. - * `description` - (Optional, String) The description of the meta data. - * `group_by` - (Optional, String) The display name of the group this variable belongs to. - * `hidden` - (Optional, Boolean) If **true**, the variable is not displayed on UI or Command line. - * `immutable` - (Optional, Boolean) Is the variable readonly ?. - * `link_status` - (Optional, String) The status of the link. - * Constraints: Allowable values are: `normal`, `broken`. - * `matches` - (Optional, String) The regex for the variable value. - * `max_length` - (Optional, Integer) The maximum length of the variable value. Applicable for the string type. - * `max_value` - (Optional, Integer) The maximum value of the variable. Applicable for the integer type. - * `min_length` - (Optional, Integer) The minimum length of the variable value. Applicable for the string type. - * `min_value` - (Optional, Integer) The minimum value of the variable. Applicable for the integer type. - * `options` - (Optional, List) The list of possible values for this variable. If type is **integer** or **date**, then the array of string is converted to array of integers or date during the runtime. - * `position` - (Optional, Integer) The relative position of this variable in a list. - * `required` - (Optional, Boolean) If the variable required?. - * `secure` - (Optional, Boolean) Is the variable secure or sensitive ?. - * `source` - (Optional, String) The source of this meta-data. - * `type` - (Optional, String) Type of the variable. - * Constraints: Allowable values are: `boolean`, `string`, `integer`, `date`, `array`, `list`, `map`, `complex`, `link`. - * `name` - (Optional, String) The name of the variable. For example, `name = "inventory username"`. - * `use_default` - (Optional, Boolean) True, will ignore the data in the value attribute, instead the data in metadata.default_value will be used. - * `value` - (Optional, String) The value for the variable or reference to the value. For example, `value = ""`. **Note** The SSH key should contain `\n` at the end of the key details in case of command line or API calls. * `agent_kpi` - (Optional, List) Schematics Agent key performance indicators. Nested scheme for **agent_kpi**: * `application_indicators` - (Optional, List) Agent application key performance indicators. @@ -144,7 +76,7 @@ Nested scheme for **user_state**: * `set_by` - (Computed, String) Name of the User who set the state of the Object. * `state` - (Optional, String) User-defined states * `enable` Agent is enabled by the user. * `disable` Agent is disbaled by the user. * Constraints: Allowable values are: `enable`, `disable`. -* `version` - (Required, String) Agent version. +* `version` - (Required, String) Agent version. Available Versions are 1.0.0-beta1, 1.0.0-beta2 ## Attribute Reference From ac15ba179c0b3a3e71f4ace0be0792302b496c37 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Nov 2023 22:25:07 +0000 Subject: [PATCH 064/132] dependabot: bump github.com/go-jose/go-jose/v3 from 3.0.0 to 3.0.1 Bumps [github.com/go-jose/go-jose/v3](https://github.com/go-jose/go-jose) from 3.0.0 to 3.0.1. - [Release notes](https://github.com/go-jose/go-jose/releases) - [Changelog](https://github.com/go-jose/go-jose/blob/v3/CHANGELOG.md) - [Commits](https://github.com/go-jose/go-jose/compare/v3.0.0...v3.0.1) --- updated-dependencies: - dependency-name: github.com/go-jose/go-jose/v3 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index db250f0b40..ddb9fcf327 100644 --- a/go.mod +++ b/go.mod @@ -96,7 +96,7 @@ require ( github.com/frankban/quicktest v1.14.3 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect - github.com/go-jose/go-jose/v3 v3.0.0 // indirect + github.com/go-jose/go-jose/v3 v3.0.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/analysis v0.21.4 // indirect diff --git a/go.sum b/go.sum index 958008a15c..abd13996b4 100644 --- a/go.sum +++ b/go.sum @@ -102,8 +102,6 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3 github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/IBM-Cloud/bluemix-go v0.0.0-20231017073329-75ebe90c98ba h1:8U4HByOYJiaGWBpGjdRIzyzu0NBzjywh//CZnSbEsPw= github.com/IBM-Cloud/bluemix-go v0.0.0-20231017073329-75ebe90c98ba/go.mod h1:mt+O8ryLVANrBKlA4RxKdENp3q6Q7mKQIi2nkiibZbU= -github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20230822142550-30562e113de9 h1:sXRzCK3Glxpyu66Tu2NjztLdT5sDwj4qly+MJKRhdWY= -github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20230822142550-30562e113de9/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c h1:tRS4VuOG3lHNG+yrsh3vZZQDVNLuFJB0oZbTJp9YXds= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs= @@ -157,10 +155,6 @@ github.com/IBM/keyprotect-go-client v0.12.2 h1:Cjxcqin9Pl0xz3MnxdiVd4v/eIa79xL3h github.com/IBM/keyprotect-go-client v0.12.2/go.mod h1:yr8h2noNgU8vcbs+vhqoXp3Lmv73PI0zAc6VMgFvWwM= github.com/IBM/networking-go-sdk v0.42.2 h1:caqjx4jyFHi10Vlf3skHvlL6K3YJRVstsmCBmvdyqkA= github.com/IBM/networking-go-sdk v0.42.2/go.mod h1:lTUZwtUkMANMnrLHFIgRhHrkBfwASY/Iho1fabaPHxo= -github.com/IBM/platform-services-go-sdk v0.52.0 h1:hbf640xE8T0Rwy2IUf5Pu4OATabGS4IDMnEInXUXs4o= -github.com/IBM/platform-services-go-sdk v0.52.0/go.mod h1:6LxcUhIaSLP4SuQJXF9oLXBamSQogs5D9BcVwr4hmfU= -github.com/IBM/platform-services-go-sdk v0.52.1 h1:fUCtYMAekzsWO/ylZi31j6BpyJ1xKb39NG62zBXePbg= -github.com/IBM/platform-services-go-sdk v0.52.1/go.mod h1:6LxcUhIaSLP4SuQJXF9oLXBamSQogs5D9BcVwr4hmfU= github.com/IBM/platform-services-go-sdk v0.53.1 h1:axpK4dzlf+C+KgHQZWXoKSUMoV2t6OrR5kGGumUEXrI= github.com/IBM/platform-services-go-sdk v0.53.1/go.mod h1:CWSprvsCsXWvujmBzbtoJSmbRZS9FVV3O594b0t/GiM= github.com/IBM/project-go-sdk v0.0.99 h1:rQU/uQLW83OsAUfP/d8fFSIjp8ooEQIFjalYQD4i4aY= @@ -476,8 +470,8 @@ github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo= -github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= +github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA= +github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= From cbdaf4cd3b0eee965d2662eb595d74088c530720 Mon Sep 17 00:00:00 2001 From: Bob Fang <7771298+bobfang@users.noreply.github.com> Date: Tue, 21 Nov 2023 23:37:06 -0800 Subject: [PATCH 065/132] Fix some job parameters for code engine (#4923) * Update code_engine_job.html.markdown fix run_mode's reference to scale_retry_limits and scale_max_execution_time * Update README.md fix references that were missing scale_ * Update code_engine_job.html.markdown * Update data_source_ibm_code_engine_job.go update with scale_ prefix * Update resource_ibm_code_engine_job.go --- examples/ibm-code-engine/README.md | 2 +- ibm/service/codeengine/data_source_ibm_code_engine_job.go | 2 +- ibm/service/codeengine/resource_ibm_code_engine_job.go | 2 +- website/docs/d/code_engine_job.html.markdown | 2 +- website/docs/r/code_engine_job.html.markdown | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/ibm-code-engine/README.md b/examples/ibm-code-engine/README.md index 952868955c..33ac34cd9b 100644 --- a/examples/ibm-code-engine/README.md +++ b/examples/ibm-code-engine/README.md @@ -250,7 +250,7 @@ data "ibm_code_engine_domain_mapping" "code_engine_domain_mapping_instance" { | data | The key-value pair for the config map. Values must be specified in `KEY=VALUE` format. Each `KEY` field must consist of alphanumeric characters, `-`, `_` or `.` and must not be exceed a max length of 253 characters. Each `VALUE` field can consists of any character and must not be exceed a max length of 1048576 characters. | `map(string)` | false | | image_reference | The name of the image that is used for this job. The format is `REGISTRY/NAMESPACE/REPOSITORY:TAG` where `REGISTRY` and `TAG` are optional. If `REGISTRY` is not specified, the default is `docker.io`. If `TAG` is not specified, the default is `latest`. If the image reference points to a registry that requires authentication, make sure to also specify the property `image_secret`. | `string` | true | | image_secret | The name of the image registry access secret. The image registry access secret is used to authenticate with a private registry when you download the container image. If the image reference points to a registry that requires authentication, the job / job runs will be created but submitted job runs will fail, until this property is provided, too. This property must not be set on a job run, which references a job template. | `string` | false | -| run_mode | The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `max_execution_time` and `retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `max_execution_time` and `retry_limit` properties are not allowed. | `string` | false | +| run_mode | The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `scale_max_execution_time` and `scale_retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `scale_max_execution_time` and `scale_retry_limit` properties are not allowed. | `string` | false | | scale_array_spec | Define a custom set of array indices as comma-separated list containing single values and hyphen-separated ranges like `5,12-14,23,27`. Each instance can pick up its array index via environment variable `JOB_INDEX`. The number of unique array indices specified here determines the number of job instances to run. | `string` | false | | scale_max_execution_time | The maximum execution time in seconds for runs of the job. This property can only be specified if `run_mode` is `task`. | `number` | false | | scale_memory_limit | Optional amount of memory set for the instance of the job. For valid values see [Supported memory and CPU combinations](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo). The units for specifying memory are Megabyte (M) or Gigabyte (G), whereas G and M are the shorthand expressions for GB and MB. For more information see [Units of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). | `string` | false | diff --git a/ibm/service/codeengine/data_source_ibm_code_engine_job.go b/ibm/service/codeengine/data_source_ibm_code_engine_job.go index f42ee19247..6182556bb5 100644 --- a/ibm/service/codeengine/data_source_ibm_code_engine_job.go +++ b/ibm/service/codeengine/data_source_ibm_code_engine_job.go @@ -129,7 +129,7 @@ func DataSourceIbmCodeEngineJob() *schema.Resource { "run_mode": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `max_execution_time` and `retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `max_execution_time` and `retry_limit` properties are not allowed.", + Description: "The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `scale_max_execution_time` and `scale_retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `scale_max_execution_time` and `scale_retry_limit` properties are not allowed.", }, "run_service_account": &schema.Schema{ Type: schema.TypeString, diff --git a/ibm/service/codeengine/resource_ibm_code_engine_job.go b/ibm/service/codeengine/resource_ibm_code_engine_job.go index 41dd8707dc..fe51077431 100644 --- a/ibm/service/codeengine/resource_ibm_code_engine_job.go +++ b/ibm/service/codeengine/resource_ibm_code_engine_job.go @@ -119,7 +119,7 @@ func ResourceIbmCodeEngineJob() *schema.Resource { Optional: true, Default: "task", ValidateFunc: validate.InvokeValidator("ibm_code_engine_job", "run_mode"), - Description: "The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `max_execution_time` and `retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `max_execution_time` and `retry_limit` properties are not allowed.", + Description: "The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `scale_max_execution_time` and `scale_retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `scale_max_execution_time` and `scale_retry_limit` properties are not allowed.", }, "run_service_account": &schema.Schema{ Type: schema.TypeString, diff --git a/website/docs/d/code_engine_job.html.markdown b/website/docs/d/code_engine_job.html.markdown index c39aba650d..189092fe7c 100644 --- a/website/docs/d/code_engine_job.html.markdown +++ b/website/docs/d/code_engine_job.html.markdown @@ -77,7 +77,7 @@ Nested scheme for **run_env_variables**: * `value` - (String) The literal value of the environment variable. * Constraints: The maximum length is `253` characters. The minimum length is `1` character. The value must match regular expression `/^[\\-._a-zA-Z0-9]+$/`. -* `run_mode` - (String) The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `max_execution_time` and `retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `max_execution_time` and `retry_limit` properties are not allowed. +* `run_mode` - (String) The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `scale_max_execution_time` and `scale_retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `scale_max_execution_time` and `scale_retry_limit` properties are not allowed. * Constraints: The default value is `task`. Allowable values are: `task`, `daemon`. The minimum length is `0` characters. The value must match regular expression `/^(task|daemon)$/`. * `run_service_account` - (String) The name of the service account. For built-in service accounts, you can use the shortened names `manager`, `none`, `reader`, and `writer`. This property must not be set on a job run, which references a job template. diff --git a/website/docs/r/code_engine_job.html.markdown b/website/docs/r/code_engine_job.html.markdown index 50c1847ae5..092a91a37b 100644 --- a/website/docs/r/code_engine_job.html.markdown +++ b/website/docs/r/code_engine_job.html.markdown @@ -58,7 +58,7 @@ Nested scheme for **run_env_variables**: * Constraints: The default value is `literal`. Allowable values are: `literal`, `config_map_full_reference`, `secret_full_reference`, `config_map_key_reference`, `secret_key_reference`. The value must match regular expression `/^(literal|config_map_full_reference|secret_full_reference|config_map_key_reference|secret_key_reference)$/`. * `value` - (Optional, String) The literal value of the environment variable. * Constraints: The maximum length is `253` characters. The minimum length is `1` character. The value must match regular expression `/^[\\-._a-zA-Z0-9]+$/`. -* `run_mode` - (Optional, String) The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `max_execution_time` and `retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `max_execution_time` and `retry_limit` properties are not allowed. +* `run_mode` - (Optional, String) The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `scale_max_execution_time` and `scale_retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `scale_max_execution_time` and `scale_retry_limit` properties are not allowed. * Constraints: The default value is `task`. Allowable values are: `task`, `daemon`. The minimum length is `0` characters. The value must match regular expression `/^(task|daemon)$/`. * `run_service_account` - (Optional, String) The name of the service account. For built-in service accounts, you can use the shortened names `manager`, `none`, `reader`, and `writer`. This property must not be set on a job run, which references a job template. * Constraints: The default value is `default`. Allowable values are: `default`, `manager`, `reader`, `writer`, `none`. The minimum length is `0` characters. The value must match regular expression `/^(manager|reader|writer|none|default)$/`. From ea5cc697a5ebb55c4755680bedab628f76acb83a Mon Sep 17 00:00:00 2001 From: Riccardo Angelilli Date: Thu, 23 Nov 2023 10:08:55 +0100 Subject: [PATCH 066/132] Support environment resource and data source for Projects - update to latest API level (#4928) * fix integration test * fix integration test * fix integration test * fix name * pr comments * pr comments * fix doc * fix doc * new version * new version * new version * new version * update code to the latest SDK level * fix integration tests * fix integration tests * fix integration tests * fix integration tests * address PR comment * typo * typo * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * add wait for create and delete * add wait for create and delete * . * fix integration tests * fix integration tests * fix integration tests * fix integration tests * fix integration tests * regenerate * new code generation * new generated code * point to latest sdk * point to latest sdk * adjust test cases and doc * adjust samples * update to latest node sdk * merge with master * Update project_instance.html.markdown Fixing formatting issues * Update project_event_notification.html.markdown * Update README.md * Update variables.tf * Update project_event_notification.html.markdown * new version * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * feat: projects graph fragment pattern * align with origin/master * update test cases * restore README.md and versions.tf to master branch * remove duplicated entries * feat: graph fragment pattern poc * feat: restore definition blocks * regenerate the terraform code based on latest YAML * regenerate the terraform code based on latest YAML * regenerate the terraform code based on latest YAML * update doc * update doc * fix test cases * commit generated code * commit fix * commit fix * test cases * test cases * test cases * test cases * updates * upgrade to latest go sdk * update generated doc * update generated code * updated secrets baseline * update code to latest API changes * secrets * fix secrets * update samples with real values * update secrets * update secrets * update generated code to the latest API definition * update secrets baseline * merge with master * merge with master * merge with master * update code to the latest SDK level * address some review comments * address PR comments * address PR comments * update to latest sdk level * update to latest sdk level * update to latest sdk level * merge with master * update to the latest sdk level * format test case * regenerate the code with generator fixes * update to latest SDK * update to latest SDK * update to latest SDK * environment for terraform * environment for terraform * secrets * address PR comments * address PR comments Signed-off-by: rangelil --------- Signed-off-by: rangelil Co-authored-by: dvesperini Co-authored-by: knee-na <130502432+knee-na@users.noreply.github.com> Co-authored-by: Mark-Kulube --- .secrets.baseline | 118 ++-- examples/ibm-project/README.md | 27 +- examples/ibm-project/main.tf | 19 + examples/ibm-project/outputs.tf | 8 + examples/ibm-project/variables.tf | 21 +- go.mod | 2 +- go.sum | 4 +- ibm/provider/provider.go | 15 +- .../project/data_source_ibm_project.go | 39 +- .../project/data_source_ibm_project_config.go | 233 +++++++- .../data_source_ibm_project_environment.go | 321 ++++++++++ ...ata_source_ibm_project_environment_test.go | 70 +++ .../project/data_source_ibm_project_test.go | 3 +- ibm/service/project/resource_ibm_project.go | 108 ++-- .../project/resource_ibm_project_config.go | 263 +++++++-- .../resource_ibm_project_environment.go | 551 ++++++++++++++++++ .../resource_ibm_project_environment_test.go | 138 +++++ website/docs/d/project.html.markdown | 35 +- website/docs/d/project_config.html.markdown | 78 ++- .../docs/d/project_environment.html.markdown | 84 +++ website/docs/r/project.html.markdown | 42 +- website/docs/r/project_config.html.markdown | 95 ++- .../docs/r/project_environment.html.markdown | 103 ++++ 23 files changed, 2120 insertions(+), 257 deletions(-) create mode 100644 ibm/service/project/data_source_ibm_project_environment.go create mode 100644 ibm/service/project/data_source_ibm_project_environment_test.go create mode 100644 ibm/service/project/resource_ibm_project_environment.go create mode 100644 ibm/service/project/resource_ibm_project_environment_test.go create mode 100644 website/docs/d/project_environment.html.markdown create mode 100644 website/docs/r/project_environment.html.markdown diff --git a/.secrets.baseline b/.secrets.baseline index c90644602f..934bc75b57 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.mod|go.sum|.*.map|^.secrets.baseline$", "lines": null }, - "generated_at": "2023-11-10T20:51:53Z", + "generated_at": "2023-11-22T09:50:41Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -560,7 +560,7 @@ "hashed_secret": "06d988e96c3d9325c9fbc7c0ef3c6c0f2b4eb8e7", "is_secret": false, "is_verified": false, - "line_number": 13, + "line_number": 45, "type": "Secret Keyword", "verified_result": null } @@ -760,7 +760,7 @@ "hashed_secret": "731438016c5ab94431f61820f35e3ae5f8ad6004", "is_secret": false, "is_verified": false, - "line_number": 412, + "line_number": 416, "type": "Secret Keyword", "verified_result": null }, @@ -768,7 +768,7 @@ "hashed_secret": "12da2e35d6b50c902c014f1ab9e3032650368df7", "is_secret": false, "is_verified": false, - "line_number": 418, + "line_number": 422, "type": "Secret Keyword", "verified_result": null }, @@ -776,7 +776,7 @@ "hashed_secret": "813274ccae5b6b509379ab56982d862f7b5969b6", "is_secret": false, "is_verified": false, - "line_number": 1123, + "line_number": 1127, "type": "Base64 High Entropy String", "verified_result": null } @@ -846,7 +846,7 @@ "hashed_secret": "da8cae6284528565678de15e03d461e23fe22538", "is_secret": false, "is_verified": false, - "line_number": 1845, + "line_number": 1858, "type": "Secret Keyword", "verified_result": null }, @@ -854,7 +854,7 @@ "hashed_secret": "1a0334cfa65f4be58b9d914b8e96e9d9478bfbac", "is_secret": false, "is_verified": false, - "line_number": 3226, + "line_number": 3239, "type": "Secret Keyword", "verified_result": null } @@ -864,7 +864,7 @@ "hashed_secret": "c8b6f5ef11b9223ac35a5663975a466ebe7ebba9", "is_secret": false, "is_verified": false, - "line_number": 1803, + "line_number": 1806, "type": "Secret Keyword", "verified_result": null }, @@ -872,7 +872,7 @@ "hashed_secret": "8abf4899c01104241510ba87685ad4de76b0c437", "is_secret": false, "is_verified": false, - "line_number": 1809, + "line_number": 1812, "type": "Secret Keyword", "verified_result": null } @@ -1268,15 +1268,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 129, - "type": "Secret Keyword", - "verified_result": null - }, - { - "hashed_secret": "505032eaf8a3acf9b094a326dfb1cd0537c75a0d", - "is_secret": false, - "is_verified": false, - "line_number": 235, + "line_number": 104, "type": "Secret Keyword", "verified_result": null } @@ -1364,15 +1356,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 94, - "type": "Secret Keyword", - "verified_result": null - }, - { - "hashed_secret": "505032eaf8a3acf9b094a326dfb1cd0537c75a0d", - "is_secret": false, - "is_verified": false, - "line_number": 364, + "line_number": 68, "type": "Secret Keyword", "verified_result": null } @@ -2014,7 +1998,7 @@ "hashed_secret": "884a58e4c2c5d195d3876787bdc63af6c5af2924", "is_secret": false, "is_verified": false, - "line_number": 1589, + "line_number": 1595, "type": "Secret Keyword", "verified_result": null } @@ -2834,7 +2818,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 190, + "line_number": 334, "type": "Secret Keyword", "verified_result": null }, @@ -2842,7 +2826,7 @@ "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", "is_secret": false, "is_verified": false, - "line_number": 461, + "line_number": 654, "type": "Secret Keyword", "verified_result": null } @@ -2857,12 +2841,40 @@ "verified_result": null } ], + "ibm/service/project/data_source_ibm_project_environment.go": [ + { + "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", + "is_secret": false, + "is_verified": false, + "line_number": 119, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", + "is_secret": false, + "is_verified": false, + "line_number": 293, + "type": "Secret Keyword", + "verified_result": null + } + ], + "ibm/service/project/data_source_ibm_project_environment_test.go": [ + { + "hashed_secret": "347cd9c53ff77d41a7b22aa56c7b4efaf54658e3", + "is_secret": false, + "is_verified": false, + "line_number": 55, + "type": "Secret Keyword", + "verified_result": null + } + ], "ibm/service/project/resource_ibm_project_config.go": [ { "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 92, + "line_number": 236, "type": "Secret Keyword", "verified_result": null }, @@ -2870,7 +2882,7 @@ "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", "is_secret": false, "is_verified": false, - "line_number": 693, + "line_number": 884, "type": "Secret Keyword", "verified_result": null } @@ -2885,6 +2897,34 @@ "verified_result": null } ], + "ibm/service/project/resource_ibm_project_environment.go": [ + { + "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", + "is_secret": false, + "is_verified": false, + "line_number": 72, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", + "is_secret": false, + "is_verified": false, + "line_number": 504, + "type": "Secret Keyword", + "verified_result": null + } + ], + "ibm/service/project/resource_ibm_project_environment_test.go": [ + { + "hashed_secret": "347cd9c53ff77d41a7b22aa56c7b4efaf54658e3", + "is_secret": false, + "is_verified": false, + "line_number": 62, + "type": "Secret Keyword", + "verified_result": null + } + ], "ibm/service/pushnotification/resource_ibm_push_notification_chrome.go": [ { "hashed_secret": "8a4036fbf3e13c7a84bac77ddae25de1cdfc4d43", @@ -2940,7 +2980,7 @@ "hashed_secret": "3c2ecad9b250fd6d99893e4d05ec02ca19aa95d0", "is_secret": false, "is_verified": false, - "line_number": 383, + "line_number": 389, "type": "Secret Keyword", "verified_result": null } @@ -4466,7 +4506,17 @@ "hashed_secret": "06d988e96c3d9325c9fbc7c0ef3c6c0f2b4eb8e7", "is_secret": false, "is_verified": false, - "line_number": 23, + "line_number": 22, + "type": "Secret Keyword", + "verified_result": null + } + ], + "website/docs/r/project_environment.html.markdown": [ + { + "hashed_secret": "06d988e96c3d9325c9fbc7c0ef3c6c0f2b4eb8e7", + "is_secret": false, + "is_verified": false, + "line_number": 22, "type": "Secret Keyword", "verified_result": null } diff --git a/examples/ibm-project/README.md b/examples/ibm-project/README.md index 2c985f19d0..8d4faefa78 100644 --- a/examples/ibm-project/README.md +++ b/examples/ibm-project/README.md @@ -6,6 +6,7 @@ The following types of resources are supported: * project_config * project +* project_environment ## Usage @@ -39,6 +40,14 @@ resource "project" "project_instance" { definition = var.project_definition } ``` +project_environment resource: + +```hcl +resource "project_environment" "project_environment_instance" { + project_id = ibm_project.project_instance.project_id + definition = var.project_environment_definition +} +``` ## ProjectV1 data sources @@ -57,6 +66,14 @@ data "project" "project_instance" { project_id = ibm_project.project_instance.id } ``` +project_environment data source: + +```hcl +data "ibm_project_environment" "project_environment_instance" { + project_id = ibm_project_environment.project_environment_instance.project_id + project_environment_id = ibm_project_environment.project_environment_instance.project_environment_id +} +``` ## Assumptions @@ -84,14 +101,15 @@ data "project" "project_instance" { |------|-------------|------|---------| | ibmcloud\_api\_key | IBM Cloud API key | `string` | true | | project_id | The unique project ID. | `string` | true | -| schematics | A schematics workspace associated to a project configuration. | `` | false | -| definition | The type and output of a project configuration. | `` | true | +| schematics | A schematics workspace associated to a project configuration, with scripts. | `` | false | +| definition | The name and description of a project configuration. | `` | true | | location | The IBM Cloud location where a resource is deployed. | `string` | true | -| resource_group | The resource group where the project's data and tools are created. | `string` | true | +| resource_group | The resource group name where the project's data and tools are created. | `string` | true | | definition | The definition of the project. | `` | true | +| definition | The environment definition. | `` | true | | project_id | The unique project ID. | `string` | true | | project_config_id | The unique config ID. | `string` | true | -| project_id | The unique project ID. | `string` | true | +| project_environment_id | The environment ID. | `string` | true | ## Outputs @@ -99,3 +117,4 @@ data "project" "project_instance" { |------|-------------| | project_config | project_config object | | project | project object | +| project_environment | project_environment object | diff --git a/examples/ibm-project/main.tf b/examples/ibm-project/main.tf index 79837ee3fb..038e99910a 100644 --- a/examples/ibm-project/main.tf +++ b/examples/ibm-project/main.tf @@ -34,6 +34,19 @@ resource "ibm_project" "project_instance" { } } +// Provision project_environment resource instance +resource "ibm_project_environment" "project_environment_instance" { + project_id = ibm_project.project_instance.project_id + definition { + name = "environment-stage" + description = "environment for stage project" + authorizations { + method = "api_key" + api_key = "" + } + } +} + // Create project_config data source data "ibm_project_config" "project_config_instance" { project_id = ibm_project_config.project_config_instance.project_id @@ -44,3 +57,9 @@ data "ibm_project_config" "project_config_instance" { data "ibm_project" "project_instance" { project_id = ibm_project.project_instance.id } + +// Create project_environment data source +data "ibm_project_environment" "project_environment_instance" { + project_id = ibm_project.project_instance.id + project_environment_id = var.project_environment_project_environment_id +} diff --git a/examples/ibm-project/outputs.tf b/examples/ibm-project/outputs.tf index 277309cbec..76db5b5331 100644 --- a/examples/ibm-project/outputs.tf +++ b/examples/ibm-project/outputs.tf @@ -3,6 +3,7 @@ output "ibm_project_config" { value = ibm_project_config.project_config_instance description = "project_config resource instance" + sensitive = true } // This output allows project data to be referenced by other resources and the terraform CLI // Modify this output if only certain data should be exposed @@ -10,3 +11,10 @@ output "ibm_project" { value = ibm_project.project_instance description = "project resource instance" } +// This output allows project_environment data to be referenced by other resources and the terraform CLI +// Modify this output if only certain data should be exposed +output "ibm_project_environment" { + value = ibm_project_environment.project_environment_instance + description = "project_environment resource instance" + sensitive = true +} diff --git a/examples/ibm-project/variables.tf b/examples/ibm-project/variables.tf index b32094d31b..82c28185f4 100644 --- a/examples/ibm-project/variables.tf +++ b/examples/ibm-project/variables.tf @@ -17,11 +17,18 @@ variable "project_location" { default = "us-south" } variable "project_resource_group" { - description = "The resource group where the project's data and tools are created." + description = "The resource group name where the project's data and tools are created." type = string default = "Default" } +// Resource arguments for project_environment +variable "project_environment_project_id" { + description = "The unique project ID." + type = string + default = "project_id" +} + // Data source arguments for project_config variable "project_config_project_id" { description = "The unique project ID." @@ -40,3 +47,15 @@ variable "project_id" { type = string default = "project_id" } + +// Data source arguments for project_environment +variable "project_environment_project_id" { + description = "The unique project ID." + type = string + default = "project_id" +} +variable "project_environment_id" { + description = "The environment ID." + type = string + default = "project_environment_id" +} diff --git a/go.mod b/go.mod index ddb9fcf327..e8fc7bf97e 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/IBM/keyprotect-go-client v0.12.2 github.com/IBM/networking-go-sdk v0.42.2 github.com/IBM/platform-services-go-sdk v0.53.1 - github.com/IBM/project-go-sdk v0.0.99 + github.com/IBM/project-go-sdk v0.1.1 github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 github.com/IBM/scc-go-sdk/v5 v5.1.3 github.com/IBM/schematics-go-sdk v0.2.2 diff --git a/go.sum b/go.sum index abd13996b4..58cfeff13e 100644 --- a/go.sum +++ b/go.sum @@ -157,8 +157,8 @@ github.com/IBM/networking-go-sdk v0.42.2 h1:caqjx4jyFHi10Vlf3skHvlL6K3YJRVstsmCB github.com/IBM/networking-go-sdk v0.42.2/go.mod h1:lTUZwtUkMANMnrLHFIgRhHrkBfwASY/Iho1fabaPHxo= github.com/IBM/platform-services-go-sdk v0.53.1 h1:axpK4dzlf+C+KgHQZWXoKSUMoV2t6OrR5kGGumUEXrI= github.com/IBM/platform-services-go-sdk v0.53.1/go.mod h1:CWSprvsCsXWvujmBzbtoJSmbRZS9FVV3O594b0t/GiM= -github.com/IBM/project-go-sdk v0.0.99 h1:rQU/uQLW83OsAUfP/d8fFSIjp8ooEQIFjalYQD4i4aY= -github.com/IBM/project-go-sdk v0.0.99/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig= +github.com/IBM/project-go-sdk v0.1.1 h1:x1PkGUTkKpgxoXs/6IG4U1mk5BgaPEaRMVpXTs52rE4= +github.com/IBM/project-go-sdk v0.1.1/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig= github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 h1:NPUhkoOCRuv3OFWt19PmwjXGGTKlvmbuPg9fUrBUNe4= github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5/go.mod h1:b07XHUVh0XYnQE9s2mqgjYST1h9buaQNqN4EcKhOsX0= github.com/IBM/sarama v1.41.2 h1:ZDBZfGPHAD4uuAtSv4U22fRZBgst0eEwGFzLj0fb85c= diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index 422dddc3e1..6ac2cd2804 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -858,8 +858,9 @@ func Provider() *schema.Provider { "ibm_code_engine_secret": codeengine.DataSourceIbmCodeEngineSecret(), // Added for Project - "ibm_project": project.DataSourceIbmProject(), - "ibm_project_config": project.DataSourceIbmProjectConfig(), + "ibm_project": project.DataSourceIbmProject(), + "ibm_project_config": project.DataSourceIbmProjectConfig(), + "ibm_project_environment": project.DataSourceIbmProjectEnvironment(), }, ResourcesMap: map[string]*schema.Resource{ @@ -1372,8 +1373,9 @@ func Provider() *schema.Provider { "ibm_code_engine_secret": codeengine.ResourceIbmCodeEngineSecret(), // Added for Project - "ibm_project": project.ResourceIbmProject(), - "ibm_project_config": project.ResourceIbmProjectConfig(), + "ibm_project": project.ResourceIbmProject(), + "ibm_project_config": project.ResourceIbmProjectConfig(), + "ibm_project_environment": project.ResourceIbmProjectEnvironment(), }, ConfigureFunc: providerConfigure, @@ -1630,8 +1632,9 @@ func Validator() validate.ValidatorDict { "ibm_code_engine_secret": codeengine.ResourceIbmCodeEngineSecretValidator(), // Added for Project - "ibm_project": project.ResourceIbmProjectValidator(), - "ibm_project_config": project.ResourceIbmProjectConfigValidator(), + "ibm_project": project.ResourceIbmProjectValidator(), + "ibm_project_config": project.ResourceIbmProjectConfigValidator(), + "ibm_project_environment": project.ResourceIbmProjectEnvironmentValidator(), }, DataSourceValidatorDictionary: map[string]*validate.ResourceValidator{ "ibm_is_subnet": vpc.DataSourceIBMISSubnetValidator(), diff --git a/ibm/service/project/data_source_ibm_project.go b/ibm/service/project/data_source_ibm_project.go index 277d769e3a..1ba775f958 100644 --- a/ibm/service/project/data_source_ibm_project.go +++ b/ibm/service/project/data_source_ibm_project.go @@ -75,16 +75,21 @@ func DataSourceIbmProject() *schema.Resource { Computed: true, Description: "The IBM Cloud location where a resource is deployed.", }, - "resource_group": &schema.Schema{ + "resource_group_id": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "The resource group where the project's data and tools are created.", + Description: "The resource group id where the project's data and tools are created.", }, "state": &schema.Schema{ Type: schema.TypeString, Computed: true, Description: "The project status value.", }, + "resource_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource group name where the project's data and tools are created.", + }, "event_notifications_crn": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -135,7 +140,7 @@ func DataSourceIbmProject() *schema.Resource { "name": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "The configuration name.", + Description: "The configuration name. It is unique within the account across projects and regions.", }, "description": &schema.Schema{ Type: schema.TypeString, @@ -254,7 +259,7 @@ func DataSourceIbmProject() *schema.Resource { "name": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "The name of the environment.", + Description: "The name of the environment. It is unique within the account across projects and regions.", }, "description": &schema.Schema{ Type: schema.TypeString, @@ -276,7 +281,7 @@ func DataSourceIbmProject() *schema.Resource { "name": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "The name of the project.", + Description: "The name of the project. It is unique within the account across regions.", }, "description": &schema.Schema{ Type: schema.TypeString, @@ -343,14 +348,18 @@ func dataSourceIbmProjectRead(context context.Context, d *schema.ResourceData, m return diag.FromErr(fmt.Errorf("Error setting location: %s", err)) } - if err = d.Set("resource_group", project.ResourceGroup); err != nil { - return diag.FromErr(fmt.Errorf("Error setting resource_group: %s", err)) + if err = d.Set("resource_group_id", project.ResourceGroupID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_group_id: %s", err)) } if err = d.Set("state", project.State); err != nil { return diag.FromErr(fmt.Errorf("Error setting state: %s", err)) } + if err = d.Set("resource_group", project.ResourceGroup); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_group: %s", err)) + } + if err = d.Set("event_notifications_crn", project.EventNotificationsCrn); err != nil { return diag.FromErr(fmt.Errorf("Error setting event_notifications_crn: %s", err)) } @@ -358,7 +367,7 @@ func dataSourceIbmProjectRead(context context.Context, d *schema.ResourceData, m configs := []map[string]interface{}{} if project.Configs != nil { for _, modelItem := range project.Configs { - modelMap, err := dataSourceIbmProjectProjectConfigCollectionMemberToMap(&modelItem) + modelMap, err := dataSourceIbmProjectProjectConfigSummaryToMap(&modelItem) if err != nil { return diag.FromErr(err) } @@ -372,7 +381,7 @@ func dataSourceIbmProjectRead(context context.Context, d *schema.ResourceData, m environments := []map[string]interface{}{} if project.Environments != nil { for _, modelItem := range project.Environments { - modelMap, err := dataSourceIbmProjectProjectEnvironmentCollectionMemberToMap(&modelItem) + modelMap, err := dataSourceIbmProjectProjectEnvironmentSummaryToMap(&modelItem) if err != nil { return diag.FromErr(err) } @@ -415,7 +424,7 @@ func dataSourceIbmProjectCumulativeNeedsAttentionToMap(model *projectv1.Cumulati return modelMap, nil } -func dataSourceIbmProjectProjectConfigCollectionMemberToMap(model *projectv1.ProjectConfigCollectionMember) (map[string]interface{}, error) { +func dataSourceIbmProjectProjectConfigSummaryToMap(model *projectv1.ProjectConfigSummary) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.ApprovedVersion != nil { approvedVersionMap, err := dataSourceIbmProjectProjectConfigVersionSummaryToMap(model.ApprovedVersion) @@ -434,12 +443,8 @@ func dataSourceIbmProjectProjectConfigCollectionMemberToMap(model *projectv1.Pro modelMap["id"] = model.ID modelMap["version"] = flex.IntValue(model.Version) modelMap["state"] = model.State - if model.CreatedAt != nil { - modelMap["created_at"] = model.CreatedAt.String() - } - if model.ModifiedAt != nil { - modelMap["modified_at"] = model.ModifiedAt.String() - } + modelMap["created_at"] = model.CreatedAt.String() + modelMap["modified_at"] = model.ModifiedAt.String() modelMap["href"] = model.Href definitionMap, err := dataSourceIbmProjectProjectConfigDefinitionNameDescriptionToMap(model.Definition) if err != nil { @@ -492,7 +497,7 @@ func dataSourceIbmProjectProjectDefinitionReferenceToMap(model *projectv1.Projec return modelMap, nil } -func dataSourceIbmProjectProjectEnvironmentCollectionMemberToMap(model *projectv1.ProjectEnvironmentCollectionMember) (map[string]interface{}, error) { +func dataSourceIbmProjectProjectEnvironmentSummaryToMap(model *projectv1.ProjectEnvironmentSummary) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["id"] = model.ID projectMap, err := dataSourceIbmProjectProjectReferenceToMap(model.Project) diff --git a/ibm/service/project/data_source_ibm_project_config.go b/ibm/service/project/data_source_ibm_project_config.go index e064294568..38ddf87947 100644 --- a/ibm/service/project/data_source_ibm_project_config.go +++ b/ibm/service/project/data_source_ibm_project_config.go @@ -129,7 +129,7 @@ func DataSourceIbmProjectConfig() *schema.Resource { "schematics": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "A schematics workspace associated to a project configuration.", + Description: "A schematics workspace associated to a project configuration, with scripts.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "workspace_crn": &schema.Schema{ @@ -137,6 +137,150 @@ func DataSourceIbmProjectConfig() *schema.Resource { Computed: true, Description: "An existing schematics workspace CRN.", }, + "validate_pre_script": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the script.", + }, + "path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The path to this script within the current version source.", + }, + "short_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The short description for this script.", + }, + }, + }, + }, + "validate_post_script": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the script.", + }, + "path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The path to this script within the current version source.", + }, + "short_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The short description for this script.", + }, + }, + }, + }, + "deploy_pre_script": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the script.", + }, + "path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The path to this script within the current version source.", + }, + "short_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The short description for this script.", + }, + }, + }, + }, + "deploy_post_script": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the script.", + }, + "path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The path to this script within the current version source.", + }, + "short_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The short description for this script.", + }, + }, + }, + }, + "undeploy_pre_script": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the script.", + }, + "path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The path to this script within the current version source.", + }, + "short_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The short description for this script.", + }, + }, + }, + }, + "undeploy_post_script": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the script.", + }, + "path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The path to this script within the current version source.", + }, + "short_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The short description for this script.", + }, + }, + }, + }, }, }, }, @@ -153,20 +297,20 @@ func DataSourceIbmProjectConfig() *schema.Resource { "definition": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "The type and output of a project configuration.", + Description: "The name and description of a project configuration.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "The configuration name.", + Description: "The configuration name. It is unique within the account across projects and regions.", }, "description": &schema.Schema{ Type: schema.TypeString, Computed: true, Description: "A project configuration description.", }, - "environment": &schema.Schema{ + "environment_id": &schema.Schema{ Type: schema.TypeString, Computed: true, Description: "The ID of the project environment.", @@ -190,6 +334,7 @@ func DataSourceIbmProjectConfig() *schema.Resource { "api_key": &schema.Schema{ Type: schema.TypeString, Computed: true, + Sensitive: true, Description: "The IBM Cloud API Key.", }, }, @@ -204,12 +349,12 @@ func DataSourceIbmProjectConfig() *schema.Resource { "id": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "The unique ID.", + Description: "The unique ID for that compliance profile.", }, "instance_id": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "The unique ID.", + Description: "A unique ID for an instance of a compliance profile.", }, "instance_location": &schema.Schema{ Type: schema.TypeString, @@ -219,7 +364,7 @@ func DataSourceIbmProjectConfig() *schema.Resource { "attachment_id": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "The unique ID.", + Description: "A unique ID for the attachment to a compliance profile.", }, "profile_name": &schema.Schema{ Type: schema.TypeString, @@ -232,7 +377,7 @@ func DataSourceIbmProjectConfig() *schema.Resource { "locator_id": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "A dotted value of catalogID.versionID.", + Description: "A unique concatenation of catalogID.versionID that identifies the DA in the catalog.", }, "inputs": &schema.Schema{ Type: schema.TypeList, @@ -250,11 +395,6 @@ func DataSourceIbmProjectConfig() *schema.Resource { Schema: map[string]*schema.Schema{}, }, }, - "type": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The type of a project configuration manual property.", - }, }, }, }, @@ -333,7 +473,7 @@ func dataSourceIbmProjectConfigRead(context context.Context, d *schema.ResourceD schematics := []map[string]interface{}{} if projectConfig.Schematics != nil { - modelMap, err := dataSourceIbmProjectConfigSchematicsWorkspaceToMap(projectConfig.Schematics) + modelMap, err := dataSourceIbmProjectConfigSchematicsMetadataToMap(projectConfig.Schematics) if err != nil { return diag.FromErr(err) } @@ -397,11 +537,67 @@ func dataSourceIbmProjectConfigProjectDefinitionReferenceToMap(model *projectv1. return modelMap, nil } -func dataSourceIbmProjectConfigSchematicsWorkspaceToMap(model *projectv1.SchematicsWorkspace) (map[string]interface{}, error) { +func dataSourceIbmProjectConfigSchematicsMetadataToMap(model *projectv1.SchematicsMetadata) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.WorkspaceCrn != nil { modelMap["workspace_crn"] = model.WorkspaceCrn } + if model.ValidatePreScript != nil { + validatePreScriptMap, err := dataSourceIbmProjectConfigScriptToMap(model.ValidatePreScript) + if err != nil { + return modelMap, err + } + modelMap["validate_pre_script"] = []map[string]interface{}{validatePreScriptMap} + } + if model.ValidatePostScript != nil { + validatePostScriptMap, err := dataSourceIbmProjectConfigScriptToMap(model.ValidatePostScript) + if err != nil { + return modelMap, err + } + modelMap["validate_post_script"] = []map[string]interface{}{validatePostScriptMap} + } + if model.DeployPreScript != nil { + deployPreScriptMap, err := dataSourceIbmProjectConfigScriptToMap(model.DeployPreScript) + if err != nil { + return modelMap, err + } + modelMap["deploy_pre_script"] = []map[string]interface{}{deployPreScriptMap} + } + if model.DeployPostScript != nil { + deployPostScriptMap, err := dataSourceIbmProjectConfigScriptToMap(model.DeployPostScript) + if err != nil { + return modelMap, err + } + modelMap["deploy_post_script"] = []map[string]interface{}{deployPostScriptMap} + } + if model.UndeployPreScript != nil { + undeployPreScriptMap, err := dataSourceIbmProjectConfigScriptToMap(model.UndeployPreScript) + if err != nil { + return modelMap, err + } + modelMap["undeploy_pre_script"] = []map[string]interface{}{undeployPreScriptMap} + } + if model.UndeployPostScript != nil { + undeployPostScriptMap, err := dataSourceIbmProjectConfigScriptToMap(model.UndeployPostScript) + if err != nil { + return modelMap, err + } + modelMap["undeploy_post_script"] = []map[string]interface{}{undeployPostScriptMap} + } + return modelMap, nil +} + +func dataSourceIbmProjectConfigScriptToMap(model *projectv1.Script) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Type != nil { + modelMap["type"] = model.Type + } + if model.Path != nil { + modelMap["path"] = model.Path + } + if model.ShortDescription != nil { + modelMap["short_description"] = model.ShortDescription + } return modelMap, nil } @@ -411,8 +607,8 @@ func dataSourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *proje if model.Description != nil { modelMap["description"] = model.Description } - if model.Environment != nil { - modelMap["environment"] = model.Environment + if model.EnvironmentID != nil { + modelMap["environment_id"] = model.EnvironmentID } if model.Authorizations != nil { authorizationsMap, err := dataSourceIbmProjectConfigProjectConfigAuthToMap(model.Authorizations) @@ -443,9 +639,6 @@ func dataSourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *proje } modelMap["settings"] = []map[string]interface{}{settingsMap} } - if model.Type != nil { - modelMap["type"] = model.Type - } return modelMap, nil } diff --git a/ibm/service/project/data_source_ibm_project_environment.go b/ibm/service/project/data_source_ibm_project_environment.go new file mode 100644 index 0000000000..e42f488a05 --- /dev/null +++ b/ibm/service/project/data_source_ibm_project_environment.go @@ -0,0 +1,321 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package project + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/project-go-sdk/projectv1" +) + +func DataSourceIbmProjectEnvironment() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmProjectEnvironmentRead, + + Schema: map[string]*schema.Schema{ + "project_id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The unique project ID.", + }, + "project_environment_id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The environment ID.", + }, + "project": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The project referenced by this resource.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique ID.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The definition of the project reference.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the project.", + }, + }, + }, + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "An IBM Cloud resource name, which uniquely identifies a resource.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A URL.", + }, + }, + }, + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "target_account": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The target account ID derived from the authentication block values.", + }, + "modified_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The environment definition.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the environment. It is unique within the account across projects and regions.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The description of the environment.", + }, + "authorizations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "trusted_profile_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The trusted profile ID.", + }, + "method": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The authorization method. You can authorize by using a trusted profile or an API key in Secrets Manager.", + }, + "api_key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Sensitive: true, + Description: "The IBM Cloud API Key.", + }, + }, + }, + }, + "inputs": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The input variables for configuration definition and environment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, + }, + }, + "compliance_profile": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The profile required for compliance.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique ID for that compliance profile.", + }, + "instance_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A unique ID for an instance of a compliance profile.", + }, + "instance_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The location of the compliance instance.", + }, + "attachment_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A unique ID for the attachment to a compliance profile.", + }, + "profile_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the compliance profile.", + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func dataSourceIbmProjectEnvironmentRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + getProjectEnvironmentOptions := &projectv1.GetProjectEnvironmentOptions{} + + getProjectEnvironmentOptions.SetProjectID(d.Get("project_id").(string)) + getProjectEnvironmentOptions.SetID(d.Get("project_environment_id").(string)) + + environment, response, err := projectClient.GetProjectEnvironmentWithContext(context, getProjectEnvironmentOptions) + if err != nil { + log.Printf("[DEBUG] GetProjectEnvironmentWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetProjectEnvironmentWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s/%s", *getProjectEnvironmentOptions.ProjectID, *getProjectEnvironmentOptions.ID)) + + project := []map[string]interface{}{} + if environment.Project != nil { + modelMap, err := dataSourceIbmProjectEnvironmentProjectReferenceToMap(environment.Project) + if err != nil { + return diag.FromErr(err) + } + project = append(project, modelMap) + } + if err = d.Set("project", project); err != nil { + return diag.FromErr(fmt.Errorf("Error setting project %s", err)) + } + + if err = d.Set("created_at", flex.DateTimeToString(environment.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + + if err = d.Set("target_account", environment.TargetAccount); err != nil { + return diag.FromErr(fmt.Errorf("Error setting target_account: %s", err)) + } + + if err = d.Set("modified_at", flex.DateTimeToString(environment.ModifiedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting modified_at: %s", err)) + } + + definition := []map[string]interface{}{} + if environment.Definition != nil { + modelMap, err := dataSourceIbmProjectEnvironmentEnvironmentDefinitionRequiredPropertiesToMap(environment.Definition) + if err != nil { + return diag.FromErr(err) + } + definition = append(definition, modelMap) + } + if err = d.Set("definition", definition); err != nil { + return diag.FromErr(fmt.Errorf("Error setting definition %s", err)) + } + + return nil +} + +func dataSourceIbmProjectEnvironmentProjectReferenceToMap(model *projectv1.ProjectReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + definitionMap, err := dataSourceIbmProjectEnvironmentProjectDefinitionReferenceToMap(model.Definition) + if err != nil { + return modelMap, err + } + modelMap["definition"] = []map[string]interface{}{definitionMap} + modelMap["crn"] = model.Crn + modelMap["href"] = model.Href + return modelMap, nil +} + +func dataSourceIbmProjectEnvironmentProjectDefinitionReferenceToMap(model *projectv1.ProjectDefinitionReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + return modelMap, nil +} + +func dataSourceIbmProjectEnvironmentEnvironmentDefinitionRequiredPropertiesToMap(model *projectv1.EnvironmentDefinitionRequiredProperties) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + if model.Description != nil { + modelMap["description"] = model.Description + } + if model.Authorizations != nil { + authorizationsMap, err := dataSourceIbmProjectEnvironmentProjectConfigAuthToMap(model.Authorizations) + if err != nil { + return modelMap, err + } + modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} + } + if model.Inputs != nil { + inputsMap, err := dataSourceIbmProjectEnvironmentInputVariableToMap(model.Inputs) + if err != nil { + return modelMap, err + } + modelMap["inputs"] = []map[string]interface{}{inputsMap} + } + if model.ComplianceProfile != nil { + complianceProfileMap, err := dataSourceIbmProjectEnvironmentProjectComplianceProfileToMap(model.ComplianceProfile) + if err != nil { + return modelMap, err + } + modelMap["compliance_profile"] = []map[string]interface{}{complianceProfileMap} + } + return modelMap, nil +} + +func dataSourceIbmProjectEnvironmentProjectConfigAuthToMap(model *projectv1.ProjectConfigAuth) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.TrustedProfileID != nil { + modelMap["trusted_profile_id"] = model.TrustedProfileID + } + if model.Method != nil { + modelMap["method"] = model.Method + } + if model.ApiKey != nil { + modelMap["api_key"] = model.ApiKey + } + return modelMap, nil +} + +func dataSourceIbmProjectEnvironmentInputVariableToMap(model *projectv1.InputVariable) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + return modelMap, nil +} + +func dataSourceIbmProjectEnvironmentProjectComplianceProfileToMap(model *projectv1.ProjectComplianceProfile) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ID != nil { + modelMap["id"] = model.ID + } + if model.InstanceID != nil { + modelMap["instance_id"] = model.InstanceID + } + if model.InstanceLocation != nil { + modelMap["instance_location"] = model.InstanceLocation + } + if model.AttachmentID != nil { + modelMap["attachment_id"] = model.AttachmentID + } + if model.ProfileName != nil { + modelMap["profile_name"] = model.ProfileName + } + return modelMap, nil +} diff --git a/ibm/service/project/data_source_ibm_project_environment_test.go b/ibm/service/project/data_source_ibm_project_environment_test.go new file mode 100644 index 0000000000..7edd07a90e --- /dev/null +++ b/ibm/service/project/data_source_ibm_project_environment_test.go @@ -0,0 +1,70 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package project_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmProjectEnvironmentDataSourceBasic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmProjectEnvironmentDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_project_environment.project_environment_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_project_environment.project_environment_instance", "project_id"), + resource.TestCheckResourceAttrSet("data.ibm_project_environment.project_environment_instance", "project_environment_id"), + resource.TestCheckResourceAttrSet("data.ibm_project_environment.project_environment_instance", "project.#"), + resource.TestCheckResourceAttrSet("data.ibm_project_environment.project_environment_instance", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_project_environment.project_environment_instance", "modified_at"), + resource.TestCheckResourceAttrSet("data.ibm_project_environment.project_environment_instance", "definition.#"), + ), + }, + }, + }) +} + +func testAccCheckIbmProjectEnvironmentDataSourceConfigBasic() string { + return fmt.Sprintf(` + resource "ibm_project" "project_instance" { + location = "us-south" + resource_group = "Default" + definition { + name = "acme-microservice" + description = "acme-microservice description" + destroy_on_delete = true + } + } + + resource "ibm_project_environment" "project_environment_instance" { + project_id = ibm_project.project_instance.id + definition { + name = "environment-stage" + description = "environment for stage project" + authorizations { + method = "api_key" + api_key = "%s" + } + } + lifecycle { + ignore_changes = [ + definition[0].authorizations[0].api_key, + ] + } + } + + data "ibm_project_environment" "project_environment_instance" { + project_id = ibm_project_environment.project_environment_instance.project_id + project_environment_id = ibm_project_environment.project_environment_instance.project_environment_id + } + `, acc.ProjectsConfigApiKey) +} diff --git a/ibm/service/project/data_source_ibm_project_test.go b/ibm/service/project/data_source_ibm_project_test.go index 062bc5fefe..e8e3ade5c8 100644 --- a/ibm/service/project/data_source_ibm_project_test.go +++ b/ibm/service/project/data_source_ibm_project_test.go @@ -28,8 +28,9 @@ func TestAccIbmProjectDataSourceBasic(t *testing.T) { resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "crn"), resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "created_at"), resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "location"), - resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "resource_group"), + resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "resource_group_id"), resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "state"), + resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "resource_group"), resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "definition.#"), ), }, diff --git a/ibm/service/project/resource_ibm_project.go b/ibm/service/project/resource_ibm_project.go index 9b5242752d..1147380c19 100644 --- a/ibm/service/project/resource_ibm_project.go +++ b/ibm/service/project/resource_ibm_project.go @@ -51,7 +51,7 @@ func ResourceIbmProject() *schema.Resource { "name": &schema.Schema{ Type: schema.TypeString, Required: true, - Description: "The name of the project.", + Description: "The name of the project. It is unique within the account across regions.", }, "description": &schema.Schema{ Type: schema.TypeString, @@ -84,22 +84,22 @@ func ResourceIbmProject() *schema.Resource { Schema: map[string]*schema.Schema{ "event": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, Description: "The event name.", }, "event_id": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, Description: "A unique ID for that individual event.", }, "config_id": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, Description: "A unique ID for the configuration.", }, "config_version": &schema.Schema{ Type: schema.TypeInt, - Optional: true, + Computed: true, Description: "The version number of the configuration.", }, }, @@ -110,6 +110,11 @@ func ResourceIbmProject() *schema.Resource { Computed: true, Description: "True indicates that the fetch of the needs attention items failed. It only exists if there was an error while retrieving the cumulative needs attention view.", }, + "resource_group_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource group id where the project's data and tools are created.", + }, "state": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -128,17 +133,17 @@ func ResourceIbmProject() *schema.Resource { Schema: map[string]*schema.Schema{ "id": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration.", }, "version": &schema.Schema{ Type: schema.TypeInt, - Required: true, + Computed: true, Description: "The version of the configuration.", }, "state": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The state of the configuration.", }, "created_at": &schema.Schema{ @@ -153,25 +158,23 @@ func ResourceIbmProject() *schema.Resource { }, "href": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "A URL.", }, "definition": &schema.Schema{ Type: schema.TypeList, - MinItems: 1, - MaxItems: 1, - Required: true, + Computed: true, Description: "The name and description of a project configuration.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, - Optional: true, - Description: "The configuration name.", + Computed: true, + Description: "The configuration name. It is unique within the account across projects and regions.", }, "description": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, Description: "A project configuration description.", }, }, @@ -179,28 +182,24 @@ func ResourceIbmProject() *schema.Resource { }, "project": &schema.Schema{ Type: schema.TypeList, - MinItems: 1, - MaxItems: 1, - Required: true, + Computed: true, Description: "The project referenced by this resource.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The unique ID.", }, "definition": &schema.Schema{ Type: schema.TypeList, - MinItems: 1, - MaxItems: 1, - Required: true, + Computed: true, Description: "The definition of the project reference.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The name of the project.", }, }, @@ -208,12 +207,12 @@ func ResourceIbmProject() *schema.Resource { }, "crn": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "An IBM Cloud resource name, which uniquely identifies a resource.", }, "href": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "A URL.", }, }, @@ -230,33 +229,29 @@ func ResourceIbmProject() *schema.Resource { Schema: map[string]*schema.Schema{ "id": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The environment id as a friendly name.", }, "project": &schema.Schema{ Type: schema.TypeList, - MinItems: 1, - MaxItems: 1, - Required: true, + Computed: true, Description: "The project referenced by this resource.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The unique ID.", }, "definition": &schema.Schema{ Type: schema.TypeList, - MinItems: 1, - MaxItems: 1, - Required: true, + Computed: true, Description: "The definition of the project reference.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The name of the project.", }, }, @@ -264,12 +259,12 @@ func ResourceIbmProject() *schema.Resource { }, "crn": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "An IBM Cloud resource name, which uniquely identifies a resource.", }, "href": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "A URL.", }, }, @@ -282,25 +277,23 @@ func ResourceIbmProject() *schema.Resource { }, "href": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "A URL.", }, "definition": &schema.Schema{ Type: schema.TypeList, - MinItems: 1, - MaxItems: 1, - Required: true, + Computed: true, Description: "The environment definition used in the project collection.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, - Optional: true, - Description: "The name of the environment.", + Computed: true, + Description: "The name of the environment. It is unique within the account across projects and regions.", }, "description": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, Description: "The description of the environment.", }, }, @@ -424,6 +417,9 @@ func resourceIbmProjectRead(context context.Context, d *schema.ResourceData, met return diag.FromErr(fmt.Errorf("Error setting cumulative_needs_attention_view_error: %s", err)) } } + if err = d.Set("resource_group_id", project.ResourceGroupID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_group_id: %s", err)) + } if err = d.Set("state", project.State); err != nil { return diag.FromErr(fmt.Errorf("Error setting state: %s", err)) } @@ -435,7 +431,7 @@ func resourceIbmProjectRead(context context.Context, d *schema.ResourceData, met if !core.IsNil(project.Configs) { configs := []map[string]interface{}{} for _, configsItem := range project.Configs { - configsItemMap, err := resourceIbmProjectProjectConfigCollectionMemberToMap(&configsItem) + configsItemMap, err := resourceIbmProjectProjectConfigSummaryToMap(&configsItem) if err != nil { return diag.FromErr(err) } @@ -448,7 +444,7 @@ func resourceIbmProjectRead(context context.Context, d *schema.ResourceData, met if !core.IsNil(project.Environments) { environments := []map[string]interface{}{} for _, environmentsItem := range project.Environments { - environmentsItemMap, err := resourceIbmProjectProjectEnvironmentCollectionMemberToMap(&environmentsItem) + environmentsItemMap, err := resourceIbmProjectProjectEnvironmentSummaryToMap(&environmentsItem) if err != nil { return diag.FromErr(err) } @@ -475,7 +471,7 @@ func resourceIbmProjectUpdate(context context.Context, d *schema.ResourceData, m hasChange := false if d.HasChange("definition") { - definition, err := resourceIbmProjectMapToProjectPrototypePatchDefinitionBlock(d.Get("definition.0").(map[string]interface{})) + definition, err := resourceIbmProjectMapToProjectPatchDefinitionBlock(d.Get("definition.0").(map[string]interface{})) if err != nil { return diag.FromErr(err) } @@ -550,8 +546,8 @@ func resourceIbmProjectMapToProjectConfigPrototypeDefinitionBlock(modelMap map[s if modelMap["description"] != nil && modelMap["description"].(string) != "" { model.Description = core.StringPtr(modelMap["description"].(string)) } - if modelMap["environment"] != nil && modelMap["environment"].(string) != "" { - model.Environment = core.StringPtr(modelMap["environment"].(string)) + if modelMap["environment_id"] != nil && modelMap["environment_id"].(string) != "" { + model.EnvironmentID = core.StringPtr(modelMap["environment_id"].(string)) } if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { AuthorizationsModel, err := resourceIbmProjectMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) @@ -639,8 +635,8 @@ func resourceIbmProjectMapToSchematicsWorkspace(modelMap map[string]interface{}) return model, nil } -func resourceIbmProjectMapToProjectPrototypePatchDefinitionBlock(modelMap map[string]interface{}) (*projectv1.ProjectPrototypePatchDefinitionBlock, error) { - model := &projectv1.ProjectPrototypePatchDefinitionBlock{} +func resourceIbmProjectMapToProjectPatchDefinitionBlock(modelMap map[string]interface{}) (*projectv1.ProjectPatchDefinitionBlock, error) { + model := &projectv1.ProjectPatchDefinitionBlock{} if modelMap["name"] != nil && modelMap["name"].(string) != "" { model.Name = core.StringPtr(modelMap["name"].(string)) } @@ -680,7 +676,7 @@ func resourceIbmProjectCumulativeNeedsAttentionToMap(model *projectv1.Cumulative return modelMap, nil } -func resourceIbmProjectProjectConfigCollectionMemberToMap(model *projectv1.ProjectConfigCollectionMember) (map[string]interface{}, error) { +func resourceIbmProjectProjectConfigSummaryToMap(model *projectv1.ProjectConfigSummary) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.ApprovedVersion != nil { approvedVersionMap, err := resourceIbmProjectProjectConfigVersionSummaryToMap(model.ApprovedVersion) @@ -699,12 +695,8 @@ func resourceIbmProjectProjectConfigCollectionMemberToMap(model *projectv1.Proje modelMap["id"] = model.ID modelMap["version"] = flex.IntValue(model.Version) modelMap["state"] = model.State - if model.CreatedAt != nil { - modelMap["created_at"] = model.CreatedAt.String() - } - if model.ModifiedAt != nil { - modelMap["modified_at"] = model.ModifiedAt.String() - } + modelMap["created_at"] = model.CreatedAt.String() + modelMap["modified_at"] = model.ModifiedAt.String() modelMap["href"] = model.Href definitionMap, err := resourceIbmProjectProjectConfigDefinitionNameDescriptionToMap(model.Definition) if err != nil { @@ -757,7 +749,7 @@ func resourceIbmProjectProjectDefinitionReferenceToMap(model *projectv1.ProjectD return modelMap, nil } -func resourceIbmProjectProjectEnvironmentCollectionMemberToMap(model *projectv1.ProjectEnvironmentCollectionMember) (map[string]interface{}, error) { +func resourceIbmProjectProjectEnvironmentSummaryToMap(model *projectv1.ProjectEnvironmentSummary) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["id"] = model.ID projectMap, err := resourceIbmProjectProjectReferenceToMap(model.Project) diff --git a/ibm/service/project/resource_ibm_project_config.go b/ibm/service/project/resource_ibm_project_config.go index ef7fb404c3..5594fbd5b7 100644 --- a/ibm/service/project/resource_ibm_project_config.go +++ b/ibm/service/project/resource_ibm_project_config.go @@ -38,7 +38,7 @@ func ResourceIbmProjectConfig() *schema.Resource { Type: schema.TypeList, MaxItems: 1, Optional: true, - Description: "A schematics workspace associated to a project configuration.", + Description: "A schematics workspace associated to a project configuration, with scripts.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "workspace_crn": &schema.Schema{ @@ -46,6 +46,150 @@ func ResourceIbmProjectConfig() *schema.Resource { Optional: true, Description: "An existing schematics workspace CRN.", }, + "validate_pre_script": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the script.", + }, + "path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The path to this script within the current version source.", + }, + "short_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The short description for this script.", + }, + }, + }, + }, + "validate_post_script": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the script.", + }, + "path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The path to this script within the current version source.", + }, + "short_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The short description for this script.", + }, + }, + }, + }, + "deploy_pre_script": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the script.", + }, + "path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The path to this script within the current version source.", + }, + "short_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The short description for this script.", + }, + }, + }, + }, + "deploy_post_script": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the script.", + }, + "path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The path to this script within the current version source.", + }, + "short_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The short description for this script.", + }, + }, + }, + }, + "undeploy_pre_script": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the script.", + }, + "path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The path to this script within the current version source.", + }, + "short_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The short description for this script.", + }, + }, + }, + }, + "undeploy_post_script": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type of the script.", + }, + "path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The path to this script within the current version source.", + }, + "short_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The short description for this script.", + }, + }, + }, + }, }, }, }, @@ -54,20 +198,20 @@ func ResourceIbmProjectConfig() *schema.Resource { MinItems: 1, MaxItems: 1, Required: true, - Description: "The type and output of a project configuration.", + Description: "The name and description of a project configuration.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, Required: true, - Description: "The configuration name.", + Description: "The configuration name. It is unique within the account across projects and regions.", }, "description": &schema.Schema{ Type: schema.TypeString, Optional: true, Description: "A project configuration description.", }, - "environment": &schema.Schema{ + "environment_id": &schema.Schema{ Type: schema.TypeString, Optional: true, Description: "The ID of the project environment.", @@ -92,6 +236,7 @@ func ResourceIbmProjectConfig() *schema.Resource { "api_key": &schema.Schema{ Type: schema.TypeString, Optional: true, + Sensitive: true, Description: "The IBM Cloud API Key.", }, }, @@ -107,12 +252,12 @@ func ResourceIbmProjectConfig() *schema.Resource { "id": &schema.Schema{ Type: schema.TypeString, Optional: true, - Description: "The unique ID.", + Description: "The unique ID for that compliance profile.", }, "instance_id": &schema.Schema{ Type: schema.TypeString, Optional: true, - Description: "The unique ID.", + Description: "A unique ID for an instance of a compliance profile.", }, "instance_location": &schema.Schema{ Type: schema.TypeString, @@ -122,7 +267,7 @@ func ResourceIbmProjectConfig() *schema.Resource { "attachment_id": &schema.Schema{ Type: schema.TypeString, Optional: true, - Description: "The unique ID.", + Description: "A unique ID for the attachment to a compliance profile.", }, "profile_name": &schema.Schema{ Type: schema.TypeString, @@ -136,7 +281,7 @@ func ResourceIbmProjectConfig() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - Description: "A dotted value of catalogID.versionID.", + Description: "A unique concatenation of catalogID.versionID that identifies the DA in the catalog.", }, "inputs": &schema.Schema{ Type: schema.TypeList, @@ -156,11 +301,6 @@ func ResourceIbmProjectConfig() *schema.Resource { Schema: map[string]*schema.Schema{}, }, }, - "type": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The type of a project configuration manual property.", - }, }, }, }, @@ -203,17 +343,17 @@ func ResourceIbmProjectConfig() *schema.Resource { Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The variable name.", }, "description": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, Description: "A short explanation of the output value.", }, "value": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, Description: "Can be any value - a string, number, boolean, array, or object.", }, }, @@ -227,20 +367,18 @@ func ResourceIbmProjectConfig() *schema.Resource { Schema: map[string]*schema.Schema{ "id": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The unique ID.", }, "definition": &schema.Schema{ Type: schema.TypeList, - MinItems: 1, - MaxItems: 1, - Required: true, + Computed: true, Description: "The definition of the project reference.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "The name of the project.", }, }, @@ -248,12 +386,12 @@ func ResourceIbmProjectConfig() *schema.Resource { }, "crn": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "An IBM Cloud resource name, which uniquely identifies a resource.", }, "href": &schema.Schema{ Type: schema.TypeString, - Required: true, + Computed: true, Description: "A URL.", }, }, @@ -439,7 +577,7 @@ func resourceIbmProjectConfigUpdate(context context.Context, d *schema.ResourceD hasChange := false if d.HasChange("definition") { - definition, err := resourceIbmProjectConfigMapToProjectConfigPrototypePatchDefinitionBlock(d.Get("definition.0").(map[string]interface{})) + definition, err := resourceIbmProjectConfigMapToProjectConfigPatchDefinitionBlock(d.Get("definition.0").(map[string]interface{})) if err != nil { return diag.FromErr(err) } @@ -491,8 +629,8 @@ func resourceIbmProjectConfigMapToProjectConfigPrototypeDefinitionBlock(modelMap if modelMap["description"] != nil && modelMap["description"].(string) != "" { model.Description = core.StringPtr(modelMap["description"].(string)) } - if modelMap["environment"] != nil && modelMap["environment"].(string) != "" { - model.Environment = core.StringPtr(modelMap["environment"].(string)) + if modelMap["environment_id"] != nil && modelMap["environment_id"].(string) != "" { + model.EnvironmentID = core.StringPtr(modelMap["environment_id"].(string)) } if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { AuthorizationsModel, err := resourceIbmProjectConfigMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) @@ -580,16 +718,16 @@ func resourceIbmProjectConfigMapToSchematicsWorkspace(modelMap map[string]interf return model, nil } -func resourceIbmProjectConfigMapToProjectConfigPrototypePatchDefinitionBlock(modelMap map[string]interface{}) (*projectv1.ProjectConfigPrototypePatchDefinitionBlock, error) { - model := &projectv1.ProjectConfigPrototypePatchDefinitionBlock{} +func resourceIbmProjectConfigMapToProjectConfigPatchDefinitionBlock(modelMap map[string]interface{}) (*projectv1.ProjectConfigPatchDefinitionBlock, error) { + model := &projectv1.ProjectConfigPatchDefinitionBlock{} if modelMap["name"] != nil && modelMap["name"].(string) != "" { model.Name = core.StringPtr(modelMap["name"].(string)) } if modelMap["description"] != nil && modelMap["description"].(string) != "" { model.Description = core.StringPtr(modelMap["description"].(string)) } - if modelMap["environment"] != nil && modelMap["environment"].(string) != "" { - model.Environment = core.StringPtr(modelMap["environment"].(string)) + if modelMap["environment_id"] != nil && modelMap["environment_id"].(string) != "" { + model.EnvironmentID = core.StringPtr(modelMap["environment_id"].(string)) } if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { AuthorizationsModel, err := resourceIbmProjectConfigMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) @@ -625,11 +763,67 @@ func resourceIbmProjectConfigMapToProjectConfigPrototypePatchDefinitionBlock(mod return model, nil } -func resourceIbmProjectConfigSchematicsWorkspaceToMap(model *projectv1.SchematicsWorkspace) (map[string]interface{}, error) { +func resourceIbmProjectConfigSchematicsMetadataToMap(model *projectv1.SchematicsMetadata) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.WorkspaceCrn != nil { modelMap["workspace_crn"] = model.WorkspaceCrn } + if model.ValidatePreScript != nil { + validatePreScriptMap, err := resourceIbmProjectConfigScriptToMap(model.ValidatePreScript) + if err != nil { + return modelMap, err + } + modelMap["validate_pre_script"] = []map[string]interface{}{validatePreScriptMap} + } + if model.ValidatePostScript != nil { + validatePostScriptMap, err := resourceIbmProjectConfigScriptToMap(model.ValidatePostScript) + if err != nil { + return modelMap, err + } + modelMap["validate_post_script"] = []map[string]interface{}{validatePostScriptMap} + } + if model.DeployPreScript != nil { + deployPreScriptMap, err := resourceIbmProjectConfigScriptToMap(model.DeployPreScript) + if err != nil { + return modelMap, err + } + modelMap["deploy_pre_script"] = []map[string]interface{}{deployPreScriptMap} + } + if model.DeployPostScript != nil { + deployPostScriptMap, err := resourceIbmProjectConfigScriptToMap(model.DeployPostScript) + if err != nil { + return modelMap, err + } + modelMap["deploy_post_script"] = []map[string]interface{}{deployPostScriptMap} + } + if model.UndeployPreScript != nil { + undeployPreScriptMap, err := resourceIbmProjectConfigScriptToMap(model.UndeployPreScript) + if err != nil { + return modelMap, err + } + modelMap["undeploy_pre_script"] = []map[string]interface{}{undeployPreScriptMap} + } + if model.UndeployPostScript != nil { + undeployPostScriptMap, err := resourceIbmProjectConfigScriptToMap(model.UndeployPostScript) + if err != nil { + return modelMap, err + } + modelMap["undeploy_post_script"] = []map[string]interface{}{undeployPostScriptMap} + } + return modelMap, nil +} + +func resourceIbmProjectConfigScriptToMap(model *projectv1.Script) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Type != nil { + modelMap["type"] = model.Type + } + if model.Path != nil { + modelMap["path"] = model.Path + } + if model.ShortDescription != nil { + modelMap["short_description"] = model.ShortDescription + } return modelMap, nil } @@ -639,8 +833,8 @@ func resourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *project if model.Description != nil { modelMap["description"] = model.Description } - if model.Environment != nil { - modelMap["environment"] = model.Environment + if model.EnvironmentID != nil { + modelMap["environment_id"] = model.EnvironmentID } if model.Authorizations != nil { authorizationsMap, err := resourceIbmProjectConfigProjectConfigAuthToMap(model.Authorizations) @@ -675,9 +869,6 @@ func resourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *project } modelMap["settings"] = []map[string]interface{}{settingsMap} } - if model.Type != nil { - modelMap["type"] = model.Type - } return modelMap, nil } diff --git a/ibm/service/project/resource_ibm_project_environment.go b/ibm/service/project/resource_ibm_project_environment.go new file mode 100644 index 0000000000..3dda07d3a2 --- /dev/null +++ b/ibm/service/project/resource_ibm_project_environment.go @@ -0,0 +1,551 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package project + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/project-go-sdk/projectv1" +) + +func ResourceIbmProjectEnvironment() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIbmProjectEnvironmentCreate, + ReadContext: resourceIbmProjectEnvironmentRead, + UpdateContext: resourceIbmProjectEnvironmentUpdate, + DeleteContext: resourceIbmProjectEnvironmentDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "project_id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_project_environment", "project_id"), + Description: "The unique project ID.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Required: true, + Description: "The environment definition.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The name of the environment. It is unique within the account across projects and regions.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The description of the environment.", + }, + "authorizations": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "trusted_profile_id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The trusted profile ID.", + }, + "method": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The authorization method. You can authorize by using a trusted profile or an API key in Secrets Manager.", + }, + "api_key": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Sensitive: true, + Description: "The IBM Cloud API Key.", + }, + }, + }, + }, + "inputs": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "The input variables for configuration definition and environment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, + }, + }, + "compliance_profile": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "The profile required for compliance.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The unique ID for that compliance profile.", + }, + "instance_id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "A unique ID for an instance of a compliance profile.", + }, + "instance_location": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The location of the compliance instance.", + }, + "attachment_id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "A unique ID for the attachment to a compliance profile.", + }, + "profile_name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the compliance profile.", + }, + }, + }, + }, + }, + }, + }, + "project": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The project referenced by this resource.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique ID.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The definition of the project reference.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the project.", + }, + }, + }, + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "An IBM Cloud resource name, which uniquely identifies a resource.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A URL.", + }, + }, + }, + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "target_account": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The target account ID derived from the authentication block values.", + }, + "modified_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", + }, + "project_environment_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The environment id as a friendly name.", + }, + }, + } +} + +func ResourceIbmProjectEnvironmentValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "project_id", + ValidateFunctionIdentifier: validate.ValidateRegexp, + Type: validate.TypeString, + Required: true, + Regexp: `^[\.\-0-9a-zA-Z]+$`, + MaxValueLength: 128, + }, + ) + + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_project_environment", Schema: validateSchema} + return &resourceValidator +} + +func resourceIbmProjectEnvironmentCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + createProjectEnvironmentOptions := &projectv1.CreateProjectEnvironmentOptions{} + + createProjectEnvironmentOptions.SetProjectID(d.Get("project_id").(string)) + definitionModel, err := resourceIbmProjectEnvironmentMapToEnvironmentDefinitionRequiredProperties(d.Get("definition.0").(map[string]interface{})) + if err != nil { + return diag.FromErr(err) + } + createProjectEnvironmentOptions.SetDefinition(definitionModel) + + environment, response, err := projectClient.CreateProjectEnvironmentWithContext(context, createProjectEnvironmentOptions) + if err != nil { + log.Printf("[DEBUG] CreateProjectEnvironmentWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CreateProjectEnvironmentWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s/%s", *createProjectEnvironmentOptions.ProjectID, *environment.ID)) + + return resourceIbmProjectEnvironmentRead(context, d, meta) +} + +func resourceIbmProjectEnvironmentRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + getProjectEnvironmentOptions := &projectv1.GetProjectEnvironmentOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + getProjectEnvironmentOptions.SetProjectID(parts[0]) + getProjectEnvironmentOptions.SetID(parts[1]) + + environment, response, err := projectClient.GetProjectEnvironmentWithContext(context, getProjectEnvironmentOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetProjectEnvironmentWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetProjectEnvironmentWithContext failed %s\n%s", err, response)) + } + + definitionMap, err := resourceIbmProjectEnvironmentEnvironmentDefinitionRequiredPropertiesToMap(environment.Definition) + if err != nil { + return diag.FromErr(err) + } + if err = d.Set("definition", []map[string]interface{}{definitionMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting definition: %s", err)) + } + projectMap, err := resourceIbmProjectEnvironmentProjectReferenceToMap(environment.Project) + if err != nil { + return diag.FromErr(err) + } + if err = d.Set("project", []map[string]interface{}{projectMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting project: %s", err)) + } + if err = d.Set("created_at", flex.DateTimeToString(environment.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + if !core.IsNil(environment.TargetAccount) { + if err = d.Set("target_account", environment.TargetAccount); err != nil { + return diag.FromErr(fmt.Errorf("Error setting target_account: %s", err)) + } + } + if err = d.Set("modified_at", flex.DateTimeToString(environment.ModifiedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting modified_at: %s", err)) + } + if err = d.Set("project_environment_id", environment.ID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting project_environment_id: %s", err)) + } + + return nil +} + +func resourceIbmProjectEnvironmentUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + updateProjectEnvironmentOptions := &projectv1.UpdateProjectEnvironmentOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + updateProjectEnvironmentOptions.SetProjectID(parts[0]) + updateProjectEnvironmentOptions.SetID(parts[1]) + + hasChange := false + + if d.HasChange("project_id") { + return diag.FromErr(fmt.Errorf("Cannot update resource property \"%s\" with the ForceNew annotation."+ + " The resource must be re-created to update this property.", "project_id")) + } + if d.HasChange("definition") { + definition, err := resourceIbmProjectEnvironmentMapToEnvironmentDefinitionProperties(d.Get("definition.0").(map[string]interface{})) + if err != nil { + return diag.FromErr(err) + } + updateProjectEnvironmentOptions.SetDefinition(definition) + hasChange = true + } + + if hasChange { + _, response, err := projectClient.UpdateProjectEnvironmentWithContext(context, updateProjectEnvironmentOptions) + if err != nil { + log.Printf("[DEBUG] UpdateProjectEnvironmentWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("UpdateProjectEnvironmentWithContext failed %s\n%s", err, response)) + } + } + + return resourceIbmProjectEnvironmentRead(context, d, meta) +} + +func resourceIbmProjectEnvironmentDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + projectClient, err := meta.(conns.ClientSession).ProjectV1() + if err != nil { + return diag.FromErr(err) + } + + deleteProjectEnvironmentOptions := &projectv1.DeleteProjectEnvironmentOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + deleteProjectEnvironmentOptions.SetProjectID(parts[0]) + deleteProjectEnvironmentOptions.SetID(parts[1]) + + _, response, err := projectClient.DeleteProjectEnvironmentWithContext(context, deleteProjectEnvironmentOptions) + if err != nil { + log.Printf("[DEBUG] DeleteProjectEnvironmentWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteProjectEnvironmentWithContext failed %s\n%s", err, response)) + } + + d.SetId("") + + return nil +} + +func resourceIbmProjectEnvironmentMapToEnvironmentDefinitionRequiredProperties(modelMap map[string]interface{}) (*projectv1.EnvironmentDefinitionRequiredProperties, error) { + model := &projectv1.EnvironmentDefinitionRequiredProperties{} + model.Name = core.StringPtr(modelMap["name"].(string)) + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { + AuthorizationsModel, err := resourceIbmProjectEnvironmentMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Authorizations = AuthorizationsModel + } + if modelMap["inputs"] != nil && len(modelMap["inputs"].([]interface{})) > 0 { + InputsModel, err := resourceIbmProjectEnvironmentMapToInputVariable(modelMap["inputs"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Inputs = InputsModel + } + if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { + ComplianceProfileModel, err := resourceIbmProjectEnvironmentMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.ComplianceProfile = ComplianceProfileModel + } + return model, nil +} + +func resourceIbmProjectEnvironmentMapToProjectConfigAuth(modelMap map[string]interface{}) (*projectv1.ProjectConfigAuth, error) { + model := &projectv1.ProjectConfigAuth{} + if modelMap["trusted_profile_id"] != nil && modelMap["trusted_profile_id"].(string) != "" { + model.TrustedProfileID = core.StringPtr(modelMap["trusted_profile_id"].(string)) + } + if modelMap["method"] != nil && modelMap["method"].(string) != "" { + model.Method = core.StringPtr(modelMap["method"].(string)) + } + if modelMap["api_key"] != nil && modelMap["api_key"].(string) != "" { + model.ApiKey = core.StringPtr(modelMap["api_key"].(string)) + } + return model, nil +} + +func resourceIbmProjectEnvironmentMapToInputVariable(modelMap map[string]interface{}) (*projectv1.InputVariable, error) { + model := &projectv1.InputVariable{} + return model, nil +} + +func resourceIbmProjectEnvironmentMapToProjectComplianceProfile(modelMap map[string]interface{}) (*projectv1.ProjectComplianceProfile, error) { + model := &projectv1.ProjectComplianceProfile{} + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } + if modelMap["instance_id"] != nil && modelMap["instance_id"].(string) != "" { + model.InstanceID = core.StringPtr(modelMap["instance_id"].(string)) + } + if modelMap["instance_location"] != nil && modelMap["instance_location"].(string) != "" { + model.InstanceLocation = core.StringPtr(modelMap["instance_location"].(string)) + } + if modelMap["attachment_id"] != nil && modelMap["attachment_id"].(string) != "" { + model.AttachmentID = core.StringPtr(modelMap["attachment_id"].(string)) + } + if modelMap["profile_name"] != nil && modelMap["profile_name"].(string) != "" { + model.ProfileName = core.StringPtr(modelMap["profile_name"].(string)) + } + return model, nil +} + +func resourceIbmProjectEnvironmentMapToEnvironmentDefinitionProperties(modelMap map[string]interface{}) (*projectv1.EnvironmentDefinitionProperties, error) { + model := &projectv1.EnvironmentDefinitionProperties{} + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { + AuthorizationsModel, err := resourceIbmProjectEnvironmentMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Authorizations = AuthorizationsModel + } + if modelMap["inputs"] != nil && len(modelMap["inputs"].([]interface{})) > 0 { + InputsModel, err := resourceIbmProjectEnvironmentMapToInputVariable(modelMap["inputs"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Inputs = InputsModel + } + if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { + ComplianceProfileModel, err := resourceIbmProjectEnvironmentMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.ComplianceProfile = ComplianceProfileModel + } + return model, nil +} + +func resourceIbmProjectEnvironmentEnvironmentDefinitionRequiredPropertiesToMap(model *projectv1.EnvironmentDefinitionRequiredProperties) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + if model.Description != nil { + modelMap["description"] = model.Description + } + if model.Authorizations != nil { + authorizationsMap, err := resourceIbmProjectEnvironmentProjectConfigAuthToMap(model.Authorizations) + if err != nil { + return modelMap, err + } + modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} + } + if model.Inputs != nil { + inputsMap, err := resourceIbmProjectEnvironmentInputVariableToMap(model.Inputs) + if err != nil { + return modelMap, err + } + if len(inputsMap) > 0 { + modelMap["inputs"] = []map[string]interface{}{inputsMap} + } + } + if model.ComplianceProfile != nil { + complianceProfileMap, err := resourceIbmProjectEnvironmentProjectComplianceProfileToMap(model.ComplianceProfile) + if err != nil { + return modelMap, err + } + if len(complianceProfileMap) > 0 { + modelMap["compliance_profile"] = []map[string]interface{}{complianceProfileMap} + } + } + return modelMap, nil +} + +func resourceIbmProjectEnvironmentProjectConfigAuthToMap(model *projectv1.ProjectConfigAuth) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.TrustedProfileID != nil { + modelMap["trusted_profile_id"] = model.TrustedProfileID + } + if model.Method != nil { + modelMap["method"] = model.Method + } + if model.ApiKey != nil { + modelMap["api_key"] = model.ApiKey + } + return modelMap, nil +} + +func resourceIbmProjectEnvironmentInputVariableToMap(model *projectv1.InputVariable) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + return modelMap, nil +} + +func resourceIbmProjectEnvironmentProjectComplianceProfileToMap(model *projectv1.ProjectComplianceProfile) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ID != nil { + modelMap["id"] = model.ID + } + if model.InstanceID != nil { + modelMap["instance_id"] = model.InstanceID + } + if model.InstanceLocation != nil { + modelMap["instance_location"] = model.InstanceLocation + } + if model.AttachmentID != nil { + modelMap["attachment_id"] = model.AttachmentID + } + if model.ProfileName != nil { + modelMap["profile_name"] = model.ProfileName + } + return modelMap, nil +} + +func resourceIbmProjectEnvironmentProjectReferenceToMap(model *projectv1.ProjectReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + definitionMap, err := resourceIbmProjectEnvironmentProjectDefinitionReferenceToMap(model.Definition) + if err != nil { + return modelMap, err + } + modelMap["definition"] = []map[string]interface{}{definitionMap} + modelMap["crn"] = model.Crn + modelMap["href"] = model.Href + return modelMap, nil +} + +func resourceIbmProjectEnvironmentProjectDefinitionReferenceToMap(model *projectv1.ProjectDefinitionReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["name"] = model.Name + return modelMap, nil +} diff --git a/ibm/service/project/resource_ibm_project_environment_test.go b/ibm/service/project/resource_ibm_project_environment_test.go new file mode 100644 index 0000000000..5d33d6db32 --- /dev/null +++ b/ibm/service/project/resource_ibm_project_environment_test.go @@ -0,0 +1,138 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package project_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/project-go-sdk/projectv1" +) + +func TestAccIbmProjectEnvironmentBasic(t *testing.T) { + var conf projectv1.Environment + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmProjectEnvironmentDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmProjectEnvironmentConfigBasic(), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmProjectEnvironmentExists("ibm_project_environment.project_environment_instance", conf), + ), + }, + resource.TestStep{ + ResourceName: "ibm_project_environment.project_environment_instance", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"project_id"}, + }, + }, + }) +} + +func testAccCheckIbmProjectEnvironmentConfigBasic() string { + return fmt.Sprintf(` + resource "ibm_project" "project_instance" { + location = "us-south" + resource_group = "Default" + definition { + name = "acme-microservice" + description = "acme-microservice description" + destroy_on_delete = true + } + } + + resource "ibm_project_environment" "project_environment_instance" { + project_id = ibm_project.project_instance.id + definition { + name = "environment-stage" + description = "environment for stage project" + authorizations { + method = "api_key" + api_key = "%s" + } + } + lifecycle { + ignore_changes = [ + definition[0].authorizations[0].api_key, + ] + } + } + `, acc.ProjectsConfigApiKey) +} + +func testAccCheckIbmProjectEnvironmentExists(n string, obj projectv1.Environment) resource.TestCheckFunc { + + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + projectClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).ProjectV1() + if err != nil { + return err + } + + getProjectEnvironmentOptions := &projectv1.GetProjectEnvironmentOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getProjectEnvironmentOptions.SetProjectID(parts[0]) + getProjectEnvironmentOptions.SetID(parts[1]) + + environment, _, err := projectClient.GetProjectEnvironment(getProjectEnvironmentOptions) + if err != nil { + return err + } + + obj = *environment + return nil + } +} + +func testAccCheckIbmProjectEnvironmentDestroy(s *terraform.State) error { + projectClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).ProjectV1() + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_project_environment" { + continue + } + + getProjectEnvironmentOptions := &projectv1.GetProjectEnvironmentOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getProjectEnvironmentOptions.SetProjectID(parts[0]) + getProjectEnvironmentOptions.SetID(parts[1]) + + // Try to find the key + _, response, err := projectClient.GetProjectEnvironment(getProjectEnvironmentOptions) + + if err == nil { + return fmt.Errorf("project_environment still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for project_environment (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/website/docs/d/project.html.markdown b/website/docs/d/project.html.markdown index 3ac6b811d3..6cac923733 100644 --- a/website/docs/d/project.html.markdown +++ b/website/docs/d/project.html.markdown @@ -31,15 +31,15 @@ After your data source is created, you can read values from the following attrib * `id` - The unique identifier of the project. * `configs` - (List) The project configurations. These configurations are only included in the response of creating a project if a configs array is specified in the request payload. - * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. + * Constraints: The default value is `[]`. The maximum length is `100` items. The minimum length is `0` items. Nested schema for **configs**: * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. * `definition` - (List) The name and description of a project configuration. Nested schema for **definition**: * `description` - (String) A project configuration description. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. - * `name` - (String) The configuration name. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `name` - (String) The configuration name. It is unique within the account across projects and regions. + * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. * `href` - (String) A URL. * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. * `id` - (String) The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. @@ -48,7 +48,7 @@ Nested schema for **configs**: * `project` - (List) The project referenced by this resource. Nested schema for **project**: * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. - * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. * `definition` - (List) The definition of the project reference. Nested schema for **definition**: * `name` - (String) The name of the project. @@ -64,10 +64,10 @@ Nested schema for **configs**: * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. - * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. * `cumulative_needs_attention_view` - (List) The cumulative list of needs attention items for a project. If the view is successfully retrieved, an array which could be empty is returned. - * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. + * Constraints: The default value is `[]`. The maximum length is `50` items. The minimum length is `0` items. Nested schema for **cumulative_needs_attention_view**: * `config_id` - (String) A unique ID for the configuration. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. @@ -83,21 +83,21 @@ Nested schema for **cumulative_needs_attention_view**: * `definition` - (List) The definition of the project. Nested schema for **definition**: * `description` - (String) A brief explanation of the project's use in the configuration of a deployable architecture. It is possible to create a project without providing a description. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. * `destroy_on_delete` - (Boolean) The policy that indicates whether the resources are destroyed or not when a project is deleted. - * `name` - (String) The name of the project. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * `name` - (String) The name of the project. It is unique within the account across regions. + * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. * `environments` - (List) The project environments. These environments are only included in the response if project environments were created on the project. - * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. + * Constraints: The default value is `[]`. The maximum length is `20` items. The minimum length is `0` items. Nested schema for **environments**: * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. * `definition` - (List) The environment definition used in the project collection. Nested schema for **definition**: * `description` - (String) The description of the environment. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. - * `name` - (String) The name of the environment. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `name` - (String) The name of the environment. It is unique within the account across projects and regions. + * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. * `href` - (String) A URL. * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. * `id` - (String) The environment id as a friendly name. @@ -105,7 +105,7 @@ Nested schema for **environments**: * `project` - (List) The project referenced by this resource. Nested schema for **project**: * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. - * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. * `definition` - (List) The definition of the project reference. Nested schema for **definition**: * `name` - (String) The name of the project. @@ -121,9 +121,12 @@ Nested schema for **environments**: * `location` - (Forces new resource, String) The IBM Cloud location where a resource is deployed. * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]*$/`. -* `resource_group` - (Forces new resource, String) The resource group where the project's data and tools are created. +* `resource_group` - (Forces new resource, String) The resource group name where the project's data and tools are created. * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]*$/`. +* `resource_group_id` - (String) The resource group id where the project's data and tools are created. + * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^[0-9a-zA-Z]+$/`. + * `state` - (String) The project status value. * Constraints: Allowable values are: `ready`, `deleting`, `deleting_failed`. diff --git a/website/docs/d/project_config.html.markdown b/website/docs/d/project_config.html.markdown index 5cfedd0d20..4db739e668 100644 --- a/website/docs/d/project_config.html.markdown +++ b/website/docs/d/project_config.html.markdown @@ -35,7 +35,7 @@ After your data source is created, you can read values from the following attrib * `id` - The unique identifier of the project_config. * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. -* `definition` - (List) The type and output of a project configuration. +* `definition` - (List) The name and description of a project configuration. Nested schema for **definition**: * `authorizations` - (List) The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. Nested schema for **authorizations**: @@ -47,30 +47,28 @@ Nested schema for **definition**: * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. * `compliance_profile` - (List) The profile required for compliance. Nested schema for **compliance_profile**: - * `attachment_id` - (String) The unique ID. + * `attachment_id` - (String) A unique ID for the attachment to a compliance profile. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. - * `id` - (String) The unique ID. + * `id` - (String) The unique ID for that compliance profile. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. - * `instance_id` - (String) The unique ID. + * `instance_id` - (String) A unique ID for an instance of a compliance profile. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. * `instance_location` - (String) The location of the compliance instance. * Constraints: The maximum length is `12` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(us-south|us-east|eu-gb|eu-de)$/`. * `profile_name` - (String) The name of the compliance profile. * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^`<>\\x00-\\x1F]*$/`. * `description` - (String) A project configuration description. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. - * `environment` - (String) The ID of the project environment. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `environment_id` - (String) The ID of the project environment. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. * `inputs` - (List) The input variables for configuration definition and environment. Nested schema for **inputs**: - * `locator_id` - (Forces new resource, String) A dotted value of catalogID.versionID. + * `locator_id` - (Forces new resource, String) A unique concatenation of catalogID.versionID that identifies the DA in the catalog. * Constraints: The maximum length is `512` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/`. - * `name` - (String) The configuration name. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. + * `name` - (String) The configuration name. It is unique within the account across projects and regions. + * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. * `settings` - (List) Schematics environment variables to use to deploy the configuration.Settings are only available if they were specified when the configuration was initially created. Nested schema for **settings**: - * `type` - (String) The type of a project configuration manual property. - * Constraints: Allowable values are: `terraform_template`, `schematics_blueprint`. * `is_draft` - (Boolean) The flag that indicates whether the version of the configuration is draft, or active. @@ -79,13 +77,13 @@ Nested schema for **definition**: * `modified_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. * `needs_attention_state` - (List) The needs attention state of a configuration. - * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. + * Constraints: The default value is `[]`. The maximum length is `50` items. The minimum length is `0` items. * `outputs` - (List) The outputs of a Schematics template property. - * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. + * Constraints: The default value is `[]`. The maximum length is `50` items. The minimum length is `0` items. Nested schema for **outputs**: * `description` - (String) A short explanation of the output value. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. * `name` - (String) The variable name. * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. * `value` - (String) Can be any value - a string, number, boolean, array, or object. @@ -93,7 +91,7 @@ Nested schema for **outputs**: * `project` - (List) The project referenced by this resource. Nested schema for **project**: * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. - * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. * `definition` - (List) The definition of the project reference. Nested schema for **definition**: * `name` - (String) The name of the project. @@ -103,8 +101,56 @@ Nested schema for **project**: * `id` - (String) The unique ID. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. -* `schematics` - (List) A schematics workspace associated to a project configuration. +* `schematics` - (List) A schematics workspace associated to a project configuration, with scripts. Nested schema for **schematics**: + * `deploy_post_script` - (List) A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy). + Nested schema for **deploy_post_script**: + * `path` - (String) The path to this script within the current version source. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^\\S+$/`. + * `short_description` - (String) The short description for this script. + * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `type` - (String) The type of the script. + * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. + * `deploy_pre_script` - (List) A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy). + Nested schema for **deploy_pre_script**: + * `path` - (String) The path to this script within the current version source. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^\\S+$/`. + * `short_description` - (String) The short description for this script. + * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `type` - (String) The type of the script. + * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. + * `undeploy_post_script` - (List) A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy). + Nested schema for **undeploy_post_script**: + * `path` - (String) The path to this script within the current version source. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^\\S+$/`. + * `short_description` - (String) The short description for this script. + * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `type` - (String) The type of the script. + * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. + * `undeploy_pre_script` - (List) A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy). + Nested schema for **undeploy_pre_script**: + * `path` - (String) The path to this script within the current version source. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^\\S+$/`. + * `short_description` - (String) The short description for this script. + * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `type` - (String) The type of the script. + * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. + * `validate_post_script` - (List) A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy). + Nested schema for **validate_post_script**: + * `path` - (String) The path to this script within the current version source. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^\\S+$/`. + * `short_description` - (String) The short description for this script. + * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `type` - (String) The type of the script. + * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. + * `validate_pre_script` - (List) A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy). + Nested schema for **validate_pre_script**: + * `path` - (String) The path to this script within the current version source. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^\\S+$/`. + * `short_description` - (String) The short description for this script. + * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `type` - (String) The type of the script. + * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. * `workspace_crn` - (String) An existing schematics workspace CRN. * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. diff --git a/website/docs/d/project_environment.html.markdown b/website/docs/d/project_environment.html.markdown new file mode 100644 index 0000000000..3b9420d3fe --- /dev/null +++ b/website/docs/d/project_environment.html.markdown @@ -0,0 +1,84 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_project_environment" +description: |- + Get information about project_environment +subcategory: "Projects" +--- + +# ibm_project_environment + +Provides a read-only data source to retrieve information about a project_environment. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```hcl +data "ibm_project_environment" "project_environment" { + project_environment_id = ibm_project_environment.project_environment.project_environment_id + project_id = ibm_project_environment.project_environment.project_id +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +* `project_environment_id` - (Required, Forces new resource, String) The environment ID. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. +* `project_id` - (Required, Forces new resource, String) The unique project ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +* `id` - The unique identifier of the project_environment. +* `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. + +* `definition` - (List) The environment definition. +Nested schema for **definition**: + * `authorizations` - (List) The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. + Nested schema for **authorizations**: + * `api_key` - (String) The IBM Cloud API Key. + * Constraints: The maximum length is `512` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^`<>\\x00-\\x1F]*$/`. + * `method` - (String) The authorization method. You can authorize by using a trusted profile or an API key in Secrets Manager. + * Constraints: Allowable values are: `api_key`, `trusted_profile`. + * `trusted_profile_id` - (String) The trusted profile ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `compliance_profile` - (List) The profile required for compliance. + Nested schema for **compliance_profile**: + * `attachment_id` - (String) A unique ID for the attachment to a compliance profile. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `id` - (String) The unique ID for that compliance profile. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `instance_id` - (String) A unique ID for an instance of a compliance profile. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `instance_location` - (String) The location of the compliance instance. + * Constraints: The maximum length is `12` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(us-south|us-east|eu-gb|eu-de)$/`. + * `profile_name` - (String) The name of the compliance profile. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^`<>\\x00-\\x1F]*$/`. + * `description` - (String) The description of the environment. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `inputs` - (List) The input variables for configuration definition and environment. + Nested schema for **inputs**: + * `name` - (String) The name of the environment. It is unique within the account across projects and regions. + * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + +* `modified_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. + +* `project` - (List) The project referenced by this resource. +Nested schema for **project**: + * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. + * `definition` - (List) The definition of the project reference. + Nested schema for **definition**: + * `name` - (String) The name of the project. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `id` - (String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + +* `target_account` - (String) The target account ID derived from the authentication block values. + * Constraints: The maximum length is `64` characters. The value must match regular expression `/^[a-zA-Z0-9.-]+$/`. + diff --git a/website/docs/r/project.html.markdown b/website/docs/r/project.html.markdown index 98926aaffd..b447a1d627 100644 --- a/website/docs/r/project.html.markdown +++ b/website/docs/r/project.html.markdown @@ -31,13 +31,13 @@ You can specify the following arguments for this resource. * `definition` - (Required, List) The definition of the project. Nested schema for **definition**: * `description` - (Optional, String) A brief explanation of the project's use in the configuration of a deployable architecture. It is possible to create a project without providing a description. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. * `destroy_on_delete` - (Required, Boolean) The policy that indicates whether the resources are destroyed or not when a project is deleted. - * `name` - (Required, String) The name of the project. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * `name` - (Required, String) The name of the project. It is unique within the account across regions. + * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. * `location` - (Required, Forces new resource, String) The IBM Cloud location where a resource is deployed. * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]*$/`. -* `resource_group` - (Required, Forces new resource, String) The resource group where the project's data and tools are created. +* `resource_group` - (Required, Forces new resource, String) The resource group name where the project's data and tools are created. * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]*$/`. ## Attribute Reference @@ -46,15 +46,15 @@ After your resource is created, you can read values from the listed arguments an * `id` - The unique identifier of the project. * `configs` - (List) The project configurations. These configurations are only included in the response of creating a project if a configs array is specified in the request payload. - * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. + * Constraints: The default value is `[]`. The maximum length is `100` items. The minimum length is `0` items. Nested schema for **configs**: * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. * `definition` - (List) The name and description of a project configuration. Nested schema for **definition**: * `description` - (String) A project configuration description. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. - * `name` - (String) The configuration name. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `name` - (String) The configuration name. It is unique within the account across projects and regions. + * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. * `href` - (String) A URL. * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. * `id` - (String) The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. @@ -63,7 +63,7 @@ Nested schema for **configs**: * `project` - (List) The project referenced by this resource. Nested schema for **project**: * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. - * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. * `definition` - (List) The definition of the project reference. Nested schema for **definition**: * `name` - (String) The name of the project. @@ -77,9 +77,9 @@ Nested schema for **configs**: * `version` - (Integer) The version of the configuration. * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. - * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. * `cumulative_needs_attention_view` - (List) The cumulative list of needs attention items for a project. If the view is successfully retrieved, an array which could be empty is returned. - * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. + * Constraints: The default value is `[]`. The maximum length is `50` items. The minimum length is `0` items. Nested schema for **cumulative_needs_attention_view**: * `config_id` - (String) A unique ID for the configuration. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. @@ -91,15 +91,15 @@ Nested schema for **cumulative_needs_attention_view**: * `cumulative_needs_attention_view_error` - (Boolean) True indicates that the fetch of the needs attention items failed. It only exists if there was an error while retrieving the cumulative needs attention view. * Constraints: The default value is `false`. * `environments` - (List) The project environments. These environments are only included in the response if project environments were created on the project. - * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. + * Constraints: The default value is `[]`. The maximum length is `20` items. The minimum length is `0` items. Nested schema for **environments**: * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. * `definition` - (List) The environment definition used in the project collection. Nested schema for **definition**: * `description` - (String) The description of the environment. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. - * `name` - (String) The name of the environment. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `name` - (String) The name of the environment. It is unique within the account across projects and regions. + * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. * `href` - (String) A URL. * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. * `id` - (String) The environment id as a friendly name. @@ -107,7 +107,7 @@ Nested schema for **environments**: * `project` - (List) The project referenced by this resource. Nested schema for **project**: * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. - * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. * `definition` - (List) The definition of the project reference. Nested schema for **definition**: * `name` - (String) The name of the project. @@ -118,15 +118,17 @@ Nested schema for **environments**: * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. * `event_notifications_crn` - (String) The CRN of the event notifications instance if one is connected to this project. * Constraints: The maximum length is `512` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. +* `resource_group_id` - (String) The resource group id where the project's data and tools are created. + * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^[0-9a-zA-Z]+$/`. * `state` - (String) The project status value. * Constraints: Allowable values are: `ready`, `deleting`, `deleting_failed`. ## Import -You can import the `ibm_project` resource by using `id`. The unique ID. +You can import the `ibm_project` resource by using `id`. The unique project ID. # Syntax -``` -$ terraform import ibm_project.project -``` +
+$ terraform import ibm_project.project <id>
+
diff --git a/website/docs/r/project_config.html.markdown b/website/docs/r/project_config.html.markdown index db20dac197..995dfa3570 100644 --- a/website/docs/r/project_config.html.markdown +++ b/website/docs/r/project_config.html.markdown @@ -16,7 +16,6 @@ Create, update, and delete project_configs with this resource. resource "ibm_project_config" "project_config_instance" { definition { name = "static-website-dev" - labels = [ "env:dev", "billing:internal" ] description = "Website - development" authorizations { method = "api_key" @@ -39,7 +38,7 @@ resource "ibm_project_config" "project_config_instance" { You can specify the following arguments for this resource. -* `definition` - (Required, List) The type and output of a project configuration. +* `definition` - (Required, List) The name and description of a project configuration. Nested schema for **definition**: * `authorizations` - (Optional, List) The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. Nested schema for **authorizations**: @@ -51,34 +50,80 @@ Nested schema for **definition**: * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. * `compliance_profile` - (Optional, List) The profile required for compliance. Nested schema for **compliance_profile**: - * `attachment_id` - (Optional, String) The unique ID. + * `attachment_id` - (Optional, String) A unique ID for the attachment to a compliance profile. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. - * `id` - (Optional, String) The unique ID. + * `id` - (Optional, String) The unique ID for that compliance profile. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. - * `instance_id` - (Optional, String) The unique ID. + * `instance_id` - (Optional, String) A unique ID for an instance of a compliance profile. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. * `instance_location` - (Optional, String) The location of the compliance instance. * Constraints: The maximum length is `12` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(us-south|us-east|eu-gb|eu-de)$/`. * `profile_name` - (Optional, String) The name of the compliance profile. * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^`<>\\x00-\\x1F]*$/`. * `description` - (Optional, String) A project configuration description. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. - * `environment` - (Optional, String) The ID of the project environment. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `environment_id` - (Optional, String) The ID of the project environment. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. * `inputs` - (Optional, List) The input variables for configuration definition and environment. Nested schema for **inputs**: - * `locator_id` - (Required, Forces new resource, String) A dotted value of catalogID.versionID. + * `locator_id` - (Required, Forces new resource, String) A unique concatenation of catalogID.versionID that identifies the DA in the catalog. * Constraints: The maximum length is `512` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/`. - * `name` - (Required, String) The configuration name. - * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. + * `name` - (Required, String) The configuration name. It is unique within the account across projects and regions. + * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. * `settings` - (Optional, List) Schematics environment variables to use to deploy the configuration.Settings are only available if they were specified when the configuration was initially created. Nested schema for **settings**: - * `type` - (Computed, String) The type of a project configuration manual property. - * Constraints: Allowable values are: `terraform_template`, `schematics_blueprint`. * `project_id` - (Required, Forces new resource, String) The unique project ID. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. -* `schematics` - (Optional, List) A schematics workspace associated to a project configuration. +* `schematics` - (Optional, List) A schematics workspace associated to a project configuration, with scripts. Nested schema for **schematics**: + * `deploy_post_script` - (Optional, List) A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy). + Nested schema for **deploy_post_script**: + * `path` - (Computed, String) The path to this script within the current version source. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^\\S+$/`. + * `short_description` - (Computed, String) The short description for this script. + * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `type` - (Computed, String) The type of the script. + * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. + * `deploy_pre_script` - (Optional, List) A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy). + Nested schema for **deploy_pre_script**: + * `path` - (Computed, String) The path to this script within the current version source. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^\\S+$/`. + * `short_description` - (Computed, String) The short description for this script. + * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `type` - (Computed, String) The type of the script. + * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. + * `undeploy_post_script` - (Optional, List) A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy). + Nested schema for **undeploy_post_script**: + * `path` - (Computed, String) The path to this script within the current version source. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^\\S+$/`. + * `short_description` - (Computed, String) The short description for this script. + * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `type` - (Computed, String) The type of the script. + * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. + * `undeploy_pre_script` - (Optional, List) A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy). + Nested schema for **undeploy_pre_script**: + * `path` - (Computed, String) The path to this script within the current version source. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^\\S+$/`. + * `short_description` - (Computed, String) The short description for this script. + * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `type` - (Computed, String) The type of the script. + * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. + * `validate_post_script` - (Optional, List) A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy). + Nested schema for **validate_post_script**: + * `path` - (Computed, String) The path to this script within the current version source. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^\\S+$/`. + * `short_description` - (Computed, String) The short description for this script. + * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `type` - (Computed, String) The type of the script. + * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. + * `validate_pre_script` - (Optional, List) A script to be run as part of a Project configuration, for a given stage (pre, post) and action (validate, deploy, undeploy). + Nested schema for **validate_pre_script**: + * `path` - (Computed, String) The path to this script within the current version source. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^\\S+$/`. + * `short_description` - (Computed, String) The short description for this script. + * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `type` - (Computed, String) The type of the script. + * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. * `workspace_crn` - (Optional, String) An existing schematics workspace CRN. * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. @@ -92,19 +137,19 @@ After your resource is created, you can read values from the listed arguments an * `last_saved_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. * `modified_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. * `needs_attention_state` - (List) The needs attention state of a configuration. - * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. + * Constraints: The default value is `[]`. The maximum length is `50` items. The minimum length is `0` items. * `outputs` - (List) The outputs of a Schematics template property. - * Constraints: The default value is `[]`. The maximum length is `10000` items. The minimum length is `0` items. + * Constraints: The default value is `[]`. The maximum length is `50` items. The minimum length is `0` items. Nested schema for **outputs**: * `description` - (String) A short explanation of the output value. - * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s).*\\S$/`. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. * `name` - (String) The variable name. * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. * `value` - (String) Can be any value - a string, number, boolean, array, or object. * `project` - (List) The project referenced by this resource. Nested schema for **project**: * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. - * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. * `definition` - (List) The definition of the project reference. Nested schema for **definition**: * `name` - (String) The name of the project. @@ -124,15 +169,15 @@ Nested schema for **project**: ## Import You can import the `ibm_project_config` resource by using `id`. -The `id` property can be formed from `project_id`, and `id` in the following format: +The `id` property can be formed from `project_id`, and `project_config_id` in the following format: -``` -/ -``` +
+<project_id>/<project_config_id>
+
* `project_id`: A string. The unique project ID. -* `id`: A string. The unique config ID. +* `project_config_id`: A string. The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. # Syntax -``` -$ terraform import ibm_project_config.project_config / -``` +
+$ terraform import ibm_project_config.project_config <project_id>/<project_config_id>
+
diff --git a/website/docs/r/project_environment.html.markdown b/website/docs/r/project_environment.html.markdown new file mode 100644 index 0000000000..f9783845eb --- /dev/null +++ b/website/docs/r/project_environment.html.markdown @@ -0,0 +1,103 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_project_environment" +description: |- + Manages project_environment. +subcategory: "Projects" +--- + +# ibm_project_environment + +Create, update, and delete project_environments with this resource. + +## Example Usage + +```hcl +resource "ibm_project_environment" "project_environment" { + definition { + name = "environment-stage" + description = "environment for stage project" + authorizations { + method = "api_key" + api_key = "" + } + } + project_id = ibm_project.project_instance.id +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +* `definition` - (Required, List) The environment definition. +Nested schema for **definition**: + * `authorizations` - (Optional, List) The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. + Nested schema for **authorizations**: + * `api_key` - (Optional, String) The IBM Cloud API Key. + * Constraints: The maximum length is `512` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^`<>\\x00-\\x1F]*$/`. + * `method` - (Optional, String) The authorization method. You can authorize by using a trusted profile or an API key in Secrets Manager. + * Constraints: Allowable values are: `api_key`, `trusted_profile`. + * `trusted_profile_id` - (Optional, String) The trusted profile ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `compliance_profile` - (Optional, List) The profile required for compliance. + Nested schema for **compliance_profile**: + * `attachment_id` - (Optional, String) A unique ID for the attachment to a compliance profile. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `id` - (Optional, String) The unique ID for that compliance profile. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `instance_id` - (Optional, String) A unique ID for an instance of a compliance profile. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + * `instance_location` - (Optional, String) The location of the compliance instance. + * Constraints: The maximum length is `12` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(us-south|us-east|eu-gb|eu-de)$/`. + * `profile_name` - (Optional, String) The name of the compliance profile. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^`<>\\x00-\\x1F]*$/`. + * `description` - (Optional, String) The description of the environment. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. + * `inputs` - (Optional, List) The input variables for configuration definition and environment. + Nested schema for **inputs**: + * `name` - (Required, String) The name of the environment. It is unique within the account across projects and regions. + * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. +* `project_id` - (Required, Forces new resource, String) The unique project ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. + +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +* `id` - The unique identifier of the project_environment. +* `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. +* `modified_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. +* `project` - (List) The project referenced by this resource. +Nested schema for **project**: + * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. + * `definition` - (List) The definition of the project reference. + Nested schema for **definition**: + * `name` - (String) The name of the project. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. + * `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `id` - (String) The unique ID. + * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. +* `project_environment_id` - (String) The environment id as a friendly name. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. +* `target_account` - (String) The target account ID derived from the authentication block values. + * Constraints: The maximum length is `64` characters. The value must match regular expression `/^[a-zA-Z0-9.-]+$/`. + + +## Import + +You can import the `ibm_project_environment` resource by using `id`. +The `id` property can be formed from `project_id`, and `project_environment_id` in the following format: + +
+<project_id>/<project_environment_id>
+
+* `project_id`: A string. The unique project ID. +* `project_environment_id`: A string. The environment id as a friendly name. + +# Syntax +
+$ terraform import ibm_project_environment.project_environment <project_id>/<project_environment_id>
+
From a45c8abbd0fbe3d4e27c804a5ec4b1318fe606ea Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Thu, 23 Nov 2023 03:30:33 -0600 Subject: [PATCH 067/132] Add workspace create workspace delete resource to terraform provider (#4935) * Add workspace-create workspace-delete terraform provider Add waiting to code to finish wait creating workspace Fix workspace delete Add workspace documentation Increase workspace create timeout Update workspace description Remove extra quotes Update dependencies Update dependencies temp * Update workspace documentation --------- Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com> Co-authored-by: HARINI KANTAREDDY --- go.mod | 6 +- go.sum | 12 +- ibm/acctest/acctest.go | 7 + ibm/provider/provider.go | 1 + ibm/service/power/ibm_pi_constants.go | 6 + .../power/resource_ibm_pi_workspace.go | 179 ++++++++++++++++++ .../power/resource_ibm_pi_workspace_test.go | 98 ++++++++++ website/docs/d/pi_workspace.html.markdown | 2 +- website/docs/d/pi_workspaces.html.markdown | 2 +- website/docs/r/pi_workspace.html.markdown | 49 +++++ 10 files changed, 351 insertions(+), 11 deletions(-) create mode 100644 ibm/service/power/resource_ibm_pi_workspace.go create mode 100644 ibm/service/power/resource_ibm_pi_workspace_test.go create mode 100644 website/docs/r/pi_workspace.html.markdown diff --git a/go.mod b/go.mod index e8fc7bf97e..0a3a27eacc 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/IBM-Cloud/bluemix-go v0.0.0-20231017073329-75ebe90c98ba github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c - github.com/IBM-Cloud/power-go-client v1.5.2 + github.com/IBM-Cloud/power-go-client v1.5.4 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca github.com/IBM/appconfiguration-go-admin-sdk v0.3.0 github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f @@ -17,14 +17,14 @@ require ( github.com/IBM/event-notifications-go-admin-sdk v0.2.7 github.com/IBM/eventstreams-go-sdk v1.4.0 github.com/IBM/go-sdk-core/v3 v3.2.4 - github.com/IBM/go-sdk-core/v5 v5.14.1 + github.com/IBM/go-sdk-core/v5 v5.15.0 github.com/IBM/ibm-cos-sdk-go v1.10.0 github.com/IBM/ibm-cos-sdk-go-config v1.2.0 github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20211109141421-a4b61b05f7d1 github.com/IBM/ibm-hpcs-uko-sdk v0.0.20-beta github.com/IBM/keyprotect-go-client v0.12.2 github.com/IBM/networking-go-sdk v0.42.2 - github.com/IBM/platform-services-go-sdk v0.53.1 + github.com/IBM/platform-services-go-sdk v0.54.0 github.com/IBM/project-go-sdk v0.1.1 github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 github.com/IBM/scc-go-sdk/v5 v5.1.3 diff --git a/go.sum b/go.sum index 58cfeff13e..c7f1a06c47 100644 --- a/go.sum +++ b/go.sum @@ -105,8 +105,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20231017073329-75ebe90c98ba/go.mod h1:mt+ github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c h1:tRS4VuOG3lHNG+yrsh3vZZQDVNLuFJB0oZbTJp9YXds= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs= -github.com/IBM-Cloud/power-go-client v1.5.2 h1:p8+vY9+wtr4BIa2+Y4EVI0jlvRg+FLWsbOpWYNlKXDw= -github.com/IBM-Cloud/power-go-client v1.5.2/go.mod h1:Vd8aSxWA30soUhE2U+tmzaYDUVNOmQE3/npny7BsN6Y= +github.com/IBM-Cloud/power-go-client v1.5.4 h1:fk+QgOdZvwq696UynehfGrMGMHXDYOJfRCE3Pec9o6c= +github.com/IBM-Cloud/power-go-client v1.5.4/go.mod h1:ZsKqKC4d4MAWujkttW1w9tG7xjlIbkIpVENX476ghVY= github.com/IBM-Cloud/softlayer-go v1.0.5-tf h1:koUAyF9b6X78lLLruGYPSOmrfY2YcGYKOj/Ug9nbKNw= github.com/IBM-Cloud/softlayer-go v1.0.5-tf/go.mod h1:6HepcfAXROz0Rf63krk5hPZyHT6qyx2MNvYyHof7ik4= github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca h1:crniVcf+YcmgF03NmmfonXwSQ73oJF+IohFYBwknMxs= @@ -139,8 +139,8 @@ github.com/IBM/go-sdk-core/v5 v5.7.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= -github.com/IBM/go-sdk-core/v5 v5.14.1 h1:WR1r0zz+gDW++xzZjF41r9ueY4JyjS2vgZjiYs8lO3c= -github.com/IBM/go-sdk-core/v5 v5.14.1/go.mod h1:MUvIr/1mgGh198ZXL+ByKz9Qs1JoEh80v/96x8jPXNY= +github.com/IBM/go-sdk-core/v5 v5.15.0 h1:AhFoWVk3i58f9vnDoEoZumI/zbtRoP5moWIz5YQOmZg= +github.com/IBM/go-sdk-core/v5 v5.15.0/go.mod h1:5Obavm/s1Tc2PxivEIfgCvj/HJ5h3QIOjLHS5y8QJf0= github.com/IBM/ibm-cos-sdk-go v1.3.1/go.mod h1:YLBAYobEA8bD27P7xpMwSQeNQu6W3DNBtBComXrRzRY= github.com/IBM/ibm-cos-sdk-go v1.10.0 h1:/2VIev2/jBei39OqU2+nSZQnoWJ+KtkiSAIDkqsd7uU= github.com/IBM/ibm-cos-sdk-go v1.10.0/go.mod h1:C8KRTRaoD3CWPPBOa6FCOpdh0ZMlUjKAAA4i3F+Q/sc= @@ -155,8 +155,8 @@ github.com/IBM/keyprotect-go-client v0.12.2 h1:Cjxcqin9Pl0xz3MnxdiVd4v/eIa79xL3h github.com/IBM/keyprotect-go-client v0.12.2/go.mod h1:yr8h2noNgU8vcbs+vhqoXp3Lmv73PI0zAc6VMgFvWwM= github.com/IBM/networking-go-sdk v0.42.2 h1:caqjx4jyFHi10Vlf3skHvlL6K3YJRVstsmCBmvdyqkA= github.com/IBM/networking-go-sdk v0.42.2/go.mod h1:lTUZwtUkMANMnrLHFIgRhHrkBfwASY/Iho1fabaPHxo= -github.com/IBM/platform-services-go-sdk v0.53.1 h1:axpK4dzlf+C+KgHQZWXoKSUMoV2t6OrR5kGGumUEXrI= -github.com/IBM/platform-services-go-sdk v0.53.1/go.mod h1:CWSprvsCsXWvujmBzbtoJSmbRZS9FVV3O594b0t/GiM= +github.com/IBM/platform-services-go-sdk v0.54.0 h1:WjHWm9ZAJvlq07E1WXXtEe+d/B0sazWD6cEWVT7EMLU= +github.com/IBM/platform-services-go-sdk v0.54.0/go.mod h1:CWSprvsCsXWvujmBzbtoJSmbRZS9FVV3O594b0t/GiM= github.com/IBM/project-go-sdk v0.1.1 h1:x1PkGUTkKpgxoXs/6IG4U1mk5BgaPEaRMVpXTs52rE4= github.com/IBM/project-go-sdk v0.1.1/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig= github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 h1:NPUhkoOCRuv3OFWt19PmwjXGGTKlvmbuPg9fUrBUNe4= diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 5e411830a7..bee8b7cb2b 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -199,6 +199,7 @@ var ( PiStoragePool string PiStorageType string Pi_shared_processor_pool_id string + Pi_resource_group_id string ) var ( @@ -1064,6 +1065,12 @@ func init() { fmt.Println("[WARN] Set the environment variable PI_SHARED_PROCESSOR_POOL_ID for testing ibm_pi_shared_processor_pool resource else it is set to default value 'tf-pi-shared-processor-pool'") } + Pi_resource_group_id = os.Getenv("PI_RESOURCE_GROUP_ID") + if Pi_resource_group_id == "" { + Pi_resource_group_id = "" + fmt.Println("[WARN] Set the environment variable PI_RESOURCE_GROUP_ID for testing ibm_pi_workspace resource else it is set to default value ''") + } + WorkspaceID = os.Getenv("SCHEMATICS_WORKSPACE_ID") if WorkspaceID == "" { WorkspaceID = "us-south.workspace.tf-acc-test-schematics-state-test.392cd99f" diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index 6ac2cd2804..9a0e61277b 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -1171,6 +1171,7 @@ func Provider() *schema.Provider { "ibm_pi_placement_group": power.ResourceIBMPIPlacementGroup(), "ibm_pi_spp_placement_group": power.ResourceIBMPISPPPlacementGroup(), "ibm_pi_shared_processor_pool": power.ResourceIBMPISharedProcessorPool(), + "ibm_pi_workspace": power.ResourceIBMPIWorkspace(), // Private DNS related resources "ibm_dns_zone": dnsservices.ResourceIBMPrivateDNSZone(), diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index ee62773462..8e66a4bd83 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -165,4 +165,10 @@ const ( Attr_DatacenterStatus = "pi_datacenter_status" Attr_DatacenterType = "pi_datacenter_type" Attr_DatacenterHref = "pi_datacenter_href" + + // IBM PI Workspace + PIWorkspaceName = "pi_name" + PIWorkspaceDatacenter = "pi_datacenter" + PIWorkspaceResourceGroup = "pi_resource_group_id" + PIWorkspacePlan = "pi_plan" ) diff --git a/ibm/service/power/resource_ibm_pi_workspace.go b/ibm/service/power/resource_ibm_pi_workspace.go new file mode 100644 index 0000000000..590f6ac657 --- /dev/null +++ b/ibm/service/power/resource_ibm_pi_workspace.go @@ -0,0 +1,179 @@ +package power + +import ( + "context" + "fmt" + "log" + "time" + + st "github.com/IBM-Cloud/power-go-client/clients/instance" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func ResourceIBMPIWorkspace() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIBMPIWorkspaceCreate, + ReadContext: resourceIBMPIWorkspaceRead, + DeleteContext: resourceIBMPIWorkspaceDelete, + Importer: &schema.ResourceImporter{}, + + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(30 * time.Minute), + Delete: schema.DefaultTimeout(30 * time.Minute), + }, + + Schema: map[string]*schema.Schema{ + PIWorkspaceName: { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "A descriptive name used to identify the workspace.", + }, + PIWorkspaceDatacenter: { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Target location or environment to create the resource instance.", + }, + PIWorkspaceResourceGroup: { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The ID of the resource group where you want to create the workspace. You can retrieve the value from data source ibm_resource_group.", + }, + PIWorkspacePlan: { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Plan associated with the offering; Valid values are public or private.", + }, + }, + } +} + +func resourceIBMPIWorkspaceCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + sess, err := meta.(conns.ClientSession).IBMPISession() + if err != nil { + return diag.FromErr(err) + } + + name := d.Get(PIWorkspaceName).(string) + datacenter := d.Get(PIWorkspaceDatacenter).(string) + resourceGroup := d.Get(PIWorkspaceResourceGroup).(string) + plan := d.Get(PIWorkspacePlan).(string) + + // No need for cloudInstanceID because we are creating a workspace + client := st.NewIBMPIWorkspacesClient(ctx, sess, "") + controller, _, err := client.Create(name, datacenter, resourceGroup, plan) + if err != nil { + log.Printf("[DEBUG] create workspace failed %v", err) + return diag.FromErr(err) + } + + d.SetId(*controller.GUID) + _, err = waitForResourceInstanceCreate(ctx, client, *controller.GUID, d.Timeout(schema.TimeoutCreate)) + if err != nil { + return diag.FromErr(err) + } + + return resourceIBMPIWorkspaceRead(ctx, d, meta) +} + +func waitForResourceInstanceCreate(ctx context.Context, client *st.IBMPIWorkspacesClient, id string, timeout time.Duration) (interface{}, error) { + stateConf := &resource.StateChangeConf{ + Pending: []string{"in progress", "inactive", "provisioning"}, + Target: []string{"active"}, + Refresh: isIBMPIWorkspaceCreateRefreshFunc(client, id), + Delay: 10 * time.Second, + MinTimeout: 1 * time.Minute, + Timeout: timeout, + } + return stateConf.WaitForStateContext(ctx) +} + +func isIBMPIWorkspaceCreateRefreshFunc(client *st.IBMPIWorkspacesClient, id string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + controller, _, err := client.GetRC(id) + if err != nil { + return nil, "", err + } + if *controller.State == "failed" { + return controller, *controller.State, fmt.Errorf("[ERROR] The resource instance %s failed to create", id) + } + return controller, *controller.State, nil + } +} + +func resourceIBMPIWorkspaceRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + // session + sess, err := meta.(conns.ClientSession).IBMPISession() + if err != nil { + return diag.FromErr(err) + } + + cloudInstanceID := d.Id() + client := st.NewIBMPIWorkspacesClient(ctx, sess, cloudInstanceID) + controller, _, err := client.GetRC(cloudInstanceID) + if err != nil { + return diag.FromErr(err) + } + d.Set(PIWorkspaceName, controller.Name) + + return nil +} + +func resourceIBMPIWorkspaceDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + sess, err := meta.(conns.ClientSession).IBMPISession() + if err != nil { + return diag.FromErr(err) + } + + cloudInstanceID := d.Id() + client := st.NewIBMPIWorkspacesClient(ctx, sess, cloudInstanceID) + response, err := client.Delete(cloudInstanceID) + if err != nil && response != nil && response.StatusCode == 410 { + return nil + } + _, err = waitForResourceInstanceDelete(ctx, client, cloudInstanceID, d.Timeout(schema.TimeoutDelete)) + if err != nil { + return diag.FromErr(err) + } + d.SetId("") + + return nil +} + +func waitForResourceInstanceDelete(ctx context.Context, client *st.IBMPIWorkspacesClient, id string, timeout time.Duration) (interface{}, error) { + stateConf := &resource.StateChangeConf{ + Pending: []string{"in progress", "inactive", "active"}, + Target: []string{"removed", "pending_reclamation"}, + Refresh: isIBMPIResourceDeleteRefreshFunc(client, id), + Delay: 10 * time.Second, + MinTimeout: 1 * time.Second, + Timeout: timeout, + } + return stateConf.WaitForStateContext(ctx) +} + +func isIBMPIResourceDeleteRefreshFunc(client *st.IBMPIWorkspacesClient, id string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + controller, response, err := client.GetRC(id) + if err != nil { + if response != nil && response.StatusCode == 404 { + return controller, "active", nil + } + return nil, "", err + } + if controller == nil { + return controller, "removed", nil + } else { + if *controller.State == "failed" { + return controller, *controller.State, fmt.Errorf("[ERROR] The resource instance %s failed to delete", id) + } + return controller, *controller.State, nil + } + } +} diff --git a/ibm/service/power/resource_ibm_pi_workspace_test.go b/ibm/service/power/resource_ibm_pi_workspace_test.go new file mode 100644 index 0000000000..d38062f794 --- /dev/null +++ b/ibm/service/power/resource_ibm_pi_workspace_test.go @@ -0,0 +1,98 @@ +package power_test + +import ( + "context" + "errors" + "fmt" + "strings" + "testing" + + st "github.com/IBM-Cloud/power-go-client/clients/instance" + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" +) + +func TestAccIBMPIWorkspaceBasic(t *testing.T) { + name := fmt.Sprintf("tf-pi-workspace-%d", acctest.RandIntRange(10, 100)) + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccIBMPIWorkspaceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMPIWorkspaceConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMPIWorkspaceExists("ibm_pi_workspace.powervs_service_instance"), + resource.TestCheckResourceAttrSet("ibm_pi_workspace.powervs_service_instance", "id"), + ), + }, + }, + }) +} + +func testAccCheckIBMPIWorkspaceConfig(name string) string { + return fmt.Sprintf(` + resource "ibm_pi_workspace" "powervs_service_instance" { + pi_name = "%[1]s" + pi_datacenter = "dal" + pi_resource_group_id = "%[2]s" + pi_plan = "public" + } + `, name, acc.Pi_resource_group_id) +} + +func testAccIBMPIWorkspaceDestroy(s *terraform.State) error { + sess, err := acc.TestAccProvider.Meta().(conns.ClientSession).IBMPISession() + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_pi_workspace" { + continue + } + cloudInstanceID := rs.Primary.ID + client := st.NewIBMPIWorkspacesClient(context.Background(), sess, cloudInstanceID) + workspace, resp, err := client.GetRC(cloudInstanceID) + if err == nil { + if *workspace.State == "active" { + return fmt.Errorf("Resource Instance still exists: %s", rs.Primary.ID) + } + } else { + if !strings.Contains(err.Error(), "404") { + return fmt.Errorf("[ERROR] Error checking if Resource Instance (%s) has been destroyed: %s with resp code: %s", rs.Primary.ID, err, resp) + } + } + } + return nil +} + +func testAccCheckIBMPIWorkspaceExists(n string) resource.TestCheckFunc { + return func(s *terraform.State) error { + + rs, ok := s.RootModule().Resources[n] + + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.ID == "" { + return errors.New("No Record ID is set") + } + + sess, err := acc.TestAccProvider.Meta().(conns.ClientSession).IBMPISession() + if err != nil { + return err + } + + cloudInstanceID := rs.Primary.ID + client := st.NewIBMPIWorkspacesClient(context.Background(), sess, cloudInstanceID) + _, _, err = client.GetRC(cloudInstanceID) + if err != nil { + return err + } + return nil + } +} diff --git a/website/docs/d/pi_workspace.html.markdown b/website/docs/d/pi_workspace.html.markdown index e82301e99b..af13d7f5f9 100644 --- a/website/docs/d/pi_workspace.html.markdown +++ b/website/docs/d/pi_workspace.html.markdown @@ -43,7 +43,7 @@ Review the argument references that you can specify for your data source. ## Attribute reference -In addition to all argument reference list, you can access the following attribute references after your data source is created. +In addition to all argument reference listed, you can access the following attribute references after your data source is created. - `id - (String) Workspace ID. - `pi_workspace_capabilities` - (Map) Workspace Capabilities. diff --git a/website/docs/d/pi_workspaces.html.markdown b/website/docs/d/pi_workspaces.html.markdown index 75acc3baba..7f220b5acb 100644 --- a/website/docs/d/pi_workspaces.html.markdown +++ b/website/docs/d/pi_workspaces.html.markdown @@ -43,7 +43,7 @@ Review the argument references that you can specify for your data source. ## Attribute reference -In addition to all argument reference list, you can access the following attribute references after your data source is created. +In addition to all argument reference listed, you can access the following attribute references after your data source is created. - `workspaces` - List of all Workspaces. Nested schema for `workspaces` diff --git a/website/docs/r/pi_workspace.html.markdown b/website/docs/r/pi_workspace.html.markdown new file mode 100644 index 0000000000..b17e5ca2a4 --- /dev/null +++ b/website/docs/r/pi_workspace.html.markdown @@ -0,0 +1,49 @@ +--- + +subcategory: "Power Systems" +layout: "ibm" +page_title: "IBM: pi_workspace" +description: |- + Manages a workspace in the Power Virtual Server cloud. +--- + +# ibm_pi_workspace + +Create or Delete a PowerVS Workspace + +## Example usage + +```terraform +data "ibm_resource_group" "group" { + name = "test" +} + +resource "ibm_pi_workspace" "powervs_service_instance" { + pi_name = "test-name" + pi_datacenter = "us-east" + pi_resource_group_id = data.ibm_resource_group.group.id + pi_plan = "public" +} +``` + +## Notes + +- Please find [supported Regions](https://cloud.ibm.com/apidocs/power-cloud#endpoint) for endpoints. +- If a Power cloud instance is provisioned at `lon04`, The provider level attributes should be as follows: + - `region` - `lon` + - `zone` - `lon04` + +## Argument reference + +Review the argument references that you can specify for your resource. + +- `pi_name` - (Required, String) A descriptive name used to identify the workspace. +- `pi_datacenter` - (Required, String) Target location or environment to create the resource instance. +- `pi_resource_group_id` - (Required, String) The ID of the resource group where you want to create the workspace. You can retrieve the value from data source `ibm_resource_group`. +- `pi_plan` - (Required, String) Plan associated with the offering; Valid values are `public` or `private`. + +## Attribute reference + +In addition to all argument reference listed, you can access the following attribute references after your resource source is created. + +- `id` - (String) Workspace ID. \ No newline at end of file From a23e7e783be579e1f645cee38178f323966b9b2d Mon Sep 17 00:00:00 2001 From: Arpit Srivastava Date: Thu, 23 Nov 2023 12:04:34 +0530 Subject: [PATCH 068/132] fix: CIS - remove deafult value for min_tls_version --- ibm/service/cis/resource_ibm_cis_domain_settings.go | 1 - ibm/service/cis/resource_ibm_cis_tls_settings.go | 1 - metadata/provider_metadata.json | 2 -- 3 files changed, 4 deletions(-) diff --git a/ibm/service/cis/resource_ibm_cis_domain_settings.go b/ibm/service/cis/resource_ibm_cis_domain_settings.go index 5a83a01ae0..47bb6046a7 100644 --- a/ibm/service/cis/resource_ibm_cis_domain_settings.go +++ b/ibm/service/cis/resource_ibm_cis_domain_settings.go @@ -127,7 +127,6 @@ func ResourceIBMCISSettings() *schema.Resource { ValidateFunc: validate.InvokeValidator( ibmCISDomainSettings, cisDomainSettingsTLSVersionValidatorID), - Default: "1.1", }, cisDomainSettingsCNAMEFlattening: { Type: schema.TypeString, diff --git a/ibm/service/cis/resource_ibm_cis_tls_settings.go b/ibm/service/cis/resource_ibm_cis_tls_settings.go index d6552318bc..76fab72351 100644 --- a/ibm/service/cis/resource_ibm_cis_tls_settings.go +++ b/ibm/service/cis/resource_ibm_cis_tls_settings.go @@ -56,7 +56,6 @@ func ResourceIBMCISTLSSettings() *schema.Resource { Description: "Minimum version of TLS required", Optional: true, ValidateFunc: validate.InvokeValidator(ibmCISTLSSettings, cisTLSSettingsMinTLSVersion), - Default: "1.1", }, }, Create: resourceCISTLSSettingsUpdate, diff --git a/metadata/provider_metadata.json b/metadata/provider_metadata.json index 595fc1b0cd..35b141da83 100644 --- a/metadata/provider_metadata.json +++ b/metadata/provider_metadata.json @@ -94360,7 +94360,6 @@ "name": "min_tls_version", "type": "TypeString", "description": "Minimum version of TLS required", - "default_value": "1.1", "optional": true }, { @@ -96013,7 +96012,6 @@ "name": "min_tls_version", "type": "TypeString", "description": "Minimum version of TLS required", - "default_value": "1.1", "options": "1.1, 1.2, 1.3, 1.4", "optional": true } From cc498aeaa22a04782cb5f96288db44270bda6bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Ill=C3=A9s?= Date: Thu, 23 Nov 2023 13:06:16 +0100 Subject: [PATCH 069/132] i4745 - add optional account id to kms config (#4944) * add account_id to kms_config * use bluemix-go@v0.0.0-20231123082353-50e8cc9c6959 --------- Co-authored-by: Zoltan Illes --- go.mod | 2 +- go.sum | 11 +++++----- .../resource_ibm_container_cluster.go | 11 ++++++++++ .../resource_ibm_container_vpc_cluster.go | 11 ++++++++++ ...resource_ibm_container_vpc_cluster_test.go | 21 +++++++++++++++++-- .../docs/r/container_cluster.html.markdown | 3 ++- .../r/container_vpc_cluster.html.markdown | 11 +++++----- 7 files changed, 56 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index 0a3a27eacc..3bb6d00084 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/IBM-Cloud/terraform-provider-ibm go 1.18 require ( - github.com/IBM-Cloud/bluemix-go v0.0.0-20231017073329-75ebe90c98ba + github.com/IBM-Cloud/bluemix-go v0.0.0-20231123082353-50e8cc9c6959 github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c github.com/IBM-Cloud/power-go-client v1.5.4 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca diff --git a/go.sum b/go.sum index c7f1a06c47..2deeef865a 100644 --- a/go.sum +++ b/go.sum @@ -100,8 +100,8 @@ github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3 github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/IBM-Cloud/bluemix-go v0.0.0-20231017073329-75ebe90c98ba h1:8U4HByOYJiaGWBpGjdRIzyzu0NBzjywh//CZnSbEsPw= -github.com/IBM-Cloud/bluemix-go v0.0.0-20231017073329-75ebe90c98ba/go.mod h1:mt+O8ryLVANrBKlA4RxKdENp3q6Q7mKQIi2nkiibZbU= +github.com/IBM-Cloud/bluemix-go v0.0.0-20231123082353-50e8cc9c6959 h1:dvvI4ybsYx6M7fFGrg3HjlNnYxEBi9jJdSU0JhjJbG8= +github.com/IBM-Cloud/bluemix-go v0.0.0-20231123082353-50e8cc9c6959/go.mod h1:jIGLnIfj+uBv2ALz3rVHzNbNwt0V/bEWNeJKECa8Q+k= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c h1:tRS4VuOG3lHNG+yrsh3vZZQDVNLuFJB0oZbTJp9YXds= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs= @@ -1269,8 +1269,8 @@ github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxe github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k= github.com/onsi/ginkgo/v2 v2.9.7/go.mod h1:cxrmXWykAwTwhQsJOPfdIDiJ+l2RYq7U8hFU+M/1uw0= github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= -github.com/onsi/ginkgo/v2 v2.12.0 h1:UIVDowFPwpg6yMUpPjGkYvf06K3RAiJXUhCxEwQVHRI= -github.com/onsi/ginkgo/v2 v2.12.0/go.mod h1:ZNEzXISYlqpb8S36iN71ifqLi3vVD1rVJGvWRCJOUpQ= +github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= @@ -1301,8 +1301,8 @@ github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+q github.com/onsi/gomega v1.27.7/go.mod h1:1p8OOlwo2iUUDsHnOrjE5UKYJ+e3W8eQ3qSlRahPmr4= github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= -github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8= github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= +github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= @@ -1935,6 +1935,7 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= diff --git a/ibm/service/kubernetes/resource_ibm_container_cluster.go b/ibm/service/kubernetes/resource_ibm_container_cluster.go index 2d786d3824..37d74326fa 100644 --- a/ibm/service/kubernetes/resource_ibm_container_cluster.go +++ b/ibm/service/kubernetes/resource_ibm_container_cluster.go @@ -122,6 +122,11 @@ func ResourceIBMContainerCluster() *schema.Resource { Default: false, Description: "Specify this option to use the KMS public service endpoint.", }, + "account_id": { + Type: schema.TypeString, + Optional: true, + Description: "Account ID of KMS instance holder - if not provided, defaults to the account in use", + }, }, }, }, @@ -1047,6 +1052,12 @@ func resourceIBMContainerClusterUpdate(d *schema.ResourceData, meta interface{}) endpoint := privateEndpoint.(bool) kmsConfig.PrivateEndpoint = endpoint } + + //Read optional account id + if accountid := kmsMap["account_id"]; accountid != nil { + accountid_string := accountid.(string) + kmsConfig.AccountID = accountid_string + } } } diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go index e05e29dbeb..944f8f074f 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go @@ -96,6 +96,11 @@ func ResourceIBMContainerVpcCluster() *schema.Resource { Default: false, Description: "Specify this option to use the KMS public service endpoint.", }, + "account_id": { + Type: schema.TypeString, + Optional: true, + Description: "Account ID of KMS instance holder - if not provided, defaults to the account in use", + }, }, }, }, @@ -685,6 +690,12 @@ func resourceIBMContainerVpcClusterUpdate(d *schema.ResourceData, meta interface endpoint := privateEndpoint.(bool) kmsConfig.PrivateEndpoint = endpoint } + + //Read optional account id + if accountid := kmsMap["account_id"]; accountid != nil { + accountid_string := accountid.(string) + kmsConfig.AccountID = accountid_string + } } } diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster_test.go b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster_test.go index e565eaf810..ad067026ae 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster_test.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster_test.go @@ -464,7 +464,7 @@ func TestAccIBMContainerVpcClusterBaseEnvvar(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "wait_till", "update_all_workers", "kms_config", "force_delete_storage", "wait_for_worker_update"}, + "wait_till", "update_all_workers", "kms_config", "force_delete_storage", "wait_for_worker_update", "albs"}, }, }, }) @@ -512,7 +512,22 @@ func testAccCheckIBMContainerVpcClusterEnvvar(name string) string { // export IBM_CLUSTER_VPC_ID // export IBM_CLUSTER_VPC_SUBNET_ID // export IBM_CLUSTER_VPC_RESOURCE_GROUP_ID +// optionally for kms and cross account kms: +// export IBM_KMS_INSTANCE_ID +// export IBM_CRK_ID +// for cross account kms: +// export IBM_KMS_ACCOUNT_ID func testAccCheckIBMContainerVpcClusterBaseEnvvar(name string) string { + var kmsConfig string + if acc.KmsInstanceID != "" { + kmsConfig = fmt.Sprintf(` + kms_config { + instance_id = "%[1]s" + crk_id = "%[2]s" + account_id = "%[3]s" + } + `, acc.KmsInstanceID, acc.CrkID, acc.KmsAccountID) + } config := fmt.Sprintf(` resource "ibm_container_vpc_cluster" "cluster" { name = "%[1]s" @@ -525,8 +540,10 @@ func testAccCheckIBMContainerVpcClusterBaseEnvvar(name string) string { name = "us-south-1" } wait_till = "normal" + %[5]s } - `, name, acc.IksClusterVpcID, acc.IksClusterResourceGroupID, acc.IksClusterSubnetID) + `, name, acc.IksClusterVpcID, acc.IksClusterResourceGroupID, acc.IksClusterSubnetID, kmsConfig) + fmt.Println(config) return config } diff --git a/website/docs/r/container_cluster.html.markdown b/website/docs/r/container_cluster.html.markdown index 0857c6e2eb..3e93cde3d7 100644 --- a/website/docs/r/container_cluster.html.markdown +++ b/website/docs/r/container_cluster.html.markdown @@ -204,12 +204,13 @@ Review the argument references that you can specify for your resource. - `hardware` - (Optional, Forces new resource, String) The level of hardware isolation for your worker node. Use `dedicated` to have available physical resources dedicated to you only, or `shared` to allow physical resources to be shared with other IBM customers. This option is available for virtual machine worker node flavors only. - `image_security_enforcement` - (Optional, Bool) Set to **true** to enable image security enforcement policies in a cluster. - `gateway_enabled` - (Optional, Bool) Set to **true** if you want to automatically create a gateway-enabled cluster. If `gateway_enabled` is set to **true**, then `private_service_endpoint` must be set to **true** at the same time. -- `kms_config` - (Optional, List) Used to attach a Key Protect instance to a cluster. Nested `kms_config` block have `instance_id`, `crk_id`, `private_endpoint` structure. +- `kms_config` - (Optional, List) Used to attach a Key Protect instance to a cluster. Nested `kms_config` block has an `instance_id`, `crk_id`, `private_endpoint` and `account_id`. Nested scheme for `kms_config`: - `crk_id` - (Optional, String) The ID of the customer root key (CRK). - `instance_id` - (Optional, String) The GUID of the Key Protect instance. - `private_endpoint` - (Optional, Bool) Set to **true** to configure the KMS private service endpoint. Default value is **false**. + - `account_id` - (Optional, String) Account ID of KMS instance holder - if not provided, defaults to the account in use. - `kube_version` - (Optional, String) The Kubernetes or OpenShift version that you want to set up in your cluster. If the version is not specified, the default version in [IBM Cloud Kubernetes Service](https://cloud.ibm.com/docs/containers?topic=containers-cs_versions) or [Red Hat OpenShift on IBM Cloud](https://cloud.ibm.com/docs/openshift?topic=openshift-openshift_versions#version_types) is used. For example, to specify Kubernetes version 1.16, enter `1.16`. For OpenShift clusters, you can specify version `3.11_openshift` or `4.3.1_openshift`. - `labels`- (Optional, Map) Labels on all the workers in the default worker pool. - `machine_type` - (Optional, Forces new resource, String) The machine type for your worker node. The machine type determines the amount of memory, CPU, and disk space that is available to the worker node. For an overview of supported machine types, see [Planning your worker node setup](https://cloud.ibm.com/docs/containers?topic=containers-planning_worker_nodes). You can retrieve the value by executing the `ibmcloud ks machine-types ` command in the IBM Cloud CLI. diff --git a/website/docs/r/container_vpc_cluster.html.markdown b/website/docs/r/container_vpc_cluster.html.markdown index ae738215c6..76c36336b5 100644 --- a/website/docs/r/container_vpc_cluster.html.markdown +++ b/website/docs/r/container_vpc_cluster.html.markdown @@ -178,13 +178,14 @@ Review the argument references that you can specify for your resource. - `flavor` - (Required, Forces new resource, String) The flavor of the VPC worker node that you want to use. - `image_security_enforcement` - (Optional, Bool) Set to **true** to enable image security enforcement policies in a cluster. - `name` - (Required, Forces new resource, String) The name of the cluster. -- `kms_config` - (Optional, String) Use to attach a Key Protect instance to a cluster. Nested `kms_config` block has an `instance_id`, `crk_id`, `private_endpoint`. -- `host_pool_id` - (Optional, String) If provided, the cluster will be associated with a dedicated host pool identified by this ID. +- `kms_config` - (Optional, String) Use to attach a Key Protect instance to a cluster. Nested `kms_config` block has an `instance_id`, `crk_id`, `private_endpoint` and `account_id`. Nested scheme for `kms_config`: - `crk_id` - (Optional, String) The ID of the customer root key (CRK). - `instance_id` - (Optional, String) The GUID of the Key Protect instance. - `private_endpoint` - (Optional, Bool) Set **true** to configure the KMS private service endpoint. Default value is **false**. + - `account_id` - (Optional, String) Account ID of KMS instance holder - if not provided, defaults to the account in use. +- `host_pool_id` - (Optional, String) If provided, the cluster will be associated with a dedicated host pool identified by this ID. - `kube_version` - (Optional, String) Specify the Kubernetes version, including the major.minor version. If you do not include this flag, the default version is used. To see available versions, run `ibmcloud ks versions`. - `operating_system` - (Optional, Forces new resource, String) The operating system of the workers in the default worker pool. For supported options, see [Red Hat OpenShift on IBM Cloud version information](https://cloud.ibm.com/docs/openshift?topic=openshift-openshift_versions) or [IBM Cloud Kubernetes Service version information](https://cloud.ibm.com/docs/containers?topic=containers-cs_versions). - `secondary_storage` - (Optional, Forces new resource, String) The secondary storage option for the default worker pool. @@ -213,9 +214,9 @@ Review the argument references that you can specify for your resource. - `name` - (Required, Forces new resource, String) The zone name for the default worker pool in a multizone cluster. - `subnet_id` - (Required, Forces new resource, String) The VPC subnet to assign the cluster's default worker pool. -- `crk` - Root Key ID for boot volume encryption. -- `kms_instance_id` - Instance ID for boot volume encryption. -- `kms_account_id` - Account ID for boot volume encryption, if other account is providing the kms. +- `crk` - (Optional, String) Root Key ID for boot volume encryption. +- `kms_instance_id` - (Optional, String) Instance ID for boot volume encryption. +- `kms_account_id` - (Optional, String) Account ID for boot volume encryption, if other account is providing the kms. **Note** From 06a9ed7c917ea8cbb2c2183e9509c078ff2cf87f Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Thu, 23 Nov 2023 08:03:21 -0600 Subject: [PATCH 070/132] Update Power Workspace/s and Datacenter/s DataSource Documentation (#4904) * Update Power Workspace/s and Datacenter/s DataSource - Update doc for get and getall workspace and datacenter * update power-go-client to v1.5.4 --------- Co-authored-by: HARINI KANTAREDDY --- website/docs/d/pi_datacenter.html.markdown | 14 +++++--------- website/docs/d/pi_datacenters.html.markdown | 14 +++++--------- website/docs/d/pi_workspace.html.markdown | 16 ++++++---------- website/docs/d/pi_workspaces.html.markdown | 14 +++++--------- 4 files changed, 21 insertions(+), 37 deletions(-) diff --git a/website/docs/d/pi_datacenter.html.markdown b/website/docs/d/pi_datacenter.html.markdown index 36cdd88493..8076d2188f 100644 --- a/website/docs/d/pi_datacenter.html.markdown +++ b/website/docs/d/pi_datacenter.html.markdown @@ -45,14 +45,10 @@ Review the argument references that you can specify for your data source. In addition to all argument reference list, you can access the following attribute references after your data source is created. -- `pi_datacenter_capabilities` - (Map) Datacenter Capabilities. +- `pi_datacenter_capabilities` - (Map) Datacenter Capabilities. Capabilities are `true` or `false`. - Nested schema for `pi_datacenter_capabilities`: - - `cloud-connections` - (Bool) Cloud-connections capability. - - `disaster-recovery-site` - (Bool) Disaster recovery site. - - `power-edge-router` - (Bool) Power edge router capability. - - `vpn-connections`- (Bool) VPN-connections capability. - - `sysdig-enabled`- (Bool) Sysdig-enabled capability. + Some of `pi_datacenter_capabilities` are: + - `cloud-connections`, `disaster-recovery-site`, `metrics`, `power-edge-router`, `power-vpn-connections` - `pi_datacenter_location` - (Map) Datacenter location. @@ -60,5 +56,5 @@ In addition to all argument reference list, you can access the following attribu - `region` - (String) The Datacenter location region zone. - `type` - (String) The Datacenter location region type. - `url`- (String) The Datacenter location region url. -- `pi_datacenter_status` - (String) The Datacenter status, `ACTIVE`,`MAINTENANCE` or `DOWN`. -- `pi_datacenter_type` - (String) The Datacenter type, `Public Cloud` or `Private Cloud`. +- `pi_datacenter_status` - (String) The Datacenter status, `active`,`maintenance` or `down`. +- `pi_datacenter_type` - (String) The Datacenter type, `off-premises` or `on-premises`. diff --git a/website/docs/d/pi_datacenters.html.markdown b/website/docs/d/pi_datacenters.html.markdown index 3d56abeca3..812b0a75f3 100644 --- a/website/docs/d/pi_datacenters.html.markdown +++ b/website/docs/d/pi_datacenters.html.markdown @@ -42,14 +42,10 @@ In addition to all argument reference list, you can access the following attribu - `datacenters` - List of Datacenters Nested schema for `datacenters` - - `pi_datacenter_capabilities` - (Map) Datacenter Capabilities. + - `pi_datacenter_capabilities` - (Map) Datacenter Capabilities. Capabilities are `true` or `false`. - Nested schema for `pi_datacenter_capabilities`; are (Bool) `true` or `false`: - - `cloud-connections` - (Bool) Cloud-connections capability. - - `disaster-recovery-site` - (Bool) Disaster recovery site. - - `power-edge-router` - (Bool) Power edge router capability. - - `vpn-connections`- (Bool) VPN-connections capability. - - `sysdig-enabled`- (Bool) Sysdig-enabled capability. + Some of `pi_datacenter_capabilities` are: + - `cloud-connections`, `disaster-recovery-site`, `metrics`, `power-edge-router`, `power-vpn-connections` - `pi_datacenter_location` - (Map) Datacenter location. @@ -57,5 +53,5 @@ In addition to all argument reference list, you can access the following attribu - `region` - (String) The Datacenter location region zone. - `type` - (String) The Datacenter location region type. - `url`- (String) The Datacenter location region url. - - `pi_datacenter_status` - (String) The Datacenter status, `ACTIVE`,`MAINTENANCE` or `DOWN`. - - `pi_datacenter_type` - (String) The Datacenter type, `Public Cloud` or `Private Cloud`. + - `pi_datacenter_status` - (String) The Datacenter status, `active`,`maintenance` or `down`. + - `pi_datacenter_type` - (String) The Datacenter type, `off-premises` or `on-premises`. diff --git a/website/docs/d/pi_workspace.html.markdown b/website/docs/d/pi_workspace.html.markdown index af13d7f5f9..1b3195f016 100644 --- a/website/docs/d/pi_workspace.html.markdown +++ b/website/docs/d/pi_workspace.html.markdown @@ -45,15 +45,11 @@ Review the argument references that you can specify for your data source. In addition to all argument reference listed, you can access the following attribute references after your data source is created. -- `id - (String) Workspace ID. -- `pi_workspace_capabilities` - (Map) Workspace Capabilities. +- `id` - (String) Workspace ID. +- `pi_workspace_capabilities` - (Map) Workspace Capabilities. Capabilities are `true` or `false`. - Nested schema for `pi_workspace_capabilities`: - - `cloud-connections` - (Bool) Cloud-connections capability. - - `custom-virtual-cores`- (Bool) Custom virtual cores capability. - - `power-edge-router` - (Bool) Power edge router capability. - - `transit-gateway-connection` - (Bool) Transit gateway connection capability. - - `vpn-connections`- (Bool) VPN-connections capability. + Some of `pi_workspace_capabilities` are: + - `cloud-connections`, `power-edge-router`, `power-vpn-connections`, `transit-gateway-connection` - `pi_workspace_details` - (Map) Workspace information. @@ -67,5 +63,5 @@ In addition to all argument reference listed, you can access the following attri - `type` - (String) The Workspace location region type. - `url`- (String) The Workspace location region url. - `pi_workspace_name` - (String) The Workspace name. -- `pi_workspace_status` - (String) The Workspace status, `ACTIVE` or `FAILED`. -- `pi_workspace_type` - (String) The Workspace type, `Public Cloud` or `Private Cloud`. +- `pi_workspace_status` - (String) The Workspace status, `active`, `critical`, `failed`, `provisioning`. +- `pi_workspace_type` - (String) The Workspace type, `off-premises` or `on-premises`. diff --git a/website/docs/d/pi_workspaces.html.markdown b/website/docs/d/pi_workspaces.html.markdown index 7f220b5acb..12ca699246 100644 --- a/website/docs/d/pi_workspaces.html.markdown +++ b/website/docs/d/pi_workspaces.html.markdown @@ -47,14 +47,10 @@ In addition to all argument reference listed, you can access the following attri - `workspaces` - List of all Workspaces. Nested schema for `workspaces` - - `pi_workspace_capabilities` - (Map) Workspace Capabilities. + - `pi_workspace_capabilities` - (Map) Workspace Capabilities. Capabilities are `true` or `false`. - Nested schema for `pi_workspace_capabilities`; are (Bool) `true` or `false`: - - `cloud-connections` - (Bool) Cloud-connections capability. - - `custom-virtual-cores`- (Bool) Custom virtual cores capability. - - `power-edge-router` - (Bool) Power edge router capability. - - `transit-gateway-connection` - (Bool) Transit gateway connection capability. - - `vpn-connections`- (Bool) VPN-connections capability. + Some of `pi_workspace_capabilities` are: + - `cloud-connections` ,`power-edge-router`, `power-vpn-connections`, `transit-gateway-connection` - `pi_workspace_details` - (Map) Workspace information. @@ -69,5 +65,5 @@ In addition to all argument reference listed, you can access the following attri - `type` - (String) The Workspace location region type. - `url`- (String) The Workspace location region url. - `pi_workspace_name` - (String) The Workspace name. - - `pi_workspace_status` - (String) The Workspace status, `ACTIVE` or `FAILED`. - - `pi_workspace_type` - (String) The Workspace type, `Public Cloud` or `Private Cloud`. + - `pi_workspace_status` - (String) The Workspace status, `active`, `critical`, `failed`, `provisioning`. + - `pi_workspace_type` - (String) The Workspace type, `off-premises` or `on-premises`. From e76645b3032e02d3404af6062e9a821636a1a865 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar <78945437+ujjwal-ibm@users.noreply.github.com> Date: Thu, 23 Nov 2023 19:34:55 +0530 Subject: [PATCH 071/132] fix(is_instance): validation on encryption with catalog images fixed (#4940) --- ibm/service/vpc/resource_ibm_is_instance.go | 2 +- .../vpc/resource_ibm_is_instance_test.go | 96 +++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/ibm/service/vpc/resource_ibm_is_instance.go b/ibm/service/vpc/resource_ibm_is_instance.go index 4e0ea22921..2debbf2734 100644 --- a/ibm/service/vpc/resource_ibm_is_instance.go +++ b/ibm/service/vpc/resource_ibm_is_instance.go @@ -625,7 +625,7 @@ func ResourceIBMISInstance() *schema.Resource { ForceNew: true, Computed: true, RequiredWith: []string{isInstanceZone, isInstancePrimaryNetworkInterface, isInstanceProfile, isInstanceKeys, isInstanceVPC}, - AtLeastOneOf: []string{isInstanceImage, isInstanceSourceTemplate, "boot_volume.0.volume_id", "boot_volume.0.snapshot"}, + AtLeastOneOf: []string{isInstanceImage, isInstanceSourceTemplate, "boot_volume.0.volume_id", "boot_volume.0.snapshot", "catalog_offering.0.offering_crn", "catalog_offering.0.version_crn"}, ConflictsWith: []string{isInstanceImage, isInstanceSourceTemplate, "boot_volume.0.snapshot", "boot_volume.0.name", "boot_volume.0.encryption", "catalog_offering.0.offering_crn", "catalog_offering.0.version_crn"}, Description: "The unique identifier for this volume", }, diff --git a/ibm/service/vpc/resource_ibm_is_instance_test.go b/ibm/service/vpc/resource_ibm_is_instance_test.go index 5bac59cff7..6d0b0055b8 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_test.go +++ b/ibm/service/vpc/resource_ibm_is_instance_test.go @@ -75,6 +75,48 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE }, }) } +func TestAccIBMISInstance_enc_catalog(t *testing.T) { + var instance string + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-instnace-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tf-subnet-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(` +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR +`) + sshname := fmt.Sprintf("tf-ssh-%d", acctest.RandIntRange(10, 100)) + resourceName := fmt.Sprintf("tf-cosresource-%d", acctest.RandIntRange(10, 100)) + keyName := fmt.Sprintf("tf-key-%d", acctest.RandIntRange(10, 100)) + userData1 := "a" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMISInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISInstanceCatEncryptionConfig(vpcname, subnetname, sshname, publicKey, name, userData1, resourceName, keyName), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMISInstanceExists("ibm_is_instance.testacc_instance", instance), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "name", name), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "user_data", userData1), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "zone", acc.ISZoneName), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "vcpu.#"), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "vcpu.0.manufacturer"), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "boot_volume.0.encryption"), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "catalog_offering.0.version_crn"), + ), + }, + }, + }) +} + func TestAccIBMISInstance_lifecycle(t *testing.T) { var instance string vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) @@ -1048,6 +1090,60 @@ func testAccCheckIBMISInstanceConfig(vpcname, subnetname, sshname, publicKey, na } }`, vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, sshname, publicKey, name, acc.IsImage, acc.InstanceProfileName, userData, acc.ISZoneName) } +func testAccCheckIBMISInstanceCatEncryptionConfig(vpcname, subnetname, sshname, publicKey, name, userData, resourceName, keyName string) string { + return fmt.Sprintf(` + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + ipv4_cidr_block = "%s" + } + + resource "ibm_is_ssh_key" "testacc_sshkey" { + name = "%s" + public_key = "%s" + } + data ibm_is_images testacc_images { + catalog_managed = true + } + resource "ibm_resource_instance" "testacc_resource" { + name = "%s" + service = "kms" + plan = "tiered-pricing" + location = "%s" + } + resource "ibm_kms_key" "testacc_key" { + instance_id = "${ibm_resource_instance.testacc_resource.guid}" + key_name = "%s" + standard_key = false + force_delete = true + } + resource "ibm_is_instance" "testacc_instance" { + name = "%s" + catalog_offering { + version_crn = data.ibm_is_images.testacc_images.images.1.catalog_offering.0.version.0.crn + } + boot_volume { + encryption = ibm_kms_key.testacc_key.crn + } + profile = "%s" + primary_network_interface { + subnet = ibm_is_subnet.testacc_subnet.id + } + user_data = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + keys = [ibm_is_ssh_key.testacc_sshkey.id] + network_interfaces { + subnet = ibm_is_subnet.testacc_subnet.id + name = "eth1" + } + }`, vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, sshname, publicKey, resourceName, acc.RegionName, keyName, name, acc.InstanceProfileName, userData, acc.ISZoneName) +} func testAccCheckIBMISInstanceRipConfig(vpcname, subnetname, subnetripname, sshname, publicKey, name, userData string) string { return fmt.Sprintf(` From 023d613b713dbbeb73850c47f5178ed06d2b5b77 Mon Sep 17 00:00:00 2001 From: hkantare Date: Thu, 23 Nov 2023 20:08:58 +0530 Subject: [PATCH 072/132] udpate CHANGELOG --- CHANGELOG.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f833c365fa..90e72694bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,45 @@ +# 1.60.0-beta1 (Nov 23, 2023) +Features +* Support for Projects + - **Datasources** + - ibm_project + - ibm_project_config + - ibm_project_environment + - **Resources** + - ibm_project + - ibm_project_config + - ibm_project_environment + +* Support for Code Engine + - **Datasources** + - ibm_code_engine_domain_mapping + - **Resources** + - ibm_code_engine_domain_mapping + +* Support for Power Instance + - **Resources** + - ibm_pi_workspace + +Enhancements +* support offline restore for MongoDB EE PITR ([4601](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4601)) +* bump ContinuousDelivery Go SDK version ([4918](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4918)) +* Added nest conditions to rule.conditions IAM Policies ([4896](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4896)) +* Updates to SCC tool ([4920](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4920)) +* Add entitlement option to Satellite cluster/workerpool create ([4894](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4894)) +* VPC ID Filter is added when Subnet Name is specified ([4892](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4892)) +* add optional account id to kms config ([4944](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4944)) + +BugFixes +* resolved nil pointer issue on vpn gateway resource ([4903](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4903)) +* Private/direct COS endpoint settings conflicts with IBM Cloud docs, VPE options, and COS config endpoint ([4919](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4919)) +* add missing required argument name to the doc ([4909](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4909)) +* Fix wrong sintax in doc for Ingress Secret Opaque ([4917](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4917)) +* schematics agent doc fixes ([4933](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4933)) +* Fix some job parameters for code engine ([4923](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4923)) +* CIS - remove deafult value for min_tls_version ([4947](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4947)) +* Update Power Workspace/s and Datacenter/s DataSource Documentation ([4904](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4904)) +* validation on encryption with catalog images fixed ([4940](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4940)) + # 1.60.0-beta0 (Nov 15, 2023) Features * Support for Projects From ff439a920587dc3dedf4d60c49dfd9d7cfbd39b5 Mon Sep 17 00:00:00 2001 From: hkantare Date: Thu, 23 Nov 2023 20:13:08 +0530 Subject: [PATCH 073/132] Bump up version to 1.60.0-beta1 --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index f1071a21bf..b5a8b4c2f3 100644 --- a/version/version.go +++ b/version/version.go @@ -5,7 +5,7 @@ import ( ) // Version is the current provider main version -const Version = "1.60.0-beta0" +const Version = "1.60.0-beta1" // GitCommit is the git commit that was compiled. This will be filled in by the compiler. var GitCommit string From ea4c07b0d85def8072e711d6fc0892d7e56482e6 Mon Sep 17 00:00:00 2001 From: archanaponnada <33832784+archanaponnada@users.noreply.github.com> Date: Mon, 27 Nov 2023 18:30:03 +0530 Subject: [PATCH 074/132] issue-13603-fix attachment terraform (#4952) * issue-13603-fix attachment terraform * adding maxitem limit --------- Co-authored-by: ArchanaPonnada --- ibm/service/scc/resource_ibm_scc_profile_attachment.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ibm/service/scc/resource_ibm_scc_profile_attachment.go b/ibm/service/scc/resource_ibm_scc_profile_attachment.go index 7c02d9613a..44ebbe12eb 100644 --- a/ibm/service/scc/resource_ibm_scc_profile_attachment.go +++ b/ibm/service/scc/resource_ibm_scc_profile_attachment.go @@ -109,7 +109,8 @@ func ResourceIbmSccProfileAttachment() *schema.Resource { }, "notifications": { Type: schema.TypeList, - Required: true, + MaxItems: 1, + Optional: true, Description: "The request payload of the attachment notifications.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ From 85f787727bd9f2a2a6f0b6b029b94fe7ea289503 Mon Sep 17 00:00:00 2001 From: VaishnaviGopal Date: Wed, 29 Nov 2023 10:15:11 +0530 Subject: [PATCH 075/132] Fixed catalog service extensions and values metadata params of workspace ds (#4957) --- .../data_source_ibm_schematics_workspace.go | 219 +++++++++++++++++- .../docs/d/schematics_workspace.html.markdown | 18 +- 2 files changed, 229 insertions(+), 8 deletions(-) diff --git a/ibm/service/schematics/data_source_ibm_schematics_workspace.go b/ibm/service/schematics/data_source_ibm_schematics_workspace.go index 69408e2c12..bdd9f28d1f 100644 --- a/ibm/service/schematics/data_source_ibm_schematics_workspace.go +++ b/ibm/service/schematics/data_source_ibm_schematics_workspace.go @@ -85,9 +85,31 @@ func DataSourceIBMSchematicsWorkspace() *schema.Resource { Computed: true, Description: "The version of the software template that you chose to install from the IBM Cloud catalog.", }, - }, - }, - }, + "service_extensions": { + Type: schema.TypeList, + Computed: true, + Description: "List of service data", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Name of the Service Data.", + }, + "value": { + Type: schema.TypeString, + Computed: true, + Description: "Value of the Service Data.", + }, + "type": { + Type: schema.TypeString, + Computed: true, + Description: "Type of the value string, int, bool.", + }, + }, + }, + }, + }}}, "created_at": { Type: schema.TypeString, Computed: true, @@ -406,6 +428,58 @@ func DataSourceIBMSchematicsWorkspace() *schema.Resource { Computed: true, Description: "The source of this meta-data.", }, + "metadata": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "A list of input variables that are associated with the workspace.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "default_value": { + Type: schema.TypeString, + Computed: true, + Description: "Default value for the variable only if the override value is not specified.", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "The description of the meta data.", + }, + "hidden": { + Type: schema.TypeBool, + Computed: true, + Description: "If **true**, the variable is not displayed on UI or Command line.", + }, + "required": { + Type: schema.TypeBool, + Computed: true, + Description: "If the variable required?.", + }, + "options": { + Type: schema.TypeList, + Computed: true, + Description: "The list of possible values for this variable. If type is **integer** or **date**, then the array of string is converted to array of integers or date during the runtime.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "type": { + Type: schema.TypeString, + Computed: true, + Description: "Type of the variable.", + }, + "secure": { + Type: schema.TypeBool, + Computed: true, + Description: "If set to `true`, the value of your input variable is protected and not returned in your API response.", + }, + }, + }, + }, + "value": { + Type: schema.TypeString, + Computed: true, + Description: "The value of the variable. Applicable for the integer type.", + }, }, }, }, @@ -675,8 +749,9 @@ func dataSourceIBMSchematicsWorkspaceRead(context context.Context, d *schema.Res if err = d.Set("template_values", templateData[0]["values"]); err != nil { return diag.FromErr(fmt.Errorf("[ERROR] Error reading values: %s", err)) } - if err = d.Set("template_values_metadata", templateData[0]["values_metadata"]); err != nil { - return diag.FromErr(fmt.Errorf("[ERROR] Error reading values_metadata: %s", err)) + err = d.Set("template_values_metadata", dataSourceWorkspaceResponseFlattenValuesMetadata(templateData[0]["values_metadata"])) + if err != nil { + fmt.Println(fmt.Errorf("[ERROR] Error reading template_values_metadata %s", err)) } if err = d.Set("template_inputs", templateData[0]["variablestore"]); err != nil { return diag.FromErr(fmt.Errorf("[ERROR] Error reading variablestore: %s", err)) @@ -804,10 +879,31 @@ func dataSourceWorkspaceResponseCatalogRefToMap(catalogRefItem schematicsv1.Cata if catalogRefItem.OfferingVersion != nil { catalogRefMap["offering_version"] = catalogRefItem.OfferingVersion } - + if catalogRefItem.ServiceExtensions != nil { + serviceExtensionsList := []map[string]interface{}{} + for _, serviceExtensionsItem := range catalogRefItem.ServiceExtensions { + serviceExtensionsList = append(serviceExtensionsList, dataSourceWorkspaceResponseCatalogRefServiceExtensionsToMap(serviceExtensionsItem)) + } + catalogRefMap["service_extensions"] = serviceExtensionsList + } return catalogRefMap } +func dataSourceWorkspaceResponseCatalogRefServiceExtensionsToMap(serviceExtensionsItem schematicsv1.ServiceExtensions) (serviceExtensionMap map[string]interface{}) { + serviceExtensionMap = map[string]interface{}{} + + if serviceExtensionsItem.Name != nil { + serviceExtensionMap["name"] = *serviceExtensionsItem.Name + } + if serviceExtensionsItem.Type != nil { + serviceExtensionMap["type"] = serviceExtensionsItem.Type + } + if serviceExtensionsItem.Value != nil { + serviceExtensionMap["value"] = *serviceExtensionsItem.Value + } + return serviceExtensionMap +} + func dataSourceWorkspaceResponseFlattenRuntimeData(result []schematicsv1.TemplateRunTimeDataResponse) (runtimeData []map[string]interface{}) { for _, runtimeDataItem := range result { runtimeData = append(runtimeData, dataSourceWorkspaceResponseRuntimeDataToMap(runtimeDataItem)) @@ -920,7 +1016,11 @@ func dataSourceWorkspaceResponseTemplateDataToMap(templateDataItem schematicsv1. templateDataMap["values"] = templateDataItem.Values } if templateDataItem.ValuesMetadata != nil { - templateDataMap["values_metadata"] = templateDataItem.ValuesMetadata + valuesMetadataList := []interface{}{} + for _, valuesMetadataItem := range templateDataItem.ValuesMetadata { + valuesMetadataList = append(valuesMetadataList, valuesMetadataItem) + } + templateDataMap["values_metadata"] = valuesMetadataList } if templateDataItem.ValuesURL != nil { templateDataMap["values_url"] = templateDataItem.ValuesURL @@ -935,6 +1035,111 @@ func dataSourceWorkspaceResponseTemplateDataToMap(templateDataItem schematicsv1. return templateDataMap } + +func dataSourceWorkspaceResponseFlattenValuesMetadata(result interface{}) (valuesMetadata []map[string]interface{}) { + if result != nil { + for _, res := range result.([]interface{}) { + valuesMetadataMap := dataSourceWorkspaceResponseValuesMetadataToMap(res.(map[string]interface{})) + valuesMetadata = append(valuesMetadata, valuesMetadataMap) + } + } + return valuesMetadata +} + +func dataSourceWorkspaceResponseValuesMetadataToMap(valuesMetadataItem map[string]interface{}) map[string]interface{} { + valuesMetadataMap := map[string]interface{}{} + + if valuesMetadataItem["name"] != nil { + valuesMetadataMap["name"] = valuesMetadataItem["name"].(string) + } + if valuesMetadataItem["type"] != nil { + valuesMetadataMap["type"] = valuesMetadataItem["type"].(string) + } + + if valuesMetadataItem["aliases"] != nil { + valuesMetadataMap["aliases"] = valuesMetadataItem["aliases"] + } + + if valuesMetadataItem["description"] != nil { + valuesMetadataMap["description"] = valuesMetadataItem["description"].(string) + } + + if valuesMetadataItem["cloud_data_type"] != nil { + valuesMetadataMap["cloud_data_type"] = valuesMetadataItem["cloud_data_type"].(string) + } + + if valuesMetadataItem["default"] != nil { + valuesMetadataMap["default"] = valuesMetadataItem["default"].(string) + } + + if valuesMetadataItem["link_status"] != nil { + valuesMetadataMap["link_status"] = valuesMetadataItem["link_status"].(string) + } + + if valuesMetadataItem["secure"] != nil { + valuesMetadataMap["secure"] = valuesMetadataItem["secure"] + } + + if valuesMetadataItem["immutable"] != nil { + valuesMetadataMap["immutable"] = valuesMetadataItem["immutable"] + } + + if valuesMetadataItem["hidden"] != nil { + valuesMetadataMap["hidden"] = valuesMetadataItem["hidden"] + } + + if valuesMetadataItem["required"] != nil { + valuesMetadataMap["required"] = valuesMetadataItem["required"] + } + + if valuesMetadataItem["options"] != nil { + valuesMetadataMap["options"] = valuesMetadataItem["options"] + } + + if valuesMetadataItem["min_value"] != nil { + valuesMetadataMap["min_value"] = valuesMetadataItem["min_value"] + } + + if valuesMetadataItem["max_value"] != nil { + valuesMetadataMap["max_value"] = valuesMetadataItem["max_value"] + } + + if valuesMetadataItem["min_length"] != nil { + valuesMetadataMap["min_length"] = valuesMetadataItem["min_length"] + } + + if valuesMetadataItem["max_length"] != nil { + valuesMetadataMap["max_length"] = valuesMetadataItem["max_length"] + } + + if valuesMetadataItem["matches"] != nil { + valuesMetadataMap["matches"] = valuesMetadataItem["matches"].(string) + } + + if valuesMetadataItem["position"] != nil { + valuesMetadataMap["position"] = valuesMetadataItem["position"] + } + + if valuesMetadataItem["group_by"] != nil { + valuesMetadataMap["group_by"] = valuesMetadataItem["group_by"].(string) + } + + if valuesMetadataItem["source"] != nil { + valuesMetadataMap["source"] = valuesMetadataItem["source"].(string) + } + + if valuesMetadataItem["metadata"] != nil { + metadataList := []map[string]interface{}{} + + valuesMetadataMap["metadata"] = append(metadataList, valuesMetadataItem["metadata"].(map[string]interface{})) + + } + if valuesMetadataItem["value"] != nil { + valuesMetadataMap["value"] = valuesMetadataItem["value"].(string) + } + + return valuesMetadataMap +} func dataSourceIbmSchematicsWorkspaceVariableMetadataToMap(model *schematicsv1.VariableMetadata) map[string]interface{} { modelMap := make(map[string]interface{}) if model.Type != nil { diff --git a/website/docs/d/schematics_workspace.html.markdown b/website/docs/d/schematics_workspace.html.markdown index dfadec7f5c..2f21acc368 100644 --- a/website/docs/d/schematics_workspace.html.markdown +++ b/website/docs/d/schematics_workspace.html.markdown @@ -45,6 +45,11 @@ Nested scheme for **catalog_ref**: * `item_url` - (String) The URL to the software template in the IBM Cloud catalog. * `launch_url` - (String) The URL to the dashboard to access your software. * `offering_version` - (String) The version of the software template that you chose to install from the IBM Cloud catalog. + * `service_extensions` - (List) List of service data +Nested scheme for **service_extensions**: + * `name` - (String) Name of the Service Data. + * `value` - (String) Value of the Service Data. + * `type` - (String) Type of the value string, int, bool. * `created_at` - (String) The timestamp when the workspace was created. @@ -123,8 +128,19 @@ Nested scheme for **env_values**: * `required` - (Boolean) If the variable required?. * `secure` - (Boolean) Is the variable secure or sensitive ?. * `source` - (String) The source of this meta-data. + * `value` - (String) The value of the variable. Applicable for the integer type. * `type` - (String) Type of the variable. - * Constraints: Allowable values are: `boolean`, `string`, `integer`, `date`, `array`, `list`, `map`, `complex`, `link`. + * Constraints: Allowable values are: `boolean`, `string`, `integer`, `date`, `array`, `list`, `map`, `complex`, `link`. + * `metadata` - (List) List of service data + Nested scheme for **metadata**: + * `default_value` - (String) Default value for the variable only if the override value is not specified. + * `description` - (String) The description of the meta data. + * `hidden` - (Boolean) If **true**, the variable is not displayed on UI or Command line. + * `options` - (List) The list of possible values for this variable. If type is **integer** or **date**, then the array of string is converted to array of integers or date during the runtime. + * `required` - (Boolean) If the variable required?. + * `secure` - (Boolean) Is the variable secure or sensitive ?. + * `type` - (String) Type of the variable. + * Constraints: Allowable values are: `boolean`, `string`, `integer`, `date`, `array`, `list`, `map`, `complex`, `link`. * `template_inputs` - (List) Information about the input variables that your template uses. Nested scheme for **variablestore**: From 1c0d88840939798a246dfc886a45043d3a1b0a9f Mon Sep 17 00:00:00 2001 From: hkantare Date: Wed, 29 Nov 2023 14:56:09 +0530 Subject: [PATCH 076/132] update CHANGELOG --- CHANGELOG.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90e72694bf..be65d39357 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,47 @@ +# 1.60.0 (Nov 29, 2023) +Features +* Support for Projects + - **Datasources** + - ibm_project + - ibm_project_config + - ibm_project_environment + - **Resources** + - ibm_project + - ibm_project_config + - ibm_project_environment + +* Support for Code Engine + - **Datasources** + - ibm_code_engine_domain_mapping + - **Resources** + - ibm_code_engine_domain_mapping + +* Support for Power Instance + - **Resources** + - ibm_pi_workspace + +Enhancements +* support offline restore for MongoDB EE PITR ([4601](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4601)) +* bump ContinuousDelivery Go SDK version ([4918](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4918)) +* Added nest conditions to rule.conditions IAM Policies ([4896](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4896)) +* Updates to SCC tool ([4920](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4920)) +* Add entitlement option to Satellite cluster/workerpool create ([4894](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4894)) +* VPC ID Filter is added when Subnet Name is specified ([4892](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4892)) +* add optional account id to kms config ([4944](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4944)) + +BugFixes +* resolved nil pointer issue on vpn gateway resource ([4903](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4903)) +* Private/direct COS endpoint settings conflicts with IBM Cloud docs, VPE options, and COS config endpoint ([4919](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4919)) +* add missing required argument name to the doc ([4909](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4909)) +* Fix wrong sintax in doc for Ingress Secret Opaque ([4917](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4917)) +* schematics agent doc fixes ([4933](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4933)) +* Fix some job parameters for code engine ([4923](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4923)) +* CIS - remove deafult value for min_tls_version ([4947](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4947)) +* Update Power Workspace/s and Datacenter/s DataSource Documentation ([4904](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4904)) +* validation on encryption with catalog images fixed ([4940](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4940)) +* issue-13603-fix attachment terraform ([4952](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4952)) +* Fixed catalog service extensions and values metadata params of workspace ds ([4957](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4957)) + # 1.60.0-beta1 (Nov 23, 2023) Features * Support for Projects @@ -60,6 +104,11 @@ BugFixes * Private/direct COS endpoint settings conflicts with IBM Cloud docs, VPE options, and COS config endpoint ([4919](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4919)) * add missing required argument name to the doc ([4909](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4909)) +# 1.59.1 (Nov 20, 2023) + +Bug Fixes +* ibm_schematics_workspace: provider crash during terraform plan ([4907](https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4907)) + # 1.59.0 (Oct 30, 2023) From 527e569c20cd78b1b78b34c42f192e4ed854aa1e Mon Sep 17 00:00:00 2001 From: hkantare Date: Wed, 29 Nov 2023 14:56:50 +0530 Subject: [PATCH 077/132] Bump up version to 1.60.0 --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index b5a8b4c2f3..19638a80ae 100644 --- a/version/version.go +++ b/version/version.go @@ -5,7 +5,7 @@ import ( ) // Version is the current provider main version -const Version = "1.60.0-beta1" +const Version = "1.60.0" // GitCommit is the git commit that was compiled. This will be filled in by the compiler. var GitCommit string From dc6d1a96a0b1cbf4bf8bd7a280e73838dc273369 Mon Sep 17 00:00:00 2001 From: alex hemard Date: Wed, 29 Nov 2023 09:36:30 -0600 Subject: [PATCH 078/132] feat(Cloud Databases): Database user password complexity validation (#4931) * feat(Cloud Databases): Database user password complexity validation * update tests to conform to new complexity rules * fix password validation edgecases * add test case for password beginning with special char * fix regexp * refactor of db users * delete and create ops manager users when updating * validate adminpassword, update docs --- .secrets.baseline | 118 ++-- ...rce_ibm_code_engine_domain_mapping_test.go | 2 +- ibm/service/database/resource_ibm_database.go | 505 ++++++++++++------ .../resource_ibm_database_cassandra_test.go | 40 +- .../resource_ibm_database_edb_test.go | 12 +- ...bm_database_elasticsearch_platinum_test.go | 42 +- ...esource_ibm_database_elasticsearch_test.go | 42 +- .../resource_ibm_database_etcd_test.go | 12 +- ...ce_ibm_database_mongodb_enterprise_test.go | 16 +- ...urce_ibm_database_mongodb_sharding_test.go | 10 +- .../resource_ibm_database_mongodb_test.go | 12 +- .../resource_ibm_database_mysql_test.go | 10 +- .../resource_ibm_database_postgresql_test.go | 26 +- .../resource_ibm_database_rabbitmq_test.go | 12 +- .../resource_ibm_database_redis_test.go | 8 +- .../database/resource_ibm_database_test.go | 107 ++++ website/docs/r/database.html.markdown | 36 +- 17 files changed, 678 insertions(+), 332 deletions(-) create mode 100644 ibm/service/database/resource_ibm_database_test.go diff --git a/.secrets.baseline b/.secrets.baseline index 934bc75b57..f7d1438953 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.mod|go.sum|.*.map|^.secrets.baseline$", "lines": null }, - "generated_at": "2023-11-22T09:50:41Z", + "generated_at": "2023-11-29T02:05:13Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -760,7 +760,7 @@ "hashed_secret": "731438016c5ab94431f61820f35e3ae5f8ad6004", "is_secret": false, "is_verified": false, - "line_number": 416, + "line_number": 417, "type": "Secret Keyword", "verified_result": null }, @@ -768,7 +768,7 @@ "hashed_secret": "12da2e35d6b50c902c014f1ab9e3032650368df7", "is_secret": false, "is_verified": false, - "line_number": 422, + "line_number": 423, "type": "Secret Keyword", "verified_result": null }, @@ -776,7 +776,7 @@ "hashed_secret": "813274ccae5b6b509379ab56982d862f7b5969b6", "is_secret": false, "is_verified": false, - "line_number": 1127, + "line_number": 1134, "type": "Base64 High Entropy String", "verified_result": null } @@ -864,7 +864,7 @@ "hashed_secret": "c8b6f5ef11b9223ac35a5663975a466ebe7ebba9", "is_secret": false, "is_verified": false, - "line_number": 1806, + "line_number": 1807, "type": "Secret Keyword", "verified_result": null }, @@ -872,7 +872,7 @@ "hashed_secret": "8abf4899c01104241510ba87685ad4de76b0c437", "is_secret": false, "is_verified": false, - "line_number": 1812, + "line_number": 1813, "type": "Secret Keyword", "verified_result": null } @@ -2056,7 +2056,7 @@ "hashed_secret": "deab23f996709b4e3d14e5499d1cc2de677bfaa8", "is_secret": false, "is_verified": false, - "line_number": 1357, + "line_number": 1334, "type": "Secret Keyword", "verified_result": null }, @@ -2064,7 +2064,7 @@ "hashed_secret": "20a25bac21219ffff1904bde871ded4027eca2f8", "is_secret": false, "is_verified": false, - "line_number": 1944, + "line_number": 1923, "type": "Secret Keyword", "verified_result": null }, @@ -2072,7 +2072,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 1963, + "line_number": 1942, "type": "Secret Keyword", "verified_result": null }, @@ -2080,14 +2080,14 @@ "hashed_secret": "1f5e25be9b575e9f5d39c82dfd1d9f4d73f1975c", "is_secret": false, "is_verified": false, - "line_number": 2203, + "line_number": 2155, "type": "Secret Keyword", "verified_result": null } ], "ibm/service/database/resource_ibm_database_cassandra_test.go": [ { - "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", + "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, "line_number": 731, @@ -2097,7 +2097,7 @@ ], "ibm/service/database/resource_ibm_database_edb_test.go": [ { - "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", + "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, "line_number": 205, @@ -2107,7 +2107,7 @@ ], "ibm/service/database/resource_ibm_database_elasticsearch_platinum_test.go": [ { - "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", + "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, "line_number": 823, @@ -2117,7 +2117,7 @@ ], "ibm/service/database/resource_ibm_database_elasticsearch_test.go": [ { - "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", + "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, "line_number": 778, @@ -2127,7 +2127,7 @@ ], "ibm/service/database/resource_ibm_database_etcd_test.go": [ { - "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", + "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, "line_number": 213, @@ -2137,7 +2137,7 @@ ], "ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go": [ { - "hashed_secret": "68ab9ef0953865fef0558010a9f7afcef110d5b8", + "hashed_secret": "8cbbbfad0206e5953901f679b0d26d583c4f5ffe", "is_secret": false, "is_verified": false, "line_number": 271, @@ -2145,7 +2145,7 @@ "verified_result": null }, { - "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", + "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, "line_number": 336, @@ -2163,7 +2163,7 @@ "verified_result": null }, { - "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", + "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, "line_number": 189, @@ -2173,7 +2173,7 @@ ], "ibm/service/database/resource_ibm_database_mongodb_test.go": [ { - "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", + "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, "line_number": 214, @@ -2183,7 +2183,7 @@ ], "ibm/service/database/resource_ibm_database_mysql_test.go": [ { - "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", + "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, "line_number": 150, @@ -2193,7 +2193,7 @@ ], "ibm/service/database/resource_ibm_database_postgresql_test.go": [ { - "hashed_secret": "e407cbe1c64cadb886be6f42907e2dd1c06ca080", + "hashed_secret": "728e83f156932be9b1dc48a5c3f7a3bfbeeb08ce", "is_secret": false, "is_verified": false, "line_number": 490, @@ -2201,7 +2201,7 @@ "verified_result": null }, { - "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", + "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, "line_number": 658, @@ -2211,7 +2211,7 @@ ], "ibm/service/database/resource_ibm_database_rabbitmq_test.go": [ { - "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", + "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, "line_number": 223, @@ -2221,7 +2221,7 @@ ], "ibm/service/database/resource_ibm_database_redis_test.go": [ { - "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", + "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, "line_number": 272, @@ -2229,6 +2229,64 @@ "verified_result": null } ], + "ibm/service/database/resource_ibm_database_test.go": [ + { + "hashed_secret": "c237978e1983e0caf1c3a84f1c2e72a7fb2981f2", + "is_secret": false, + "is_verified": false, + "line_number": 19, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "d67007844d8f7fbc45ea3b27c4bea0bffafb53a0", + "is_secret": false, + "is_verified": false, + "line_number": 27, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "279fb854eb9fa001b4629518a45c921cfad6d697", + "is_secret": false, + "is_verified": false, + "line_number": 35, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "dad6fac3e5b6be7bb6f274970b4c50739a7e26ee", + "is_secret": false, + "is_verified": false, + "line_number": 59, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "8cbbbfad0206e5953901f679b0d26d583c4f5ffe", + "is_secret": false, + "is_verified": false, + "line_number": 67, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "f5ecb30890399c7b1d1781583478aaa9d0b0c89d", + "is_secret": false, + "is_verified": false, + "line_number": 91, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "6da9eab371358a331c59a76d80a0ffcd589fe3c9", + "is_secret": false, + "is_verified": false, + "line_number": 101, + "type": "Secret Keyword", + "verified_result": null + } + ], "ibm/service/directlink/resource_ibm_dl_provider_gateway_test.go": [ { "hashed_secret": "a184c8ba0974f2e1da4ca1d71f54e1cf40604335", @@ -2758,7 +2816,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 1315, + "line_number": 1326, "type": "Secret Keyword", "verified_result": null } @@ -3774,7 +3832,7 @@ "hashed_secret": "f855f5027fd8fdb2df3f6a6f1cf858fffcbedb0c", "is_secret": false, "is_verified": false, - "line_number": 96615, + "line_number": 96613, "type": "Secret Keyword", "verified_result": null }, @@ -3782,7 +3840,7 @@ "hashed_secret": "5fb0fa884132a8724a8d7cba55853737e442adbd", "is_secret": false, "is_verified": false, - "line_number": 119404, + "line_number": 119402, "type": "Secret Keyword", "verified_result": null }, @@ -3790,7 +3848,7 @@ "hashed_secret": "1e5c2f367f02e47a8c160cda1cd9d91decbac441", "is_secret": false, "is_verified": false, - "line_number": 151612, + "line_number": 151610, "type": "Secret Keyword", "verified_result": null } @@ -4267,7 +4325,7 @@ ], "website/docs/r/database.html.markdown": [ { - "hashed_secret": "10c28f9cf0668595d45c1090a7b4a2ae98edfa58", + "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, "line_number": 494, @@ -4275,7 +4333,7 @@ "verified_result": null }, { - "hashed_secret": "e407cbe1c64cadb886be6f42907e2dd1c06ca080", + "hashed_secret": "ddf75a48487b387b1dc328ac0a942377b377c556", "is_secret": false, "is_verified": false, "line_number": 559, diff --git a/ibm/service/codeengine/resource_ibm_code_engine_domain_mapping_test.go b/ibm/service/codeengine/resource_ibm_code_engine_domain_mapping_test.go index d6178fb825..21ae9dfa77 100644 --- a/ibm/service/codeengine/resource_ibm_code_engine_domain_mapping_test.go +++ b/ibm/service/codeengine/resource_ibm_code_engine_domain_mapping_test.go @@ -214,7 +214,7 @@ func testAccCheckIbmCodeEngineDomainMappingDestroy(s *terraform.State) error { func decodeBase64EnvVar(base64Text string, envVar string) string { decodedText, err := base64.StdEncoding.DecodeString(base64Text) if err != nil { - fmt.Printf("Error decoding environment variable %s: %s", envVar, err) + // fmt.Errorf("Error decoding environment variable %s: %s", envVar, err) return "" } return string(decodedText) diff --git a/ibm/service/database/resource_ibm_database.go b/ibm/service/database/resource_ibm_database.go index ee2a9d09fa..aa2808dcbe 100644 --- a/ibm/service/database/resource_ibm_database.go +++ b/ibm/service/database/resource_ibm_database.go @@ -6,6 +6,7 @@ package database import ( "context" "encoding/json" + "errors" "fmt" "log" "net/url" @@ -50,8 +51,24 @@ const ( databaseTaskFailStatus = "failed" ) +const ( + databaseUserSpecialChars = "_-" + opsManagerUserSpecialChars = "~!@#$%^&*()=+[]{}|;:,.<>/?_-" +) + +const ( + redisRBACRoleRegexPattern = `([+-][a-z]+\s?)+` +) + +type DatabaseUser struct { + Username string + Password string + Role string + Type string +} + type userChange struct { - Old, New map[string]interface{} + Old, New *DatabaseUser } func retry(f func() error) (err error) { @@ -84,7 +101,8 @@ func ResourceIBMDatabaseInstance() *schema.Resource { CustomizeDiff: customdiff.All( resourceIBMDatabaseInstanceDiff, - checkV5Groups), + validateGroupsDiff, + validateUsersDiff), Importer: &schema.ResourceImporter{}, @@ -154,11 +172,14 @@ func ResourceIBMDatabaseInstance() *schema.Resource { Computed: true, }, "adminpassword": { - Description: "The admin user password for the instance", - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringLenBetween(10, 32), - Sensitive: true, + Description: "The admin user password for the instance", + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.All( + validation.StringLenBetween(15, 32), + DatabaseUserPasswordValidator("database"), + ), + Sensitive: true, // DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { // return true // }, @@ -264,7 +285,7 @@ func ResourceIBMDatabaseInstance() *schema.Resource { Type: schema.TypeString, Required: true, Sensitive: true, - ValidateFunc: validation.StringLenBetween(10, 32), + ValidateFunc: validation.StringLenBetween(15, 32), }, "type": { Description: "User type", @@ -975,50 +996,6 @@ func getGroups(instanceID string, meta interface{}) (groups []clouddatabasesv5.G return groupsResponse.Groups, nil } -// V5 Groups -func checkGroupScaling(groupId string, resourceName string, value int, resource *GroupResource, nodeCount int) error { - if nodeCount == 0 { - nodeCount = 1 - } - if resource.StepSize == 0 { - return fmt.Errorf("%s group must have members scaled > 0 before scaling %s", groupId, resourceName) - } - if value < resource.Minimum/nodeCount || value > resource.Maximum/nodeCount || value%(resource.StepSize/nodeCount) != 0 { - if !(value == 0 && resource.IsOptional) { - return fmt.Errorf("%s group %s must be >= %d and <= %d in increments of %d", groupId, resourceName, resource.Minimum/nodeCount, resource.Maximum/nodeCount, resource.StepSize/nodeCount) - } - } - if value != resource.Allocation/nodeCount && !resource.IsAdjustable { - return fmt.Errorf("%s can not change %s value after create", groupId, resourceName) - } - if value < resource.Allocation/nodeCount && !resource.CanScaleDown { - return fmt.Errorf("can not scale %s group %s below %d to %d", groupId, resourceName, resource.Allocation/nodeCount, value) - } - return nil -} - -func checkGroupValue(name string, limits GroupResource, divider int, diff *schema.ResourceDiff) error { - if diff.HasChange(name) { - oldSetting, newSetting := diff.GetChange(name) - old := oldSetting.(int) - new := newSetting.(int) - - if new < limits.Minimum/divider || new > limits.Maximum/divider || new%(limits.StepSize/divider) != 0 { - if !(new == 0 && limits.IsOptional) { - return fmt.Errorf("%s must be >= %d and <= %d in increments of %d", name, limits.Minimum/divider, limits.Maximum/divider/divider, limits.StepSize/divider) - } - } - if old != new && !limits.IsAdjustable { - return fmt.Errorf("%s can not change value after create", name) - } - if new < old && !limits.CanScaleDown { - return fmt.Errorf("%s can not scale down from %d to %d", name, old, new) - } - return nil - } - return nil -} - type CountLimit struct { Units string AllocationCount int @@ -1451,9 +1428,16 @@ func resourceIBMDatabaseInstanceCreate(context context.Context, d *schema.Resour return diag.FromErr(fmt.Errorf("[ERROR] Error getting database client settings: %s", err)) } - for _, user := range userList.(*schema.Set).List() { - userEl := user.(map[string]interface{}) - err := userUpdateCreate(userEl, instanceID, meta, d) + users := expandUsers(userList.(*schema.Set).List()) + for _, user := range users { + // Note: Some db users exist after provisioning (i.e. admin, repl) + // so we must attempt both methods + err := user.Update(instanceID, d, meta) + + if err != nil { + err = user.Create(instanceID, d, meta) + } + if err != nil { return diag.FromErr(err) } @@ -1500,11 +1484,6 @@ func resourceIBMDatabaseInstanceCreate(context context.Context, d *schema.Resour return diag.FromErr(fmt.Errorf("[ERROR] Error Logical Replication can only be set for databases-for-postgresql instances")) } - cloudDatabasesClient, err := meta.(conns.ClientSession).CloudDatabasesV5() - if err != nil { - return diag.FromErr(fmt.Errorf("[ERROR] Error getting database client settings: %s", err)) - } - _, logicalReplicationList := d.GetChange("logical_replication_slot") add := logicalReplicationList.(*schema.Set).List() @@ -2000,65 +1979,38 @@ func resourceIBMDatabaseInstanceUpdate(context context.Context, d *schema.Resour if d.HasChange("users") { oldUsers, newUsers := d.GetChange("users") - userChanges := make(map[string]*userChange) - userKey := func(raw map[string]interface{}) string { - if raw["role"].(string) != "" { - return fmt.Sprintf("%s-%s-%s", raw["type"].(string), raw["role"].(string), raw["name"].(string)) - } else { - return fmt.Sprintf("%s-%s", raw["type"].(string), raw["name"].(string)) - } - } - - for _, raw := range oldUsers.(*schema.Set).List() { - user := raw.(map[string]interface{}) - k := userKey(user) - userChanges[k] = &userChange{Old: user} - } - - for _, raw := range newUsers.(*schema.Set).List() { - user := raw.(map[string]interface{}) - k := userKey(user) - if _, ok := userChanges[k]; !ok { - userChanges[k] = &userChange{} - } - userChanges[k].New = user - } + userChanges := expandUserChanges(oldUsers.(*schema.Set).List(), newUsers.(*schema.Set).List()) for _, change := range userChanges { - // Delete Old User - if change.Old != nil && change.New == nil { - deleteDatabaseUserOptions := &clouddatabasesv5.DeleteDatabaseUserOptions{ - ID: &instanceID, - UserType: core.StringPtr(change.Old["type"].(string)), - Username: core.StringPtr(change.Old["name"].(string)), - } - - deleteDatabaseUserResponse, response, err := cloudDatabasesClient.DeleteDatabaseUser(deleteDatabaseUserOptions) + // Delete User + if change.isDelete() { + // Delete Old User + err = change.Old.Delete(instanceID, d, meta) if err != nil { - return diag.FromErr(fmt.Errorf( - "[ERROR] DeleteDatabaseUser (%s) failed %s\n%s", *deleteDatabaseUserOptions.Username, err, response)) - + return diag.FromErr(err) } + } - taskID := *deleteDatabaseUserResponse.Task.ID - _, err = waitForDatabaseTaskComplete(taskID, d, meta, d.Timeout(schema.TimeoutUpdate)) + if change.isCreate() || change.isUpdate() { - if err != nil { - return diag.FromErr(fmt.Errorf( - "[ERROR] Error waiting for database (%s) user (%s) delete task to complete: %s", icdId, *deleteDatabaseUserOptions.Username, err)) - } + // Note: User Update is not supported for ops_manager user type + // Delete (ignoring errors), then re-create + if change.isUpdate() && !change.New.isUpdatable() { + change.Old.Delete(instanceID, d, meta) - continue - } + err = change.New.Create(instanceID, d, meta) + } else { + // Note: Some db users exist after provisioning (i.e. admin, repl) + // so we must attempt both methods + err = change.New.Update(instanceID, d, meta) - if change.New != nil { - // No change - if change.Old != nil && change.Old["password"].(string) == change.New["password"].(string) && change.Old["name"].(string) == change.New["name"].(string) { - continue + // Create User if Update failed + if err != nil { + err = change.New.Create(instanceID, d, meta) + } } - err := userUpdateCreate(change.New, instanceID, meta, d) if err != nil { return diag.FromErr(err) } @@ -2124,24 +2076,24 @@ func resourceIBMDatabaseInstanceUpdate(context context.Context, d *schema.Resour if len(remove) > 0 { for _, entry := range remove { newEntry := entry.(map[string]interface{}) - deleteDatabaseUserOptions := &clouddatabasesv5.DeleteLogicalReplicationSlotOptions{ + deleteLogicalReplicationSlotOptions := &clouddatabasesv5.DeleteLogicalReplicationSlotOptions{ ID: &instanceID, Name: core.StringPtr(newEntry["name"].(string)), } - deleteDatabaseUserResponse, response, err := cloudDatabasesClient.DeleteLogicalReplicationSlot(deleteDatabaseUserOptions) + deleteLogicalReplicationSlotResponse, response, err := cloudDatabasesClient.DeleteLogicalReplicationSlot(deleteLogicalReplicationSlotOptions) if err != nil { return diag.FromErr(fmt.Errorf( - "[ERROR] DeleteDatabaseUser (%s) failed %s\n%s", *deleteDatabaseUserOptions.Name, err, response)) + "[ERROR] DeleteLogicalReplicationSlot (%s) failed %s\n%s", *deleteLogicalReplicationSlotOptions.Name, err, response)) } - taskID := *deleteDatabaseUserResponse.Task.ID + taskID := *deleteLogicalReplicationSlotResponse.Task.ID _, err = waitForDatabaseTaskComplete(taskID, d, meta, d.Timeout(schema.TimeoutUpdate)) if err != nil { return diag.FromErr(fmt.Errorf( - "[ERROR] Error waiting for database (%s) logical replication slot (%s) delete task to complete: %s", icdId, *deleteDatabaseUserOptions.Name, err)) + "[ERROR] Error waiting for database (%s) logical replication slot (%s) delete task to complete: %s", icdId, *deleteLogicalReplicationSlotOptions.Name, err)) } } } @@ -2401,7 +2353,10 @@ func waitForDatabaseTaskComplete(taskId string, d *schema.ResourceData, meta int delayDuration := 5 * time.Second timeout := time.After(t) - delay := time.Tick(delayDuration) + ticker := time.NewTicker(delayDuration) + delay := ticker.C + defer ticker.Stop() + getTaskOptions := &clouddatabasesv5.GetTaskOptions{ ID: &taskId, } @@ -2748,7 +2703,28 @@ func expandGroups(_groups []interface{}) []*Group { return groups } -func checkV5Groups(_ context.Context, diff *schema.ResourceDiff, meta interface{}) (err error) { +func validateGroupScaling(groupId string, resourceName string, value int, resource *GroupResource, nodeCount int) error { + if nodeCount == 0 { + nodeCount = 1 + } + if resource.StepSize == 0 { + return fmt.Errorf("%s group must have members scaled > 0 before scaling %s", groupId, resourceName) + } + if value < resource.Minimum/nodeCount || value > resource.Maximum/nodeCount || value%(resource.StepSize/nodeCount) != 0 { + if !(value == 0 && resource.IsOptional) { + return fmt.Errorf("%s group %s must be >= %d and <= %d in increments of %d", groupId, resourceName, resource.Minimum/nodeCount, resource.Maximum/nodeCount, resource.StepSize/nodeCount) + } + } + if value != resource.Allocation/nodeCount && !resource.IsAdjustable { + return fmt.Errorf("%s can not change %s value after create", groupId, resourceName) + } + if value < resource.Allocation/nodeCount && !resource.CanScaleDown { + return fmt.Errorf("can not scale %s group %s below %d to %d", groupId, resourceName, resource.Allocation/nodeCount, value) + } + return nil +} + +func validateGroupsDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) (err error) { instanceID := diff.Id() service := diff.Get("service").(string) plan := diff.Get("plan").(string) @@ -2772,7 +2748,7 @@ func checkV5Groups(_ context.Context, diff *schema.ResourceDiff, meta interface{ tfGroups := expandGroups(group.(*schema.Set).List()) - // Check group_ids are unique + // validate group_ids are unique groupIds = make([]string, 0, len(tfGroups)) for _, g := range tfGroups { groupIds = append(groupIds, g.ID) @@ -2804,28 +2780,28 @@ func checkV5Groups(_ context.Context, diff *schema.ResourceDiff, meta interface{ nodeCount := groupDefaults.Members.Allocation if group.Members != nil { - err = checkGroupScaling(groupId, "members", group.Members.Allocation, groupDefaults.Members, 1) + err = validateGroupScaling(groupId, "members", group.Members.Allocation, groupDefaults.Members, 1) if err != nil { return err } } if group.Memory != nil { - err = checkGroupScaling(groupId, "memory", group.Memory.Allocation, groupDefaults.Memory, nodeCount) + err = validateGroupScaling(groupId, "memory", group.Memory.Allocation, groupDefaults.Memory, nodeCount) if err != nil { return err } } if group.Disk != nil { - err = checkGroupScaling(groupId, "disk", group.Disk.Allocation, groupDefaults.Disk, nodeCount) + err = validateGroupScaling(groupId, "disk", group.Disk.Allocation, groupDefaults.Disk, nodeCount) if err != nil { return err } } if group.CPU != nil { - err = checkGroupScaling(groupId, "cpu", group.CPU.Allocation, groupDefaults.CPU, nodeCount) + err = validateGroupScaling(groupId, "cpu", group.CPU.Allocation, groupDefaults.CPU, nodeCount) if err != nil { return err } @@ -2836,73 +2812,278 @@ func checkV5Groups(_ context.Context, diff *schema.ResourceDiff, meta interface{ return nil } -// Updates and creates users. Because we cannot get users, we first attempt to update the users, then create them -func userUpdateCreate(userData map[string]interface{}, instanceID string, meta interface{}, d *schema.ResourceData) (err error) { - cloudDatabasesClient, _ := meta.(conns.ClientSession).CloudDatabasesV5() +func validateUsersDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) (err error) { + oldUsers, newUsers := diff.GetChange("users") + userChanges := expandUserChanges(oldUsers.(*schema.Set).List(), newUsers.(*schema.Set).List()) + + for _, change := range userChanges { + if change.isDelete() { + continue + } + + if change.isCreate() || change.isUpdate() { + err = change.New.Validate() + if err != nil { + return err + } + } + } + + return nil +} + +func expandUsers(_users []interface{}) []*DatabaseUser { + if len(_users) == 0 { + return nil + } + + users := make([]*DatabaseUser, 0, len(_users)) + + for _, userRaw := range _users { + if tfUser, ok := userRaw.(map[string]interface{}); ok { + + user := DatabaseUser{ + Username: tfUser["name"].(string), + Password: tfUser["password"].(string), + Role: tfUser["role"].(string), + Type: tfUser["type"].(string), + } + + users = append(users, &user) + } + } + + return users +} + +func expandUserChanges(_oldUsers []interface{}, _newUsers []interface{}) (userChanges []*userChange) { + oldUsers := expandUsers(_oldUsers) + newUsers := expandUsers(_newUsers) + + userChangeMap := make(map[string]*userChange) + + for _, user := range oldUsers { + userChangeMap[user.ID()] = &userChange{Old: user} + } + + for _, user := range newUsers { + if _, ok := userChangeMap[user.ID()]; !ok { + userChangeMap[user.ID()] = &userChange{} + } + userChangeMap[user.ID()].New = user + } + + userChanges = make([]*userChange, 0, len(userChangeMap)) + + for _, user := range userChangeMap { + userChanges = append(userChanges, user) + } + + return userChanges +} + +func (c *userChange) isDelete() bool { + return c.Old != nil && c.New == nil +} + +func (c *userChange) isCreate() bool { + return c.Old == nil && c.New != nil +} + +func (c *userChange) isUpdate() bool { + return c.New != nil && + c.Old != nil && + ((c.Old.Password != c.New.Password) || + (c.Old.Role != c.New.Role)) +} + +func (u *DatabaseUser) ID() (id string) { + return fmt.Sprintf("%s-%s", u.Type, u.Username) +} + +func (u *DatabaseUser) Create(instanceID string, d *schema.ResourceData, meta interface{}) (err error) { + cloudDatabasesClient, err := meta.(conns.ClientSession).CloudDatabasesV5() + if err != nil { + return fmt.Errorf("[ERROR] Error getting database client settings: %w", err) + } + + //Attempt to create user + userEntry := &clouddatabasesv5.User{ + Username: core.StringPtr(u.Username), + Password: core.StringPtr(u.Password), + } + + // User Role only for ops_manager user type + if u.Type == "ops_manager" && u.Role != "" { + userEntry.Role = core.StringPtr(u.Role) + } + + createDatabaseUserOptions := &clouddatabasesv5.CreateDatabaseUserOptions{ + ID: &instanceID, + UserType: core.StringPtr(u.Type), + User: userEntry, + } + + createDatabaseUserResponse, response, err := cloudDatabasesClient.CreateDatabaseUser(createDatabaseUserOptions) + if err != nil { + return fmt.Errorf("[ERROR] CreateDatabaseUser (%s) failed %w\n%s", *userEntry.Username, err, response) + } + + taskID := *createDatabaseUserResponse.Task.ID + _, err = waitForDatabaseTaskComplete(taskID, d, meta, d.Timeout(schema.TimeoutUpdate)) + + if err != nil { + return fmt.Errorf( + "[ERROR] Error waiting for database (%s) user (%s) create task to complete: %w", instanceID, *userEntry.Username, err) + } + + return nil +} + +func (u *DatabaseUser) Update(instanceID string, d *schema.ResourceData, meta interface{}) (err error) { + cloudDatabasesClient, err := meta.(conns.ClientSession).CloudDatabasesV5() + if err != nil { + return fmt.Errorf("[ERROR] Error getting database client settings: %s", err) + } + // Attempt to update user password passwordSettingUser := &clouddatabasesv5.APasswordSettingUser{ - Password: core.StringPtr(userData["password"].(string)), + Password: core.StringPtr(u.Password), } changeUserPasswordOptions := &clouddatabasesv5.ChangeUserPasswordOptions{ ID: &instanceID, - UserType: core.StringPtr(userData["type"].(string)), - Username: core.StringPtr(userData["name"].(string)), + UserType: core.StringPtr(u.Type), + Username: core.StringPtr(u.Username), User: passwordSettingUser, } changeUserPasswordResponse, response, err := cloudDatabasesClient.ChangeUserPassword(changeUserPasswordOptions) // user was found but an error occurs while triggering task - if response.StatusCode != 404 && err != nil { - return fmt.Errorf("[ERROR] ChangeUserPassword (%s) failed %s\n%s", *changeUserPasswordOptions.Username, err, response) + if err != nil || (response.StatusCode < 200 || response.StatusCode >= 300) { + return fmt.Errorf("[ERROR] ChangeUserPassword (%s) failed %w\n%s", *changeUserPasswordOptions.Username, err, response) } - updatePass := true // Assume that update password passed + taskID := *changeUserPasswordResponse.Task.ID + _, err = waitForDatabaseTaskComplete(taskID, d, meta, d.Timeout(schema.TimeoutUpdate)) - if userData["type"].(string) == "ops_manager" && response.StatusCode == 404 { - updatePass = false // when user_password api can't find an ops_manager user, it returns a 404 and does not get to the point of creating a task - } else { - // when user_password api can't find a database user, its task fails - taskID := *changeUserPasswordResponse.Task.ID - updatePass, err = waitForDatabaseTaskComplete(taskID, d, meta, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + return fmt.Errorf( + "[ERROR] Error waiting for database (%s) user (%s) create task to complete: %w", instanceID, *changeUserPasswordOptions.Username, err) + } - if err != nil { - log.Printf("[ERROR] Error waiting for database (%s) user (%s) password update task to complete: %s", instanceID, *changeUserPasswordOptions.Username, err) - } + return nil +} + +func (u *DatabaseUser) Delete(instanceID string, d *schema.ResourceData, meta interface{}) (err error) { + cloudDatabasesClient, err := meta.(conns.ClientSession).CloudDatabasesV5() + if err != nil { + return fmt.Errorf("[ERROR] Error getting database client settings: %s", err) } - // Updating the password has failed - if !updatePass { - //Attempt to create user - userEntry := &clouddatabasesv5.User{ - Username: core.StringPtr(userData["name"].(string)), - Password: core.StringPtr(userData["password"].(string)), - } + deleteDatabaseUserOptions := &clouddatabasesv5.DeleteDatabaseUserOptions{ + ID: &instanceID, + UserType: core.StringPtr(u.Type), + Username: core.StringPtr(u.Username), + } - // User Role only for ops_manager user type - if userData["type"].(string) == "ops_manager" && userData["role"].(string) != "" { - userEntry.Role = core.StringPtr(userData["role"].(string)) - } + deleteDatabaseUserResponse, response, err := cloudDatabasesClient.DeleteDatabaseUser(deleteDatabaseUserOptions) + + if err != nil { + return fmt.Errorf( + "[ERROR] DeleteDatabaseUser (%s) failed %s\n%s", *deleteDatabaseUserOptions.Username, err, response) + + } + + taskID := *deleteDatabaseUserResponse.Task.ID + _, err = waitForDatabaseTaskComplete(taskID, d, meta, d.Timeout(schema.TimeoutUpdate)) + + if err != nil { + return fmt.Errorf( + "[ERROR] Error waiting for database (%s) user (%s) delete task to complete: %s", instanceID, *deleteDatabaseUserOptions.Username, err) + } + + return nil +} + +func (u *DatabaseUser) isUpdatable() bool { + return u.Type != "ops_manager" +} - createDatabaseUserOptions := &clouddatabasesv5.CreateDatabaseUserOptions{ - ID: &instanceID, - UserType: core.StringPtr(userData["type"].(string)), - User: userEntry, +func (u *DatabaseUser) Validate() error { + var errs []error + + var specialChars string + switch u.Type { + case "ops_manager": + specialChars = opsManagerUserSpecialChars + default: + specialChars = databaseUserSpecialChars + } + + // Format for regexp + var specialCharPattern string + var bs strings.Builder + for i, c := range strings.Split(specialChars, "") { + if i > 0 { + bs.WriteByte('|') } + bs.WriteString(regexp.QuoteMeta(c)) + } - createDatabaseUserResponse, response, err := cloudDatabasesClient.CreateDatabaseUser(createDatabaseUserOptions) - if err != nil { - return fmt.Errorf("[ERROR] CreateDatabaseUser (%s) failed %s\n%s", *userEntry.Username, err, response) + specialCharPattern = bs.String() + + var allowedCharacters = regexp.MustCompile(fmt.Sprintf("^(?:[a-zA-Z0-9]|%s)+$", specialCharPattern)) + var beginWithSpecialChar = regexp.MustCompile(fmt.Sprintf("^(?:%s)", specialCharPattern)) + var containsLetter = regexp.MustCompile("[a-zA-Z]") + var containsNumber = regexp.MustCompile("[0-9]") + var containsSpecialChar = regexp.MustCompile(fmt.Sprintf("(?:%s)", specialCharPattern)) + + if u.Type == "ops_manager" && !containsSpecialChar.MatchString(u.Password) { + errs = append(errs, fmt.Errorf( + "password must contain at least one special character (%s)", specialChars)) + } + + if u.Type == "database" && beginWithSpecialChar.MatchString(u.Password) { + errs = append(errs, fmt.Errorf( + "password must not begin with a special character (%s)", specialChars)) + } + + if !containsLetter.MatchString(u.Password) { + errs = append(errs, errors.New("password must contain at least one letter")) + } + + if !containsNumber.MatchString(u.Password) { + errs = append(errs, errors.New("password must contain at least one number")) + } + + if !allowedCharacters.MatchString(u.Password) { + errs = append(errs, errors.New("password must not contain invalid characters")) + } + + if len(errs) == 0 { + return nil + } + + var b []byte + for i, err := range errs { + if i > 0 { + b = append(b, '\n') } + b = append(b, err.Error()...) + } - taskID := *createDatabaseUserResponse.Task.ID - _, err = waitForDatabaseTaskComplete(taskID, d, meta, d.Timeout(schema.TimeoutUpdate)) + return fmt.Errorf("database user (%s) validation error:\n%w", u.Username, errors.New(string(b))) +} + +func DatabaseUserPasswordValidator(userType string) schema.SchemaValidateFunc { + return func(i interface{}, k string) (warnings []string, errors []error) { + user := &DatabaseUser{Username: "admin", Type: userType, Password: i.(string)} + err := user.Validate() if err != nil { - return fmt.Errorf( - "[ERROR] Error waiting for database (%s) user (%s) create task to complete: %s", instanceID, *userEntry.Username, err) + errors = append(errors, err) } + return } - - return nil } diff --git a/ibm/service/database/resource_ibm_database_cassandra_test.go b/ibm/service/database/resource_ibm_database_cassandra_test.go index 831d52752b..2701ecb344 100644 --- a/ibm/service/database/resource_ibm_database_cassandra_test.go +++ b/ibm/service/database/resource_ibm_database_cassandra_test.go @@ -295,10 +295,10 @@ func testAccCheckIBMDatabaseInstanceCassandraBasic(databaseResourceGroup string, service = "databases-for-cassandra" plan = "enterprise" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -327,14 +327,14 @@ func testAccCheckIBMDatabaseInstanceCassandraFullyspecified(databaseResourceGrou service = "databases-for-cassandra" plan = "enterprise" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -367,7 +367,7 @@ func testAccCheckIBMDatabaseInstanceCassandraReduced(databaseResourceGroup strin service = "databases-for-cassandra" plan = "enterprise" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" timeouts { create = "480m" @@ -391,7 +391,7 @@ func testAccCheckIBMDatabaseInstanceCassandraNodeBasic(databaseResourceGroup str service = "databases-for-cassandra" plan = "enterprise" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -411,7 +411,7 @@ func testAccCheckIBMDatabaseInstanceCassandraNodeBasic(databaseResourceGroup str users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -441,7 +441,7 @@ func testAccCheckIBMDatabaseInstanceCassandraNodeFullyspecified(databaseResource plan = "enterprise" location = "%[3]s" version = "5.1" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -462,11 +462,11 @@ func testAccCheckIBMDatabaseInstanceCassandraNodeFullyspecified(databaseResource users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -500,7 +500,7 @@ func testAccCheckIBMDatabaseInstanceCassandraNodeReduced(databaseResourceGroup s plan = "enterprise" location = "%[3]s" version = "5.1" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -540,7 +540,7 @@ func testAccCheckIBMDatabaseInstanceCassandraNodeScaleOut(databaseResourceGroup service = "databases-for-cassandra" plan = "enterprise" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -581,7 +581,7 @@ func testAccCheckIBMDatabaseInstanceCassandraGroupBasic(databaseResourceGroup st plan = "enterprise" version = "5.1" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -600,7 +600,7 @@ func testAccCheckIBMDatabaseInstanceCassandraGroupBasic(databaseResourceGroup st } users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -630,7 +630,7 @@ func testAccCheckIBMDatabaseInstanceCassandraGroupFullyspecified(databaseResourc plan = "enterprise" version = "5.1" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -649,11 +649,11 @@ func testAccCheckIBMDatabaseInstanceCassandraGroupFullyspecified(databaseResourc } users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -688,7 +688,7 @@ func testAccCheckIBMDatabaseInstanceCassandraGroupReduced(databaseResourceGroup plan = "enterprise" version = "5.1" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" members { @@ -728,7 +728,7 @@ func testAccCheckIBMDatabaseInstanceCassandraGroupScaleOut(databaseResourceGroup plan = "enterprise" version = "5.1" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" diff --git a/ibm/service/database/resource_ibm_database_edb_test.go b/ibm/service/database/resource_ibm_database_edb_test.go index 2f7a639e25..f4ec044be2 100644 --- a/ibm/service/database/resource_ibm_database_edb_test.go +++ b/ibm/service/database/resource_ibm_database_edb_test.go @@ -110,7 +110,7 @@ func testAccCheckIBMDatabaseInstanceEDBBasic(databaseResourceGroup string, name service = "databases-for-enterprisedb" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { @@ -123,7 +123,7 @@ func testAccCheckIBMDatabaseInstanceEDBBasic(databaseResourceGroup string, name tags = ["one:two"] users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -150,7 +150,7 @@ func testAccCheckIBMDatabaseInstanceEDBFullyspecified(databaseResourceGroup stri service = "databases-for-enterprisedb" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { @@ -167,11 +167,11 @@ func testAccCheckIBMDatabaseInstanceEDBFullyspecified(databaseResourceGroup stri tags = ["one:two"] users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -202,7 +202,7 @@ func testAccCheckIBMDatabaseInstanceEDBReduced(databaseResourceGroup string, nam service = "databases-for-enterprisedb" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { diff --git a/ibm/service/database/resource_ibm_database_elasticsearch_platinum_test.go b/ibm/service/database/resource_ibm_database_elasticsearch_platinum_test.go index e1cefb491d..114400145f 100644 --- a/ibm/service/database/resource_ibm_database_elasticsearch_platinum_test.go +++ b/ibm/service/database/resource_ibm_database_elasticsearch_platinum_test.go @@ -351,7 +351,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumBasic(databaseResourceG service = "databases-for-elasticsearch" plan = "platinum" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -364,7 +364,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumBasic(databaseResourceG } users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -393,14 +393,14 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumFullyspecified(database service = "databases-for-elasticsearch" plan = "platinum" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -434,7 +434,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumReduced(databaseResourc service = "databases-for-elasticsearch" plan = "platinum" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" timeouts { create = "120m" @@ -458,7 +458,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupMigration(database service = "databases-for-elasticsearch" plan = "platinum" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -493,7 +493,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeBasic(databaseResou service = "databases-for-elasticsearch" plan = "platinum" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" members { @@ -512,7 +512,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeBasic(databaseResou users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -541,7 +541,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeFullyspecified(data service = "databases-for-elasticsearch" plan = "platinum" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" members { @@ -559,11 +559,11 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeFullyspecified(data } users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -596,7 +596,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeReduced(databaseRes service = "databases-for-elasticsearch" plan = "platinum" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" members { @@ -635,7 +635,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeScaleOut(databaseRe service = "databases-for-elasticsearch" plan = "platinum" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" members { @@ -674,7 +674,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupBasic(databaseReso service = "databases-for-elasticsearch" plan = "platinum" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -694,7 +694,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupBasic(databaseReso users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -723,7 +723,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupFullyspecified(dat service = "databases-for-elasticsearch" plan = "platinum" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -742,11 +742,11 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupFullyspecified(dat } users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -780,7 +780,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupReduced(databaseRe service = "databases-for-elasticsearch" plan = "platinum" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -820,7 +820,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupScaleOut(databaseR service = "databases-for-elasticsearch" plan = "platinum" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" diff --git a/ibm/service/database/resource_ibm_database_elasticsearch_test.go b/ibm/service/database/resource_ibm_database_elasticsearch_test.go index 400e61b7b9..2a6059f36a 100644 --- a/ibm/service/database/resource_ibm_database_elasticsearch_test.go +++ b/ibm/service/database/resource_ibm_database_elasticsearch_test.go @@ -316,10 +316,10 @@ func testAccCheckIBMDatabaseInstanceElasticsearchBasic(databaseResourceGroup str service = "databases-for-elasticsearch" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -348,14 +348,14 @@ func testAccCheckIBMDatabaseInstanceElasticsearchFullyspecified(databaseResource service = "databases-for-elasticsearch" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -389,7 +389,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchReduced(databaseResourceGroup s service = "databases-for-elasticsearch" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" timeouts { create = "120m" @@ -413,7 +413,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchGroupMigration(databaseResource service = "databases-for-elasticsearch" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -448,7 +448,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchNodeBasic(databaseResourceGroup service = "databases-for-elasticsearch" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -467,7 +467,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchNodeBasic(databaseResourceGroup } users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -496,7 +496,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchNodeFullyspecified(databaseReso service = "databases-for-elasticsearch" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" members { @@ -514,11 +514,11 @@ func testAccCheckIBMDatabaseInstanceElasticsearchNodeFullyspecified(databaseReso } users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -551,7 +551,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchNodeReduced(databaseResourceGro service = "databases-for-elasticsearch" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" members { @@ -590,7 +590,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchNodeScaleOut(databaseResourceGr service = "databases-for-elasticsearch" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" members { @@ -629,7 +629,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchGroupBasic(databaseResourceGrou service = "databases-for-elasticsearch" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -649,7 +649,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchGroupBasic(databaseResourceGrou users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -678,7 +678,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchGroupFullyspecified(databaseRes service = "databases-for-elasticsearch" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -697,11 +697,11 @@ func testAccCheckIBMDatabaseInstanceElasticsearchGroupFullyspecified(databaseRes } users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -735,7 +735,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchGroupReduced(databaseResourceGr service = "databases-for-elasticsearch" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -775,7 +775,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchGroupScaleOut(databaseResourceG service = "databases-for-elasticsearch" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" diff --git a/ibm/service/database/resource_ibm_database_etcd_test.go b/ibm/service/database/resource_ibm_database_etcd_test.go index 90ae1134d9..07e2eea5e6 100644 --- a/ibm/service/database/resource_ibm_database_etcd_test.go +++ b/ibm/service/database/resource_ibm_database_etcd_test.go @@ -131,7 +131,7 @@ func testAccCheckIBMDatabaseInstanceEtcdBasic(databaseResourceGroup string, name service = "databases-for-etcd" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { @@ -143,7 +143,7 @@ func testAccCheckIBMDatabaseInstanceEtcdBasic(databaseResourceGroup string, name } users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -166,7 +166,7 @@ func testAccCheckIBMDatabaseInstanceEtcdFullyspecified(databaseResourceGroup str service = "databases-for-etcd" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { @@ -178,11 +178,11 @@ func testAccCheckIBMDatabaseInstanceEtcdFullyspecified(databaseResourceGroup str } users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -210,7 +210,7 @@ func testAccCheckIBMDatabaseInstanceEtcdReduced(databaseResourceGroup string, na service = "databases-for-etcd" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { diff --git a/ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go b/ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go index 0993877628..d3ed077681 100644 --- a/ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go +++ b/ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go @@ -93,7 +93,7 @@ func TestAccIBMMongoDBEnterpriseDatabaseInstanceBasic(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "wait_time_minutes", "adminpassword", "connectionstrings.0.queryoptions"}, + "wait_time_minutes", "adminpassword", "connectionstrings.0.queryoptions", "group"}, }, }, }) @@ -206,7 +206,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseBasic(databaseResourceGroup service = "databases-for-mongodb" plan = "enterprise" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" tags = ["one:two"] group { group_id = "member" @@ -219,7 +219,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseBasic(databaseResourceGroup } users { name = "user123" - password = "password12" + password = "password12345678" type = "database" } allowlist { @@ -247,7 +247,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseFullyspecified(databaseReso service = "databases-for-mongodb" plan = "enterprise" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" tags = ["one:two"] group { group_id = "member" @@ -263,12 +263,12 @@ func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseFullyspecified(databaseReso } users { name = "user123" - password = "password12" + password = "password12345678" type = "database" } users { name = "user124" - password = "password12$password" + password = "password12345678$password" type = "ops_manager" } allowlist { @@ -300,7 +300,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseReduced(databaseResourceGro service = "databases-for-mongodb" plan = "enterprise" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" service_endpoints = "public" tags = ["one:two"] group { @@ -333,7 +333,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseGroupBasic(databaseResource service = "databases-for-mongodb" plan = "enterprise" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" tags = ["one:two"] group { diff --git a/ibm/service/database/resource_ibm_database_mongodb_sharding_test.go b/ibm/service/database/resource_ibm_database_mongodb_sharding_test.go index dad9d64ff0..1cce4bc9a4 100644 --- a/ibm/service/database/resource_ibm_database_mongodb_sharding_test.go +++ b/ibm/service/database/resource_ibm_database_mongodb_sharding_test.go @@ -94,7 +94,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBShardingBasic(databaseResourceGroup s service = "databases-for-mongodb" plan = "enterprise-sharding" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { @@ -106,7 +106,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBShardingBasic(databaseResourceGroup s } users { name = "user123" - password = "password12" + password = "password12345678" type = "database" } allowlist { @@ -134,7 +134,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBShardingFullyspecified(databaseResour service = "databases-for-mongodb" plan = "enterprise-sharding" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { @@ -149,7 +149,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBShardingFullyspecified(databaseResour } users { name = "user123" - password = "password12" + password = "password12345678" type = "database" } users { @@ -186,7 +186,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBShardingReduced(databaseResourceGroup service = "databases-for-mongodb" plan = "enterprise-sharding" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { diff --git a/ibm/service/database/resource_ibm_database_mongodb_test.go b/ibm/service/database/resource_ibm_database_mongodb_test.go index 3bbfae9e52..81fd0cd1f7 100644 --- a/ibm/service/database/resource_ibm_database_mongodb_test.go +++ b/ibm/service/database/resource_ibm_database_mongodb_test.go @@ -135,7 +135,7 @@ func testAccCheckIBMDatabaseInstanceMongodbBasic(databaseResourceGroup string, n service = "databases-for-mongodb" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { @@ -147,7 +147,7 @@ func testAccCheckIBMDatabaseInstanceMongodbBasic(databaseResourceGroup string, n } users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -169,7 +169,7 @@ func testAccCheckIBMDatabaseInstanceMongodbFullyspecified(databaseResourceGroup service = "databases-for-mongodb" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { @@ -181,11 +181,11 @@ func testAccCheckIBMDatabaseInstanceMongodbFullyspecified(databaseResourceGroup } users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -211,7 +211,7 @@ func testAccCheckIBMDatabaseInstanceMongodbReduced(databaseResourceGroup string, service = "databases-for-mongodb" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { diff --git a/ibm/service/database/resource_ibm_database_mysql_test.go b/ibm/service/database/resource_ibm_database_mysql_test.go index a1291df54d..ddb33d5ffe 100644 --- a/ibm/service/database/resource_ibm_database_mysql_test.go +++ b/ibm/service/database/resource_ibm_database_mysql_test.go @@ -86,7 +86,7 @@ func testAccCheckIBMDatabaseInstanceMysqlBasic(databaseResourceGroup string, nam service = "databases-for-mysql" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { @@ -99,7 +99,7 @@ func testAccCheckIBMDatabaseInstanceMysqlBasic(databaseResourceGroup string, nam tags = ["one:two"] users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -126,7 +126,7 @@ func testAccCheckIBMDatabaseInstanceMysqlFullyspecified(databaseResourceGroup st service = "databases-for-mysql" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { @@ -143,11 +143,11 @@ func testAccCheckIBMDatabaseInstanceMysqlFullyspecified(databaseResourceGroup st tags = ["one:two"] users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" diff --git a/ibm/service/database/resource_ibm_database_postgresql_test.go b/ibm/service/database/resource_ibm_database_postgresql_test.go index 56769cba61..dc34b287c4 100644 --- a/ibm/service/database/resource_ibm_database_postgresql_test.go +++ b/ibm/service/database/resource_ibm_database_postgresql_test.go @@ -415,7 +415,7 @@ func testAccCheckIBMDatabaseInstancePostgresBasic(databaseResourceGroup string, service = "databases-for-postgresql" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { @@ -428,7 +428,7 @@ func testAccCheckIBMDatabaseInstancePostgresBasic(databaseResourceGroup string, tags = ["one:two"] users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -462,7 +462,7 @@ func testAccCheckIBMDatabaseInstancePostgresFullyspecified(databaseResourceGroup service = "databases-for-postgresql" plan = "standard" location = "%[3]s" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" memory { @@ -479,15 +479,15 @@ func testAccCheckIBMDatabaseInstancePostgresFullyspecified(databaseResourceGroup tags = ["one:two"] users { name = "user123" - password = "password12" + password = "password12345678" } users { name = "user124" - password = "password12" + password = "password12345678" } users { name = "repl" - password = "repl123456" + password = "repl123456password" } configuration = </?_-)", + }, + { + user: DatabaseUser{ + Username: "testy", + Password: "password12345678$password", + Type: "ops_manager", + }, + expectedError: "", + }, + { + user: DatabaseUser{ + Username: "testy", + Password: "~!@#$%^&*()=+[]{}|;:,.<>/?_-", + Type: "ops_manager", + }, + expectedError: "database user (testy) validation error:\npassword must contain at least one letter\npassword must contain at least one number", + }, + { + user: DatabaseUser{ + Username: "testy", + Password: "~!@#$%^&*()=+[]{}|;:,.<>/?_-a1", + Type: "ops_manager", + }, + expectedError: "", + }, + { + user: DatabaseUser{ + Username: "testy", + Password: "pizza1pizzapizza1", + Type: "database", + }, + expectedError: "", + }, + } + for _, tc := range testcases { + err := tc.user.Validate() + if tc.expectedError == "" { + if err != nil { + t.Errorf("TestValidateUserPassword: %q, %q unexpected error: %q", tc.user.Username, tc.user.Password, err.Error()) + } + } else { + assert.Equal(t, tc.expectedError, err.Error()) + } + } +} diff --git a/website/docs/r/database.html.markdown b/website/docs/r/database.html.markdown index 04248090bb..b27f42deab 100644 --- a/website/docs/r/database.html.markdown +++ b/website/docs/r/database.html.markdown @@ -31,7 +31,7 @@ resource "ibm_database" "" { resource_group_id = data.ibm_resource_group.group.id tags = ["tag1", "tag2"] - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -51,7 +51,7 @@ resource "ibm_database" "" { users { name = "user123" - password = "password12" + password = "password12345678" type = "database" } @@ -83,7 +83,7 @@ resource "ibm_database" "" { resource_group_id = data.ibm_resource_group.group.id tags = ["tag1", "tag2"] - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -103,7 +103,7 @@ resource "ibm_database" "" { users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { @@ -187,7 +187,7 @@ resource "ibm_database" "cassandra" { service = "databases-for-cassandra" plan = "enterprise" location = "us-south" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -207,7 +207,7 @@ resource "ibm_database" "cassandra" { users { name = "user123" - password = "password12" + password = "password12345678" type = "database" } @@ -239,7 +239,7 @@ resource "ibm_database" "mongodb" { service = "databases-for-mongodb" plan = "enterprise" location = "us-south" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -261,7 +261,7 @@ resource "ibm_database" "mongodb" { users { name = "dbuser" - password = "password12" + password = "password12345678" type = "database" } @@ -300,7 +300,7 @@ resource "ibm_database" "mongodb_enterprise" { service = "databases-for-mongodb" plan = "enterprise" location = "us-south" - adminpassword = "password12" + adminpassword = "password12345678" tags = ["one:two"] group { @@ -375,7 +375,7 @@ resource "ibm_database" "edb" { service = "databases-for-enterprisedb" plan = "standard" location = "us-south" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" @@ -397,7 +397,7 @@ resource "ibm_database" "edb" { users { name = "user123" - password = "password12" + password = "password12345678" type = "database" } @@ -427,7 +427,7 @@ resource "ibm_database" "es" { service = "databases-for-elasticsearch" plan = "enterprise" location = "eu-gb" - adminpassword = "password12" + adminpassword = "password12345678" version = "7.17" group { group_id = "member" @@ -446,7 +446,7 @@ resource "ibm_database" "es" { } users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -473,7 +473,7 @@ resource "ibm_database" "es" { service = "databases-for-elasticsearch" plan = "platinum" location = "eu-gb" - adminpassword = "password12" + adminpassword = "password12345678" group { group_id = "member" members { @@ -491,7 +491,7 @@ resource "ibm_database" "es" { } users { name = "user123" - password = "password12" + password = "password12345678" } allowlist { address = "172.168.1.2/32" @@ -556,7 +556,7 @@ resource "ibm_database" "db" { users { name = "repl" - password = "repl123456" + password = "repl12345password" } configuration = </?_-` as well as a letter and a number. Other user types may only use special characters `-_`. - `type` - (Optional, String) The type for the user. Examples: `database`, `ops_manager`, `read_only_replica`. The default value is `database`. - `role` - (Optional, String) The role for the user. Only available for `ops_manager` user type. Examples: `group_read_only`, `group_data_access_admin`. From 83603fb908a3f78f588bbe382088cca21474f10c Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 30 Nov 2023 14:27:43 +0530 Subject: [PATCH 079/132] some changes --- ibm/service/vpc/resource_ibm_is_instance.go | 314 ++++++++++++++++++ ...urce_ibm_is_instance_network_attachment.go | 159 ++++++++- 2 files changed, 472 insertions(+), 1 deletion(-) diff --git a/ibm/service/vpc/resource_ibm_is_instance.go b/ibm/service/vpc/resource_ibm_is_instance.go index cd573cbfdc..b702b59e73 100644 --- a/ibm/service/vpc/resource_ibm_is_instance.go +++ b/ibm/service/vpc/resource_ibm_is_instance.go @@ -4134,6 +4134,320 @@ func instanceUpdate(d *schema.ResourceData, meta interface{}) error { return err } id := d.Id() + // network attachments + + if d.HasChange("network_attachments") && !d.IsNewResource() { + nacs := d.Get("network_attachments").([]interface{}) + for i := range nacs { + nacIdKey := fmt.Sprintf("network_attachments.%d.id", i) + nacId := d.Get(nacIdKey).(string) + nacName := fmt.Sprintf("network_attachments.%d.name", i) + nacVniName := fmt.Sprintf("network_attachments.%d.virtual_network_interface", i) + if d.HasChange(nacName) { + networkName := d.Get(nacName).(string) + updateInstanceNetworkAttachmentOptions := &vpcv1.UpdateInstanceNetworkAttachmentOptions{ + InstanceID: &id, + ID: &nacId, + } + instanceNetworkAttachmentPatch := &vpcv1.InstanceNetworkAttachmentPatch{ + Name: &networkName, + } + instanceNetworkAttachmentPatchAsPatch, err := instanceNetworkAttachmentPatch.AsPatch() + if err != nil { + return (fmt.Errorf("[ERROR] Error encountered while apply as patch for instanceNetworkAttachmentPatchAsPatch of network attachment(%s) of instance(%s) %s", nacId, id, err)) + } + updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchAsPatch + _, res, err := instanceC.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions) + if err != nil { + return (fmt.Errorf("[ERROR] Error encountered while updating network attachment(%s) name of instance(%s) %s/n%s", nacId, id, err, res)) + } + } + if d.HasChange(nacVniName) { + vniId := d.Get(fmt.Sprintf("%s.%s", nacVniName, "0.id")).(string) + updateVirtualNetworkInterfaceOptions := &vpcv1.UpdateVirtualNetworkInterfaceOptions{ + ID: &vniId, + } + virtualNetworkInterfacePatch := &vpcv1.VirtualNetworkInterfacePatch{} + autoDeleteName := fmt.Sprintf("%s.%s", nacVniName, "0.auto_delete") + nameName := fmt.Sprintf("%s.%s", nacVniName, "0.name") + ipsName := fmt.Sprintf("%s.%s", nacVniName, "0.ips") + enableNatName := fmt.Sprintf("%s.%s", nacVniName, "0.enable_infrastructure_nat") + allowIpSpoofingName := fmt.Sprintf("%s.%s", nacVniName, "0.allow_ip_spoofing") + if d.HasChange(autoDeleteName) { + autodelete := d.Get(autoDeleteName).(bool) + virtualNetworkInterfacePatch.AutoDelete = &autodelete + } + if d.HasChange(nameName) { + name := d.Get(nameName).(string) + virtualNetworkInterfacePatch.Name = &name + } + if d.HasChange(enableNatName) { + enableNat := d.Get(enableNatName).(bool) + virtualNetworkInterfacePatch.EnableInfrastructureNat = &enableNat + } + if d.HasChange(allowIpSpoofingName) { + allIpSpoofing := d.Get(allowIpSpoofingName).(bool) + virtualNetworkInterfacePatch.AllowIPSpoofing = &allIpSpoofing + } + virtualNetworkInterfacePatchAsPatch, err := virtualNetworkInterfacePatch.AsPatch() + if err != nil { + return fmt.Errorf("[ERROR] Error encountered while apply as patch for virtualNetworkInterfacePatch of instance(%s) vni (%s) %s", d.Id(), vniId, err) + } + updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchAsPatch + _, response, err := instanceC.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions) + if err != nil { + log.Printf("[DEBUG] UpdateVirtualNetworkInterfaceWithContext failed %s\n%s", err, response) + return fmt.Errorf("UpdateVirtualNetworkInterfaceWithContext failed during instance(%s) network attachment patch %s\n%s", d.Id(), err, response) + } + + if d.HasChange(ipsName) { + oldips, newips := d.GetChange(ipsName) + os := oldips.(*schema.Set) + ns := newips.(*schema.Set) + var oldset, newset *schema.Set + + var out = make([]interface{}, ns.Len(), ns.Len()) + for i, nA := range ns.List() { + newPack := nA.(map[string]interface{}) + out[i] = newPack["reserved_ip"].(string) + } + newset = schema.NewSet(schema.HashString, out) + + out = make([]interface{}, os.Len(), os.Len()) + for i, oA := range os.List() { + oldPack := oA.(map[string]interface{}) + out[i] = oldPack["reserved_ip"].(string) + } + oldset = schema.NewSet(schema.HashString, out) + + remove := flex.ExpandStringList(oldset.Difference(newset).List()) + add := flex.ExpandStringList(newset.Difference(oldset).List()) + + if add != nil && len(add) > 0 { + for _, ipItem := range add { + if ipItem != "" { + addVirtualNetworkInterfaceIPOptions := &vpcv1.AddVirtualNetworkInterfaceIPOptions{} + addVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) + addVirtualNetworkInterfaceIPOptions.SetID(ipItem) + _, response, err := instanceC.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + return fmt.Errorf("AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + } + } + } + } + if remove != nil && len(remove) > 0 { + for _, ipItem := range remove { + if ipItem != "" { + removeVirtualNetworkInterfaceIPOptions := &vpcv1.RemoveVirtualNetworkInterfaceIPOptions{} + removeVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) + removeVirtualNetworkInterfaceIPOptions.SetID(ipItem) + response, err := instanceC.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + return fmt.Errorf("RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + } + } + } + } + } + + } + + } + } + + //primary_network_attachment + if d.HasChange("primary_network_attachment") && !d.IsNewResource() { + networkID := d.Get("primary_network_attachment.0.id").(string) + networkName := d.Get("primary_network_attachment.0.name").(string) + nacVniName := d.Get("primary_network_attachment.0.virtual_network_interface").(string) + if d.HasChange(networkName) { + updateInstanceNetworkAttachmentOptions := &vpcv1.UpdateInstanceNetworkAttachmentOptions{ + InstanceID: &id, + ID: &networkID, + } + instanceNetworkAttachmentPatch := &vpcv1.InstanceNetworkAttachmentPatch{ + Name: &networkName, + } + instanceNetworkAttachmentPatchAsPatch, err := instanceNetworkAttachmentPatch.AsPatch() + if err != nil { + return (fmt.Errorf("[ERROR] Error encountered while apply as patch for instanceNetworkAttachmentPatchAsPatch of pna of instance(%s) %s", id, err)) + } + updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchAsPatch + _, res, err := instanceC.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions) + if err != nil { + return (fmt.Errorf("[ERROR] Error encountered while updating pna name of instance(%s) %s/n%s", id, err, res)) + } + } + if d.HasChange(nacVniName) { + vniId := d.Get(fmt.Sprintf("%s.%s", nacVniName, "0.id")).(string) + updateVirtualNetworkInterfaceOptions := &vpcv1.UpdateVirtualNetworkInterfaceOptions{ + ID: &vniId, + } + virtualNetworkInterfacePatch := &vpcv1.VirtualNetworkInterfacePatch{} + autoDeleteName := fmt.Sprintf("%s.%s", nacVniName, "0.auto_delete") + nameName := fmt.Sprintf("%s.%s", nacVniName, "0.name") + ipsName := fmt.Sprintf("%s.%s", nacVniName, "0.ips") + primaryipName := fmt.Sprintf("%s.%s", nacVniName, "0.primary_ip") + sgName := fmt.Sprintf("%s.%s", nacVniName, "0.security_groups") + enableNatName := fmt.Sprintf("%s.%s", nacVniName, "0.enable_infrastructure_nat") + allowIpSpoofingName := fmt.Sprintf("%s.%s", nacVniName, "0.allow_ip_spoofing") + if d.HasChange(autoDeleteName) { + autodelete := d.Get(autoDeleteName).(bool) + virtualNetworkInterfacePatch.AutoDelete = &autodelete + } + if d.HasChange(nameName) { + name := d.Get(nameName).(string) + virtualNetworkInterfacePatch.Name = &name + } + if d.HasChange(enableNatName) { + enableNat := d.Get(enableNatName).(bool) + virtualNetworkInterfacePatch.EnableInfrastructureNat = &enableNat + } + if d.HasChange(allowIpSpoofingName) { + allIpSpoofing := d.Get(allowIpSpoofingName).(bool) + virtualNetworkInterfacePatch.AllowIPSpoofing = &allIpSpoofing + } + virtualNetworkInterfacePatchAsPatch, err := virtualNetworkInterfacePatch.AsPatch() + if err != nil { + return fmt.Errorf("[ERROR] Error encountered while apply as patch for virtualNetworkInterfacePatch of instance(%s) vni (%s) %s", d.Id(), vniId, err) + } + updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchAsPatch + _, response, err := instanceC.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions) + if err != nil { + log.Printf("[DEBUG] UpdateVirtualNetworkInterfaceWithContext failed %s\n%s", err, response) + return fmt.Errorf("UpdateVirtualNetworkInterfaceWithContext failed during instance(%s) network attachment patch %s\n%s", d.Id(), err, response) + } + + if d.HasChange(ipsName) { + oldips, newips := d.GetChange(ipsName) + os := oldips.(*schema.Set) + ns := newips.(*schema.Set) + var oldset, newset *schema.Set + + var out = make([]interface{}, ns.Len(), ns.Len()) + for i, nA := range ns.List() { + newPack := nA.(map[string]interface{}) + out[i] = newPack["reserved_ip"].(string) + } + newset = schema.NewSet(schema.HashString, out) + + out = make([]interface{}, os.Len(), os.Len()) + for i, oA := range os.List() { + oldPack := oA.(map[string]interface{}) + out[i] = oldPack["reserved_ip"].(string) + } + oldset = schema.NewSet(schema.HashString, out) + + remove := flex.ExpandStringList(oldset.Difference(newset).List()) + add := flex.ExpandStringList(newset.Difference(oldset).List()) + + if add != nil && len(add) > 0 { + for _, ipItem := range add { + if ipItem != "" { + addVirtualNetworkInterfaceIPOptions := &vpcv1.AddVirtualNetworkInterfaceIPOptions{} + addVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) + addVirtualNetworkInterfaceIPOptions.SetID(ipItem) + _, response, err := instanceC.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + return fmt.Errorf("AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + } + } + } + } + if remove != nil && len(remove) > 0 { + for _, ipItem := range remove { + if ipItem != "" { + removeVirtualNetworkInterfaceIPOptions := &vpcv1.RemoveVirtualNetworkInterfaceIPOptions{} + removeVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) + removeVirtualNetworkInterfaceIPOptions.SetID(ipItem) + response, err := instanceC.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + return fmt.Errorf("RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + } + } + } + } + } + + if d.HasChange(primaryipName) { + subnetIdName := fmt.Sprintf("%s.%s", nacVniName, "0.subnet") + ripIdName := fmt.Sprintf("%s.%s", primaryipName, "0.reserved_ip") + subnetId := d.Get(subnetIdName).(string) + primaryipNameName := fmt.Sprintf("%s.%s", primaryipName, "0.name") + primaryipAutoDeleteName := fmt.Sprintf("%s.%s", primaryipName, "0.name") + ripId := d.Get(ripIdName).(string) + updateripoptions := &vpcv1.UpdateSubnetReservedIPOptions{ + SubnetID: &subnetId, + ID: &ripId, + } + reservedIpPath := &vpcv1.ReservedIPPatch{} + if d.HasChange(primaryipNameName) { + name := d.Get(primaryipNameName).(string) + reservedIpPath.Name = &name + } + if d.HasChange(primaryipAutoDeleteName) { + auto := d.Get(primaryipAutoDeleteName).(bool) + reservedIpPath.AutoDelete = &auto + } + reservedIpPathAsPatch, err := reservedIpPath.AsPatch() + if err != nil { + return fmt.Errorf("[ERROR] Error calling reserved ip as patch on vni patch \n%s", err) + } + updateripoptions.ReservedIPPatch = reservedIpPathAsPatch + _, response, err := instanceC.UpdateSubnetReservedIP(updateripoptions) + if err != nil { + return fmt.Errorf("[ERROR] Error updating vni reserved ip(%s): %s\n%s", ripId, err, response) + } + } + if d.HasChange(sgName) { + ovs, nvs := d.GetChange(sgName) + ov := ovs.(*schema.Set) + nv := nvs.(*schema.Set) + remove := flex.ExpandStringList(ov.Difference(nv).List()) + add := flex.ExpandStringList(nv.Difference(ov).List()) + if len(add) > 0 { + for i := range add { + createsgnicoptions := &vpcv1.CreateSecurityGroupTargetBindingOptions{ + SecurityGroupID: &add[i], + ID: &vniId, + } + _, response, err := instanceC.CreateSecurityGroupTargetBinding(createsgnicoptions) + if err != nil { + return fmt.Errorf("[ERROR] Error while creating security group %q for virtual network interface %s\n%s: %q", add[i], vniId, err, response) + } + _, err = isWaitForVirtualNetworkInterfaceAvailable(instanceC, vniId, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + return err + } + } + + } + if len(remove) > 0 { + for i := range remove { + deletesgnicoptions := &vpcv1.DeleteSecurityGroupTargetBindingOptions{ + SecurityGroupID: &remove[i], + ID: &vniId, + } + response, err := instanceC.DeleteSecurityGroupTargetBinding(deletesgnicoptions) + if err != nil { + return fmt.Errorf("[ERROR] Error while removing security group %q for virtual network interface %s\n%s: %q", remove[i], d.Id(), err, response) + } + _, err = isWaitForVirtualNetworkInterfaceAvailable(instanceC, vniId, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + return err + } + } + } + } + + } + + } bootVolSize := "boot_volume.0.size" if d.HasChange(bootVolSize) && !d.IsNewResource() { diff --git a/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go b/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go index 82f1a7d53b..0a0c1ae4a6 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go +++ b/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go @@ -474,9 +474,166 @@ func resourceIBMIsInstanceNetworkAttachmentUpdate(context context.Context, d *sc patchVals := &vpcv1.InstanceNetworkAttachmentPatch{} if d.HasChange("instance") { - return diag.FromErr(fmt.Errorf("Cannot update resource property \"%s\" with the ForceNew annotation."+ + return diag.FromErr(fmt.Errorf("[ERROR] Cannot update resource property \"%s\" with the ForceNew annotation."+ " The resource must be re-created to update this property.", "instance")) } + if d.HasChange("virtual_network_interface") && !d.IsNewResource() { + vniId := d.Get("virtual_network_interface.0.id").(string) + updateVirtualNetworkInterfaceOptions := &vpcv1.UpdateVirtualNetworkInterfaceOptions{ + ID: &vniId, + } + virtualNetworkInterfacePatch := &vpcv1.VirtualNetworkInterfacePatch{} + if d.HasChange("virtual_network_interface.0.auto_delete") { + autodelete := d.Get("virtual_network_interface.0.auto_delete").(bool) + virtualNetworkInterfacePatch.AutoDelete = &autodelete + } + if d.HasChange("virtual_network_interface.0.name") { + name := d.Get("virtual_network_interface.0.name").(string) + virtualNetworkInterfacePatch.Name = &name + } + if d.HasChange("virtual_network_interface.0.enable_infrastructure_nat") { + enableNat := d.Get("virtual_network_interface.0.enable_infrastructure_nat").(bool) + virtualNetworkInterfacePatch.EnableInfrastructureNat = &enableNat + } + if d.HasChange("virtual_network_interface.0.allow_ip_spoofing") { + allIpSpoofing := d.Get("virtual_network_interface.0.allow_ip_spoofing").(bool) + virtualNetworkInterfacePatch.AllowIPSpoofing = &allIpSpoofing + } + virtualNetworkInterfacePatchAsPatch, err := virtualNetworkInterfacePatch.AsPatch() + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error encountered while apply as patch for virtualNetworkInterfacePatch of instance(%s) vni (%s) %s", d.Id(), vniId, err)) + } + updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchAsPatch + _, response, err := vpcClient.UpdateVirtualNetworkInterfaceWithContext(context, updateVirtualNetworkInterfaceOptions) + if err != nil { + log.Printf("[DEBUG] UpdateVirtualNetworkInterfaceWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("UpdateVirtualNetworkInterfaceWithContext failed during instance(%s) network attachment patch %s\n%s", d.Id(), err, response)) + } + + if d.HasChange("virtual_network_interface.0.ips") { + oldips, newips := d.GetChange("virtual_network_interface.0.ips") + os := oldips.(*schema.Set) + ns := newips.(*schema.Set) + var oldset, newset *schema.Set + + var out = make([]interface{}, ns.Len(), ns.Len()) + for i, nA := range ns.List() { + newPack := nA.(map[string]interface{}) + out[i] = newPack["reserved_ip"].(string) + } + newset = schema.NewSet(schema.HashString, out) + + out = make([]interface{}, os.Len(), os.Len()) + for i, oA := range os.List() { + oldPack := oA.(map[string]interface{}) + out[i] = oldPack["reserved_ip"].(string) + } + oldset = schema.NewSet(schema.HashString, out) + + remove := flex.ExpandStringList(oldset.Difference(newset).List()) + add := flex.ExpandStringList(newset.Difference(oldset).List()) + + if add != nil && len(add) > 0 { + for _, ipItem := range add { + if ipItem != "" { + + addVirtualNetworkInterfaceIPOptions := &vpcv1.AddVirtualNetworkInterfaceIPOptions{} + addVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) + addVirtualNetworkInterfaceIPOptions.SetID(ipItem) + _, response, err := vpcClient.AddVirtualNetworkInterfaceIPWithContext(context, addVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response)) + } + } + } + } + if remove != nil && len(remove) > 0 { + for _, ipItem := range remove { + if ipItem != "" { + + removeVirtualNetworkInterfaceIPOptions := &vpcv1.RemoveVirtualNetworkInterfaceIPOptions{} + removeVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) + removeVirtualNetworkInterfaceIPOptions.SetID(ipItem) + response, err := vpcClient.RemoveVirtualNetworkInterfaceIPWithContext(context, removeVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response)) + } + } + } + } + + } + if d.HasChange("virtual_network_interface.0.primary_ip") { + subnetId := d.Get("virtual_network_interface.0.subnet").(string) + ripId := d.Get("virtual_network_interface.0.primary_ip.0.reserved_ip").(string) + updateripoptions := &vpcv1.UpdateSubnetReservedIPOptions{ + SubnetID: &subnetId, + ID: &ripId, + } + reservedIpPath := &vpcv1.ReservedIPPatch{} + if d.HasChange("virtual_network_interface.0.primary_ip.0.name") { + name := d.Get("virtual_network_interface.0.primary_ip.0.name").(string) + reservedIpPath.Name = &name + } + if d.HasChange("virtual_network_interface.0.primary_ip.0.auto_delete") { + auto := d.Get("virtual_network_interface.0.primary_ip.0.auto_delete").(bool) + reservedIpPath.AutoDelete = &auto + } + reservedIpPathAsPatch, err := reservedIpPath.AsPatch() + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error calling reserved ip as patch on vni patch \n%s", err)) + } + updateripoptions.ReservedIPPatch = reservedIpPathAsPatch + _, response, err := vpcClient.UpdateSubnetReservedIP(updateripoptions) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error updating vni reserved ip(%s): %s\n%s", ripId, err, response)) + } + } + if d.HasChange("virtual_network_interface.0.security_groups") { + ovs, nvs := d.GetChange("virtual_network_interface.0.security_groups") + ov := ovs.(*schema.Set) + nv := nvs.(*schema.Set) + remove := flex.ExpandStringList(ov.Difference(nv).List()) + add := flex.ExpandStringList(nv.Difference(ov).List()) + if len(add) > 0 { + for i := range add { + createsgnicoptions := &vpcv1.CreateSecurityGroupTargetBindingOptions{ + SecurityGroupID: &add[i], + ID: &vniId, + } + _, response, err := vpcClient.CreateSecurityGroupTargetBinding(createsgnicoptions) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error while creating security group %q for virtual network interface %s\n%s: %q", add[i], d.Id(), err, response)) + } + _, err = isWaitForVirtualNetworkInterfaceAvailable(vpcClient, vniId, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + return diag.FromErr(err) + } + } + + } + if len(remove) > 0 { + for i := range remove { + deletesgnicoptions := &vpcv1.DeleteSecurityGroupTargetBindingOptions{ + SecurityGroupID: &remove[i], + ID: &vniId, + } + response, err := vpcClient.DeleteSecurityGroupTargetBinding(deletesgnicoptions) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error while removing security group %q for virtual network interface %s\n%s: %q", remove[i], d.Id(), err, response)) + } + _, err = isWaitForVirtualNetworkInterfaceAvailable(vpcClient, vniId, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + return diag.FromErr(err) + } + } + } + } + + } + if d.HasChange("name") { newName := d.Get("name").(string) patchVals.Name = &newName From 588aef7fe504c5d08dacf18e1af64058b78f97e3 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 30 Nov 2023 16:07:38 +0530 Subject: [PATCH 080/132] Update resource_ibm_is_instance.go --- ibm/service/vpc/resource_ibm_is_instance.go | 73 +++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/ibm/service/vpc/resource_ibm_is_instance.go b/ibm/service/vpc/resource_ibm_is_instance.go index b702b59e73..8a57a62be6 100644 --- a/ibm/service/vpc/resource_ibm_is_instance.go +++ b/ibm/service/vpc/resource_ibm_is_instance.go @@ -4143,6 +4143,8 @@ func instanceUpdate(d *schema.ResourceData, meta interface{}) error { nacId := d.Get(nacIdKey).(string) nacName := fmt.Sprintf("network_attachments.%d.name", i) nacVniName := fmt.Sprintf("network_attachments.%d.virtual_network_interface", i) + primaryipName := fmt.Sprintf("%s.%s", nacVniName, "0.primary_ip") + sgName := fmt.Sprintf("%s.%s", nacVniName, "0.security_groups") if d.HasChange(nacName) { networkName := d.Get(nacName).(string) updateInstanceNetworkAttachmentOptions := &vpcv1.UpdateInstanceNetworkAttachmentOptions{ @@ -4253,6 +4255,77 @@ func instanceUpdate(d *schema.ResourceData, meta interface{}) error { } } + if d.HasChange(primaryipName) { + subnetIdName := fmt.Sprintf("%s.%s", nacVniName, "0.subnet") + ripIdName := fmt.Sprintf("%s.%s", primaryipName, "0.reserved_ip") + subnetId := d.Get(subnetIdName).(string) + primaryipNameName := fmt.Sprintf("%s.%s", primaryipName, "0.name") + primaryipAutoDeleteName := fmt.Sprintf("%s.%s", primaryipName, "0.name") + ripId := d.Get(ripIdName).(string) + updateripoptions := &vpcv1.UpdateSubnetReservedIPOptions{ + SubnetID: &subnetId, + ID: &ripId, + } + reservedIpPath := &vpcv1.ReservedIPPatch{} + if d.HasChange(primaryipNameName) { + name := d.Get(primaryipNameName).(string) + reservedIpPath.Name = &name + } + if d.HasChange(primaryipAutoDeleteName) { + auto := d.Get(primaryipAutoDeleteName).(bool) + reservedIpPath.AutoDelete = &auto + } + reservedIpPathAsPatch, err := reservedIpPath.AsPatch() + if err != nil { + return fmt.Errorf("[ERROR] Error calling reserved ip as patch on vni patch \n%s", err) + } + updateripoptions.ReservedIPPatch = reservedIpPathAsPatch + _, response, err := instanceC.UpdateSubnetReservedIP(updateripoptions) + if err != nil { + return fmt.Errorf("[ERROR] Error updating vni reserved ip(%s): %s\n%s", ripId, err, response) + } + } + if d.HasChange(sgName) { + ovs, nvs := d.GetChange(sgName) + ov := ovs.(*schema.Set) + nv := nvs.(*schema.Set) + remove := flex.ExpandStringList(ov.Difference(nv).List()) + add := flex.ExpandStringList(nv.Difference(ov).List()) + if len(add) > 0 { + for i := range add { + createsgnicoptions := &vpcv1.CreateSecurityGroupTargetBindingOptions{ + SecurityGroupID: &add[i], + ID: &vniId, + } + _, response, err := instanceC.CreateSecurityGroupTargetBinding(createsgnicoptions) + if err != nil { + return fmt.Errorf("[ERROR] Error while creating security group %q for virtual network interface %s\n%s: %q", add[i], vniId, err, response) + } + _, err = isWaitForVirtualNetworkInterfaceAvailable(instanceC, vniId, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + return err + } + } + + } + if len(remove) > 0 { + for i := range remove { + deletesgnicoptions := &vpcv1.DeleteSecurityGroupTargetBindingOptions{ + SecurityGroupID: &remove[i], + ID: &vniId, + } + response, err := instanceC.DeleteSecurityGroupTargetBinding(deletesgnicoptions) + if err != nil { + return fmt.Errorf("[ERROR] Error while removing security group %q for virtual network interface %s\n%s: %q", remove[i], d.Id(), err, response) + } + _, err = isWaitForVirtualNetworkInterfaceAvailable(instanceC, vniId, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + return err + } + } + } + } + } } From 1c6657316c3edb3b5dcd1234b1421657a47a9c7f Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 30 Nov 2023 16:39:35 +0530 Subject: [PATCH 081/132] Update resource_ibm_is_instance.go --- ibm/service/vpc/resource_ibm_is_instance.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_instance.go b/ibm/service/vpc/resource_ibm_is_instance.go index 8a57a62be6..61e483c296 100644 --- a/ibm/service/vpc/resource_ibm_is_instance.go +++ b/ibm/service/vpc/resource_ibm_is_instance.go @@ -4334,15 +4334,16 @@ func instanceUpdate(d *schema.ResourceData, meta interface{}) error { //primary_network_attachment if d.HasChange("primary_network_attachment") && !d.IsNewResource() { networkID := d.Get("primary_network_attachment.0.id").(string) - networkName := d.Get("primary_network_attachment.0.name").(string) - nacVniName := d.Get("primary_network_attachment.0.virtual_network_interface").(string) + networkName := "primary_network_attachment.0.name" + nacVniName := "primary_network_attachment.0.virtual_network_interface" if d.HasChange(networkName) { + networkNameString := d.Get(networkName).(string) updateInstanceNetworkAttachmentOptions := &vpcv1.UpdateInstanceNetworkAttachmentOptions{ InstanceID: &id, ID: &networkID, } instanceNetworkAttachmentPatch := &vpcv1.InstanceNetworkAttachmentPatch{ - Name: &networkName, + Name: &networkNameString, } instanceNetworkAttachmentPatchAsPatch, err := instanceNetworkAttachmentPatch.AsPatch() if err != nil { From a59c61971cd8ae5a6dc5fd9265ab77f5713db218 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 30 Nov 2023 17:14:28 +0530 Subject: [PATCH 082/132] Update resource_ibm_is_instance_test.go --- .../vpc/resource_ibm_is_instance_test.go | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/ibm/service/vpc/resource_ibm_is_instance_test.go b/ibm/service/vpc/resource_ibm_is_instance_test.go index b460aef6fd..7a23b25bda 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_test.go +++ b/ibm/service/vpc/resource_ibm_is_instance_test.go @@ -115,6 +115,49 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE }, }) } + +func TestAccIBMISInstance_enc_catalog(t *testing.T) { + var instance string + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-instnace-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tf-subnet-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(` +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR +`) + sshname := fmt.Sprintf("tf-ssh-%d", acctest.RandIntRange(10, 100)) + resourceName := fmt.Sprintf("tf-cosresource-%d", acctest.RandIntRange(10, 100)) + keyName := fmt.Sprintf("tf-key-%d", acctest.RandIntRange(10, 100)) + userData1 := "a" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMISInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISInstanceCatEncryptionConfig(vpcname, subnetname, sshname, publicKey, name, userData1, resourceName, keyName), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMISInstanceExists("ibm_is_instance.testacc_instance", instance), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "name", name), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "user_data", userData1), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "zone", acc.ISZoneName), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "vcpu.#"), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "vcpu.0.manufacturer"), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "boot_volume.0.encryption"), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "catalog_offering.0.version_crn"), + ), + }, + }, + }) +} + func TestAccIBMISInstance_lifecycle(t *testing.T) { var instance string vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) @@ -1129,6 +1172,61 @@ resource "ibm_is_instance" "testacc_instance" { }`, vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, sshname, publicKey, vniname, name, acc.IsImage, acc.InstanceProfileName, userData, acc.ISZoneName) } +func testAccCheckIBMISInstanceCatEncryptionConfig(vpcname, subnetname, sshname, publicKey, name, userData, resourceName, keyName string) string { + return fmt.Sprintf(` + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + ipv4_cidr_block = "%s" + } + + resource "ibm_is_ssh_key" "testacc_sshkey" { + name = "%s" + public_key = "%s" + } + data ibm_is_images testacc_images { + catalog_managed = true + } + resource "ibm_resource_instance" "testacc_resource" { + name = "%s" + service = "kms" + plan = "tiered-pricing" + location = "%s" + } + resource "ibm_kms_key" "testacc_key" { + instance_id = "${ibm_resource_instance.testacc_resource.guid}" + key_name = "%s" + standard_key = false + force_delete = true + } + resource "ibm_is_instance" "testacc_instance" { + name = "%s" + catalog_offering { + version_crn = data.ibm_is_images.testacc_images.images.1.catalog_offering.0.version.0.crn + } + boot_volume { + encryption = ibm_kms_key.testacc_key.crn + } + profile = "%s" + primary_network_interface { + subnet = ibm_is_subnet.testacc_subnet.id + } + user_data = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + keys = [ibm_is_ssh_key.testacc_sshkey.id] + network_interfaces { + subnet = ibm_is_subnet.testacc_subnet.id + name = "eth1" + } + }`, vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, sshname, publicKey, resourceName, acc.RegionName, keyName, name, acc.InstanceProfileName, userData, acc.ISZoneName) +} + func testAccCheckIBMISInstanceRipConfig(vpcname, subnetname, subnetripname, sshname, publicKey, name, userData string) string { return fmt.Sprintf(` resource "ibm_is_vpc" "testacc_vpc" { From dbf5b7cbe4aa778f63b25b2300a57fea8c6d642b Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 30 Nov 2023 19:28:43 +0530 Subject: [PATCH 083/132] test cases updated --- ...ibm_is_instance_network_attachment_test.go | 131 ++++++++++++++++++ .../vpc/resource_ibm_is_instance_test.go | 129 +++++++++++++++++ 2 files changed, 260 insertions(+) diff --git a/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go b/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go index 26598a9e76..5cd02e23d0 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go +++ b/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go @@ -101,6 +101,81 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE }, }) } +func TestAccIBMIsInstanceNetworkAttachmentAllArgsUpdate(t *testing.T) { + var conf vpcv1.InstanceNetworkAttachment + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-vsi-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tf-vni-%d", acctest.RandIntRange(10, 100)) + vninameupdated := fmt.Sprintf("tf-vni-upd-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tvni-subnet-%d", acctest.RandIntRange(10, 100)) + naname := fmt.Sprintf("tvni-na-%d", acctest.RandIntRange(10, 100)) + nanameupdated := fmt.Sprintf("tvni-na-upd-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(` +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR +`) + sshname := fmt.Sprintf("tf-sshname-%d", acctest.RandIntRange(10, 100)) + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIsInstanceNetworkAttachmentDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsInstanceNetworkAttachmentUpdateConfig(vpcname, subnetname, sshname, publicKey, vniname, name, naname), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIsInstanceNetworkAttachmentExists("ibm_is_instance_network_attachment.is_instance_network_attachment", conf), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "resource_type", "instance_network_attachment"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "type", "secondary"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "lifecycle_state", "stable"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "created_at"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "href"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "id"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "instance"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "network_attachment"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "name"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "name", naname), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "port_speed"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.#"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.id"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.allow_ip_spoofing"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.allow_ip_spoofing", "true"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.enable_infrastructure_nat"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.enable_infrastructure_nat", "true"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name", vniname+"-inline"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.#"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.0.address", "10.240.64.12"), + ), + }, + resource.TestStep{ + Config: testAccCheckIBMIsInstanceNetworkAttachmentUpdateConfig(vpcname, subnetname, sshname, publicKey, vninameupdated, name, nanameupdated), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIsInstanceNetworkAttachmentExists("ibm_is_instance_network_attachment.is_instance_network_attachment", conf), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "resource_type", "instance_network_attachment"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "type", "secondary"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "lifecycle_state", "stable"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "created_at"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "href"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "id"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "instance"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "network_attachment"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "name"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "name", nanameupdated), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "port_speed"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.#"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.id"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.allow_ip_spoofing"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.allow_ip_spoofing", "true"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.enable_infrastructure_nat"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.enable_infrastructure_nat", "true"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name", vninameupdated+"-inline"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.#"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.0.address", "10.240.64.12"), + ), + }, + }, + }) +} func testAccCheckIBMIsInstanceNetworkAttachmentConfigBasic(vpcname, subnetname, sshname, publicKey, vniname, name, naname string) string { return fmt.Sprintf(` @@ -213,6 +288,62 @@ func testAccCheckIBMIsInstanceNetworkAttachmentConfig(vpcname, subnetname, sshna } `, vpcname, subnetname, acc.ISZoneName2, sshname, publicKey, vniname, true, acc.InstanceProfileName, name, acc.IsImage, acc.ISZoneName2, naname, vniname, true) } +func testAccCheckIBMIsInstanceNetworkAttachmentUpdateConfig(vpcname, subnetname, sshname, publicKey, vniname, name, naname string) string { + return fmt.Sprintf(` + + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + total_ipv4_address_count = 16 + } + + resource "ibm_is_ssh_key" "testacc_sshkey" { + name = "%s" + public_key = "%s" + } + resource "ibm_is_virtual_network_interface" "testacc_vni" { + name = "%s" + subnet = ibm_is_subnet.testacc_subnet.id + enable_infrastructure_nat = true + allow_ip_spoofing = %t + } + + resource "ibm_is_instance" "testacc_vsi" { + profile = "%s" + name = "%s" + image = "%s" + zone = "%s" + keys = [ibm_is_ssh_key.testacc_sshkey.id] + primary_network_attachment { + name = "vni-2" + virtual_network_interface { + id = ibm_is_virtual_network_interface.testacc_vni.id + } + } + vpc = ibm_is_vpc.testacc_vpc.id + } + + resource "ibm_is_instance_network_attachment" "is_instance_network_attachment" { + instance = ibm_is_instance.testacc_vsi.id + name = "%s" + virtual_network_interface { + name = "%s-inline" + allow_ip_spoofing = %t + enable_infrastructure_nat = true + primary_ip { + auto_delete = true + address = cidrhost(ibm_is_subnet.testacc_subnet.ipv4_cidr_block, 23) + } + subnet = ibm_is_subnet.testacc_subnet.id + } + } + `, vpcname, subnetname, acc.ISZoneName2, sshname, publicKey, vniname, true, acc.InstanceProfileName, name, acc.IsImage, acc.ISZoneName2, naname, vniname, true) +} func testAccCheckIBMIsInstanceNetworkAttachmentExists(n string, obj vpcv1.InstanceNetworkAttachment) resource.TestCheckFunc { diff --git a/ibm/service/vpc/resource_ibm_is_instance_test.go b/ibm/service/vpc/resource_ibm_is_instance_test.go index 7a23b25bda..5b4ed44179 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_test.go +++ b/ibm/service/vpc/resource_ibm_is_instance_test.go @@ -115,6 +115,84 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE }, }) } +func TestAccIBMISInstance_vni_update(t *testing.T) { + var instance string + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-instnace-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tf-subnet-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(` +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR +`) + vniname := fmt.Sprintf("tf-vni-%d", acctest.RandIntRange(10, 100)) + inlinevniname := fmt.Sprintf("tf-inlinevni-%d", acctest.RandIntRange(10, 100)) + inlinevniupdatedname := fmt.Sprintf("tf-inlinevniupd-%d", acctest.RandIntRange(10, 100)) + pnaName := fmt.Sprintf("tf-pna-%d", acctest.RandIntRange(10, 100)) + snaName := fmt.Sprintf("tf-sna-%d", acctest.RandIntRange(10, 100)) + snaNameUpdated := fmt.Sprintf("tf-sna-upd-%d", acctest.RandIntRange(10, 100)) + pnaNameUpdated := fmt.Sprintf("tf-pna-upd-%d", acctest.RandIntRange(10, 100)) + sshname := fmt.Sprintf("tf-ssh-%d", acctest.RandIntRange(10, 100)) + userData1 := "a" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMISInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISInstanceVniUpdateConfig(vpcname, subnetname, sshname, publicKey, name, vniname, inlinevniname, pnaName, snaName, userData1), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMISInstanceExists("ibm_is_instance.testacc_instance", instance), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "name", name), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "user_data", userData1), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "zone", acc.ISZoneName), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "vcpu.#"), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "vcpu.0.manufacturer"), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "primary_network_attachment.#"), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "primary_network_attachment.#", "1"), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "primary_network_attachment.0.name", pnaName), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "network_attachments.0.name", snaName), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "network_attachments.0.virtual_network_interface.0.name", inlinevniname), + ), + }, + { + Config: testAccCheckIBMISInstanceVniUpdateConfig(vpcname, subnetname, sshname, publicKey, name, vniname, inlinevniupdatedname, pnaNameUpdated, snaNameUpdated, userData1), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMISInstanceExists("ibm_is_instance.testacc_instance", instance), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "name", name), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "user_data", userData1), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "zone", acc.ISZoneName), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "vcpu.#"), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "vcpu.0.manufacturer"), + resource.TestCheckResourceAttrSet( + "ibm_is_instance.testacc_instance", "primary_network_attachment.#"), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "primary_network_attachment.#", "1"), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "primary_network_attachment.0.name", pnaNameUpdated), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "network_attachments.0.name", snaNameUpdated), + resource.TestCheckResourceAttr( + "ibm_is_instance.testacc_instance", "network_attachments.0.virtual_network_interface.0.name", inlinevniupdatedname), + ), + }, + }, + }) +} func TestAccIBMISInstance_enc_catalog(t *testing.T) { var instance string @@ -1171,6 +1249,57 @@ resource "ibm_is_instance" "testacc_instance" { keys = [ibm_is_ssh_key.testacc_sshkey.id] }`, vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, sshname, publicKey, vniname, name, acc.IsImage, acc.InstanceProfileName, userData, acc.ISZoneName) } +func testAccCheckIBMISInstanceVniUpdateConfig(vpcname, subnetname, sshname, publicKey, name, vniname, inlinevniname, pnaName, snaName, userData string) string { + return fmt.Sprintf(` +resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" +} + +resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + ipv4_cidr_block = "%s" +} + +resource "ibm_is_ssh_key" "testacc_sshkey" { + name = "%s" + public_key = "%s" +} + +resource "ibm_is_virtual_network_interface" "testacc_vni"{ + name = "%s" + allow_ip_spoofing = true + subnet = ibm_is_subnet.testacc_subnet.id +} + +resource "ibm_is_instance" "testacc_instance" { + name = "%s" + image = "%s" + profile = "%s" + primary_network_attachment { + name = "%s" + virtual_network_interface { + id = ibm_is_virtual_network_interface.testacc_vni.id + } + } + network_attachments { + name = "%s" + virtual_network_interface { + name = "%s" + primary_ip { + auto_delete = true + address = cidrhost(ibm_is_subnet.testacc_subnet.ipv4_cidr_block, 23) + } + subnet = ibm_is_subnet.testacc_subnet.id + } + } + user_data = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + keys = [ibm_is_ssh_key.testacc_sshkey.id] +}`, vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, sshname, publicKey, vniname, name, acc.IsImage, acc.InstanceProfileName, pnaName, snaName, inlinevniname, userData, acc.ISZoneName) +} func testAccCheckIBMISInstanceCatEncryptionConfig(vpcname, subnetname, sshname, publicKey, name, userData, resourceName, keyName string) string { return fmt.Sprintf(` From 7e2cd4f34921f65a3d67bcfffc5bb27c5ddcf30a Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 30 Nov 2023 19:48:35 +0530 Subject: [PATCH 084/132] Update resource_ibm_is_instance_network_attachment_test.go --- ...e_ibm_is_instance_network_attachment_test.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go b/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go index 5cd02e23d0..bd6bd25a98 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go +++ b/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go @@ -143,7 +143,7 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name"), resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name", vniname+"-inline"), resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.#"), - resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.0.address", "10.240.64.12"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.0.address", "10.240.64.11"), ), }, resource.TestStep{ @@ -170,7 +170,7 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name"), resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name", vninameupdated+"-inline"), resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.#"), - resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.0.address", "10.240.64.12"), + resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.0.address", "10.240.64.11"), ), }, }, @@ -320,10 +320,10 @@ func testAccCheckIBMIsInstanceNetworkAttachmentUpdateConfig(vpcname, subnetname, zone = "%s" keys = [ibm_is_ssh_key.testacc_sshkey.id] primary_network_attachment { - name = "vni-2" - virtual_network_interface { - id = ibm_is_virtual_network_interface.testacc_vni.id - } + name = "vni-2" + virtual_network_interface { + id = ibm_is_virtual_network_interface.testacc_vni.id + } } vpc = ibm_is_vpc.testacc_vpc.id } @@ -332,12 +332,13 @@ func testAccCheckIBMIsInstanceNetworkAttachmentUpdateConfig(vpcname, subnetname, instance = ibm_is_instance.testacc_vsi.id name = "%s" virtual_network_interface { - name = "%s-inline" + auto_delete = true + name = "%s-inline" allow_ip_spoofing = %t enable_infrastructure_nat = true primary_ip { auto_delete = true - address = cidrhost(ibm_is_subnet.testacc_subnet.ipv4_cidr_block, 23) + address = cidrhost(ibm_is_subnet.testacc_subnet.ipv4_cidr_block, 11) } subnet = ibm_is_subnet.testacc_subnet.id } From fb652af75d222c430f620f1e81c4da291702089b Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 30 Nov 2023 19:50:02 +0530 Subject: [PATCH 085/132] Update resource_ibm_is_instance_network_attachment_test.go --- .../vpc/resource_ibm_is_instance_network_attachment_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go b/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go index bd6bd25a98..3ea2973088 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go +++ b/ibm/service/vpc/resource_ibm_is_instance_network_attachment_test.go @@ -143,7 +143,7 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name"), resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name", vniname+"-inline"), resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.#"), - resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.0.address", "10.240.64.11"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.0.address"), ), }, resource.TestStep{ @@ -170,7 +170,7 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name"), resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.name", vninameupdated+"-inline"), resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.#"), - resource.TestCheckResourceAttr("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.0.address", "10.240.64.11"), + resource.TestCheckResourceAttrSet("ibm_is_instance_network_attachment.is_instance_network_attachment", "virtual_network_interface.0.primary_ip.0.address"), ), }, }, From a1c6f4030fc6a0256752480e4551e552a4afa660 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 1 Dec 2023 13:24:46 +0530 Subject: [PATCH 086/132] testing --- ibm/service/vpc/resource_ibm_is_instance.go | 416 ++++++++++++-------- website/docs/r/is_instance.html.markdown | 12 +- 2 files changed, 256 insertions(+), 172 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_instance.go b/ibm/service/vpc/resource_ibm_is_instance.go index 2ea2cc70ec..ce3b657854 100644 --- a/ibm/service/vpc/resource_ibm_is_instance.go +++ b/ibm/service/vpc/resource_ibm_is_instance.go @@ -846,9 +846,9 @@ func ResourceIBMISInstance() *schema.Resource { // pna can accept either vni id or prototype "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Required: true, + // DiffSuppressFunc: flex.ApplyOnce, ValidateFunc: validate.InvokeValidator("ibm_is_instance_network_attachment", "name"), Description: "The name for this instance network attachment. The name is unique across all network attachments for the instance.", }, @@ -4138,197 +4138,268 @@ func instanceUpdate(d *schema.ResourceData, meta interface{}) error { if d.HasChange("network_attachments") && !d.IsNewResource() { nacs := d.Get("network_attachments").([]interface{}) - for i := range nacs { - nacIdKey := fmt.Sprintf("network_attachments.%d.id", i) - nacId := d.Get(nacIdKey).(string) - nacName := fmt.Sprintf("network_attachments.%d.name", i) - nacVniName := fmt.Sprintf("network_attachments.%d.virtual_network_interface", i) - primaryipName := fmt.Sprintf("%s.%s", nacVniName, "0.primary_ip") - sgName := fmt.Sprintf("%s.%s", nacVniName, "0.security_groups") - if d.HasChange(nacName) { - networkName := d.Get(nacName).(string) - updateInstanceNetworkAttachmentOptions := &vpcv1.UpdateInstanceNetworkAttachmentOptions{ - InstanceID: &id, - ID: &nacId, - } - instanceNetworkAttachmentPatch := &vpcv1.InstanceNetworkAttachmentPatch{ - Name: &networkName, - } - instanceNetworkAttachmentPatchAsPatch, err := instanceNetworkAttachmentPatch.AsPatch() - if err != nil { - return (fmt.Errorf("[ERROR] Error encountered while apply as patch for instanceNetworkAttachmentPatchAsPatch of network attachment(%s) of instance(%s) %s", nacId, id, err)) - } - updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchAsPatch - _, res, err := instanceC.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions) - if err != nil { - return (fmt.Errorf("[ERROR] Error encountered while updating network attachment(%s) name of instance(%s) %s/n%s", nacId, id, err, res)) + ots, nts := d.GetChange("network_attachments") + otsIntf := ots.([]interface{}) + ntsIntf := nts.([]interface{}) + out := make([]string, len(otsIntf)) + j := 0 + for _, currOtsG := range otsIntf { + currOts := currOtsG.(map[string]interface{}) + flag := false + for _, currNtsG := range ntsIntf { + currNts := currNtsG.(map[string]interface{}) + if currOts["name"].(string) == currNts["name"].(string) { + flag = true + } + } + + if !flag { + + log.Printf("[INFO] Nac with name (%s) will be deleted", currOts["name"].(string)) + nacId := currOts["id"] + if nacId != nil && nacId.(string) != "" { + nacIdStr := nacId.(string) + if !containsNacId(out, nacIdStr) { + out[j] = nacIdStr + j = j + 1 + deleteInstanceNetworkAttachmentOptions := &vpcv1.DeleteInstanceNetworkAttachmentOptions{ + InstanceID: &id, + ID: &nacIdStr, + } + res, err := instanceC.DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions) + if err != nil { + return fmt.Errorf("[ERROR] Error while deleting network attachment(%s) of instance(%s) \n%s: %q", nacIdStr, d.Id(), err, res) + } + } } } - if d.HasChange(nacVniName) { - vniId := d.Get(fmt.Sprintf("%s.%s", nacVniName, "0.id")).(string) - updateVirtualNetworkInterfaceOptions := &vpcv1.UpdateVirtualNetworkInterfaceOptions{ - ID: &vniId, - } - virtualNetworkInterfacePatch := &vpcv1.VirtualNetworkInterfacePatch{} - autoDeleteName := fmt.Sprintf("%s.%s", nacVniName, "0.auto_delete") - nameName := fmt.Sprintf("%s.%s", nacVniName, "0.name") - ipsName := fmt.Sprintf("%s.%s", nacVniName, "0.ips") - enableNatName := fmt.Sprintf("%s.%s", nacVniName, "0.enable_infrastructure_nat") - allowIpSpoofingName := fmt.Sprintf("%s.%s", nacVniName, "0.allow_ip_spoofing") - if d.HasChange(autoDeleteName) { - autodelete := d.Get(autoDeleteName).(bool) - virtualNetworkInterfacePatch.AutoDelete = &autodelete - } - if d.HasChange(nameName) { - name := d.Get(nameName).(string) - virtualNetworkInterfacePatch.Name = &name - } - if d.HasChange(enableNatName) { - enableNat := d.Get(enableNatName).(bool) - virtualNetworkInterfacePatch.EnableInfrastructureNat = &enableNat - } - if d.HasChange(allowIpSpoofingName) { - allIpSpoofing := d.Get(allowIpSpoofingName).(bool) - virtualNetworkInterfacePatch.AllowIPSpoofing = &allIpSpoofing - } - virtualNetworkInterfacePatchAsPatch, err := virtualNetworkInterfacePatch.AsPatch() - if err != nil { - return fmt.Errorf("[ERROR] Error encountered while apply as patch for virtualNetworkInterfacePatch of instance(%s) vni (%s) %s", d.Id(), vniId, err) - } - updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchAsPatch - _, response, err := instanceC.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions) - if err != nil { - log.Printf("[DEBUG] UpdateVirtualNetworkInterfaceWithContext failed %s\n%s", err, response) - return fmt.Errorf("UpdateVirtualNetworkInterfaceWithContext failed during instance(%s) network attachment patch %s\n%s", d.Id(), err, response) - } - if d.HasChange(ipsName) { - oldips, newips := d.GetChange(ipsName) - os := oldips.(*schema.Set) - ns := newips.(*schema.Set) - var oldset, newset *schema.Set + } - var out = make([]interface{}, ns.Len(), ns.Len()) - for i, nA := range ns.List() { - newPack := nA.(map[string]interface{}) - out[i] = newPack["reserved_ip"].(string) + for i, nac := range nacs { + nacIdKey := fmt.Sprintf("network_attachments.%d.id", i) + nacId := d.Get(nacIdKey).(string) + // if nacId is empty, then create + if nacId == "" || containsNacId(out, nacId) { + if nacId == "" { + log.Printf("[DEBUG] nacId is empty") + allowipspoofing := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.allow_ip_spoofing", i) + autodelete := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.auto_delete", i) + enablenat := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.enable_infrastructure_nat", i) + nacMap := nac.(map[string]interface{}) + VirtualNetworkInterfaceModel, err := resourceIBMIsInstanceMapToVirtualNetworkInterfacePrototypeAttachmentContext(allowipspoofing, autodelete, enablenat, d, nacMap["virtual_network_interface"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return err } - newset = schema.NewSet(schema.HashString, out) - - out = make([]interface{}, os.Len(), os.Len()) - for i, oA := range os.List() { - oldPack := oA.(map[string]interface{}) - out[i] = oldPack["reserved_ip"].(string) + nacNameStr := nacMap["name"].(string) + createInstanceNetworkAttachmentOptions := &vpcv1.CreateInstanceNetworkAttachmentOptions{ + InstanceID: &id, + Name: &nacNameStr, + VirtualNetworkInterface: VirtualNetworkInterfaceModel, } - oldset = schema.NewSet(schema.HashString, out) - - remove := flex.ExpandStringList(oldset.Difference(newset).List()) - add := flex.ExpandStringList(newset.Difference(oldset).List()) - - if add != nil && len(add) > 0 { - for _, ipItem := range add { - if ipItem != "" { - addVirtualNetworkInterfaceIPOptions := &vpcv1.AddVirtualNetworkInterfaceIPOptions{} - addVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) - addVirtualNetworkInterfaceIPOptions.SetID(ipItem) - _, response, err := instanceC.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions) - if err != nil { - log.Printf("[DEBUG] AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) - return fmt.Errorf("AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) - } - } + _, res, err := instanceC.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions) + if err != nil { + return fmt.Errorf("[ERROR] Error while creating network attachment(%s) of instance(%s) \n%s: %q", nacNameStr, d.Id(), err, res) + } + } else { + log.Printf("[DEBUG] nacId is not empty") + nacName := fmt.Sprintf("network_attachments.%d.name", i) + nacVniName := fmt.Sprintf("network_attachments.%d.virtual_network_interface", i) + primaryipName := fmt.Sprintf("%s.%s", nacVniName, "0.primary_ip") + sgName := fmt.Sprintf("%s.%s", nacVniName, "0.security_groups") + if d.HasChange(nacName) { + networkName := d.Get(nacName).(string) + updateInstanceNetworkAttachmentOptions := &vpcv1.UpdateInstanceNetworkAttachmentOptions{ + InstanceID: &id, + ID: &nacId, + } + instanceNetworkAttachmentPatch := &vpcv1.InstanceNetworkAttachmentPatch{ + Name: &networkName, + } + instanceNetworkAttachmentPatchAsPatch, err := instanceNetworkAttachmentPatch.AsPatch() + if err != nil { + return (fmt.Errorf("[ERROR] Error encountered while apply as patch for instanceNetworkAttachmentPatchAsPatch of network attachment(%s) of instance(%s) %s", nacId, id, err)) + } + updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchAsPatch + _, res, err := instanceC.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions) + if err != nil { + return (fmt.Errorf("[ERROR] Error encountered while updating network attachment(%s) name of instance(%s) %s/n%s", nacId, id, err, res)) } + // output, err := json.MarshalIndent(updateInstanceNetworkAttachmentOptions, "", " ") + // if err == nil { + // log.Printf("%+v\n", string(output)) + // } else { + // log.Printf("Error : %#v", updateInstanceNetworkAttachmentOptions) + // } } - if remove != nil && len(remove) > 0 { - for _, ipItem := range remove { - if ipItem != "" { - removeVirtualNetworkInterfaceIPOptions := &vpcv1.RemoveVirtualNetworkInterfaceIPOptions{} - removeVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) - removeVirtualNetworkInterfaceIPOptions.SetID(ipItem) - response, err := instanceC.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions) - if err != nil { - log.Printf("[DEBUG] RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) - return fmt.Errorf("RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + if d.HasChange(nacVniName) { + vniId := d.Get(fmt.Sprintf("%s.%s", nacVniName, "0.id")).(string) + updateVirtualNetworkInterfaceOptions := &vpcv1.UpdateVirtualNetworkInterfaceOptions{ + ID: &vniId, + } + virtualNetworkInterfacePatch := &vpcv1.VirtualNetworkInterfacePatch{} + autoDeleteName := fmt.Sprintf("%s.%s", nacVniName, "0.auto_delete") + nameName := fmt.Sprintf("%s.%s", nacVniName, "0.name") + ipsName := fmt.Sprintf("%s.%s", nacVniName, "0.ips") + enableNatName := fmt.Sprintf("%s.%s", nacVniName, "0.enable_infrastructure_nat") + allowIpSpoofingName := fmt.Sprintf("%s.%s", nacVniName, "0.allow_ip_spoofing") + if d.HasChange(autoDeleteName) { + autodelete := d.Get(autoDeleteName).(bool) + virtualNetworkInterfacePatch.AutoDelete = &autodelete + } + if d.HasChange(nameName) { + name := d.Get(nameName).(string) + virtualNetworkInterfacePatch.Name = &name + } + if d.HasChange(enableNatName) { + enableNat := d.Get(enableNatName).(bool) + virtualNetworkInterfacePatch.EnableInfrastructureNat = &enableNat + } + if d.HasChange(allowIpSpoofingName) { + allIpSpoofing := d.Get(allowIpSpoofingName).(bool) + virtualNetworkInterfacePatch.AllowIPSpoofing = &allIpSpoofing + } + virtualNetworkInterfacePatchAsPatch, err := virtualNetworkInterfacePatch.AsPatch() + if err != nil { + return fmt.Errorf("[ERROR] Error encountered while apply as patch for virtualNetworkInterfacePatch of instance(%s) vni (%s) %s", d.Id(), vniId, err) + } + updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchAsPatch + _, response, err := instanceC.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions) + if err != nil { + log.Printf("[DEBUG] UpdateVirtualNetworkInterfaceWithContext failed %s\n%s", err, response) + return fmt.Errorf("UpdateVirtualNetworkInterfaceWithContext failed during instance(%s) network attachment patch %s\n%s", d.Id(), err, response) + } + + if d.HasChange(ipsName) { + oldips, newips := d.GetChange(ipsName) + os := oldips.(*schema.Set) + ns := newips.(*schema.Set) + var oldset, newset *schema.Set + + var out = make([]interface{}, ns.Len(), ns.Len()) + for i, nA := range ns.List() { + newPack := nA.(map[string]interface{}) + out[i] = newPack["reserved_ip"].(string) + } + newset = schema.NewSet(schema.HashString, out) + + out = make([]interface{}, os.Len(), os.Len()) + for i, oA := range os.List() { + oldPack := oA.(map[string]interface{}) + out[i] = oldPack["reserved_ip"].(string) + } + oldset = schema.NewSet(schema.HashString, out) + + remove := flex.ExpandStringList(oldset.Difference(newset).List()) + add := flex.ExpandStringList(newset.Difference(oldset).List()) + + if add != nil && len(add) > 0 { + for _, ipItem := range add { + if ipItem != "" { + addVirtualNetworkInterfaceIPOptions := &vpcv1.AddVirtualNetworkInterfaceIPOptions{} + addVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) + addVirtualNetworkInterfaceIPOptions.SetID(ipItem) + _, response, err := instanceC.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + return fmt.Errorf("AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + } + } + } + } + if remove != nil && len(remove) > 0 { + for _, ipItem := range remove { + if ipItem != "" { + removeVirtualNetworkInterfaceIPOptions := &vpcv1.RemoveVirtualNetworkInterfaceIPOptions{} + removeVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) + removeVirtualNetworkInterfaceIPOptions.SetID(ipItem) + response, err := instanceC.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + return fmt.Errorf("RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + } + } } } } - } - } - if d.HasChange(primaryipName) { - subnetIdName := fmt.Sprintf("%s.%s", nacVniName, "0.subnet") - ripIdName := fmt.Sprintf("%s.%s", primaryipName, "0.reserved_ip") - subnetId := d.Get(subnetIdName).(string) - primaryipNameName := fmt.Sprintf("%s.%s", primaryipName, "0.name") - primaryipAutoDeleteName := fmt.Sprintf("%s.%s", primaryipName, "0.name") - ripId := d.Get(ripIdName).(string) - updateripoptions := &vpcv1.UpdateSubnetReservedIPOptions{ - SubnetID: &subnetId, - ID: &ripId, - } - reservedIpPath := &vpcv1.ReservedIPPatch{} - if d.HasChange(primaryipNameName) { - name := d.Get(primaryipNameName).(string) - reservedIpPath.Name = &name - } - if d.HasChange(primaryipAutoDeleteName) { - auto := d.Get(primaryipAutoDeleteName).(bool) - reservedIpPath.AutoDelete = &auto - } - reservedIpPathAsPatch, err := reservedIpPath.AsPatch() - if err != nil { - return fmt.Errorf("[ERROR] Error calling reserved ip as patch on vni patch \n%s", err) - } - updateripoptions.ReservedIPPatch = reservedIpPathAsPatch - _, response, err := instanceC.UpdateSubnetReservedIP(updateripoptions) - if err != nil { - return fmt.Errorf("[ERROR] Error updating vni reserved ip(%s): %s\n%s", ripId, err, response) - } - } - if d.HasChange(sgName) { - ovs, nvs := d.GetChange(sgName) - ov := ovs.(*schema.Set) - nv := nvs.(*schema.Set) - remove := flex.ExpandStringList(ov.Difference(nv).List()) - add := flex.ExpandStringList(nv.Difference(ov).List()) - if len(add) > 0 { - for i := range add { - createsgnicoptions := &vpcv1.CreateSecurityGroupTargetBindingOptions{ - SecurityGroupID: &add[i], - ID: &vniId, + if d.HasChange(primaryipName) { + subnetIdName := fmt.Sprintf("%s.%s", nacVniName, "0.subnet") + ripIdName := fmt.Sprintf("%s.%s", primaryipName, "0.reserved_ip") + subnetId := d.Get(subnetIdName).(string) + primaryipNameName := fmt.Sprintf("%s.%s", primaryipName, "0.name") + primaryipAutoDeleteName := fmt.Sprintf("%s.%s", primaryipName, "0.name") + ripId := d.Get(ripIdName).(string) + updateripoptions := &vpcv1.UpdateSubnetReservedIPOptions{ + SubnetID: &subnetId, + ID: &ripId, + } + reservedIpPath := &vpcv1.ReservedIPPatch{} + if d.HasChange(primaryipNameName) { + name := d.Get(primaryipNameName).(string) + reservedIpPath.Name = &name + } + if d.HasChange(primaryipAutoDeleteName) { + auto := d.Get(primaryipAutoDeleteName).(bool) + reservedIpPath.AutoDelete = &auto } - _, response, err := instanceC.CreateSecurityGroupTargetBinding(createsgnicoptions) + reservedIpPathAsPatch, err := reservedIpPath.AsPatch() if err != nil { - return fmt.Errorf("[ERROR] Error while creating security group %q for virtual network interface %s\n%s: %q", add[i], vniId, err, response) + return fmt.Errorf("[ERROR] Error calling reserved ip as patch on vni patch \n%s", err) } - _, err = isWaitForVirtualNetworkInterfaceAvailable(instanceC, vniId, d.Timeout(schema.TimeoutUpdate)) + updateripoptions.ReservedIPPatch = reservedIpPathAsPatch + _, response, err := instanceC.UpdateSubnetReservedIP(updateripoptions) if err != nil { - return err + return fmt.Errorf("[ERROR] Error updating vni reserved ip(%s): %s\n%s", ripId, err, response) } } + if d.HasChange(sgName) { + ovs, nvs := d.GetChange(sgName) + ov := ovs.(*schema.Set) + nv := nvs.(*schema.Set) + remove := flex.ExpandStringList(ov.Difference(nv).List()) + add := flex.ExpandStringList(nv.Difference(ov).List()) + if len(add) > 0 { + for i := range add { + createsgnicoptions := &vpcv1.CreateSecurityGroupTargetBindingOptions{ + SecurityGroupID: &add[i], + ID: &vniId, + } + _, response, err := instanceC.CreateSecurityGroupTargetBinding(createsgnicoptions) + if err != nil { + return fmt.Errorf("[ERROR] Error while creating security group %q for virtual network interface %s\n%s: %q", add[i], vniId, err, response) + } + _, err = isWaitForVirtualNetworkInterfaceAvailable(instanceC, vniId, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + return err + } + } - } - if len(remove) > 0 { - for i := range remove { - deletesgnicoptions := &vpcv1.DeleteSecurityGroupTargetBindingOptions{ - SecurityGroupID: &remove[i], - ID: &vniId, } - response, err := instanceC.DeleteSecurityGroupTargetBinding(deletesgnicoptions) - if err != nil { - return fmt.Errorf("[ERROR] Error while removing security group %q for virtual network interface %s\n%s: %q", remove[i], d.Id(), err, response) - } - _, err = isWaitForVirtualNetworkInterfaceAvailable(instanceC, vniId, d.Timeout(schema.TimeoutUpdate)) - if err != nil { - return err + if len(remove) > 0 { + for i := range remove { + deletesgnicoptions := &vpcv1.DeleteSecurityGroupTargetBindingOptions{ + SecurityGroupID: &remove[i], + ID: &vniId, + } + response, err := instanceC.DeleteSecurityGroupTargetBinding(deletesgnicoptions) + if err != nil { + return fmt.Errorf("[ERROR] Error while removing security group %q for virtual network interface %s\n%s: %q", remove[i], d.Id(), err, response) + } + _, err = isWaitForVirtualNetworkInterfaceAvailable(instanceC, vniId, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + return err + } + } } } + } - } + } } - } + } //primary_network_attachment @@ -5891,3 +5962,12 @@ func resourceIBMIsInstanceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototy } return model, nil } + +func containsNacId(s []string, e string) bool { + for _, a := range s { + if a == e { + return true + } + } + return false +} diff --git a/website/docs/r/is_instance.html.markdown b/website/docs/r/is_instance.html.markdown index 00331a543d..121916a179 100644 --- a/website/docs/r/is_instance.html.markdown +++ b/website/docs/r/is_instance.html.markdown @@ -531,15 +531,17 @@ Review the argument references that you can specify for your resource. - `protocol` - (Optional, String) The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is enabled. Default is **http** - `response_hop_limit` - (Optional, Integer) The hop limit (IP time to live) for IP response packets from the metadata service. Default is **1** - `name` - (Optional, String) The instance name. -- `network_attachments` - (Optional, List) The network attachments for this virtual server instance, including the primary network attachment. +- `network_attachments` - (Optional, List) The network attachments for this virtual server instance, including the primary network attachment. Adding and removing of network attachments must be done from the rear end to avoid unwanted differences and changes in terraform. Nested schema for **network_attachments**: - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. Nested schema for **deleted**: - `more_info` - (Required, String) Link to documentation about deleted resources. - `href` - (String) The URL for this network attachment. - ~> **NOTE** to add `ips` only existing `reserved_ip` is supported, new reserved_ip creation is not supported as it leads to unmanaged(dangling) reserved ips. Use `ibm_is_subnet_reserved_ip` to create a reserved_ip - `id` - (String) The unique identifier for this network attachment. - - `name` - (Required, String) + - `ips` - (Optional, Array of strings) Array of reserved ip identifier for this network attachment. + + ~> **NOTE** to add `ips` only existing `reserved_ip` is supported, new reserved_ip creation is not supported as it leads to unmanaged(dangling) reserved ips. Use `ibm_is_subnet_reserved_ip` to create a reserved_ip + - `name` - (Required, String) Name of the attachment. Name is a required field. - `primary_ip` - (Required, List) The primary IP address of the virtual network interface for the network attachment. Nested schema for **primary_ip**: - `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. @@ -590,7 +592,9 @@ Review the argument references that you can specify for your resource. - `more_info` - (Required, String) Link to documentation about deleted resources. - `href` - (String) The URL for this network attachment. - `id` - (String) The unique identifier for this network attachment. - - `name` - (Required, String) + - `name` - (Required, String) The name of this network attachment + - `virtual_network_interface` - (Required, List(1)) The name of this network attachment + - `primary_ip` - (Required, List) The primary IP address of the virtual network interface for the network attachment. Nested schema for **primary_ip**: - `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. From e9ce0a208b690869f4336d92e1b3bd6eb42d0162 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 1 Dec 2023 13:40:23 +0530 Subject: [PATCH 087/132] Update is_instance.html.markdown --- website/docs/r/is_instance.html.markdown | 94 ++++++++++++------------ 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/website/docs/r/is_instance.html.markdown b/website/docs/r/is_instance.html.markdown index 121916a179..44311dd538 100644 --- a/website/docs/r/is_instance.html.markdown +++ b/website/docs/r/is_instance.html.markdown @@ -538,31 +538,30 @@ Review the argument references that you can specify for your resource. - `more_info` - (Required, String) Link to documentation about deleted resources. - `href` - (String) The URL for this network attachment. - `id` - (String) The unique identifier for this network attachment. - - `ips` - (Optional, Array of strings) Array of reserved ip identifier for this network attachment. - - ~> **NOTE** to add `ips` only existing `reserved_ip` is supported, new reserved_ip creation is not supported as it leads to unmanaged(dangling) reserved ips. Use `ibm_is_subnet_reserved_ip` to create a reserved_ip - `name` - (Required, String) Name of the attachment. Name is a required field. - - `primary_ip` - (Required, List) The primary IP address of the virtual network interface for the network attachment. - Nested schema for **primary_ip**: - - `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. - - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. - Nested schema for **deleted**: - - `more_info` - (Required, String) Link to documentation about deleted resources. - - `href` - (Required, String) The URL for this reserved IP. - - `id` - (Required, String) The unique identifier for this reserved IP. - - `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - - `resource_type` - (String) The resource type. - - `resource_type` - (String) The resource type. - - `subnet` - (Required, List) The subnet of the virtual network interface for the network attachment. - Nested schema for **subnet**: - - `crn` - (Required, String) The CRN for this subnet. - - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. - Nested schema for **deleted**: - - `more_info` - (Required, String) Link to documentation about deleted resources. - - `href` - (Required, String) The URL for this subnet. - - `id` - (Required, String) The unique identifier for this subnet. - - `name` - (String) The name for this subnet. The name is unique across all subnets in the VPC. - - `resource_type` - (String) The resource type. + - `virtual_network_interface` - (Required, List(1)) The details of the virtual network interface for this network attachment. It can either accept an `id` or properties of `virtual_network_interface` + Nested schema for **virtual_network_interface**: + - `id` - (Optional, String) The `id` of the virtual network interface, id conflicts with other properties of virtual network interface + - `allow_ip_spoofing` - (Optional, Boolean) 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. + - `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when target is deleted + - `enable_infrastructure_nat` - (Optional, Boolean) If true: The VPC infrastructure performs any needed NAT operations and 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. + - `name` - (Optional, String) The resource type. + - `ips` - (Optional, Array of String) 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. + ~> **NOTE** to add `ips` only existing `reserved_ip` is supported, new reserved_ip creation is not supported as it leads to unmanaged(dangling) reserved ips. Use `ibm_is_subnet_reserved_ip` to create a reserved_ip + - `resource_group` - (Optional, String) The resource type. + - `security_groups` - (Optional, Array of String) The resource type. + - `primary_ip` - (Required, List) The primary IP address of the virtual network interface for the network attachment. + Nested schema for **primary_ip**: + - `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (Required, String) Link to documentation about deleted resources. + - `href` - (Required, String) The URL for this reserved IP. + - `id` - (Required, String) The unique identifier for this reserved IP. + - `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. + - `resource_type` - (String) The resource type. + - `subnet` - (Required, String) The subnet id of the virtual network interface for the network attachment. - `network_interfaces` (Optional, Forces new resource, List) A list of more network interfaces that are set up for the instance. -> **Allowed vNIC per profile.** Follow the vNIC count as per the instance profile's `network_interface_count`. For details see [`is_instance_profile`](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/is_instance_profile) or [`is_instance_profiles`](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/is_instance_profiles). @@ -593,29 +592,30 @@ Review the argument references that you can specify for your resource. - `href` - (String) The URL for this network attachment. - `id` - (String) The unique identifier for this network attachment. - `name` - (Required, String) The name of this network attachment - - `virtual_network_interface` - (Required, List(1)) The name of this network attachment - - - `primary_ip` - (Required, List) The primary IP address of the virtual network interface for the network attachment. - Nested schema for **primary_ip**: - - `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. - - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. - Nested schema for **deleted**: - - `more_info` - (Required, String) Link to documentation about deleted resources. - - `href` - (Required, String) The URL for this reserved IP. - - `id` - (Required, String) The unique identifier for this reserved IP. - - `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - - `resource_type` - (String) The resource type. - - `resource_type` - (String) The resource type. - - `subnet` - (Required, List) The subnet of the virtual network interface for the network attachment. - Nested schema for **subnet**: - - `crn` - (Required, String) The CRN for this subnet. - - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. - Nested schema for **deleted**: - - `more_info` - (Required, String) Link to documentation about deleted resources. - - `href` - (Required, String) The URL for this subnet. - - `id` - (Required, String) The unique identifier for this subnet. - - `name` - (String) The name for this subnet. The name is unique across all subnets in the VPC. - - `resource_type` - (String) The resource type. + - `resource_type` - (String) The resource type. + - `virtual_network_interface` - (Required, List(1)) The details of the virtual network interface for this network attachment. It can either accept an `id` or properties of `virtual_network_interface` + Nested schema for **virtual_network_interface**: + - `id` - (Optional, List) The `id` of the virtual network interface, id conflicts with other properties of virtual network interface + - `allow_ip_spoofing` - (Optional, Boolean) 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. + - `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when target is deleted + - `enable_infrastructure_nat` - (Optional, Boolean) If true: The VPC infrastructure performs any needed NAT operations and 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. + - `name` - (Optional, String) The resource type. + - `ips` - (Optional, Array of String) 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. + - `resource_group` - (Optional, String) The resource type. + - `security_groups` - (Optional, Array of String) The resource type. + - `primary_ip` - (Required, List) The primary IP address of the virtual network interface for the network attachment. + Nested schema for **primary_ip**: + - `address` - (Required, String) The IP address.If the address has not yet been selected, the value will be `0.0.0.0`.This property may add support for IPv6 addresses in the future. When processing a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + - `deleted` - (Optional, List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for **deleted**: + - `more_info` - (Required, String) Link to documentation about deleted resources. + - `href` - (Required, String) The URL for this reserved IP. + - `id` - (Required, String) The unique identifier for this reserved IP. + - `name` - (Required, String) The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + - `resource_type` - (String) The resource type. + - `resource_type` - (String) The resource type. + - `subnet` - (Required, String) The subnet id of the virtual network interface for the network attachment. + - `primary_network_interface` - (Required, List) A nested block describes the primary network interface of this instance. Only one primary network interface can be specified for an instance. When using `instance_template`, `primary_network_interface` is not required. Nested scheme for `primary_network_interface`: From de979d8ccbb67151c41a5f43e3c2ddd9d5b4a2b5 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 1 Dec 2023 17:14:13 +0530 Subject: [PATCH 088/132] checking in final changes --- go.mod | 11 +- go.sum | 20 + ibm/service/vpc/resource_ibm_is_instance.go | 388 ++++++++++---------- website/docs/r/is_instance.html.markdown | 2 +- 4 files changed, 224 insertions(+), 197 deletions(-) diff --git a/go.mod b/go.mod index 5c6d09affc..bb92c45a38 100644 --- a/go.mod +++ b/go.mod @@ -70,6 +70,7 @@ require ( require ( cloud.google.com/go/kms v1.10.1 // indirect cloud.google.com/go/monitoring v1.13.0 // indirect + github.com/Bowery/prompt v0.0.0-20190916142128-fa8279994f75 // indirect github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 // indirect github.com/PromonLogicalis/asn1 v0.0.0-20190312173541-d60463189a56 // indirect github.com/agext/levenshtein v1.2.2 // indirect @@ -86,6 +87,7 @@ require ( github.com/coreos/pkg v0.0.0-20220810130054-c7d1c02cb6cf // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a // indirect + github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185 // indirect github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect github.com/eapache/go-resiliency v1.4.0 // indirect github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect @@ -118,6 +120,7 @@ require ( github.com/google/gnostic v0.6.9 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect + github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect @@ -158,6 +161,7 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/kardianos/govendor v1.0.9 // indirect github.com/klauspost/compress v1.16.7 // indirect github.com/kube-object-storage/lib-bucket-provisioner v0.0.0-20221122204822-d1a8c34382f1 // indirect github.com/leodido/go-urn v1.2.4 // indirect @@ -169,6 +173,8 @@ require ( github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.0 // indirect + github.com/mitchellh/gox v1.0.1 // indirect + github.com/mitchellh/iochan v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/moby/spdystream v0.2.0 // indirect @@ -205,10 +211,13 @@ require ( go.uber.org/ratelimit v0.2.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.7.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect + golang.org/x/tools v0.12.0 // indirect + golang.org/x/tools/cmd/cover v0.1.0-deprecated // indirect + golang.org/x/tools/go/vcs v0.1.0-deprecated // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect diff --git a/go.sum b/go.sum index 2deeef865a..7c91dc6748 100644 --- a/go.sum +++ b/go.sum @@ -93,6 +93,8 @@ github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= +github.com/Bowery/prompt v0.0.0-20190916142128-fa8279994f75 h1:xGHheKK44eC6K0u5X+DZW/fRaR1LnDdqPHMZMWx5fv8= +github.com/Bowery/prompt v0.0.0-20190916142128-fa8279994f75/go.mod h1:4/6eNcqZ09BZ9wLK3tZOjBA1nDj+B0728nlX5YRlSmQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -139,6 +141,7 @@ github.com/IBM/go-sdk-core/v5 v5.7.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= +github.com/IBM/go-sdk-core/v5 v5.12.1/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= github.com/IBM/go-sdk-core/v5 v5.15.0 h1:AhFoWVk3i58f9vnDoEoZumI/zbtRoP5moWIz5YQOmZg= github.com/IBM/go-sdk-core/v5 v5.15.0/go.mod h1:5Obavm/s1Tc2PxivEIfgCvj/HJ5h3QIOjLHS5y8QJf0= github.com/IBM/ibm-cos-sdk-go v1.3.1/go.mod h1:YLBAYobEA8bD27P7xpMwSQeNQu6W3DNBtBComXrRzRY= @@ -360,6 +363,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a h1:saTgr5tMLFnmy/yg3qDTft4rE5DY2uJ/cCxCe3q0XTU= github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a/go.mod h1:Bw9BbhOJVNR+t0jCqx2GC6zv0TGBsShs56Y3gfSCvl0= +github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185 h1:3T8ZyTDp5QxTx3NU48JVb2u+75xc040fofcBaN+6jPA= +github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185/go.mod h1:cFRxtTwTOJkz2x3rQUNCYKWC93yP1VKjR8NUhqFxZNU= github.com/denisenkom/go-mssqldb v0.0.0-20190412130859-3b1d194e553a/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba h1:p6poVbjHDkKa+wtC8frBMwQtT3BmqGYBjzMwJ63tuR4= github.com/dgryski/go-metro v0.0.0-20180109044635-280f6062b5bc h1:8WFBn63wegobsYAX0YjD+8suexZDga5CctH4CCTx2+8= @@ -738,6 +743,8 @@ github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20230510103437-eeec1cb781c3 h1:2XF1Vzq06X+inNqgJ9tRnGuw+ZVCB3FazXODD6JE1R8= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -887,6 +894,7 @@ github.com/hashicorp/go-uuid v1.0.2-0.20191001231223-f32f5fe8d6a8/go.mod h1:6SBZ github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= @@ -1071,6 +1079,8 @@ github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVY github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kardianos/govendor v1.0.9 h1:WOH3FcVI9eOgnIZYg96iwUwrL4eOVx+aQ66oyX2R8Yc= +github.com/kardianos/govendor v1.0.9/go.mod h1:yvmR6q9ZZ7nSF5Wvh40v0wfP+3TwwL8zYQp+itoZSVM= github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/kelseyhightower/envconfig v1.3.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= @@ -1185,7 +1195,10 @@ github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/gox v1.0.1 h1:x0jD3dcHk9a9xPSDN6YEL4xL6Qz0dvNYm8yZqui5chI= +github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4= github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= +github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= @@ -1288,6 +1301,7 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/onsi/gomega v1.18.0/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= @@ -1938,6 +1952,8 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -2065,6 +2081,10 @@ golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= +golang.org/x/tools/cmd/cover v0.1.0-deprecated h1:Rwy+mWYz6loAF+LnG1jHG/JWMHRMMC2/1XX3Ejkx9lA= +golang.org/x/tools/cmd/cover v0.1.0-deprecated/go.mod h1:hMDiIvlpN1NoVgmjLjUJE9tMHyxHjFX7RuQ+rW12mSA= +golang.org/x/tools/go/vcs v0.1.0-deprecated h1:cOIJqWBl99H1dH5LWizPa+0ImeeJq3t3cJjaeOWUAL4= +golang.org/x/tools/go/vcs v0.1.0-deprecated/go.mod h1:zUrvATBAvEI9535oC0yWYsLsHIV4Z7g63sNPVMtuBy8= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/ibm/service/vpc/resource_ibm_is_instance.go b/ibm/service/vpc/resource_ibm_is_instance.go index ce3b657854..13950c7844 100644 --- a/ibm/service/vpc/resource_ibm_is_instance.go +++ b/ibm/service/vpc/resource_ibm_is_instance.go @@ -846,9 +846,9 @@ func ResourceIBMISInstance() *schema.Resource { // pna can accept either vni id or prototype "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - // DiffSuppressFunc: flex.ApplyOnce, + Type: schema.TypeString, + Optional: true, + Computed: true, ValidateFunc: validate.InvokeValidator("ibm_is_instance_network_attachment", "name"), Description: "The name for this instance network attachment. The name is unique across all network attachments for the instance.", }, @@ -4148,13 +4148,11 @@ func instanceUpdate(d *schema.ResourceData, meta interface{}) error { flag := false for _, currNtsG := range ntsIntf { currNts := currNtsG.(map[string]interface{}) - if currOts["name"].(string) == currNts["name"].(string) { + if currOts["id"].(string) == currNts["id"].(string) { flag = true } } - if !flag { - log.Printf("[INFO] Nac with name (%s) will be deleted", currOts["name"].(string)) nacId := currOts["id"] if nacId != nil && nacId.(string) != "" { @@ -4173,231 +4171,231 @@ func instanceUpdate(d *schema.ResourceData, meta interface{}) error { } } } - } for i, nac := range nacs { nacIdKey := fmt.Sprintf("network_attachments.%d.id", i) nacId := d.Get(nacIdKey).(string) // if nacId is empty, then create - if nacId == "" || containsNacId(out, nacId) { - if nacId == "" { - log.Printf("[DEBUG] nacId is empty") - allowipspoofing := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.allow_ip_spoofing", i) - autodelete := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.auto_delete", i) - enablenat := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.enable_infrastructure_nat", i) - nacMap := nac.(map[string]interface{}) - VirtualNetworkInterfaceModel, err := resourceIBMIsInstanceMapToVirtualNetworkInterfacePrototypeAttachmentContext(allowipspoofing, autodelete, enablenat, d, nacMap["virtual_network_interface"].([]interface{})[0].(map[string]interface{})) + // if nacId == "" || containsNacId(out, nacId) { + + if nacId == "" { + log.Printf("[DEBUG] nacId is empty") + allowipspoofing := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.allow_ip_spoofing", i) + autodelete := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.auto_delete", i) + enablenat := fmt.Sprintf("network_attachments.%d.virtual_network_interface.0.enable_infrastructure_nat", i) + nacMap := nac.(map[string]interface{}) + VirtualNetworkInterfaceModel, err := resourceIBMIsInstanceMapToVirtualNetworkInterfacePrototypeAttachmentContext(allowipspoofing, autodelete, enablenat, d, nacMap["virtual_network_interface"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return err + } + nacNameStr := nacMap["name"].(string) + createInstanceNetworkAttachmentOptions := &vpcv1.CreateInstanceNetworkAttachmentOptions{ + InstanceID: &id, + Name: &nacNameStr, + VirtualNetworkInterface: VirtualNetworkInterfaceModel, + } + _, res, err := instanceC.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions) + if err != nil { + return fmt.Errorf("[ERROR] Error while creating network attachment(%s) of instance(%s) \n%s: %q", nacNameStr, d.Id(), err, res) + } + } else { + log.Printf("[DEBUG] nacId is not empty") + nacName := fmt.Sprintf("network_attachments.%d.name", i) + nacVniName := fmt.Sprintf("network_attachments.%d.virtual_network_interface", i) + primaryipName := fmt.Sprintf("%s.%s", nacVniName, "0.primary_ip") + sgName := fmt.Sprintf("%s.%s", nacVniName, "0.security_groups") + if d.HasChange(nacName) { + networkName := d.Get(nacName).(string) + updateInstanceNetworkAttachmentOptions := &vpcv1.UpdateInstanceNetworkAttachmentOptions{ + InstanceID: &id, + ID: &nacId, + } + instanceNetworkAttachmentPatch := &vpcv1.InstanceNetworkAttachmentPatch{ + Name: &networkName, + } + instanceNetworkAttachmentPatchAsPatch, err := instanceNetworkAttachmentPatch.AsPatch() + if err != nil { + return (fmt.Errorf("[ERROR] Error encountered while apply as patch for instanceNetworkAttachmentPatchAsPatch of network attachment(%s) of instance(%s) %s", nacId, id, err)) + } + updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchAsPatch + _, res, err := instanceC.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions) if err != nil { - return err + return (fmt.Errorf("[ERROR] Error encountered while updating network attachment(%s) name of instance(%s) %s/n%s", nacId, id, err, res)) } - nacNameStr := nacMap["name"].(string) - createInstanceNetworkAttachmentOptions := &vpcv1.CreateInstanceNetworkAttachmentOptions{ - InstanceID: &id, - Name: &nacNameStr, - VirtualNetworkInterface: VirtualNetworkInterfaceModel, + // output, err := json.MarshalIndent(updateInstanceNetworkAttachmentOptions, "", " ") + // if err == nil { + // log.Printf("%+v\n", string(output)) + // } else { + // log.Printf("Error : %#v", updateInstanceNetworkAttachmentOptions) + // } + } + if d.HasChange(nacVniName) { + vniId := d.Get(fmt.Sprintf("%s.%s", nacVniName, "0.id")).(string) + updateVirtualNetworkInterfaceOptions := &vpcv1.UpdateVirtualNetworkInterfaceOptions{ + ID: &vniId, + } + virtualNetworkInterfacePatch := &vpcv1.VirtualNetworkInterfacePatch{} + autoDeleteName := fmt.Sprintf("%s.%s", nacVniName, "0.auto_delete") + nameName := fmt.Sprintf("%s.%s", nacVniName, "0.name") + ipsName := fmt.Sprintf("%s.%s", nacVniName, "0.ips") + enableNatName := fmt.Sprintf("%s.%s", nacVniName, "0.enable_infrastructure_nat") + allowIpSpoofingName := fmt.Sprintf("%s.%s", nacVniName, "0.allow_ip_spoofing") + if d.HasChange(autoDeleteName) { + autodelete := d.Get(autoDeleteName).(bool) + virtualNetworkInterfacePatch.AutoDelete = &autodelete + } + if d.HasChange(nameName) { + name := d.Get(nameName).(string) + virtualNetworkInterfacePatch.Name = &name + } + if d.HasChange(enableNatName) { + enableNat := d.Get(enableNatName).(bool) + virtualNetworkInterfacePatch.EnableInfrastructureNat = &enableNat + } + if d.HasChange(allowIpSpoofingName) { + allIpSpoofing := d.Get(allowIpSpoofingName).(bool) + virtualNetworkInterfacePatch.AllowIPSpoofing = &allIpSpoofing } - _, res, err := instanceC.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions) + virtualNetworkInterfacePatchAsPatch, err := virtualNetworkInterfacePatch.AsPatch() if err != nil { - return fmt.Errorf("[ERROR] Error while creating network attachment(%s) of instance(%s) \n%s: %q", nacNameStr, d.Id(), err, res) + return fmt.Errorf("[ERROR] Error encountered while apply as patch for virtualNetworkInterfacePatch of instance(%s) vni (%s) %s", d.Id(), vniId, err) } - } else { - log.Printf("[DEBUG] nacId is not empty") - nacName := fmt.Sprintf("network_attachments.%d.name", i) - nacVniName := fmt.Sprintf("network_attachments.%d.virtual_network_interface", i) - primaryipName := fmt.Sprintf("%s.%s", nacVniName, "0.primary_ip") - sgName := fmt.Sprintf("%s.%s", nacVniName, "0.security_groups") - if d.HasChange(nacName) { - networkName := d.Get(nacName).(string) - updateInstanceNetworkAttachmentOptions := &vpcv1.UpdateInstanceNetworkAttachmentOptions{ - InstanceID: &id, - ID: &nacId, + updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchAsPatch + _, response, err := instanceC.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions) + if err != nil { + log.Printf("[DEBUG] UpdateVirtualNetworkInterfaceWithContext failed %s\n%s", err, response) + return fmt.Errorf("UpdateVirtualNetworkInterfaceWithContext failed during instance(%s) network attachment patch %s\n%s", d.Id(), err, response) + } + + if d.HasChange(ipsName) { + oldips, newips := d.GetChange(ipsName) + os := oldips.(*schema.Set) + ns := newips.(*schema.Set) + var oldset, newset *schema.Set + + var out = make([]interface{}, ns.Len(), ns.Len()) + for i, nA := range ns.List() { + newPack := nA.(map[string]interface{}) + out[i] = newPack["reserved_ip"].(string) } - instanceNetworkAttachmentPatch := &vpcv1.InstanceNetworkAttachmentPatch{ - Name: &networkName, + newset = schema.NewSet(schema.HashString, out) + + out = make([]interface{}, os.Len(), os.Len()) + for i, oA := range os.List() { + oldPack := oA.(map[string]interface{}) + out[i] = oldPack["reserved_ip"].(string) } - instanceNetworkAttachmentPatchAsPatch, err := instanceNetworkAttachmentPatch.AsPatch() - if err != nil { - return (fmt.Errorf("[ERROR] Error encountered while apply as patch for instanceNetworkAttachmentPatchAsPatch of network attachment(%s) of instance(%s) %s", nacId, id, err)) + oldset = schema.NewSet(schema.HashString, out) + + remove := flex.ExpandStringList(oldset.Difference(newset).List()) + add := flex.ExpandStringList(newset.Difference(oldset).List()) + + if add != nil && len(add) > 0 { + for _, ipItem := range add { + if ipItem != "" { + addVirtualNetworkInterfaceIPOptions := &vpcv1.AddVirtualNetworkInterfaceIPOptions{} + addVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) + addVirtualNetworkInterfaceIPOptions.SetID(ipItem) + _, response, err := instanceC.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + return fmt.Errorf("AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + } + } + } } - updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchAsPatch - _, res, err := instanceC.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions) - if err != nil { - return (fmt.Errorf("[ERROR] Error encountered while updating network attachment(%s) name of instance(%s) %s/n%s", nacId, id, err, res)) + if remove != nil && len(remove) > 0 { + for _, ipItem := range remove { + if ipItem != "" { + removeVirtualNetworkInterfaceIPOptions := &vpcv1.RemoveVirtualNetworkInterfaceIPOptions{} + removeVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) + removeVirtualNetworkInterfaceIPOptions.SetID(ipItem) + response, err := instanceC.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions) + if err != nil { + log.Printf("[DEBUG] RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + return fmt.Errorf("RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) + } + } + } } - // output, err := json.MarshalIndent(updateInstanceNetworkAttachmentOptions, "", " ") - // if err == nil { - // log.Printf("%+v\n", string(output)) - // } else { - // log.Printf("Error : %#v", updateInstanceNetworkAttachmentOptions) - // } } - if d.HasChange(nacVniName) { - vniId := d.Get(fmt.Sprintf("%s.%s", nacVniName, "0.id")).(string) - updateVirtualNetworkInterfaceOptions := &vpcv1.UpdateVirtualNetworkInterfaceOptions{ - ID: &vniId, - } - virtualNetworkInterfacePatch := &vpcv1.VirtualNetworkInterfacePatch{} - autoDeleteName := fmt.Sprintf("%s.%s", nacVniName, "0.auto_delete") - nameName := fmt.Sprintf("%s.%s", nacVniName, "0.name") - ipsName := fmt.Sprintf("%s.%s", nacVniName, "0.ips") - enableNatName := fmt.Sprintf("%s.%s", nacVniName, "0.enable_infrastructure_nat") - allowIpSpoofingName := fmt.Sprintf("%s.%s", nacVniName, "0.allow_ip_spoofing") - if d.HasChange(autoDeleteName) { - autodelete := d.Get(autoDeleteName).(bool) - virtualNetworkInterfacePatch.AutoDelete = &autodelete - } - if d.HasChange(nameName) { - name := d.Get(nameName).(string) - virtualNetworkInterfacePatch.Name = &name + + if d.HasChange(primaryipName) { + subnetIdName := fmt.Sprintf("%s.%s", nacVniName, "0.subnet") + ripIdName := fmt.Sprintf("%s.%s", primaryipName, "0.reserved_ip") + subnetId := d.Get(subnetIdName).(string) + primaryipNameName := fmt.Sprintf("%s.%s", primaryipName, "0.name") + primaryipAutoDeleteName := fmt.Sprintf("%s.%s", primaryipName, "0.name") + ripId := d.Get(ripIdName).(string) + updateripoptions := &vpcv1.UpdateSubnetReservedIPOptions{ + SubnetID: &subnetId, + ID: &ripId, } - if d.HasChange(enableNatName) { - enableNat := d.Get(enableNatName).(bool) - virtualNetworkInterfacePatch.EnableInfrastructureNat = &enableNat + reservedIpPath := &vpcv1.ReservedIPPatch{} + if d.HasChange(primaryipNameName) { + name := d.Get(primaryipNameName).(string) + reservedIpPath.Name = &name } - if d.HasChange(allowIpSpoofingName) { - allIpSpoofing := d.Get(allowIpSpoofingName).(bool) - virtualNetworkInterfacePatch.AllowIPSpoofing = &allIpSpoofing + if d.HasChange(primaryipAutoDeleteName) { + auto := d.Get(primaryipAutoDeleteName).(bool) + reservedIpPath.AutoDelete = &auto } - virtualNetworkInterfacePatchAsPatch, err := virtualNetworkInterfacePatch.AsPatch() + reservedIpPathAsPatch, err := reservedIpPath.AsPatch() if err != nil { - return fmt.Errorf("[ERROR] Error encountered while apply as patch for virtualNetworkInterfacePatch of instance(%s) vni (%s) %s", d.Id(), vniId, err) + return fmt.Errorf("[ERROR] Error calling reserved ip as patch on vni patch \n%s", err) } - updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchAsPatch - _, response, err := instanceC.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions) + updateripoptions.ReservedIPPatch = reservedIpPathAsPatch + _, response, err := instanceC.UpdateSubnetReservedIP(updateripoptions) if err != nil { - log.Printf("[DEBUG] UpdateVirtualNetworkInterfaceWithContext failed %s\n%s", err, response) - return fmt.Errorf("UpdateVirtualNetworkInterfaceWithContext failed during instance(%s) network attachment patch %s\n%s", d.Id(), err, response) + return fmt.Errorf("[ERROR] Error updating vni reserved ip(%s): %s\n%s", ripId, err, response) } - - if d.HasChange(ipsName) { - oldips, newips := d.GetChange(ipsName) - os := oldips.(*schema.Set) - ns := newips.(*schema.Set) - var oldset, newset *schema.Set - - var out = make([]interface{}, ns.Len(), ns.Len()) - for i, nA := range ns.List() { - newPack := nA.(map[string]interface{}) - out[i] = newPack["reserved_ip"].(string) - } - newset = schema.NewSet(schema.HashString, out) - - out = make([]interface{}, os.Len(), os.Len()) - for i, oA := range os.List() { - oldPack := oA.(map[string]interface{}) - out[i] = oldPack["reserved_ip"].(string) - } - oldset = schema.NewSet(schema.HashString, out) - - remove := flex.ExpandStringList(oldset.Difference(newset).List()) - add := flex.ExpandStringList(newset.Difference(oldset).List()) - - if add != nil && len(add) > 0 { - for _, ipItem := range add { - if ipItem != "" { - addVirtualNetworkInterfaceIPOptions := &vpcv1.AddVirtualNetworkInterfaceIPOptions{} - addVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) - addVirtualNetworkInterfaceIPOptions.SetID(ipItem) - _, response, err := instanceC.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions) - if err != nil { - log.Printf("[DEBUG] AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) - return fmt.Errorf("AddVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) - } - } + } + if d.HasChange(sgName) { + ovs, nvs := d.GetChange(sgName) + ov := ovs.(*schema.Set) + nv := nvs.(*schema.Set) + remove := flex.ExpandStringList(ov.Difference(nv).List()) + add := flex.ExpandStringList(nv.Difference(ov).List()) + if len(add) > 0 { + for i := range add { + createsgnicoptions := &vpcv1.CreateSecurityGroupTargetBindingOptions{ + SecurityGroupID: &add[i], + ID: &vniId, } - } - if remove != nil && len(remove) > 0 { - for _, ipItem := range remove { - if ipItem != "" { - removeVirtualNetworkInterfaceIPOptions := &vpcv1.RemoveVirtualNetworkInterfaceIPOptions{} - removeVirtualNetworkInterfaceIPOptions.SetVirtualNetworkInterfaceID(vniId) - removeVirtualNetworkInterfaceIPOptions.SetID(ipItem) - response, err := instanceC.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions) - if err != nil { - log.Printf("[DEBUG] RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) - return fmt.Errorf("RemoveVirtualNetworkInterfaceIPWithContext failed in VirtualNetworkInterface patch during instance nac patch %s\n%s", err, response) - } - } + _, response, err := instanceC.CreateSecurityGroupTargetBinding(createsgnicoptions) + if err != nil { + return fmt.Errorf("[ERROR] Error while creating security group %q for virtual network interface %s\n%s: %q", add[i], vniId, err, response) + } + _, err = isWaitForVirtualNetworkInterfaceAvailable(instanceC, vniId, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + return err } } - } - if d.HasChange(primaryipName) { - subnetIdName := fmt.Sprintf("%s.%s", nacVniName, "0.subnet") - ripIdName := fmt.Sprintf("%s.%s", primaryipName, "0.reserved_ip") - subnetId := d.Get(subnetIdName).(string) - primaryipNameName := fmt.Sprintf("%s.%s", primaryipName, "0.name") - primaryipAutoDeleteName := fmt.Sprintf("%s.%s", primaryipName, "0.name") - ripId := d.Get(ripIdName).(string) - updateripoptions := &vpcv1.UpdateSubnetReservedIPOptions{ - SubnetID: &subnetId, - ID: &ripId, - } - reservedIpPath := &vpcv1.ReservedIPPatch{} - if d.HasChange(primaryipNameName) { - name := d.Get(primaryipNameName).(string) - reservedIpPath.Name = &name - } - if d.HasChange(primaryipAutoDeleteName) { - auto := d.Get(primaryipAutoDeleteName).(bool) - reservedIpPath.AutoDelete = &auto - } - reservedIpPathAsPatch, err := reservedIpPath.AsPatch() - if err != nil { - return fmt.Errorf("[ERROR] Error calling reserved ip as patch on vni patch \n%s", err) - } - updateripoptions.ReservedIPPatch = reservedIpPathAsPatch - _, response, err := instanceC.UpdateSubnetReservedIP(updateripoptions) - if err != nil { - return fmt.Errorf("[ERROR] Error updating vni reserved ip(%s): %s\n%s", ripId, err, response) - } } - if d.HasChange(sgName) { - ovs, nvs := d.GetChange(sgName) - ov := ovs.(*schema.Set) - nv := nvs.(*schema.Set) - remove := flex.ExpandStringList(ov.Difference(nv).List()) - add := flex.ExpandStringList(nv.Difference(ov).List()) - if len(add) > 0 { - for i := range add { - createsgnicoptions := &vpcv1.CreateSecurityGroupTargetBindingOptions{ - SecurityGroupID: &add[i], - ID: &vniId, - } - _, response, err := instanceC.CreateSecurityGroupTargetBinding(createsgnicoptions) - if err != nil { - return fmt.Errorf("[ERROR] Error while creating security group %q for virtual network interface %s\n%s: %q", add[i], vniId, err, response) - } - _, err = isWaitForVirtualNetworkInterfaceAvailable(instanceC, vniId, d.Timeout(schema.TimeoutUpdate)) - if err != nil { - return err - } + if len(remove) > 0 { + for i := range remove { + deletesgnicoptions := &vpcv1.DeleteSecurityGroupTargetBindingOptions{ + SecurityGroupID: &remove[i], + ID: &vniId, } - - } - if len(remove) > 0 { - for i := range remove { - deletesgnicoptions := &vpcv1.DeleteSecurityGroupTargetBindingOptions{ - SecurityGroupID: &remove[i], - ID: &vniId, - } - response, err := instanceC.DeleteSecurityGroupTargetBinding(deletesgnicoptions) - if err != nil { - return fmt.Errorf("[ERROR] Error while removing security group %q for virtual network interface %s\n%s: %q", remove[i], d.Id(), err, response) - } - _, err = isWaitForVirtualNetworkInterfaceAvailable(instanceC, vniId, d.Timeout(schema.TimeoutUpdate)) - if err != nil { - return err - } + response, err := instanceC.DeleteSecurityGroupTargetBinding(deletesgnicoptions) + if err != nil { + return fmt.Errorf("[ERROR] Error while removing security group %q for virtual network interface %s\n%s: %q", remove[i], d.Id(), err, response) + } + _, err = isWaitForVirtualNetworkInterfaceAvailable(instanceC, vniId, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + return err } } } - } } + } + // } } } diff --git a/website/docs/r/is_instance.html.markdown b/website/docs/r/is_instance.html.markdown index 44311dd538..a848e7cf86 100644 --- a/website/docs/r/is_instance.html.markdown +++ b/website/docs/r/is_instance.html.markdown @@ -538,7 +538,7 @@ Review the argument references that you can specify for your resource. - `more_info` - (Required, String) Link to documentation about deleted resources. - `href` - (String) The URL for this network attachment. - `id` - (String) The unique identifier for this network attachment. - - `name` - (Required, String) Name of the attachment. Name is a required field. + - `name` - (Optional, String) Name of the attachment. - `virtual_network_interface` - (Required, List(1)) The details of the virtual network interface for this network attachment. It can either accept an `id` or properties of `virtual_network_interface` Nested schema for **virtual_network_interface**: - `id` - (Optional, String) The `id` of the virtual network interface, id conflicts with other properties of virtual network interface From c393b56e8c13121979d89e7db7b75714fe4f2c56 Mon Sep 17 00:00:00 2001 From: Ian Reyes Date: Mon, 4 Dec 2023 03:27:16 -0500 Subject: [PATCH 089/132] Add new service Logs Router to IBM Terraform Provider (#4945) * Added new service Logs Router to IBM Terraform Provider * Ran detect-secrets and re-generated secrets.baseline * Added emptycredentialsError check for Logs Router Client Error Signed-off-by: Ian Reyes * Removed redundant general provider set up information. Fixed Service Subcategories Signed-off-by: Ian Reyes --------- Signed-off-by: Ian Reyes --- .secrets.baseline | 22 +- examples/ibm-logs-router/README.md | 81 ++++++ examples/ibm-logs-router/main.tf | 17 ++ examples/ibm-logs-router/outputs.tf | 6 + examples/ibm-logs-router/variables.tf | 33 +++ examples/ibm-logs-router/versions.tf | 9 + go.mod | 1 + go.sum | 2 + ibm/conns/config.go | 28 ++ ibm/provider/provider.go | 8 + ibm/service/logsrouter/README.md | 11 + .../data_source_ibm_logs_router_tenant.go | 118 ++++++++ ...data_source_ibm_logs_router_tenant_test.go | 44 +++ .../resource_ibm_logs_router_tenant.go | 266 ++++++++++++++++++ .../resource_ibm_logs_router_tenant_test.go | 128 +++++++++ website/allowed-subcategories.txt | 1 + .../docs/d/logs_router_tenant.html.markdown | 52 ++++ .../docs/r/logs_router_tenant.html.markdown | 60 ++++ 18 files changed, 881 insertions(+), 6 deletions(-) create mode 100644 examples/ibm-logs-router/README.md create mode 100644 examples/ibm-logs-router/main.tf create mode 100644 examples/ibm-logs-router/outputs.tf create mode 100644 examples/ibm-logs-router/variables.tf create mode 100644 examples/ibm-logs-router/versions.tf create mode 100644 ibm/service/logsrouter/README.md create mode 100644 ibm/service/logsrouter/data_source_ibm_logs_router_tenant.go create mode 100644 ibm/service/logsrouter/data_source_ibm_logs_router_tenant_test.go create mode 100644 ibm/service/logsrouter/resource_ibm_logs_router_tenant.go create mode 100644 ibm/service/logsrouter/resource_ibm_logs_router_tenant_test.go create mode 100644 website/docs/d/logs_router_tenant.html.markdown create mode 100644 website/docs/r/logs_router_tenant.html.markdown diff --git a/.secrets.baseline b/.secrets.baseline index f7d1438953..3a62206e9a 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -786,7 +786,7 @@ "hashed_secret": "9184b0c38101bf24d78b2bb0d044deb1d33696fc", "is_secret": false, "is_verified": false, - "line_number": 131, + "line_number": 132, "type": "Secret Keyword", "verified_result": null }, @@ -794,7 +794,7 @@ "hashed_secret": "c427f185ddcb2440be9b77c8e45f1cd487a2e790", "is_secret": false, "is_verified": false, - "line_number": 1438, + "line_number": 1449, "type": "Base64 High Entropy String", "verified_result": null }, @@ -802,7 +802,7 @@ "hashed_secret": "1f7e33de15e22de9d2eaf502df284ed25ca40018", "is_secret": false, "is_verified": false, - "line_number": 1505, + "line_number": 1516, "type": "Secret Keyword", "verified_result": null }, @@ -810,7 +810,7 @@ "hashed_secret": "1f614c2eb6b3da22d89bd1b9fd47d7cb7c8fc670", "is_secret": false, "is_verified": false, - "line_number": 3298, + "line_number": 3325, "type": "Secret Keyword", "verified_result": null }, @@ -818,7 +818,7 @@ "hashed_secret": "7abfce65b8504403afc25c9790f358d513dfbcc6", "is_secret": false, "is_verified": false, - "line_number": 3311, + "line_number": 3338, "type": "Secret Keyword", "verified_result": null }, @@ -826,7 +826,7 @@ "hashed_secret": "0c2d85bf9a9b1579b16f220a4ea8c3d62b2e24b1", "is_secret": false, "is_verified": false, - "line_number": 3352, + "line_number": 3379, "type": "Secret Keyword", "verified_result": null } @@ -4505,6 +4505,16 @@ "verified_result": null } ], + "website/docs/r/logs_router_tenant.html.markdown": [ + { + "hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e", + "is_secret": false, + "is_verified": false, + "line_number": 78, + "type": "Secret Keyword", + "verified_result": null + } + ], "website/docs/r/metrics_router_route.html.markdown": [ { "hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e", diff --git a/examples/ibm-logs-router/README.md b/examples/ibm-logs-router/README.md new file mode 100644 index 0000000000..51da09060a --- /dev/null +++ b/examples/ibm-logs-router/README.md @@ -0,0 +1,81 @@ +# Example for IBM Logs Router V1 + +This example illustrates how to use IBM LogsRouterV1 + +The following types of resources are supported: + +* logs_router_tenant + +## Usage + +To run this example, execute the following commands: + +```bash +$ terraform init +$ terraform plan +$ terraform apply +``` + +Run `terraform destroy` when you don't need these resources. + + +## IbmLogsRouterV1 resources + +logs_router_tenant resource: + +```hcl +resource "logs_router_tenant" "logs_router_tenant_instance" { + target_type = var.logs_router_tenant_target_type + target_host = var.logs_router_tenant_target_host + target_port = var.logs_router_tenant_target_port + target_instance_crn = var.logs_router_tenant_target_instance_crn +} +``` + +## IbmLogsRouterV1 data sources + +logs_router_tenant data source: + +```hcl +data "logs_router_tenant" "logs_router_tenant_instance" { + tenant_id = ibm_logs_router_tenant.logs_router_tenant_instance.id +} +``` + +## Assumptions + +1. TODO + +## Notes + +1. TODO + +## Requirements + +| Name | Version | +|------|---------| +| terraform | ~> 0.12 | + +## Providers + +| Name | Version | +|------|---------| +| ibm | 1.13.1 | + +## Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | +| target_type | Type of log-sink. | `string` | true | +| target_host | Host name of log-sink. | `string` | true | +| target_port | Network port of log sink. | `number` | true | +| target_instance_crn | Cloud resource name of the log-sink target instance. | `string` | true | +| tenant_id | The instance ID of the tenant. | `` | true | + +## Outputs + +| Name | Description | +|------|-------------| +| logs_router_tenant | logs_router_tenant object | +| logs_router_tenant | logs_router_tenant object | diff --git a/examples/ibm-logs-router/main.tf b/examples/ibm-logs-router/main.tf new file mode 100644 index 0000000000..1be39ee095 --- /dev/null +++ b/examples/ibm-logs-router/main.tf @@ -0,0 +1,17 @@ +provider "ibm" { + ibmcloud_api_key = var.ibmcloud_api_key +} + +// Provision logs_router_tenant resource instance +resource "ibm_logs_router_tenant" "logs_router_tenant_instance" { + target_type = var.logs_router_tenant_target_type + target_host = var.logs_router_tenant_target_host + target_port = var.logs_router_tenant_target_port + target_instance_crn = var.logs_router_tenant_target_instance_crn +} + +// Create logs_router_tenant data source +data "ibm_logs_router_tenant" "logs_router_tenant_instance" { + tenant_id = ibm_logs_router_tenant.logs_router_tenant_instance.id +} + diff --git a/examples/ibm-logs-router/outputs.tf b/examples/ibm-logs-router/outputs.tf new file mode 100644 index 0000000000..813aeb5bcb --- /dev/null +++ b/examples/ibm-logs-router/outputs.tf @@ -0,0 +1,6 @@ +// This output allows logs_router_tenant data to be referenced by other resources and the terraform CLI +// Modify this output if only certain data should be exposed +output "ibm_logs_router_tenant" { + value = ibm_logs_router_tenant.logs_router_tenant_instance + description = "logs_router_tenant resource instance" +} diff --git a/examples/ibm-logs-router/variables.tf b/examples/ibm-logs-router/variables.tf new file mode 100644 index 0000000000..34a9f372ff --- /dev/null +++ b/examples/ibm-logs-router/variables.tf @@ -0,0 +1,33 @@ +variable "ibmcloud_api_key" { + description = "IBM Cloud API key" + type = string +} + +// Resource arguments for logs_router_tenant +variable "logs_router_tenant_target_type" { + description = "Type of log-sink." + type = string + default = "logdna" +} +variable "logs_router_tenant_target_host" { + description = "Host name of log-sink." + type = string + default = "www.example.com" +} +variable "logs_router_tenant_target_port" { + description = "Network port of log sink." + type = number + default = 10 +} +variable "logs_router_tenant_target_instance_crn" { + description = "Cloud resource name of the log-sink target instance." + type = string + default = "crn:v1:bluemix:public:logdna:us-east:a/36ff82794a734d7580b90c97b0327d28:f08aea7c-dde9-4452-b552-225af4b51eaa::" +} + +// Data source arguments for logs_router_tenant +variable "logs_router_tenant_tenant_id" { + description = "The instance ID of the tenant." + type = string + default = "f3a466c9-c4db-4eee-95cc-ba82db58e2b5" +} diff --git a/examples/ibm-logs-router/versions.tf b/examples/ibm-logs-router/versions.tf new file mode 100644 index 0000000000..54c9d03e8d --- /dev/null +++ b/examples/ibm-logs-router/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_version = ">= 1.0" + required_providers { + ibm = { + source = "IBM-Cloud/ibm" + version = "1.52.0-beta0" + } + } +} diff --git a/go.mod b/go.mod index 3bb6d00084..bffd2441f8 100644 --- a/go.mod +++ b/go.mod @@ -23,6 +23,7 @@ require ( github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20211109141421-a4b61b05f7d1 github.com/IBM/ibm-hpcs-uko-sdk v0.0.20-beta github.com/IBM/keyprotect-go-client v0.12.2 + github.com/IBM/logs-router-go-sdk v1.0.0 github.com/IBM/networking-go-sdk v0.42.2 github.com/IBM/platform-services-go-sdk v0.54.0 github.com/IBM/project-go-sdk v0.1.1 diff --git a/go.sum b/go.sum index 2deeef865a..4477787f09 100644 --- a/go.sum +++ b/go.sum @@ -153,6 +153,8 @@ github.com/IBM/ibm-hpcs-uko-sdk v0.0.20-beta/go.mod h1:MLVNHMYoKsvovJZ4v1gQCpIYt github.com/IBM/keyprotect-go-client v0.5.1/go.mod h1:5TwDM/4FRJq1ZOlwQL1xFahLWQ3TveR88VmL1u3njyI= github.com/IBM/keyprotect-go-client v0.12.2 h1:Cjxcqin9Pl0xz3MnxdiVd4v/eIa79xL3hQpSbwOr/DQ= github.com/IBM/keyprotect-go-client v0.12.2/go.mod h1:yr8h2noNgU8vcbs+vhqoXp3Lmv73PI0zAc6VMgFvWwM= +github.com/IBM/logs-router-go-sdk v1.0.0 h1:cGBjf7wJye/WuzFljqN7yB8ToIxLIiffWaQGW9rSTcI= +github.com/IBM/logs-router-go-sdk v1.0.0/go.mod h1:FJpyZctp5DmRms/MtvRUuWBF/CAk76WJzAsJc4EIM/Y= github.com/IBM/networking-go-sdk v0.42.2 h1:caqjx4jyFHi10Vlf3skHvlL6K3YJRVstsmCBmvdyqkA= github.com/IBM/networking-go-sdk v0.42.2/go.mod h1:lTUZwtUkMANMnrLHFIgRhHrkBfwASY/Iho1fabaPHxo= github.com/IBM/platform-services-go-sdk v0.54.0 h1:WjHWm9ZAJvlq07E1WXXtEe+d/B0sazWD6cEWVT7EMLU= diff --git a/ibm/conns/config.go b/ibm/conns/config.go index ff89bd307f..88eb394709 100644 --- a/ibm/conns/config.go +++ b/ibm/conns/config.go @@ -29,6 +29,7 @@ import ( "github.com/IBM/go-sdk-core/v5/core" cosconfig "github.com/IBM/ibm-cos-sdk-go-config/resourceconfigurationv1" kp "github.com/IBM/keyprotect-go-client" + "github.com/IBM/logs-router-go-sdk/ibmlogsrouteropenapi30v0" cisalertsv1 "github.com/IBM/networking-go-sdk/alertsv1" cisoriginpull "github.com/IBM/networking-go-sdk/authenticatedoriginpullapiv1" cisbotanalyticsv1 "github.com/IBM/networking-go-sdk/botanalyticsv1" @@ -228,6 +229,7 @@ type ClientSession interface { ResourceManagementAPIv2() (managementv2.ResourceManagementAPIv2, error) ResourceControllerAPI() (controller.ResourceControllerAPI, error) ResourceControllerAPIV2() (controllerv2.ResourceControllerAPIV2, error) + IbmLogsRouterOpenApi30V0() (*ibmlogsrouteropenapi30v0.IbmLogsRouterOpenApi30V0, error) SoftLayerSession() *slsession.Session IBMPISession() (*ibmpisession.IBMPISession, error) UserManagementAPI() (usermanagementv2.UserManagementAPI, error) @@ -542,6 +544,10 @@ type clientSession struct { secretsManagerClient *secretsmanagerv2.SecretsManagerV2 secretsManagerClientErr error + // Logs Routing + ibmLogsRouterOpenApi30Client *ibmlogsrouteropenapi30v0.IbmLogsRouterOpenApi30V0 + ibmLogsRouterOpenApi30ClientErr error + // Schematics service options schematicsClient *schematicsv1.SchematicsV1 schematicsClientErr error @@ -1169,6 +1175,11 @@ func (session clientSession) MetricsRouterV3() (*metricsrouterv3.MetricsRouterV3 return session.metricsRouterClient, session.metricsRouterClientErr } +// Logs Router API +func (session clientSession) IbmLogsRouterOpenApi30V0() (*ibmlogsrouteropenapi30v0.IbmLogsRouterOpenApi30V0, error) { + return session.ibmLogsRouterOpenApi30Client, session.ibmLogsRouterOpenApi30ClientErr +} + func (session clientSession) ESschemaRegistrySession() (*schemaregistryv1.SchemaregistryV1, error) { return session.esSchemaRegistryClient, session.esSchemaRegistryErr } @@ -1296,6 +1307,7 @@ func (c *Config) ClientSession() (interface{}, error) { session.cdToolchainClientErr = errEmptyBluemixCredentials session.codeEngineClientErr = errEmptyBluemixCredentials session.projectClientErr = errEmptyBluemixCredentials + session.ibmLogsRouterOpenApi30ClientErr = errEmptyBluemixCredentials return session, nil } @@ -1678,6 +1690,22 @@ func (c *Config) ClientSession() (interface{}, error) { }) } + // LOGS ROUTER service + ibmLogsRouterOpenApi30ClientOptions := &ibmlogsrouteropenapi30v0.IbmLogsRouterOpenApi30V0Options{ + Authenticator: authenticator, + } + session.ibmLogsRouterOpenApi30Client, err = ibmlogsrouteropenapi30v0.NewIbmLogsRouterOpenApi30V0(ibmLogsRouterOpenApi30ClientOptions) + if err == nil { + // Enable retries for API calls + session.ibmLogsRouterOpenApi30Client.Service.EnableRetries(c.RetryCount, c.RetryDelay) + // Add custom header for analytics + session.ibmLogsRouterOpenApi30Client.SetDefaultHeaders(gohttp.Header{ + "X-Original-User-Agent": {fmt.Sprintf("terraform-provider-ibm/%s", version.Version)}, + }) + } else { + session.ibmLogsRouterOpenApi30ClientErr = fmt.Errorf("Error occurred while configuring IBM logs-router service: %q", err) + } + // ATRACKER Version 2 var atrackerClientV2URL string var atrackerURLV2Err error diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index 9a0e61277b..aa758ebf66 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -38,6 +38,7 @@ import ( "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/iampolicy" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/kms" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/kubernetes" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/logsrouter" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/metricsrouter" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/power" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/project" @@ -743,6 +744,9 @@ func Provider() *schema.Provider { "ibm_metrics_router_targets": metricsrouter.DataSourceIBMMetricsRouterTargets(), "ibm_metrics_router_routes": metricsrouter.DataSourceIBMMetricsRouterRoutes(), + // Logs Router + "ibm_logs_router_tenant": logsrouter.DataSourceIbmLogsRouterTenant(), + // Security and Complaince Center(soon to be deprecated) "ibm_scc_account_location": scc.DataSourceIBMSccAccountLocation(), "ibm_scc_account_locations": scc.DataSourceIBMSccAccountLocations(), @@ -1276,6 +1280,9 @@ func Provider() *schema.Provider { "ibm_metrics_router_route": metricsrouter.ResourceIBMMetricsRouterRoute(), "ibm_metrics_router_settings": metricsrouter.ResourceIBMMetricsRouterSettings(), + // Logs Router + "ibm_logs_router_tenant": logsrouter.ResourceIbmLogsRouterTenant(), + // Security and Compliance Center(soon to be deprecated) "ibm_scc_account_settings": scc.ResourceIBMSccAccountSettings(), "ibm_scc_rule_attachment": scc.ResourceIBMSccRuleAttachment(), @@ -1540,6 +1547,7 @@ func Validator() validate.ValidatorDict { "ibm_metrics_router_target": metricsrouter.ResourceIBMMetricsRouterTargetValidator(), "ibm_metrics_router_route": metricsrouter.ResourceIBMMetricsRouterRouteValidator(), "ibm_metrics_router_settings": metricsrouter.ResourceIBMMetricsRouterSettingsValidator(), + "ibm_logs_router_tenant": logsrouter.ResourceIbmLogsRouterTenantValidator(), "ibm_satellite_endpoint": satellite.ResourceIBMSatelliteEndpointValidator(), "ibm_cbr_zone": contextbasedrestrictions.ResourceIBMCbrZoneValidator(), "ibm_cbr_rule": contextbasedrestrictions.ResourceIBMCbrRuleValidator(), diff --git a/ibm/service/logsrouter/README.md b/ibm/service/logsrouter/README.md new file mode 100644 index 0000000000..350106c42d --- /dev/null +++ b/ibm/service/logsrouter/README.md @@ -0,0 +1,11 @@ +# Terraform IBM Provider + +This area is primarily for IBM provider contributors and maintainers. For information on _using_ Terraform and the IBM provider, see the links below. + + +## Handy Links +* [Find out about contributing](../../../CONTRIBUTING.md) to the IBM provider! +* IBM Provider Docs: [Home](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs) +* IBM Provider Docs: [One of the resources](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/logs_router_tenant) +* IBM API Docs: [IBM API Docs for IBM Cloud Logs Router](https://test.cloud.ibm.com/apidocs/logs-router-service-api) +* IBM SDK: [IBM SDK for IBM Cloud Logs Router](https://github.com/IBM/logs-router-go-sdk) diff --git a/ibm/service/logsrouter/data_source_ibm_logs_router_tenant.go b/ibm/service/logsrouter/data_source_ibm_logs_router_tenant.go new file mode 100644 index 0000000000..db12580145 --- /dev/null +++ b/ibm/service/logsrouter/data_source_ibm_logs_router_tenant.go @@ -0,0 +1,118 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package logsrouter + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/logs-router-go-sdk/ibmlogsrouteropenapi30v0" + + "github.com/IBM/go-sdk-core/v5/core" + "github.com/go-openapi/strfmt" +) + +func DataSourceIbmLogsRouterTenant() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmLogsRouterTenantRead, + + Schema: map[string]*schema.Schema{ + "tenant_id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The instance ID of the tenant.", + }, + "account_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The account ID the tenant belongs to.", + }, + "target_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Type of log-sink.", + }, + "target_host": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Host name of log-sink.", + }, + "target_port": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Network port of log sink.", + }, + "target_instance_crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Cloud resource name of the log-sink target instance.", + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Time stamp the tenant was originally created.", + }, + "updated_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "time stamp the tenant was last updated.", + }, + }, + } +} + +func dataSourceIbmLogsRouterTenantRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + ibmLogsRouterOpenApi30Client, err := meta.(conns.ClientSession).IbmLogsRouterOpenApi30V0() + if err != nil { + return diag.FromErr(err) + } + + getTenantDetailOptions := &ibmlogsrouteropenapi30v0.GetTenantDetailOptions{} + + getTenantDetailOptions.SetTenantID(core.UUIDPtr(strfmt.UUID(d.Get("tenant_id").(string)))) + + tenantDetailsResponse, response, err := ibmLogsRouterOpenApi30Client.GetTenantDetailWithContext(context, getTenantDetailOptions) + if err != nil { + log.Printf("[DEBUG] GetTenantDetailWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetTenantDetailWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s", *getTenantDetailOptions.TenantID)) + + if err = d.Set("account_id", tenantDetailsResponse.AccountID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting account_id: %s", err)) + } + + if err = d.Set("target_type", tenantDetailsResponse.TargetType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting target_type: %s", err)) + } + + if err = d.Set("target_host", tenantDetailsResponse.TargetHost); err != nil { + return diag.FromErr(fmt.Errorf("Error setting target_host: %s", err)) + } + + if err = d.Set("target_port", flex.IntValue(tenantDetailsResponse.TargetPort)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting target_port: %s", err)) + } + + if err = d.Set("target_instance_crn", tenantDetailsResponse.TargetInstanceCrn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting target_instance_crn: %s", err)) + } + + if err = d.Set("created_at", tenantDetailsResponse.CreatedAt); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + + if err = d.Set("updated_at", tenantDetailsResponse.UpdatedAt); err != nil { + return diag.FromErr(fmt.Errorf("Error setting updated_at: %s", err)) + } + + return nil +} diff --git a/ibm/service/logsrouter/data_source_ibm_logs_router_tenant_test.go b/ibm/service/logsrouter/data_source_ibm_logs_router_tenant_test.go new file mode 100644 index 0000000000..597acdbded --- /dev/null +++ b/ibm/service/logsrouter/data_source_ibm_logs_router_tenant_test.go @@ -0,0 +1,44 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package logsrouter_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmLogsRouterTenantDataSourceBasic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmLogsRouterTenantDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_logs_router_tenant.logs_router_tenant_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_logs_router_tenant.logs_router_tenant_instance", "tenant_id"), + ), + }, + }, + }) +} + +func testAccCheckIbmLogsRouterTenantDataSourceConfigBasic() string { + return fmt.Sprintf(` + resource "ibm_logs_router_tenant" "logs_router_tenant_instance" { + target_type = "logdna" + target_host = "tf-target-host-01" + target_port = 42 + target_instance_crn = "crn:v1:bluemix:public:logdna:eu-de:a/3516b8fa0a174a71899f5affa4f18d78:3517d2ed-9429-af34-ad52-34278391cbca::" + access_credential = "test-credential" + } + data "ibm_logs_router_tenant" "logs_router_tenant_instance" { + tenant_id = ibm_logs_router_tenant.logs_router_tenant_instance.id + } + `) +} diff --git a/ibm/service/logsrouter/resource_ibm_logs_router_tenant.go b/ibm/service/logsrouter/resource_ibm_logs_router_tenant.go new file mode 100644 index 0000000000..02da4c81c0 --- /dev/null +++ b/ibm/service/logsrouter/resource_ibm_logs_router_tenant.go @@ -0,0 +1,266 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package logsrouter + +import ( + "context" + "fmt" + "log" + + "github.com/go-openapi/strfmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/logs-router-go-sdk/ibmlogsrouteropenapi30v0" +) + +func ResourceIbmLogsRouterTenant() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIbmLogsRouterTenantCreate, + ReadContext: resourceIbmLogsRouterTenantRead, + UpdateContext: resourceIbmLogsRouterTenantUpdate, + DeleteContext: resourceIbmLogsRouterTenantDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "target_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validate.InvokeValidator("ibm_logs_router_tenant", "target_type"), + Description: "Type of log-sink.", + }, + "target_host": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validate.InvokeValidator("ibm_logs_router_tenant", "target_host"), + Description: "Host name of log-sink.", + }, + "target_port": { + Type: schema.TypeInt, + Required: true, + Description: "Network port of log sink.", + }, + "target_instance_crn": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validate.InvokeValidator("ibm_logs_router_tenant", "target_instance_crn"), + Description: "Cloud resource name of the log-sink target instance.", + }, + "access_credential": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validate.InvokeValidator("ibm_logs_router_tenant", "access_credential"), + Description: "Secret to connect to the log-sink", + }, + "account_id": { + Type: schema.TypeString, + Computed: true, + Description: "The account ID the tenant belongs to.", + }, + "created_at": { + Type: schema.TypeString, + Computed: true, + Description: "Time stamp the tenant was originally created.", + }, + "updated_at": { + Type: schema.TypeString, + Computed: true, + Description: "time stamp the tenant was last updated.", + }, + }, + } +} + +func ResourceIbmLogsRouterTenantValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "target_type", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `[a-z,A-Z,0-9,-]`, + MinValueLength: 1, + MaxValueLength: 32, + }, + validate.ValidateSchema{ + Identifier: "target_host", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `[a-z,A-Z,0-9,-,.]`, + MinValueLength: 1, + MaxValueLength: 256, + }, + validate.ValidateSchema{ + Identifier: "target_instance_crn", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `[a-z,A-Z,0-9,:,-]`, + MinValueLength: 1, + MaxValueLength: 256, + }, + validate.ValidateSchema{ + Identifier: "access_credential", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `[a-z,A-Z,0-9,-\\.;!?]`, + MinValueLength: 10, + MaxValueLength: 50, + }, + ) + + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_logs_router_tenant", Schema: validateSchema} + return &resourceValidator +} + +func resourceIbmLogsRouterTenantCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + ibmLogsRouterOpenApi30Client, err := meta.(conns.ClientSession).IbmLogsRouterOpenApi30V0() + if err != nil { + return diag.FromErr(err) + } + + createTenantOptions := &ibmlogsrouteropenapi30v0.CreateTenantOptions{} + + createTenantOptions.SetTargetType(d.Get("target_type").(string)) + createTenantOptions.SetTargetHost(d.Get("target_host").(string)) + createTenantOptions.SetTargetPort(int64(d.Get("target_port").(int))) + createTenantOptions.SetAccessCredential(d.Get("access_credential").(string)) + createTenantOptions.SetTargetInstanceCrn(d.Get("target_instance_crn").(string)) + + tenantDetailsResponse, response, err := ibmLogsRouterOpenApi30Client.CreateTenantWithContext(context, createTenantOptions) + if err != nil { + log.Printf("[DEBUG] CreateTenantWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CreateTenantWithContext failed %s\n%s", err, response)) + } + + d.SetId(tenantDetailsResponse.ID.String()) + + return resourceIbmLogsRouterTenantRead(context, d, meta) +} + +func resourceIbmLogsRouterTenantRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + ibmLogsRouterOpenApi30Client, err := meta.(conns.ClientSession).IbmLogsRouterOpenApi30V0() + if err != nil { + return diag.FromErr(err) + } + + getTenantDetailOptions := &ibmlogsrouteropenapi30v0.GetTenantDetailOptions{} + tenantId := strfmt.UUID(d.Id()) + getTenantDetailOptions.SetTenantID(&tenantId) + + tenantDetailsResponse, response, err := ibmLogsRouterOpenApi30Client.GetTenantDetailWithContext(context, getTenantDetailOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetTenantDetailWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetTenantDetailWithContext failed %s\n%s", err, response)) + } + + if err = d.Set("target_type", tenantDetailsResponse.TargetType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting target_type: %s", err)) + } + if err = d.Set("target_host", tenantDetailsResponse.TargetHost); err != nil { + return diag.FromErr(fmt.Errorf("Error setting target_host: %s", err)) + } + if err = d.Set("target_port", flex.IntValue(tenantDetailsResponse.TargetPort)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting target_port: %s", err)) + } + if err = d.Set("target_instance_crn", tenantDetailsResponse.TargetInstanceCrn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting target_instance_crn: %s", err)) + } + if !core.IsNil(tenantDetailsResponse.AccountID) { + if err = d.Set("account_id", tenantDetailsResponse.AccountID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting account_id: %s", err)) + } + } + if !core.IsNil(tenantDetailsResponse.CreatedAt) { + if err = d.Set("created_at", tenantDetailsResponse.CreatedAt); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + } + if !core.IsNil(tenantDetailsResponse.UpdatedAt) { + if err = d.Set("updated_at", tenantDetailsResponse.UpdatedAt); err != nil { + return diag.FromErr(fmt.Errorf("Error setting updated_at: %s", err)) + } + } + + return nil +} + +func resourceIbmLogsRouterTenantUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + ibmLogsRouterOpenApi30Client, err := meta.(conns.ClientSession).IbmLogsRouterOpenApi30V0() + if err != nil { + return diag.FromErr(err) + } + + updateTargetOptions := &ibmlogsrouteropenapi30v0.UpdateTargetOptions{} + tenantId := strfmt.UUID(d.Id()) + updateTargetOptions.SetTenantID(&tenantId) + + hasChange := false + + patchVals := &ibmlogsrouteropenapi30v0.TenantDetailsResponsePatch{} + if d.HasChange("target_host") { + newTargetHost := d.Get("target_host").(string) + patchVals.TargetHost = &newTargetHost + hasChange = true + } + if d.HasChange("target_port") { + newTargetPort := int64(d.Get("target_port").(int)) + patchVals.TargetPort = &newTargetPort + hasChange = true + } + if d.HasChange("access_credential") { + newAccessCredential := d.Get("access_credential").(string) + patchVals.AccessCredential = &newAccessCredential + hasChange = true + } + if d.HasChange("target_instance_crn") { + newTargetInstanceCrn := d.Get("target_instance_crn").(string) + patchVals.TargetInstanceCrn = &newTargetInstanceCrn + hasChange = true + } + + if hasChange { + updateTargetOptions.TenantDetailsResponsePatch, _ = patchVals.AsPatch() + _, response, err := ibmLogsRouterOpenApi30Client.UpdateTargetWithContext(context, updateTargetOptions) + if err != nil { + log.Printf("[DEBUG] UpdateTargetWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("UpdateTargetWithContext failed %s\n%s", err, response)) + } + } + + return resourceIbmLogsRouterTenantRead(context, d, meta) +} + +func resourceIbmLogsRouterTenantDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + ibmLogsRouterOpenApi30Client, err := meta.(conns.ClientSession).IbmLogsRouterOpenApi30V0() + if err != nil { + return diag.FromErr(err) + } + + deleteTenantOptions := &ibmlogsrouteropenapi30v0.DeleteTenantOptions{} + tenantId := strfmt.UUID(d.Id()) + deleteTenantOptions.SetTenantID(&tenantId) + + _, response, err := ibmLogsRouterOpenApi30Client.DeleteTenantWithContext(context, deleteTenantOptions) + if err != nil { + log.Printf("[DEBUG] DeleteTenantWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteTenantWithContext failed %s\n%s", err, response)) + } + + d.SetId("") + + return nil +} diff --git a/ibm/service/logsrouter/resource_ibm_logs_router_tenant_test.go b/ibm/service/logsrouter/resource_ibm_logs_router_tenant_test.go new file mode 100644 index 0000000000..a625776d49 --- /dev/null +++ b/ibm/service/logsrouter/resource_ibm_logs_router_tenant_test.go @@ -0,0 +1,128 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package logsrouter_test + +import ( + "fmt" + "testing" + + "github.com/go-openapi/strfmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM/logs-router-go-sdk/ibmlogsrouteropenapi30v0" +) + +func TestAccIbmLogsRouterTenantBasic(t *testing.T) { + var conf ibmlogsrouteropenapi30v0.TenantDetailsResponse + targetType := fmt.Sprintf("logdna") + targetHost := fmt.Sprintf("tf-target-host-%d", acctest.RandIntRange(10, 100)) + targetPort := fmt.Sprintf("%d", acctest.RandIntRange(10, 100)) + targetInstanceCrn := fmt.Sprintf("crn:v1:bluemix:public:logdna:eu-de:a/3516b8fa0a174a71899f5affa4f18d78:3517d2ed-9429-af34-ad52-34278391cbc8::") + targetTypeUpdate := fmt.Sprintf("logdna") + targetHostUpdate := fmt.Sprintf("tf-target-host-%d", acctest.RandIntRange(10, 100)) + targetPortUpdate := fmt.Sprintf("%d", acctest.RandIntRange(10, 100)) + targetInstanceCrnUpdate := fmt.Sprintf("crn:v1:bluemix:public:logdna:eu-de:a/3516b8fa0a174a71899f5affa4f18d78:3517d2ed-9429-af34-ad52-34278391cbc8::") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmLogsRouterTenantDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmLogsRouterTenantConfigBasic(targetType, targetHost, targetPort, targetInstanceCrn), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmLogsRouterTenantExists("ibm_logs_router_tenant.logs_router_tenant_instance", conf), + resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_type", targetType), + resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_host", targetHost), + resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_instance_crn", targetInstanceCrn), + ), + }, + resource.TestStep{ + Config: testAccCheckIbmLogsRouterTenantConfigBasic(targetTypeUpdate, targetHostUpdate, targetPortUpdate, targetInstanceCrnUpdate), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_type", targetTypeUpdate), + resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_host", targetHostUpdate), + resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_port", targetPortUpdate), + resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_instance_crn", targetInstanceCrnUpdate), + ), + }, + resource.TestStep{ + ResourceName: "ibm_logs_router_tenant.logs_router_tenant_instance", //"ibm_logs_router_tenant.logs_router_tenant", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"access_credential"}, + }, + }, + }) +} + +func testAccCheckIbmLogsRouterTenantConfigBasic(targetType string, targetHost string, targetPort string, targetInstanceCrn string) string { + return fmt.Sprintf(` + resource "ibm_logs_router_tenant" "logs_router_tenant_instance" { + target_type = "%s" + target_host = "%s" + target_port = %s + target_instance_crn = "%s" + access_credential = "test-credential" + } + `, targetType, targetHost, targetPort, targetInstanceCrn) +} + +func testAccCheckIbmLogsRouterTenantExists(n string, obj ibmlogsrouteropenapi30v0.TenantDetailsResponse) resource.TestCheckFunc { + + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + ibmLogsRouterOpenApi30Client, err := acc.TestAccProvider.Meta().(conns.ClientSession).IbmLogsRouterOpenApi30V0() + if err != nil { + return err + } + + getTenantDetailOptions := &ibmlogsrouteropenapi30v0.GetTenantDetailOptions{} + tenantId := strfmt.UUID(rs.Primary.ID) + getTenantDetailOptions.SetTenantID(&tenantId) + + tenantDetailsResponse, _, err := ibmLogsRouterOpenApi30Client.GetTenantDetail(getTenantDetailOptions) + if err != nil { + return err + } + + obj = *tenantDetailsResponse + return nil + } +} + +func testAccCheckIbmLogsRouterTenantDestroy(s *terraform.State) error { + ibmLogsRouterOpenApi30Client, err := acc.TestAccProvider.Meta().(conns.ClientSession).IbmLogsRouterOpenApi30V0() + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_logs_router_tenant" { + continue + } + + getTenantDetailOptions := &ibmlogsrouteropenapi30v0.GetTenantDetailOptions{} + tenantId := strfmt.UUID(rs.Primary.ID) + getTenantDetailOptions.SetTenantID(&tenantId) + + // Try to find the key + _, response, err := ibmLogsRouterOpenApi30Client.GetTenantDetail(getTenantDetailOptions) + + if err == nil { + return fmt.Errorf("logs_router_tenant still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for logs_router_tenant (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/website/allowed-subcategories.txt b/website/allowed-subcategories.txt index 1e97423139..7410d43146 100644 --- a/website/allowed-subcategories.txt +++ b/website/allowed-subcategories.txt @@ -25,6 +25,7 @@ Identity & Access Management (IAM) Internet services Key Management Service Kubernetes Service +Logs Router Metrics Router Object Storage Power Systems diff --git a/website/docs/d/logs_router_tenant.html.markdown b/website/docs/d/logs_router_tenant.html.markdown new file mode 100644 index 0000000000..0ff47b87b3 --- /dev/null +++ b/website/docs/d/logs_router_tenant.html.markdown @@ -0,0 +1,52 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_logs_router_tenant" +description: |- + Get information about logs_router_tenant +subcategory: "Logs Router" +--- + +# ibm_logs_router_tenant + +Provides a read-only data source to retrieve information about a logs_router_tenant. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```hcl +data "ibm_logs_router_tenant" "logs_router_tenant" { + tenant_id = "f3a466c9-c4db-4eee-95cc-ba82db58e2b5" +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +* `tenant_id` - (Required, Forces new resource, String) The instance ID of the tenant. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/[A-F,0-9,-]/`. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +* `id` - The unique identifier of the logs_router_tenant. +* `account_id` - (String) The account ID the tenant belongs to. + * Constraints: The maximum length is `32` characters. The minimum length is `32` characters. The value must match regular expression `/[a-z,A-Z,0-9,-]/`. + +* `created_at` - (String) Time stamp the tenant was originally created. + * Constraints: The maximum length is `36` characters. The minimum length is `1` character. The value must match regular expression `/[0-9,:,.,-,T,Z]/`. + +* `target_host` - (String) Host name of log-sink. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/[a-z,A-Z,0-9,-,.]/`. + +* `target_instance_crn` - (String) Cloud resource name of the log-sink target instance. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/[a-z,A-Z,0-9,:,-]/`. + +* `target_port` - (Integer) Network port of log sink. + +* `target_type` - (String) Type of log-sink. + * Constraints: The maximum length is `32` characters. The minimum length is `1` character. The value must match regular expression `/[a-z,A-Z,0-9,-]/`. + +* `updated_at` - (String) time stamp the tenant was last updated. + * Constraints: The maximum length is `36` characters. The minimum length is `1` character. The value must match regular expression `/[0-9,:,.,-,T,Z]/`. + diff --git a/website/docs/r/logs_router_tenant.html.markdown b/website/docs/r/logs_router_tenant.html.markdown new file mode 100644 index 0000000000..0a193468d8 --- /dev/null +++ b/website/docs/r/logs_router_tenant.html.markdown @@ -0,0 +1,60 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_logs_router_tenant" +description: |- + Manages logs_router_tenant. +subcategory: "Logs Router" +--- + +# ibm_logs_router_tenant + +Create, update, and delete logs_router_tenants with this resource. + +## Example Usage + +```hcl +resource "ibm_logs_router_tenant" "logs_router_tenant_instance" { + target_host = "www.example.com" + target_instance_crn = "crn:v1:bluemix:public:logdna:eu-de:a/3516b8fa0a174a71899f5affa4f18d78:3517d2ed-9429-af34-ad52-34278391cbc8::" + target_port = 10 + target_type = "logdna" +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +* `target_host` - (Required, String) Host name of log-sink. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/[a-z,A-Z,0-9,-,.]/`. +* `target_instance_crn` - (Required, String) Cloud resource name of the log-sink target instance. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/[a-z,A-Z,0-9,:,-]/`. +* `target_port` - (Required, Integer) Network port of log sink. +* `target_type` - (Required, String) Type of log-sink. + * Constraints: The maximum length is `32` characters. The minimum length is `1` character. The value must match regular expression `/[a-z,A-Z,0-9,-]/`. + +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +* `id` - The unique identifier of the logs_router_tenant. +* `account_id` - (String) The account ID the tenant belongs to. + * Constraints: The maximum length is `32` characters. The minimum length is `32` characters. The value must match regular expression `/[a-z,A-Z,0-9,-]/`. +* `created_at` - (String) Time stamp the tenant was originally created. + * Constraints: The maximum length is `36` characters. The minimum length is `1` character. The value must match regular expression `/[0-9,:,.,-,T,Z]/`. +* `updated_at` - (String) time stamp the tenant was last updated. + * Constraints: The maximum length is `36` characters. The minimum length is `1` character. The value must match regular expression `/[0-9,:,.,-,T,Z]/`. + +## Import + +You can import the `ibm_logs_router_tenant` resource by using `id`. Unique ID of the created instance. + +# Syntax +
+$ terraform import ibm_logs_router_tenant.logs_router_tenant <id>
+
+ +# Example +``` +$ terraform import ibm_logs_router_tenant.logs_router_tenant aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa +``` From 97b8f095498280d7fb9e5d7110546f31ddd73fce Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 4 Dec 2023 22:23:11 -0600 Subject: [PATCH 090/132] Update go.mod (#4963) - Update go.mod: bluemix-go version --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index bffd2441f8..fe7c351529 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/IBM-Cloud/terraform-provider-ibm go 1.18 require ( - github.com/IBM-Cloud/bluemix-go v0.0.0-20231123082353-50e8cc9c6959 + github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c github.com/IBM-Cloud/power-go-client v1.5.4 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca diff --git a/go.sum b/go.sum index 4477787f09..77c54968b8 100644 --- a/go.sum +++ b/go.sum @@ -102,6 +102,8 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3 github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/IBM-Cloud/bluemix-go v0.0.0-20231123082353-50e8cc9c6959 h1:dvvI4ybsYx6M7fFGrg3HjlNnYxEBi9jJdSU0JhjJbG8= github.com/IBM-Cloud/bluemix-go v0.0.0-20231123082353-50e8cc9c6959/go.mod h1:jIGLnIfj+uBv2ALz3rVHzNbNwt0V/bEWNeJKECa8Q+k= +github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc h1:AeooCa6UMWycgKJ9n0do9PEZaNlYZZHqspfwUzPvopc= +github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc/go.mod h1:jIGLnIfj+uBv2ALz3rVHzNbNwt0V/bEWNeJKECa8Q+k= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c h1:tRS4VuOG3lHNG+yrsh3vZZQDVNLuFJB0oZbTJp9YXds= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs= From 6eb27665823bffae30c96fd77b5de13985a0d998 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 5 Dec 2023 17:53:59 +0530 Subject: [PATCH 091/132] resolved the ips auto_delete to default false --- ibm/service/vpc/resource_ibm_is_virtual_network_interface.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go index 0b77c30bf1..57645bd1f7 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go @@ -515,7 +515,7 @@ func resourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema ips := []map[string]interface{}{} for _, ipsItem := range virtualNetworkInterface.Ips { if *virtualNetworkInterface.PrimaryIP.ID != *ipsItem.ID { - ipsItemMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(&ipsItem, true) + ipsItemMap, err := resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(&ipsItem, false) if err != nil { return diag.FromErr(err) } From de7b248d0b0cbb7e5b4351e7bf0bcafd12dc3ef7 Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Fri, 8 Dec 2023 03:31:21 -0600 Subject: [PATCH 092/132] Fix IBM i documentation bug (#4969) * Fix IBM i documentation bug On several documentation pages, it incorrectly implied that IBMi was the only usable OS for that resource/data source. * Update help URLs --- website/docs/d/pi_key.html.markdown | 2 +- website/docs/d/pi_network.html.markdown | 2 +- website/docs/r/pi_network.html.markdown | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/d/pi_key.html.markdown b/website/docs/d/pi_key.html.markdown index fab30bd2c2..19b824e44c 100644 --- a/website/docs/d/pi_key.html.markdown +++ b/website/docs/d/pi_key.html.markdown @@ -8,7 +8,7 @@ description: |- --- # ibm_pi_key -Retrieve information about the SSH key that is used for your Power Systems Virtual Server instance. The SSH key is used to access the instance after it is created. For more information, about [configuring your IBM i virtual machine (VM)](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-configuring-ibmi). +Retrieve information about the SSH key that is used for your Power Systems Virtual Server instance. The SSH key is used to access the instance after it is created. For more information, about [configuring your IBM virtual machine (VM)](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-ssh-key). ## Example usage diff --git a/website/docs/d/pi_network.html.markdown b/website/docs/d/pi_network.html.markdown index 153b53696d..eea249a557 100644 --- a/website/docs/d/pi_network.html.markdown +++ b/website/docs/d/pi_network.html.markdown @@ -8,7 +8,7 @@ description: |- --- # ibm_pi_network -Retrieve information about the network that your Power Systems Virtual Server instance is connected to. For more information, about power virtual server instance network, see [setting up an IBM i network install server](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-preparing-install-server). +Retrieve information about the network that your Power Systems Virtual Server instance is connected to. For more information, about power virtual server instance network, see [setting up an IBM network install server](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-configuring-subnet). ## Example usage diff --git a/website/docs/r/pi_network.html.markdown b/website/docs/r/pi_network.html.markdown index ba60fc993c..23da3c3de9 100644 --- a/website/docs/r/pi_network.html.markdown +++ b/website/docs/r/pi_network.html.markdown @@ -8,7 +8,7 @@ description: |- # ibm_pi_network -Create, update, or delete a network connection for your Power Systems Virtual Server instance. For more information, about power virtual server instance network, see [setting up an IBM i network install server](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-preparing-install-server). +Create, update, or delete a network connection for your Power Systems Virtual Server instance. For more information, about power virtual server instance network, see [setting up an IBM network install server](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-configuring-subnet). ## Example usage From 1bb8e0577ebba4c965e2deda0b997f0300168e3f Mon Sep 17 00:00:00 2001 From: Riccardo Angelilli Date: Fri, 8 Dec 2023 17:00:36 +0100 Subject: [PATCH 093/132] Regenerate Projects TF to fix generated doc and samples (#4961) * fix integration test * fix integration test * fix integration test * fix name * pr comments * pr comments * fix doc * fix doc * new version * new version * new version * new version * update code to the latest SDK level * fix integration tests * fix integration tests * fix integration tests * fix integration tests * address PR comment * typo * typo * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * add wait for create and delete * add wait for create and delete * . * fix integration tests * fix integration tests * fix integration tests * fix integration tests * fix integration tests * regenerate * new code generation * new generated code * point to latest sdk * point to latest sdk * adjust test cases and doc * adjust samples * update to latest node sdk * merge with master * Update project_instance.html.markdown Fixing formatting issues * Update project_event_notification.html.markdown * Update README.md * Update variables.tf * Update project_event_notification.html.markdown * new version * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * feat: projects graph fragment pattern * align with origin/master * update test cases * restore README.md and versions.tf to master branch * remove duplicated entries * feat: graph fragment pattern poc * feat: restore definition blocks * regenerate the terraform code based on latest YAML * regenerate the terraform code based on latest YAML * regenerate the terraform code based on latest YAML * update doc * update doc * fix test cases * commit generated code * commit fix * commit fix * test cases * test cases * test cases * test cases * updates * upgrade to latest go sdk * update generated doc * update generated code * updated secrets baseline * update code to latest API changes * secrets * fix secrets * update samples with real values * update secrets * update secrets * update generated code to the latest API definition * update secrets baseline * merge with master * merge with master * merge with master * update code to the latest SDK level * address some review comments * address PR comments * address PR comments * update to latest sdk level * update to latest sdk level * update to latest sdk level * merge with master * update to the latest sdk level * format test case * regenerate the code with generator fixes * regenerate code * fix "inputs" and "settings" properties --------- Co-authored-by: dvesperini Co-authored-by: knee-na <130502432+knee-na@users.noreply.github.com> Co-authored-by: Mark-Kulube --- .secrets.baseline | 44 +++---- examples/ibm-project/README.md | 4 +- examples/ibm-project/main.tf | 8 +- go.mod | 2 +- go.sum | 6 +- .../project/data_source_ibm_project_config.go | 53 ++++---- .../data_source_ibm_project_config_test.go | 4 +- .../data_source_ibm_project_environment.go | 24 ++-- ibm/service/project/resource_ibm_project.go | 33 ++--- .../project/resource_ibm_project_config.go | 113 ++++++++---------- .../resource_ibm_project_environment.go | 54 ++++----- website/docs/d/project_config.html.markdown | 12 +- .../docs/d/project_environment.html.markdown | 7 +- website/docs/r/project_config.html.markdown | 18 +-- .../docs/r/project_environment.html.markdown | 3 +- 15 files changed, 159 insertions(+), 226 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index 3a62206e9a..0d0d86addf 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.mod|go.sum|.*.map|^.secrets.baseline$", "lines": null }, - "generated_at": "2023-11-29T02:05:13Z", + "generated_at": "2023-12-05T09:48:48Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -560,7 +560,7 @@ "hashed_secret": "06d988e96c3d9325c9fbc7c0ef3c6c0f2b4eb8e7", "is_secret": false, "is_verified": false, - "line_number": 45, + "line_number": 41, "type": "Secret Keyword", "verified_result": null } @@ -794,7 +794,7 @@ "hashed_secret": "c427f185ddcb2440be9b77c8e45f1cd487a2e790", "is_secret": false, "is_verified": false, - "line_number": 1449, + "line_number": 1450, "type": "Base64 High Entropy String", "verified_result": null }, @@ -802,7 +802,7 @@ "hashed_secret": "1f7e33de15e22de9d2eaf502df284ed25ca40018", "is_secret": false, "is_verified": false, - "line_number": 1516, + "line_number": 1517, "type": "Secret Keyword", "verified_result": null }, @@ -810,7 +810,7 @@ "hashed_secret": "1f614c2eb6b3da22d89bd1b9fd47d7cb7c8fc670", "is_secret": false, "is_verified": false, - "line_number": 3325, + "line_number": 3326, "type": "Secret Keyword", "verified_result": null }, @@ -818,7 +818,7 @@ "hashed_secret": "7abfce65b8504403afc25c9790f358d513dfbcc6", "is_secret": false, "is_verified": false, - "line_number": 3338, + "line_number": 3339, "type": "Secret Keyword", "verified_result": null }, @@ -826,7 +826,7 @@ "hashed_secret": "0c2d85bf9a9b1579b16f220a4ea8c3d62b2e24b1", "is_secret": false, "is_verified": false, - "line_number": 3379, + "line_number": 3380, "type": "Secret Keyword", "verified_result": null } @@ -864,7 +864,7 @@ "hashed_secret": "c8b6f5ef11b9223ac35a5663975a466ebe7ebba9", "is_secret": false, "is_verified": false, - "line_number": 1807, + "line_number": 1815, "type": "Secret Keyword", "verified_result": null }, @@ -872,7 +872,7 @@ "hashed_secret": "8abf4899c01104241510ba87685ad4de76b0c437", "is_secret": false, "is_verified": false, - "line_number": 1813, + "line_number": 1821, "type": "Secret Keyword", "verified_result": null } @@ -2876,7 +2876,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 334, + "line_number": 335, "type": "Secret Keyword", "verified_result": null }, @@ -2884,7 +2884,7 @@ "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", "is_secret": false, "is_verified": false, - "line_number": 654, + "line_number": 663, "type": "Secret Keyword", "verified_result": null } @@ -2904,7 +2904,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 119, + "line_number": 120, "type": "Secret Keyword", "verified_result": null }, @@ -2912,7 +2912,7 @@ "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", "is_secret": false, "is_verified": false, - "line_number": 293, + "line_number": 298, "type": "Secret Keyword", "verified_result": null } @@ -2932,7 +2932,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 236, + "line_number": 237, "type": "Secret Keyword", "verified_result": null }, @@ -2940,7 +2940,7 @@ "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", "is_secret": false, "is_verified": false, - "line_number": 884, + "line_number": 875, "type": "Secret Keyword", "verified_result": null } @@ -2960,7 +2960,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 72, + "line_number": 73, "type": "Secret Keyword", "verified_result": null }, @@ -2968,7 +2968,7 @@ "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", "is_secret": false, "is_verified": false, - "line_number": 504, + "line_number": 499, "type": "Secret Keyword", "verified_result": null } @@ -4505,16 +4505,6 @@ "verified_result": null } ], - "website/docs/r/logs_router_tenant.html.markdown": [ - { - "hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e", - "is_secret": false, - "is_verified": false, - "line_number": 78, - "type": "Secret Keyword", - "verified_result": null - } - ], "website/docs/r/metrics_router_route.html.markdown": [ { "hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e", diff --git a/examples/ibm-project/README.md b/examples/ibm-project/README.md index 8d4faefa78..479c92419c 100644 --- a/examples/ibm-project/README.md +++ b/examples/ibm-project/README.md @@ -69,8 +69,8 @@ data "project" "project_instance" { project_environment data source: ```hcl -data "ibm_project_environment" "project_environment_instance" { - project_id = ibm_project_environment.project_environment_instance.project_id +data "project_environment" "project_environment_instance" { + project_id = ibm_project.project_instance.id project_environment_id = ibm_project_environment.project_environment_instance.project_environment_id } ``` diff --git a/examples/ibm-project/main.tf b/examples/ibm-project/main.tf index 038e99910a..f07c03de9e 100644 --- a/examples/ibm-project/main.tf +++ b/examples/ibm-project/main.tf @@ -13,13 +13,9 @@ resource "ibm_project_config" "project_config_instance" { api_key = "" } locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.145be7c1-9ec4-4719-b586-584ee52fbed0-global" - input { + inputs = { name = "app_repo_name" } - setting { - name = "app_repo_name" - value = "static-website-dev-app-repo" - } } } @@ -61,5 +57,5 @@ data "ibm_project" "project_instance" { // Create project_environment data source data "ibm_project_environment" "project_environment_instance" { project_id = ibm_project.project_instance.id - project_environment_id = var.project_environment_project_environment_id + project_environment_id = ibm_project_environment.project_environment_instance.project_environment_id } diff --git a/go.mod b/go.mod index fe7c351529..fdf9de1fb1 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/IBM/logs-router-go-sdk v1.0.0 github.com/IBM/networking-go-sdk v0.42.2 github.com/IBM/platform-services-go-sdk v0.54.0 - github.com/IBM/project-go-sdk v0.1.1 + github.com/IBM/project-go-sdk v0.1.4 github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 github.com/IBM/scc-go-sdk/v5 v5.1.3 github.com/IBM/schematics-go-sdk v0.2.2 diff --git a/go.sum b/go.sum index 77c54968b8..f53d313116 100644 --- a/go.sum +++ b/go.sum @@ -100,8 +100,6 @@ github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3 github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/IBM-Cloud/bluemix-go v0.0.0-20231123082353-50e8cc9c6959 h1:dvvI4ybsYx6M7fFGrg3HjlNnYxEBi9jJdSU0JhjJbG8= -github.com/IBM-Cloud/bluemix-go v0.0.0-20231123082353-50e8cc9c6959/go.mod h1:jIGLnIfj+uBv2ALz3rVHzNbNwt0V/bEWNeJKECa8Q+k= github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc h1:AeooCa6UMWycgKJ9n0do9PEZaNlYZZHqspfwUzPvopc= github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc/go.mod h1:jIGLnIfj+uBv2ALz3rVHzNbNwt0V/bEWNeJKECa8Q+k= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c h1:tRS4VuOG3lHNG+yrsh3vZZQDVNLuFJB0oZbTJp9YXds= @@ -161,8 +159,8 @@ github.com/IBM/networking-go-sdk v0.42.2 h1:caqjx4jyFHi10Vlf3skHvlL6K3YJRVstsmCB github.com/IBM/networking-go-sdk v0.42.2/go.mod h1:lTUZwtUkMANMnrLHFIgRhHrkBfwASY/Iho1fabaPHxo= github.com/IBM/platform-services-go-sdk v0.54.0 h1:WjHWm9ZAJvlq07E1WXXtEe+d/B0sazWD6cEWVT7EMLU= github.com/IBM/platform-services-go-sdk v0.54.0/go.mod h1:CWSprvsCsXWvujmBzbtoJSmbRZS9FVV3O594b0t/GiM= -github.com/IBM/project-go-sdk v0.1.1 h1:x1PkGUTkKpgxoXs/6IG4U1mk5BgaPEaRMVpXTs52rE4= -github.com/IBM/project-go-sdk v0.1.1/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig= +github.com/IBM/project-go-sdk v0.1.4 h1:QGehJxpp/QqfrBYSmN2FRYwuGejlHlVscB/9QGQfdLk= +github.com/IBM/project-go-sdk v0.1.4/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig= github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 h1:NPUhkoOCRuv3OFWt19PmwjXGGTKlvmbuPg9fUrBUNe4= github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5/go.mod h1:b07XHUVh0XYnQE9s2mqgjYST1h9buaQNqN4EcKhOsX0= github.com/IBM/sarama v1.41.2 h1:ZDBZfGPHAD4uuAtSv4U22fRZBgst0eEwGFzLj0fb85c= diff --git a/ibm/service/project/data_source_ibm_project_config.go b/ibm/service/project/data_source_ibm_project_config.go index 38ddf87947..8fadc48a9f 100644 --- a/ibm/service/project/data_source_ibm_project_config.go +++ b/ibm/service/project/data_source_ibm_project_config.go @@ -5,6 +5,7 @@ package project import ( "context" + "encoding/json" "fmt" "log" @@ -135,7 +136,7 @@ func DataSourceIbmProjectConfig() *schema.Resource { "workspace_crn": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "An existing schematics workspace CRN.", + Description: "An IBM Cloud resource name, which uniquely identifies a resource.", }, "validate_pre_script": &schema.Schema{ Type: schema.TypeList, @@ -377,22 +378,22 @@ func DataSourceIbmProjectConfig() *schema.Resource { "locator_id": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "A unique concatenation of catalogID.versionID that identifies the DA in the catalog.", + Description: "A unique concatenation of catalogID.versionID that identifies the DA in the catalog. Either schematics.workspace_crn, definition.locator_id, or both must be specified.", }, "inputs": &schema.Schema{ - Type: schema.TypeList, + Type: schema.TypeMap, Computed: true, Description: "The input variables for configuration definition and environment.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{}, + Elem: &schema.Schema{ + Type: schema.TypeString, }, }, "settings": &schema.Schema{ - Type: schema.TypeList, + Type: schema.TypeMap, Computed: true, - Description: "Schematics environment variables to use to deploy the configuration.Settings are only available if they were specified when the configuration was initially created.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{}, + Description: "Schematics environment variables to use to deploy the configuration. Settings are only available if they were specified when the configuration was initially created.", + Elem: &schema.Schema{ + Type: schema.TypeString, }, }, }, @@ -626,18 +627,26 @@ func dataSourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *proje } modelMap["locator_id"] = model.LocatorID if model.Inputs != nil { - inputsMap, err := dataSourceIbmProjectConfigInputVariableToMap(model.Inputs) - if err != nil { - return modelMap, err + inputs := make(map[string]interface{}) + for k, v := range model.Inputs { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + inputs[k] = string(bytes) } - modelMap["inputs"] = []map[string]interface{}{inputsMap} + modelMap["inputs"] = inputs } if model.Settings != nil { - settingsMap, err := dataSourceIbmProjectConfigProjectConfigSettingToMap(model.Settings) - if err != nil { - return modelMap, err + settings := make(map[string]interface{}) + for k, v := range model.Settings { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + settings[k] = string(bytes) } - modelMap["settings"] = []map[string]interface{}{settingsMap} + modelMap["settings"] = settings } return modelMap, nil } @@ -675,13 +684,3 @@ func dataSourceIbmProjectConfigProjectComplianceProfileToMap(model *projectv1.Pr } return modelMap, nil } - -func dataSourceIbmProjectConfigInputVariableToMap(model *projectv1.InputVariable) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - return modelMap, nil -} - -func dataSourceIbmProjectConfigProjectConfigSettingToMap(model *projectv1.ProjectConfigSetting) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - return modelMap, nil -} diff --git a/ibm/service/project/data_source_ibm_project_config_test.go b/ibm/service/project/data_source_ibm_project_config_test.go index 785e6ff684..e009ba0704 100644 --- a/ibm/service/project/data_source_ibm_project_config_test.go +++ b/ibm/service/project/data_source_ibm_project_config_test.go @@ -56,8 +56,8 @@ func testAccCheckIbmProjectConfigDataSourceConfigBasic() string { authorizations { method = "api_key" api_key = "%s" - } - locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.cd596f95-95a2-4f21-9b84-477f21fd1e95-global" + } + locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.cd596f95-95a2-4f21-9b84-477f21fd1e95-global" } lifecycle { ignore_changes = [ diff --git a/ibm/service/project/data_source_ibm_project_environment.go b/ibm/service/project/data_source_ibm_project_environment.go index e42f488a05..dc095eea94 100644 --- a/ibm/service/project/data_source_ibm_project_environment.go +++ b/ibm/service/project/data_source_ibm_project_environment.go @@ -5,6 +5,7 @@ package project import ( "context" + "encoding/json" "fmt" "log" @@ -126,11 +127,11 @@ func DataSourceIbmProjectEnvironment() *schema.Resource { }, }, "inputs": &schema.Schema{ - Type: schema.TypeList, + Type: schema.TypeMap, Computed: true, Description: "The input variables for configuration definition and environment.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{}, + Elem: &schema.Schema{ + Type: schema.TypeString, }, }, "compliance_profile": &schema.Schema{ @@ -265,11 +266,15 @@ func dataSourceIbmProjectEnvironmentEnvironmentDefinitionRequiredPropertiesToMap modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} } if model.Inputs != nil { - inputsMap, err := dataSourceIbmProjectEnvironmentInputVariableToMap(model.Inputs) - if err != nil { - return modelMap, err + inputs := make(map[string]interface{}) + for k, v := range model.Inputs { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + inputs[k] = string(bytes) } - modelMap["inputs"] = []map[string]interface{}{inputsMap} + modelMap["inputs"] = inputs } if model.ComplianceProfile != nil { complianceProfileMap, err := dataSourceIbmProjectEnvironmentProjectComplianceProfileToMap(model.ComplianceProfile) @@ -295,11 +300,6 @@ func dataSourceIbmProjectEnvironmentProjectConfigAuthToMap(model *projectv1.Proj return modelMap, nil } -func dataSourceIbmProjectEnvironmentInputVariableToMap(model *projectv1.InputVariable) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - return modelMap, nil -} - func dataSourceIbmProjectEnvironmentProjectComplianceProfileToMap(model *projectv1.ProjectComplianceProfile) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.ID != nil { diff --git a/ibm/service/project/resource_ibm_project.go b/ibm/service/project/resource_ibm_project.go index 1147380c19..4e51734983 100644 --- a/ibm/service/project/resource_ibm_project.go +++ b/ibm/service/project/resource_ibm_project.go @@ -5,6 +5,7 @@ package project import ( "context" + "encoding/json" "fmt" "log" @@ -566,19 +567,17 @@ func resourceIbmProjectMapToProjectConfigPrototypeDefinitionBlock(modelMap map[s if modelMap["locator_id"] != nil && modelMap["locator_id"].(string) != "" { model.LocatorID = core.StringPtr(modelMap["locator_id"].(string)) } - if modelMap["inputs"] != nil && len(modelMap["inputs"].([]interface{})) > 0 { - InputsModel, err := resourceIbmProjectMapToInputVariable(modelMap["inputs"].([]interface{})[0].(map[string]interface{})) - if err != nil { - return model, err - } - model.Inputs = InputsModel + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + model.Inputs = newMap } - if modelMap["settings"] != nil && len(modelMap["settings"].([]interface{})) > 0 { - SettingsModel, err := resourceIbmProjectMapToProjectConfigSetting(modelMap["settings"].([]interface{})[0].(map[string]interface{})) - if err != nil { - return model, err - } - model.Settings = SettingsModel + if modelMap["settings"] != nil { + bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + model.Settings = newMap } return model, nil } @@ -617,16 +616,6 @@ func resourceIbmProjectMapToProjectComplianceProfile(modelMap map[string]interfa return model, nil } -func resourceIbmProjectMapToInputVariable(modelMap map[string]interface{}) (*projectv1.InputVariable, error) { - model := &projectv1.InputVariable{} - return model, nil -} - -func resourceIbmProjectMapToProjectConfigSetting(modelMap map[string]interface{}) (*projectv1.ProjectConfigSetting, error) { - model := &projectv1.ProjectConfigSetting{} - return model, nil -} - func resourceIbmProjectMapToSchematicsWorkspace(modelMap map[string]interface{}) (*projectv1.SchematicsWorkspace, error) { model := &projectv1.SchematicsWorkspace{} if modelMap["workspace_crn"] != nil && modelMap["workspace_crn"].(string) != "" { diff --git a/ibm/service/project/resource_ibm_project_config.go b/ibm/service/project/resource_ibm_project_config.go index 5594fbd5b7..161c7a41f1 100644 --- a/ibm/service/project/resource_ibm_project_config.go +++ b/ibm/service/project/resource_ibm_project_config.go @@ -5,6 +5,7 @@ package project import ( "context" + "encoding/json" "fmt" "log" @@ -44,7 +45,7 @@ func ResourceIbmProjectConfig() *schema.Resource { "workspace_crn": &schema.Schema{ Type: schema.TypeString, Optional: true, - Description: "An existing schematics workspace CRN.", + Description: "An IBM Cloud resource name, which uniquely identifies a resource.", }, "validate_pre_script": &schema.Schema{ Type: schema.TypeList, @@ -281,25 +282,19 @@ func ResourceIbmProjectConfig() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - Description: "A unique concatenation of catalogID.versionID that identifies the DA in the catalog.", + Description: "A unique concatenation of catalogID.versionID that identifies the DA in the catalog. Either schematics.workspace_crn, definition.locator_id, or both must be specified.", }, "inputs": &schema.Schema{ - Type: schema.TypeList, - MaxItems: 1, + Type: schema.TypeMap, Optional: true, Description: "The input variables for configuration definition and environment.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{}, - }, + Elem: &schema.Schema{Type: schema.TypeString}, }, "settings": &schema.Schema{ - Type: schema.TypeList, - MaxItems: 1, + Type: schema.TypeMap, Optional: true, - Description: "Schematics environment variables to use to deploy the configuration.Settings are only available if they were specified when the configuration was initially created.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{}, - }, + Description: "Schematics environment variables to use to deploy the configuration. Settings are only available if they were specified when the configuration was initially created.", + Elem: &schema.Schema{Type: schema.TypeString}, }, }, }, @@ -649,19 +644,17 @@ func resourceIbmProjectConfigMapToProjectConfigPrototypeDefinitionBlock(modelMap if modelMap["locator_id"] != nil && modelMap["locator_id"].(string) != "" { model.LocatorID = core.StringPtr(modelMap["locator_id"].(string)) } - if modelMap["inputs"] != nil && len(modelMap["inputs"].([]interface{})) > 0 { - InputsModel, err := resourceIbmProjectConfigMapToInputVariable(modelMap["inputs"].([]interface{})[0].(map[string]interface{})) - if err != nil { - return model, err - } - model.Inputs = InputsModel + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + model.Inputs = newMap } - if modelMap["settings"] != nil && len(modelMap["settings"].([]interface{})) > 0 { - SettingsModel, err := resourceIbmProjectConfigMapToProjectConfigSetting(modelMap["settings"].([]interface{})[0].(map[string]interface{})) - if err != nil { - return model, err - } - model.Settings = SettingsModel + if modelMap["settings"] != nil { + bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + model.Settings = newMap } return model, nil } @@ -700,16 +693,6 @@ func resourceIbmProjectConfigMapToProjectComplianceProfile(modelMap map[string]i return model, nil } -func resourceIbmProjectConfigMapToInputVariable(modelMap map[string]interface{}) (*projectv1.InputVariable, error) { - model := &projectv1.InputVariable{} - return model, nil -} - -func resourceIbmProjectConfigMapToProjectConfigSetting(modelMap map[string]interface{}) (*projectv1.ProjectConfigSetting, error) { - model := &projectv1.ProjectConfigSetting{} - return model, nil -} - func resourceIbmProjectConfigMapToSchematicsWorkspace(modelMap map[string]interface{}) (*projectv1.SchematicsWorkspace, error) { model := &projectv1.SchematicsWorkspace{} if modelMap["workspace_crn"] != nil && modelMap["workspace_crn"].(string) != "" { @@ -746,19 +729,17 @@ func resourceIbmProjectConfigMapToProjectConfigPatchDefinitionBlock(modelMap map if modelMap["locator_id"] != nil && modelMap["locator_id"].(string) != "" { model.LocatorID = core.StringPtr(modelMap["locator_id"].(string)) } - if modelMap["inputs"] != nil && len(modelMap["inputs"].([]interface{})) > 0 { - InputsModel, err := resourceIbmProjectConfigMapToInputVariable(modelMap["inputs"].([]interface{})[0].(map[string]interface{})) - if err != nil { - return model, err - } - model.Inputs = InputsModel + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + model.Inputs = newMap } - if modelMap["settings"] != nil && len(modelMap["settings"].([]interface{})) > 0 { - SettingsModel, err := resourceIbmProjectConfigMapToProjectConfigSetting(modelMap["settings"].([]interface{})[0].(map[string]interface{})) - if err != nil { - return model, err - } - model.Settings = SettingsModel + if modelMap["settings"] != nil { + bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + model.Settings = newMap } return model, nil } @@ -854,20 +835,30 @@ func resourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *project } modelMap["locator_id"] = model.LocatorID if model.Inputs != nil { - inputsMap, err := resourceIbmProjectConfigInputVariableToMap(model.Inputs) - if err != nil { - return modelMap, err + inputs := make(map[string]interface{}) + for k, v := range model.Inputs { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + inputs[k] = string(bytes) } - if len(inputsMap) > 0 { - modelMap["inputs"] = []map[string]interface{}{inputsMap} + if len(inputs) > 0 { + modelMap["inputs"] = inputs } } if model.Settings != nil { - settingsMap, err := resourceIbmProjectConfigProjectConfigSettingToMap(model.Settings) - if err != nil { - return modelMap, err + settings := make(map[string]interface{}) + for k, v := range model.Settings { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + settings[k] = string(bytes) + } + if len(settings) > 0 { + modelMap["settings"] = settings } - modelMap["settings"] = []map[string]interface{}{settingsMap} } return modelMap, nil } @@ -906,16 +897,6 @@ func resourceIbmProjectConfigProjectComplianceProfileToMap(model *projectv1.Proj return modelMap, nil } -func resourceIbmProjectConfigInputVariableToMap(model *projectv1.InputVariable) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - return modelMap, nil -} - -func resourceIbmProjectConfigProjectConfigSettingToMap(model *projectv1.ProjectConfigSetting) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - return modelMap, nil -} - func resourceIbmProjectConfigOutputValueToMap(model *projectv1.OutputValue) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["name"] = model.Name diff --git a/ibm/service/project/resource_ibm_project_environment.go b/ibm/service/project/resource_ibm_project_environment.go index 3dda07d3a2..d9fa73b4d9 100644 --- a/ibm/service/project/resource_ibm_project_environment.go +++ b/ibm/service/project/resource_ibm_project_environment.go @@ -5,6 +5,7 @@ package project import ( "context" + "encoding/json" "fmt" "log" @@ -79,13 +80,10 @@ func ResourceIbmProjectEnvironment() *schema.Resource { }, }, "inputs": &schema.Schema{ - Type: schema.TypeList, - MaxItems: 1, + Type: schema.TypeMap, Optional: true, Description: "The input variables for configuration definition and environment.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{}, - }, + Elem: &schema.Schema{Type: schema.TypeString}, }, "compliance_profile": &schema.Schema{ Type: schema.TypeList, @@ -370,12 +368,11 @@ func resourceIbmProjectEnvironmentMapToEnvironmentDefinitionRequiredProperties(m } model.Authorizations = AuthorizationsModel } - if modelMap["inputs"] != nil && len(modelMap["inputs"].([]interface{})) > 0 { - InputsModel, err := resourceIbmProjectEnvironmentMapToInputVariable(modelMap["inputs"].([]interface{})[0].(map[string]interface{})) - if err != nil { - return model, err - } - model.Inputs = InputsModel + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + model.Inputs = newMap } if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { ComplianceProfileModel, err := resourceIbmProjectEnvironmentMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) @@ -401,11 +398,6 @@ func resourceIbmProjectEnvironmentMapToProjectConfigAuth(modelMap map[string]int return model, nil } -func resourceIbmProjectEnvironmentMapToInputVariable(modelMap map[string]interface{}) (*projectv1.InputVariable, error) { - model := &projectv1.InputVariable{} - return model, nil -} - func resourceIbmProjectEnvironmentMapToProjectComplianceProfile(modelMap map[string]interface{}) (*projectv1.ProjectComplianceProfile, error) { model := &projectv1.ProjectComplianceProfile{} if modelMap["id"] != nil && modelMap["id"].(string) != "" { @@ -441,12 +433,11 @@ func resourceIbmProjectEnvironmentMapToEnvironmentDefinitionProperties(modelMap } model.Authorizations = AuthorizationsModel } - if modelMap["inputs"] != nil && len(modelMap["inputs"].([]interface{})) > 0 { - InputsModel, err := resourceIbmProjectEnvironmentMapToInputVariable(modelMap["inputs"].([]interface{})[0].(map[string]interface{})) - if err != nil { - return model, err - } - model.Inputs = InputsModel + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + model.Inputs = newMap } if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { ComplianceProfileModel, err := resourceIbmProjectEnvironmentMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) @@ -472,12 +463,16 @@ func resourceIbmProjectEnvironmentEnvironmentDefinitionRequiredPropertiesToMap(m modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} } if model.Inputs != nil { - inputsMap, err := resourceIbmProjectEnvironmentInputVariableToMap(model.Inputs) - if err != nil { - return modelMap, err + inputs := make(map[string]interface{}) + for k, v := range model.Inputs { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + inputs[k] = string(bytes) } - if len(inputsMap) > 0 { - modelMap["inputs"] = []map[string]interface{}{inputsMap} + if len(inputs) > 0 { + modelMap["inputs"] = inputs } } if model.ComplianceProfile != nil { @@ -506,11 +501,6 @@ func resourceIbmProjectEnvironmentProjectConfigAuthToMap(model *projectv1.Projec return modelMap, nil } -func resourceIbmProjectEnvironmentInputVariableToMap(model *projectv1.InputVariable) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - return modelMap, nil -} - func resourceIbmProjectEnvironmentProjectComplianceProfileToMap(model *projectv1.ProjectComplianceProfile) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.ID != nil { diff --git a/website/docs/d/project_config.html.markdown b/website/docs/d/project_config.html.markdown index 4db739e668..8a3b1e183b 100644 --- a/website/docs/d/project_config.html.markdown +++ b/website/docs/d/project_config.html.markdown @@ -61,14 +61,12 @@ Nested schema for **definition**: * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. * `environment_id` - (String) The ID of the project environment. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. - * `inputs` - (List) The input variables for configuration definition and environment. - Nested schema for **inputs**: - * `locator_id` - (Forces new resource, String) A unique concatenation of catalogID.versionID that identifies the DA in the catalog. + * `inputs` - (Map) The input variables for configuration definition and environment. + * `locator_id` - (Forces new resource, String) A unique concatenation of catalogID.versionID that identifies the DA in the catalog. Either schematics.workspace_crn, definition.locator_id, or both must be specified. * Constraints: The maximum length is `512` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/`. * `name` - (String) The configuration name. It is unique within the account across projects and regions. * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. - * `settings` - (List) Schematics environment variables to use to deploy the configuration.Settings are only available if they were specified when the configuration was initially created. - Nested schema for **settings**: + * `settings` - (Map) Schematics environment variables to use to deploy the configuration. Settings are only available if they were specified when the configuration was initially created. * `is_draft` - (Boolean) The flag that indicates whether the version of the configuration is draft, or active. @@ -151,8 +149,8 @@ Nested schema for **schematics**: * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. * `type` - (String) The type of the script. * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. - * `workspace_crn` - (String) An existing schematics workspace CRN. - * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * `workspace_crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. * `state` - (String) The state of the configuration. * Constraints: Allowable values are: `approved`, `deleted`, `deleting`, `deleting_failed`, `discarded`, `draft`, `deployed`, `deploying_failed`, `deploying`, `superseded`, `undeploying`, `undeploying_failed`, `validated`, `validating`, `validating_failed`. diff --git a/website/docs/d/project_environment.html.markdown b/website/docs/d/project_environment.html.markdown index 3b9420d3fe..e7c6fd774c 100644 --- a/website/docs/d/project_environment.html.markdown +++ b/website/docs/d/project_environment.html.markdown @@ -14,8 +14,8 @@ Provides a read-only data source to retrieve information about a project_environ ```hcl data "ibm_project_environment" "project_environment" { - project_environment_id = ibm_project_environment.project_environment.project_environment_id - project_id = ibm_project_environment.project_environment.project_id + project_environment_id = ibm_project_environment.project_environment_instance.project_environment_id + project_id = ibm_project_environment.project_environment_instance.project_id } ``` @@ -59,8 +59,7 @@ Nested schema for **definition**: * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^`<>\\x00-\\x1F]*$/`. * `description` - (String) The description of the environment. * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. - * `inputs` - (List) The input variables for configuration definition and environment. - Nested schema for **inputs**: + * `inputs` - (Map) The input variables for configuration definition and environment. * `name` - (String) The name of the environment. It is unique within the account across projects and regions. * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. diff --git a/website/docs/r/project_config.html.markdown b/website/docs/r/project_config.html.markdown index 995dfa3570..86be477768 100644 --- a/website/docs/r/project_config.html.markdown +++ b/website/docs/r/project_config.html.markdown @@ -22,13 +22,9 @@ resource "ibm_project_config" "project_config_instance" { api_key = "" } locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.145be7c1-9ec4-4719-b586-584ee52fbed0-global" - input { + inputs = { name = "app_repo_name" } - setting { - name = "app_repo_name" - value = "static-website-dev-app-repo" - } } project_id = ibm_project.project_instance.id } @@ -64,14 +60,12 @@ Nested schema for **definition**: * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. * `environment_id` - (Optional, String) The ID of the project environment. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. - * `inputs` - (Optional, List) The input variables for configuration definition and environment. - Nested schema for **inputs**: - * `locator_id` - (Required, Forces new resource, String) A unique concatenation of catalogID.versionID that identifies the DA in the catalog. + * `inputs` - (Optional, Map) The input variables for configuration definition and environment. + * `locator_id` - (Required, Forces new resource, String) A unique concatenation of catalogID.versionID that identifies the DA in the catalog. Either schematics.workspace_crn, definition.locator_id, or both must be specified. * Constraints: The maximum length is `512` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/`. * `name` - (Required, String) The configuration name. It is unique within the account across projects and regions. * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. - * `settings` - (Optional, List) Schematics environment variables to use to deploy the configuration.Settings are only available if they were specified when the configuration was initially created. - Nested schema for **settings**: + * `settings` - (Optional, Map) Schematics environment variables to use to deploy the configuration. Settings are only available if they were specified when the configuration was initially created. * `project_id` - (Required, Forces new resource, String) The unique project ID. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. * `schematics` - (Optional, List) A schematics workspace associated to a project configuration, with scripts. @@ -124,8 +118,8 @@ Nested schema for **schematics**: * Constraints: The maximum length is `256` characters. The minimum length is `0` characters. The value must match regular expression `/$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. * `type` - (Computed, String) The type of the script. * Constraints: The maximum length is `7` characters. The minimum length is `7` characters. The value must match regular expression `/^(ansible)$/`. - * `workspace_crn` - (Optional, String) An existing schematics workspace CRN. - * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + * `workspace_crn` - (Optional, String) An IBM Cloud resource name, which uniquely identifies a resource. + * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. ## Attribute Reference diff --git a/website/docs/r/project_environment.html.markdown b/website/docs/r/project_environment.html.markdown index f9783845eb..99299f2fd4 100644 --- a/website/docs/r/project_environment.html.markdown +++ b/website/docs/r/project_environment.html.markdown @@ -54,8 +54,7 @@ Nested schema for **definition**: * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^`<>\\x00-\\x1F]*$/`. * `description` - (Optional, String) The description of the environment. * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. - * `inputs` - (Optional, List) The input variables for configuration definition and environment. - Nested schema for **inputs**: + * `inputs` - (Optional, Map) The input variables for configuration definition and environment. * `name` - (Required, String) The name of the environment. It is unique within the account across projects and regions. * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. * `project_id` - (Required, Forces new resource, String) The unique project ID. From b2b59ea59e6e12947c636747d8b9db2c82fcdf81 Mon Sep 17 00:00:00 2001 From: Ian Reyes Date: Sun, 10 Dec 2023 20:03:40 -0500 Subject: [PATCH 094/132] Removed Logs Router Provider Signed-off-by: Ian Reyes --- .secrets.baseline | 18 +- examples/ibm-logs-router/README.md | 81 ------ examples/ibm-logs-router/main.tf | 17 -- examples/ibm-logs-router/outputs.tf | 6 - examples/ibm-logs-router/variables.tf | 33 --- examples/ibm-logs-router/versions.tf | 9 - go.mod | 1 - go.sum | 2 - ibm/conns/config.go | 28 -- ibm/provider/provider.go | 8 - ibm/service/logsrouter/README.md | 11 - .../data_source_ibm_logs_router_tenant.go | 118 -------- ...data_source_ibm_logs_router_tenant_test.go | 44 --- .../resource_ibm_logs_router_tenant.go | 266 ------------------ .../resource_ibm_logs_router_tenant_test.go | 128 --------- website/allowed-subcategories.txt | 1 - .../docs/d/logs_router_tenant.html.markdown | 52 ---- .../docs/r/logs_router_tenant.html.markdown | 60 ---- 18 files changed, 9 insertions(+), 874 deletions(-) delete mode 100644 examples/ibm-logs-router/README.md delete mode 100644 examples/ibm-logs-router/main.tf delete mode 100644 examples/ibm-logs-router/outputs.tf delete mode 100644 examples/ibm-logs-router/variables.tf delete mode 100644 examples/ibm-logs-router/versions.tf delete mode 100644 ibm/service/logsrouter/README.md delete mode 100644 ibm/service/logsrouter/data_source_ibm_logs_router_tenant.go delete mode 100644 ibm/service/logsrouter/data_source_ibm_logs_router_tenant_test.go delete mode 100644 ibm/service/logsrouter/resource_ibm_logs_router_tenant.go delete mode 100644 ibm/service/logsrouter/resource_ibm_logs_router_tenant_test.go delete mode 100644 website/docs/d/logs_router_tenant.html.markdown delete mode 100644 website/docs/r/logs_router_tenant.html.markdown diff --git a/.secrets.baseline b/.secrets.baseline index 0d0d86addf..f846664a78 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.mod|go.sum|.*.map|^.secrets.baseline$", "lines": null }, - "generated_at": "2023-12-05T09:48:48Z", + "generated_at": "2023-12-11T01:02:37Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -786,7 +786,7 @@ "hashed_secret": "9184b0c38101bf24d78b2bb0d044deb1d33696fc", "is_secret": false, "is_verified": false, - "line_number": 132, + "line_number": 131, "type": "Secret Keyword", "verified_result": null }, @@ -794,7 +794,7 @@ "hashed_secret": "c427f185ddcb2440be9b77c8e45f1cd487a2e790", "is_secret": false, "is_verified": false, - "line_number": 1450, + "line_number": 1438, "type": "Base64 High Entropy String", "verified_result": null }, @@ -802,7 +802,7 @@ "hashed_secret": "1f7e33de15e22de9d2eaf502df284ed25ca40018", "is_secret": false, "is_verified": false, - "line_number": 1517, + "line_number": 1505, "type": "Secret Keyword", "verified_result": null }, @@ -810,7 +810,7 @@ "hashed_secret": "1f614c2eb6b3da22d89bd1b9fd47d7cb7c8fc670", "is_secret": false, "is_verified": false, - "line_number": 3326, + "line_number": 3298, "type": "Secret Keyword", "verified_result": null }, @@ -818,7 +818,7 @@ "hashed_secret": "7abfce65b8504403afc25c9790f358d513dfbcc6", "is_secret": false, "is_verified": false, - "line_number": 3339, + "line_number": 3311, "type": "Secret Keyword", "verified_result": null }, @@ -826,7 +826,7 @@ "hashed_secret": "0c2d85bf9a9b1579b16f220a4ea8c3d62b2e24b1", "is_secret": false, "is_verified": false, - "line_number": 3380, + "line_number": 3352, "type": "Secret Keyword", "verified_result": null } @@ -864,7 +864,7 @@ "hashed_secret": "c8b6f5ef11b9223ac35a5663975a466ebe7ebba9", "is_secret": false, "is_verified": false, - "line_number": 1815, + "line_number": 1807, "type": "Secret Keyword", "verified_result": null }, @@ -872,7 +872,7 @@ "hashed_secret": "8abf4899c01104241510ba87685ad4de76b0c437", "is_secret": false, "is_verified": false, - "line_number": 1821, + "line_number": 1813, "type": "Secret Keyword", "verified_result": null } diff --git a/examples/ibm-logs-router/README.md b/examples/ibm-logs-router/README.md deleted file mode 100644 index 51da09060a..0000000000 --- a/examples/ibm-logs-router/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# Example for IBM Logs Router V1 - -This example illustrates how to use IBM LogsRouterV1 - -The following types of resources are supported: - -* logs_router_tenant - -## Usage - -To run this example, execute the following commands: - -```bash -$ terraform init -$ terraform plan -$ terraform apply -``` - -Run `terraform destroy` when you don't need these resources. - - -## IbmLogsRouterV1 resources - -logs_router_tenant resource: - -```hcl -resource "logs_router_tenant" "logs_router_tenant_instance" { - target_type = var.logs_router_tenant_target_type - target_host = var.logs_router_tenant_target_host - target_port = var.logs_router_tenant_target_port - target_instance_crn = var.logs_router_tenant_target_instance_crn -} -``` - -## IbmLogsRouterV1 data sources - -logs_router_tenant data source: - -```hcl -data "logs_router_tenant" "logs_router_tenant_instance" { - tenant_id = ibm_logs_router_tenant.logs_router_tenant_instance.id -} -``` - -## Assumptions - -1. TODO - -## Notes - -1. TODO - -## Requirements - -| Name | Version | -|------|---------| -| terraform | ~> 0.12 | - -## Providers - -| Name | Version | -|------|---------| -| ibm | 1.13.1 | - -## Inputs - -| Name | Description | Type | Required | -|------|-------------|------|---------| -| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | -| target_type | Type of log-sink. | `string` | true | -| target_host | Host name of log-sink. | `string` | true | -| target_port | Network port of log sink. | `number` | true | -| target_instance_crn | Cloud resource name of the log-sink target instance. | `string` | true | -| tenant_id | The instance ID of the tenant. | `` | true | - -## Outputs - -| Name | Description | -|------|-------------| -| logs_router_tenant | logs_router_tenant object | -| logs_router_tenant | logs_router_tenant object | diff --git a/examples/ibm-logs-router/main.tf b/examples/ibm-logs-router/main.tf deleted file mode 100644 index 1be39ee095..0000000000 --- a/examples/ibm-logs-router/main.tf +++ /dev/null @@ -1,17 +0,0 @@ -provider "ibm" { - ibmcloud_api_key = var.ibmcloud_api_key -} - -// Provision logs_router_tenant resource instance -resource "ibm_logs_router_tenant" "logs_router_tenant_instance" { - target_type = var.logs_router_tenant_target_type - target_host = var.logs_router_tenant_target_host - target_port = var.logs_router_tenant_target_port - target_instance_crn = var.logs_router_tenant_target_instance_crn -} - -// Create logs_router_tenant data source -data "ibm_logs_router_tenant" "logs_router_tenant_instance" { - tenant_id = ibm_logs_router_tenant.logs_router_tenant_instance.id -} - diff --git a/examples/ibm-logs-router/outputs.tf b/examples/ibm-logs-router/outputs.tf deleted file mode 100644 index 813aeb5bcb..0000000000 --- a/examples/ibm-logs-router/outputs.tf +++ /dev/null @@ -1,6 +0,0 @@ -// This output allows logs_router_tenant data to be referenced by other resources and the terraform CLI -// Modify this output if only certain data should be exposed -output "ibm_logs_router_tenant" { - value = ibm_logs_router_tenant.logs_router_tenant_instance - description = "logs_router_tenant resource instance" -} diff --git a/examples/ibm-logs-router/variables.tf b/examples/ibm-logs-router/variables.tf deleted file mode 100644 index 34a9f372ff..0000000000 --- a/examples/ibm-logs-router/variables.tf +++ /dev/null @@ -1,33 +0,0 @@ -variable "ibmcloud_api_key" { - description = "IBM Cloud API key" - type = string -} - -// Resource arguments for logs_router_tenant -variable "logs_router_tenant_target_type" { - description = "Type of log-sink." - type = string - default = "logdna" -} -variable "logs_router_tenant_target_host" { - description = "Host name of log-sink." - type = string - default = "www.example.com" -} -variable "logs_router_tenant_target_port" { - description = "Network port of log sink." - type = number - default = 10 -} -variable "logs_router_tenant_target_instance_crn" { - description = "Cloud resource name of the log-sink target instance." - type = string - default = "crn:v1:bluemix:public:logdna:us-east:a/36ff82794a734d7580b90c97b0327d28:f08aea7c-dde9-4452-b552-225af4b51eaa::" -} - -// Data source arguments for logs_router_tenant -variable "logs_router_tenant_tenant_id" { - description = "The instance ID of the tenant." - type = string - default = "f3a466c9-c4db-4eee-95cc-ba82db58e2b5" -} diff --git a/examples/ibm-logs-router/versions.tf b/examples/ibm-logs-router/versions.tf deleted file mode 100644 index 54c9d03e8d..0000000000 --- a/examples/ibm-logs-router/versions.tf +++ /dev/null @@ -1,9 +0,0 @@ -terraform { - required_version = ">= 1.0" - required_providers { - ibm = { - source = "IBM-Cloud/ibm" - version = "1.52.0-beta0" - } - } -} diff --git a/go.mod b/go.mod index fdf9de1fb1..4c06cd1d1d 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,6 @@ require ( github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20211109141421-a4b61b05f7d1 github.com/IBM/ibm-hpcs-uko-sdk v0.0.20-beta github.com/IBM/keyprotect-go-client v0.12.2 - github.com/IBM/logs-router-go-sdk v1.0.0 github.com/IBM/networking-go-sdk v0.42.2 github.com/IBM/platform-services-go-sdk v0.54.0 github.com/IBM/project-go-sdk v0.1.4 diff --git a/go.sum b/go.sum index f53d313116..e9de9e3543 100644 --- a/go.sum +++ b/go.sum @@ -153,8 +153,6 @@ github.com/IBM/ibm-hpcs-uko-sdk v0.0.20-beta/go.mod h1:MLVNHMYoKsvovJZ4v1gQCpIYt github.com/IBM/keyprotect-go-client v0.5.1/go.mod h1:5TwDM/4FRJq1ZOlwQL1xFahLWQ3TveR88VmL1u3njyI= github.com/IBM/keyprotect-go-client v0.12.2 h1:Cjxcqin9Pl0xz3MnxdiVd4v/eIa79xL3hQpSbwOr/DQ= github.com/IBM/keyprotect-go-client v0.12.2/go.mod h1:yr8h2noNgU8vcbs+vhqoXp3Lmv73PI0zAc6VMgFvWwM= -github.com/IBM/logs-router-go-sdk v1.0.0 h1:cGBjf7wJye/WuzFljqN7yB8ToIxLIiffWaQGW9rSTcI= -github.com/IBM/logs-router-go-sdk v1.0.0/go.mod h1:FJpyZctp5DmRms/MtvRUuWBF/CAk76WJzAsJc4EIM/Y= github.com/IBM/networking-go-sdk v0.42.2 h1:caqjx4jyFHi10Vlf3skHvlL6K3YJRVstsmCBmvdyqkA= github.com/IBM/networking-go-sdk v0.42.2/go.mod h1:lTUZwtUkMANMnrLHFIgRhHrkBfwASY/Iho1fabaPHxo= github.com/IBM/platform-services-go-sdk v0.54.0 h1:WjHWm9ZAJvlq07E1WXXtEe+d/B0sazWD6cEWVT7EMLU= diff --git a/ibm/conns/config.go b/ibm/conns/config.go index 88eb394709..ff89bd307f 100644 --- a/ibm/conns/config.go +++ b/ibm/conns/config.go @@ -29,7 +29,6 @@ import ( "github.com/IBM/go-sdk-core/v5/core" cosconfig "github.com/IBM/ibm-cos-sdk-go-config/resourceconfigurationv1" kp "github.com/IBM/keyprotect-go-client" - "github.com/IBM/logs-router-go-sdk/ibmlogsrouteropenapi30v0" cisalertsv1 "github.com/IBM/networking-go-sdk/alertsv1" cisoriginpull "github.com/IBM/networking-go-sdk/authenticatedoriginpullapiv1" cisbotanalyticsv1 "github.com/IBM/networking-go-sdk/botanalyticsv1" @@ -229,7 +228,6 @@ type ClientSession interface { ResourceManagementAPIv2() (managementv2.ResourceManagementAPIv2, error) ResourceControllerAPI() (controller.ResourceControllerAPI, error) ResourceControllerAPIV2() (controllerv2.ResourceControllerAPIV2, error) - IbmLogsRouterOpenApi30V0() (*ibmlogsrouteropenapi30v0.IbmLogsRouterOpenApi30V0, error) SoftLayerSession() *slsession.Session IBMPISession() (*ibmpisession.IBMPISession, error) UserManagementAPI() (usermanagementv2.UserManagementAPI, error) @@ -544,10 +542,6 @@ type clientSession struct { secretsManagerClient *secretsmanagerv2.SecretsManagerV2 secretsManagerClientErr error - // Logs Routing - ibmLogsRouterOpenApi30Client *ibmlogsrouteropenapi30v0.IbmLogsRouterOpenApi30V0 - ibmLogsRouterOpenApi30ClientErr error - // Schematics service options schematicsClient *schematicsv1.SchematicsV1 schematicsClientErr error @@ -1175,11 +1169,6 @@ func (session clientSession) MetricsRouterV3() (*metricsrouterv3.MetricsRouterV3 return session.metricsRouterClient, session.metricsRouterClientErr } -// Logs Router API -func (session clientSession) IbmLogsRouterOpenApi30V0() (*ibmlogsrouteropenapi30v0.IbmLogsRouterOpenApi30V0, error) { - return session.ibmLogsRouterOpenApi30Client, session.ibmLogsRouterOpenApi30ClientErr -} - func (session clientSession) ESschemaRegistrySession() (*schemaregistryv1.SchemaregistryV1, error) { return session.esSchemaRegistryClient, session.esSchemaRegistryErr } @@ -1307,7 +1296,6 @@ func (c *Config) ClientSession() (interface{}, error) { session.cdToolchainClientErr = errEmptyBluemixCredentials session.codeEngineClientErr = errEmptyBluemixCredentials session.projectClientErr = errEmptyBluemixCredentials - session.ibmLogsRouterOpenApi30ClientErr = errEmptyBluemixCredentials return session, nil } @@ -1690,22 +1678,6 @@ func (c *Config) ClientSession() (interface{}, error) { }) } - // LOGS ROUTER service - ibmLogsRouterOpenApi30ClientOptions := &ibmlogsrouteropenapi30v0.IbmLogsRouterOpenApi30V0Options{ - Authenticator: authenticator, - } - session.ibmLogsRouterOpenApi30Client, err = ibmlogsrouteropenapi30v0.NewIbmLogsRouterOpenApi30V0(ibmLogsRouterOpenApi30ClientOptions) - if err == nil { - // Enable retries for API calls - session.ibmLogsRouterOpenApi30Client.Service.EnableRetries(c.RetryCount, c.RetryDelay) - // Add custom header for analytics - session.ibmLogsRouterOpenApi30Client.SetDefaultHeaders(gohttp.Header{ - "X-Original-User-Agent": {fmt.Sprintf("terraform-provider-ibm/%s", version.Version)}, - }) - } else { - session.ibmLogsRouterOpenApi30ClientErr = fmt.Errorf("Error occurred while configuring IBM logs-router service: %q", err) - } - // ATRACKER Version 2 var atrackerClientV2URL string var atrackerURLV2Err error diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index aa758ebf66..9a0e61277b 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -38,7 +38,6 @@ import ( "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/iampolicy" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/kms" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/kubernetes" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/logsrouter" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/metricsrouter" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/power" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/project" @@ -744,9 +743,6 @@ func Provider() *schema.Provider { "ibm_metrics_router_targets": metricsrouter.DataSourceIBMMetricsRouterTargets(), "ibm_metrics_router_routes": metricsrouter.DataSourceIBMMetricsRouterRoutes(), - // Logs Router - "ibm_logs_router_tenant": logsrouter.DataSourceIbmLogsRouterTenant(), - // Security and Complaince Center(soon to be deprecated) "ibm_scc_account_location": scc.DataSourceIBMSccAccountLocation(), "ibm_scc_account_locations": scc.DataSourceIBMSccAccountLocations(), @@ -1280,9 +1276,6 @@ func Provider() *schema.Provider { "ibm_metrics_router_route": metricsrouter.ResourceIBMMetricsRouterRoute(), "ibm_metrics_router_settings": metricsrouter.ResourceIBMMetricsRouterSettings(), - // Logs Router - "ibm_logs_router_tenant": logsrouter.ResourceIbmLogsRouterTenant(), - // Security and Compliance Center(soon to be deprecated) "ibm_scc_account_settings": scc.ResourceIBMSccAccountSettings(), "ibm_scc_rule_attachment": scc.ResourceIBMSccRuleAttachment(), @@ -1547,7 +1540,6 @@ func Validator() validate.ValidatorDict { "ibm_metrics_router_target": metricsrouter.ResourceIBMMetricsRouterTargetValidator(), "ibm_metrics_router_route": metricsrouter.ResourceIBMMetricsRouterRouteValidator(), "ibm_metrics_router_settings": metricsrouter.ResourceIBMMetricsRouterSettingsValidator(), - "ibm_logs_router_tenant": logsrouter.ResourceIbmLogsRouterTenantValidator(), "ibm_satellite_endpoint": satellite.ResourceIBMSatelliteEndpointValidator(), "ibm_cbr_zone": contextbasedrestrictions.ResourceIBMCbrZoneValidator(), "ibm_cbr_rule": contextbasedrestrictions.ResourceIBMCbrRuleValidator(), diff --git a/ibm/service/logsrouter/README.md b/ibm/service/logsrouter/README.md deleted file mode 100644 index 350106c42d..0000000000 --- a/ibm/service/logsrouter/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Terraform IBM Provider - -This area is primarily for IBM provider contributors and maintainers. For information on _using_ Terraform and the IBM provider, see the links below. - - -## Handy Links -* [Find out about contributing](../../../CONTRIBUTING.md) to the IBM provider! -* IBM Provider Docs: [Home](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs) -* IBM Provider Docs: [One of the resources](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/logs_router_tenant) -* IBM API Docs: [IBM API Docs for IBM Cloud Logs Router](https://test.cloud.ibm.com/apidocs/logs-router-service-api) -* IBM SDK: [IBM SDK for IBM Cloud Logs Router](https://github.com/IBM/logs-router-go-sdk) diff --git a/ibm/service/logsrouter/data_source_ibm_logs_router_tenant.go b/ibm/service/logsrouter/data_source_ibm_logs_router_tenant.go deleted file mode 100644 index db12580145..0000000000 --- a/ibm/service/logsrouter/data_source_ibm_logs_router_tenant.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package logsrouter - -import ( - "context" - "fmt" - "log" - - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" - "github.com/IBM/logs-router-go-sdk/ibmlogsrouteropenapi30v0" - - "github.com/IBM/go-sdk-core/v5/core" - "github.com/go-openapi/strfmt" -) - -func DataSourceIbmLogsRouterTenant() *schema.Resource { - return &schema.Resource{ - ReadContext: dataSourceIbmLogsRouterTenantRead, - - Schema: map[string]*schema.Schema{ - "tenant_id": &schema.Schema{ - Type: schema.TypeString, - Required: true, - Description: "The instance ID of the tenant.", - }, - "account_id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "The account ID the tenant belongs to.", - }, - "target_type": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Type of log-sink.", - }, - "target_host": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Host name of log-sink.", - }, - "target_port": &schema.Schema{ - Type: schema.TypeInt, - Computed: true, - Description: "Network port of log sink.", - }, - "target_instance_crn": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Cloud resource name of the log-sink target instance.", - }, - "created_at": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Time stamp the tenant was originally created.", - }, - "updated_at": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "time stamp the tenant was last updated.", - }, - }, - } -} - -func dataSourceIbmLogsRouterTenantRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - ibmLogsRouterOpenApi30Client, err := meta.(conns.ClientSession).IbmLogsRouterOpenApi30V0() - if err != nil { - return diag.FromErr(err) - } - - getTenantDetailOptions := &ibmlogsrouteropenapi30v0.GetTenantDetailOptions{} - - getTenantDetailOptions.SetTenantID(core.UUIDPtr(strfmt.UUID(d.Get("tenant_id").(string)))) - - tenantDetailsResponse, response, err := ibmLogsRouterOpenApi30Client.GetTenantDetailWithContext(context, getTenantDetailOptions) - if err != nil { - log.Printf("[DEBUG] GetTenantDetailWithContext failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("GetTenantDetailWithContext failed %s\n%s", err, response)) - } - - d.SetId(fmt.Sprintf("%s", *getTenantDetailOptions.TenantID)) - - if err = d.Set("account_id", tenantDetailsResponse.AccountID); err != nil { - return diag.FromErr(fmt.Errorf("Error setting account_id: %s", err)) - } - - if err = d.Set("target_type", tenantDetailsResponse.TargetType); err != nil { - return diag.FromErr(fmt.Errorf("Error setting target_type: %s", err)) - } - - if err = d.Set("target_host", tenantDetailsResponse.TargetHost); err != nil { - return diag.FromErr(fmt.Errorf("Error setting target_host: %s", err)) - } - - if err = d.Set("target_port", flex.IntValue(tenantDetailsResponse.TargetPort)); err != nil { - return diag.FromErr(fmt.Errorf("Error setting target_port: %s", err)) - } - - if err = d.Set("target_instance_crn", tenantDetailsResponse.TargetInstanceCrn); err != nil { - return diag.FromErr(fmt.Errorf("Error setting target_instance_crn: %s", err)) - } - - if err = d.Set("created_at", tenantDetailsResponse.CreatedAt); err != nil { - return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) - } - - if err = d.Set("updated_at", tenantDetailsResponse.UpdatedAt); err != nil { - return diag.FromErr(fmt.Errorf("Error setting updated_at: %s", err)) - } - - return nil -} diff --git a/ibm/service/logsrouter/data_source_ibm_logs_router_tenant_test.go b/ibm/service/logsrouter/data_source_ibm_logs_router_tenant_test.go deleted file mode 100644 index 597acdbded..0000000000 --- a/ibm/service/logsrouter/data_source_ibm_logs_router_tenant_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package logsrouter_test - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - - acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" -) - -func TestAccIbmLogsRouterTenantDataSourceBasic(t *testing.T) { - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIbmLogsRouterTenantDataSourceConfigBasic(), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_logs_router_tenant.logs_router_tenant_instance", "id"), - resource.TestCheckResourceAttrSet("data.ibm_logs_router_tenant.logs_router_tenant_instance", "tenant_id"), - ), - }, - }, - }) -} - -func testAccCheckIbmLogsRouterTenantDataSourceConfigBasic() string { - return fmt.Sprintf(` - resource "ibm_logs_router_tenant" "logs_router_tenant_instance" { - target_type = "logdna" - target_host = "tf-target-host-01" - target_port = 42 - target_instance_crn = "crn:v1:bluemix:public:logdna:eu-de:a/3516b8fa0a174a71899f5affa4f18d78:3517d2ed-9429-af34-ad52-34278391cbca::" - access_credential = "test-credential" - } - data "ibm_logs_router_tenant" "logs_router_tenant_instance" { - tenant_id = ibm_logs_router_tenant.logs_router_tenant_instance.id - } - `) -} diff --git a/ibm/service/logsrouter/resource_ibm_logs_router_tenant.go b/ibm/service/logsrouter/resource_ibm_logs_router_tenant.go deleted file mode 100644 index 02da4c81c0..0000000000 --- a/ibm/service/logsrouter/resource_ibm_logs_router_tenant.go +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package logsrouter - -import ( - "context" - "fmt" - "log" - - "github.com/go-openapi/strfmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" - "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/logs-router-go-sdk/ibmlogsrouteropenapi30v0" -) - -func ResourceIbmLogsRouterTenant() *schema.Resource { - return &schema.Resource{ - CreateContext: resourceIbmLogsRouterTenantCreate, - ReadContext: resourceIbmLogsRouterTenantRead, - UpdateContext: resourceIbmLogsRouterTenantUpdate, - DeleteContext: resourceIbmLogsRouterTenantDelete, - Importer: &schema.ResourceImporter{}, - - Schema: map[string]*schema.Schema{ - "target_type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validate.InvokeValidator("ibm_logs_router_tenant", "target_type"), - Description: "Type of log-sink.", - }, - "target_host": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validate.InvokeValidator("ibm_logs_router_tenant", "target_host"), - Description: "Host name of log-sink.", - }, - "target_port": { - Type: schema.TypeInt, - Required: true, - Description: "Network port of log sink.", - }, - "target_instance_crn": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validate.InvokeValidator("ibm_logs_router_tenant", "target_instance_crn"), - Description: "Cloud resource name of the log-sink target instance.", - }, - "access_credential": { - Type: schema.TypeString, - Required: true, - Sensitive: true, - ValidateFunc: validate.InvokeValidator("ibm_logs_router_tenant", "access_credential"), - Description: "Secret to connect to the log-sink", - }, - "account_id": { - Type: schema.TypeString, - Computed: true, - Description: "The account ID the tenant belongs to.", - }, - "created_at": { - Type: schema.TypeString, - Computed: true, - Description: "Time stamp the tenant was originally created.", - }, - "updated_at": { - Type: schema.TypeString, - Computed: true, - Description: "time stamp the tenant was last updated.", - }, - }, - } -} - -func ResourceIbmLogsRouterTenantValidator() *validate.ResourceValidator { - validateSchema := make([]validate.ValidateSchema, 0) - validateSchema = append(validateSchema, - validate.ValidateSchema{ - Identifier: "target_type", - ValidateFunctionIdentifier: validate.ValidateRegexpLen, - Type: validate.TypeString, - Required: true, - Regexp: `[a-z,A-Z,0-9,-]`, - MinValueLength: 1, - MaxValueLength: 32, - }, - validate.ValidateSchema{ - Identifier: "target_host", - ValidateFunctionIdentifier: validate.ValidateRegexpLen, - Type: validate.TypeString, - Required: true, - Regexp: `[a-z,A-Z,0-9,-,.]`, - MinValueLength: 1, - MaxValueLength: 256, - }, - validate.ValidateSchema{ - Identifier: "target_instance_crn", - ValidateFunctionIdentifier: validate.ValidateRegexpLen, - Type: validate.TypeString, - Required: true, - Regexp: `[a-z,A-Z,0-9,:,-]`, - MinValueLength: 1, - MaxValueLength: 256, - }, - validate.ValidateSchema{ - Identifier: "access_credential", - ValidateFunctionIdentifier: validate.ValidateRegexpLen, - Type: validate.TypeString, - Required: true, - Regexp: `[a-z,A-Z,0-9,-\\.;!?]`, - MinValueLength: 10, - MaxValueLength: 50, - }, - ) - - resourceValidator := validate.ResourceValidator{ResourceName: "ibm_logs_router_tenant", Schema: validateSchema} - return &resourceValidator -} - -func resourceIbmLogsRouterTenantCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - ibmLogsRouterOpenApi30Client, err := meta.(conns.ClientSession).IbmLogsRouterOpenApi30V0() - if err != nil { - return diag.FromErr(err) - } - - createTenantOptions := &ibmlogsrouteropenapi30v0.CreateTenantOptions{} - - createTenantOptions.SetTargetType(d.Get("target_type").(string)) - createTenantOptions.SetTargetHost(d.Get("target_host").(string)) - createTenantOptions.SetTargetPort(int64(d.Get("target_port").(int))) - createTenantOptions.SetAccessCredential(d.Get("access_credential").(string)) - createTenantOptions.SetTargetInstanceCrn(d.Get("target_instance_crn").(string)) - - tenantDetailsResponse, response, err := ibmLogsRouterOpenApi30Client.CreateTenantWithContext(context, createTenantOptions) - if err != nil { - log.Printf("[DEBUG] CreateTenantWithContext failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("CreateTenantWithContext failed %s\n%s", err, response)) - } - - d.SetId(tenantDetailsResponse.ID.String()) - - return resourceIbmLogsRouterTenantRead(context, d, meta) -} - -func resourceIbmLogsRouterTenantRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - ibmLogsRouterOpenApi30Client, err := meta.(conns.ClientSession).IbmLogsRouterOpenApi30V0() - if err != nil { - return diag.FromErr(err) - } - - getTenantDetailOptions := &ibmlogsrouteropenapi30v0.GetTenantDetailOptions{} - tenantId := strfmt.UUID(d.Id()) - getTenantDetailOptions.SetTenantID(&tenantId) - - tenantDetailsResponse, response, err := ibmLogsRouterOpenApi30Client.GetTenantDetailWithContext(context, getTenantDetailOptions) - if err != nil { - if response != nil && response.StatusCode == 404 { - d.SetId("") - return nil - } - log.Printf("[DEBUG] GetTenantDetailWithContext failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("GetTenantDetailWithContext failed %s\n%s", err, response)) - } - - if err = d.Set("target_type", tenantDetailsResponse.TargetType); err != nil { - return diag.FromErr(fmt.Errorf("Error setting target_type: %s", err)) - } - if err = d.Set("target_host", tenantDetailsResponse.TargetHost); err != nil { - return diag.FromErr(fmt.Errorf("Error setting target_host: %s", err)) - } - if err = d.Set("target_port", flex.IntValue(tenantDetailsResponse.TargetPort)); err != nil { - return diag.FromErr(fmt.Errorf("Error setting target_port: %s", err)) - } - if err = d.Set("target_instance_crn", tenantDetailsResponse.TargetInstanceCrn); err != nil { - return diag.FromErr(fmt.Errorf("Error setting target_instance_crn: %s", err)) - } - if !core.IsNil(tenantDetailsResponse.AccountID) { - if err = d.Set("account_id", tenantDetailsResponse.AccountID); err != nil { - return diag.FromErr(fmt.Errorf("Error setting account_id: %s", err)) - } - } - if !core.IsNil(tenantDetailsResponse.CreatedAt) { - if err = d.Set("created_at", tenantDetailsResponse.CreatedAt); err != nil { - return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) - } - } - if !core.IsNil(tenantDetailsResponse.UpdatedAt) { - if err = d.Set("updated_at", tenantDetailsResponse.UpdatedAt); err != nil { - return diag.FromErr(fmt.Errorf("Error setting updated_at: %s", err)) - } - } - - return nil -} - -func resourceIbmLogsRouterTenantUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - ibmLogsRouterOpenApi30Client, err := meta.(conns.ClientSession).IbmLogsRouterOpenApi30V0() - if err != nil { - return diag.FromErr(err) - } - - updateTargetOptions := &ibmlogsrouteropenapi30v0.UpdateTargetOptions{} - tenantId := strfmt.UUID(d.Id()) - updateTargetOptions.SetTenantID(&tenantId) - - hasChange := false - - patchVals := &ibmlogsrouteropenapi30v0.TenantDetailsResponsePatch{} - if d.HasChange("target_host") { - newTargetHost := d.Get("target_host").(string) - patchVals.TargetHost = &newTargetHost - hasChange = true - } - if d.HasChange("target_port") { - newTargetPort := int64(d.Get("target_port").(int)) - patchVals.TargetPort = &newTargetPort - hasChange = true - } - if d.HasChange("access_credential") { - newAccessCredential := d.Get("access_credential").(string) - patchVals.AccessCredential = &newAccessCredential - hasChange = true - } - if d.HasChange("target_instance_crn") { - newTargetInstanceCrn := d.Get("target_instance_crn").(string) - patchVals.TargetInstanceCrn = &newTargetInstanceCrn - hasChange = true - } - - if hasChange { - updateTargetOptions.TenantDetailsResponsePatch, _ = patchVals.AsPatch() - _, response, err := ibmLogsRouterOpenApi30Client.UpdateTargetWithContext(context, updateTargetOptions) - if err != nil { - log.Printf("[DEBUG] UpdateTargetWithContext failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("UpdateTargetWithContext failed %s\n%s", err, response)) - } - } - - return resourceIbmLogsRouterTenantRead(context, d, meta) -} - -func resourceIbmLogsRouterTenantDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - ibmLogsRouterOpenApi30Client, err := meta.(conns.ClientSession).IbmLogsRouterOpenApi30V0() - if err != nil { - return diag.FromErr(err) - } - - deleteTenantOptions := &ibmlogsrouteropenapi30v0.DeleteTenantOptions{} - tenantId := strfmt.UUID(d.Id()) - deleteTenantOptions.SetTenantID(&tenantId) - - _, response, err := ibmLogsRouterOpenApi30Client.DeleteTenantWithContext(context, deleteTenantOptions) - if err != nil { - log.Printf("[DEBUG] DeleteTenantWithContext failed %s\n%s", err, response) - return diag.FromErr(fmt.Errorf("DeleteTenantWithContext failed %s\n%s", err, response)) - } - - d.SetId("") - - return nil -} diff --git a/ibm/service/logsrouter/resource_ibm_logs_router_tenant_test.go b/ibm/service/logsrouter/resource_ibm_logs_router_tenant_test.go deleted file mode 100644 index a625776d49..0000000000 --- a/ibm/service/logsrouter/resource_ibm_logs_router_tenant_test.go +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package logsrouter_test - -import ( - "fmt" - "testing" - - "github.com/go-openapi/strfmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - - acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" - "github.com/IBM/logs-router-go-sdk/ibmlogsrouteropenapi30v0" -) - -func TestAccIbmLogsRouterTenantBasic(t *testing.T) { - var conf ibmlogsrouteropenapi30v0.TenantDetailsResponse - targetType := fmt.Sprintf("logdna") - targetHost := fmt.Sprintf("tf-target-host-%d", acctest.RandIntRange(10, 100)) - targetPort := fmt.Sprintf("%d", acctest.RandIntRange(10, 100)) - targetInstanceCrn := fmt.Sprintf("crn:v1:bluemix:public:logdna:eu-de:a/3516b8fa0a174a71899f5affa4f18d78:3517d2ed-9429-af34-ad52-34278391cbc8::") - targetTypeUpdate := fmt.Sprintf("logdna") - targetHostUpdate := fmt.Sprintf("tf-target-host-%d", acctest.RandIntRange(10, 100)) - targetPortUpdate := fmt.Sprintf("%d", acctest.RandIntRange(10, 100)) - targetInstanceCrnUpdate := fmt.Sprintf("crn:v1:bluemix:public:logdna:eu-de:a/3516b8fa0a174a71899f5affa4f18d78:3517d2ed-9429-af34-ad52-34278391cbc8::") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - CheckDestroy: testAccCheckIbmLogsRouterTenantDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIbmLogsRouterTenantConfigBasic(targetType, targetHost, targetPort, targetInstanceCrn), - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIbmLogsRouterTenantExists("ibm_logs_router_tenant.logs_router_tenant_instance", conf), - resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_type", targetType), - resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_host", targetHost), - resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_instance_crn", targetInstanceCrn), - ), - }, - resource.TestStep{ - Config: testAccCheckIbmLogsRouterTenantConfigBasic(targetTypeUpdate, targetHostUpdate, targetPortUpdate, targetInstanceCrnUpdate), - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_type", targetTypeUpdate), - resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_host", targetHostUpdate), - resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_port", targetPortUpdate), - resource.TestCheckResourceAttr("ibm_logs_router_tenant.logs_router_tenant_instance", "target_instance_crn", targetInstanceCrnUpdate), - ), - }, - resource.TestStep{ - ResourceName: "ibm_logs_router_tenant.logs_router_tenant_instance", //"ibm_logs_router_tenant.logs_router_tenant", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"access_credential"}, - }, - }, - }) -} - -func testAccCheckIbmLogsRouterTenantConfigBasic(targetType string, targetHost string, targetPort string, targetInstanceCrn string) string { - return fmt.Sprintf(` - resource "ibm_logs_router_tenant" "logs_router_tenant_instance" { - target_type = "%s" - target_host = "%s" - target_port = %s - target_instance_crn = "%s" - access_credential = "test-credential" - } - `, targetType, targetHost, targetPort, targetInstanceCrn) -} - -func testAccCheckIbmLogsRouterTenantExists(n string, obj ibmlogsrouteropenapi30v0.TenantDetailsResponse) resource.TestCheckFunc { - - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Not found: %s", n) - } - - ibmLogsRouterOpenApi30Client, err := acc.TestAccProvider.Meta().(conns.ClientSession).IbmLogsRouterOpenApi30V0() - if err != nil { - return err - } - - getTenantDetailOptions := &ibmlogsrouteropenapi30v0.GetTenantDetailOptions{} - tenantId := strfmt.UUID(rs.Primary.ID) - getTenantDetailOptions.SetTenantID(&tenantId) - - tenantDetailsResponse, _, err := ibmLogsRouterOpenApi30Client.GetTenantDetail(getTenantDetailOptions) - if err != nil { - return err - } - - obj = *tenantDetailsResponse - return nil - } -} - -func testAccCheckIbmLogsRouterTenantDestroy(s *terraform.State) error { - ibmLogsRouterOpenApi30Client, err := acc.TestAccProvider.Meta().(conns.ClientSession).IbmLogsRouterOpenApi30V0() - if err != nil { - return err - } - for _, rs := range s.RootModule().Resources { - if rs.Type != "ibm_logs_router_tenant" { - continue - } - - getTenantDetailOptions := &ibmlogsrouteropenapi30v0.GetTenantDetailOptions{} - tenantId := strfmt.UUID(rs.Primary.ID) - getTenantDetailOptions.SetTenantID(&tenantId) - - // Try to find the key - _, response, err := ibmLogsRouterOpenApi30Client.GetTenantDetail(getTenantDetailOptions) - - if err == nil { - return fmt.Errorf("logs_router_tenant still exists: %s", rs.Primary.ID) - } else if response.StatusCode != 404 { - return fmt.Errorf("Error checking for logs_router_tenant (%s) has been destroyed: %s", rs.Primary.ID, err) - } - } - - return nil -} diff --git a/website/allowed-subcategories.txt b/website/allowed-subcategories.txt index 7410d43146..1e97423139 100644 --- a/website/allowed-subcategories.txt +++ b/website/allowed-subcategories.txt @@ -25,7 +25,6 @@ Identity & Access Management (IAM) Internet services Key Management Service Kubernetes Service -Logs Router Metrics Router Object Storage Power Systems diff --git a/website/docs/d/logs_router_tenant.html.markdown b/website/docs/d/logs_router_tenant.html.markdown deleted file mode 100644 index 0ff47b87b3..0000000000 --- a/website/docs/d/logs_router_tenant.html.markdown +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: "ibm" -page_title: "IBM : ibm_logs_router_tenant" -description: |- - Get information about logs_router_tenant -subcategory: "Logs Router" ---- - -# ibm_logs_router_tenant - -Provides a read-only data source to retrieve information about a logs_router_tenant. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. - -## Example Usage - -```hcl -data "ibm_logs_router_tenant" "logs_router_tenant" { - tenant_id = "f3a466c9-c4db-4eee-95cc-ba82db58e2b5" -} -``` - -## Argument Reference - -You can specify the following arguments for this data source. - -* `tenant_id` - (Required, Forces new resource, String) The instance ID of the tenant. - * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/[A-F,0-9,-]/`. - -## Attribute Reference - -After your data source is created, you can read values from the following attributes. - -* `id` - The unique identifier of the logs_router_tenant. -* `account_id` - (String) The account ID the tenant belongs to. - * Constraints: The maximum length is `32` characters. The minimum length is `32` characters. The value must match regular expression `/[a-z,A-Z,0-9,-]/`. - -* `created_at` - (String) Time stamp the tenant was originally created. - * Constraints: The maximum length is `36` characters. The minimum length is `1` character. The value must match regular expression `/[0-9,:,.,-,T,Z]/`. - -* `target_host` - (String) Host name of log-sink. - * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/[a-z,A-Z,0-9,-,.]/`. - -* `target_instance_crn` - (String) Cloud resource name of the log-sink target instance. - * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/[a-z,A-Z,0-9,:,-]/`. - -* `target_port` - (Integer) Network port of log sink. - -* `target_type` - (String) Type of log-sink. - * Constraints: The maximum length is `32` characters. The minimum length is `1` character. The value must match regular expression `/[a-z,A-Z,0-9,-]/`. - -* `updated_at` - (String) time stamp the tenant was last updated. - * Constraints: The maximum length is `36` characters. The minimum length is `1` character. The value must match regular expression `/[0-9,:,.,-,T,Z]/`. - diff --git a/website/docs/r/logs_router_tenant.html.markdown b/website/docs/r/logs_router_tenant.html.markdown deleted file mode 100644 index 0a193468d8..0000000000 --- a/website/docs/r/logs_router_tenant.html.markdown +++ /dev/null @@ -1,60 +0,0 @@ ---- -layout: "ibm" -page_title: "IBM : ibm_logs_router_tenant" -description: |- - Manages logs_router_tenant. -subcategory: "Logs Router" ---- - -# ibm_logs_router_tenant - -Create, update, and delete logs_router_tenants with this resource. - -## Example Usage - -```hcl -resource "ibm_logs_router_tenant" "logs_router_tenant_instance" { - target_host = "www.example.com" - target_instance_crn = "crn:v1:bluemix:public:logdna:eu-de:a/3516b8fa0a174a71899f5affa4f18d78:3517d2ed-9429-af34-ad52-34278391cbc8::" - target_port = 10 - target_type = "logdna" -} -``` - -## Argument Reference - -You can specify the following arguments for this resource. - -* `target_host` - (Required, String) Host name of log-sink. - * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/[a-z,A-Z,0-9,-,.]/`. -* `target_instance_crn` - (Required, String) Cloud resource name of the log-sink target instance. - * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/[a-z,A-Z,0-9,:,-]/`. -* `target_port` - (Required, Integer) Network port of log sink. -* `target_type` - (Required, String) Type of log-sink. - * Constraints: The maximum length is `32` characters. The minimum length is `1` character. The value must match regular expression `/[a-z,A-Z,0-9,-]/`. - -## Attribute Reference - -After your resource is created, you can read values from the listed arguments and the following attributes. - -* `id` - The unique identifier of the logs_router_tenant. -* `account_id` - (String) The account ID the tenant belongs to. - * Constraints: The maximum length is `32` characters. The minimum length is `32` characters. The value must match regular expression `/[a-z,A-Z,0-9,-]/`. -* `created_at` - (String) Time stamp the tenant was originally created. - * Constraints: The maximum length is `36` characters. The minimum length is `1` character. The value must match regular expression `/[0-9,:,.,-,T,Z]/`. -* `updated_at` - (String) time stamp the tenant was last updated. - * Constraints: The maximum length is `36` characters. The minimum length is `1` character. The value must match regular expression `/[0-9,:,.,-,T,Z]/`. - -## Import - -You can import the `ibm_logs_router_tenant` resource by using `id`. Unique ID of the created instance. - -# Syntax -
-$ terraform import ibm_logs_router_tenant.logs_router_tenant <id>
-
- -# Example -``` -$ terraform import ibm_logs_router_tenant.logs_router_tenant aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa -``` From add6e8c723fd81a594d2dd7449e4c97cff5d8f04 Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Sun, 10 Dec 2023 20:51:14 -0600 Subject: [PATCH 095/132] Update pi_user_data to accept string input (#4974) * Add string support for pi_user_data field in instance creation * Add new user data test * Updated pi_user_data documentation * Remove duplicate import --- ibm/service/power/resource_ibm_pi_instance.go | 23 +++---- .../power/resource_ibm_pi_instance_test.go | 60 +++++++++++++++++++ website/docs/r/pi_instance.html.markdown | 2 +- 3 files changed, 68 insertions(+), 17 deletions(-) diff --git a/ibm/service/power/resource_ibm_pi_instance.go b/ibm/service/power/resource_ibm_pi_instance.go index 0a5a760803..610bf44813 100644 --- a/ibm/service/power/resource_ibm_pi_instance.go +++ b/ibm/service/power/resource_ibm_pi_instance.go @@ -856,12 +856,13 @@ func isPIInstanceRefreshFunc(client *st.IBMPIInstanceClient, id, instanceReadySt } } -func checkBase64(input string) error { - _, err := base64.StdEncoding.DecodeString(input) +// This function takes the input string and encodes into base64 if isn't already encoded +func encodeBase64(userData string) string { + _, err := base64.StdEncoding.DecodeString(userData) if err != nil { - return fmt.Errorf("failed to check if input is base64 %s", err) + return base64.StdEncoding.EncodeToString([]byte(userData)) } - return err + return userData } func isWaitForPIInstanceStopped(ctx context.Context, client *st.IBMPIInstanceClient, id string) (interface{}, error) { @@ -1081,12 +1082,7 @@ func createSAPInstance(d *schema.ResourceData, sapClient *st.IBMPISAPInstanceCli } if u, ok := d.GetOk(helpers.PIInstanceUserData); ok { userData := u.(string) - err := checkBase64(userData) - if err != nil { - log.Printf("Data is not base64 encoded") - return nil, err - } - body.UserData = userData + body.UserData = encodeBase64(userData) } if sys, ok := d.GetOk(helpers.PIInstanceSystemType); ok { body.SysType = sys.(string) @@ -1205,11 +1201,6 @@ func createPVMInstance(d *schema.ResourceData, client *st.IBMPIInstanceClient, i if u, ok := d.GetOk(helpers.PIInstanceUserData); ok { userData = u.(string) } - err := checkBase64(userData) - if err != nil { - log.Printf("Data is not base64 encoded") - return nil, err - } //publicinterface := d.Get(helpers.PIInstancePublicNetwork).(bool) body := &models.PVMInstanceCreate{ @@ -1221,7 +1212,7 @@ func createPVMInstance(d *schema.ResourceData, client *st.IBMPIInstanceClient, i ImageID: flex.PtrToString(imageid), ProcType: flex.PtrToString(processortype), Replicants: replicants, - UserData: userData, + UserData: encodeBase64(userData), ReplicantNamingScheme: flex.PtrToString(replicationNamingScheme), ReplicantAffinityPolicy: flex.PtrToString(replicationpolicy), Networks: pvmNetworks, diff --git a/ibm/service/power/resource_ibm_pi_instance_test.go b/ibm/service/power/resource_ibm_pi_instance_test.go index f6dbf5fba2..9e5555fadd 100644 --- a/ibm/service/power/resource_ibm_pi_instance_test.go +++ b/ibm/service/power/resource_ibm_pi_instance_test.go @@ -62,6 +62,47 @@ func testAccCheckIBMPIInstanceConfig(name, instanceHealthStatus string) string { `, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name, instanceHealthStatus) } +func testAccCheckIBMPIInstanceUserDataConfig(name, instanceHealthStatus string) string { + return fmt.Sprintf(` + resource "ibm_pi_key" "key" { + pi_cloud_instance_id = "%[1]s" + pi_key_name = "%[2]s" + pi_ssh_key = "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEArb2aK0mekAdbYdY9rwcmeNSxqVCwez3WZTYEq+1Nwju0x5/vQFPSD2Kp9LpKBbxx3OVLN4VffgGUJznz9DAr7veLkWaf3iwEil6U4rdrhBo32TuDtoBwiczkZ9gn1uJzfIaCJAJdnO80Kv9k0smbQFq5CSb9H+F5VGyFue/iVd5/b30MLYFAz6Jg1GGWgw8yzA4Gq+nO7HtyuA2FnvXdNA3yK/NmrTiPCdJAtEPZkGu9LcelkQ8y90ArlKfjtfzGzYDE4WhOufFxyWxciUePh425J2eZvElnXSdGha+FCfYjQcvqpCVoBAG70U4fJBGjB+HL/GpCXLyiYXPrSnzC9w==" + } + data "ibm_pi_image" "power_image" { + pi_image_name = "%[3]s" + pi_cloud_instance_id = "%[1]s" + } + data "ibm_pi_network" "power_networks" { + pi_cloud_instance_id = "%[1]s" + pi_network_name = "%[4]s" + } + resource "ibm_pi_volume" "power_volume" { + pi_volume_size = 20 + pi_volume_name = "%[2]s" + pi_volume_shareable = true + pi_volume_pool = data.ibm_pi_image.power_image.storage_pool + pi_cloud_instance_id = "%[1]s" + } + resource "ibm_pi_instance" "power_instance" { + pi_memory = "2" + pi_processors = "0.25" + pi_instance_name = "%[2]s" + pi_proc_type = "shared" + pi_image_id = data.ibm_pi_image.power_image.id + pi_sys_type = "s922" + pi_cloud_instance_id = "%[1]s" + pi_storage_pool = data.ibm_pi_image.power_image.storage_pool + pi_health_status = "%[5]s" + pi_volume_ids = [ibm_pi_volume.power_volume.volume_id] + pi_network { + network_id = data.ibm_pi_network.power_networks.id + } + pi_user_data = "this is test user data" + } + `, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name, instanceHealthStatus) +} + func testAccCheckIBMPIInstanceDeploymentTypeConfig(name, instanceHealthStatus string) string { return fmt.Sprintf(` resource "ibm_pi_key" "key" { @@ -238,6 +279,25 @@ func TestAccIBMPIInstanceBasic(t *testing.T) { }) } +func TestAccIBMPIInstanceUserData(t *testing.T) { + instanceRes := "ibm_pi_instance.power_instance" + name := fmt.Sprintf("tf-pi-instance-%d", acctest.RandIntRange(10, 100)) + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMPIInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMPIInstanceUserDataConfig(name, helpers.PIInstanceHealthWarning), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMPIInstanceExists(instanceRes), + resource.TestCheckResourceAttr(instanceRes, "pi_instance_name", name), + ), + }, + }, + }) +} + func TestAccIBMPIInstanceDeploymentType(t *testing.T) { instanceRes := "ibm_pi_instance.power_instance" name := fmt.Sprintf("tf-pi-instance-%d", acctest.RandIntRange(10, 100)) diff --git a/website/docs/r/pi_instance.html.markdown b/website/docs/r/pi_instance.html.markdown index 6a5e2234a9..1001d49f34 100644 --- a/website/docs/r/pi_instance.html.markdown +++ b/website/docs/r/pi_instance.html.markdown @@ -99,7 +99,7 @@ Review the argument references that you can specify for your resource. - `pi_storage_connection` - (Optional, String) - Storage Connectivity Group (SCG) for server deployment. Only supported value is `vSCSI`. - `pi_sys_type` - (Optional, String) The type of system on which to create the VM (s922/e880/e980/s1022). - Supported SAP system types are (e880/e980). -- `pi_user_data` - (Optional, String) The base64 encoded form of the user data `cloud-init` to pass to the instance during creation. +- `pi_user_data` - (Optional, String) The user data `cloud-init` to pass to the instance during creation. It can be a base64 encoded or an unencoded string. If it is an unencoded string, the provider will encode it before it passing it down. - `pi_virtual_cores_assigned` - (Optional, Integer) Specify the number of virtual cores to be assigned. - `pi_volume_ids` - (Optional, List of String) The list of volume IDs that you want to attach to the instance during creation. ## Attribute reference From d05f916950f1bb9d102b30e896a97d975e1a1af8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:34:30 +0000 Subject: [PATCH 096/132] dependabot: bump actions/setup-go from 4 to 5 Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/go.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 7cb93f42ef..2fd6abc9a2 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Set up Go 1.x - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ^1.18 id: go diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d727809c5a..15f3a980ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: run: git fetch --prune --unshallow - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: 1.18 - From d7a06110981f4f53d22cb215d9faef31d06afe74 Mon Sep 17 00:00:00 2001 From: Justin Kanz Date: Mon, 11 Dec 2023 12:02:43 -0500 Subject: [PATCH 097/132] new host link endpoint commits (#4970) * new host link endpoint commits * add host link agent argument and example. Fixed RHEL7 repos to RHEL8 --------- Co-authored-by: Justin Kanz --- go.mod | 2 +- go.sum | 2 ++ .../data_source_ibm_satellite_host_script.go | 11 ++++++++++ ...a_source_ibm_satellite_host_script_test.go | 2 ++ ...satellite_attach_host_script.html.markdown | 22 ++++++++++--------- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 4c06cd1d1d..55322cd7a7 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc - github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c + github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231116055201-2a84da7b9bd6 github.com/IBM-Cloud/power-go-client v1.5.4 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca github.com/IBM/appconfiguration-go-admin-sdk v0.3.0 diff --git a/go.sum b/go.sum index e9de9e3543..30e5ffdf8e 100644 --- a/go.sum +++ b/go.sum @@ -104,6 +104,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc h1:AeooCa6UMW github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc/go.mod h1:jIGLnIfj+uBv2ALz3rVHzNbNwt0V/bEWNeJKECa8Q+k= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c h1:tRS4VuOG3lHNG+yrsh3vZZQDVNLuFJB0oZbTJp9YXds= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= +github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231116055201-2a84da7b9bd6 h1:QXU1Atl/JSI3ZtYB9tHbWLhrFYE1E+5Iww1sjQ7mqdo= +github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231116055201-2a84da7b9bd6/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs= github.com/IBM-Cloud/power-go-client v1.5.4 h1:fk+QgOdZvwq696UynehfGrMGMHXDYOJfRCE3Pec9o6c= github.com/IBM-Cloud/power-go-client v1.5.4/go.mod h1:ZsKqKC4d4MAWujkttW1w9tG7xjlIbkIpVENX476ghVY= diff --git a/ibm/service/satellite/data_source_ibm_satellite_host_script.go b/ibm/service/satellite/data_source_ibm_satellite_host_script.go index 069f1f60e5..48ac821502 100644 --- a/ibm/service/satellite/data_source_ibm_satellite_host_script.go +++ b/ibm/service/satellite/data_source_ibm_satellite_host_script.go @@ -74,6 +74,11 @@ func DataSourceIBMSatelliteAttachHostScript() *schema.Resource { Optional: true, ExactlyOneOf: []string{"host_provider", "custom_script"}, }, + "host_link_agent_endpoint": { + Description: "The satellite link agent endpoint, required for reduced firewall attach script", + Type: schema.TypeString, + Optional: true, + }, }, } } @@ -155,6 +160,12 @@ func dataSourceIBMSatelliteAttachHostScriptRead(d *schema.ResourceData, meta int scriptPath = filepath.Join(scriptDir, "addHost.sh") } + // If the user supplied link agent endpoint, use reduced firewall attach script + if hlae, ok := d.GetOk("host_link_agent_endpoint"); ok { + host_link_agent_endpoint := hlae.(string) + createRegOptions.HostLinkAgentEndpoint = &host_link_agent_endpoint + } + resp, err := satClient.AttachSatelliteHost(createRegOptions) if err != nil { return fmt.Errorf("[ERROR] Error Generating Satellite Registration Script: %s\n%s", err, resp) diff --git a/ibm/service/satellite/data_source_ibm_satellite_host_script_test.go b/ibm/service/satellite/data_source_ibm_satellite_host_script_test.go index 6d3a98709f..9c09d5a5a8 100644 --- a/ibm/service/satellite/data_source_ibm_satellite_host_script_test.go +++ b/ibm/service/satellite/data_source_ibm_satellite_host_script_test.go @@ -55,6 +55,7 @@ func TestAccIBMSatelliteAttachHostScriptDataSourceBasicCoreos(t *testing.T) { Config: testAccCheckIBMSatelliteAttachHostScriptDataSourceConfigCoreos(locationName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.ibm_satellite_attach_host_script.script", "host_provider", "ibm"), + resource.TestCheckResourceAttr("data.ibm_satellite_attach_host_script.script", "host_link_agent_endpoint", "testendpoint"), ), }, }, @@ -75,5 +76,6 @@ data "ibm_satellite_attach_host_script" "script" { labels = ["env:prod"] coreos_host = true host_provider = "ibm" + host_link_agent_endpoint = "testendpoint" }`, locationName) } diff --git a/website/docs/d/satellite_attach_host_script.html.markdown b/website/docs/d/satellite_attach_host_script.html.markdown index 824f177ec9..e578670ec5 100644 --- a/website/docs/d/satellite_attach_host_script.html.markdown +++ b/website/docs/d/satellite_attach_host_script.html.markdown @@ -21,14 +21,15 @@ data "ibm_satellite_attach_host_script" "script" { } ``` -### Sample to read satellite host script to attach AWS EC2 host to Satellite control plane +### Sample to read satellite host script to attach AWS EC2 host to Satellite control plane and uses reduced firewall requirements. ```terraform data "ibm_satellite_attach_host_script" "script" { - location = var.location - labels = var.labels - script_dir = "/tmp" - host_provider = "aws" + location = var.location + labels = var.labels + script_dir = "/tmp" + host_provider = "aws" + host_link_agent_endpoint = "c-01-ws.us-south.link.satellite.cloud.ibm.com" } ``` ### Sample to read satellite host script to attach IBM host to Satellite control plane @@ -38,11 +39,11 @@ data "ibm_satellite_attach_host_script" "script" { location = var.location custom_script = < Date: Tue, 12 Dec 2023 10:29:47 -0600 Subject: [PATCH 098/132] Add mtu and accessConfig flags to subnet create commands for terraform (#4690) * Add mtu and accessConfig flags to subnet create commands for terraform * Fix terraform compile errors * Fix terraform compile error from yaml changes * Clean up warnings in powervs provider * Fix bug checking region instead of zone for satellite check * Hide shared processor pool and IBMi license arguments from being set in satellite location * Fix typing issues in MTU and access config Three issues here: - There is no schema.TypeInt64, so I have to set this field to schema.TypeInt. Pretend this value is an int and then cast it back to an int64. This an issue with the terraform sdk. - I accidentally set schema.Int on access config where it should be schema.TypeString - All passed in variables by the user need to be set or else the sdk and/or service broker can't safeguard against bad values correctly * Update new network field satellite documentation * Revert nullable name change Due to incompatibility between to the two service brokers, this change has to be undone to maintain consistency. * Update go mod files for new sdk version * Add satellite network acceptance test * Update mtu and jumbo descriptions * Add access-config validation to terraform --- .../data_source_ibm_pi_catalog_images.go | 14 +++--- .../power/data_source_ibm_pi_instance.go | 4 -- .../power/data_source_ibm_pi_network.go | 12 ++++- ibm/service/power/resource_ibm_pi_network.go | 33 ++++++++++-- .../power/resource_ibm_pi_network_port.go | 2 +- .../power/resource_ibm_pi_network_test.go | 50 +++++++++++++++++++ website/docs/d/pi_network.html.markdown | 4 +- website/docs/r/pi_network.html.markdown | 4 +- 8 files changed, 103 insertions(+), 20 deletions(-) diff --git a/ibm/service/power/data_source_ibm_pi_catalog_images.go b/ibm/service/power/data_source_ibm_pi_catalog_images.go index eb505ac070..62adf75a8e 100644 --- a/ibm/service/power/data_source_ibm_pi_catalog_images.go +++ b/ibm/service/power/data_source_ibm_pi_catalog_images.go @@ -163,25 +163,25 @@ func dataSourceIBMPICatalogImagesRead(ctx context.Context, d *schema.ResourceDat } if i.Specifications != nil { s := i.Specifications - if &s.ImageType != nil { + if s.ImageType != "" { image["image_type"] = s.ImageType } - if &s.ContainerFormat != nil { + if s.ContainerFormat != "" { image["container_format"] = s.ContainerFormat } - if &s.DiskFormat != nil { + if s.DiskFormat != "" { image["disk_format"] = s.DiskFormat } - if &s.OperatingSystem != nil { + if s.OperatingSystem != "" { image["operating_system"] = s.OperatingSystem } - if &s.HypervisorType != nil { + if s.HypervisorType != "" { image["hypervisor_type"] = s.HypervisorType } - if &s.Architecture != nil { + if s.Architecture != "" { image["architecture"] = s.Architecture } - if &s.Endianness != nil { + if s.Endianness != "" { image["endianness"] = s.Endianness } } diff --git a/ibm/service/power/data_source_ibm_pi_instance.go b/ibm/service/power/data_source_ibm_pi_instance.go index f6dd4d2d9b..354cfe951b 100644 --- a/ibm/service/power/data_source_ibm_pi_instance.go +++ b/ibm/service/power/data_source_ibm_pi_instance.go @@ -246,7 +246,6 @@ func dataSourceIBMPIInstancesRead(ctx context.Context, d *schema.ResourceData, m if powervmdata.Addresses != nil { pvmaddress := make([]map[string]interface{}, len(powervmdata.Addresses)) for i, pvmip := range powervmdata.Addresses { - p := make(map[string]interface{}) p["ip"] = pvmip.IPAddress p["network_name"] = pvmip.NetworkName @@ -257,13 +256,10 @@ func dataSourceIBMPIInstancesRead(ctx context.Context, d *schema.ResourceData, m pvmaddress[i] = p } d.Set("addresses", pvmaddress) - } if powervmdata.Health != nil { - d.Set("health_status", powervmdata.Health.Status) - } return nil diff --git a/ibm/service/power/data_source_ibm_pi_network.go b/ibm/service/power/data_source_ibm_pi_network.go index a080f5a022..3a04453ca7 100644 --- a/ibm/service/power/data_source_ibm_pi_network.go +++ b/ibm/service/power/data_source_ibm_pi_network.go @@ -39,12 +39,10 @@ func DataSourceIBMPINetwork() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "type": { Type: schema.TypeString, Computed: true, }, - "vlan_id": { Type: schema.TypeInt, Computed: true, @@ -79,6 +77,14 @@ func DataSourceIBMPINetwork() *schema.Resource { Type: schema.TypeBool, Computed: true, }, + "mtu": { + Type: schema.TypeInt, + Computed: true, + }, + "access_config": { + Type: schema.TypeString, + Computed: true, + }, }, } } @@ -124,6 +130,8 @@ func dataSourceIBMPINetworkRead(ctx context.Context, d *schema.ResourceData, met d.Set("dns", networkdata.DNSServers) } d.Set("jumbo", networkdata.Jumbo) + d.Set("mtu", networkdata.Mtu) + d.Set("access_config", networkdata.AccessConfig) return nil diff --git a/ibm/service/power/resource_ibm_pi_network.go b/ibm/service/power/resource_ibm_pi_network.go index 113e5f9176..49e85d9aa5 100644 --- a/ibm/service/power/resource_ibm_pi_network.go +++ b/ibm/service/power/resource_ibm_pi_network.go @@ -75,10 +75,26 @@ func ResourceIBMPINetwork() *schema.Resource { Description: "PI network gateway", }, helpers.PINetworkJumbo: { - Type: schema.TypeBool, - Optional: true, - Computed: true, - Description: "PI network enable MTU Jumbo option", + Type: schema.TypeBool, + Optional: true, + Computed: true, + Deprecated: "deprecated use pi_network_mtu instead", + ExactlyOneOf: []string{helpers.PINetworkMtu, helpers.PINetworkJumbo}, + Description: "PI network enable MTU Jumbo option", + }, + helpers.PINetworkMtu: { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ExactlyOneOf: []string{helpers.PINetworkMtu, helpers.PINetworkJumbo}, + Description: "PI Maximum Transmission Unit", + }, + helpers.PINetworkAccessConfig: { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validate.ValidateAllowedStringValues([]string{"internal-only", "outbound-only", "bidirectional-static-route", "bidirectional-bgp", "bidirectional-l2out"}), + Description: "PI network communication configuration", }, helpers.PICloudInstanceId: { Type: schema.TypeString, @@ -145,6 +161,13 @@ func resourceIBMPINetworkCreate(ctx context.Context, d *schema.ResourceData, met if v, ok := d.GetOk(helpers.PINetworkJumbo); ok { body.Jumbo = v.(bool) } + if v, ok := d.GetOk(helpers.PINetworkMtu); ok { + var mtu int64 = int64(v.(int)) + body.Mtu = &mtu + } + if v, ok := d.GetOk(helpers.PINetworkAccessConfig); ok { + body.AccessConfig = models.AccessConfig(v.(string)) + } if networktype == "vlan" { var networkcidr string @@ -216,6 +239,8 @@ func resourceIBMPINetworkRead(ctx context.Context, d *schema.ResourceData, meta d.Set(helpers.PINetworkName, networkdata.Name) d.Set(helpers.PINetworkType, networkdata.Type) d.Set(helpers.PINetworkJumbo, networkdata.Jumbo) + d.Set(helpers.PINetworkMtu, networkdata.Mtu) + d.Set(helpers.PINetworkAccessConfig, networkdata.AccessConfig) d.Set(helpers.PINetworkGateway, networkdata.Gateway) ipRangesMap := []map[string]interface{}{} if networkdata.IPAddressRanges != nil { diff --git a/ibm/service/power/resource_ibm_pi_network_port.go b/ibm/service/power/resource_ibm_pi_network_port.go index 703686eb0b..6b1ffb0cf7 100644 --- a/ibm/service/power/resource_ibm_pi_network_port.go +++ b/ibm/service/power/resource_ibm_pi_network_port.go @@ -200,7 +200,7 @@ func isIBMPINetworkPortRefreshFunc(client *st.IBMPINetworkClient, id, networknam return nil, "", err } - if &network.PortID != nil { + if network.PortID != nil { //if network.State == "available" { log.Printf(" The port has been created with the following ip address and attached to an instance ") return network, "DOWN", nil diff --git a/ibm/service/power/resource_ibm_pi_network_test.go b/ibm/service/power/resource_ibm_pi_network_test.go index 517bf87118..249ce65615 100644 --- a/ibm/service/power/resource_ibm_pi_network_test.go +++ b/ibm/service/power/resource_ibm_pi_network_test.go @@ -88,6 +88,43 @@ func TestAccIBMPINetworkGatewaybasic(t *testing.T) { }, }) } + +func TestAccIBMPINetworkGatewaybasicSatellite(t *testing.T) { + name := fmt.Sprintf("tf-pi-network-%d", acctest.RandIntRange(10, 100)) + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMPINetworkDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMPINetworkGatewayConfigSatellite(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMPINetworkExists("ibm_pi_network.power_networks"), + resource.TestCheckResourceAttr( + "ibm_pi_network.power_networks", "pi_network_name", name), + resource.TestCheckResourceAttrSet("ibm_pi_network.power_networks", "pi_gateway"), + resource.TestCheckResourceAttrSet("ibm_pi_network.power_networks", "id"), + resource.TestCheckResourceAttrSet("ibm_pi_network.power_networks", "pi_ipaddress_range.#"), + ), + }, + { + Config: testAccCheckIBMPINetworkConfigGatewayUpdateDNS(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMPINetworkExists("ibm_pi_network.power_networks"), + resource.TestCheckResourceAttr( + "ibm_pi_network.power_networks", "pi_network_name", name), + resource.TestCheckResourceAttr( + "ibm_pi_network.power_networks", "pi_gateway", "192.168.17.2"), + resource.TestCheckResourceAttr( + "ibm_pi_network.power_networks", "pi_ipaddress_range.0.pi_ending_ip_address", "192.168.17.254"), + resource.TestCheckResourceAttr( + "ibm_pi_network.power_networks", "pi_ipaddress_range.0.pi_starting_ip_address", "192.168.17.3"), + ), + }, + }, + }) +} + func testAccCheckIBMPINetworkDestroy(s *terraform.State) error { sess, err := acc.TestAccProvider.Meta().(conns.ClientSession).IBMPISession() @@ -190,3 +227,16 @@ func testAccCheckIBMPINetworkConfigGatewayUpdateDNS(name string) string { } `, acc.Pi_cloud_instance_id, name) } + +func testAccCheckIBMPINetworkGatewayConfigSatellite(name string) string { + return fmt.Sprintf(` + resource "ibm_pi_network" "power_networks" { + pi_cloud_instance_id = "%s" + pi_network_name = "%s" + pi_network_type = "vlan" + pi_cidr = "192.168.17.0/24" + pi_network_mtu = 6500 + pi_network_access_config = "outbound-only" + } + `, acc.Pi_cloud_instance_id, name) +} diff --git a/website/docs/d/pi_network.html.markdown b/website/docs/d/pi_network.html.markdown index eea249a557..c4f03cb824 100644 --- a/website/docs/d/pi_network.html.markdown +++ b/website/docs/d/pi_network.html.markdown @@ -53,4 +53,6 @@ In addition to all argument reference list, you can access the following attribu - `used_ip_count` - (Float) The number of used IP addresses. - `used_ip_percent` - (Float) The percentage of IP addresses used. - `vlan_id` - (String) The VLAN ID that the network is connected to. -- `jumbo` - (Bool) MTU Jumbo option of the network. +- `jumbo` - (Bool) MTU Jumbo option of the network (for multi-zone locations only). `deprecated` +- `mtu` - (Bool) Maximum Transmission Unit option of the network. +- `access_config` - (String) The network communication configuration option of the network (for satellite locations only). \ No newline at end of file diff --git a/website/docs/r/pi_network.html.markdown b/website/docs/r/pi_network.html.markdown index 23da3c3de9..4abefe7694 100644 --- a/website/docs/r/pi_network.html.markdown +++ b/website/docs/r/pi_network.html.markdown @@ -69,7 +69,9 @@ Review the argument references that you can specify for your resource. The `pi_ipaddress_range` block supports: - `pi_ending_ip_address` - (Required, String) The ending ip address. - `pi_starting_ip_address` - (Required, String) The staring ip address. **Note** if the `pi_gateway` or `pi_ipaddress_range` is not provided, it will calculate the value based on CIDR respectively. -- `pi_network_jumbo` - (Optional, Bool) MTU Jumbo option of the network. +- `pi_network_jumbo` - (Optional, Bool) MTU Jumbo option of the network (for multi-zone locations only). `deprecated` use `pi_network_mtu` instead. +- `pi_network_mtu` - (Optional, Integer) Maximum Transmission Unit option of the network, min size = 1450 & max size = 9000. +- `pi_network_access_config` - (Optional, String) The network communication configuration option of the network (for satellite locations only). ## Attribute reference From 6aa6b14b7ad290306f3aec04adf8442341dee8a0 Mon Sep 17 00:00:00 2001 From: Shuaib Bapputty Date: Tue, 12 Dec 2023 12:08:16 +0530 Subject: [PATCH 099/132] feat: add new service mqcloud --- examples/ibm-mqcloud/README.md | 175 ++++++++ examples/ibm-mqcloud/main.tf | 103 +++++ examples/ibm-mqcloud/outputs.tf | 30 ++ examples/ibm-mqcloud/variables.tf | 203 +++++++++ examples/ibm-mqcloud/versions.tf | 9 + go.mod | 48 +- go.sum | 160 +++---- ibm/acctest/acctest.go | 42 ++ ibm/conns/config.go | 40 ++ ibm/provider/provider.go | 23 + ibm/service/mqcloud/README.md | 11 + .../data_source_ibm_mqcloud_application.go | 167 +++++++ ...ata_source_ibm_mqcloud_application_test.go | 87 ++++ ...source_ibm_mqcloud_keystore_certificate.go | 223 ++++++++++ ...e_ibm_mqcloud_keystore_certificate_test.go | 107 +++++ .../data_source_ibm_mqcloud_queue_manager.go | 232 ++++++++++ ...source_ibm_mqcloud_queue_manager_status.go | 77 ++++ ...e_ibm_mqcloud_queue_manager_status_test.go | 44 ++ ...a_source_ibm_mqcloud_queue_manager_test.go | 114 +++++ ...urce_ibm_mqcloud_truststore_certificate.go | 208 +++++++++ ...ibm_mqcloud_truststore_certificate_test.go | 106 +++++ .../mqcloud/data_source_ibm_mqcloud_user.go | 166 +++++++ .../data_source_ibm_mqcloud_user_test.go | 93 ++++ .../resource_ibm_mqcloud_application.go | 188 ++++++++ .../resource_ibm_mqcloud_application_test.go | 150 +++++++ ...source_ibm_mqcloud_keystore_certificate.go | 314 +++++++++++++ ...e_ibm_mqcloud_keystore_certificate_test.go | 163 +++++++ .../resource_ibm_mqcloud_queue_manager.go | 415 ++++++++++++++++++ ...resource_ibm_mqcloud_queue_manager_test.go | 182 ++++++++ ...urce_ibm_mqcloud_truststore_certificate.go | 297 +++++++++++++ ...ibm_mqcloud_truststore_certificate_test.go | 163 +++++++ .../mqcloud/resource_ibm_mqcloud_user.go | 196 +++++++++ .../mqcloud/resource_ibm_mqcloud_user_test.go | 157 +++++++ ibm/service/mqcloud/utils.go | 196 +++++++++ website/allowed-subcategories.txt | 1 + .../docs/d/mqcloud_application.html.markdown | 44 ++ ...mqcloud_keystore_certificate.html.markdown | 63 +++ .../d/mqcloud_queue_manager.html.markdown | 60 +++ ...mqcloud_queue_manager_status.html.markdown | 38 ++ ...cloud_truststore_certificate.html.markdown | 60 +++ website/docs/d/mqcloud_user.html.markdown | 46 ++ .../guides/custom-service-endpoints.html.md | 13 +- .../docs/r/mqcloud_application.html.markdown | 55 +++ ...mqcloud_keystore_certificate.html.markdown | 73 +++ .../r/mqcloud_queue_manager.html.markdown | 74 ++++ ...cloud_truststore_certificate.html.markdown | 70 +++ website/docs/r/mqcloud_user.html.markdown | 57 +++ 47 files changed, 5426 insertions(+), 117 deletions(-) create mode 100644 examples/ibm-mqcloud/README.md create mode 100644 examples/ibm-mqcloud/main.tf create mode 100644 examples/ibm-mqcloud/outputs.tf create mode 100644 examples/ibm-mqcloud/variables.tf create mode 100644 examples/ibm-mqcloud/versions.tf create mode 100644 ibm/service/mqcloud/README.md create mode 100644 ibm/service/mqcloud/data_source_ibm_mqcloud_application.go create mode 100644 ibm/service/mqcloud/data_source_ibm_mqcloud_application_test.go create mode 100644 ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate.go create mode 100644 ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate_test.go create mode 100644 ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager.go create mode 100644 ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_status.go create mode 100644 ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_status_test.go create mode 100644 ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_test.go create mode 100644 ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate.go create mode 100644 ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate_test.go create mode 100644 ibm/service/mqcloud/data_source_ibm_mqcloud_user.go create mode 100644 ibm/service/mqcloud/data_source_ibm_mqcloud_user_test.go create mode 100644 ibm/service/mqcloud/resource_ibm_mqcloud_application.go create mode 100644 ibm/service/mqcloud/resource_ibm_mqcloud_application_test.go create mode 100644 ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate.go create mode 100644 ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate_test.go create mode 100644 ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager.go create mode 100644 ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager_test.go create mode 100644 ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate.go create mode 100644 ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate_test.go create mode 100644 ibm/service/mqcloud/resource_ibm_mqcloud_user.go create mode 100644 ibm/service/mqcloud/resource_ibm_mqcloud_user_test.go create mode 100644 ibm/service/mqcloud/utils.go create mode 100644 website/docs/d/mqcloud_application.html.markdown create mode 100644 website/docs/d/mqcloud_keystore_certificate.html.markdown create mode 100644 website/docs/d/mqcloud_queue_manager.html.markdown create mode 100644 website/docs/d/mqcloud_queue_manager_status.html.markdown create mode 100644 website/docs/d/mqcloud_truststore_certificate.html.markdown create mode 100644 website/docs/d/mqcloud_user.html.markdown create mode 100644 website/docs/r/mqcloud_application.html.markdown create mode 100644 website/docs/r/mqcloud_keystore_certificate.html.markdown create mode 100644 website/docs/r/mqcloud_queue_manager.html.markdown create mode 100644 website/docs/r/mqcloud_truststore_certificate.html.markdown create mode 100644 website/docs/r/mqcloud_user.html.markdown diff --git a/examples/ibm-mqcloud/README.md b/examples/ibm-mqcloud/README.md new file mode 100644 index 0000000000..ae8ef2a8dd --- /dev/null +++ b/examples/ibm-mqcloud/README.md @@ -0,0 +1,175 @@ +# Example for MqcloudV1 + +This example illustrates how to use the MqcloudV1 + +The following types of resources are supported: + +* mqcloud_queue_manager +* mqcloud_application +* mqcloud_user +* mqcloud_keystore_certificate +* mqcloud_truststore_certificate + +## Usage + +To run this example, execute the following commands: + +```bash +$ terraform init +$ terraform plan +$ terraform apply +``` + +Run `terraform destroy` when you don't need these resources. + + +## MqcloudV1 resources + +mqcloud_queue_manager resource: + +```hcl +resource "mqcloud_queue_manager" "mqcloud_queue_manager_instance" { + service_instance_guid = var.mqcloud_queue_manager_service_instance_guid + name = var.mqcloud_queue_manager_name + display_name = var.mqcloud_queue_manager_display_name + location = var.mqcloud_queue_manager_location + size = var.mqcloud_queue_manager_size + version = var.mqcloud_queue_manager_version +} +``` +mqcloud_application resource: + +```hcl +resource "mqcloud_application" "mqcloud_application_instance" { + service_instance_guid = var.mqcloud_application_service_instance_guid + name = var.mqcloud_application_name +} +``` +mqcloud_user resource: + +```hcl +resource "mqcloud_user" "mqcloud_user_instance" { + service_instance_guid = var.mqcloud_user_service_instance_guid + name = var.mqcloud_user_name + email = var.mqcloud_user_email +} +``` +mqcloud_keystore_certificate resource: + +```hcl +resource "mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { + service_instance_guid = var.mqcloud_keystore_certificate_service_instance_guid + queue_manager_id = var.mqcloud_keystore_certificate_queue_manager_id + label = var.mqcloud_keystore_certificate_label +} +``` +mqcloud_truststore_certificate resource: + +```hcl +resource "mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { + service_instance_guid = var.mqcloud_truststore_certificate_service_instance_guid + queue_manager_id = var.mqcloud_truststore_certificate_queue_manager_id + label = var.mqcloud_truststore_certificate_label +} +``` + +## MqcloudV1 data sources + +mqcloud_queue_manager data source: + +```hcl +data "mqcloud_queue_manager" "mqcloud_queue_manager_instance" { + service_instance_guid = var.mqcloud_queue_manager_service_instance_guid + name = var.mqcloud_queue_manager_name +} +``` +mqcloud_queue_manager_status data source: + +```hcl +data "mqcloud_queue_manager_status" "mqcloud_queue_manager_status_instance" { + service_instance_guid = var.mqcloud_queue_manager_status_service_instance_guid + queue_manager_id = var.mqcloud_queue_manager_status_queue_manager_id +} +``` +mqcloud_application data source: + +```hcl +data "mqcloud_application" "mqcloud_application_instance" { + service_instance_guid = var.mqcloud_application_service_instance_guid + name = var.mqcloud_application_name +} +``` +mqcloud_user data source: + +```hcl +data "mqcloud_user" "mqcloud_user_instance" { + service_instance_guid = var.mqcloud_user_service_instance_guid + name = var.mqcloud_user_name +} +``` +mqcloud_truststore_certificate data source: + +```hcl +data "mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { + service_instance_guid = var.mqcloud_truststore_certificate_service_instance_guid + queue_manager_id = var.mqcloud_truststore_certificate_queue_manager_id + label = var.mqcloud_truststore_certificate_label +} +``` +mqcloud_keystore_certificate data source: + +```hcl +data "mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { + service_instance_guid = var.mqcloud_keystore_certificate_service_instance_guid + queue_manager_id = var.mqcloud_keystore_certificate_queue_manager_id + label = var.mqcloud_keystore_certificate_label +} +``` + +## Assumptions + +1. TODO + +## Notes + +1. TODO + +## Requirements + +| Name | Version | +|------|---------| +| terraform | ~> 0.12 | + +## Providers + +| Name | Version | +|------|---------| +| ibm | 1.13.1 | + +## Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | +| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true | +| name | A queue manager name conforming to MQ restrictions. | `string` | true | +| display_name | A displayable name for the queue manager - limited only in length. | `string` | false | +| location | The locations in which the queue manager could be deployed. | `string` | true | +| size | The queue manager sizes of deployment available. Deployment of lite queue managers for aws_us_east_1 and aws_eu_west_1 locations is not available. | `string` | true | +| version | The MQ version of the queue manager. | `string` | false | +| name | The name of the application - conforming to MQ rules. | `string` | true | +| name | The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance. | `string` | true | +| email | The email of the user. | `string` | true | +| queue_manager_id | The id of the queue manager to retrieve its full details. | `string` | true | +| label | Certificate label in queue manager store. | `string` | true | + +## Outputs + +| Name | Description | +|------|-------------| +| mqcloud_queue_manager | mqcloud_queue_manager object | +| mqcloud_queue_manager_status | mqcloud_queue_manager_status object | +| mqcloud_application | mqcloud_application object | +| mqcloud_user | mqcloud_user object | +| mqcloud_truststore_certificate | mqcloud_truststore_certificate object | +| mqcloud_keystore_certificate | mqcloud_keystore_certificate object | diff --git a/examples/ibm-mqcloud/main.tf b/examples/ibm-mqcloud/main.tf new file mode 100644 index 0000000000..b89e08c72a --- /dev/null +++ b/examples/ibm-mqcloud/main.tf @@ -0,0 +1,103 @@ +provider "ibm" { + ibmcloud_api_key = var.ibmcloud_api_key +} + +// Provision mqcloud_queue_manager resource instance +resource "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" { + service_instance_guid = var.mqcloud_queue_manager_service_instance_guid + name = var.mqcloud_queue_manager_name + display_name = var.mqcloud_queue_manager_display_name + location = var.mqcloud_queue_manager_location + size = var.mqcloud_queue_manager_size + version = var.mqcloud_queue_manager_version +} + +// Provision mqcloud_application resource instance +resource "ibm_mqcloud_application" "mqcloud_application_instance" { + service_instance_guid = var.mqcloud_application_service_instance_guid + name = var.mqcloud_application_name +} + +// Provision mqcloud_user resource instance +resource "ibm_mqcloud_user" "mqcloud_user_instance" { + service_instance_guid = var.mqcloud_user_service_instance_guid + name = var.mqcloud_user_name + email = var.mqcloud_user_email +} + +// Provision mqcloud_keystore_certificate resource instance +resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { + service_instance_guid = var.mqcloud_keystore_certificate_service_instance_guid + queue_manager_id = var.mqcloud_keystore_certificate_queue_manager_id + label = var.mqcloud_keystore_certificate_label +} + +// Provision mqcloud_truststore_certificate resource instance +resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { + service_instance_guid = var.mqcloud_truststore_certificate_service_instance_guid + queue_manager_id = var.mqcloud_truststore_certificate_queue_manager_id + label = var.mqcloud_truststore_certificate_label +} + +// Data source is not linked to a resource instance +// Uncomment if an existing data source instance exists +/* +// Create mqcloud_queue_manager data source +data "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" { + service_instance_guid = var.mqcloud_queue_manager_service_instance_guid + + name = var.mqcloud_queue_manager_name +} +*/ + +// Data source is not linked to a resource instance +// Uncomment if an existing data source instance exists +/* +// Create mqcloud_queue_manager_status data source +data "ibm_mqcloud_queue_manager_status" "mqcloud_queue_manager_status_instance" { + service_instance_guid = var.mqcloud_queue_manager_status_service_instance_guid + queue_manager_id = var.mqcloud_queue_manager_status_queue_manager_id +} +*/ + +// Data source is not linked to a resource instance +// Uncomment if an existing data source instance exists +/* +// Create mqcloud_application data source +data "ibm_mqcloud_application" "mqcloud_application_instance" { + service_instance_guid = var.mqcloud_application_service_instance_guid + name = var.mqcloud_application_name +} +*/ + +// Data source is not linked to a resource instance +// Uncomment if an existing data source instance exists +/* +// Create mqcloud_user data source +data "ibm_mqcloud_user" "mqcloud_user_instance" { + service_instance_guid = var.mqcloud_user_service_instance_guid + name = var.mqcloud_user_name +} +*/ + +// Data source is not linked to a resource instance +// Uncomment if an existing data source instance exists +/* +// Create mqcloud_truststore_certificate data source +data "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { + service_instance_guid = var.mqcloud_truststore_certificate_service_instance_guid + queue_manager_id = var.mqcloud_truststore_certificate_queue_manager_id + label = var.mqcloud_truststore_certificate_label +} +*/ + +// Data source is not linked to a resource instance +// Uncomment if an existing data source instance exists +/* +// Create mqcloud_keystore_certificate data source +data "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { + service_instance_guid = var.mqcloud_keystore_certificate_service_instance_guid + queue_manager_id = var.mqcloud_keystore_certificate_queue_manager_id + label = var.mqcloud_keystore_certificate_label +} +*/ diff --git a/examples/ibm-mqcloud/outputs.tf b/examples/ibm-mqcloud/outputs.tf new file mode 100644 index 0000000000..ebd87da85e --- /dev/null +++ b/examples/ibm-mqcloud/outputs.tf @@ -0,0 +1,30 @@ +// This output allows mqcloud_queue_manager data to be referenced by other resources and the terraform CLI +// Modify this output if only certain data should be exposed +output "ibm_mqcloud_queue_manager" { + value = ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance + description = "mqcloud_queue_manager resource instance" +} +// This output allows mqcloud_application data to be referenced by other resources and the terraform CLI +// Modify this output if only certain data should be exposed +output "ibm_mqcloud_application" { + value = ibm_mqcloud_application.mqcloud_application_instance + description = "mqcloud_application resource instance" +} +// This output allows mqcloud_user data to be referenced by other resources and the terraform CLI +// Modify this output if only certain data should be exposed +output "ibm_mqcloud_user" { + value = ibm_mqcloud_user.mqcloud_user_instance + description = "mqcloud_user resource instance" +} +// This output allows mqcloud_keystore_certificate data to be referenced by other resources and the terraform CLI +// Modify this output if only certain data should be exposed +output "ibm_mqcloud_keystore_certificate" { + value = ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance + description = "mqcloud_keystore_certificate resource instance" +} +// This output allows mqcloud_truststore_certificate data to be referenced by other resources and the terraform CLI +// Modify this output if only certain data should be exposed +output "ibm_mqcloud_truststore_certificate" { + value = ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance + description = "mqcloud_truststore_certificate resource instance" +} diff --git a/examples/ibm-mqcloud/variables.tf b/examples/ibm-mqcloud/variables.tf new file mode 100644 index 0000000000..dba4d0fff0 --- /dev/null +++ b/examples/ibm-mqcloud/variables.tf @@ -0,0 +1,203 @@ +variable "ibmcloud_api_key" { + description = "IBM Cloud API key" + type = string +} + +// Resource arguments for mqcloud_queue_manager +variable "mqcloud_queue_manager_service_instance_guid" { + description = "The GUID that uniquely identifies the MQ on Cloud service instance." + type = string + default = "Service Instance ID" +} +variable "mqcloud_queue_manager_name" { + description = "A queue manager name conforming to MQ restrictions." + type = string + default = "testqm" +} +variable "mqcloud_queue_manager_display_name" { + description = "A displayable name for the queue manager - limited only in length." + type = string + default = "A test queue manager" +} +variable "mqcloud_queue_manager_location" { + description = "The locations in which the queue manager could be deployed." + type = string + default = "reserved-eu-fr-cluster-f884" +} +variable "mqcloud_queue_manager_size" { + description = "The queue manager sizes of deployment available. Deployment of lite queue managers for aws_us_east_1 and aws_eu_west_1 locations is not available." + type = string + default = "lite" +} +variable "mqcloud_queue_manager_version" { + description = "The MQ version of the queue manager." + type = string + default = "9.3.2_2" +} + +// Resource arguments for mqcloud_application +variable "mqcloud_application_service_instance_guid" { + description = "The GUID that uniquely identifies the MQ on Cloud service instance." + type = string + default = "Service Instance ID" +} +variable "mqcloud_application_name" { + description = "The name of the application - conforming to MQ rules." + type = string + default = "test-app" +} + +// Resource arguments for mqcloud_user +variable "mqcloud_user_service_instance_guid" { + description = "The GUID that uniquely identifies the MQ on Cloud service instance." + type = string + default = "Service Instance ID" +} + +// Data source arguments for mqcloud_application +variable "mqcloud_application_service_instance_guid" { + description = "The GUID that uniquely identifies the MQ on Cloud service instance." + type = string + default = "Service Instance ID" +} +variable "mqcloud_user_name" { + description = "The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance." + type = string + default = "name" +} + +variable "mqcloud_application_name" { + description = "The name of the application - conforming to MQ rules." + type = string + default = "name" +} +variable "mqcloud_user_name" { + description = "The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance." + type = string + default = "t0scie98o57a" +} +variable "mqcloud_user_email" { + description = "The email of the user." + type = string + default = "user@example.com" +} + +// Resource arguments for mqcloud_keystore_certificate +variable "mqcloud_keystore_certificate_service_instance_guid" { + description = "The GUID that uniquely identifies the MQ on Cloud service instance." + type = string + default = "Service Instance ID" +} +variable "mqcloud_keystore_certificate_queue_manager_id" { + description = "The id of the queue manager to retrieve its full details." + type = string + default = "Queue Manager ID" +} +variable "mqcloud_keystore_certificate_label" { + description = "Certificate label in queue manager store." + type = string + default = "label" +} + +// Resource arguments for mqcloud_truststore_certificate +variable "mqcloud_truststore_certificate_service_instance_guid" { + description = "The GUID that uniquely identifies the MQ on Cloud service instance." + type = string + default = "Service Instance ID" +} +variable "mqcloud_truststore_certificate_queue_manager_id" { + description = "The id of the queue manager to retrieve its full details." + type = string + default = "Queue Manager ID" +} + +variable "mqcloud_truststore_certificate_label" { + description = "Certificate label in queue manager store." + type = string + default = "label" +} + +// Data source arguments for mqcloud_queue_manager +variable "mqcloud_queue_manager_service_instance_guid" { + description = "The GUID that uniquely identifies the MQ on Cloud service instance." + type = string + default = "Service Instance ID" +} + +variable "mqcloud_queue_manager_name" { + description = "A queue manager name conforming to MQ restrictions." + type = string + default = "name" +} + +// Data source arguments for mqcloud_queue_manager_status +variable "mqcloud_queue_manager_status_service_instance_guid" { + description = "The GUID that uniquely identifies the MQ on Cloud service instance." + type = string + default = "Service Instance ID" +} +variable "mqcloud_queue_manager_status_queue_manager_id" { + description = "The id of the queue manager to retrieve its full details." + type = string + default = "Queue Manager ID" +} + +// Data source arguments for mqcloud_application +variable "mqcloud_application_service_instance_guid" { + description = "The GUID that uniquely identifies the MQ on Cloud service instance." + type = string + default = "Service Instance ID" +} + +variable "mqcloud_application_name" { + description = "The name of the application - conforming to MQ rules." + type = string + default = "name" +} + +// Data source arguments for mqcloud_user +variable "mqcloud_user_service_instance_guid" { + description = "The GUID that uniquely identifies the MQ on Cloud service instance." + type = string + default = "Service Instance ID" +} + +variable "mqcloud_user_name" { + description = "The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance." + type = string + default = "name" +} + +// Data source arguments for mqcloud_truststore_certificate +variable "mqcloud_truststore_certificate_service_instance_guid" { + description = "The GUID that uniquely identifies the MQ on Cloud service instance." + type = string + default = "Service Instance ID" +} +variable "mqcloud_truststore_certificate_queue_manager_id" { + description = "The id of the queue manager to retrieve its full details." + type = string + default = "Queue Manager ID" +} +variable "mqcloud_truststore_certificate_label" { + description = "Certificate label in queue manager store." + type = string + default = "label" +} + +// Data source arguments for mqcloud_keystore_certificate +variable "mqcloud_keystore_certificate_service_instance_guid" { + description = "The GUID that uniquely identifies the MQ on Cloud service instance." + type = string + default = "Service Instance ID" +} +variable "mqcloud_keystore_certificate_queue_manager_id" { + description = "The id of the queue manager to retrieve its full details." + type = string + default = "Queue Manager ID" +} +variable "mqcloud_keystore_certificate_label" { + description = "Certificate label in queue manager store." + type = string + default = "label" +} diff --git a/examples/ibm-mqcloud/versions.tf b/examples/ibm-mqcloud/versions.tf new file mode 100644 index 0000000000..54c9d03e8d --- /dev/null +++ b/examples/ibm-mqcloud/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_version = ">= 1.0" + required_providers { + ibm = { + source = "IBM-Cloud/ibm" + version = "1.52.0-beta0" + } + } +} diff --git a/go.mod b/go.mod index 55322cd7a7..f7c431a96b 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( github.com/google/uuid v1.3.0 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.6.0 - github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0 + github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 github.com/jinzhu/copier v0.3.2 github.com/minsikl/netscaler-nitro-go v0.0.0-20170827154432-5b14ce3643e3 github.com/mitchellh/go-homedir v1.1.0 @@ -53,7 +53,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/rook/rook v1.11.4 github.com/softlayer/softlayer-go v1.0.3 - golang.org/x/crypto v0.14.0 + golang.org/x/crypto v0.16.0 gopkg.in/yaml.v3 v3.0.1 gotest.tools v2.2.0+incompatible k8s.io/api v0.26.3 @@ -62,6 +62,7 @@ require ( ) require ( + github.com/IBM/mqcloud-go-sdk v0.0.0-20231207105140-14d858932788 github.com/IBM/sarama v1.41.2 k8s.io/utils v0.0.0-20230313181309-38a27ef9d749 sigs.k8s.io/controller-runtime v0.14.1 @@ -72,15 +73,17 @@ require ( cloud.google.com/go/monitoring v1.13.0 // indirect github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 // indirect github.com/PromonLogicalis/asn1 v0.0.0-20190312173541-d60463189a56 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect github.com/agext/levenshtein v1.2.2 // indirect github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect github.com/apex/log v1.9.0 // indirect - github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/armon/go-metrics v0.4.1 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v3 v3.2.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cloudflare/circl v1.3.3 // indirect github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 // indirect github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect github.com/coreos/pkg v0.0.0-20220810130054-c7d1c02cb6cf // indirect @@ -111,7 +114,7 @@ require ( github.com/go-ozzo/ozzo-validation/v4 v4.3.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.15.5 // indirect + github.com/go-playground/validator/v10 v10.16.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect @@ -125,30 +128,30 @@ require ( github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.5.0 // indirect + github.com/hashicorp/go-plugin v1.5.1 // indirect github.com/hashicorp/go-retryablehttp v0.7.4 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect github.com/hashicorp/go-sockaddr v1.0.2 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect - github.com/hashicorp/hc-install v0.4.0 // indirect + github.com/hashicorp/hc-install v0.6.1 // indirect github.com/hashicorp/hcl v1.0.1-vault-5 // indirect - github.com/hashicorp/hcl/v2 v2.14.1 // indirect + github.com/hashicorp/hcl/v2 v2.19.1 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-exec v0.17.3 // indirect - github.com/hashicorp/terraform-json v0.14.0 // indirect - github.com/hashicorp/terraform-plugin-go v0.14.0 // indirect - github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect - github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect - github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect + github.com/hashicorp/terraform-exec v0.19.0 // indirect + github.com/hashicorp/terraform-json v0.17.1 // indirect + github.com/hashicorp/terraform-plugin-go v0.19.0 // indirect + github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect + github.com/hashicorp/terraform-registry-address v0.2.2 // indirect + github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/vault v1.13.7 // indirect github.com/hashicorp/vault/api v1.9.2 // indirect github.com/hashicorp/vault/api/auth/approle v0.3.0 // indirect github.com/hashicorp/vault/sdk v0.10.0 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/hokaccha/go-prettyjson v0.0.0-20170213120834-e6b9231a2b1c // indirect - github.com/imdario/mergo v0.3.13 // indirect + github.com/imdario/mergo v0.3.15 // indirect github.com/jarcoal/httpmock v1.0.7 // indirect github.com/jcmturner/aescts/v2 v2.0.0 // indirect github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect @@ -196,19 +199,22 @@ require ( github.com/stretchr/objx v0.5.0 // indirect github.com/stretchr/testify v1.8.4 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect - github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect - github.com/vmihailenco/tagparser v0.1.1 // indirect - github.com/zclconf/go-cty v1.11.0 // indirect + github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect + github.com/zclconf/go-cty v1.14.1 // indirect go.mongodb.org/mongo-driver v1.12.1 // indirect go.opentelemetry.io/otel v1.14.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect go.uber.org/ratelimit v0.2.0 // indirect - golang.org/x/net v0.17.0 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.7.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/term v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect + golang.org/x/tools v0.16.0 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect diff --git a/go.sum b/go.sum index 30e5ffdf8e..8df8dccea4 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,7 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= code.cloudfoundry.org/gofileutils v0.0.0-20170111115228-4d0c80011a0f/go.mod h1:sk5LnIjB/nIEU7yP5sDQExVm62wu0pBh3yrElngUisI= +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= git.apache.org/thrift.git v0.12.0/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/Azure/azure-sdk-for-go v36.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= @@ -155,6 +156,8 @@ github.com/IBM/ibm-hpcs-uko-sdk v0.0.20-beta/go.mod h1:MLVNHMYoKsvovJZ4v1gQCpIYt github.com/IBM/keyprotect-go-client v0.5.1/go.mod h1:5TwDM/4FRJq1ZOlwQL1xFahLWQ3TveR88VmL1u3njyI= github.com/IBM/keyprotect-go-client v0.12.2 h1:Cjxcqin9Pl0xz3MnxdiVd4v/eIa79xL3hQpSbwOr/DQ= github.com/IBM/keyprotect-go-client v0.12.2/go.mod h1:yr8h2noNgU8vcbs+vhqoXp3Lmv73PI0zAc6VMgFvWwM= +github.com/IBM/mqcloud-go-sdk v0.0.0-20231207105140-14d858932788 h1:cIT0YSzqMGqxM3OJQx1gp4gtYYy9U35O0tVdcFHOgwc= +github.com/IBM/mqcloud-go-sdk v0.0.0-20231207105140-14d858932788/go.mod h1:R4NBbDMygpHiFywUnOdV0UfBZap4HcHa3QXLlACr9TU= github.com/IBM/networking-go-sdk v0.42.2 h1:caqjx4jyFHi10Vlf3skHvlL6K3YJRVstsmCBmvdyqkA= github.com/IBM/networking-go-sdk v0.42.2/go.mod h1:lTUZwtUkMANMnrLHFIgRhHrkBfwASY/Iho1fabaPHxo= github.com/IBM/platform-services-go-sdk v0.54.0 h1:WjHWm9ZAJvlq07E1WXXtEe+d/B0sazWD6cEWVT7EMLU= @@ -186,8 +189,6 @@ github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030I github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= github.com/Masterminds/sprig/v3 v3.2.1 h1:n6EPaDyLSvCEa3frruQvAiHuNp2dhBlMSmkEr+HuzGc= github.com/Microsoft/go-winio v0.4.13/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= @@ -196,8 +197,8 @@ github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8 github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PromonLogicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:zL3Ph7RCZadAPb7QV0gMIDmjuZHFawNhoPZ5erh6TRw= github.com/PromonLogicalis/asn1 v0.0.0-20190312173541-d60463189a56/go.mod h1:nE9BGpMlMfM9Z3U+P+mWtcHNDwHcGctalMx1VTkODAY= -github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= -github.com/ProtonMail/go-crypto v0.0.0-20230626094100-7e9e0395ebec h1:vV3RryLxt42+ZIVOFbYJCH1jsZNTNmj2NYru5zfx+4E= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -211,8 +212,7 @@ github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWX github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= -github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= -github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= +github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= @@ -232,7 +232,6 @@ github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5/go.mod h1 github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 h1:MzBOUgng9orim59UnfUTLRjMpd09C5uEVQ6RPGeCaVI= github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129/go.mod h1:rFgpPQZYZ8vdbc+48xibu8ALc3yeyd64IhHS+PU6Yyg= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/openwhisk-client-go v0.0.0-20200201143223-a804fb82d105 h1:k1wP1gZMrNJeXTz6a+3010NKC/ZvSffk07BzrLmYrmc= github.com/apache/openwhisk-client-go v0.0.0-20200201143223-a804fb82d105/go.mod h1:jLLKYP7+1+LFlIJW1n9U1gqeveLM1HIwa4ZHNOFxjPw= @@ -244,11 +243,9 @@ github.com/aphistic/golf v0.0.0-20180712155816-02c07f170c5a/go.mod h1:3NqKYiepwy github.com/aphistic/sweet v0.2.0/go.mod h1:fWDlIh/isSE9n6EPsRmC0det+whmX6dJid3stzu0Xys= github.com/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU= github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= -github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I= -github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= -github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= -github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/apple/foundationdb/bindings/go v0.0.0-20190411004307-cd5c9d91fad2/go.mod h1:OMVSB21p9+xQUIqlGizHPZfjK+SHws1ht+ZytVDoz9U= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= @@ -264,7 +261,6 @@ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= @@ -297,6 +293,7 @@ github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyX github.com/briankassouf/jose v0.9.2-0.20180619214549-d2569464773f/go.mod h1:HQhVmdUf7dBNwIIdBTivnCDxcf6IZY3/zrb+uKSJz6Y= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= @@ -320,6 +317,7 @@ github.com/circonus-labs/circonusllhist v0.1.3 h1:TJH+oke8D16535+jHExHj4nQvzlZrj github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/cloudfoundry-community/go-cfclient v0.0.0-20190201205600-f136f9222381/go.mod h1:e5+USP2j8Le2M0Jo3qKPFnNhuo1wueU4nWHCXBOfQ14= github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 h1:tuijfIjZyjZaHq9xDUh0tNitwXshJpbLkqMOJv4H3do= github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21/go.mod h1:po7NpZ/QiTKzBKyrsEAxwnTamCoh8uDk/egRpQ7siIc= @@ -356,6 +354,7 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -405,8 +404,7 @@ github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emicklei/go-restful/v3 v3.10.0 h1:X4gma4HM7hFm6WMeAsTfqA0GOfdNoCzBIkHGoRLGXuM= github.com/emicklei/go-restful/v3 v3.10.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= -github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -432,7 +430,6 @@ github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= @@ -456,19 +453,13 @@ github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2H github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew= github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I= -github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= -github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= -github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34= -github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= -github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4= -github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= +github.com/go-git/go-git/v5 v5.9.0 h1:cD9SFA7sHVRdJ7AYck1ZaAa/yeuBvGPxwXDL8cxrObY= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -596,8 +587,8 @@ github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+ github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7NLylN+x8TTueE24= -github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-playground/validator/v10 v10.16.0 h1:x+plE831WK4vaKHO/jpgUGsvLKIqRRkz6M78GuJAfGE= +github.com/go-playground/validator/v10 v10.16.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= @@ -845,8 +836,8 @@ github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9 github.com/hashicorp/go-plugin v1.0.0/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= github.com/hashicorp/go-plugin v1.4.3/go.mod h1:5fGEH17QVwTTcR0zV7yhDPLLmFX9YSZ38b18Udy6vYQ= -github.com/hashicorp/go-plugin v1.5.0 h1:g6Lj3USwF5LaB8HlvCxPjN2X4nFE08ko2BJNVpl7TIE= -github.com/hashicorp/go-plugin v1.5.0/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= +github.com/hashicorp/go-plugin v1.5.1 h1:oGm7cWBaYIp3lJpx1RUEfLWophprE2EV/KUeqBYo+6k= +github.com/hashicorp/go-plugin v1.5.1/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/hashicorp/go-raftchunking v0.6.3-0.20191002164813-7e9e8525653a h1:FmnBDwGwlTgugDGbVxwV8UavqSMACbGrUpfc98yFLR4= github.com/hashicorp/go-raftchunking v0.6.3-0.20191002164813-7e9e8525653a/go.mod h1:xbXnmKqX9/+RhPkJ4zrEx4738HacP72aaUPlT2RZ4sU= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= @@ -891,7 +882,6 @@ github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/C github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= @@ -901,13 +891,13 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hc-install v0.4.0 h1:cZkRFr1WVa0Ty6x5fTvL1TuO1flul231rWkGH92oYYk= -github.com/hashicorp/hc-install v0.4.0/go.mod h1:5d155H8EC5ewegao9A4PUTMNPZaq+TbOzkJJZ4vrXeI= +github.com/hashicorp/hc-install v0.6.1 h1:IGxShH7AVhPaSuSJpKtVi/EFORNjO+OYVJJrAtGG2mY= +github.com/hashicorp/hc-install v0.6.1/go.mod h1:0fW3jpg+wraYSnFDJ6Rlie3RvLf1bIqVIkzoon4KoVE= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= -github.com/hashicorp/hcl/v2 v2.14.1 h1:x0BpjfZ+CYdbiz+8yZTQ+gdLO7IXvOut7Da+XJayx34= -github.com/hashicorp/hcl/v2 v2.14.1/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0= +github.com/hashicorp/hcl/v2 v2.19.1 h1://i05Jqznmb2EXqa39Nsvyan2o5XyMowW5fnCKW5RPI= +github.com/hashicorp/hcl/v2 v2.19.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE= github.com/hashicorp/hcp-sdk-go v0.23.0 h1:3WarkQSK0VzxJaH6psHIGQagag3ujL+NjWagZZHpiZM= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= @@ -927,20 +917,20 @@ github.com/hashicorp/raft-snapshot v1.0.2-0.20190827162939-8117efcc5aab/go.mod h github.com/hashicorp/raft-snapshot v1.0.4 h1:EuDuayAJPdiDmVk1ygTDnG2zDzrs0/6/yBuma1IYSow= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.8.3/go.mod h1:UpNcs7fFbpKIyZaUuSW6EPiH+eZC7OuyFD+wc1oal+k= -github.com/hashicorp/terraform-exec v0.17.3 h1:MX14Kvnka/oWGmIkyuyvL6POx25ZmKrjlaclkx3eErU= -github.com/hashicorp/terraform-exec v0.17.3/go.mod h1:+NELG0EqQekJzhvikkeQsOAZpsw0cv/03rbeQJqscAI= -github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s= -github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= -github.com/hashicorp/terraform-plugin-go v0.14.0 h1:ttnSlS8bz3ZPYbMb84DpcPhY4F5DsQtcAS7cHo8uvP4= -github.com/hashicorp/terraform-plugin-go v0.14.0/go.mod h1:2nNCBeRLaenyQEi78xrGrs9hMbulveqG/zDMQSvVJTE= -github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs= -github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0 h1:FtCLTiTcykdsURXPt/ku7fYXm3y19nbzbZcUxHx9RbI= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0/go.mod h1:80wf5oad1tW+oLnbXS4UTYmDCrl7BuN1Q+IA91X1a4Y= -github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c h1:D8aRO6+mTqHfLsK/BC3j5OAoogv1WLRWzY1AaTo3rBg= -github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c/go.mod h1:Wn3Na71knbXc1G8Lh+yu/dQWWJeFQEpDeJMtWMtlmNI= -github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= -github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= +github.com/hashicorp/terraform-exec v0.19.0 h1:FpqZ6n50Tk95mItTSS9BjeOVUb4eg81SpgVtZNNtFSM= +github.com/hashicorp/terraform-exec v0.19.0/go.mod h1:tbxUpe3JKruE9Cuf65mycSIT8KiNPZ0FkuTE3H4urQg= +github.com/hashicorp/terraform-json v0.17.1 h1:eMfvh/uWggKmY7Pmb3T85u86E2EQg6EQHgyRwf3RkyA= +github.com/hashicorp/terraform-json v0.17.1/go.mod h1:Huy6zt6euxaY9knPAFKjUITn8QxUFIe9VuSzb4zn/0o= +github.com/hashicorp/terraform-plugin-go v0.19.0 h1:BuZx/6Cp+lkmiG0cOBk6Zps0Cb2tmqQpDM3iAtnhDQU= +github.com/hashicorp/terraform-plugin-go v0.19.0/go.mod h1:EhRSkEPNoylLQntYsk5KrDHTZJh9HQoumZXbOGOXmec= +github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= +github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 h1:wcOKYwPI9IorAJEBLzgclh3xVolO7ZorYd6U1vnok14= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0/go.mod h1:qH/34G25Ugdj5FcM95cSoXzUgIbgfhVLXCcEcYaMwq8= +github.com/hashicorp/terraform-registry-address v0.2.2 h1:lPQBg403El8PPicg/qONZJDC6YlgCVbWDtNmmZKtBno= +github.com/hashicorp/terraform-registry-address v0.2.2/go.mod h1:LtwNbCihUoUZ3RYriyS2wF/lGPB6gF9ICLRtuDk7hSo= +github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= +github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/vault v1.4.2/go.mod h1:500fLOj7p92Ys4X265LizqF78MzmHJUf1jV1zNJt060= github.com/hashicorp/vault v1.13.7 h1:4s/RullYWwTtWW7HzOKSR3SNzv4V2cgNo4ImvArnXpU= github.com/hashicorp/vault v1.13.7/go.mod h1:KgEsayEcTM6N6fSun+4OqofsiwmD8rN6TUPRqESLBJQ= @@ -1003,9 +993,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1: github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= +github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb v0.0.0-20190411212539-d24b7ba8c4c4/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ= @@ -1014,7 +1003,6 @@ github.com/jarcoal/httpmock v1.0.5/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT github.com/jarcoal/httpmock v1.0.7 h1:d1a2VFpSdm5gtjhCPWsQHSnx8+5V3ms5431YwvmkuNk= github.com/jarcoal/httpmock v1.0.7/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jcmturner/aescts v1.0.1/go.mod h1:k9gJoDUf1GH5r2IBtBjwjDCoLELYxOcEhitdP8RL7qQ= github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8= github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= @@ -1038,7 +1026,6 @@ github.com/jefferai/isbadcipher v0.0.0-20190226160619-51d2077c035f/go.mod h1:3J2 github.com/jefferai/jsonx v1.0.0 h1:Xoz0ZbmkpBvED5W9W1B5B/zc3Oiq7oXqiW7iRV3B6EI= github.com/jefferai/jsonx v1.0.0/go.mod h1:OGmqmi2tTeI/PS+qQfBDToLHHJIy/RMp24fPo8vFvoQ= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= github.com/jinzhu/copier v0.3.2 h1:QdBOCbaouLDYaIPFfi1bKv5F5tPpeTwXe4sD0jqtz5w= @@ -1077,8 +1064,7 @@ github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaR github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/kelseyhightower/envconfig v1.3.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= -github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= -github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/keybase/go-crypto v0.0.0-20190403132359-d65b6b94177f/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= @@ -1107,7 +1093,6 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kube-object-storage/lib-bucket-provisioner v0.0.0-20221122204822-d1a8c34382f1 h1:dQEHhTfi+bSIOSViQrKY9PqJvZenD6tFz+3lPzux58o= github.com/kube-object-storage/lib-bucket-provisioner v0.0.0-20221122204822-d1a8c34382f1/go.mod h1:my+EVjOJLeQ9lUR9uVkxRvNNkhO2saSGIgzV8GZT9HY= github.com/kubernetes-csi/external-snapshotter/client/v4 v4.0.0/go.mod h1:YBCo4DoEeDndqvAn6eeu0vWM7QdXmHEeI9cFWplmBys= -github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= @@ -1136,7 +1121,6 @@ github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJ github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11/go.mod h1:Ah2dBMoxZEqk118as2T4u4fjfXarE0pPnMJaArZQZsI= -github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -1228,7 +1212,6 @@ github.com/nicksnyder/go-i18n v1.10.0 h1:5AzlPKvXBH4qBzmZ09Ua9Gipyruv6uApMcrNZdo github.com/nicksnyder/go-i18n v1.10.0/go.mod h1:HrK7VCrbOvQoUAQ7Vpy7i87N7JZZZ7R2xBGjv0j365Q= github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2 h1:BQ1HW7hr4IVovMwWg0E0PYcyW8CzqDcVmaew9cujU4s= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758= github.com/nwaples/rardecode v1.0.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= @@ -1303,8 +1286,8 @@ github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+q github.com/onsi/gomega v1.27.7/go.mod h1:1p8OOlwo2iUUDsHnOrjE5UKYJ+e3W8eQ3qSlRahPmr4= github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= -github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= @@ -1352,6 +1335,7 @@ github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ= github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pires/go-proxyproto v0.6.1 h1:EBupykFmo22SDjv4fQVQd2J9NOoLPmyZA/15ldOGkPw= +github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -1444,9 +1428,7 @@ github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec/go.mod h1:gi+0 github.com/sasha-s/go-deadlock v0.2.0 h1:lMqc+fUb7RrFS3gQLtoQsJ7/6TV/pAIFvBsqX73DK8Y= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sethvargo/go-limiter v0.7.2 h1:FgC4N7RMpV5gMrUdda15FaFTkQ/L4fEqM7seXMs4oO8= github.com/shirou/gopsutil v2.19.9+incompatible h1:IrPVlK4nfwW10DF7pW+7YJKws9NkgNzWozwwWv9FsgY= @@ -1463,6 +1445,7 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM= github.com/smartystreets/assertions v0.0.0-20180725160413-e900ae048470/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= @@ -1537,13 +1520,12 @@ github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U= -github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= -github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= -github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= +github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/vmware/govmomi v0.18.0 h1:f7QxSmP7meCtoAmiKZogvVbLInT+CZx6Px6K5rYsJZo= -github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= -github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= +github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= @@ -1569,12 +1551,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= -github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= -github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= -github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -github.com/zclconf/go-cty v1.11.0 h1:726SxLdi2SDnjY+BStqB9J1hNp4+2WlzyXLuimibIe0= -github.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA= -github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= +github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA= +github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -1629,7 +1607,6 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -1654,19 +1631,19 @@ golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1710,12 +1687,12 @@ golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1741,7 +1718,6 @@ golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1767,7 +1743,6 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= @@ -1791,8 +1766,9 @@ golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190130055435-99b60b757ec1/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1828,8 +1804,9 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1862,7 +1839,6 @@ golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1905,11 +1881,9 @@ golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1938,8 +1912,9 @@ golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1953,8 +1928,9 @@ golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1975,8 +1951,9 @@ golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2065,8 +2042,9 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= -golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= +golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM= +golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -2253,7 +2231,6 @@ gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI 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/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -2268,7 +2245,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index bee8b7cb2b..4e563d0cb8 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -122,6 +122,14 @@ var ( HpcsInstanceID string ) +// MQ on Cloud +var ( + MqcloudInstanceID string + MqcloudQueueManagerID string + MqcloudKSCertFilePath string + MqcloudTSCertFilePath string +) + // Secrets Manager var ( SecretsManagerInstanceID string @@ -1562,6 +1570,24 @@ func init() { if SatelliteSSHPubKey == "" { fmt.Println("[WARN] Set the environment variable IBM_SATELLITE_SSH_PUB_KEY with a ssh public key or ibm_satellite_* tests may fail") } + + MqcloudInstanceID = os.Getenv("IBM_MQCLOUD_INSTANCE_ID") + if MqcloudInstanceID == "" { + fmt.Println("[INFO] Set the environment variable IBM_MQCLOUD_INSTANCE_ID for ibm_mqcloud_queue_manager resource or datasource else tests will fail if this is not set correctly") + } + + MqcloudQueueManagerID = os.Getenv("IBM_MQCLOUD_QUEUEMANAGER_ID") + if MqcloudQueueManagerID == "" { + fmt.Println("[INFO] Set the environment variable IBM_MQCLOUD_QUEUEMANAGER_ID for ibm_mqcloud_queue_manager resource or datasource else tests will fail if this is not set correctly") + } + MqcloudKSCertFilePath = os.Getenv("IBM_MQCLOUD_KS_CERT_PATH") + if MqcloudKSCertFilePath == "" { + fmt.Println("[INFO] Set the environment variable IBM_MQCLOUD_KS_CERT_PATH for ibm_mqcloud_keystore_certificate resource or datasource else tests will fail if this is not set correctly") + } + MqcloudTSCertFilePath = os.Getenv("IBM_MQCLOUD_TS_CERT_PATH") + if MqcloudTSCertFilePath == "" { + fmt.Println("[INFO] Set the environment variable IBM_MQCLOUD_TS_CERT_PATH for ibm_mqcloud_truststore_certificate resource or datasource else tests will fail if this is not set correctly") + } } var ( @@ -1773,6 +1799,22 @@ func TestAccPreCheckSatelliteSSH(t *testing.T) { } } +func TestAccPreCheckMqcloud(t *testing.T) { + TestAccPreCheck(t) + if MqcloudInstanceID == "" { + t.Fatal("IBM_MQCLOUD_INSTANCE_ID must be set for acceptance tests") + } + if MqcloudQueueManagerID == "" { + t.Fatal("IBM_MQCLOUD_QUEUEMANAGER_ID must be set for acceptance tests") + } + if MqcloudTSCertFilePath == "" { + t.Fatal("IBM_MQCLOUD_TS_CERT_PATH must be set for acceptance tests") + } + if MqcloudKSCertFilePath == "" { + t.Fatal("IBM_MQCLOUD_KS_CERT_PATH must be set for acceptance tests") + } +} + func TestAccProviderFactories() map[string]func() (*schema.Provider, error) { return map[string]func() (*schema.Provider, error){ ProviderName: func() (*schema.Provider, error) { return provider.Provider(), nil }, diff --git a/ibm/conns/config.go b/ibm/conns/config.go index ff89bd307f..fd99350034 100644 --- a/ibm/conns/config.go +++ b/ibm/conns/config.go @@ -29,6 +29,7 @@ import ( "github.com/IBM/go-sdk-core/v5/core" cosconfig "github.com/IBM/ibm-cos-sdk-go-config/resourceconfigurationv1" kp "github.com/IBM/keyprotect-go-client" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" cisalertsv1 "github.com/IBM/networking-go-sdk/alertsv1" cisoriginpull "github.com/IBM/networking-go-sdk/authenticatedoriginpullapiv1" cisbotanalyticsv1 "github.com/IBM/networking-go-sdk/botanalyticsv1" @@ -299,6 +300,7 @@ type ClientSession interface { CodeEngineV2() (*codeengine.CodeEngineV2, error) ProjectV1() (*project.ProjectV1, error) UsageReportsV4() (*usagereportsv4.UsageReportsV4, error) + MqcloudV1() (*mqcloudv1.MqcloudV1, error) } type clientSession struct { @@ -624,6 +626,9 @@ type clientSession struct { // Usage Reports options usageReportsClient *usagereportsv4.UsageReportsV4 usageReportsClientErr error + + mqcloudClient *mqcloudv1.MqcloudV1 + mqcloudClientErr error } // Usage Reports @@ -1203,6 +1208,13 @@ func (session clientSession) ProjectV1() (*project.ProjectV1, error) { return session.projectClient, session.projectClientErr } +// MQ on Cloud +func (session clientSession) MqcloudV1() (*mqcloudv1.MqcloudV1, error) { + sessionMqcloudClient := session.mqcloudClient + sessionMqcloudClient.EnableRetries(0, 0) + return session.mqcloudClient, session.mqcloudClientErr +} + // ClientSession configures and returns a fully initialized ClientSession func (c *Config) ClientSession() (interface{}, error) { sess, err := newSession(c) @@ -1296,6 +1308,7 @@ func (c *Config) ClientSession() (interface{}, error) { session.cdToolchainClientErr = errEmptyBluemixCredentials session.codeEngineClientErr = errEmptyBluemixCredentials session.projectClientErr = errEmptyBluemixCredentials + session.mqcloudClientErr = errEmptyBluemixCredentials return session, nil } @@ -3245,6 +3258,33 @@ func (c *Config) ClientSession() (interface{}, error) { session.cdTektonPipelineClientErr = fmt.Errorf("Error occurred while configuring CD Tekton Pipeline service: %q", err) } + // MQ Cloud Service Configuration + mqCloudURL := ContructEndpoint(fmt.Sprintf("api.%s.mq2", c.Region), cloudEndpoint) + if c.Visibility == "private" || c.Visibility == "public-and-private" { + mqCloudURL = ContructEndpoint(fmt.Sprintf("api.private.%s.mq2", c.Region), cloudEndpoint) + } + if fileMap != nil && c.Visibility != "public-and-private" { + mqCloudURL = fileFallBack(fileMap, c.Visibility, "IBMCLOUD_MQCLOUD_CONFIG_ENDPOINT", c.Region, mqCloudURL) + } + + mqcloudClientOptions := &mqcloudv1.MqcloudV1Options{ + Authenticator: authenticator, + URL: EnvFallBack([]string{"IBMCLOUD_MQCLOUD_CONFIG_ENDPOINT"}, mqCloudURL), + } + + // Construct the service client for MQ Cloud. + session.mqcloudClient, err = mqcloudv1.NewMqcloudV1(mqcloudClientOptions) + if err != nil { + session.mqcloudClientErr = fmt.Errorf("Error occurred while configuring MQ Cloud service: %q", err) + } else { + // Enable retries for API calls + session.mqcloudClient.Service.EnableRetries(c.RetryCount, c.RetryDelay) + // Add custom header for analytics + session.mqcloudClient.SetDefaultHeaders(gohttp.Header{ + "X-Original-User-Agent": {fmt.Sprintf("terraform-provider-ibm/%s", version.Version)}, + }) + } + // Construct the service options. codeEngineEndpoint := ContructEndpoint(fmt.Sprintf("api.%s.codeengine", c.Region), cloudEndpoint+"/v2") if c.Visibility == "private" || c.Visibility == "public-and-private" { diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index 9a0e61277b..c00464a12b 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -39,6 +39,7 @@ import ( "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/kms" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/kubernetes" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/metricsrouter" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/mqcloud" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/power" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/project" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/pushnotification" @@ -743,6 +744,14 @@ func Provider() *schema.Provider { "ibm_metrics_router_targets": metricsrouter.DataSourceIBMMetricsRouterTargets(), "ibm_metrics_router_routes": metricsrouter.DataSourceIBMMetricsRouterRoutes(), + // MQ on Cloud + "ibm_mqcloud_queue_manager": mqcloud.DataSourceIbmMqcloudQueueManager(), + "ibm_mqcloud_queue_manager_status": mqcloud.DataSourceIbmMqcloudQueueManagerStatus(), + "ibm_mqcloud_application": mqcloud.DataSourceIbmMqcloudApplication(), + "ibm_mqcloud_user": mqcloud.DataSourceIbmMqcloudUser(), + "ibm_mqcloud_truststore_certificate": mqcloud.DataSourceIbmMqcloudTruststoreCertificate(), + "ibm_mqcloud_keystore_certificate": mqcloud.DataSourceIbmMqcloudKeystoreCertificate(), + // Security and Complaince Center(soon to be deprecated) "ibm_scc_account_location": scc.DataSourceIBMSccAccountLocation(), "ibm_scc_account_locations": scc.DataSourceIBMSccAccountLocations(), @@ -1276,6 +1285,13 @@ func Provider() *schema.Provider { "ibm_metrics_router_route": metricsrouter.ResourceIBMMetricsRouterRoute(), "ibm_metrics_router_settings": metricsrouter.ResourceIBMMetricsRouterSettings(), + // MQ on Cloud + "ibm_mqcloud_queue_manager": mqcloud.ResourceIbmMqcloudQueueManager(), + "ibm_mqcloud_application": mqcloud.ResourceIbmMqcloudApplication(), + "ibm_mqcloud_user": mqcloud.ResourceIbmMqcloudUser(), + "ibm_mqcloud_keystore_certificate": mqcloud.ResourceIbmMqcloudKeystoreCertificate(), + "ibm_mqcloud_truststore_certificate": mqcloud.ResourceIbmMqcloudTruststoreCertificate(), + // Security and Compliance Center(soon to be deprecated) "ibm_scc_account_settings": scc.ResourceIBMSccAccountSettings(), "ibm_scc_rule_attachment": scc.ResourceIBMSccRuleAttachment(), @@ -1461,6 +1477,13 @@ func Validator() validate.ValidatorDict { "ibm_hpcs_key_template": hpcs.ResourceIbmKeyTemplateValidator(), "ibm_hpcs_vault": hpcs.ResourceIbmVaultValidator(), + // MQ on Cloud + "ibm_mqcloud_queue_manager": mqcloud.ResourceIbmMqcloudQueueManagerValidator(), + "ibm_mqcloud_application": mqcloud.ResourceIbmMqcloudApplicationValidator(), + "ibm_mqcloud_user": mqcloud.ResourceIbmMqcloudUserValidator(), + "ibm_mqcloud_keystore_certificate": mqcloud.ResourceIbmMqcloudKeystoreCertificateValidator(), + "ibm_mqcloud_truststore_certificate": mqcloud.ResourceIbmMqcloudTruststoreCertificateValidator(), + "ibm_is_backup_policy": vpc.ResourceIBMIsBackupPolicyValidator(), "ibm_is_backup_policy_plan": vpc.ResourceIBMIsBackupPolicyPlanValidator(), diff --git a/ibm/service/mqcloud/README.md b/ibm/service/mqcloud/README.md new file mode 100644 index 0000000000..c95818ac94 --- /dev/null +++ b/ibm/service/mqcloud/README.md @@ -0,0 +1,11 @@ +# Terraform IBM Provider + +This area is primarily for IBM provider contributors and maintainers. For information on _using_ Terraform and the IBM provider, see the links below. + + +## Handy Links +* [Find out about contributing](../../../CONTRIBUTING.md) to the IBM provider! +* IBM Provider Docs: [Home](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs) +* IBM Provider Docs: [One of the resources](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/mqcloud_queue_manager) +* IBM API Docs: [IBM API Docs for ]() +* IBM SDK: [IBM SDK for ](https://github.com/IBM/appconfiguration-go-admin-sdk/tree/master/mqcloudv1) diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_application.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_application.go new file mode 100644 index 0000000000..9cef9c4831 --- /dev/null +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_application.go @@ -0,0 +1,167 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud + +import ( + "context" + "fmt" + + "time" + + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" +) + +func DataSourceIbmMqcloudApplication() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmMqcloudApplicationRead, + + Schema: map[string]*schema.Schema{ + "service_instance_guid": { + Type: schema.TypeString, + Required: true, + Description: "The GUID that uniquely identifies the MQ on Cloud service instance.", + }, + "name": { + Type: schema.TypeString, + Optional: true, + Description: "The name of the application - conforming to MQ rules.", + }, + "applications": { + Type: schema.TypeList, + Computed: true, + Description: "List of applications.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of the application which was allocated on creation, and can be used for delete calls.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "The name of the application - conforming to MQ rules.", + }, + "create_api_key_uri": { + Type: schema.TypeString, + Computed: true, + Description: "The URI to create a new apikey for the application.", + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this application.", + }, + }, + }, + }, + }, + } +} + +func dataSourceIbmMqcloudApplicationRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Read Application failed %s", err)) + } + + serviceInstanceGuid := d.Get("service_instance_guid").(string) + + // Support for pagination + offset := int64(0) + limit := int64(25) + allItems := []mqcloudv1.ApplicationDetails{} + + for { + listApplicationsOptions := &mqcloudv1.ListApplicationsOptions{ + ServiceInstanceGuid: &serviceInstanceGuid, + Limit: &limit, + Offset: &offset, + } + + result, response, err := mqcloudClient.ListApplicationsWithContext(context, listApplicationsOptions) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error Getting Applications %s\n%s", err, response)) + } + if result == nil { + return diag.FromErr(fmt.Errorf("List Applications returned nil")) + } + + allItems = append(allItems, result.Applications...) + + // Check if the number of returned records is less than the limit + if int64(len(result.Applications)) < limit { + break + } + + offset += limit + } + + // Use the provided filter argument and construct a new list with only the requested resource(s) + var matchApplications []mqcloudv1.ApplicationDetails + var name string + var suppliedFilter bool + + if v, ok := d.GetOk("name"); ok { + name = v.(string) + suppliedFilter = true + for _, data := range allItems { + if *data.Name == name { + matchApplications = append(matchApplications, data) + } + } + } else { + matchApplications = allItems + } + + allItems = matchApplications + + if suppliedFilter { + if len(allItems) == 0 { + return diag.FromErr(fmt.Errorf("No Applications found with name %s", name)) + } + d.SetId(name) + } else { + d.SetId(dataSourceIbmMqcloudApplicationID(d)) + } + + mapSlice := []map[string]interface{}{} + for _, modelItem := range allItems { + modelItem := modelItem + modelMap, err := dataSourceIbmMqcloudApplicationApplicationDetailsToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + mapSlice = append(mapSlice, modelMap) + } + + if err = d.Set("applications", mapSlice); err != nil { + return diag.FromErr(fmt.Errorf("Error setting applications %s", err)) + } + + return nil +} + +// dataSourceIbmMqcloudApplicationID returns a reasonable ID for the list. +func dataSourceIbmMqcloudApplicationID(d *schema.ResourceData) string { + return time.Now().UTC().String() +} + +func dataSourceIbmMqcloudApplicationApplicationDetailsToMap(model *mqcloudv1.ApplicationDetails) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["create_api_key_uri"] = model.CreateApiKeyURI + modelMap["href"] = model.Href + return modelMap, nil +} diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_application_test.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_application_test.go new file mode 100644 index 0000000000..1c9f1d7347 --- /dev/null +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_application_test.go @@ -0,0 +1,87 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmMqcloudApplicationDataSourceBasic(t *testing.T) { + applicationDetailsServiceInstanceGuid := acc.MqcloudInstanceID + applicationDetailsName := "appdsbasic" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudApplicationDataSourceConfigBasic(applicationDetailsServiceInstanceGuid, applicationDetailsName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "service_instance_guid"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "applications.#"), + resource.TestCheckResourceAttr("data.ibm_mqcloud_application.mqcloud_application_instance", "applications.0.name", applicationDetailsName), + ), + }, + }, + }) +} + +func TestAccIbmMqcloudApplicationDataSourceAllArgs(t *testing.T) { + applicationDetailsServiceInstanceGuid := acc.MqcloudInstanceID + applicationDetailsName := "appdsargs" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudApplicationDataSourceConfig(applicationDetailsServiceInstanceGuid, applicationDetailsName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "service_instance_guid"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "name"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "applications.#"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "applications.0.id"), + resource.TestCheckResourceAttr("data.ibm_mqcloud_application.mqcloud_application_instance", "applications.0.name", applicationDetailsName), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "applications.0.create_api_key_uri"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "applications.0.href"), + ), + }, + }, + }) +} + +func testAccCheckIbmMqcloudApplicationDataSourceConfigBasic(applicationDetailsServiceInstanceGuid string, applicationDetailsName string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_application" "mqcloud_application_instance" { + service_instance_guid = "%s" + name = "%s" + } + + data "ibm_mqcloud_application" "mqcloud_application_instance" { + service_instance_guid = ibm_mqcloud_application.mqcloud_application_instance.service_instance_guid + name = ibm_mqcloud_application.mqcloud_application_instance.name + } + `, applicationDetailsServiceInstanceGuid, applicationDetailsName) +} + +func testAccCheckIbmMqcloudApplicationDataSourceConfig(applicationDetailsServiceInstanceGuid string, applicationDetailsName string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_application" "mqcloud_application_instance" { + service_instance_guid = "%s" + name = "%s" + } + + data "ibm_mqcloud_application" "mqcloud_application_instance" { + service_instance_guid = ibm_mqcloud_application.mqcloud_application_instance.service_instance_guid + name = ibm_mqcloud_application.mqcloud_application_instance.name + } + `, applicationDetailsServiceInstanceGuid, applicationDetailsName) +} diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate.go new file mode 100644 index 0000000000..0f27f37fa3 --- /dev/null +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate.go @@ -0,0 +1,223 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func DataSourceIbmMqcloudKeystoreCertificate() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmMqcloudKeystoreCertificateRead, + + Schema: map[string]*schema.Schema{ + "service_instance_guid": { + Type: schema.TypeString, + Required: true, + Description: "The GUID that uniquely identifies the MQ on Cloud service instance.", + }, + "queue_manager_id": { + Type: schema.TypeString, + Required: true, + Description: "The id of the queue manager to retrieve its full details.", + }, + "label": { + Type: schema.TypeString, + Optional: true, + Description: "Certificate label in queue manager store.", + }, + "total_count": { + Type: schema.TypeInt, + Computed: true, + Description: "The total count of key store certificates.", + }, + "key_store": { + Type: schema.TypeList, + Computed: true, + Description: "The list of key store certificates.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + Description: "ID of the certificate.", + }, + "label": { + Type: schema.TypeString, + Computed: true, + Description: "Certificate label in queue manager store.", + }, + "certificate_type": { + Type: schema.TypeString, + Computed: true, + Description: "The type of certificate.", + }, + "fingerprint_sha256": { + Type: schema.TypeString, + Computed: true, + Description: "Fingerprint SHA256.", + }, + "subject_dn": { + Type: schema.TypeString, + Computed: true, + Description: "Subject's Distinguished Name.", + }, + "subject_cn": { + Type: schema.TypeString, + Computed: true, + Description: "Subject's Common Name.", + }, + "issuer_dn": { + Type: schema.TypeString, + Computed: true, + Description: "Issuer's Distinguished Name.", + }, + "issuer_cn": { + Type: schema.TypeString, + Computed: true, + Description: "Issuer's Common Name.", + }, + "issued": { + Type: schema.TypeString, + Computed: true, + Description: "Date certificate was issued.", + }, + "expiry": { + Type: schema.TypeString, + Computed: true, + Description: "Expiry date for the certificate.", + }, + "is_default": { + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether it is the queue manager's default certificate.", + }, + "dns_names_total_count": { + Type: schema.TypeInt, + Computed: true, + Description: "The total count of dns names.", + }, + "dns_names": { + Type: schema.TypeList, + Computed: true, + Description: "The list of DNS names.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this key store certificate.", + }, + }, + }, + }, + }, + } +} + +func dataSourceIbmMqcloudKeystoreCertificateRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Read Keystore Certificate failed %s", err)) + } + + listKeyStoreCertificatesOptions := &mqcloudv1.ListKeyStoreCertificatesOptions{} + + listKeyStoreCertificatesOptions.SetServiceInstanceGuid(d.Get("service_instance_guid").(string)) + listKeyStoreCertificatesOptions.SetQueueManagerID(d.Get("queue_manager_id").(string)) + + keyStoreCertificateDetailsCollection, response, err := mqcloudClient.ListKeyStoreCertificatesWithContext(context, listKeyStoreCertificatesOptions) + if err != nil { + log.Printf("[DEBUG] ListKeyStoreCertificatesWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("ListKeyStoreCertificatesWithContext failed %s\n%s", err, response)) + } + + // Use the provided filter argument and construct a new list with only the requested resource(s) + var matchKeyStore []mqcloudv1.KeyStoreCertificateDetails + var label string + var suppliedFilter bool + + if v, ok := d.GetOk("label"); ok { + label = v.(string) + suppliedFilter = true + for _, data := range keyStoreCertificateDetailsCollection.KeyStore { + if *data.Label == label { + matchKeyStore = append(matchKeyStore, data) + } + } + } else { + matchKeyStore = keyStoreCertificateDetailsCollection.KeyStore + } + keyStoreCertificateDetailsCollection.KeyStore = matchKeyStore + + if suppliedFilter { + if len(keyStoreCertificateDetailsCollection.KeyStore) == 0 { + return diag.FromErr(fmt.Errorf("no KeyStore found with label %s", label)) + } + d.SetId(label) + } else { + d.SetId(dataSourceIbmMqcloudKeystoreCertificateID(d)) + } + + if err = d.Set("total_count", flex.IntValue(keyStoreCertificateDetailsCollection.TotalCount)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting total_count: %s", err)) + } + + keyStore := []map[string]interface{}{} + if keyStoreCertificateDetailsCollection.KeyStore != nil { + for _, modelItem := range keyStoreCertificateDetailsCollection.KeyStore { + modelItem := modelItem + modelMap, err := dataSourceIbmMqcloudKeystoreCertificateKeyStoreCertificateDetailsToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + keyStore = append(keyStore, modelMap) + } + } + if err = d.Set("key_store", keyStore); err != nil { + return diag.FromErr(fmt.Errorf("Error setting key_store %s", err)) + } + + return nil +} + +// dataSourceIbmMqcloudKeystoreCertificateID returns a reasonable ID for the list. +func dataSourceIbmMqcloudKeystoreCertificateID(d *schema.ResourceData) string { + return time.Now().UTC().String() +} + +func dataSourceIbmMqcloudKeystoreCertificateKeyStoreCertificateDetailsToMap(model *mqcloudv1.KeyStoreCertificateDetails) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + modelMap["label"] = model.Label + modelMap["certificate_type"] = model.CertificateType + modelMap["fingerprint_sha256"] = model.FingerprintSha256 + modelMap["subject_dn"] = model.SubjectDn + modelMap["subject_cn"] = model.SubjectCn + modelMap["issuer_dn"] = model.IssuerDn + modelMap["issuer_cn"] = model.IssuerCn + modelMap["issued"] = model.Issued.String() + modelMap["expiry"] = model.Expiry.String() + modelMap["is_default"] = model.IsDefault + modelMap["dns_names_total_count"] = flex.IntValue(model.DnsNamesTotalCount) + modelMap["dns_names"] = model.DnsNames + modelMap["href"] = model.Href + return modelMap, nil +} diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate_test.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate_test.go new file mode 100644 index 0000000000..9f0b3218e6 --- /dev/null +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate_test.go @@ -0,0 +1,107 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmMqcloudKeystoreCertificateDataSourceBasic(t *testing.T) { + keyStoreCertificateDetailsServiceInstanceGuid := acc.MqcloudInstanceID + keyStoreCertificateDetailsQueueManagerID := acc.MqcloudQueueManagerID + keyStoreCertificateDetailsLabel := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) + keyStoreCertificateDetailsCertificateFile := acc.MqcloudKSCertFilePath + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudKeystoreCertificateDataSourceConfigBasic(keyStoreCertificateDetailsServiceInstanceGuid, keyStoreCertificateDetailsQueueManagerID, keyStoreCertificateDetailsLabel, keyStoreCertificateDetailsCertificateFile), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "service_instance_guid"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "queue_manager_id"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.#"), + resource.TestCheckResourceAttr("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.label", keyStoreCertificateDetailsLabel), + ), + }, + }, + }) +} + +func TestAccIbmMqcloudKeystoreCertificateDataSourceAllArgs(t *testing.T) { + keyStoreCertificateDetailsServiceInstanceGuid := acc.MqcloudInstanceID + keyStoreCertificateDetailsQueueManagerID := acc.MqcloudQueueManagerID + keyStoreCertificateDetailsLabel := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) + keyStoreCertificateDetailsCertificateFile := acc.MqcloudKSCertFilePath + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudKeystoreCertificateDataSourceConfig(keyStoreCertificateDetailsServiceInstanceGuid, keyStoreCertificateDetailsQueueManagerID, keyStoreCertificateDetailsLabel, keyStoreCertificateDetailsCertificateFile), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "service_instance_guid"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "queue_manager_id"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "label"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "total_count"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.#"), + resource.TestCheckResourceAttr("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.label", keyStoreCertificateDetailsLabel), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.certificate_type"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.fingerprint_sha256"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.subject_dn"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.subject_cn"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.issuer_dn"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.issuer_cn"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.issued"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.expiry"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.is_default"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.dns_names_total_count"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.href"), + ), + }, + }, + }) +} + +func testAccCheckIbmMqcloudKeystoreCertificateDataSourceConfigBasic(keyStoreCertificateDetailsServiceInstanceGuid string, keyStoreCertificateDetailsQueueManagerID string, keyStoreCertificateDetailsLabel string, keyStoreCertificateDetailsCertificateFile string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { + service_instance_guid = "%s" + queue_manager_id = "%s" + label = "%s" + certificate_file = "%s" + } + + data "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { + service_instance_guid = ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance.service_instance_guid + queue_manager_id = ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance.queue_manager_id + label = ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance.label + } + `, keyStoreCertificateDetailsServiceInstanceGuid, keyStoreCertificateDetailsQueueManagerID, keyStoreCertificateDetailsLabel, keyStoreCertificateDetailsCertificateFile) +} + +func testAccCheckIbmMqcloudKeystoreCertificateDataSourceConfig(keyStoreCertificateDetailsServiceInstanceGuid string, keyStoreCertificateDetailsQueueManagerID string, keyStoreCertificateDetailsLabel string, keyStoreCertificateDetailsCertificateFile string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { + service_instance_guid = "%s" + queue_manager_id = "%s" + label = "%s" + certificate_file = "%s" + } + + data "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { + service_instance_guid = ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance.service_instance_guid + queue_manager_id = ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance.queue_manager_id + label = ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance.label + } + `, keyStoreCertificateDetailsServiceInstanceGuid, keyStoreCertificateDetailsQueueManagerID, keyStoreCertificateDetailsLabel, keyStoreCertificateDetailsCertificateFile) +} diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager.go new file mode 100644 index 0000000000..42774e4bce --- /dev/null +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager.go @@ -0,0 +1,232 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func DataSourceIbmMqcloudQueueManager() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmMqcloudQueueManagerRead, + + Schema: map[string]*schema.Schema{ + "service_instance_guid": { + Type: schema.TypeString, + Required: true, + Description: "The GUID that uniquely identifies the MQ on Cloud service instance.", + }, + "name": { + Type: schema.TypeString, + Optional: true, + Description: "A queue manager name conforming to MQ restrictions.", + }, + "queue_managers": { + Type: schema.TypeList, + Computed: true, + Description: "List of queue managers.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of the queue manager which was allocated on creation, and can be used for delete calls.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "A queue manager name conforming to MQ restrictions.", + }, + "display_name": { + Type: schema.TypeString, + Computed: true, + Description: "A displayable name for the queue manager - limited only in length.", + }, + "location": { + Type: schema.TypeString, + Computed: true, + Description: "The locations in which the queue manager could be deployed.", + }, + "size": { + Type: schema.TypeString, + Computed: true, + Description: "The queue manager sizes of deployment available. Deployment of lite queue managers for aws_us_east_1 and aws_eu_west_1 locations is not available.", + }, + "status_uri": { + Type: schema.TypeString, + Computed: true, + Description: "A reference uri to get deployment status of the queue manager.", + }, + "version": { + Type: schema.TypeString, + Computed: true, + Description: "The MQ version of the queue manager.", + }, + "web_console_url": { + Type: schema.TypeString, + Computed: true, + Description: "The url through which to access the web console for this queue manager.", + }, + "rest_api_endpoint_url": { + Type: schema.TypeString, + Computed: true, + Description: "The url through which to access REST APIs for this queue manager.", + }, + "administrator_api_endpoint_url": { + Type: schema.TypeString, + Computed: true, + Description: "The url through which to access the Admin REST APIs for this queue manager.", + }, + "connection_info_uri": { + Type: schema.TypeString, + Computed: true, + Description: "The uri through which the CDDT for this queue manager can be obtained.", + }, + "date_created": { + Type: schema.TypeString, + Computed: true, + Description: "RFC3339 formatted UTC date for when the queue manager was created.", + }, + "upgrade_available": { + Type: schema.TypeBool, + Computed: true, + Description: "Describes whether an upgrade is available for this queue manager.", + }, + "available_upgrade_versions_uri": { + Type: schema.TypeString, + Computed: true, + Description: "The uri through which the available versions to upgrade to can be found for this queue manager.", + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this queue manager.", + }, + }, + }, + }, + }, + } +} + +func dataSourceIbmMqcloudQueueManagerRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Read Queue Manager failed %s", err)) + } + + serviceInstanceGuid := d.Get("service_instance_guid").(string) + + // Support for pagination + offset := int64(0) + limit := int64(25) + allItems := []mqcloudv1.QueueManagerDetails{} + + for { + listQueueManagersOptions := &mqcloudv1.ListQueueManagersOptions{ + ServiceInstanceGuid: &serviceInstanceGuid, + Limit: &limit, + Offset: &offset, + } + + result, response, err := mqcloudClient.ListQueueManagersWithContext(context, listQueueManagersOptions) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error Getting QueueManagers %s\n%s", err, response)) + } + if result == nil { + return diag.FromErr(fmt.Errorf("List QueueManagers returned nil")) + } + + allItems = append(allItems, result.QueueManagers...) + + // Check if the number of returned records is less than the limit + if int64(len(result.QueueManagers)) < limit { + break + } + + offset += limit + } + + // Use the provided filter argument and construct a new list with only the requested resource(s) + var matchQueueManagers []mqcloudv1.QueueManagerDetails + var name string + var suppliedFilter bool + + if v, ok := d.GetOk("name"); ok { + name = v.(string) + suppliedFilter = true + for _, data := range allItems { + if *data.Name == name { + matchQueueManagers = append(matchQueueManagers, data) + } + } + } else { + matchQueueManagers = allItems + } + + allItems = matchQueueManagers + + if suppliedFilter { + if len(allItems) == 0 { + return diag.FromErr(fmt.Errorf("No Queue Managers found with name %s", name)) + } + d.SetId(name) + } else { + d.SetId(dataSourceIbmMqcloudQueueManagerID(d)) + } + + mapSlice := []map[string]interface{}{} + for _, modelItem := range allItems { + modelItem := modelItem + modelMap, err := dataSourceIbmMqcloudQueueManagerQueueManagerDetailsToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + mapSlice = append(mapSlice, modelMap) + } + + if err = d.Set("queue_managers", mapSlice); err != nil { + return diag.FromErr(fmt.Errorf("Error setting queue_managers %s", err)) + } + + return nil +} + +// dataSourceIbmMqcloudQueueManagerID returns a reasonable ID for the list. +func dataSourceIbmMqcloudQueueManagerID(d *schema.ResourceData) string { + return time.Now().UTC().String() +} + +func dataSourceIbmMqcloudQueueManagerQueueManagerDetailsToMap(model *mqcloudv1.QueueManagerDetails) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["display_name"] = model.DisplayName + modelMap["location"] = model.Location + modelMap["size"] = model.Size + modelMap["status_uri"] = model.StatusURI + modelMap["version"] = model.Version + modelMap["web_console_url"] = model.WebConsoleURL + modelMap["rest_api_endpoint_url"] = model.RestApiEndpointURL + modelMap["administrator_api_endpoint_url"] = model.AdministratorApiEndpointURL + modelMap["connection_info_uri"] = model.ConnectionInfoURI + modelMap["date_created"] = model.DateCreated.String() + modelMap["upgrade_available"] = model.UpgradeAvailable + modelMap["available_upgrade_versions_uri"] = model.AvailableUpgradeVersionsURI + modelMap["href"] = model.Href + return modelMap, nil +} diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_status.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_status.go new file mode 100644 index 0000000000..835949afed --- /dev/null +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_status.go @@ -0,0 +1,77 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func DataSourceIbmMqcloudQueueManagerStatus() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmMqcloudQueueManagerStatusRead, + + Schema: map[string]*schema.Schema{ + "service_instance_guid": { + Type: schema.TypeString, + Required: true, + Description: "The GUID that uniquely identifies the MQ on Cloud service instance.", + }, + "queue_manager_id": { + Type: schema.TypeString, + Required: true, + Description: "The id of the queue manager to retrieve its full details.", + }, + "status": { + Type: schema.TypeString, + Computed: true, + Description: "The deploying and failed states are not queue manager states, they are states which can occur when the request to deploy has been fired, or with that request has failed without producing a queue manager to have any state. The other states map to the queue manager states. State \"ending\" is either quiesing or ending immediately. State \"ended\" is either ended normally or endedimmediately. The others map one to one with queue manager states.", + }, + }, + } +} + +func dataSourceIbmMqcloudQueueManagerStatusRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Read Queue Manager Status failed %s", err)) + } + + getQueueManagerStatusOptions := &mqcloudv1.GetQueueManagerStatusOptions{} + + getQueueManagerStatusOptions.SetServiceInstanceGuid(d.Get("service_instance_guid").(string)) + getQueueManagerStatusOptions.SetQueueManagerID(d.Get("queue_manager_id").(string)) + + queueManagerStatus, response, err := mqcloudClient.GetQueueManagerStatusWithContext(context, getQueueManagerStatusOptions) + if err != nil { + log.Printf("[DEBUG] GetQueueManagerStatusWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetQueueManagerStatusWithContext failed %s\n%s", err, response)) + } + + d.SetId(dataSourceIbmMqcloudQueueManagerStatusID(d)) + + if err = d.Set("status", queueManagerStatus.Status); err != nil { + return diag.FromErr(fmt.Errorf("Error setting status: %s", err)) + } + + return nil +} + +// dataSourceIbmMqcloudQueueManagerStatusID returns a reasonable ID for the list. +func dataSourceIbmMqcloudQueueManagerStatusID(d *schema.ResourceData) string { + return time.Now().UTC().String() +} diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_status_test.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_status_test.go new file mode 100644 index 0000000000..c09b3d5ba6 --- /dev/null +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_status_test.go @@ -0,0 +1,44 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmMqcloudQueueManagerStatusDataSourceBasic(t *testing.T) { + t.Parallel() + service_instance_guid := acc.MqcloudInstanceID + queue_manager_id := acc.MqcloudQueueManagerID + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudQueueManagerStatusDataSourceConfigBasic(service_instance_guid, queue_manager_id), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager_status.mqcloud_queue_manager_status_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager_status.mqcloud_queue_manager_status_instance", "service_instance_guid"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager_status.mqcloud_queue_manager_status_instance", "queue_manager_id"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager_status.mqcloud_queue_manager_status_instance", "status"), + ), + }, + }, + }) +} + +func testAccCheckIbmMqcloudQueueManagerStatusDataSourceConfigBasic(service_instance_guid string, queue_manager_id string) string { + return fmt.Sprintf(` + data "ibm_mqcloud_queue_manager_status" "mqcloud_queue_manager_status_instance" { + service_instance_guid = "%s" + queue_manager_id = "%s" + } + `, service_instance_guid, queue_manager_id) +} diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_test.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_test.go new file mode 100644 index 0000000000..69f9690370 --- /dev/null +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_test.go @@ -0,0 +1,114 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmMqcloudQueueManagerDataSourceBasic(t *testing.T) { + t.Parallel() + queueManagerDetailsServiceInstanceGuid := acc.MqcloudInstanceID + queueManagerDetailsName := "queue_manager_ds_basic" + queueManagerDetailsLocation := "ibmcloud_eu_de" + queueManagerDetailsSize := "small" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudQueueManagerDataSourceConfigBasic(queueManagerDetailsServiceInstanceGuid, queueManagerDetailsName, queueManagerDetailsLocation, queueManagerDetailsSize), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "service_instance_guid"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.#"), + resource.TestCheckResourceAttr("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.name", queueManagerDetailsName), + resource.TestCheckResourceAttr("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.location", queueManagerDetailsLocation), + resource.TestCheckResourceAttr("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.size", queueManagerDetailsSize), + ), + }, + }, + }) +} + +func TestAccIbmMqcloudQueueManagerDataSourceAllArgs(t *testing.T) { + t.Parallel() + queueManagerDetailsServiceInstanceGuid := acc.MqcloudInstanceID + queueManagerDetailsName := "queue_manager_ds_allargs" + queueManagerDetailsDisplayName := "queue_manager_ds_allargs" + queueManagerDetailsLocation := "ibmcloud_eu_de" + queueManagerDetailsSize := "small" + queueManagerDetailsVersion := "9.3.3_3" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudQueueManagerDataSourceConfig(queueManagerDetailsServiceInstanceGuid, queueManagerDetailsName, queueManagerDetailsDisplayName, queueManagerDetailsLocation, queueManagerDetailsSize, queueManagerDetailsVersion), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "service_instance_guid"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "name"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.#"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.id"), + resource.TestCheckResourceAttr("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.name", queueManagerDetailsName), + resource.TestCheckResourceAttr("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.display_name", queueManagerDetailsDisplayName), + resource.TestCheckResourceAttr("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.location", queueManagerDetailsLocation), + resource.TestCheckResourceAttr("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.size", queueManagerDetailsSize), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.status_uri"), + resource.TestCheckResourceAttr("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.version", queueManagerDetailsVersion), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.web_console_url"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.rest_api_endpoint_url"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.administrator_api_endpoint_url"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.connection_info_uri"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.date_created"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.upgrade_available"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.available_upgrade_versions_uri"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "queue_managers.0.href"), + ), + }, + }, + }) +} + +func testAccCheckIbmMqcloudQueueManagerDataSourceConfigBasic(queueManagerDetailsServiceInstanceGuid string, queueManagerDetailsName string, queueManagerDetailsLocation string, queueManagerDetailsSize string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" { + service_instance_guid = "%s" + name = "%s" + location = "%s" + size = "%s" + } + + data "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" { + service_instance_guid = ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance.service_instance_guid + name = ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance.name + } + `, queueManagerDetailsServiceInstanceGuid, queueManagerDetailsName, queueManagerDetailsLocation, queueManagerDetailsSize) +} + +func testAccCheckIbmMqcloudQueueManagerDataSourceConfig(queueManagerDetailsServiceInstanceGuid string, queueManagerDetailsName string, queueManagerDetailsDisplayName string, queueManagerDetailsLocation string, queueManagerDetailsSize string, queueManagerDetailsVersion string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" { + service_instance_guid = "%s" + name = "%s" + display_name = "%s" + location = "%s" + size = "%s" + version = "%s" + } + + data "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" { + service_instance_guid = ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance.service_instance_guid + name = ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance.name + } + `, queueManagerDetailsServiceInstanceGuid, queueManagerDetailsName, queueManagerDetailsDisplayName, queueManagerDetailsLocation, queueManagerDetailsSize, queueManagerDetailsVersion) +} diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate.go new file mode 100644 index 0000000000..265c2cb8b1 --- /dev/null +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate.go @@ -0,0 +1,208 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func DataSourceIbmMqcloudTruststoreCertificate() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmMqcloudTruststoreCertificateRead, + + Schema: map[string]*schema.Schema{ + "service_instance_guid": { + Type: schema.TypeString, + Required: true, + Description: "The GUID that uniquely identifies the MQ on Cloud service instance.", + }, + "queue_manager_id": { + Type: schema.TypeString, + Required: true, + Description: "The id of the queue manager to retrieve its full details.", + }, + "label": { + Type: schema.TypeString, + Optional: true, + Description: "Certificate label in queue manager store.", + }, + "total_count": { + Type: schema.TypeInt, + Computed: true, + Description: "The total count of trust store certificates.", + }, + "trust_store": { + Type: schema.TypeList, + Computed: true, + Description: "The list of trust store certificates.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + Description: "Id of the certificate.", + }, + "label": { + Type: schema.TypeString, + Computed: true, + Description: "Certificate label in queue manager store.", + }, + "certificate_type": { + Type: schema.TypeString, + Computed: true, + Description: "The type of certificate.", + }, + "fingerprint_sha256": { + Type: schema.TypeString, + Computed: true, + Description: "Fingerprint SHA256.", + }, + "subject_dn": { + Type: schema.TypeString, + Computed: true, + Description: "Subject's Distinguished Name.", + }, + "subject_cn": { + Type: schema.TypeString, + Computed: true, + Description: "Subject's Common Name.", + }, + "issuer_dn": { + Type: schema.TypeString, + Computed: true, + Description: "Issuer's Distinguished Name.", + }, + "issuer_cn": { + Type: schema.TypeString, + Computed: true, + Description: "Issuer's Common Name.", + }, + "issued": { + Type: schema.TypeString, + Computed: true, + Description: "The Date the certificate was issued.", + }, + "expiry": { + Type: schema.TypeString, + Computed: true, + Description: "Expiry date for the certificate.", + }, + "trusted": { + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether a certificate is trusted.", + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this trust store certificate.", + }, + }, + }, + }, + }, + } +} + +func dataSourceIbmMqcloudTruststoreCertificateRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Read Truststore Certificate failed %s", err)) + } + + listTrustStoreCertificatesOptions := &mqcloudv1.ListTrustStoreCertificatesOptions{} + + listTrustStoreCertificatesOptions.SetServiceInstanceGuid(d.Get("service_instance_guid").(string)) + listTrustStoreCertificatesOptions.SetQueueManagerID(d.Get("queue_manager_id").(string)) + + trustStoreCertificateDetailsCollection, response, err := mqcloudClient.ListTrustStoreCertificatesWithContext(context, listTrustStoreCertificatesOptions) + if err != nil { + log.Printf("[DEBUG] ListTrustStoreCertificatesWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("ListTrustStoreCertificatesWithContext failed %s\n%s", err, response)) + } + + // Use the provided filter argument and construct a new list with only the requested resource(s) + var matchTrustStore []mqcloudv1.TrustStoreCertificateDetails + var label string + var suppliedFilter bool + + if v, ok := d.GetOk("label"); ok { + label = v.(string) + suppliedFilter = true + for _, data := range trustStoreCertificateDetailsCollection.TrustStore { + if *data.Label == label { + matchTrustStore = append(matchTrustStore, data) + } + } + } else { + matchTrustStore = trustStoreCertificateDetailsCollection.TrustStore + } + trustStoreCertificateDetailsCollection.TrustStore = matchTrustStore + + if suppliedFilter { + if len(trustStoreCertificateDetailsCollection.TrustStore) == 0 { + return diag.FromErr(fmt.Errorf("no TrustStore found with label %s", label)) + } + d.SetId(label) + } else { + d.SetId(dataSourceIbmMqcloudTruststoreCertificateID(d)) + } + + if err = d.Set("total_count", flex.IntValue(trustStoreCertificateDetailsCollection.TotalCount)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting total_count: %s", err)) + } + + trustStore := []map[string]interface{}{} + if trustStoreCertificateDetailsCollection.TrustStore != nil { + for _, modelItem := range trustStoreCertificateDetailsCollection.TrustStore { + modelItem := modelItem + modelMap, err := dataSourceIbmMqcloudTruststoreCertificateTrustStoreCertificateDetailsToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + trustStore = append(trustStore, modelMap) + } + } + if err = d.Set("trust_store", trustStore); err != nil { + return diag.FromErr(fmt.Errorf("Error setting trust_store %s", err)) + } + + return nil +} + +// dataSourceIbmMqcloudTruststoreCertificateID returns a reasonable ID for the list. +func dataSourceIbmMqcloudTruststoreCertificateID(d *schema.ResourceData) string { + return time.Now().UTC().String() +} + +func dataSourceIbmMqcloudTruststoreCertificateTrustStoreCertificateDetailsToMap(model *mqcloudv1.TrustStoreCertificateDetails) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + modelMap["label"] = model.Label + modelMap["certificate_type"] = model.CertificateType + modelMap["fingerprint_sha256"] = model.FingerprintSha256 + modelMap["subject_dn"] = model.SubjectDn + modelMap["subject_cn"] = model.SubjectCn + modelMap["issuer_dn"] = model.IssuerDn + modelMap["issuer_cn"] = model.IssuerCn + modelMap["issued"] = model.Issued.String() + modelMap["expiry"] = model.Expiry.String() + modelMap["trusted"] = model.Trusted + modelMap["href"] = model.Href + return modelMap, nil +} diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate_test.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate_test.go new file mode 100644 index 0000000000..a4c50e196f --- /dev/null +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate_test.go @@ -0,0 +1,106 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmMqcloudTruststoreCertificateDataSourceBasic(t *testing.T) { + trustStoreCertificateDetailsServiceInstanceGuid := acc.MqcloudInstanceID + trustStoreCertificateDetailsQueueManagerID := acc.MqcloudQueueManagerID + trustStoreCertificateDetailsLabel := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) + trustStoreCertificateDetailsCertificateFile := acc.MqcloudTSCertFilePath + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudTruststoreCertificateDataSourceConfigBasic(trustStoreCertificateDetailsServiceInstanceGuid, trustStoreCertificateDetailsQueueManagerID, trustStoreCertificateDetailsLabel, trustStoreCertificateDetailsCertificateFile), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "service_instance_guid"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "queue_manager_id"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.#"), + resource.TestCheckResourceAttr("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.label", trustStoreCertificateDetailsLabel), + ), + }, + }, + }) +} + +func TestAccIbmMqcloudTruststoreCertificateDataSourceAllArgs(t *testing.T) { + trustStoreCertificateDetailsServiceInstanceGuid := acc.MqcloudInstanceID + trustStoreCertificateDetailsQueueManagerID := acc.MqcloudQueueManagerID + trustStoreCertificateDetailsLabel := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) + trustStoreCertificateDetailsCertificateFile := acc.MqcloudTSCertFilePath + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudTruststoreCertificateDataSourceConfig(trustStoreCertificateDetailsServiceInstanceGuid, trustStoreCertificateDetailsQueueManagerID, trustStoreCertificateDetailsLabel, trustStoreCertificateDetailsCertificateFile), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "service_instance_guid"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "queue_manager_id"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "label"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "total_count"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.#"), + resource.TestCheckResourceAttr("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.label", trustStoreCertificateDetailsLabel), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.certificate_type"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.fingerprint_sha256"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.subject_dn"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.subject_cn"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.issuer_dn"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.issuer_cn"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.issued"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.expiry"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.trusted"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.href"), + ), + }, + }, + }) +} + +func testAccCheckIbmMqcloudTruststoreCertificateDataSourceConfigBasic(trustStoreCertificateDetailsServiceInstanceGuid string, trustStoreCertificateDetailsQueueManagerID string, trustStoreCertificateDetailsLabel string, trustStoreCertificateDetailsCertificateFile string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { + service_instance_guid = "%s" + queue_manager_id = "%s" + label = "%s" + certificate_file = "%s" + } + + data "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { + service_instance_guid = ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance.service_instance_guid + queue_manager_id = ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance.queue_manager_id + label = ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance.label + } + `, trustStoreCertificateDetailsServiceInstanceGuid, trustStoreCertificateDetailsQueueManagerID, trustStoreCertificateDetailsLabel, trustStoreCertificateDetailsCertificateFile) +} + +func testAccCheckIbmMqcloudTruststoreCertificateDataSourceConfig(trustStoreCertificateDetailsServiceInstanceGuid string, trustStoreCertificateDetailsQueueManagerID string, trustStoreCertificateDetailsLabel string, trustStoreCertificateDetailsCertificateFile string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { + service_instance_guid = "%s" + queue_manager_id = "%s" + label = "%s" + certificate_file = "%s" + } + + data "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { + service_instance_guid = ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance.service_instance_guid + queue_manager_id = ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance.queue_manager_id + label = ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance.label + } + `, trustStoreCertificateDetailsServiceInstanceGuid, trustStoreCertificateDetailsQueueManagerID, trustStoreCertificateDetailsLabel, trustStoreCertificateDetailsCertificateFile) +} diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_user.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_user.go new file mode 100644 index 0000000000..259aefa17d --- /dev/null +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_user.go @@ -0,0 +1,166 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func DataSourceIbmMqcloudUser() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmMqcloudUserRead, + + Schema: map[string]*schema.Schema{ + "service_instance_guid": { + Type: schema.TypeString, + Required: true, + Description: "The GUID that uniquely identifies the MQ on Cloud service instance.", + }, + "name": { + Type: schema.TypeString, + Optional: true, + Description: "The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance.", + }, + "users": { + Type: schema.TypeList, + Computed: true, + Description: "List of users.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of the user which was allocated on creation, and can be used for delete calls.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance.", + }, + "email": { + Type: schema.TypeString, + Computed: true, + Description: "The email of the user.", + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for the user details.", + }, + }, + }, + }, + }, + } +} + +func dataSourceIbmMqcloudUserRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Read User failed %s", err)) + } + + serviceInstanceGuid := d.Get("service_instance_guid").(string) + + // Support for pagination + offset := int64(0) + limit := int64(25) + allItems := []mqcloudv1.UserDetails{} + + for { + listUsersOptions := &mqcloudv1.ListUsersOptions{ + ServiceInstanceGuid: &serviceInstanceGuid, + Limit: &limit, + Offset: &offset, + } + + result, response, err := mqcloudClient.ListUsersWithContext(context, listUsersOptions) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error Getting Users %s\n%s", err, response)) + } + if result == nil { + return diag.FromErr(fmt.Errorf("List Users returned nil")) + } + + allItems = append(allItems, result.Users...) + + // Check if the number of returned records is less than the limit + if int64(len(result.Users)) < limit { + break + } + + offset += limit + } + + // Use the provided filter argument and construct a new list with only the requested resource(s) + var matchUsers []mqcloudv1.UserDetails + var name string + var suppliedFilter bool + + if v, ok := d.GetOk("name"); ok { + name = v.(string) + suppliedFilter = true + for _, data := range allItems { + if *data.Name == name { + matchUsers = append(matchUsers, data) + } + } + } else { + matchUsers = allItems + } + + allItems = matchUsers + + if suppliedFilter { + if len(allItems) == 0 { + return diag.FromErr(fmt.Errorf("No Users found with name %s", name)) + } + d.SetId(name) + } else { + d.SetId(dataSourceIbmMqcloudUserID(d)) + } + + mapSlice := []map[string]interface{}{} + for _, modelItem := range allItems { + modelItem := modelItem + modelMap, err := dataSourceIbmMqcloudUserUserDetailsToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + mapSlice = append(mapSlice, modelMap) + } + + if err = d.Set("users", mapSlice); err != nil { + return diag.FromErr(fmt.Errorf("Error setting users %s", err)) + } + + return nil +} + +// dataSourceIbmMqcloudUserID returns a reasonable ID for the list. +func dataSourceIbmMqcloudUserID(d *schema.ResourceData) string { + return time.Now().UTC().String() +} + +func dataSourceIbmMqcloudUserUserDetailsToMap(model *mqcloudv1.UserDetails) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + modelMap["name"] = model.Name + modelMap["email"] = model.Email + modelMap["href"] = model.Href + return modelMap, nil +} diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_user_test.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_user_test.go new file mode 100644 index 0000000000..eb3491817e --- /dev/null +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_user_test.go @@ -0,0 +1,93 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmMqcloudUserDataSourceBasic(t *testing.T) { + userDetailsServiceInstanceGuid := acc.MqcloudInstanceID + userDetailsName := fmt.Sprintf("tfname%d", acctest.RandIntRange(10, 100)) + userDetailsEmail := fmt.Sprintf("tfemail%d@ibm.com", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudUserDataSourceConfigBasic(userDetailsServiceInstanceGuid, userDetailsName, userDetailsEmail), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "service_instance_guid"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "users.#"), + resource.TestCheckResourceAttr("data.ibm_mqcloud_user.mqcloud_user_instance", "users.0.name", userDetailsName), + resource.TestCheckResourceAttr("data.ibm_mqcloud_user.mqcloud_user_instance", "users.0.email", userDetailsEmail), + ), + }, + }, + }) +} + +func TestAccIbmMqcloudUserDataSourceAllArgs(t *testing.T) { + userDetailsServiceInstanceGuid := acc.MqcloudInstanceID + userDetailsName := fmt.Sprintf("tfname%d", acctest.RandIntRange(10, 100)) + userDetailsEmail := fmt.Sprintf("tfemail%d@ibm.com", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudUserDataSourceConfig(userDetailsServiceInstanceGuid, userDetailsName, userDetailsEmail), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "service_instance_guid"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "name"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "users.#"), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "users.0.id"), + resource.TestCheckResourceAttr("data.ibm_mqcloud_user.mqcloud_user_instance", "users.0.name", userDetailsName), + resource.TestCheckResourceAttr("data.ibm_mqcloud_user.mqcloud_user_instance", "users.0.email", userDetailsEmail), + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "users.0.href"), + ), + }, + }, + }) +} + +func testAccCheckIbmMqcloudUserDataSourceConfigBasic(userDetailsServiceInstanceGuid string, userDetailsName string, userDetailsEmail string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_user" "mqcloud_user_instance" { + service_instance_guid = "%s" + name = "%s" + email = "%s" + } + + data "ibm_mqcloud_user" "mqcloud_user_instance" { + service_instance_guid = ibm_mqcloud_user.mqcloud_user_instance.service_instance_guid + name = ibm_mqcloud_user.mqcloud_user_instance.name + } + `, userDetailsServiceInstanceGuid, userDetailsName, userDetailsEmail) +} + +func testAccCheckIbmMqcloudUserDataSourceConfig(userDetailsServiceInstanceGuid string, userDetailsName string, userDetailsEmail string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_user" "mqcloud_user_instance" { + service_instance_guid = "%s" + name = "%s" + email = "%s" + } + + data "ibm_mqcloud_user" "mqcloud_user_instance" { + service_instance_guid = ibm_mqcloud_user.mqcloud_user_instance.service_instance_guid + name = ibm_mqcloud_user.mqcloud_user_instance.name + } + `, userDetailsServiceInstanceGuid, userDetailsName, userDetailsEmail) +} diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_application.go b/ibm/service/mqcloud/resource_ibm_mqcloud_application.go new file mode 100644 index 0000000000..6b317ad242 --- /dev/null +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_application.go @@ -0,0 +1,188 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func ResourceIbmMqcloudApplication() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIbmMqcloudApplicationCreate, + ReadContext: resourceIbmMqcloudApplicationRead, + DeleteContext: resourceIbmMqcloudApplicationDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "service_instance_guid": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_application", "service_instance_guid"), + Description: "The GUID that uniquely identifies the MQ on Cloud service instance.", + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_application", "name"), + Description: "The name of the application - conforming to MQ rules.", + }, + "create_api_key_uri": { + Type: schema.TypeString, + Computed: true, + Description: "The URI to create a new apikey for the application.", + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this application.", + }, + "application_id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of the application which was allocated on creation, and can be used for delete calls.", + }, + }, + } +} + +func ResourceIbmMqcloudApplicationValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "service_instance_guid", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`, + MinValueLength: 36, + MaxValueLength: 36, + }, + validate.ValidateSchema{ + Identifier: "name", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^[a-z][-a-z0-9]*$`, + MinValueLength: 1, + MaxValueLength: 12, + }, + ) + + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_mqcloud_application", Schema: validateSchema} + return &resourceValidator +} + +func resourceIbmMqcloudApplicationCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Create Application failed %s", err)) + } + + createApplicationOptions := &mqcloudv1.CreateApplicationOptions{} + + createApplicationOptions.SetServiceInstanceGuid(d.Get("service_instance_guid").(string)) + createApplicationOptions.SetName(d.Get("name").(string)) + + applicationCreated, response, err := mqcloudClient.CreateApplicationWithContext(context, createApplicationOptions) + if err != nil { + log.Printf("[DEBUG] CreateApplicationWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CreateApplicationWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s/%s", *createApplicationOptions.ServiceInstanceGuid, *applicationCreated.ID)) + + return resourceIbmMqcloudApplicationRead(context, d, meta) +} + +func resourceIbmMqcloudApplicationRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + + getApplicationOptions := &mqcloudv1.GetApplicationOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + getApplicationOptions.SetServiceInstanceGuid(parts[0]) + getApplicationOptions.SetApplicationID(parts[1]) + + applicationDetails, response, err := mqcloudClient.GetApplicationWithContext(context, getApplicationOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetApplicationWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetApplicationWithContext failed %s\n%s", err, response)) + } + + if err = d.Set("name", applicationDetails.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + if err = d.Set("service_instance_guid", parts[0]); err != nil { + return diag.FromErr(fmt.Errorf("Error setting service instance guid: %s", err)) + } + if err = d.Set("create_api_key_uri", applicationDetails.CreateApiKeyURI); err != nil { + return diag.FromErr(fmt.Errorf("Error setting create_api_key_uri: %s", err)) + } + if err = d.Set("href", applicationDetails.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + if err = d.Set("application_id", applicationDetails.ID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting application_id: %s", err)) + } + + return nil +} + +func resourceIbmMqcloudApplicationDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Delete Application failed %s", err)) + } + + deleteApplicationOptions := &mqcloudv1.DeleteApplicationOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + deleteApplicationOptions.SetServiceInstanceGuid(parts[0]) + deleteApplicationOptions.SetApplicationID(parts[1]) + + response, err := mqcloudClient.DeleteApplicationWithContext(context, deleteApplicationOptions) + if err != nil { + log.Printf("[DEBUG] DeleteApplicationWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteApplicationWithContext failed %s\n%s", err, response)) + } + + d.SetId("") + + return nil +} diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_application_test.go b/ibm/service/mqcloud/resource_ibm_mqcloud_application_test.go new file mode 100644 index 0000000000..b780d789d1 --- /dev/null +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_application_test.go @@ -0,0 +1,150 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func TestAccIbmMqcloudApplicationBasic(t *testing.T) { + var conf mqcloudv1.ApplicationDetails + serviceInstanceGuid := acc.MqcloudInstanceID + name := "appbasic" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmMqcloudApplicationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudApplicationConfigBasic(serviceInstanceGuid, name), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmMqcloudApplicationExists("ibm_mqcloud_application.mqcloud_application_instance", conf), + resource.TestCheckResourceAttr("ibm_mqcloud_application.mqcloud_application_instance", "service_instance_guid", serviceInstanceGuid), + resource.TestCheckResourceAttr("ibm_mqcloud_application.mqcloud_application_instance", "name", name), + ), + }, + }, + }) +} + +func TestAccIbmMqcloudApplicationAllArgs(t *testing.T) { + var conf mqcloudv1.ApplicationDetails + serviceInstanceGuid := acc.MqcloudInstanceID + name := "appallargs" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmMqcloudApplicationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudApplicationConfig(serviceInstanceGuid, name), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmMqcloudApplicationExists("ibm_mqcloud_application.mqcloud_application_instance", conf), + resource.TestCheckResourceAttr("ibm_mqcloud_application.mqcloud_application_instance", "service_instance_guid", serviceInstanceGuid), + resource.TestCheckResourceAttr("ibm_mqcloud_application.mqcloud_application_instance", "name", name), + ), + }, + { + ResourceName: "ibm_mqcloud_application.mqcloud_application_instance", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccCheckIbmMqcloudApplicationConfigBasic(serviceInstanceGuid string, name string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_application" "mqcloud_application_instance" { + service_instance_guid = "%s" + name = "%s" + } + `, serviceInstanceGuid, name) +} + +func testAccCheckIbmMqcloudApplicationConfig(serviceInstanceGuid string, name string) string { + return fmt.Sprintf(` + + resource "ibm_mqcloud_application" "mqcloud_application_instance" { + service_instance_guid = "%s" + name = "%s" + } + `, serviceInstanceGuid, name) +} + +func testAccCheckIbmMqcloudApplicationExists(n string, obj mqcloudv1.ApplicationDetails) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + mqcloudClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).MqcloudV1() + if err != nil { + return err + } + + getApplicationOptions := &mqcloudv1.GetApplicationOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getApplicationOptions.SetServiceInstanceGuid(parts[0]) + getApplicationOptions.SetApplicationID(parts[1]) + + applicationDetails, _, err := mqcloudClient.GetApplication(getApplicationOptions) + if err != nil { + return err + } + + obj = *applicationDetails + return nil + } +} + +func testAccCheckIbmMqcloudApplicationDestroy(s *terraform.State) error { + mqcloudClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).MqcloudV1() + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_mqcloud_application" { + continue + } + + getApplicationOptions := &mqcloudv1.GetApplicationOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getApplicationOptions.SetServiceInstanceGuid(parts[0]) + getApplicationOptions.SetApplicationID(parts[1]) + + // Try to find the key + _, response, err := mqcloudClient.GetApplication(getApplicationOptions) + + if err == nil { + return fmt.Errorf("mqcloud_application still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for mqcloud_application (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate.go b/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate.go new file mode 100644 index 0000000000..859d0aa5cc --- /dev/null +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate.go @@ -0,0 +1,314 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud + +import ( + "context" + "fmt" + "io" + "log" + "os" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func ResourceIbmMqcloudKeystoreCertificate() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIbmMqcloudKeystoreCertificateCreate, + ReadContext: resourceIbmMqcloudKeystoreCertificateRead, + DeleteContext: resourceIbmMqcloudKeystoreCertificateDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "service_instance_guid": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_keystore_certificate", "service_instance_guid"), + Description: "The GUID that uniquely identifies the MQ on Cloud service instance.", + }, + "queue_manager_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_keystore_certificate", "queue_manager_id"), + Description: "The id of the queue manager to retrieve its full details.", + }, + "label": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_keystore_certificate", "label"), + Description: "Certificate label in queue manager store.", + }, + "certificate_type": { + Type: schema.TypeString, + Computed: true, + Description: "The type of certificate.", + }, + "fingerprint_sha256": { + Type: schema.TypeString, + Computed: true, + Description: "Fingerprint SHA256.", + }, + "subject_dn": { + Type: schema.TypeString, + Computed: true, + Description: "Subject's Distinguished Name.", + }, + "subject_cn": { + Type: schema.TypeString, + Computed: true, + Description: "Subject's Common Name.", + }, + "issuer_dn": { + Type: schema.TypeString, + Computed: true, + Description: "Issuer's Distinguished Name.", + }, + "issuer_cn": { + Type: schema.TypeString, + Computed: true, + Description: "Issuer's Common Name.", + }, + "issued": { + Type: schema.TypeString, + Computed: true, + Description: "Date certificate was issued.", + }, + "expiry": { + Type: schema.TypeString, + Computed: true, + Description: "Expiry date for the certificate.", + }, + "is_default": { + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether it is the queue manager's default certificate.", + }, + "dns_names_total_count": { + Type: schema.TypeInt, + Computed: true, + Description: "The total count of dns names.", + }, + "dns_names": { + Type: schema.TypeList, + Computed: true, + Description: "The list of DNS names.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this key store certificate.", + }, + "certificate_id": { + Type: schema.TypeString, + Computed: true, + Description: "ID of the certificate.", + }, + "certificate_file": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The filename and path of the certificate to be uploaded.", + }, + }, + } +} + +func ResourceIbmMqcloudKeystoreCertificateValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "service_instance_guid", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`, + MinValueLength: 36, + MaxValueLength: 36, + }, + validate.ValidateSchema{ + Identifier: "queue_manager_id", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^[0-9a-fA-F]{32}$`, + MinValueLength: 32, + MaxValueLength: 32, + }, + validate.ValidateSchema{ + Identifier: "label", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^[a-zA-Z0-9_.]*$`, + MinValueLength: 1, + MaxValueLength: 64, + }, + ) + + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_mqcloud_keystore_certificate", Schema: validateSchema} + return &resourceValidator +} + +func resourceIbmMqcloudKeystoreCertificateCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Create Keystore Certificate failed %s", err)) + } + createKeyStorePemCertificateOptions := &mqcloudv1.CreateKeyStorePemCertificateOptions{} + + createKeyStorePemCertificateOptions.SetServiceInstanceGuid(d.Get("service_instance_guid").(string)) + createKeyStorePemCertificateOptions.SetQueueManagerID(d.Get("queue_manager_id").(string)) + createKeyStorePemCertificateOptions.SetLabel(d.Get("label").(string)) + //Custom code to read certs and pass to SDK + certBytes, err := os.ReadFile(d.Get("certificate_file").(string)) // just pass the file name + if err != nil { + fmt.Print(err) + } + certString := string(certBytes) // convert content to a 'string' + rc := io.NopCloser(strings.NewReader(certString)) + // certificateFileModel, err := resourceIbmMqcloudKeystoreCertificateMapToio.ReadCloser(d.Get("certificate_file.0").(map[string]interface{})) + // if err != nil { + // return diag.FromErr(err) + // } + createKeyStorePemCertificateOptions.SetCertificateFile(rc) + + keyStoreCertificateDetails, response, err := mqcloudClient.CreateKeyStorePemCertificateWithContext(context, createKeyStorePemCertificateOptions) + if err != nil { + log.Printf("[DEBUG] CreateKeyStorePemCertificateWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CreateKeyStorePemCertificateWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s/%s/%s", *createKeyStorePemCertificateOptions.ServiceInstanceGuid, *createKeyStorePemCertificateOptions.QueueManagerID, *keyStoreCertificateDetails.ID)) + + return resourceIbmMqcloudKeystoreCertificateRead(context, d, meta) +} + +func resourceIbmMqcloudKeystoreCertificateRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + + getKeyStoreCertificateOptions := &mqcloudv1.GetKeyStoreCertificateOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + getKeyStoreCertificateOptions.SetServiceInstanceGuid(parts[0]) + getKeyStoreCertificateOptions.SetQueueManagerID(parts[1]) + getKeyStoreCertificateOptions.SetCertificateID(parts[2]) + + keyStoreCertificateDetails, response, err := mqcloudClient.GetKeyStoreCertificateWithContext(context, getKeyStoreCertificateOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetKeyStoreCertificateWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetKeyStoreCertificateWithContext failed %s\n%s", err, response)) + } + if err = d.Set("service_instance_guid", parts[0]); err != nil { + return diag.FromErr(fmt.Errorf("Error setting service_instance_guid: %s", err)) + } + if err = d.Set("queue_manager_id", parts[1]); err != nil { + return diag.FromErr(fmt.Errorf("Error setting queue_manager_id: %s", err)) + } + downloadCertificatePath := "./certificates/keystore/" + *keyStoreCertificateDetails.Label + ".pem" + if err = d.Set("certificate_file", downloadCertificatePath); err != nil { + return diag.FromErr(fmt.Errorf("Error setting certificate_file: %s", err)) + } + if err = d.Set("label", keyStoreCertificateDetails.Label); err != nil { + return diag.FromErr(fmt.Errorf("Error setting label: %s", err)) + } + if err = d.Set("certificate_type", keyStoreCertificateDetails.CertificateType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting certificate_type: %s", err)) + } + if err = d.Set("fingerprint_sha256", keyStoreCertificateDetails.FingerprintSha256); err != nil { + return diag.FromErr(fmt.Errorf("Error setting fingerprint_sha256: %s", err)) + } + if err = d.Set("subject_dn", keyStoreCertificateDetails.SubjectDn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting subject_dn: %s", err)) + } + if err = d.Set("subject_cn", keyStoreCertificateDetails.SubjectCn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting subject_cn: %s", err)) + } + if err = d.Set("issuer_dn", keyStoreCertificateDetails.IssuerDn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting issuer_dn: %s", err)) + } + if err = d.Set("issuer_cn", keyStoreCertificateDetails.IssuerCn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting issuer_cn: %s", err)) + } + if err = d.Set("issued", flex.DateTimeToString(keyStoreCertificateDetails.Issued)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting issued: %s", err)) + } + if err = d.Set("expiry", flex.DateTimeToString(keyStoreCertificateDetails.Expiry)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting expiry: %s", err)) + } + if err = d.Set("is_default", keyStoreCertificateDetails.IsDefault); err != nil { + return diag.FromErr(fmt.Errorf("Error setting is_default: %s", err)) + } + if err = d.Set("dns_names_total_count", flex.IntValue(keyStoreCertificateDetails.DnsNamesTotalCount)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting dns_names_total_count: %s", err)) + } + if err = d.Set("dns_names", keyStoreCertificateDetails.DnsNames); err != nil { + return diag.FromErr(fmt.Errorf("Error setting dns_names: %s", err)) + } + if err = d.Set("href", keyStoreCertificateDetails.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + if err = d.Set("certificate_id", keyStoreCertificateDetails.ID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting certificate_id: %s", err)) + } + + return nil +} + +func resourceIbmMqcloudKeystoreCertificateDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Delete Keystore Certificate failed %s", err)) + } + + deleteKeyStoreCertificateOptions := &mqcloudv1.DeleteKeyStoreCertificateOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + deleteKeyStoreCertificateOptions.SetServiceInstanceGuid(parts[0]) + deleteKeyStoreCertificateOptions.SetQueueManagerID(parts[1]) + deleteKeyStoreCertificateOptions.SetCertificateID(parts[2]) + + response, err := mqcloudClient.DeleteKeyStoreCertificateWithContext(context, deleteKeyStoreCertificateOptions) + if err != nil { + log.Printf("[DEBUG] DeleteKeyStoreCertificateWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteKeyStoreCertificateWithContext failed %s\n%s", err, response)) + } + + d.SetId("") + + return nil +} diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate_test.go b/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate_test.go new file mode 100644 index 0000000000..5041c8ed77 --- /dev/null +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate_test.go @@ -0,0 +1,163 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func TestAccIbmMqcloudKeystoreCertificateBasic(t *testing.T) { + var conf mqcloudv1.KeyStoreCertificateDetails + serviceInstanceGuid := acc.MqcloudInstanceID + queueManagerID := acc.MqcloudQueueManagerID + label := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) + certificateFile := acc.MqcloudKSCertFilePath + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmMqcloudKeystoreCertificateDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudKeystoreCertificateConfigBasic(serviceInstanceGuid, queueManagerID, label, certificateFile), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmMqcloudKeystoreCertificateExists("ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", conf), + resource.TestCheckResourceAttr("ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "service_instance_guid", serviceInstanceGuid), + resource.TestCheckResourceAttr("ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "queue_manager_id", queueManagerID), + resource.TestCheckResourceAttr("ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "label", label), + ), + }, + }, + }) +} + +func TestAccIbmMqcloudKeystoreCertificateAllArgs(t *testing.T) { + var conf mqcloudv1.KeyStoreCertificateDetails + serviceInstanceGuid := acc.MqcloudInstanceID + queueManagerID := acc.MqcloudQueueManagerID + label := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) + certificateFile := acc.MqcloudKSCertFilePath + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmMqcloudKeystoreCertificateDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudKeystoreCertificateConfig(serviceInstanceGuid, queueManagerID, label, certificateFile), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmMqcloudKeystoreCertificateExists("ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", conf), + resource.TestCheckResourceAttr("ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "service_instance_guid", serviceInstanceGuid), + resource.TestCheckResourceAttr("ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "queue_manager_id", queueManagerID), + resource.TestCheckResourceAttr("ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "label", label), + ), + }, + { + ResourceName: "ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccCheckIbmMqcloudKeystoreCertificateConfigBasic(serviceInstanceGuid string, queueManagerID string, label string, certificateFile string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { + service_instance_guid = "%s" + queue_manager_id = "%s" + label = "%s" + certificate_file = "%s" + } + `, serviceInstanceGuid, queueManagerID, label, certificateFile) +} + +func testAccCheckIbmMqcloudKeystoreCertificateConfig(serviceInstanceGuid string, queueManagerID string, label string, certificateFile string) string { + return fmt.Sprintf(` + + resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { + service_instance_guid = "%s" + queue_manager_id = "%s" + label = "%s" + certificate_file = "%s" + } + `, serviceInstanceGuid, queueManagerID, label, certificateFile) +} + +func testAccCheckIbmMqcloudKeystoreCertificateExists(n string, obj mqcloudv1.KeyStoreCertificateDetails) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + mqcloudClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).MqcloudV1() + if err != nil { + return err + } + + getKeyStoreCertificateOptions := &mqcloudv1.GetKeyStoreCertificateOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getKeyStoreCertificateOptions.SetServiceInstanceGuid(parts[0]) + getKeyStoreCertificateOptions.SetQueueManagerID(parts[1]) + getKeyStoreCertificateOptions.SetCertificateID(parts[2]) + + keyStoreCertificateDetails, _, err := mqcloudClient.GetKeyStoreCertificate(getKeyStoreCertificateOptions) + if err != nil { + return err + } + + obj = *keyStoreCertificateDetails + return nil + } +} + +func testAccCheckIbmMqcloudKeystoreCertificateDestroy(s *terraform.State) error { + mqcloudClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).MqcloudV1() + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_mqcloud_keystore_certificate" { + continue + } + + getKeyStoreCertificateOptions := &mqcloudv1.GetKeyStoreCertificateOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getKeyStoreCertificateOptions.SetServiceInstanceGuid(parts[0]) + getKeyStoreCertificateOptions.SetQueueManagerID(parts[1]) + getKeyStoreCertificateOptions.SetCertificateID(parts[2]) + + // Try to find the key + _, response, err := mqcloudClient.GetKeyStoreCertificate(getKeyStoreCertificateOptions) + + if err == nil { + return fmt.Errorf("mqcloud_keystore_certificate still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for mqcloud_keystore_certificate (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager.go b/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager.go new file mode 100644 index 0000000000..a94f6fa5c9 --- /dev/null +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager.go @@ -0,0 +1,415 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func ResourceIbmMqcloudQueueManager() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIbmMqcloudQueueManagerCreate, + ReadContext: resourceIbmMqcloudQueueManagerRead, + UpdateContext: resourceIbmMqcloudQueueManagerUpdate, + DeleteContext: resourceIbmMqcloudQueueManagerDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "service_instance_guid": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_queue_manager", "service_instance_guid"), + Description: "The GUID that uniquely identifies the MQ on Cloud service instance.", + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_queue_manager", "name"), + Description: "A queue manager name conforming to MQ restrictions.", + }, + "display_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_queue_manager", "display_name"), + Description: "A displayable name for the queue manager - limited only in length.", + }, + "location": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_queue_manager", "location"), + Description: "The locations in which the queue manager could be deployed.", + }, + "size": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_queue_manager", "size"), + Description: "The queue manager sizes of deployment available. Deployment of lite queue managers for aws_us_east_1 and aws_eu_west_1 locations is not available.", + }, + "version": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_queue_manager", "version"), + Description: "The MQ version of the queue manager.", + }, + "status_uri": { + Type: schema.TypeString, + Computed: true, + Description: "A reference uri to get deployment status of the queue manager.", + }, + "web_console_url": { + Type: schema.TypeString, + Computed: true, + Description: "The url through which to access the web console for this queue manager.", + }, + "rest_api_endpoint_url": { + Type: schema.TypeString, + Computed: true, + Description: "The url through which to access REST APIs for this queue manager.", + }, + "administrator_api_endpoint_url": { + Type: schema.TypeString, + Computed: true, + Description: "The url through which to access the Admin REST APIs for this queue manager.", + }, + "connection_info_uri": { + Type: schema.TypeString, + Computed: true, + Description: "The uri through which the CDDT for this queue manager can be obtained.", + }, + "date_created": { + Type: schema.TypeString, + Computed: true, + Description: "RFC3339 formatted UTC date for when the queue manager was created.", + }, + "upgrade_available": { + Type: schema.TypeBool, + Computed: true, + Description: "Describes whether an upgrade is available for this queue manager.", + }, + "available_upgrade_versions_uri": { + Type: schema.TypeString, + Computed: true, + Description: "The uri through which the available versions to upgrade to can be found for this queue manager.", + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this queue manager.", + }, + "queue_manager_id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of the queue manager which was allocated on creation, and can be used for delete calls.", + }, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(15 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + Update: schema.DefaultTimeout(5 * time.Minute), + }, + } +} + +func ResourceIbmMqcloudQueueManagerValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "service_instance_guid", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`, + MinValueLength: 36, + MaxValueLength: 36, + }, + validate.ValidateSchema{ + Identifier: "name", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^[a-zA-Z0-9_.]*$`, + MinValueLength: 1, + MaxValueLength: 48, + }, + validate.ValidateSchema{ + Identifier: "display_name", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Optional: true, + Regexp: `^.*$`, + MinValueLength: 0, + MaxValueLength: 150, + }, + validate.ValidateSchema{ + Identifier: "location", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^([^[:ascii:]]|[a-zA-Z0-9-._: ])+$`, + MinValueLength: 2, + MaxValueLength: 150, + }, + validate.ValidateSchema{ + Identifier: "size", + ValidateFunctionIdentifier: validate.ValidateAllowedStringValue, + Type: validate.TypeString, + Required: true, + AllowedValues: "large, lite, medium, small, xsmall", + }, + validate.ValidateSchema{ + Identifier: "version", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Optional: true, + Regexp: `^[0-9]+.[0-9]+.[0-9]+_[0-9]+$`, + MinValueLength: 7, + MaxValueLength: 15, + }, + ) + + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_mqcloud_queue_manager", Schema: validateSchema} + return &resourceValidator +} + +func resourceIbmMqcloudQueueManagerCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Create Queue Manager failed %s", err)) + } + + createQueueManagerOptions := &mqcloudv1.CreateQueueManagerOptions{} + + createQueueManagerOptions.SetServiceInstanceGuid(d.Get("service_instance_guid").(string)) + createQueueManagerOptions.SetName(d.Get("name").(string)) + createQueueManagerOptions.SetLocation(d.Get("location").(string)) + createQueueManagerOptions.SetSize(d.Get("size").(string)) + if _, ok := d.GetOk("display_name"); ok { + createQueueManagerOptions.SetDisplayName(d.Get("display_name").(string)) + } + if _, ok := d.GetOk("version"); ok { + createQueueManagerOptions.SetVersion(d.Get("version").(string)) + } + + queueManagerTaskStatus, response, err := mqcloudClient.CreateQueueManagerWithContext(context, createQueueManagerOptions) + if err != nil { + log.Printf("[DEBUG] CreateQueueManagerWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CreateQueueManagerWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s/%s", *createQueueManagerOptions.ServiceInstanceGuid, *queueManagerTaskStatus.QueueManagerID)) + if waitForQmStatus { + _, err = waitForQmStatusUpdate(context, d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error waiting for Queue Manager (%s) to be in running state: %s", *queueManagerTaskStatus.QueueManagerID, err)) + } + } + d.SetId(fmt.Sprintf("%s/%s", *createQueueManagerOptions.ServiceInstanceGuid, *queueManagerTaskStatus.QueueManagerID)) + + return resourceIbmMqcloudQueueManagerRead(context, d, meta) +} + +func resourceIbmMqcloudQueueManagerRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + + getQueueManagerOptions := &mqcloudv1.GetQueueManagerOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + getQueueManagerOptions.SetServiceInstanceGuid(parts[0]) + getQueueManagerOptions.SetQueueManagerID(parts[1]) + + var queueManagerDetails *mqcloudv1.QueueManagerDetails + var response *core.DetailedResponse + + err = resource.RetryContext(context, 10*time.Second, func() *resource.RetryError { + queueManagerDetails, response, err = mqcloudClient.GetQueueManagerWithContext(context, getQueueManagerOptions) + if err != nil || response == nil { + if response.StatusCode == 404 { + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetQueueManagerWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetQueueManagerWithContext failed %s\n%s", err, response)) + } + + if err = d.Set("service_instance_guid", parts[0]); err != nil { + return diag.FromErr(fmt.Errorf("Error setting service_instance_guid: %s", err)) + } + if err = d.Set("name", queueManagerDetails.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + if !core.IsNil(queueManagerDetails.DisplayName) { + if err = d.Set("display_name", queueManagerDetails.DisplayName); err != nil { + return diag.FromErr(fmt.Errorf("Error setting display_name: %s", err)) + } + } + if err = d.Set("location", queueManagerDetails.Location); err != nil { + return diag.FromErr(fmt.Errorf("Error setting location: %s", err)) + } + if err = d.Set("size", queueManagerDetails.Size); err != nil { + return diag.FromErr(fmt.Errorf("Error setting size: %s", err)) + } + if !core.IsNil(queueManagerDetails.Version) { + if err = d.Set("version", queueManagerDetails.Version); err != nil { + return diag.FromErr(fmt.Errorf("Error setting version: %s", err)) + } + } + if err = d.Set("status_uri", queueManagerDetails.StatusURI); err != nil { + return diag.FromErr(fmt.Errorf("Error setting status_uri: %s", err)) + } + if err = d.Set("web_console_url", queueManagerDetails.WebConsoleURL); err != nil { + return diag.FromErr(fmt.Errorf("Error setting web_console_url: %s", err)) + } + if err = d.Set("rest_api_endpoint_url", queueManagerDetails.RestApiEndpointURL); err != nil { + return diag.FromErr(fmt.Errorf("Error setting rest_api_endpoint_url: %s", err)) + } + if err = d.Set("administrator_api_endpoint_url", queueManagerDetails.AdministratorApiEndpointURL); err != nil { + return diag.FromErr(fmt.Errorf("Error setting administrator_api_endpoint_url: %s", err)) + } + if err = d.Set("connection_info_uri", queueManagerDetails.ConnectionInfoURI); err != nil { + return diag.FromErr(fmt.Errorf("Error setting connection_info_uri: %s", err)) + } + if err = d.Set("date_created", flex.DateTimeToString(queueManagerDetails.DateCreated)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting date_created: %s", err)) + } + if err = d.Set("upgrade_available", queueManagerDetails.UpgradeAvailable); err != nil { + return diag.FromErr(fmt.Errorf("Error setting upgrade_available: %s", err)) + } + if err = d.Set("available_upgrade_versions_uri", queueManagerDetails.AvailableUpgradeVersionsURI); err != nil { + return diag.FromErr(fmt.Errorf("Error setting available_upgrade_versions_uri: %s", err)) + } + if err = d.Set("href", queueManagerDetails.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + if err = d.Set("queue_manager_id", queueManagerDetails.ID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting queue_manager_id: %s", err)) + } + + return nil +} + +func resourceIbmMqcloudQueueManagerUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Update Queue Manager failed %s", err)) + } + + setQueueManagerVersionOptions := &mqcloudv1.SetQueueManagerVersionOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + setQueueManagerVersionOptions.SetServiceInstanceGuid(parts[0]) + setQueueManagerVersionOptions.SetQueueManagerID(parts[1]) + + hasChange := false + + if d.HasChange("version") { + oldVersion, newVersion := d.GetChange("version") + if IsVersionDowngrade(oldVersion.(string), newVersion.(string)) { + return diag.FromErr(fmt.Errorf("Version downgrade is not allowed")) + } + setQueueManagerVersionOptions.SetVersion(newVersion.(string)) + hasChange = true + } + + if hasChange { + _, response, err := mqcloudClient.SetQueueManagerVersionWithContext(context, setQueueManagerVersionOptions) + if err != nil { + log.Printf("[DEBUG] SetQueueManagerVersionWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("SetQueueManagerVersionWithContext failed %s\n%s", err, response)) + } + if waitForQmStatus { + _, err = waitForQmStatusUpdate(context, d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error waiting for Queue Manager (%s) to be in running state: %s", *setQueueManagerVersionOptions.QueueManagerID, err)) + } + } + } + + return resourceIbmMqcloudQueueManagerRead(context, d, meta) +} + +func resourceIbmMqcloudQueueManagerDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Delete Queue Manager failed %s", err)) + } + + deleteQueueManagerOptions := &mqcloudv1.DeleteQueueManagerOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + deleteQueueManagerOptions.SetServiceInstanceGuid(parts[0]) + deleteQueueManagerOptions.SetQueueManagerID(parts[1]) + + _, response, err := mqcloudClient.DeleteQueueManagerWithContext(context, deleteQueueManagerOptions) + if err != nil { + log.Printf("[DEBUG] DeleteQueueManagerWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteQueueManagerWithContext failed %s\n%s", err, response)) + } + if waitForQmStatus { + _, err = waitForQueueManagerToDelete(context, d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error waiting for Queue Manager (%s) to be in running state: %s", *deleteQueueManagerOptions.QueueManagerID, err)) + } + } + d.SetId("") + + return nil +} diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager_test.go b/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager_test.go new file mode 100644 index 0000000000..a6ccbd7feb --- /dev/null +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager_test.go @@ -0,0 +1,182 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func TestAccIbmMqcloudQueueManagerBasic(t *testing.T) { + t.Parallel() + var conf mqcloudv1.QueueManagerDetails + serviceInstanceGuid := acc.MqcloudInstanceID + name := "queue_manager_basic" + location := "ibmcloud_eu_de" + size := "small" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmMqcloudQueueManagerDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudQueueManagerConfigBasic(serviceInstanceGuid, name, location, size), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmMqcloudQueueManagerExists("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", conf), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "service_instance_guid", serviceInstanceGuid), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "name", name), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "location", location), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "size", size), + ), + }, + }, + }) +} + +func TestAccIbmMqcloudQueueManagerAllArgs(t *testing.T) { + t.Parallel() + var conf mqcloudv1.QueueManagerDetails + serviceInstanceGuid := acc.MqcloudInstanceID + name := "queue_manager_allargs" + displayName := "queue_manager_allargs" + location := "ibmcloud_eu_de" + size := "small" + version := "9.3.3_3" + versionUpdate := "9.3.4_1" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmMqcloudQueueManagerDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudQueueManagerConfig(serviceInstanceGuid, name, displayName, location, size, version), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmMqcloudQueueManagerExists("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", conf), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "service_instance_guid", serviceInstanceGuid), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "name", name), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "display_name", displayName), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "location", location), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "size", size), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "version", version), + ), + }, + { + Config: testAccCheckIbmMqcloudQueueManagerConfig(serviceInstanceGuid, name, displayName, location, size, versionUpdate), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "service_instance_guid", serviceInstanceGuid), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "name", name), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "display_name", displayName), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "location", location), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "size", size), + resource.TestCheckResourceAttr("ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", "version", versionUpdate), + ), + }, + { + ResourceName: "ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccCheckIbmMqcloudQueueManagerConfigBasic(serviceInstanceGuid string, name string, location string, size string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" { + service_instance_guid = "%s" + name = "%s" + location = "%s" + size = "%s" + } + `, serviceInstanceGuid, name, location, size) +} + +func testAccCheckIbmMqcloudQueueManagerConfig(serviceInstanceGuid string, name string, displayName string, location string, size string, version string) string { + return fmt.Sprintf(` + + resource "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" { + service_instance_guid = "%s" + name = "%s" + display_name = "%s" + location = "%s" + size = "%s" + version = "%s" + } + `, serviceInstanceGuid, name, displayName, location, size, version) +} + +func testAccCheckIbmMqcloudQueueManagerExists(n string, obj mqcloudv1.QueueManagerDetails) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + mqcloudClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).MqcloudV1() + if err != nil { + return err + } + + getQueueManagerOptions := &mqcloudv1.GetQueueManagerOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getQueueManagerOptions.SetServiceInstanceGuid(parts[0]) + getQueueManagerOptions.SetQueueManagerID(parts[1]) + + queueManagerDetails, _, err := mqcloudClient.GetQueueManager(getQueueManagerOptions) + if err != nil { + return err + } + + obj = *queueManagerDetails + return nil + } +} + +func testAccCheckIbmMqcloudQueueManagerDestroy(s *terraform.State) error { + mqcloudClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).MqcloudV1() + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_mqcloud_queue_manager" { + continue + } + + getQueueManagerOptions := &mqcloudv1.GetQueueManagerOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getQueueManagerOptions.SetServiceInstanceGuid(parts[0]) + getQueueManagerOptions.SetQueueManagerID(parts[1]) + + // Try to find the key + _, response, err := mqcloudClient.GetQueueManager(getQueueManagerOptions) + + if err == nil { + return fmt.Errorf("mqcloud_queue_manager_instance still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for mqcloud_queue_manager_instance (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate.go b/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate.go new file mode 100644 index 0000000000..63a35c247e --- /dev/null +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate.go @@ -0,0 +1,297 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud + +import ( + "context" + "fmt" + "io" + "log" + "os" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func ResourceIbmMqcloudTruststoreCertificate() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIbmMqcloudTruststoreCertificateCreate, + ReadContext: resourceIbmMqcloudTruststoreCertificateRead, + DeleteContext: resourceIbmMqcloudTruststoreCertificateDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "service_instance_guid": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_truststore_certificate", "service_instance_guid"), + Description: "The GUID that uniquely identifies the MQ on Cloud service instance.", + }, + "queue_manager_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_truststore_certificate", "queue_manager_id"), + Description: "The id of the queue manager to retrieve its full details.", + }, + "label": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_truststore_certificate", "label"), + Description: "Certificate label in queue manager store.", + }, + "certificate_type": { + Type: schema.TypeString, + Computed: true, + Description: "The type of certificate.", + }, + "fingerprint_sha256": { + Type: schema.TypeString, + Computed: true, + Description: "Fingerprint SHA256.", + }, + "subject_dn": { + Type: schema.TypeString, + Computed: true, + Description: "Subject's Distinguished Name.", + }, + "subject_cn": { + Type: schema.TypeString, + Computed: true, + Description: "Subject's Common Name.", + }, + "issuer_dn": { + Type: schema.TypeString, + Computed: true, + Description: "Issuer's Distinguished Name.", + }, + "issuer_cn": { + Type: schema.TypeString, + Computed: true, + Description: "Issuer's Common Name.", + }, + "issued": { + Type: schema.TypeString, + Computed: true, + Description: "The Date the certificate was issued.", + }, + "expiry": { + Type: schema.TypeString, + Computed: true, + Description: "Expiry date for the certificate.", + }, + "trusted": { + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether a certificate is trusted.", + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this trust store certificate.", + }, + "certificate_id": { + Type: schema.TypeString, + Computed: true, + Description: "Id of the certificate.", + }, + "certificate_file": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The filename and path of the certificate to be uploaded.", + }, + }, + } +} + +func ResourceIbmMqcloudTruststoreCertificateValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "service_instance_guid", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`, + MinValueLength: 36, + MaxValueLength: 36, + }, + validate.ValidateSchema{ + Identifier: "queue_manager_id", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^[0-9a-fA-F]{32}$`, + MinValueLength: 32, + MaxValueLength: 32, + }, + validate.ValidateSchema{ + Identifier: "label", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^[a-zA-Z0-9_.]*$`, + MinValueLength: 1, + MaxValueLength: 64, + }, + ) + + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_mqcloud_truststore_certificate", Schema: validateSchema} + return &resourceValidator +} + +func resourceIbmMqcloudTruststoreCertificateCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Create Truststore Certificate failed %s", err)) + } + + createTrustStorePemCertificateOptions := &mqcloudv1.CreateTrustStorePemCertificateOptions{} + + createTrustStorePemCertificateOptions.SetServiceInstanceGuid(d.Get("service_instance_guid").(string)) + createTrustStorePemCertificateOptions.SetQueueManagerID(d.Get("queue_manager_id").(string)) + createTrustStorePemCertificateOptions.SetLabel(d.Get("label").(string)) + //Custom code to read certs and pass to SDK + certBytes, err := os.ReadFile(d.Get("certificate_file").(string)) // just pass the file name + if err != nil { + fmt.Print(err) + } + certString := string(certBytes) // convert content to a 'string' + rc := io.NopCloser(strings.NewReader(certString)) + // certificateFileModel, err := resourceIbmMqcloudTruststoreCertificateMapToio.ReadCloser(d.Get("certificate_file.0").(map[string]interface{})) + // if err != nil { + // return diag.FromErr(err) + // } + createTrustStorePemCertificateOptions.SetCertificateFile(rc) + + trustStoreCertificateDetails, response, err := mqcloudClient.CreateTrustStorePemCertificateWithContext(context, createTrustStorePemCertificateOptions) + if err != nil { + log.Printf("[DEBUG] CreateTrustStorePemCertificateWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CreateTrustStorePemCertificateWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s/%s/%s", *createTrustStorePemCertificateOptions.ServiceInstanceGuid, *createTrustStorePemCertificateOptions.QueueManagerID, *trustStoreCertificateDetails.ID)) + + return resourceIbmMqcloudTruststoreCertificateRead(context, d, meta) +} + +func resourceIbmMqcloudTruststoreCertificateRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + + getTrustStoreCertificateOptions := &mqcloudv1.GetTrustStoreCertificateOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + getTrustStoreCertificateOptions.SetServiceInstanceGuid(parts[0]) + getTrustStoreCertificateOptions.SetQueueManagerID(parts[1]) + getTrustStoreCertificateOptions.SetCertificateID(parts[2]) + + trustStoreCertificateDetails, response, err := mqcloudClient.GetTrustStoreCertificateWithContext(context, getTrustStoreCertificateOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetTrustStoreCertificateWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetTrustStoreCertificateWithContext failed %s\n%s", err, response)) + } + if err = d.Set("service_instance_guid", parts[0]); err != nil { + return diag.FromErr(fmt.Errorf("Error setting service_instance_guid: %s", err)) + } + if err = d.Set("queue_manager_id", parts[1]); err != nil { + return diag.FromErr(fmt.Errorf("Error setting queue_manager_id: %s", err)) + } + downloadCertificatePath := "./certificates/truststore/" + *trustStoreCertificateDetails.Label + ".pem" + if err = d.Set("certificate_file", downloadCertificatePath); err != nil { + return diag.FromErr(fmt.Errorf("Error setting certificate_file: %s", err)) + } + if err = d.Set("label", trustStoreCertificateDetails.Label); err != nil { + return diag.FromErr(fmt.Errorf("Error setting label: %s", err)) + } + if err = d.Set("certificate_type", trustStoreCertificateDetails.CertificateType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting certificate_type: %s", err)) + } + if err = d.Set("fingerprint_sha256", trustStoreCertificateDetails.FingerprintSha256); err != nil { + return diag.FromErr(fmt.Errorf("Error setting fingerprint_sha256: %s", err)) + } + if err = d.Set("subject_dn", trustStoreCertificateDetails.SubjectDn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting subject_dn: %s", err)) + } + if err = d.Set("subject_cn", trustStoreCertificateDetails.SubjectCn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting subject_cn: %s", err)) + } + if err = d.Set("issuer_dn", trustStoreCertificateDetails.IssuerDn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting issuer_dn: %s", err)) + } + if err = d.Set("issuer_cn", trustStoreCertificateDetails.IssuerCn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting issuer_cn: %s", err)) + } + if err = d.Set("issued", flex.DateTimeToString(trustStoreCertificateDetails.Issued)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting issued: %s", err)) + } + if err = d.Set("expiry", flex.DateTimeToString(trustStoreCertificateDetails.Expiry)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting expiry: %s", err)) + } + if err = d.Set("trusted", trustStoreCertificateDetails.Trusted); err != nil { + return diag.FromErr(fmt.Errorf("Error setting trusted: %s", err)) + } + if err = d.Set("href", trustStoreCertificateDetails.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + if err = d.Set("certificate_id", trustStoreCertificateDetails.ID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting certificate_id: %s", err)) + } + + return nil +} + +func resourceIbmMqcloudTruststoreCertificateDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Delete Truststore Certificate failed %s", err)) + } + deleteTrustStoreCertificateOptions := &mqcloudv1.DeleteTrustStoreCertificateOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + deleteTrustStoreCertificateOptions.SetServiceInstanceGuid(parts[0]) + deleteTrustStoreCertificateOptions.SetQueueManagerID(parts[1]) + deleteTrustStoreCertificateOptions.SetCertificateID(parts[2]) + + response, err := mqcloudClient.DeleteTrustStoreCertificateWithContext(context, deleteTrustStoreCertificateOptions) + if err != nil { + log.Printf("[DEBUG] DeleteTrustStoreCertificateWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteTrustStoreCertificateWithContext failed %s\n%s", err, response)) + } + + d.SetId("") + + return nil +} diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate_test.go b/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate_test.go new file mode 100644 index 0000000000..80acc0e4a1 --- /dev/null +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate_test.go @@ -0,0 +1,163 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func TestAccIbmMqcloudTruststoreCertificateBasic(t *testing.T) { + var conf mqcloudv1.TrustStoreCertificateDetails + serviceInstanceGuid := acc.MqcloudInstanceID + queueManagerID := acc.MqcloudQueueManagerID + label := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) + certificateFile := acc.MqcloudTSCertFilePath + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmMqcloudTruststoreCertificateDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudTruststoreCertificateConfigBasic(serviceInstanceGuid, queueManagerID, label, certificateFile), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmMqcloudTruststoreCertificateExists("ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", conf), + resource.TestCheckResourceAttr("ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "service_instance_guid", serviceInstanceGuid), + resource.TestCheckResourceAttr("ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "queue_manager_id", queueManagerID), + resource.TestCheckResourceAttr("ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "label", label), + ), + }, + }, + }) +} + +func TestAccIbmMqcloudTruststoreCertificateAllArgs(t *testing.T) { + var conf mqcloudv1.TrustStoreCertificateDetails + serviceInstanceGuid := acc.MqcloudInstanceID + queueManagerID := acc.MqcloudQueueManagerID + label := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) + certificateFile := acc.MqcloudTSCertFilePath + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmMqcloudTruststoreCertificateDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudTruststoreCertificateConfig(serviceInstanceGuid, queueManagerID, label, certificateFile), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmMqcloudTruststoreCertificateExists("ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", conf), + resource.TestCheckResourceAttr("ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "service_instance_guid", serviceInstanceGuid), + resource.TestCheckResourceAttr("ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "queue_manager_id", queueManagerID), + resource.TestCheckResourceAttr("ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "label", label), + ), + }, + { + ResourceName: "ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccCheckIbmMqcloudTruststoreCertificateConfigBasic(serviceInstanceGuid string, queueManagerID string, label string, certificateFile string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { + service_instance_guid = "%s" + queue_manager_id = "%s" + label = "%s" + certificate_file = "%s" + } + `, serviceInstanceGuid, queueManagerID, label, certificateFile) +} + +func testAccCheckIbmMqcloudTruststoreCertificateConfig(serviceInstanceGuid string, queueManagerID string, label string, certificateFile string) string { + return fmt.Sprintf(` + + resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { + service_instance_guid = "%s" + queue_manager_id = "%s" + label = "%s" + certificate_file = "%s" + } + `, serviceInstanceGuid, queueManagerID, label, certificateFile) +} + +func testAccCheckIbmMqcloudTruststoreCertificateExists(n string, obj mqcloudv1.TrustStoreCertificateDetails) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + mqcloudClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).MqcloudV1() + if err != nil { + return err + } + + getTrustStoreCertificateOptions := &mqcloudv1.GetTrustStoreCertificateOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getTrustStoreCertificateOptions.SetServiceInstanceGuid(parts[0]) + getTrustStoreCertificateOptions.SetQueueManagerID(parts[1]) + getTrustStoreCertificateOptions.SetCertificateID(parts[2]) + + trustStoreCertificateDetails, _, err := mqcloudClient.GetTrustStoreCertificate(getTrustStoreCertificateOptions) + if err != nil { + return err + } + + obj = *trustStoreCertificateDetails + return nil + } +} + +func testAccCheckIbmMqcloudTruststoreCertificateDestroy(s *terraform.State) error { + mqcloudClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).MqcloudV1() + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_mqcloud_truststore_certificate" { + continue + } + + getTrustStoreCertificateOptions := &mqcloudv1.GetTrustStoreCertificateOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getTrustStoreCertificateOptions.SetServiceInstanceGuid(parts[0]) + getTrustStoreCertificateOptions.SetQueueManagerID(parts[1]) + getTrustStoreCertificateOptions.SetCertificateID(parts[2]) + + // Try to find the key + _, response, err := mqcloudClient.GetTrustStoreCertificate(getTrustStoreCertificateOptions) + + if err == nil { + return fmt.Errorf("mqcloud_truststore_certificate still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for mqcloud_truststore_certificate (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_user.go b/ibm/service/mqcloud/resource_ibm_mqcloud_user.go new file mode 100644 index 0000000000..3509b1d1da --- /dev/null +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_user.go @@ -0,0 +1,196 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func ResourceIbmMqcloudUser() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIbmMqcloudUserCreate, + ReadContext: resourceIbmMqcloudUserRead, + DeleteContext: resourceIbmMqcloudUserDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "service_instance_guid": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_user", "service_instance_guid"), + Description: "The GUID that uniquely identifies the MQ on Cloud service instance.", + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_user", "name"), + Description: "The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance.", + }, + "email": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.InvokeValidator("ibm_mqcloud_user", "email"), + Description: "The email of the user.", + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for the user details.", + }, + "user_id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of the user which was allocated on creation, and can be used for delete calls.", + }, + }, + } +} + +func ResourceIbmMqcloudUserValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "service_instance_guid", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`, + MinValueLength: 36, + MaxValueLength: 36, + }, + validate.ValidateSchema{ + Identifier: "name", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Required: true, + Regexp: `^[a-z][-a-z0-9]*$`, + MinValueLength: 1, + MaxValueLength: 12, + }, + validate.ValidateSchema{ + Identifier: "email", + ValidateFunctionIdentifier: validate.StringLenBetween, + Type: validate.TypeString, + Required: true, + MinValueLength: 5, + MaxValueLength: 253, + }, + ) + + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_mqcloud_user", Schema: validateSchema} + return &resourceValidator +} + +func resourceIbmMqcloudUserCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Create User failed %s", err)) + } + createUserOptions := &mqcloudv1.CreateUserOptions{} + + createUserOptions.SetServiceInstanceGuid(d.Get("service_instance_guid").(string)) + createUserOptions.SetEmail(d.Get("email").(string)) + createUserOptions.SetName(d.Get("name").(string)) + + userDetails, response, err := mqcloudClient.CreateUserWithContext(context, createUserOptions) + if err != nil { + log.Printf("[DEBUG] CreateUserWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CreateUserWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s/%s", *createUserOptions.ServiceInstanceGuid, *userDetails.ID)) + + return resourceIbmMqcloudUserRead(context, d, meta) +} + +func resourceIbmMqcloudUserRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + + getUserOptions := &mqcloudv1.GetUserOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + getUserOptions.SetServiceInstanceGuid(parts[0]) + getUserOptions.SetUserID(parts[1]) + + userDetails, response, err := mqcloudClient.GetUserWithContext(context, getUserOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetUserWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetUserWithContext failed %s\n%s", err, response)) + } + if err = d.Set("service_instance_guid", parts[0]); err != nil { + return diag.FromErr(fmt.Errorf("Error setting service_instance_guid: %s", err)) + } + if err = d.Set("name", userDetails.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + if err = d.Set("email", userDetails.Email); err != nil { + return diag.FromErr(fmt.Errorf("Error setting email: %s", err)) + } + if err = d.Set("href", userDetails.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + if err = d.Set("user_id", userDetails.ID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting user_id: %s", err)) + } + + return nil +} + +func resourceIbmMqcloudUserDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return diag.FromErr(err) + } + err = checkSIPlan(d, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("Delete User failed %s", err)) + } + deleteUserOptions := &mqcloudv1.DeleteUserOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return diag.FromErr(err) + } + + deleteUserOptions.SetServiceInstanceGuid(parts[0]) + deleteUserOptions.SetUserID(parts[1]) + + response, err := mqcloudClient.DeleteUserWithContext(context, deleteUserOptions) + if err != nil { + log.Printf("[DEBUG] DeleteUserWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteUserWithContext failed %s\n%s", err, response)) + } + + d.SetId("") + + return nil +} diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_user_test.go b/ibm/service/mqcloud/resource_ibm_mqcloud_user_test.go new file mode 100644 index 0000000000..551827f583 --- /dev/null +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_user_test.go @@ -0,0 +1,157 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package mqcloud_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" +) + +func TestAccIbmMqcloudUserBasic(t *testing.T) { + var conf mqcloudv1.UserDetails + serviceInstanceGuid := acc.MqcloudInstanceID + name := fmt.Sprintf("tfname%d", acctest.RandIntRange(10, 100)) + email := fmt.Sprintf("tfemail%d@ibm.com", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmMqcloudUserDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudUserConfigBasic(serviceInstanceGuid, name, email), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmMqcloudUserExists("ibm_mqcloud_user.mqcloud_user_instance", conf), + resource.TestCheckResourceAttr("ibm_mqcloud_user.mqcloud_user_instance", "service_instance_guid", serviceInstanceGuid), + resource.TestCheckResourceAttr("ibm_mqcloud_user.mqcloud_user_instance", "name", name), + resource.TestCheckResourceAttr("ibm_mqcloud_user.mqcloud_user_instance", "email", email), + ), + }, + }, + }) +} + +func TestAccIbmMqcloudUserAllArgs(t *testing.T) { + var conf mqcloudv1.UserDetails + serviceInstanceGuid := acc.MqcloudInstanceID + name := fmt.Sprintf("tfname%d", acctest.RandIntRange(10, 100)) + email := fmt.Sprintf("tfemail%d@ibm.com", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmMqcloudUserDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmMqcloudUserConfig(serviceInstanceGuid, name, email), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmMqcloudUserExists("ibm_mqcloud_user.mqcloud_user_instance", conf), + resource.TestCheckResourceAttr("ibm_mqcloud_user.mqcloud_user_instance", "service_instance_guid", serviceInstanceGuid), + resource.TestCheckResourceAttr("ibm_mqcloud_user.mqcloud_user_instance", "name", name), + resource.TestCheckResourceAttr("ibm_mqcloud_user.mqcloud_user_instance", "email", email), + ), + }, + { + ResourceName: "ibm_mqcloud_user.mqcloud_user_instance", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccCheckIbmMqcloudUserConfigBasic(serviceInstanceGuid string, name string, email string) string { + return fmt.Sprintf(` + resource "ibm_mqcloud_user" "mqcloud_user_instance" { + service_instance_guid = "%s" + name = "%s" + email = "%s" + } + `, serviceInstanceGuid, name, email) +} + +func testAccCheckIbmMqcloudUserConfig(serviceInstanceGuid string, name string, email string) string { + return fmt.Sprintf(` + + resource "ibm_mqcloud_user" "mqcloud_user_instance" { + service_instance_guid = "%s" + name = "%s" + email = "%s" + } + `, serviceInstanceGuid, name, email) +} + +func testAccCheckIbmMqcloudUserExists(n string, obj mqcloudv1.UserDetails) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + mqcloudClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).MqcloudV1() + if err != nil { + return err + } + + getUserOptions := &mqcloudv1.GetUserOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getUserOptions.SetServiceInstanceGuid(parts[0]) + getUserOptions.SetUserID(parts[1]) + + userDetails, _, err := mqcloudClient.GetUser(getUserOptions) + if err != nil { + return err + } + + obj = *userDetails + return nil + } +} + +func testAccCheckIbmMqcloudUserDestroy(s *terraform.State) error { + mqcloudClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).MqcloudV1() + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_mqcloud_user" { + continue + } + + getUserOptions := &mqcloudv1.GetUserOptions{} + + parts, err := flex.SepIdParts(rs.Primary.ID, "/") + if err != nil { + return err + } + + getUserOptions.SetServiceInstanceGuid(parts[0]) + getUserOptions.SetUserID(parts[1]) + + // Try to find the key + _, response, err := mqcloudClient.GetUser(getUserOptions) + + if err == nil { + return fmt.Errorf("mqcloud_user still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for mqcloud_user (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/ibm/service/mqcloud/utils.go b/ibm/service/mqcloud/utils.go new file mode 100644 index 0000000000..877b5ed79b --- /dev/null +++ b/ibm/service/mqcloud/utils.go @@ -0,0 +1,196 @@ +package mqcloud + +import ( + "context" + "fmt" + "os" + "strings" + "time" + + "strconv" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + rc "github.com/IBM/platform-services-go-sdk/resourcecontrollerv2" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func loadWaitForQmStatusEnvVar() bool { + envValue := os.Getenv("IBMCLOUD_MQCLOUD_WAIT_FOR_QM_STATUS") + return strings.ToLower(envValue) != "false" +} + +var waitForQmStatus = loadWaitForQmStatusEnvVar() +var planCache = make(map[string]string) + +const qmStatus = "running" +const qmCreating = "initializing" +const isQueueManagerDeleting = "true" +const isQueueManagerDeleteDone = "true" +const reservedDeploymentPlan = "reserved-deployment" +const enforceReservedDeploymentPlan = true + +// waitForQmStatusUpdate Waits for QM to be in running state +func waitForQmStatusUpdate(context context.Context, d *schema.ResourceData, meta interface{}) (interface{}, error) { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return "", err + } + + stateConf := &resource.StateChangeConf{ + Pending: []string{qmCreating}, + Target: []string{qmStatus}, + Refresh: func() (interface{}, string, error) { + getQueueManagerStatusOptions := &mqcloudv1.GetQueueManagerStatusOptions{} + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return nil, "", err + } + getQueueManagerStatusOptions.SetServiceInstanceGuid(parts[0]) + getQueueManagerStatusOptions.SetQueueManagerID(parts[1]) + queueManagerStatus, response, err := mqcloudClient.GetQueueManagerStatusWithContext(context, getQueueManagerStatusOptions) + if err != nil { + return "", "", fmt.Errorf("GetQueueManagerWithContext ...... %s err: %s", response, err) + } + if queueManagerStatus == nil || queueManagerStatus.Status == nil { + return nil, "", fmt.Errorf("queueManagerStatus or queueManagerStatus.Status is nil") + } + fmt.Println("The queue manager is currently in the " + *queueManagerStatus.Status + " state ....") + + if *queueManagerStatus.Status == "running" { + return queueManagerStatus, qmStatus, nil + } else if *queueManagerStatus.Status == "initialization_failed" || *queueManagerStatus.Status == "restore_failed" || *queueManagerStatus.Status == "status_not_available" { + return queueManagerStatus, qmStatus, fmt.Errorf("%s", err) + } + return queueManagerStatus, qmCreating, nil + }, + Timeout: d.Timeout(schema.TimeoutCreate), + Delay: 10 * time.Second, + MinTimeout: 30 * time.Second, + } + return stateConf.WaitForStateContext(context) +} + +func waitForQueueManagerToDelete(context context.Context, d *schema.ResourceData, meta interface{}) (interface{}, error) { + mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() + if err != nil { + return false, err + } + + stateConf := &resource.StateChangeConf{ + Pending: []string{isQueueManagerDeleting}, + Target: []string{isQueueManagerDeleteDone}, + Refresh: func() (interface{}, string, error) { + getQueueManagerOptions := &mqcloudv1.GetQueueManagerOptions{} + + parts, err := flex.SepIdParts(d.Id(), "/") + if err != nil { + return "", "", err + } + + getQueueManagerOptions.SetServiceInstanceGuid(parts[0]) + getQueueManagerOptions.SetQueueManagerID(parts[1]) + + queueManagerDetails, response, err := mqcloudClient.GetQueueManagerWithContext(context, getQueueManagerOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + return queueManagerDetails, isQueueManagerDeleteDone, nil + } + return nil, "", err + } + return queueManagerDetails, isQueueManagerDeleting, nil + }, + Timeout: d.Timeout(schema.TimeoutDelete), + Delay: 60 * time.Second, + MinTimeout: 60 * time.Second, + } + + return stateConf.WaitForStateContext(context) +} + +// checkSIPlan checks whether a Service Instance (SI) is in a Reserved Deployment. +func checkSIPlan(d *schema.ResourceData, meta interface{}) error { + if !enforceReservedDeploymentPlan { + return nil + } + + instanceID := d.Get("service_instance_guid").(string) + // Check cache first + if plan, found := planCache[instanceID]; found { + return handlePlanCheck(plan, instanceID) + } + + // Creating a Resource Controller Client + rsConClient, err := meta.(conns.ClientSession).ResourceControllerV2API() + if err != nil { + return fmt.Errorf("[ERROR] Failed to create Resource Controller Client: %s", err) + } + + // Getting the resource instance + rsInst := rc.GetResourceInstanceOptions{ + ID: &instanceID, + } + instance, response, err := rsConClient.GetResourceInstance(&rsInst) + if err != nil { + return fmt.Errorf("[ERROR] Failed to retrieve resource instance: %s, Response: %s", err, response) + } + + // Creating a Resource Catalog Client + rsCatClient, err := meta.(conns.ClientSession).ResourceCatalogAPI() + if err != nil { + return fmt.Errorf("[ERROR] Failed to create Resource Catalog Client: %s", err) + } + rsCatRepo := rsCatClient.ResourceCatalog() + + // Checking the service plan + plan, err := rsCatRepo.GetServicePlanName(*instance.ResourcePlanID) + if err != nil { + return fmt.Errorf("[ERROR] Failed to retrieve service plan: %s", err) + } + + // Update cache + planCache[instanceID] = plan + + return handlePlanCheck(plan, instanceID) +} + +func handlePlanCheck(plan string, instanceID string) error { + if plan != reservedDeploymentPlan { + return fmt.Errorf("[ERROR] Terraform is only supported for Reserved Deployment Plan. Your Service Plan is: %s for the instance %s", plan, instanceID) + } + return nil +} + +func IsVersionDowngrade(oldVersion, newVersion string) bool { + oldParts := strings.Split(oldVersion, ".") + newParts := strings.Split(newVersion, ".") + + for i := 0; i < len(oldParts); i++ { + oldPartNum := strings.Split(oldParts[i], "_")[0] + newPartNum := strings.Split(newParts[i], "_")[0] + + oldPart, _ := strconv.Atoi(oldPartNum) + newPart, _ := strconv.Atoi(newPartNum) + + if newPart < oldPart { + return true + } else if newPart > oldPart { + return false + } + } + + oldPatchNum := strings.Split(oldParts[len(oldParts)-1], "_") + newPatchNum := strings.Split(newParts[len(newParts)-1], "_") + + if len(oldPatchNum) > 1 && len(newPatchNum) > 1 { + oldPatch, _ := strconv.Atoi(oldPatchNum[1]) + newPatch, _ := strconv.Atoi(newPatchNum[1]) + + return newPatch < oldPatch + } + + return false +} diff --git a/website/allowed-subcategories.txt b/website/allowed-subcategories.txt index 1e97423139..f80f98af65 100644 --- a/website/allowed-subcategories.txt +++ b/website/allowed-subcategories.txt @@ -26,6 +26,7 @@ Internet services Key Management Service Kubernetes Service Metrics Router +MQ on Cloud Object Storage Power Systems Project diff --git a/website/docs/d/mqcloud_application.html.markdown b/website/docs/d/mqcloud_application.html.markdown new file mode 100644 index 0000000000..0e854d5c8a --- /dev/null +++ b/website/docs/d/mqcloud_application.html.markdown @@ -0,0 +1,44 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_mqcloud_application" +description: |- + Get information about mqcloud_application +subcategory: "MQ on Cloud" +--- + +# ibm_mqcloud_application + +Provides a read-only data source to retrieve information about a mqcloud_application. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```hcl +data "ibm_mqcloud_application" "mqcloud_application" { + name = ibm_mqcloud_application.mqcloud_application_instance.name + service_instance_guid = ibm_mqcloud_application.mqcloud_application_instance.service_instance_guid +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +* `name` - (Optional, String) The name of the application - conforming to MQ rules. + * Constraints: The maximum length is `12` characters. The minimum length is `1` character. +* `service_instance_guid` - (Required, Forces new resource, String) The GUID that uniquely identifies the MQ on Cloud service instance. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/`. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +* `id` - The unique identifier of the mqcloud_application. +* `applications` - (List) List of applications. + * Constraints: The maximum length is `50` items. The minimum length is `0` items. +Nested schema for **applications**: + * `create_api_key_uri` - (String) The URI to create a new apikey for the application. + * `href` - (String) The URL for this application. + * `id` - (String) The ID of the application which was allocated on creation, and can be used for delete calls. + * `name` - (String) The name of the application - conforming to MQ rules. + * Constraints: The maximum length is `12` characters. The minimum length is `1` character. + diff --git a/website/docs/d/mqcloud_keystore_certificate.html.markdown b/website/docs/d/mqcloud_keystore_certificate.html.markdown new file mode 100644 index 0000000000..6222ecd784 --- /dev/null +++ b/website/docs/d/mqcloud_keystore_certificate.html.markdown @@ -0,0 +1,63 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_mqcloud_keystore_certificate" +description: |- + Get information about mqcloud_keystore_certificate +subcategory: "MQ on Cloud" +--- + +# ibm_mqcloud_keystore_certificate + +Provides a read-only data source to retrieve information about a mqcloud_keystore_certificate. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```hcl +data "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate" { + label = ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance.label + queue_manager_id = ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance.queue_manager_id + service_instance_guid = ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance.service_instance_guid +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +* `label` - (Optional, String) Certificate label in queue manager store. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9_.]*$/`. +* `queue_manager_id` - (Required, Forces new resource, String) The id of the queue manager to retrieve its full details. + * Constraints: The maximum length is `32` characters. The minimum length is `32` characters. The value must match regular expression `/^[0-9a-fA-F]{32}$/`. +* `service_instance_guid` - (Required, Forces new resource, String) The GUID that uniquely identifies the MQ on Cloud service instance. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/`. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +* `id` - The unique identifier of the mqcloud_keystore_certificate. +* `key_store` - (List) The list of key store certificates. + * Constraints: The maximum length is `50` items. The minimum length is `0` items. +Nested schema for **key_store**: + * `certificate_type` - (String) The type of certificate. + * Constraints: Allowable values are: `key_store`. + * `dns_names` - (List) The list of DNS names. + * Constraints: The maximum length is `200` items. The minimum length is `0` items. + * `dns_names_total_count` - (Integer) The total count of dns names. + * `expiry` - (String) Expiry date for the certificate. + * `fingerprint_sha256` - (String) Fingerprint SHA256. + * Constraints: The value must match regular expression `/^[A-F0-9]{2}(:[A-F0-9]{2}){31}$/`. + * `href` - (String) The URL for this key store certificate. + * `id` - (String) ID of the certificate. + * Constraints: The maximum length is `16` characters. The minimum length is `1` character. The value must match regular expression `/^[0-9a-fA-F]*$/`. + * `is_default` - (Boolean) Indicates whether it is the queue manager's default certificate. + * `issued` - (String) Date certificate was issued. + * `issuer_cn` - (String) Issuer's Common Name. + * `issuer_dn` - (String) Issuer's Distinguished Name. + * `label` - (String) Certificate label in queue manager store. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9_.]*$/`. + * `subject_cn` - (String) Subject's Common Name. + * `subject_dn` - (String) Subject's Distinguished Name. + +* `total_count` - (Integer) The total count of key store certificates. + diff --git a/website/docs/d/mqcloud_queue_manager.html.markdown b/website/docs/d/mqcloud_queue_manager.html.markdown new file mode 100644 index 0000000000..59bfc7c76b --- /dev/null +++ b/website/docs/d/mqcloud_queue_manager.html.markdown @@ -0,0 +1,60 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_mqcloud_queue_manager" +description: |- + Get information about mqcloud_queue_manager +subcategory: "MQ on Cloud" +--- + +# ibm_mqcloud_queue_manager + +Provides a read-only data source to retrieve information about a mqcloud_queue_manager. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```hcl +data "ibm_mqcloud_queue_manager" "mqcloud_queue_manager" { + name = ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance.name + service_instance_guid = ibm_mqcloud_queue_manager.mqcloud_queue_manager_instance.service_instance_guid +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +* `name` - (Optional, String) A queue manager name conforming to MQ restrictions. + * Constraints: The maximum length is `48` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9._]*$/`. +* `service_instance_guid` - (Required, Forces new resource, String) The GUID that uniquely identifies the MQ on Cloud service instance. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/`. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +* `id` - The unique identifier of the mqcloud_queue_manager. + +* `queue_managers` - (List) List of queue managers. + * Constraints: The maximum length is `50` items. The minimum length is `0` items. +Nested schema for **queue_managers**: + * `administrator_api_endpoint_url` - (String) The url through which to access the Admin REST APIs for this queue manager. + * `available_upgrade_versions_uri` - (String) The uri through which the available versions to upgrade to can be found for this queue manager. + * `connection_info_uri` - (String) The uri through which the CDDT for this queue manager can be obtained. + * `date_created` - (String) RFC3339 formatted UTC date for when the queue manager was created. + * `display_name` - (String) A displayable name for the queue manager - limited only in length. + * Constraints: The maximum length is `150` characters. + * `href` - (String) The URL for this queue manager. + * `id` - (String) The ID of the queue manager which was allocated on creation, and can be used for delete calls. + * `location` - (String) The locations in which the queue manager could be deployed. + * Constraints: The maximum length is `150` characters. The minimum length is `2` characters. The value must match regular expression `/^([^[:ascii:]]|[a-zA-Z0-9-._: ])+$/`. + * `name` - (String) A queue manager name conforming to MQ restrictions. + * Constraints: The maximum length is `48` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9._]*$/`. + * `rest_api_endpoint_url` - (String) The url through which to access REST APIs for this queue manager. + * `size` - (String) The queue manager sizes of deployment available. Deployment of lite queue managers for aws_us_east_1 and aws_eu_west_1 locations is not available. + * Constraints: Allowable values are: `lite`, `xsmall`, `small`, `medium`, `large`. + * `status_uri` - (String) A reference uri to get deployment status of the queue manager. + * `upgrade_available` - (Boolean) Describes whether an upgrade is available for this queue manager. + * `version` - (String) The MQ version of the queue manager. + * Constraints: The maximum length is `15` characters. The minimum length is `7` characters. The value must match regular expression `/^[0-9]+.[0-9]+.[0-9]+_[0-9]+$/`. + * `web_console_url` - (String) The url through which to access the web console for this queue manager. + diff --git a/website/docs/d/mqcloud_queue_manager_status.html.markdown b/website/docs/d/mqcloud_queue_manager_status.html.markdown new file mode 100644 index 0000000000..342ac508c9 --- /dev/null +++ b/website/docs/d/mqcloud_queue_manager_status.html.markdown @@ -0,0 +1,38 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_mqcloud_queue_manager_status" +description: |- + Get information about mqcloud_queue_manager_status +subcategory: "MQ on Cloud" +--- + +# ibm_mqcloud_queue_manager_status + +Provides a read-only data source to retrieve information about mqcloud_queue_manager_status. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```hcl +data "ibm_mqcloud_queue_manager_status" "mqcloud_queue_manager_status" { + queue_manager_id = var.queue_manager_id + service_instance_guid = var.service_instance_guid +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +* `queue_manager_id` - (Required, Forces new resource, String) The id of the queue manager to retrieve its full details. + * Constraints: The maximum length is `32` characters. The minimum length is `32` characters. The value must match regular expression `/^[0-9a-fA-F]{32}$/`. +* `service_instance_guid` - (Required, Forces new resource, String) The GUID that uniquely identifies the MQ on Cloud service instance. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/`. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +* `id` - The unique identifier of the mqcloud_queue_manager_status. +* `status` - (String) The deploying and failed states are not queue manager states, they are states which can occur when the request to deploy has been fired, or with that request has failed without producing a queue manager to have any state. The other states map to the queue manager states. State "ending" is either quiesing or ending immediately. State "ended" is either ended normally or endedimmediately. The others map one to one with queue manager states. + * Constraints: Allowable values are: `initializing`, `deploying`, `starting`, `running`, `stopping`, `stopped`, `status_not_available`, `deleting`, `failed`, `upgrading_version`, `updating_revision`, `initialization_failed`, `restoring_queue_manager`, `restoring_config`, `restore_failed`, `suspended`, `resumable`. + diff --git a/website/docs/d/mqcloud_truststore_certificate.html.markdown b/website/docs/d/mqcloud_truststore_certificate.html.markdown new file mode 100644 index 0000000000..5fb07ffb1a --- /dev/null +++ b/website/docs/d/mqcloud_truststore_certificate.html.markdown @@ -0,0 +1,60 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_mqcloud_truststore_certificate" +description: |- + Get information about mqcloud_truststore_certificate +subcategory: "MQ on Cloud" +--- + +# ibm_mqcloud_truststore_certificate + +Provides a read-only data source to retrieve information about a mqcloud_truststore_certificate. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```hcl +data "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate" { + label = ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance.label + queue_manager_id = ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance.queue_manager_id + service_instance_guid = ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance.service_instance_guid +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +* `label` - (Optional, String) Certificate label in queue manager store. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9_.]*$/`. +* `queue_manager_id` - (Required, Forces new resource, String) The id of the queue manager to retrieve its full details. + * Constraints: The maximum length is `32` characters. The minimum length is `32` characters. The value must match regular expression `/^[0-9a-fA-F]{32}$/`. +* `service_instance_guid` - (Required, Forces new resource, String) The GUID that uniquely identifies the MQ on Cloud service instance. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/`. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +* `id` - The unique identifier of the mqcloud_truststore_certificate. +* `total_count` - (Integer) The total count of trust store certificates. + +* `trust_store` - (List) The list of trust store certificates. + * Constraints: The maximum length is `50` items. The minimum length is `0` items. +Nested schema for **trust_store**: + * `certificate_type` - (String) The type of certificate. + * Constraints: Allowable values are: `trust_store`. + * `expiry` - (String) Expiry date for the certificate. + * `fingerprint_sha256` - (String) Fingerprint SHA256. + * Constraints: The value must match regular expression `/^[A-F0-9]{2}(:[A-F0-9]{2}){31}$/`. + * `href` - (String) The URL for this trust store certificate. + * `id` - (String) Id of the certificate. + * Constraints: The maximum length is `16` characters. The minimum length is `1` character. The value must match regular expression `/^[0-9a-fA-F]*$/`. + * `issued` - (String) The Date the certificate was issued. + * `issuer_cn` - (String) Issuer's Common Name. + * `issuer_dn` - (String) Issuer's Distinguished Name. + * `label` - (String) Certificate label in queue manager store. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9_.]*$/`. + * `subject_cn` - (String) Subject's Common Name. + * `subject_dn` - (String) Subject's Distinguished Name. + * `trusted` - (Boolean) Indicates whether a certificate is trusted. + diff --git a/website/docs/d/mqcloud_user.html.markdown b/website/docs/d/mqcloud_user.html.markdown new file mode 100644 index 0000000000..89c1aa4db7 --- /dev/null +++ b/website/docs/d/mqcloud_user.html.markdown @@ -0,0 +1,46 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_mqcloud_user" +description: |- + Get information about mqcloud_user +subcategory: "MQ on Cloud" +--- + +# ibm_mqcloud_user + +Provides a read-only data source to retrieve information about a mqcloud_user. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```hcl +data "ibm_mqcloud_user" "mqcloud_user" { + name = ibm_mqcloud_user.mqcloud_user_instance.name + service_instance_guid = ibm_mqcloud_user.mqcloud_user_instance.service_instance_guid +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +* `name` - (Optional, String) The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance. + * Constraints: The maximum length is `12` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][-a-z0-9]*$/`. +* `service_instance_guid` - (Required, Forces new resource, String) The GUID that uniquely identifies the MQ on Cloud service instance. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/`. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +* `id` - The unique identifier of the mqcloud_user. + +* `users` - (List) List of users. + * Constraints: The maximum length is `50` items. The minimum length is `0` items. +Nested schema for **users**: + * `email` - (String) The email of the user. + * Constraints: The maximum length is `253` characters. The minimum length is `5` characters. + * `href` - (String) The URL for the user details. + * `id` - (String) The ID of the user which was allocated on creation, and can be used for delete calls. + * `name` - (String) The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance. + * Constraints: The maximum length is `12` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][-a-z0-9]*$/`. + diff --git a/website/docs/guides/custom-service-endpoints.html.md b/website/docs/guides/custom-service-endpoints.html.md index ac2a9ebe5d..b03eedc00b 100644 --- a/website/docs/guides/custom-service-endpoints.html.md +++ b/website/docs/guides/custom-service-endpoints.html.md @@ -14,10 +14,14 @@ The IBM Cloud Provider plug-in for Terraform can be configured to use non-defaul -- [Getting Started with custom service endpoints](#getting-started-with-custom-service-endpoints) -- [Supported endpoint customizations](#supported-endpoint-customizations) -- [File structure for endpoints file](#file-structure-for-endpoints-file) -- [Prioritisation of endpoints](#prioritisation-of-endpoints) +- [Customizing default cloud service endpoints](#customizing-default-cloud-service-endpoints) + - [Getting started with custom service endpoints](#getting-started-with-custom-service-endpoints) + - [Supported endpoint customizations](#supported-endpoint-customizations) + - [File structure for endpoints file](#file-structure-for-endpoints-file) + - [Prioritisation of endpoints](#prioritisation-of-endpoints) + - [1. Define service endpoints by using environment variables](#1-define-service-endpoints-by-using-environment-variables) + - [2. Define service endpoints by using an endpoints file](#2-define-service-endpoints-by-using-an-endpoints-file) + - [3. Use the default private or public service endpoint based on the `visibility` setting in the provider block](#3-use-the-default-private-or-public-service-endpoint-based-on-the-visibility-setting-in-the-provider-block) ## Getting started with custom service endpoints @@ -53,6 +57,7 @@ provider "ibm" { |Container Registry|IBMCLOUD_CR_API_ENDPOINT| |Kubernetes Service|IBMCLOUD_CS_API_ENDPOINT| |Metrics Router| IBMCLOUD_METRICS_ROUTING_API_ENDPOINT| +|MQ on Cloud| IBMCLOUD_MQCLOUD_CONFIG_ENDPOINT| |Direct Link|IBMCLOUD_DL_API_ENDPOINT| |Direct Link Provider|IBMCLOUD_DL_PROVIDER_API_ENDPOINT| |Enterprise Management|IBMCLOUD_ENTERPRISE_API_ENDPOINT| diff --git a/website/docs/r/mqcloud_application.html.markdown b/website/docs/r/mqcloud_application.html.markdown new file mode 100644 index 0000000000..a244325ade --- /dev/null +++ b/website/docs/r/mqcloud_application.html.markdown @@ -0,0 +1,55 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_mqcloud_application" +description: |- + Manages mqcloud_application. +subcategory: "MQ on Cloud" +--- + +# ibm_mqcloud_application + +Create, update, and delete mqcloud_applications with this resource. + +## Example Usage + +```hcl +resource "ibm_mqcloud_application" "mqcloud_application_instance" { + name = "test-app" + service_instance_guid = var.service_instance_guid +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +* `name` - (Required, Forces new resource, String) The name of the application - conforming to MQ rules. + * Constraints: The maximum length is `12` characters. The minimum length is `1` character. +* `service_instance_guid` - (Required, Forces new resource, String) The GUID that uniquely identifies the MQ on Cloud service instance. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/`. + +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +* `id` - The unique identifier of the mqcloud_application. +* `application_id` - (String) The ID of the application which was allocated on creation, and can be used for delete calls. +* `create_api_key_uri` - (String) The URI to create a new apikey for the application. +* `href` - (String) The URL for this application. + + +## Import + +You can import the `ibm_mqcloud_application` resource by using `id`. +The `id` property can be formed from `service_instance_guid`, and `application_id` in the following format: + +
+<service_instance_guid>/<application_id>
+
+* `service_instance_guid`: A string in the format `a2b4d4bc-dadb-4637-bcec-9b7d1e723af8`. The GUID that uniquely identifies the MQ on Cloud service instance. +* `application_id`: A string. The ID of the application which was allocated on creation, and can be used for delete calls. + +# Syntax +
+$ terraform import ibm_mqcloud_application.mqcloud_application <service_instance_guid>/<application_id>
+
diff --git a/website/docs/r/mqcloud_keystore_certificate.html.markdown b/website/docs/r/mqcloud_keystore_certificate.html.markdown new file mode 100644 index 0000000000..e3b1a0108c --- /dev/null +++ b/website/docs/r/mqcloud_keystore_certificate.html.markdown @@ -0,0 +1,73 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_mqcloud_keystore_certificate" +description: |- + Manages mqcloud_keystore_certificate. +subcategory: "MQ on Cloud" +--- + +# ibm_mqcloud_keystore_certificate + +Create, update, and delete mqcloud_keystore_certificates with this resource. + +## Example Usage + +```hcl +resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { + label = "label" + queue_manager_id = var.queue_manager_id + service_instance_guid = var.service_instance_guid +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +* `label` - (Required, Forces new resource, String) Certificate label in queue manager store. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9_.]*$/`. +* `queue_manager_id` - (Required, Forces new resource, String) The id of the queue manager to retrieve its full details. + * Constraints: The maximum length is `32` characters. The minimum length is `32` characters. The value must match regular expression `/^[0-9a-fA-F]{32}$/`. +* `service_instance_guid` - (Required, Forces new resource, String) The GUID that uniquely identifies the MQ on Cloud service instance. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/`. + +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +* `id` - The unique identifier of the mqcloud_keystore_certificate. +* `certificate_id` - (String) ID of the certificate. + * Constraints: The maximum length is `16` characters. The minimum length is `1` character. The value must match regular expression `/^[0-9a-fA-F]*$/`. +* `certificate_type` - (String) The type of certificate. + * Constraints: Allowable values are: `key_store`. +* `dns_names` - (List) The list of DNS names. + * Constraints: The maximum length is `200` items. The minimum length is `0` items. +* `dns_names_total_count` - (Integer) The total count of dns names. +* `expiry` - (String) Expiry date for the certificate. +* `fingerprint_sha256` - (String) Fingerprint SHA256. + * Constraints: The value must match regular expression `/^[A-F0-9]{2}(:[A-F0-9]{2}){31}$/`. +* `href` - (String) The URL for this key store certificate. +* `is_default` - (Boolean) Indicates whether it is the queue manager's default certificate. +* `issued` - (String) Date certificate was issued. +* `issuer_cn` - (String) Issuer's Common Name. +* `issuer_dn` - (String) Issuer's Distinguished Name. +* `subject_cn` - (String) Subject's Common Name. +* `subject_dn` - (String) Subject's Distinguished Name. + + +## Import + +You can import the `ibm_mqcloud_keystore_certificate` resource by using `id`. +The `id` property can be formed from `service_instance_guid`, `queue_manager_id`, and `certificate_id` in the following format: + +
+<service_instance_guid>/<queue_manager_id>/<certificate_id>
+
+* `service_instance_guid`: A string in the format `a2b4d4bc-dadb-4637-bcec-9b7d1e723af8`. The GUID that uniquely identifies the MQ on Cloud service instance. +* `queue_manager_id`: A string in the format `b8e1aeda078009cf3db74e90d5d42328`. The id of the queue manager to retrieve its full details. +* `certificate_id`: A string. ID of the certificate. + +# Syntax +
+$ terraform import ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate <service_instance_guid>/<queue_manager_id>/<certificate_id>
+
diff --git a/website/docs/r/mqcloud_queue_manager.html.markdown b/website/docs/r/mqcloud_queue_manager.html.markdown new file mode 100644 index 0000000000..b26b62631e --- /dev/null +++ b/website/docs/r/mqcloud_queue_manager.html.markdown @@ -0,0 +1,74 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_mqcloud_queue_manager" +description: |- + Manages mqcloud_queue_manager. +subcategory: "MQ on Cloud" +--- + +# ibm_mqcloud_queue_manager + +Create, update, and delete mqcloud_queue_managers with this resource. + +## Example Usage + +```hcl +resource "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" { + display_name = "A test queue manager" + location = "reserved-eu-fr-cluster-f884" + name = "testqm" + service_instance_guid = var.service_instance_guid + size = "lite" + version = "9.3.2_2" +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +* `display_name` - (Optional, String) A displayable name for the queue manager - limited only in length. + * Constraints: The maximum length is `150` characters. +* `location` - (Required, String) The locations in which the queue manager could be deployed. + * Constraints: The maximum length is `150` characters. The minimum length is `2` characters. The value must match regular expression `/^([^[:ascii:]]|[a-zA-Z0-9-._: ])+$/`. +* `name` - (Required, String) A queue manager name conforming to MQ restrictions. + * Constraints: The maximum length is `48` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9._]*$/`. +* `service_instance_guid` - (Required, Forces new resource, String) The GUID that uniquely identifies the MQ on Cloud service instance. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/`. +* `size` - (Required, String) The queue manager sizes of deployment available. Deployment of lite queue managers for aws_us_east_1 and aws_eu_west_1 locations is not available. + * Constraints: Allowable values are: `lite`, `xsmall`, `small`, `medium`, `large`. +* `version` - (Optional, String) The MQ version of the queue manager. + * Constraints: The maximum length is `15` characters. The minimum length is `7` characters. The value must match regular expression `/^[0-9]+.[0-9]+.[0-9]+_[0-9]+$/`. + +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +* `id` - The unique identifier of the mqcloud_queue_manager. +* `administrator_api_endpoint_url` - (String) The url through which to access the Admin REST APIs for this queue manager. +* `available_upgrade_versions_uri` - (String) The uri through which the available versions to upgrade to can be found for this queue manager. +* `connection_info_uri` - (String) The uri through which the CDDT for this queue manager can be obtained. +* `date_created` - (String) RFC3339 formatted UTC date for when the queue manager was created. +* `href` - (String) The URL for this queue manager. +* `queue_manager_id` - (String) The ID of the queue manager which was allocated on creation, and can be used for delete calls. +* `rest_api_endpoint_url` - (String) The url through which to access REST APIs for this queue manager. +* `status_uri` - (String) A reference uri to get deployment status of the queue manager. +* `upgrade_available` - (Boolean) Describes whether an upgrade is available for this queue manager. +* `web_console_url` - (String) The url through which to access the web console for this queue manager. + + +## Import + +You can import the `ibm_mqcloud_queue_manager` resource by using `id`. +The `id` property can be formed from `service_instance_guid`, and `queue_manager_id` in the following format: + +
+<service_instance_guid>/<queue_manager_id>
+
+* `service_instance_guid`: A string in the format `a2b4d4bc-dadb-4637-bcec-9b7d1e723af8`. The GUID that uniquely identifies the MQ on Cloud service instance. +* `queue_manager_id`: A string. The ID of the queue manager which was allocated on creation, and can be used for delete calls. + +# Syntax +
+$ terraform import ibm_mqcloud_queue_manager.mqcloud_queue_manager <service_instance_guid>/<queue_manager_id>
+
diff --git a/website/docs/r/mqcloud_truststore_certificate.html.markdown b/website/docs/r/mqcloud_truststore_certificate.html.markdown new file mode 100644 index 0000000000..ebc00ef103 --- /dev/null +++ b/website/docs/r/mqcloud_truststore_certificate.html.markdown @@ -0,0 +1,70 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_mqcloud_truststore_certificate" +description: |- + Manages mqcloud_truststore_certificate. +subcategory: "MQ on Cloud" +--- + +# ibm_mqcloud_truststore_certificate + +Create, update, and delete mqcloud_truststore_certificates with this resource. + +## Example Usage + +```hcl +resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { + label = "label" + queue_manager_id = var.queue_manager_id + service_instance_guid = var.service_instance_guid +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +* `label` - (Required, Forces new resource, String) Certificate label in queue manager store. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9_.]*$/`. +* `queue_manager_id` - (Required, Forces new resource, String) The id of the queue manager to retrieve its full details. + * Constraints: The maximum length is `32` characters. The minimum length is `32` characters. The value must match regular expression `/^[0-9a-fA-F]{32}$/`. +* `service_instance_guid` - (Required, Forces new resource, String) The GUID that uniquely identifies the MQ on Cloud service instance. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/`. + +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +* `id` - The unique identifier of the mqcloud_truststore_certificate. +* `certificate_id` - (String) Id of the certificate. + * Constraints: The maximum length is `16` characters. The minimum length is `1` character. The value must match regular expression `/^[0-9a-fA-F]*$/`. +* `certificate_type` - (String) The type of certificate. + * Constraints: Allowable values are: `trust_store`. +* `expiry` - (String) Expiry date for the certificate. +* `fingerprint_sha256` - (String) Fingerprint SHA256. + * Constraints: The value must match regular expression `/^[A-F0-9]{2}(:[A-F0-9]{2}){31}$/`. +* `href` - (String) The URL for this trust store certificate. +* `issued` - (String) The Date the certificate was issued. +* `issuer_cn` - (String) Issuer's Common Name. +* `issuer_dn` - (String) Issuer's Distinguished Name. +* `subject_cn` - (String) Subject's Common Name. +* `subject_dn` - (String) Subject's Distinguished Name. +* `trusted` - (Boolean) Indicates whether a certificate is trusted. + + +## Import + +You can import the `ibm_mqcloud_truststore_certificate` resource by using `id`. +The `id` property can be formed from `service_instance_guid`, `queue_manager_id`, and `certificate_id` in the following format: + +
+<service_instance_guid>/<queue_manager_id>/<certificate_id>
+
+* `service_instance_guid`: A string in the format `a2b4d4bc-dadb-4637-bcec-9b7d1e723af8`. The GUID that uniquely identifies the MQ on Cloud service instance. +* `queue_manager_id`: A string in the format `b8e1aeda078009cf3db74e90d5d42328`. The id of the queue manager to retrieve its full details. +* `certificate_id`: A string. Id of the certificate. + +# Syntax +
+$ terraform import ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate <service_instance_guid>/<queue_manager_id>/<certificate_id>
+
diff --git a/website/docs/r/mqcloud_user.html.markdown b/website/docs/r/mqcloud_user.html.markdown new file mode 100644 index 0000000000..6d12da2ab7 --- /dev/null +++ b/website/docs/r/mqcloud_user.html.markdown @@ -0,0 +1,57 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_mqcloud_user" +description: |- + Manages mqcloud_user. +subcategory: "MQ on Cloud" +--- + +# ibm_mqcloud_user + +Create, update, and delete mqcloud_users with this resource. + +## Example Usage + +```hcl +resource "ibm_mqcloud_user" "mqcloud_user_instance" { + email = "user@example.com" + name = "t0scie98o57a" + service_instance_guid = var.service_instance_guid +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +* `email` - (Required, Forces new resource, String) The email of the user. + * Constraints: The maximum length is `253` characters. The minimum length is `5` characters. +* `name` - (Required, Forces new resource, String) The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance. + * Constraints: The maximum length is `12` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][-a-z0-9]*$/`. +* `service_instance_guid` - (Required, Forces new resource, String) The GUID that uniquely identifies the MQ on Cloud service instance. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/`. + +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +* `id` - The unique identifier of the mqcloud_user. +* `href` - (String) The URL for the user details. +* `user_id` - (String) The ID of the user which was allocated on creation, and can be used for delete calls. + + +## Import + +You can import the `ibm_mqcloud_user` resource by using `id`. +The `id` property can be formed from `service_instance_guid`, and `user_id` in the following format: + +
+<service_instance_guid>/<user_id>
+
+* `service_instance_guid`: A string in the format `a2b4d4bc-dadb-4637-bcec-9b7d1e723af8`. The GUID that uniquely identifies the MQ on Cloud service instance. +* `user_id`: A string. The ID of the user which was allocated on creation, and can be used for delete calls. + +# Syntax +
+$ terraform import ibm_mqcloud_user.mqcloud_user <service_instance_guid>/<user_id>
+
From d98953da552351a566d19a3106ad6f422d2eafb8 Mon Sep 17 00:00:00 2001 From: yonatanyell <69857977+yonatanyell@users.noreply.github.com> Date: Wed, 13 Dec 2023 09:04:15 +0200 Subject: [PATCH 100/132] Service Credentials secret addition (#4926) * SC addition * SC addition * SC addition * update function updated * SC unit tests added * SC unit tests added * d * tests fixes * tests fixes * update sdk * .secrets.baseline update * .secrets.baseline update * .secrets.baseline update * Update sm_service_credentials_secret_metadata.html.markdown --------- Co-authored-by: Yonathan-Yellin Co-authored-by: Avi Ribchinsky Co-authored-by: Tatyana Co-authored-by: Idan Adar --- .secrets.baseline | 80 +- examples/ibm-secrets-manager/README.md | 238 +++--- examples/ibm-secrets-manager/main.tf | 43 + examples/ibm-secrets-manager/outputs.tf | 6 + examples/ibm-secrets-manager/variables.tf | 63 ++ go.mod | 2 +- go.sum | 4 +- ibm/acctest/acctest.go | 6 + ibm/provider/provider.go | 3 + ...ource_ibm_sm_service_credentials_secret.go | 506 +++++++++++ ..._sm_service_credentials_secret_metadata.go | 494 +++++++++++ ...ervice_credentials_secret_metadata_test.go | 74 ++ ..._ibm_sm_service_credentials_secret_test.go | 83 ++ ...ource_ibm_sm_service_credentilas_secret.go | 790 ++++++++++++++++++ ..._ibm_sm_service_credentilas_secret_test.go | 335 ++++++++ ibm/service/secretsmanager/utils.go | 15 +- ...m_service_credentials_secret.html.markdown | 156 ++++ ..._credentials_secret_metadata.html.markdown | 113 +++ ...m_service_credentials_secret.html.markdown | 222 +++++ 19 files changed, 3119 insertions(+), 114 deletions(-) create mode 100644 ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret.go create mode 100644 ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret_metadata.go create mode 100644 ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret_metadata_test.go create mode 100644 ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret_test.go create mode 100644 ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret.go create mode 100644 ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret_test.go create mode 100644 website/docs/d/sm_service_credentials_secret.html.markdown create mode 100644 website/docs/d/sm_service_credentials_secret_metadata.html.markdown create mode 100644 website/docs/r/sm_service_credentials_secret.html.markdown diff --git a/.secrets.baseline b/.secrets.baseline index f846664a78..dfa3b8db5b 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.mod|go.sum|.*.map|^.secrets.baseline$", "lines": null }, - "generated_at": "2023-12-11T01:02:37Z", + "generated_at": "2023-12-11T16:26:19Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -696,7 +696,7 @@ "hashed_secret": "912accc17209bb36cb22d76d430ef9e9ec99dd4c", "is_secret": false, "is_verified": false, - "line_number": 163, + "line_number": 188, "type": "Secret Keyword", "verified_result": null }, @@ -704,7 +704,7 @@ "hashed_secret": "514edd121688f936809a62aecd24419c7eaa772b", "is_secret": false, "is_verified": false, - "line_number": 250, + "line_number": 275, "type": "Secret Keyword", "verified_result": null }, @@ -712,7 +712,7 @@ "hashed_secret": "fa33d07da58b52eee9f13b88e9cda8b98f1c19b6", "is_secret": false, "is_verified": false, - "line_number": 261, + "line_number": 286, "type": "Secret Keyword", "verified_result": null }, @@ -720,7 +720,7 @@ "hashed_secret": "5926151b9a84e25fbc262e88ef6c1d58f0c95548", "is_secret": false, "is_verified": false, - "line_number": 273, + "line_number": 298, "type": "Secret Keyword", "verified_result": null } @@ -776,7 +776,7 @@ "hashed_secret": "813274ccae5b6b509379ab56982d862f7b5969b6", "is_secret": false, "is_verified": false, - "line_number": 1134, + "line_number": 1128, "type": "Base64 High Entropy String", "verified_result": null } @@ -864,7 +864,7 @@ "hashed_secret": "c8b6f5ef11b9223ac35a5663975a466ebe7ebba9", "is_secret": false, "is_verified": false, - "line_number": 1807, + "line_number": 1806, "type": "Secret Keyword", "verified_result": null }, @@ -872,7 +872,7 @@ "hashed_secret": "8abf4899c01104241510ba87685ad4de76b0c437", "is_secret": false, "is_verified": false, - "line_number": 1813, + "line_number": 1812, "type": "Secret Keyword", "verified_result": null } @@ -3453,6 +3453,34 @@ "verified_result": null } ], + "ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret.go": [ + { + "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", + "is_secret": false, + "is_verified": false, + "line_number": 196, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", + "is_secret": false, + "is_verified": false, + "line_number": 387, + "type": "Secret Keyword", + "verified_result": null + } + ], + "ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret_metadata.go": [ + { + "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", + "is_secret": false, + "is_verified": false, + "line_number": 179, + "type": "Secret Keyword", + "verified_result": null + } + ], "ibm/service/secretsmanager/data_source_ibm_sm_username_password_secret.go": [ { "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", @@ -3761,6 +3789,24 @@ "verified_result": null } ], + "ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret.go": [ + { + "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", + "is_secret": false, + "is_verified": false, + "line_number": 190, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", + "is_secret": false, + "is_verified": false, + "line_number": 443, + "type": "Secret Keyword", + "verified_result": null + } + ], "ibm/service/secretsmanager/resource_ibm_sm_username_password_secret.go": [ { "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", @@ -4909,6 +4955,24 @@ "verified_result": null } ], + "website/docs/r/sm_service_credentials_secret.html.markdown": [ + { + "hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e", + "is_secret": false, + "is_verified": false, + "line_number": 191, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "e66e7d67fdf3c596c435fc7828b13205e4950a0f", + "is_secret": false, + "is_verified": false, + "line_number": 193, + "type": "Secret Keyword", + "verified_result": null + } + ], "website/docs/r/sm_username_password_secret.html.markdown": [ { "hashed_secret": "e3efaa78f2f6ca38f70ded91b232d8dac947315d", diff --git a/examples/ibm-secrets-manager/README.md b/examples/ibm-secrets-manager/README.md index 04a144758a..f68677dec5 100644 --- a/examples/ibm-secrets-manager/README.md +++ b/examples/ibm-secrets-manager/README.md @@ -131,6 +131,31 @@ resource "sm_iam_credentials_secret" "sm_iam_credentials_secret_instance" { rotation = var.sm_iam_credentials_secret_rotation } ``` +sm_service_credentials_secret resource: + +```hcl +resource "ibm_sm_service_credentials_secret" "sm_service_credentials_secret" { + instance_id = var.secrets_manager_instance_id + region = var.region + endpoint_type = var.endpoint_type + name = var.sm_service_credentials_secret_name + custom_metadata = { my_key = jsonencode(var.sm_service_credentials_secret_custom_metadata) } + description = var.sm_service_credentials_secret_description + labels = var.sm_service_credentials_secret_labels + rotation = var.sm_service_credentials_secret_rotation + secret_group_id = var.sm_service_credentials_secret_secret_group_id + source_service { + instance { + crn = var.sm_service_credentials_secret_source_service_instance_crn + } + role { + crn = var.sm_service_credentials_secret_source_service_role_crn + } + parameters = var.sm_service_credentials_secret_source_service_parameters + } + ttl = var.sm_service_credentials_secret_ttl +} +``` sm_arbitrary_secret resource: ```hcl @@ -349,6 +374,15 @@ data "sm_iam_credentials_secret_metadata" "sm_iam_credentials_secret_metadata_in secret_id = var.sm_iam_credentials_secret_metadata_id } ``` +sm_service_credentials_secret_metadata data source: + +```hcl +data "sm_service_credentials_secret_metadata" "sm_service_credentials_secret_metadata_instance" { + instance_id = var.secrets_manager_instance_id + region = var.region + secret_id = var.sm_service_credentials_secret_metadata_id +} +``` sm_arbitrary_secret_metadata data source: ```hcl @@ -403,6 +437,15 @@ data "sm_iam_credentials_secret" "sm_iam_credentials_secret_instance" { secret_id = var.sm_iam_credentials_secret_id } ``` +sm_service_credentials_secret data source: + +```hcl +data "sm_service_credentials_secret" "sm_service_credentials_secret_instance" { + instance_id = var.secrets_manager_instance_id + region = var.region + secret_id = var.sm_service_credentials_secret_id +} +``` sm_arbitrary_secret data source: ```hcl @@ -524,103 +567,106 @@ data "sm_en_registration" "sm_en_registration_instance" { ## Inputs -| Name | Description | Type | Default | Required | -|----------------------------------------|-------------|------|---------|----------| -| ibmcloud\_api\_key | IBM Cloud API key | `string` | | true | -| region | Secrets Manager Instance region | `string` | us-south | false | -| secrets\_manager\_instance\_id | Secrets Manager Instance GUID | `string` | | true | -| instance\_id | Secrets Manager Instance GUID | `string` | | true | -| endpoint\_type | Secrets manager endpoint type | `string` | `private` | false | -| description | An extended description of your secret group.To protect your privacy, do not use personal data, such as your name or location, as a description for your secret group. | `string` | false | -| custom_metadata | The secret metadata that a user can customize. | `map()` | false | -| description | An extended description of your secret.To protect your privacy, do not use personal data, such as your name or location, as a description for your secret group. | `string` | false | -| expiration_date | The date a secret is expired. The date format follows RFC 3339. | `` | false | -| labels | Labels that you can use to search for secrets in your instance.Up to 30 labels can be created. | `list(string)` | false | -| secret_group_id | A v4 UUID identifier, or `default` secret group. | `string` | false | -| secret_type | The secret type. Supported types are arbitrary, certificates (imported, public, and private), IAM credentials, key-value, and user credentials. | `string` | false | -| certificate | The PEM-encoded contents of your certificate. | `string` | false | -| intermediate | (Optional) The PEM-encoded intermediate certificate to associate with the root certificate. | `string` | false | -| private_key | (Optional) The PEM-encoded private key to associate with the certificate. | `string` | false | -| custom_metadata | The secret metadata that a user can customize. | `map()` | false | -| rotation | Determines whether Secrets Manager rotates your secrets automatically. | `` | false | -| data | The payload data of a key-value secret. | `map()` | false | -| ttl | The time-to-live (TTL) or lease duration to assign to generated credentials.For `iam_credentials` secrets, the TTL defines for how long each generated API key remains valid. The value can be either an integer that specifies the number of seconds, or the string representation of a duration, such as `120m` or `24h`.Minimum duration is 1 minute. Maximum is 90 days. | `string` | false | -| access_groups | Access Groups that you can use for an `iam_credentials` secret.Up to 10 Access Groups can be used for each secret. | `list(string)` | false | -| service_id | The service ID under which the API key (see the `api_key` field) is created.If you omit this parameter, Secrets Manager generates a new service ID for your secret at its creation and adds it to the access groups that you assign.Optionally, you can use this field to provide your own service ID if you prefer to manage its access directly or retain the service ID after your secret expires, is rotated, or deleted. If you provide a service ID, do not include the `access_groups` parameter. | `string` | false | -| reuse_api_key | Determines whether to use the same service ID and API key for future read operations on an`iam_credentials` secret.If it is set to `true`, the service reuses the current credentials. If it is set to `false`, a new service ID and API key are generated each time that the secret is read or accessed. | `bool` | false | -| payload | The arbitrary secret's data payload. | `string` | false | -| username | The username that is assigned to the secret. | `string` | false | -| password | The password that is assigned to the secret. | `string` | false | -| secret_id | The ID of the secret. | `string` | true | -| certificate_template | The name of the certificate template. | `string` | false | -| config_type | Th configuration type. | `string` | false | -| crl_disable | Disables or enables certificate revocation list (CRL) building.If CRL building is disabled, a signed but zero-length CRL is returned when downloading the CRL. If CRL building is enabled, it will rebuild the CRL. | `bool` | false | -| crl_distribution_points_encoded | Determines whether to encode the certificate revocation list (CRL) distribution points in the certificates that are issued by this certificate authority. | `bool` | false | -| issuing_certificates_urls_encoded | Determines whether to encode the URL of the issuing certificate in the certificates that are issued by this certificate authority. | `bool` | false | -| ttl | The requested time-to-live (TTL) for certificates that are created by this CA. This field's value cannot be longer than the `max_ttl` limit.The value can be supplied as a string representation of a duration in hours, for example '8760h'. In the API response, this value is returned in seconds (integer). | `string` | false | -| signing_method | The signing method to use with this certificate authority to generate private certificates.You can choose between internal or externally signed options. For more information, see the [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-intermediate-certificate-authorities). | `string` | false | -| certificate_authority | The name of the intermediate certificate authority. | `string` | false | -| allowed_secret_groups | Scopes the creation of private certificates to only the secret groups that you specify.This field can be supplied as a comma-delimited list of secret group IDs. | `string` | false | -| allow_localhost | Determines whether to allow `localhost` to be included as one of the requested common names. | `bool` | false | -| allowed_domains | The domains to define for the certificate template. This property is used along with the `allow_bare_domains` and `allow_subdomains` options. | `list(string)` | false | -| allowed_domains_template | Determines whether to allow the domains that are supplied in the `allowed_domains` field to contain access control list (ACL) templates. | `bool` | false | -| allow_bare_domains | Determines whether to allow clients to request private certificates that match the value of the actual domains on the final certificate.For example, if you specify `example.com` in the `allowed_domains` field, you grant clients the ability to request a certificate that contains the name `example.com` as one of the DNS values on the final certificate.**Important:** In some scenarios, allowing bare domains can be considered a security risk. | `bool` | false | -| allow_subdomains | Determines whether to allow clients to request private certificates with common names (CN) that are subdomains of the CNs that are allowed by the other certificate template options. This includes wildcard subdomains.For example, if `allowed_domains` has a value of `example.com` and `allow_subdomains`is set to `true`, then the following subdomains are allowed: `foo.example.com`, `bar.example.com`, `*.example.com`.**Note:** This field is redundant if you use the `allow_any_name` option. | `bool` | false | -| allow_glob_domains | Determines whether to allow glob patterns, for example, `ftp*.example.com`, in the names that are specified in the `allowed_domains` field.If set to `true`, clients are allowed to request private certificates with names that match the glob patterns. | `bool` | false | -| allow_any_name | Determines whether to allow clients to request a private certificate that matches any common name. | `bool` | false | -| enforce_hostnames | Determines whether to enforce only valid host names for common names, DNS Subject Alternative Names, and the host section of email addresses. | `bool` | false | -| allow_ip_sans | Determines whether to allow clients to request a private certificate with IP Subject Alternative Names. | `bool` | false | -| allowed_uri_sans | The URI Subject Alternative Names to allow for private certificates.Values can contain glob patterns, for example `spiffe://hostname/_*`. | `list(string)` | false | -| allowed_other_sans | The custom Object Identifier (OID) or UTF8-string Subject Alternative Names (SANs) to allow for private certificates.The format for each element in the list is the same as OpenSSL: `::` where the current valid type is `UTF8`. To allow any value for an OID, use `*` as its value. Alternatively, specify a single `*` to allow any `other_sans` input. | `list(string)` | false | -| server_flag | Determines whether private certificates are flagged for server use. | `bool` | false | -| client_flag | Determines whether private certificates are flagged for client use. | `bool` | false | -| code_signing_flag | Determines whether private certificates are flagged for code signing use. | `bool` | false | -| email_protection_flag | Determines whether private certificates are flagged for email protection use. | `bool` | false | -| key_usage | The allowed key usage constraint to define for private certificates.You can find valid values in the [Go x509 package documentation](https://pkg.go.dev/crypto/x509#KeyUsage). Omit the `KeyUsage` part of the value. Values are not case-sensitive. To specify no key usage constraints, set this field to an empty list. | `list(string)` | false | -| ext_key_usage | The allowed extended key usage constraint on private certificates.You can find valid values in the [Go x509 package documentation](https://golang.org/pkg/crypto/x509/#ExtKeyUsage). Omit the `ExtKeyUsage` part of the value. Values are not case-sensitive. To specify no key usage constraints, set this field to an empty list. | `list(string)` | false | -| ext_key_usage_oids | A list of extended key usage Object Identifiers (OIDs). | `list(string)` | false | -| use_csr_common_name | When used with the `private_cert_configuration_action_sign_csr` action, this field determines whether to use the common name (CN) from a certificate signing request (CSR) instead of the CN that's included in the data of the certificate.Does not include any requested Subject Alternative Names (SANs) in the CSR. To use the alternative names, include the `use_csr_sans` property. | `bool` | false | -| use_csr_sans | When used with the `private_cert_configuration_action_sign_csr` action, this field determines whether to use the Subject Alternative Names(SANs) from a certificate signing request (CSR) instead of the SANs that are included in the data of the certificate.Does not include the common name in the CSR. To use the common name, include the `use_csr_common_name` property. | `bool` | false | -| require_cn | Determines whether to require a common name to create a private certificate.By default, a common name is required to generate a certificate. To make the `common_name` field optional, set the `require_cn` option to `false`. | `bool` | false | -| policy_identifiers | A list of policy Object Identifiers (OIDs). | `list(string)` | false | -| basic_constraints_valid_for_non_ca | Determines whether to mark the Basic Constraints extension of an issued private certificate as valid for non-CA certificates. | `bool` | false | -| lets_encrypt_environment | The configuration of the Let's Encrypt CA environment. | `string` | false | -| lets_encrypt_private_key | The PEM encoded private key of your Lets Encrypt account. | `string` | false | -| lets_encrypt_preferred_chain | Prefer the chain with an issuer matching this Subject Common Name. | `string` | false | -| event_notifications_instance_crn | A CRN that uniquely identifies an IBM Cloud resource. | `string` | true | -| event_notifications_source_name | The name that is displayed as a source that is in your Event Notifications instance. | `string` | true | -| event_notifications_source_description | An optional description for the source that is in your Event Notifications instance. | `string` | false | -| secret_group_id | The ID of the secret group. | `string` | true | -| secret_id | The ID of the secret. | `string` | true | -| name | The name of the configuration. | `string` | true | +| Name | Description | Type | Default | Required | +|----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|-----------|----------| +| ibmcloud\_api\_key | IBM Cloud API key | `string` | | true | +| region | Secrets Manager Instance region | `string` | us-south | false | +| secrets\_manager\_instance\_id | Secrets Manager Instance GUID | `string` | | true | +| instance\_id | Secrets Manager Instance GUID | `string` | | true | +| endpoint\_type | Secrets manager endpoint type | `string` | `private` | false | +| description | An extended description of your secret group.To protect your privacy, do not use personal data, such as your name or location, as a description for your secret group. | `string` | false | +| custom_metadata | The secret metadata that a user can customize. | `map()` | false | +| description | An extended description of your secret.To protect your privacy, do not use personal data, such as your name or location, as a description for your secret group. | `string` | false | +| expiration_date | The date a secret is expired. The date format follows RFC 3339. | `` | false | +| labels | Labels that you can use to search for secrets in your instance.Up to 30 labels can be created. | `list(string)` | false | +| secret_group_id | A v4 UUID identifier, or `default` secret group. | `string` | false | +| secret_type | The secret type. Supported types are arbitrary, certificates (imported, public, and private), IAM credentials, key-value, and user credentials. | `string` | false | +| certificate | The PEM-encoded contents of your certificate. | `string` | false | +| intermediate | (Optional) The PEM-encoded intermediate certificate to associate with the root certificate. | `string` | false | +| private_key | (Optional) The PEM-encoded private key to associate with the certificate. | `string` | false | +| custom_metadata | The secret metadata that a user can customize. | `map()` | false | +| rotation | Determines whether Secrets Manager rotates your secrets automatically. | `` | false | +| source_service | The properties required for creating the service credentials for the specified source service instance. | `` | false | +| data | The payload data of a key-value secret. | `map()` | false | +| ttl | The time-to-live (TTL) or lease duration to assign to generated credentials.The TTL defines for how long generated credentials remain valid. For iam_credentials secret TTL is mandatory. The minimum duration is 1 minute. The maximum is 90 days. For service_credentials secret TTL is optional, if set the minimum duration is 1 day. The maximum is 90 days. The TTL defaults to 0 which means no TTL. | `string` | false | +| access_groups | Access Groups that you can use for an `iam_credentials` secret.Up to 10 Access Groups can be used for each secret. | `list(string)` | false | +| service_id | The service ID under which the API key (see the `api_key` field) is created.If you omit this parameter, Secrets Manager generates a new service ID for your secret at its creation and adds it to the access groups that you assign.Optionally, you can use this field to provide your own service ID if you prefer to manage its access directly or retain the service ID after your secret expires, is rotated, or deleted. If you provide a service ID, do not include the `access_groups` parameter. | `string` | false | +| reuse_api_key | Determines whether to use the same service ID and API key for future read operations on an`iam_credentials` secret.If it is set to `true`, the service reuses the current credentials. If it is set to `false`, a new service ID and API key are generated each time that the secret is read or accessed. | `bool` | false | +| payload | The arbitrary secret's data payload. | `string` | false | +| username | The username that is assigned to the secret. | `string` | false | +| password | The password that is assigned to the secret. | `string` | false | +| secret_id | The ID of the secret. | `string` | true | +| certificate_template | The name of the certificate template. | `string` | false | +| config_type | Th configuration type. | `string` | false | +| crl_disable | Disables or enables certificate revocation list (CRL) building.If CRL building is disabled, a signed but zero-length CRL is returned when downloading the CRL. If CRL building is enabled, it will rebuild the CRL. | `bool` | false | +| crl_distribution_points_encoded | Determines whether to encode the certificate revocation list (CRL) distribution points in the certificates that are issued by this certificate authority. | `bool` | false | +| issuing_certificates_urls_encoded | Determines whether to encode the URL of the issuing certificate in the certificates that are issued by this certificate authority. | `bool` | false | +| ttl | The requested time-to-live (TTL) for certificates that are created by this CA. This field's value cannot be longer than the `max_ttl` limit.The value can be supplied as a string representation of a duration in hours, for example '8760h'. In the API response, this value is returned in seconds (integer). | `string` | false | +| signing_method | The signing method to use with this certificate authority to generate private certificates.You can choose between internal or externally signed options. For more information, see the [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-intermediate-certificate-authorities). | `string` | false | +| certificate_authority | The name of the intermediate certificate authority. | `string` | false | +| allowed_secret_groups | Scopes the creation of private certificates to only the secret groups that you specify.This field can be supplied as a comma-delimited list of secret group IDs. | `string` | false | +| allow_localhost | Determines whether to allow `localhost` to be included as one of the requested common names. | `bool` | false | +| allowed_domains | The domains to define for the certificate template. This property is used along with the `allow_bare_domains` and `allow_subdomains` options. | `list(string)` | false | +| allowed_domains_template | Determines whether to allow the domains that are supplied in the `allowed_domains` field to contain access control list (ACL) templates. | `bool` | false | +| allow_bare_domains | Determines whether to allow clients to request private certificates that match the value of the actual domains on the final certificate.For example, if you specify `example.com` in the `allowed_domains` field, you grant clients the ability to request a certificate that contains the name `example.com` as one of the DNS values on the final certificate.**Important:** In some scenarios, allowing bare domains can be considered a security risk. | `bool` | false | +| allow_subdomains | Determines whether to allow clients to request private certificates with common names (CN) that are subdomains of the CNs that are allowed by the other certificate template options. This includes wildcard subdomains.For example, if `allowed_domains` has a value of `example.com` and `allow_subdomains`is set to `true`, then the following subdomains are allowed: `foo.example.com`, `bar.example.com`, `*.example.com`.**Note:** This field is redundant if you use the `allow_any_name` option. | `bool` | false | +| allow_glob_domains | Determines whether to allow glob patterns, for example, `ftp*.example.com`, in the names that are specified in the `allowed_domains` field.If set to `true`, clients are allowed to request private certificates with names that match the glob patterns. | `bool` | false | +| allow_any_name | Determines whether to allow clients to request a private certificate that matches any common name. | `bool` | false | +| enforce_hostnames | Determines whether to enforce only valid host names for common names, DNS Subject Alternative Names, and the host section of email addresses. | `bool` | false | +| allow_ip_sans | Determines whether to allow clients to request a private certificate with IP Subject Alternative Names. | `bool` | false | +| allowed_uri_sans | The URI Subject Alternative Names to allow for private certificates.Values can contain glob patterns, for example `spiffe://hostname/_*`. | `list(string)` | false | +| allowed_other_sans | The custom Object Identifier (OID) or UTF8-string Subject Alternative Names (SANs) to allow for private certificates.The format for each element in the list is the same as OpenSSL: `::` where the current valid type is `UTF8`. To allow any value for an OID, use `*` as its value. Alternatively, specify a single `*` to allow any `other_sans` input. | `list(string)` | false | +| server_flag | Determines whether private certificates are flagged for server use. | `bool` | false | +| client_flag | Determines whether private certificates are flagged for client use. | `bool` | false | +| code_signing_flag | Determines whether private certificates are flagged for code signing use. | `bool` | false | +| email_protection_flag | Determines whether private certificates are flagged for email protection use. | `bool` | false | +| key_usage | The allowed key usage constraint to define for private certificates.You can find valid values in the [Go x509 package documentation](https://pkg.go.dev/crypto/x509#KeyUsage). Omit the `KeyUsage` part of the value. Values are not case-sensitive. To specify no key usage constraints, set this field to an empty list. | `list(string)` | false | +| ext_key_usage | The allowed extended key usage constraint on private certificates.You can find valid values in the [Go x509 package documentation](https://golang.org/pkg/crypto/x509/#ExtKeyUsage). Omit the `ExtKeyUsage` part of the value. Values are not case-sensitive. To specify no key usage constraints, set this field to an empty list. | `list(string)` | false | +| ext_key_usage_oids | A list of extended key usage Object Identifiers (OIDs). | `list(string)` | false | +| use_csr_common_name | When used with the `private_cert_configuration_action_sign_csr` action, this field determines whether to use the common name (CN) from a certificate signing request (CSR) instead of the CN that's included in the data of the certificate.Does not include any requested Subject Alternative Names (SANs) in the CSR. To use the alternative names, include the `use_csr_sans` property. | `bool` | false | +| use_csr_sans | When used with the `private_cert_configuration_action_sign_csr` action, this field determines whether to use the Subject Alternative Names(SANs) from a certificate signing request (CSR) instead of the SANs that are included in the data of the certificate.Does not include the common name in the CSR. To use the common name, include the `use_csr_common_name` property. | `bool` | false | +| require_cn | Determines whether to require a common name to create a private certificate.By default, a common name is required to generate a certificate. To make the `common_name` field optional, set the `require_cn` option to `false`. | `bool` | false | +| policy_identifiers | A list of policy Object Identifiers (OIDs). | `list(string)` | false | +| basic_constraints_valid_for_non_ca | Determines whether to mark the Basic Constraints extension of an issued private certificate as valid for non-CA certificates. | `bool` | false | +| lets_encrypt_environment | The configuration of the Let's Encrypt CA environment. | `string` | false | +| lets_encrypt_private_key | The PEM encoded private key of your Lets Encrypt account. | `string` | false | +| lets_encrypt_preferred_chain | Prefer the chain with an issuer matching this Subject Common Name. | `string` | false | +| event_notifications_instance_crn | A CRN that uniquely identifies an IBM Cloud resource. | `string` | true | +| event_notifications_source_name | The name that is displayed as a source that is in your Event Notifications instance. | `string` | true | +| event_notifications_source_description | An optional description for the source that is in your Event Notifications instance. | `string` | false | +| secret_group_id | The ID of the secret group. | `string` | true | +| secret_id | The ID of the secret. | `string` | true | +| name | The name of the configuration. | `string` | true | ## Outputs -| Name | Description | -|------|-------------| -| secrets\_manager\_secrets | secrets\_manager\_secrets object | -| secrets\_manager\_secret | secrets\_manager\_secret object | -| sm_secret_group | sm_secret_group object | -| sm_imported_certificate | sm_imported_certificate object | -| sm_public_certificate | sm_public_certificate object | -| sm_kv_secret | sm_kv_secret object | -| sm_iam_credentials_secret | sm_iam_credentials_secret object | -| sm_arbitrary_secret | sm_arbitrary_secret object | -| sm_username_password_secret | sm_username_password_secret object | -| sm_private_certificate | sm_private_certificate object | -| sm_private_certificate_configuration_root_ca | sm_private_certificate_configuration_root_ca object | +| Name | Description | +|------------------------------------------------------|-------------------------------------------------------------| +| secrets\_manager\_secrets | secrets\_manager\_secrets object | +| secrets\_manager\_secret | secrets\_manager\_secret object | +| sm_secret_group | sm_secret_group object | +| sm_imported_certificate | sm_imported_certificate object | +| sm_public_certificate | sm_public_certificate object | +| sm_kv_secret | sm_kv_secret object | +| sm_iam_credentials_secret | sm_iam_credentials_secret object | +| sm_service_credentials_secret | sm_service_credentials_secret object | +| sm_arbitrary_secret | sm_arbitrary_secret object | +| sm_username_password_secret | sm_username_password_secret object | +| sm_private_certificate | sm_private_certificate object | +| sm_private_certificate_configuration_root_ca | sm_private_certificate_configuration_root_ca object | | sm_private_certificate_configuration_intermediate_ca | sm_private_certificate_configuration_intermediate_ca object | -| sm_private_certificate_configuration_template | sm_private_certificate_configuration_template object | -| sm_public_certificate_configuration_ca_lets_encrypt | sm_public_certificate_configuration_ca_lets_encrypt object | -| sm_en_registration | sm_en_registration object | -| sm_secret_group | sm_secret_group object | -| sm_secret_groups | sm_secret_groups object | -| sm_secrets | sm_secrets object | -| sm_imported_certificate_metadata | sm_imported_certificate_metadata object | -| sm_public_certificate_metadata | sm_public_certificate_metadata object | -| sm_kv_secret_metadata | sm_kv_secret_metadata object | -| sm_iam_credentials_secret_metadata | sm_iam_credentials_secret_metadata object | -| sm_arbitrary_secret_metadata | sm_arbitrary_secret_metadata object | -| sm_username_password_secret_metadata | sm_username_password_secret_metadata object | -| sm_private_certificate_metadata | sm_private_certificate_metadata object | -| sm_configurations | sm_configurations object | +| sm_private_certificate_configuration_template | sm_private_certificate_configuration_template object | +| sm_public_certificate_configuration_ca_lets_encrypt | sm_public_certificate_configuration_ca_lets_encrypt object | +| sm_en_registration | sm_en_registration object | +| sm_secret_group | sm_secret_group object | +| sm_secret_groups | sm_secret_groups object | +| sm_secrets | sm_secrets object | +| sm_imported_certificate_metadata | sm_imported_certificate_metadata object | +| sm_public_certificate_metadata | sm_public_certificate_metadata object | +| sm_kv_secret_metadata | sm_kv_secret_metadata object | +| sm_iam_credentials_secret_metadata | sm_iam_credentials_secret_metadata object | +| sm_service_credentials_secret_metadata | sm_service_credentials_secret_metadata object | +| sm_arbitrary_secret_metadata | sm_arbitrary_secret_metadata object | +| sm_username_password_secret_metadata | sm_username_password_secret_metadata object | +| sm_private_certificate_metadata | sm_private_certificate_metadata object | +| sm_configurations | sm_configurations object | diff --git a/examples/ibm-secrets-manager/main.tf b/examples/ibm-secrets-manager/main.tf index 1e1a89fccb..5823fb3fa6 100644 --- a/examples/ibm-secrets-manager/main.tf +++ b/examples/ibm-secrets-manager/main.tf @@ -81,6 +81,33 @@ resource "ibm_sm_iam_credentials_secret" "sm_iam_credentials_secret_instance" { } } +// Provision sm_service_credentials_secret resource instance +resource "ibm_sm_service_credentials_secret" "sm_service_credentials_secret" { + instance_id = var.secrets_manager_instance_id + region = var.region + endpoint_type = var.endpoint_type + name = var.sm_service_credentials_secret_name + custom_metadata = { my_key = jsonencode(var.sm_service_credentials_secret_custom_metadata) } + description = var.sm_service_credentials_secret_description + labels = var.sm_service_credentials_secret_labels + rotation { + auto_rotate = true + interval = 1 + unit = "day" + } + secret_group_id = var.sm_service_credentials_secret_secret_group_id + source_service { + instance { + crn = var.sm_service_credentials_secret_source_service_instance_crn + } + role { + crn = var.sm_service_credentials_secret_source_service_role_crn + } + parameters = var.sm_service_credentials_secret_source_service_parameters + } + ttl = var.sm_service_credentials_secret_ttl +} + // Provision sm_arbitrary_secret resource instance resource "ibm_sm_arbitrary_secret" "sm_arbitrary_secret_instance" { instance_id = var.secrets_manager_instance_id @@ -304,6 +331,14 @@ data "ibm_sm_iam_credentials_secret_metadata" "sm_iam_credentials_secret_metadat secret_id = var.sm_iam_credentials_secret_metadata_id } +// Create sm_service_credentials_secret_metadata data source +data "ibm_sm_service_credentials_secret_metadata" "sm_service_credentials_secret_metadata_instance" { + instance_id = var.secrets_manager_instance_id + region = var.region + endpoint_type = var.endpoint_type + secret_id = var.sm_service_credentials_secret_metadata_id +} + // Create sm_arbitrary_secret_metadata data source data "ibm_sm_arbitrary_secret_metadata" "sm_arbitrary_secret_metadata_instance" { instance_id = var.secrets_manager_instance_id @@ -352,6 +387,14 @@ data "ibm_sm_iam_credentials_secret" "sm_iam_credentials_secret_instance" { secret_id = var.sm_iam_credentials_secret_id } +// Create sm_service_credentials_secret data source +data "ibm_sm_service_credentials_secret" "sm_service_credentials_secret_instance" { + instance_id = var.secrets_manager_instance_id + region = var.region + endpoint_type = var.endpoint_type + secret_id = var.sm_service_credentials_secret_id +} + // Create sm_arbitrary_secret data source data "ibm_sm_arbitrary_secret" "sm_arbitrary_secret_instance" { instance_id = var.secrets_manager_instance_id diff --git a/examples/ibm-secrets-manager/outputs.tf b/examples/ibm-secrets-manager/outputs.tf index 9ea26978eb..9684c8c1eb 100644 --- a/examples/ibm-secrets-manager/outputs.tf +++ b/examples/ibm-secrets-manager/outputs.tf @@ -45,6 +45,12 @@ output "ibm_sm_iam_credentials_secret" { value = ibm_sm_iam_credentials_secret.sm_iam_credentials_secret_instance description = "sm_iam_credentials_secret resource instance" } +// This allows sm_service_credentials_secret data to be referenced by other resources and the terraform CLI +// Modify this if only certain data should be exposed +output "ibm_sm_service_credentials_secret" { + value = ibm_sm_service_credentials_secret.sm_service_credentials_secret_instance + description = "sm_service_credentials_secret resource instance" +} // This allows sm_arbitrary_secret data to be referenced by other resources and the terraform CLI // Modify this if only certain data should be exposed output "ibm_sm_arbitrary_secret" { diff --git a/examples/ibm-secrets-manager/variables.tf b/examples/ibm-secrets-manager/variables.tf index 6c713285b8..fba28a2af8 100644 --- a/examples/ibm-secrets-manager/variables.tf +++ b/examples/ibm-secrets-manager/variables.tf @@ -210,6 +210,54 @@ variable "sm_iam_credentials_secret_reuse_api_key" { default = true } +// Resource arguments for sm_service_credentials_secret +variable "sm_service_credentials_name" { + description = "The human-readable name of your secret." + type = string + default = "my-service-credentials-secret" +} +variable "sm_service_credentials_secret_custom_metadata" { + description = "The secret metadata that a user can customize." + type = any + default = "anything as a string" +} +variable "sm_service_credentials_secret_description" { + description = "An extended description of your secret.To protect your privacy, do not use personal data, such as your name or location, as a description for your secret group." + type = string + default = "Extended description for this secret." +} +variable "sm_service_credentials_secret_labels" { + description = "Labels that you can use to search for secrets in your instance.Up to 30 labels can be created." + type = list(string) + default = [ "my-label" ] +} +variable "sm_service_credentials_secret_secret_group_id" { + description = "A v4 UUID identifier, or `default` secret group." + type = string + default = "default" +} +variable "sm_service_credentials_secret_source_service_instance_crn" { + description = "A CRN that uniquely identifies a service credentials source" + type = string + default = "crn:v1:staging:public:cloud-object-storage:global:a/111f5fb10986423e9saa8512f1db7e65:111133c8-49ea-41xe-8c40-122038246f5b::" +} +variable "sm_service_credentials_secret_source_service_role_crn" { + description = "The service-specific custom role object, CRN role is accepted. Refer to the service’s documentation for supported roles." + type = string + default = "crn:v1:bluemix:public:iam::::serviceRole:Writer" +} +variable "sm_service_credentials_secret_source_service_parameters" { + description = "Configuration options represented as key-value pairs. Service-defined options are used in the generation of credentials for some services." + type = string + default = {} +} +variable "sm_service_credentials_secret_ttl" { + description = "The time-to-live (TTL) or lease duration to assign to generated credentials. The TTL defines for how long generated credentials remain valid. The value should be a string that specifies the number of seconds. Minimum duration is 86400 (1 day). Maximum is 7776000 seconds (90 days)." + type = string + default = "86401" +} + + // Resource arguments for sm_arbitrary_secret variable "sm_arbitrary_secret_name" { description = "The human-readable name of your secret." @@ -705,6 +753,14 @@ variable "sm_iam_credentials_secret_metadata_id" { default = "0b5571f7-21e6-42b7-91c5-3f5ac9793a46" } +// Data source arguments for sm_service_credentials_secret_metadata +variable "sm_service_credentials_secret_metadata_id" { + description = "The ID of the secret." + type = string + default = "0b5571f7-21e6-42b7-91c5-3f5ac9793a46" +} + + // Data source arguments for sm_arbitrary_secret_metadata variable "sm_arbitrary_secret_metadata_id" { description = "The ID of the secret." @@ -747,6 +803,13 @@ variable "sm_iam_credentials_secret_id" { default = "0b5571f7-21e6-42b7-91c5-3f5ac9793a46" } +// Data source arguments for sm_service_credentials_secret +variable "sm_service_credentials_secret_id" { + description = "The ID of the secret." + type = string + default = "0b5571f7-21e6-42b7-91c5-3f5ac9793a46" +} + // Data source arguments for sm_arbitrary_secret variable "sm_arbitrary_secret_id" { description = "The ID of the secret." diff --git a/go.mod b/go.mod index f7c431a96b..d69e3df819 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 github.com/IBM/scc-go-sdk/v5 v5.1.3 github.com/IBM/schematics-go-sdk v0.2.2 - github.com/IBM/secrets-manager-go-sdk/v2 v2.0.1 + github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2 github.com/IBM/vpc-beta-go-sdk v0.6.0 github.com/IBM/vpc-go-sdk v0.43.0 github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5 diff --git a/go.sum b/go.sum index 8df8dccea4..9ee7c97b82 100644 --- a/go.sum +++ b/go.sum @@ -172,8 +172,8 @@ github.com/IBM/scc-go-sdk/v5 v5.1.3 h1:8zqJx/HgChTlMaC21HzthIR4HbFkuJ3dR/D68254j github.com/IBM/scc-go-sdk/v5 v5.1.3/go.mod h1:YtAVlzq10bwR82QX4ZavhDIwa1s85RuVO9N/KmXVcuk= github.com/IBM/schematics-go-sdk v0.2.2 h1:8S3hoVLzF/ZRgWDaLqwHnLmZvlEBHCKgHszmMh7yD2E= github.com/IBM/schematics-go-sdk v0.2.2/go.mod h1:Tw2OSAPdpC69AxcwoyqcYYaGTTW6YpERF9uNEU+BFRQ= -github.com/IBM/secrets-manager-go-sdk/v2 v2.0.1 h1:0Ouu31RsuOLdH26oNsnPErEjctWTplLEIXxwExnTZT0= -github.com/IBM/secrets-manager-go-sdk/v2 v2.0.1/go.mod h1:jagqWmjZ0zUEqh5jdGB42ApSQS40fu2LWw6pdg8JJko= +github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2 h1:+Svh1OmoFxMBnZQSOUtp2UUzrOGFsSQlE5TFL/ptJco= +github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2/go.mod h1:WII+LS4VkQYykmq65NWSuPb5xGNvsqkcK1aCWZoU2x4= github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc= github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA= github.com/IBM/vpc-go-sdk v0.43.0 h1:uy/qWIqETCXraUG2cq5sjScr6pZ79ZteY1v5iLUVQ3Q= diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 4e563d0cb8..4968af4c8a 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -146,6 +146,7 @@ var ( SecretsManagerPublicCertificateCommonName string SecretsManagerValidateManualDnsCisZoneId string SecretsManagerImportedCertificatePathToCertificate string + SecretsManagerServiceCredentialsCosCrn string SecretsManagerSecretType string SecretsManagerSecretID string ) @@ -1227,6 +1228,11 @@ func init() { fmt.Println("[INFO] Set the environment variable SECRETS_MANAGER_IMPORTED_CERTIFICATE_PATH_TO_CERTIFICATE for testing imported certificate's tests, else tests fail if not set correctly") } + SecretsManagerServiceCredentialsCosCrn = os.Getenv("SECRETS_MANAGER_SERVICE_CREDENTIALS_COS_CRN") + if SecretsManagerServiceCredentialsCosCrn == "" { + fmt.Println("[INFO] Set the environment variable SECRETS_MANAGER_SERVICE_CREDENTIALS_COS_CRN for testing service credentials' tests, else tests fail if not set correctly") + } + SecretsManagerSecretType = os.Getenv("SECRETS_MANAGER_SECRET_TYPE") if SecretsManagerSecretType == "" { SecretsManagerSecretType = "username_password" diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index c00464a12b..48915f7c9d 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -702,6 +702,7 @@ func Provider() *schema.Provider { "ibm_sm_public_certificate_metadata": secretsmanager.AddInstanceFields(secretsmanager.DataSourceIbmSmPublicCertificateMetadata()), "ibm_sm_private_certificate_metadata": secretsmanager.AddInstanceFields(secretsmanager.DataSourceIbmSmPrivateCertificateMetadata()), "ibm_sm_iam_credentials_secret_metadata": secretsmanager.AddInstanceFields(secretsmanager.DataSourceIbmSmIamCredentialsSecretMetadata()), + "ibm_sm_service_credentials_secret_metadata": secretsmanager.AddInstanceFields(secretsmanager.DataSourceIbmSmServiceCredentialsSecretMetadata()), "ibm_sm_kv_secret_metadata": secretsmanager.AddInstanceFields(secretsmanager.DataSourceIbmSmKvSecretMetadata()), "ibm_sm_username_password_secret_metadata": secretsmanager.AddInstanceFields(secretsmanager.DataSourceIbmSmUsernamePasswordSecretMetadata()), "ibm_sm_arbitrary_secret": secretsmanager.AddInstanceFields(secretsmanager.DataSourceIbmSmArbitrarySecret()), @@ -711,6 +712,7 @@ func Provider() *schema.Provider { "ibm_sm_iam_credentials_secret": secretsmanager.AddInstanceFields(secretsmanager.DataSourceIbmSmIamCredentialsSecret()), "ibm_sm_kv_secret": secretsmanager.AddInstanceFields(secretsmanager.DataSourceIbmSmKvSecret()), "ibm_sm_username_password_secret": secretsmanager.AddInstanceFields(secretsmanager.DataSourceIbmSmUsernamePasswordSecret()), + "ibm_sm_service_credentials_secret": secretsmanager.AddInstanceFields(secretsmanager.DataSourceIbmSmServiceCredentialsSecret()), "ibm_sm_en_registration": secretsmanager.AddInstanceFields(secretsmanager.DataSourceIbmSmEnRegistration()), // //Added for Satellite @@ -1246,6 +1248,7 @@ func Provider() *schema.Provider { "ibm_sm_public_certificate": secretsmanager.AddInstanceFields(secretsmanager.ResourceIbmSmPublicCertificate()), "ibm_sm_private_certificate": secretsmanager.AddInstanceFields(secretsmanager.ResourceIbmSmPrivateCertificate()), "ibm_sm_iam_credentials_secret": secretsmanager.AddInstanceFields(secretsmanager.ResourceIbmSmIamCredentialsSecret()), + "ibm_sm_service_credentials_secret": secretsmanager.AddInstanceFields(secretsmanager.ResourceIbmSmServiceCredentialsSecret()), "ibm_sm_username_password_secret": secretsmanager.AddInstanceFields(secretsmanager.ResourceIbmSmUsernamePasswordSecret()), "ibm_sm_kv_secret": secretsmanager.AddInstanceFields(secretsmanager.ResourceIbmSmKvSecret()), "ibm_sm_public_certificate_configuration_ca_lets_encrypt": secretsmanager.AddInstanceFields(secretsmanager.ResourceIbmSmPublicCertificateConfigurationCALetsEncrypt()), diff --git a/ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret.go b/ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret.go new file mode 100644 index 0000000000..bc5c17a8c9 --- /dev/null +++ b/ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret.go @@ -0,0 +1,506 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package secretsmanager + +import ( + "context" + "encoding/json" + "fmt" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/secrets-manager-go-sdk/v2/secretsmanagerv2" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func DataSourceIbmSmServiceCredentialsSecret() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmSmServiceCredentialsSecretRead, + + Schema: map[string]*schema.Schema{ + "secret_id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ExactlyOneOf: []string{"secret_id", "name"}, + Description: "The ID of the secret.", + }, + "created_by": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier that is associated with the entity that created the secret.", + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date when a resource was created. The date format follows RFC 3339.", + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A CRN that uniquely identifies an IBM Cloud resource.", + }, + "custom_metadata": &schema.Schema{ + Type: schema.TypeMap, + Computed: true, + Description: "The secret metadata that a user can customize.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "An extended description of your secret.To protect your privacy, do not use personal data, such as your name or location, as a description for your secret group.", + }, + "downloaded": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service API.", + }, + "labels": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Labels that you can use to search for secrets in your instance.Up to 30 labels can be created.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "locks_total": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The number of locks of the secret.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ExactlyOneOf: []string{"secret_id", "name"}, + RequiredWith: []string{"secret_group_name"}, + Description: "The human-readable name of your secret.", + }, + + "secret_group_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + ForceNew: true, + Description: "A v4 UUID identifier, or `default` secret group.", + }, + "secret_group_name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + RequiredWith: []string{"name"}, + Description: "The human-readable name of your secret group.", + }, + "secret_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The secret type. Supported types are arbitrary, certificates (imported, public, and private), IAM credentials, key-value, and user credentials.", + }, + "state": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The secret state that is based on NIST SP 800-57. States are integers and correspond to the `Pre-activation = 0`, `Active = 1`, `Suspended = 2`, `Deactivated = 3`, and `Destroyed = 5` values.", + }, + "state_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A text representation of the secret state.", + }, + "updated_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date when a resource was recently modified. The date format follows RFC 3339.", + }, + "versions_total": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The number of versions of the secret.", + }, + "ttl": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The time-to-live (TTL) or lease duration to assign to generated credentials.", + }, + "rotation": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Determines whether Secrets Manager rotates your secrets automatically.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "auto_rotate": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval.", + }, + "interval": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The length of the secret rotation time interval.", + }, + "unit": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The units for the secret rotation time interval.", + }, + }, + }, + }, + "next_rotation_date": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date that the secret is scheduled for automatic rotation. The service automatically creates a new version of the secret on its next rotation date. This field exists only for secrets that have an existing rotation policy.", + }, + "credentials": &schema.Schema{ + Type: schema.TypeMap, + Computed: true, + Sensitive: true, + Description: "The properties of the service credentials secret payload.", + }, + "source_service": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The properties required for creating the service credentials for the specified source service instance.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "instance": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The source service instance identifier.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A CRN that uniquely identifies a service credentials target.", + }, + }, + }, + }, + "role": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The service-specific custom role object, CRN role is accepted. Refer to the service’s documentation for supported roles.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN role identifier for creating a service-id.", + }, + }, + }, + }, + "iam": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The source service IAM data is returned in case IAM credentials where created for this secret.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "apikey": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The IAM apikey metadata for the IAM credentials that were generated.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IAM API key name for the generated service credentials.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IAM API key description for the generated service credentials.", + }, + }, + }, + }, + "role": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The IAM role for the generate service credentials.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IAM role CRN assigned to the generated service credentials.", + }, + }, + }, + }, + "serviceid": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The IAM serviceid for the generated service credentials.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IAM Service ID CRN.", + }, + }, + }, + }, + }, + }, + }, + "resource_key": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The source service resource key data of the generated service credentials.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource key CRN of the generated service credentials.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource key name of the generated service credentials.", + }, + }, + }, + }, + "parameters": &schema.Schema{ + Type: schema.TypeMap, + Computed: true, + Description: "The collection of parameters for the service credentials target.", + }, + }, + }, + }, + }, + } +} + +func dataSourceIbmSmServiceCredentialsSecretRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + ServiceCredentialsSecretIntf, region, instanceId, diagError := getSecretByIdOrByName(context, d, meta, ServiceCredentialsSecretType) + if diagError != nil { + return diagError + } + + ServiceCredentialsSecret := ServiceCredentialsSecretIntf.(*secretsmanagerv2.ServiceCredentialsSecret) + d.SetId(fmt.Sprintf("%s/%s/%s", region, instanceId, *ServiceCredentialsSecret.ID)) + + var err error + if err = d.Set("region", region); err != nil { + return diag.FromErr(fmt.Errorf("Error setting region: %s", err)) + } + if err = d.Set("created_by", ServiceCredentialsSecret.CreatedBy); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_by: %s", err)) + } + + if err = d.Set("created_at", DateTimeToRFC3339(ServiceCredentialsSecret.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + + if err = d.Set("crn", ServiceCredentialsSecret.Crn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting crn: %s", err)) + } + + if ServiceCredentialsSecret.CustomMetadata != nil { + convertedMap := make(map[string]interface{}, len(ServiceCredentialsSecret.CustomMetadata)) + for k, v := range ServiceCredentialsSecret.CustomMetadata { + convertedMap[k] = v + } + + if err = d.Set("custom_metadata", flex.Flatten(convertedMap)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting custom_metadata: %s", err)) + } + if err != nil { + return diag.FromErr(fmt.Errorf("Error setting custom_metadata %s", err)) + } + } + + if err = d.Set("description", ServiceCredentialsSecret.Description); err != nil { + return diag.FromErr(fmt.Errorf("Error setting description: %s", err)) + } + + if err = d.Set("downloaded", ServiceCredentialsSecret.Downloaded); err != nil { + return diag.FromErr(fmt.Errorf("Error setting downloaded: %s", err)) + } + + if ServiceCredentialsSecret.Labels != nil { + if err = d.Set("labels", ServiceCredentialsSecret.Labels); err != nil { + return diag.FromErr(fmt.Errorf("Error setting labels: %s", err)) + } + } + + if err = d.Set("locks_total", flex.IntValue(ServiceCredentialsSecret.LocksTotal)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting locks_total: %s", err)) + } + + if err = d.Set("name", ServiceCredentialsSecret.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + + if err = d.Set("secret_group_id", ServiceCredentialsSecret.SecretGroupID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting secret_group_id: %s", err)) + } + + if err = d.Set("secret_type", ServiceCredentialsSecret.SecretType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting secret_type: %s", err)) + } + + if err = d.Set("state", flex.IntValue(ServiceCredentialsSecret.State)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting state: %s", err)) + } + + if err = d.Set("state_description", ServiceCredentialsSecret.StateDescription); err != nil { + return diag.FromErr(fmt.Errorf("Error setting state_description: %s", err)) + } + + if err = d.Set("updated_at", DateTimeToRFC3339(ServiceCredentialsSecret.UpdatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting updated_at: %s", err)) + } + + if err = d.Set("versions_total", flex.IntValue(ServiceCredentialsSecret.VersionsTotal)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting versions_total: %s", err)) + } + + if err = d.Set("ttl", ServiceCredentialsSecret.TTL); err != nil { + return diag.FromErr(fmt.Errorf("Error setting ttl: %s", err)) + } + + rotation := []map[string]interface{}{} + if ServiceCredentialsSecret.Rotation != nil { + modelMap, err := dataSourceIbmSmServiceCredentialsSecretRotationPolicyToMap(ServiceCredentialsSecret.Rotation.(*secretsmanagerv2.RotationPolicy)) + if err != nil { + return diag.FromErr(err) + } + rotation = append(rotation, modelMap) + } + if err = d.Set("rotation", rotation); err != nil { + return diag.FromErr(fmt.Errorf("Error setting rotation %s", err)) + } + + if err = d.Set("next_rotation_date", DateTimeToRFC3339(ServiceCredentialsSecret.NextRotationDate)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting next_rotation_date: %s", err)) + } + + if ServiceCredentialsSecret.Credentials != nil { + var credInterface map[string]interface{} + cred, _ := json.Marshal(ServiceCredentialsSecret.Credentials) + json.Unmarshal(cred, &credInterface) + if err = d.Set("credentials", flex.Flatten(credInterface)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting credentials: %s", err)) + } + } + + sourceServiceMap, err := dataSourceIbmSmServiceCredentialsSecretSourceServiceToMap(ServiceCredentialsSecret.SourceService) + if err != nil { + return diag.FromErr(err) + } + if len(sourceServiceMap) > 0 { + if err = d.Set("source_service", []map[string]interface{}{sourceServiceMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting source_service: %s", err)) + } + } + + return nil +} + +func dataSourceIbmSmServiceCredentialsSecretRotationPolicyToMap(model *secretsmanagerv2.RotationPolicy) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.AutoRotate != nil { + modelMap["auto_rotate"] = *model.AutoRotate + } + if model.Interval != nil { + modelMap["interval"] = *model.Interval + } + if model.Unit != nil { + modelMap["unit"] = *model.Unit + } + return modelMap, nil +} + +func dataSourceIbmSmServiceCredentialsSecretSourceServiceToMap(sourceService *secretsmanagerv2.ServiceCredentialsSecretSourceService) (map[string]interface{}, error) { + mainModelMap := make(map[string]interface{}) + if sourceService.Instance != nil { + instanceMap := make(map[string]interface{}) + instanceModel := sourceService.Instance + if instanceModel.Crn != nil { + instanceMap["crn"] = instanceModel.Crn + } + mainModelMap["instance"] = []map[string]interface{}{instanceMap} + } + + if sourceService.Role != nil { + roleMap := make(map[string]interface{}) + roleModel := sourceService.Role + if roleModel.Crn != nil { + roleMap["crn"] = roleModel.Crn + } + mainModelMap["role"] = []map[string]interface{}{roleMap} + } + + if sourceService.Iam != nil { + iamMap := make(map[string]interface{}) + iamModel := sourceService.Iam + + // apikey + if iamModel.Apikey != nil { + iamApikeyMap := make(map[string]interface{}) + iamApikeyModel := iamModel.Apikey + if iamApikeyModel.Name != nil { + iamApikeyMap["name"] = iamApikeyModel.Name + } + if iamApikeyModel.Description != nil { + iamApikeyMap["description"] = iamApikeyModel.Description + } + iamMap["apikey"] = []map[string]interface{}{iamApikeyMap} + } + + // role + if iamModel.Role != nil { + iamRoleMap := make(map[string]interface{}) + iamRoleModel := iamModel.Role + if iamRoleModel.Crn != nil { + iamRoleMap["crn"] = iamRoleModel.Crn + } + iamMap["role"] = []map[string]interface{}{iamRoleMap} + } + + // service id + if iamModel.Serviceid != nil { + iamServiceidMap := make(map[string]interface{}) + iamServiceidModel := iamModel.Serviceid + if iamServiceidModel.Crn != nil { + iamServiceidMap["crn"] = iamServiceidModel.Crn + } + iamMap["serviceid"] = []map[string]interface{}{iamServiceidMap} + } + + mainModelMap["iam"] = []map[string]interface{}{iamMap} + + } + + if sourceService.ResourceKey != nil { + resourceKeyMap := make(map[string]interface{}) + resourceKeyModel := sourceService.ResourceKey + if resourceKeyModel.Crn != nil { + resourceKeyMap["crn"] = resourceKeyModel.Crn + } + if resourceKeyModel.Name != nil { + resourceKeyMap["name"] = resourceKeyModel.Name + } + mainModelMap["resource_key"] = []map[string]interface{}{resourceKeyMap} + } + + if sourceService.Parameters != nil { + parametersMap := sourceService.Parameters.GetProperties() + for k, v := range parametersMap { + parametersMap[k] = fmt.Sprint(v) + } + if sourceService.Parameters.ServiceidCrn != nil { + if len(parametersMap) == 0 { + parametersMap = make(map[string]interface{}) + } + parametersMap["serviceid_crn"] = sourceService.Parameters.ServiceidCrn + } + mainModelMap["parameters"] = parametersMap + } + + return mainModelMap, nil +} diff --git a/ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret_metadata.go b/ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret_metadata.go new file mode 100644 index 0000000000..141e0f9e6d --- /dev/null +++ b/ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret_metadata.go @@ -0,0 +1,494 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package secretsmanager + +import ( + "context" + "fmt" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/secrets-manager-go-sdk/v2/secretsmanagerv2" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "log" +) + +func DataSourceIbmSmServiceCredentialsSecretMetadata() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmSmServiceCredentialsSecretMetadataRead, + + Schema: map[string]*schema.Schema{ + "secret_id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The ID of the secret.", + }, + "created_by": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier that is associated with the entity that created the secret.", + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date when a resource was created. The date format follows RFC 3339.", + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A CRN that uniquely identifies an IBM Cloud resource.", + }, + "custom_metadata": &schema.Schema{ + Type: schema.TypeMap, + Computed: true, + Description: "The secret metadata that a user can customize.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "An extended description of your secret.To protect your privacy, do not use personal data, such as your name or location, as a description for your secret group.", + }, + "downloaded": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service API.", + }, + "labels": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Labels that you can use to search for secrets in your instance.Up to 30 labels can be created.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "locks_total": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The number of locks of the secret.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The human-readable name of your secret.", + }, + "secret_group_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + ForceNew: true, + Description: "A v4 UUID identifier, or `default` secret group.", + }, + "secret_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The secret type. Supported types are arbitrary, certificates (imported, public, and private), IAM credentials, key-value, and user credentials.", + }, + "state": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The secret state that is based on NIST SP 800-57. States are integers and correspond to the `Pre-activation = 0`, `Active = 1`, `Suspended = 2`, `Deactivated = 3`, and `Destroyed = 5` values.", + }, + "state_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A text representation of the secret state.", + }, + "updated_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date when a resource was recently modified. The date format follows RFC 3339.", + }, + "versions_total": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The number of versions of the secret.", + }, + "ttl": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The time-to-live (TTL) or lease duration to assign to generated credentials.", + }, + "rotation": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Determines whether Secrets Manager rotates your secrets automatically.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "auto_rotate": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval.", + }, + "interval": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The length of the secret rotation time interval.", + }, + "unit": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The units for the secret rotation time interval.", + }, + }, + }, + }, + "next_rotation_date": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date that the secret is scheduled for automatic rotation. The service automatically creates a new version of the secret on its next rotation date. This field exists only for secrets that have an existing rotation policy.", + }, + "source_service": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The properties required for creating the service credentials for the specified source service instance.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "instance": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The source service instance identifier.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A CRN that uniquely identifies a service credentials target.", + }, + }, + }, + }, + "role": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The service-specific custom role object, CRN role is accepted. Refer to the service’s documentation for supported roles.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN role identifier for creating a service-id.", + }, + }, + }, + }, + "iam": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The source service IAM data is returned in case IAM credentials where created for this secret.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "apikey": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The IAM apikey metadata for the IAM credentials that were generated.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IAM API key name for the generated service credentials.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IAM API key description for the generated service credentials.", + }, + }, + }, + }, + "role": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The IAM role for the generate service credentials.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IAM role CRN assigned to the generated service credentials.", + }, + }, + }, + }, + "serviceid": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The IAM serviceid for the generated service credentials.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IAM Service ID CRN.", + }, + }, + }, + }, + }, + }, + }, + "resource_key": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The source service resource key data of the generated service credentials.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource key CRN of the generated service credentials.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource key name of the generated service credentials.", + }, + }, + }, + }, + "parameters": &schema.Schema{ + Type: schema.TypeMap, + Computed: true, + Description: "The collection of parameters for the service credentials target.", + }, + }, + }, + }, + }, + } +} + +func dataSourceIbmSmServiceCredentialsSecretMetadataRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + secretsManagerClient, err := meta.(conns.ClientSession).SecretsManagerV2() + if err != nil { + return diag.FromErr(err) + } + + region := getRegion(secretsManagerClient, d) + instanceId := d.Get("instance_id").(string) + secretsManagerClient = getClientWithInstanceEndpoint(secretsManagerClient, instanceId, region, getEndpointType(secretsManagerClient, d)) + + getSecretMetadataOptions := &secretsmanagerv2.GetSecretMetadataOptions{} + + secretId := d.Get("secret_id").(string) + getSecretMetadataOptions.SetID(secretId) + + ServiceCredentialsSecretMetadataIntf, response, err := secretsManagerClient.GetSecretMetadataWithContext(context, getSecretMetadataOptions) + if err != nil { + log.Printf("[DEBUG] GetSecretMetadataWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetSecretMetadataWithContext failed %s\n%s", err, response)) + } + ServiceCredentialsSecretMetadata := ServiceCredentialsSecretMetadataIntf.(*secretsmanagerv2.ServiceCredentialsSecretMetadata) + + d.SetId(fmt.Sprintf("%s/%s/%s", region, instanceId, secretId)) + + if err = d.Set("region", region); err != nil { + return diag.FromErr(fmt.Errorf("Error setting region: %s", err)) + } + if err = d.Set("created_by", ServiceCredentialsSecretMetadata.CreatedBy); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_by: %s", err)) + } + + if err = d.Set("created_at", DateTimeToRFC3339(ServiceCredentialsSecretMetadata.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + + if err = d.Set("crn", ServiceCredentialsSecretMetadata.Crn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting crn: %s", err)) + } + + if ServiceCredentialsSecretMetadata.CustomMetadata != nil { + convertedMap := make(map[string]interface{}, len(ServiceCredentialsSecretMetadata.CustomMetadata)) + for k, v := range ServiceCredentialsSecretMetadata.CustomMetadata { + convertedMap[k] = v + } + + if err = d.Set("custom_metadata", flex.Flatten(convertedMap)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting custom_metadata: %s", err)) + } + if err != nil { + return diag.FromErr(fmt.Errorf("Error setting custom_metadata %s", err)) + } + } + + if err = d.Set("description", ServiceCredentialsSecretMetadata.Description); err != nil { + return diag.FromErr(fmt.Errorf("Error setting description: %s", err)) + } + + if err = d.Set("downloaded", ServiceCredentialsSecretMetadata.Downloaded); err != nil { + return diag.FromErr(fmt.Errorf("Error setting downloaded: %s", err)) + } + + if ServiceCredentialsSecretMetadata.Labels != nil { + if err = d.Set("labels", ServiceCredentialsSecretMetadata.Labels); err != nil { + return diag.FromErr(fmt.Errorf("Error setting labels: %s", err)) + } + } + + if err = d.Set("locks_total", flex.IntValue(ServiceCredentialsSecretMetadata.LocksTotal)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting locks_total: %s", err)) + } + + if err = d.Set("name", ServiceCredentialsSecretMetadata.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + + if err = d.Set("secret_group_id", ServiceCredentialsSecretMetadata.SecretGroupID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting secret_group_id: %s", err)) + } + + if err = d.Set("secret_type", ServiceCredentialsSecretMetadata.SecretType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting secret_type: %s", err)) + } + + if err = d.Set("state", flex.IntValue(ServiceCredentialsSecretMetadata.State)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting state: %s", err)) + } + + if err = d.Set("state_description", ServiceCredentialsSecretMetadata.StateDescription); err != nil { + return diag.FromErr(fmt.Errorf("Error setting state_description: %s", err)) + } + + if err = d.Set("updated_at", DateTimeToRFC3339(ServiceCredentialsSecretMetadata.UpdatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting updated_at: %s", err)) + } + + if err = d.Set("versions_total", flex.IntValue(ServiceCredentialsSecretMetadata.VersionsTotal)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting versions_total: %s", err)) + } + + if err = d.Set("ttl", ServiceCredentialsSecretMetadata.TTL); err != nil { + return diag.FromErr(fmt.Errorf("Error setting ttl: %s", err)) + } + + rotation := []map[string]interface{}{} + if ServiceCredentialsSecretMetadata.Rotation != nil { + modelMap, err := dataSourceIbmSmServiceCredentialsSecretMetadataRotationPolicyToMap(ServiceCredentialsSecretMetadata.Rotation.(*secretsmanagerv2.RotationPolicy)) + if err != nil { + return diag.FromErr(err) + } + rotation = append(rotation, modelMap) + } + if err = d.Set("rotation", rotation); err != nil { + return diag.FromErr(fmt.Errorf("Error setting rotation %s", err)) + } + + if err = d.Set("next_rotation_date", DateTimeToRFC3339(ServiceCredentialsSecretMetadata.NextRotationDate)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting next_rotation_date: %s", err)) + } + + sourceServiceMap, err := dataSourceIbmSmServiceCredentialsSecretMetadataSourceServiceToMap(ServiceCredentialsSecretMetadata.SourceService) + if err != nil { + return diag.FromErr(err) + } + if len(sourceServiceMap) > 0 { + if err = d.Set("source_service", []map[string]interface{}{sourceServiceMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting source_service: %s", err)) + } + } + + return nil +} + +func dataSourceIbmSmServiceCredentialsSecretMetadataRotationPolicyToMap(model *secretsmanagerv2.RotationPolicy) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.AutoRotate != nil { + modelMap["auto_rotate"] = *model.AutoRotate + } + if model.Interval != nil { + modelMap["interval"] = *model.Interval + } + if model.Unit != nil { + modelMap["unit"] = *model.Unit + } + return modelMap, nil +} + +func dataSourceIbmSmServiceCredentialsSecretMetadataSourceServiceToMap(sourceService *secretsmanagerv2.ServiceCredentialsSecretSourceService) (map[string]interface{}, error) { + mainModelMap := make(map[string]interface{}) + if sourceService.Instance != nil { + instanceMap := make(map[string]interface{}) + instanceModel := sourceService.Instance + if instanceModel.Crn != nil { + instanceMap["crn"] = instanceModel.Crn + } + mainModelMap["instance"] = []map[string]interface{}{instanceMap} + } + + if sourceService.Role != nil { + roleMap := make(map[string]interface{}) + roleModel := sourceService.Role + if roleModel.Crn != nil { + roleMap["crn"] = roleModel.Crn + } + mainModelMap["role"] = []map[string]interface{}{roleMap} + } + + if sourceService.Iam != nil { + iamMap := make(map[string]interface{}) + iamModel := sourceService.Iam + + // apikey + if iamModel.Apikey != nil { + iamApikeyMap := make(map[string]interface{}) + iamApikeyModel := iamModel.Apikey + if iamApikeyModel.Name != nil { + iamApikeyMap["name"] = iamApikeyModel.Name + } + if iamApikeyModel.Description != nil { + iamApikeyMap["description"] = iamApikeyModel.Description + } + iamMap["apikey"] = []map[string]interface{}{iamApikeyMap} + } + + // role + if iamModel.Role != nil { + iamRoleMap := make(map[string]interface{}) + iamRoleModel := iamModel.Role + if iamRoleModel.Crn != nil { + iamRoleMap["crn"] = iamRoleModel.Crn + } + iamMap["role"] = []map[string]interface{}{iamRoleMap} + } + + // service id + if iamModel.Serviceid != nil { + iamServiceidMap := make(map[string]interface{}) + iamServiceidModel := iamModel.Serviceid + if iamServiceidModel.Crn != nil { + iamServiceidMap["crn"] = iamServiceidModel.Crn + } + iamMap["serviceid"] = []map[string]interface{}{iamServiceidMap} + } + + mainModelMap["iam"] = []map[string]interface{}{iamMap} + + } + + if sourceService.ResourceKey != nil { + resourceKeyMap := make(map[string]interface{}) + resourceKeyModel := sourceService.ResourceKey + if resourceKeyModel.Crn != nil { + resourceKeyMap["crn"] = resourceKeyModel.Crn + } + if resourceKeyModel.Name != nil { + resourceKeyMap["name"] = resourceKeyModel.Name + } + mainModelMap["resource_key"] = []map[string]interface{}{resourceKeyMap} + } + + if sourceService.Parameters != nil { + parametersMap := sourceService.Parameters.GetProperties() + for k, v := range parametersMap { + parametersMap[k] = fmt.Sprint(v) + } + if sourceService.Parameters.ServiceidCrn != nil { + if len(parametersMap) == 0 { + parametersMap = make(map[string]interface{}) + } + parametersMap["serviceid_crn"] = sourceService.Parameters.ServiceidCrn + } + mainModelMap["parameters"] = parametersMap + } + + return mainModelMap, nil +} diff --git a/ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret_metadata_test.go b/ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret_metadata_test.go new file mode 100644 index 0000000000..91ad1c0491 --- /dev/null +++ b/ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret_metadata_test.go @@ -0,0 +1,74 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package secretsmanager_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmSmServiceCredentialsSecretMetadataDataSourceBasic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmSmServiceCredentialsSecretMetadataDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret_metadata.sm_service_credentials_secret_metadata", "secret_id"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret_metadata.sm_service_credentials_secret_metadata", "instance_id"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret_metadata.sm_service_credentials_secret_metadata", "created_by"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret_metadata.sm_service_credentials_secret_metadata", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret_metadata.sm_service_credentials_secret_metadata", "crn"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret_metadata.sm_service_credentials_secret_metadata", "secret_group_id"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret_metadata.sm_service_credentials_secret_metadata", "secret_type"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret_metadata.sm_service_credentials_secret_metadata", "updated_at"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret_metadata.sm_service_credentials_secret_metadata", "versions_total"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret_metadata.sm_service_credentials_secret_metadata", "rotation.#"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret_metadata.sm_service_credentials_secret_metadata", "ttl"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret_metadata.sm_service_credentials_secret_metadata", "source_service.#"), + ), + }, + }, + }) +} + +func testAccCheckIbmSmServiceCredentialsSecretMetadataDataSourceConfigBasic() string { + return fmt.Sprintf(` + resource "ibm_sm_service_credentials_secret" "sm_service_credentials_secret_instance" { + instance_id = "%s" + region = "%s" + custom_metadata = {"key":"value"} + description = "Extended description for this secret." + labels = ["my-label"] + rotation { + auto_rotate = true + interval = 1 + unit = "day" + } + secret_group_id = "default" + name = "service_credentials-datasource-terraform-test" + ttl = "%s" + source_service { + instance { + crn = "%s" + } + parameters = %s + role { + crn = "%s" + } + } + } + + data "ibm_sm_service_credentials_secret_metadata" "sm_service_credentials_secret_metadata" { + instance_id = "%s" + region = "%s" + secret_id = ibm_sm_service_credentials_secret.sm_service_credentials_secret_instance.secret_id + } + `, acc.SecretsManagerInstanceID, acc.SecretsManagerInstanceRegion, serviceCredentialsTtl, acc.SecretsManagerServiceCredentialsCosCrn, serviceCredentialsParameters, serviceCredentialsRoleCrn, acc.SecretsManagerInstanceID, acc.SecretsManagerInstanceRegion) +} diff --git a/ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret_test.go b/ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret_test.go new file mode 100644 index 0000000000..eadf2f92c8 --- /dev/null +++ b/ibm/service/secretsmanager/data_source_ibm_sm_service_credentials_secret_test.go @@ -0,0 +1,83 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package secretsmanager_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmSmServiceCredentialsSecretDataSourceBasic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmSmServiceCredentialsSecretDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret", "secret_id"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret", "instance_id"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret", "created_by"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret", "crn"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret", "secret_group_id"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret", "secret_type"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret", "updated_at"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret", "versions_total"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret", "rotation.#"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret", "ttl"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret", "source_service.#"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret_by_name", "name"), + resource.TestCheckResourceAttrSet("data.ibm_sm_service_credentials_secret.sm_service_credentials_secret_by_name", "secret_group_name"), + ), + }, + }, + }) +} + +func testAccCheckIbmSmServiceCredentialsSecretDataSourceConfigBasic() string { + return fmt.Sprintf(` + resource "ibm_sm_service_credentials_secret" "sm_service_credentials_secret_instance" { + instance_id = "%s" + region = "%s" + custom_metadata = {"key":"value"} + description = "Extended description for this secret." + labels = ["my-label"] + rotation { + auto_rotate = true + interval = 1 + unit = "day" + } + secret_group_id = "default" + name = "service_credentials-datasource-terraform-test" + ttl = "%s" + source_service { + instance { + crn = "%s" + } + parameters = %s + role { + crn = "%s" + } + } + } + + data "ibm_sm_service_credentials_secret" "sm_service_credentials_secret" { + instance_id = "%s" + region = "%s" + secret_id = ibm_sm_service_credentials_secret.sm_service_credentials_secret_instance.secret_id + } + + data "ibm_sm_service_credentials_secret" "sm_service_credentials_secret_by_name" { + instance_id = "%s" + region = "%s" + name = ibm_sm_service_credentials_secret.sm_service_credentials_secret_instance.name + secret_group_name = "default" + } + `, acc.SecretsManagerInstanceID, acc.SecretsManagerInstanceRegion, serviceCredentialsTtl, acc.SecretsManagerServiceCredentialsCosCrn, serviceCredentialsParameters, serviceCredentialsRoleCrn, acc.SecretsManagerInstanceID, acc.SecretsManagerInstanceRegion, acc.SecretsManagerInstanceID, acc.SecretsManagerInstanceRegion) +} diff --git a/ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret.go b/ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret.go new file mode 100644 index 0000000000..7d5e211b0d --- /dev/null +++ b/ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret.go @@ -0,0 +1,790 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 +// . +package secretsmanager + +import ( + "context" + "encoding/json" + "fmt" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/secrets-manager-go-sdk/v2/secretsmanagerv2" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "log" + "strconv" + "strings" +) + +func ResourceIbmSmServiceCredentialsSecret() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIbmSmServiceCredentialsSecretCreate, + ReadContext: resourceIbmSmServiceCredentialsSecretRead, + UpdateContext: resourceIbmSmServiceCredentialsSecretUpdate, + DeleteContext: resourceIbmSmServiceCredentialsSecretDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "secret_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The secret type. Supported types are arbitrary, certificates (imported, public, and private), IAM credentials, key-value, and user credentials.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "A human-readable name to assign to your secret.To protect your privacy, do not use personal data, such as your name or location, as a name for your secret.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "An extended description of your secret.To protect your privacy, do not use personal data, such as your name or location, as a description for your secret group.", + }, + "secret_group_id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + Description: "A v4 UUID identifier, or `default` secret group.", + }, + "labels": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Computed: true, + Description: "Labels that you can use to search for secrets in your instance.Up to 30 labels can be created.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "custom_metadata": &schema.Schema{ + Type: schema.TypeMap, + Optional: true, + Computed: true, + Description: "The secret metadata that a user can customize.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "version_custom_metadata": &schema.Schema{ + Type: schema.TypeMap, + Optional: true, + Computed: true, + Description: "The secret version metadata that a user can customize.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "created_by": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier that is associated with the entity that created the secret.", + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date when a resource was created. The date format follows RFC 3339.", + }, + "credentials": &schema.Schema{ + Type: schema.TypeMap, + Computed: true, + Sensitive: true, + Description: "The properties of the service credentials secret payload.", + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A CRN that uniquely identifies an IBM Cloud resource.", + }, + "downloaded": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service API.", + }, + "locks_total": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The number of locks of the secret.", + }, + "next_rotation_date": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date that the secret is scheduled for automatic rotation. The service automatically creates a new version of the secret on its next rotation date. This field exists only for secrets that have an existing rotation policy.", + }, + "rotation": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Determines whether Secrets Manager rotates your secrets automatically.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "auto_rotate": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval.", + }, + "interval": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "The length of the secret rotation time interval.", + DiffSuppressFunc: rotationAttributesDiffSuppress, + }, + "unit": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The units for the secret rotation time interval.", + DiffSuppressFunc: rotationAttributesDiffSuppress, + }, + }, + }, + }, + "source_service": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Required: true, + ForceNew: true, + Description: "The properties required for creating the service credentials for the specified source service instance.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "instance": &schema.Schema{ + Type: schema.TypeList, + Required: true, + MaxItems: 1, + ForceNew: true, + Description: "The source service instance identifier.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "A CRN that uniquely identifies a service credentials target.", + }, + }, + }, + }, + "role": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Computed: true, + ForceNew: true, + MaxItems: 1, + Description: "The service-specific custom role object, CRN role is accepted. Refer to the service’s documentation for supported roles.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + Description: "The CRN role identifier for creating a service-id.", + }, + }, + }, + }, + "iam": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The source service IAM data is returned in case IAM credentials where created for this secret.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "apikey": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The IAM apikey metadata for the IAM credentials that were generated.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IAM API key name for the generated service credentials.", + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IAM API key description for the generated service credentials.", + }, + }, + }, + }, + "role": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The IAM role for the generate service credentials.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IAM role CRN assigned to the generated service credentials.", + }, + }, + }, + }, + "serviceid": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The IAM serviceid for the generated service credentials.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IAM Service ID CRN.", + }, + }, + }, + }, + }, + }, + }, + "resource_key": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The source service resource key data of the generated service credentials.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource key CRN of the generated service credentials.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource key name of the generated service credentials.", + }, + }, + }, + }, + "parameters": &schema.Schema{ + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: "The collection of parameters for the service credentials target.", + }, + }, + }, + }, + "state": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The secret state that is based on NIST SP 800-57. States are integers and correspond to the `Pre-activation = 0`, `Active = 1`, `Suspended = 2`, `Deactivated = 3`, and `Destroyed = 5` values.", + }, + "state_description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A text representation of the secret state.", + }, + "ttl": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The time-to-live (TTL) or lease duration to assign to generated credentials.", + }, + "updated_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date when a resource was recently modified. The date format follows RFC 3339.", + }, + "versions_total": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The number of versions of the secret.", + }, + "secret_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A v4 UUID identifier.", + }, + }, + } +} + +func resourceIbmSmServiceCredentialsSecretCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + secretsManagerClient, err := meta.(conns.ClientSession).SecretsManagerV2() + if err != nil { + return diag.FromErr(err) + } + + region := getRegion(secretsManagerClient, d) + instanceId := d.Get("instance_id").(string) + secretsManagerClient = getClientWithInstanceEndpoint(secretsManagerClient, instanceId, region, getEndpointType(secretsManagerClient, d)) + + createSecretOptions := &secretsmanagerv2.CreateSecretOptions{} + + secretPrototypeModel, err := resourceIbmSmServiceCredentialsSecretMapToSecretPrototype(d) + if err != nil { + return diag.FromErr(err) + } + createSecretOptions.SetSecretPrototype(secretPrototypeModel) + + secretIntf, response, err := secretsManagerClient.CreateSecretWithContext(context, createSecretOptions) + if err != nil { + log.Printf("[DEBUG] CreateSecretWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CreateSecretWithContext failed %s\n%s", err, response)) + } + + secret := secretIntf.(*secretsmanagerv2.ServiceCredentialsSecret) + d.SetId(fmt.Sprintf("%s/%s/%s", region, instanceId, *secret.ID)) + d.Set("secret_id", *secret.ID) + + return resourceIbmSmServiceCredentialsSecretRead(context, d, meta) +} + +func resourceIbmSmServiceCredentialsSecretRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + secretsManagerClient, err := meta.(conns.ClientSession).SecretsManagerV2() + if err != nil { + return diag.FromErr(err) + } + + id := strings.Split(d.Id(), "/") + if len(id) != 3 { + return diag.Errorf("Wrong format of resource ID. To import a secret use the format `//`") + } + region := id[0] + instanceId := id[1] + secretId := id[2] + secretsManagerClient = getClientWithInstanceEndpoint(secretsManagerClient, instanceId, region, getEndpointType(secretsManagerClient, d)) + + getSecretOptions := &secretsmanagerv2.GetSecretOptions{} + + getSecretOptions.SetID(secretId) + + secretIntf, response, err := secretsManagerClient.GetSecretWithContext(context, getSecretOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetSecretWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetSecretWithContext failed %s\n%s", err, response)) + } + + secret := secretIntf.(*secretsmanagerv2.ServiceCredentialsSecret) + + if err = d.Set("secret_id", secretId); err != nil { + return diag.FromErr(fmt.Errorf("Error setting secret_id: %s", err)) + } + if err = d.Set("instance_id", instanceId); err != nil { + return diag.FromErr(fmt.Errorf("Error setting instance_id: %s", err)) + } + if err = d.Set("region", region); err != nil { + return diag.FromErr(fmt.Errorf("Error setting region: %s", err)) + } + if err = d.Set("created_by", secret.CreatedBy); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_by: %s", err)) + } + if err = d.Set("created_at", DateTimeToRFC3339(secret.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + if err = d.Set("crn", secret.Crn); err != nil { + return diag.FromErr(fmt.Errorf("Error setting crn: %s", err)) + } + if err = d.Set("downloaded", secret.Downloaded); err != nil { + return diag.FromErr(fmt.Errorf("Error setting downloaded: %s", err)) + } + if err = d.Set("locks_total", flex.IntValue(secret.LocksTotal)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting locks_total: %s", err)) + } + if err = d.Set("name", secret.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + if err = d.Set("secret_group_id", secret.SecretGroupID); err != nil { + return diag.FromErr(fmt.Errorf("Error setting secret_group_id: %s", err)) + } + if err = d.Set("secret_type", secret.SecretType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting secret_type: %s", err)) + } + if err = d.Set("state", flex.IntValue(secret.State)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting state: %s", err)) + } + if err = d.Set("state_description", secret.StateDescription); err != nil { + return diag.FromErr(fmt.Errorf("Error setting state_description: %s", err)) + } + if err = d.Set("updated_at", DateTimeToRFC3339(secret.UpdatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting updated_at: %s", err)) + } + if err = d.Set("versions_total", flex.IntValue(secret.VersionsTotal)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting versions_total: %s", err)) + } + if secret.CustomMetadata != nil { + d.Set("custom_metadata", secret.CustomMetadata) + } + if err = d.Set("description", secret.Description); err != nil { + return diag.FromErr(fmt.Errorf("Error setting description: %s", err)) + } + if secret.Labels != nil { + if err = d.Set("labels", secret.Labels); err != nil { + return diag.FromErr(fmt.Errorf("Error setting labels: %s", err)) + } + } + rotationMap, err := resourceIbmSmServiceCredentialsSecretRotationPolicyToMap(secret.Rotation) + if err != nil { + return diag.FromErr(err) + } + if len(rotationMap) > 0 { + if err = d.Set("rotation", []map[string]interface{}{rotationMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting rotation: %s", err)) + } + } + sourceServiceMap, err := resourceIbmSmServiceCredentialsSecretSourceServiceToMap(secret.SourceService) + if err != nil { + return diag.FromErr(err) + } + if len(sourceServiceMap) > 0 { + if err = d.Set("source_service", []map[string]interface{}{sourceServiceMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting source_service: %s", err)) + } + } + if secret.Credentials != nil { + var credInterface map[string]interface{} + cred, _ := json.Marshal(secret.Credentials) + json.Unmarshal(cred, &credInterface) + if err = d.Set("credentials", flex.Flatten(credInterface)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting credentials: %s", err)) + } + } + if err = d.Set("next_rotation_date", DateTimeToRFC3339(secret.NextRotationDate)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting next_rotation_date: %s", err)) + } + + // Call get version metadata API to get the current version_custom_metadata + getVersionMetdataOptions := &secretsmanagerv2.GetSecretVersionMetadataOptions{} + getVersionMetdataOptions.SetSecretID(secretId) + getVersionMetdataOptions.SetID("current") + + versionMetadataIntf, response, err := secretsManagerClient.GetSecretVersionMetadataWithContext(context, getVersionMetdataOptions) + if err != nil { + log.Printf("[DEBUG] GetSecretVersionMetadataWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetSecretVersionMetadataWithContext failed %s\n%s", err, response)) + } + + versionMetadata := versionMetadataIntf.(*secretsmanagerv2.ServiceCredentialsSecretVersionMetadata) + if versionMetadata.VersionCustomMetadata != nil { + if err = d.Set("version_custom_metadata", versionMetadata.VersionCustomMetadata); err != nil { + return diag.FromErr(fmt.Errorf("Error setting version_custom_metadata: %s", err)) + } + } + + return nil +} + +func resourceIbmSmServiceCredentialsSecretUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + secretsManagerClient, err := meta.(conns.ClientSession).SecretsManagerV2() + if err != nil { + return diag.FromErr(err) + } + + id := strings.Split(d.Id(), "/") + region := id[0] + instanceId := id[1] + secretId := id[2] + secretsManagerClient = getClientWithInstanceEndpoint(secretsManagerClient, instanceId, region, getEndpointType(secretsManagerClient, d)) + + updateSecretMetadataOptions := &secretsmanagerv2.UpdateSecretMetadataOptions{} + + updateSecretMetadataOptions.SetID(secretId) + + hasChange := false + + patchVals := &secretsmanagerv2.SecretMetadataPatch{} + + if d.HasChange("name") { + patchVals.Name = core.StringPtr(d.Get("name").(string)) + hasChange = true + } + if d.HasChange("description") { + patchVals.Description = core.StringPtr(d.Get("description").(string)) + hasChange = true + } + if d.HasChange("ttl") { + patchVals.TTL = core.StringPtr(d.Get("ttl").(string)) + hasChange = true + } + if d.HasChange("labels") { + labels := d.Get("labels").([]interface{}) + labelsParsed := make([]string, len(labels)) + for i, v := range labels { + labelsParsed[i] = fmt.Sprint(v) + } + patchVals.Labels = labelsParsed + hasChange = true + } + if d.HasChange("custom_metadata") { + patchVals.CustomMetadata = d.Get("custom_metadata").(map[string]interface{}) + hasChange = true + } + if d.HasChange("rotation") { + RotationModel, err := resourceIbmSmServiceCredentialsSecretMapToRotationPolicy(d.Get("rotation").([]interface{})[0].(map[string]interface{})) + if err != nil { + log.Printf("[DEBUG] UpdateSecretMetadataWithContext failed: Reading Rotation parameter failed: %s", err) + return diag.FromErr(fmt.Errorf("UpdateSecretMetadataWithContext failed: Reading Rotation parameter failed: %s", err)) + } + patchVals.Rotation = RotationModel + hasChange = true + } + + // Apply change in metadata (if changed) + if hasChange { + updateSecretMetadataOptions.SecretMetadataPatch, _ = patchVals.AsPatch() + _, response, err := secretsManagerClient.UpdateSecretMetadataWithContext(context, updateSecretMetadataOptions) + if err != nil { + log.Printf("[DEBUG] UpdateSecretMetadataWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("UpdateSecretMetadataWithContext failed %s\n%s", err, response)) + } + } + + if d.HasChange("version_custom_metadata") { + // Apply change to version_custom_metadata in current version + secretVersionMetadataPatchModel := new(secretsmanagerv2.SecretVersionMetadataPatch) + secretVersionMetadataPatchModel.VersionCustomMetadata = d.Get("version_custom_metadata").(map[string]interface{}) + secretVersionMetadataPatchModelAsPatch, _ := secretVersionMetadataPatchModel.AsPatch() + + updateSecretVersionOptions := &secretsmanagerv2.UpdateSecretVersionMetadataOptions{} + updateSecretVersionOptions.SetSecretID(secretId) + updateSecretVersionOptions.SetID("current") + updateSecretVersionOptions.SetSecretVersionMetadataPatch(secretVersionMetadataPatchModelAsPatch) + _, response, err := secretsManagerClient.UpdateSecretVersionMetadataWithContext(context, updateSecretVersionOptions) + if err != nil { + if hasChange { + // Call the read function to update the Terraform state with the change already applied to the metadata + resourceIbmSmServiceCredentialsSecretRead(context, d, meta) + } + log.Printf("[DEBUG] UpdateSecretVersionMetadataWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("UpdateSecretVersionMetadataWithContext failed %s\n%s", err, response)) + } + } + + return resourceIbmSmServiceCredentialsSecretRead(context, d, meta) +} + +func resourceIbmSmServiceCredentialsSecretDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + secretsManagerClient, err := meta.(conns.ClientSession).SecretsManagerV2() + if err != nil { + return diag.FromErr(err) + } + + id := strings.Split(d.Id(), "/") + region := id[0] + instanceId := id[1] + secretId := id[2] + secretsManagerClient = getClientWithInstanceEndpoint(secretsManagerClient, instanceId, region, getEndpointType(secretsManagerClient, d)) + + deleteSecretOptions := &secretsmanagerv2.DeleteSecretOptions{} + + deleteSecretOptions.SetID(secretId) + + response, err := secretsManagerClient.DeleteSecretWithContext(context, deleteSecretOptions) + if err != nil { + log.Printf("[DEBUG] DeleteSecretWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteSecretWithContext failed %s\n%s", err, response)) + } + + d.SetId("") + + return nil +} + +func resourceIbmSmServiceCredentialsSecretMapToSecretPrototype(d *schema.ResourceData) (*secretsmanagerv2.ServiceCredentialsSecretPrototype, error) { + model := &secretsmanagerv2.ServiceCredentialsSecretPrototype{} + model.SecretType = core.StringPtr("service_credentials") + + if _, ok := d.GetOk("name"); ok { + model.Name = core.StringPtr(d.Get("name").(string)) + } + if _, ok := d.GetOk("description"); ok { + model.Description = core.StringPtr(d.Get("description").(string)) + } + if _, ok := d.GetOk("secret_group_id"); ok { + model.SecretGroupID = core.StringPtr(d.Get("secret_group_id").(string)) + } + if _, ok := d.GetOk("labels"); ok { + labels := d.Get("labels").([]interface{}) + labelsParsed := make([]string, len(labels)) + for i, v := range labels { + labelsParsed[i] = fmt.Sprint(v) + } + model.Labels = labelsParsed + } + if _, ok := d.GetOk("ttl"); ok { + model.TTL = core.StringPtr(d.Get("ttl").(string)) + } + if _, ok := d.GetOk("rotation"); ok { + RotationModel, err := resourceIbmSmServiceCredentialsSecretMapToRotationPolicy(d.Get("rotation").([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Rotation = RotationModel + } + if _, ok := d.GetOk("source_service"); ok { + SourceServiceModel, err := resourceIbmSmServiceCredentialsSecretMapToSourceService(d.Get("source_service").([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.SourceService = SourceServiceModel + } + if _, ok := d.GetOk("custom_metadata"); ok { + model.CustomMetadata = d.Get("custom_metadata").(map[string]interface{}) + } + if _, ok := d.GetOk("version_custom_metadata"); ok { + model.VersionCustomMetadata = d.Get("version_custom_metadata").(map[string]interface{}) + } + return model, nil +} + +func resourceIbmSmServiceCredentialsSecretMapToRotationPolicy(modelMap map[string]interface{}) (secretsmanagerv2.RotationPolicyIntf, error) { + model := &secretsmanagerv2.RotationPolicy{} + if modelMap["auto_rotate"] != nil { + model.AutoRotate = core.BoolPtr(modelMap["auto_rotate"].(bool)) + } + if modelMap["interval"].(int) == 0 { + model.Interval = nil + } else { + model.Interval = core.Int64Ptr(int64(modelMap["interval"].(int))) + } + if modelMap["unit"] != nil && modelMap["unit"].(string) != "" { + model.Unit = core.StringPtr(modelMap["unit"].(string)) + } + return model, nil +} + +func resourceIbmSmServiceCredentialsSecretMapToSourceService(modelMap map[string]interface{}) (*secretsmanagerv2.ServiceCredentialsSecretSourceService, error) { + mainModel := &secretsmanagerv2.ServiceCredentialsSecretSourceService{} + + if modelMap["instance"] != nil && len(modelMap["instance"].([]interface{})) > 0 { + instanceModel := &secretsmanagerv2.ServiceCredentialsSourceServiceInstance{} + if modelMap["instance"].([]interface{})[0].(map[string]interface{})["crn"].(string) != "" { + instanceModel.Crn = core.StringPtr(modelMap["instance"].([]interface{})[0].(map[string]interface{})["crn"].(string)) + mainModel.Instance = instanceModel + } + } + + if modelMap["role"] != nil && len(modelMap["role"].([]interface{})) > 0 { + roleModel := &secretsmanagerv2.ServiceCredentialsSourceServiceRole{} + if modelMap["role"].([]interface{})[0].(map[string]interface{})["crn"].(string) != "" { + roleModel.Crn = core.StringPtr(modelMap["role"].([]interface{})[0].(map[string]interface{})["crn"].(string)) + mainModel.Role = roleModel + } + } + + if modelMap["parameters"] != nil { + mainModel.Parameters = &secretsmanagerv2.ServiceCredentialsSourceServiceParameters{} + parametersMap := modelMap["parameters"].(map[string]interface{}) + for k, v := range parametersMap { + if k == "serviceid_crn" { + serviceIdCrn := v.(string) + mainModel.Parameters.ServiceidCrn = &serviceIdCrn + } else if v == "true" || v == "false" { + b, _ := strconv.ParseBool(v.(string)) + mainModel.Parameters.SetProperty(k, b) + } else { + mainModel.Parameters.SetProperty(k, v) + } + } + } + return mainModel, nil +} + +func resourceIbmSmServiceCredentialsSecretRotationPolicyToMap(modelIntf secretsmanagerv2.RotationPolicyIntf) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + model := modelIntf.(*secretsmanagerv2.RotationPolicy) + if model.AutoRotate != nil { + modelMap["auto_rotate"] = model.AutoRotate + } + if model.Interval != nil { + modelMap["interval"] = flex.IntValue(model.Interval) + } + if model.Unit != nil { + modelMap["unit"] = model.Unit + } + return modelMap, nil +} + +func resourceIbmSmServiceCredentialsSecretSourceServiceToMap(sourceService *secretsmanagerv2.ServiceCredentialsSecretSourceService) (map[string]interface{}, error) { + mainModelMap := make(map[string]interface{}) + if sourceService.Instance != nil { + instanceMap := make(map[string]interface{}) + instanceModel := sourceService.Instance + if instanceModel.Crn != nil { + instanceMap["crn"] = instanceModel.Crn + } + mainModelMap["instance"] = []map[string]interface{}{instanceMap} + } + + if sourceService.Role != nil { + roleMap := make(map[string]interface{}) + roleModel := sourceService.Role + if roleModel.Crn != nil { + roleMap["crn"] = roleModel.Crn + } + mainModelMap["role"] = []map[string]interface{}{roleMap} + } + + if sourceService.Iam != nil { + iamMap := make(map[string]interface{}) + iamModel := sourceService.Iam + + // apikey + if iamModel.Apikey != nil { + iamApikeyMap := make(map[string]interface{}) + iamApikeyModel := iamModel.Apikey + if iamApikeyModel.Name != nil { + iamApikeyMap["name"] = iamApikeyModel.Name + } + if iamApikeyModel.Description != nil { + iamApikeyMap["description"] = iamApikeyModel.Description + } + iamMap["apikey"] = []map[string]interface{}{iamApikeyMap} + } + + // role + if iamModel.Role != nil { + iamRoleMap := make(map[string]interface{}) + iamRoleModel := iamModel.Role + if iamRoleModel.Crn != nil { + iamRoleMap["crn"] = iamRoleModel.Crn + } + iamMap["role"] = []map[string]interface{}{iamRoleMap} + } + + // service id + if iamModel.Serviceid != nil { + iamServiceidMap := make(map[string]interface{}) + iamServiceidModel := iamModel.Serviceid + if iamServiceidModel.Crn != nil { + iamServiceidMap["crn"] = iamServiceidModel.Crn + } + iamMap["serviceid"] = []map[string]interface{}{iamServiceidMap} + } + + mainModelMap["iam"] = []map[string]interface{}{iamMap} + + } + + if sourceService.ResourceKey != nil { + resourceKeyMap := make(map[string]interface{}) + resourceKeyModel := sourceService.ResourceKey + if resourceKeyModel.Crn != nil { + resourceKeyMap["crn"] = resourceKeyModel.Crn + } + if resourceKeyModel.Name != nil { + resourceKeyMap["name"] = resourceKeyModel.Name + } + mainModelMap["resource_key"] = []map[string]interface{}{resourceKeyMap} + } + + if sourceService.Parameters != nil { + parametersMap := sourceService.Parameters.GetProperties() + for k, v := range parametersMap { + parametersMap[k] = fmt.Sprint(v) + } + if sourceService.Parameters.ServiceidCrn != nil { + if len(parametersMap) == 0 { + parametersMap = make(map[string]interface{}) + } + parametersMap["serviceid_crn"] = sourceService.Parameters.ServiceidCrn + } + mainModelMap["parameters"] = parametersMap + } + + return mainModelMap, nil +} diff --git a/ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret_test.go b/ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret_test.go new file mode 100644 index 0000000000..7de340208c --- /dev/null +++ b/ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret_test.go @@ -0,0 +1,335 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package secretsmanager_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM/secrets-manager-go-sdk/v2/secretsmanagerv2" +) + +var serviceCredentialsSecretName = "terraform-test-sc-secret" +var modifiedServiceCredentialsSecretName = "modified-terraform-test-sc-secret" +var serviceCredentialsParameters = `{"HMAC":"true"}` +var serviceCredentialsParametersWithServiceId = `{"serviceid_crn": ibm_iam_service_id.ibm_iam_service_id_instance.crn}` +var serviceCredentialsTtl = "172800" +var modifiedServiceCredentialsTtl = "6048000" +var serviceCredentialsRoleCrn = "crn:v1:bluemix:public:iam::::serviceRole:Writer" + +func TestAccIbmSmServiceCredentialsSecretBasic(t *testing.T) { + resourceName := "ibm_sm_service_credentials_secret.sm_service_credentials_secret_basic" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmSmServiceCredentialsSecretDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: serviceCredentialsSecretConfigBasic(), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttrSet(resourceName, "secret_id"), + resource.TestCheckResourceAttrSet(resourceName, "created_by"), + resource.TestCheckResourceAttrSet(resourceName, "created_at"), + resource.TestCheckResourceAttrSet(resourceName, "updated_at"), + resource.TestCheckResourceAttrSet(resourceName, "crn"), + resource.TestCheckResourceAttrSet(resourceName, "downloaded"), + resource.TestCheckResourceAttr(resourceName, "state", "1"), + resource.TestCheckResourceAttr(resourceName, "versions_total", "1"), + ), + }, + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"ttl"}, + }, + }, + }) +} + +func TestAccIbmSmServiceCredentialsSecretAllArgs(t *testing.T) { + resourceName := "ibm_sm_service_credentials_secret.sm_service_credentials_secret" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmSmServiceCredentialsSecretDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: serviceCredentialsSecretConfigAllArgs(), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmSmServiceCredentialsSecretCreated(resourceName), + resource.TestCheckResourceAttrSet(resourceName, "secret_id"), + resource.TestCheckResourceAttrSet(resourceName, "created_by"), + resource.TestCheckResourceAttrSet(resourceName, "created_at"), + resource.TestCheckResourceAttrSet(resourceName, "updated_at"), + resource.TestCheckResourceAttrSet(resourceName, "crn"), + resource.TestCheckResourceAttrSet(resourceName, "downloaded"), + resource.TestCheckResourceAttrSet(resourceName, "next_rotation_date"), + resource.TestCheckResourceAttr(resourceName, "state", "1"), + resource.TestCheckResourceAttr(resourceName, "versions_total", "1"), + ), + }, + resource.TestStep{ + Config: serviceCredentialsSecretConfigUpdated(), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmSmServiceCredentialsSecretUpdated(resourceName), + ), + }, + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"ttl"}, + }, + }, + }) +} + +func TestAccIbmSmServiceCredentialsSecretAllArgsWithExistingServiceId(t *testing.T) { + resourceName := "ibm_sm_service_credentials_secret.sm_service_credentials_secret_service_id" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmSmServiceCredentialsSecretDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: serviceCredentialsSecretConfigAllArgsWithExistingServiceId(), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmSmServiceCredentialsSecretCreated(resourceName), + resource.TestCheckResourceAttrSet(resourceName, "secret_id"), + resource.TestCheckResourceAttrSet(resourceName, "created_by"), + resource.TestCheckResourceAttrSet(resourceName, "created_at"), + resource.TestCheckResourceAttrSet(resourceName, "updated_at"), + resource.TestCheckResourceAttrSet(resourceName, "crn"), + resource.TestCheckResourceAttrSet(resourceName, "downloaded"), + resource.TestCheckResourceAttrSet(resourceName, "next_rotation_date"), + resource.TestCheckResourceAttr(resourceName, "state", "1"), + resource.TestCheckResourceAttr(resourceName, "versions_total", "1"), + ), + }, + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"ttl"}, + }, + }, + }) +} + +var serviceCredentialsSecretBasicConfigFormat = ` + resource "ibm_sm_service_credentials_secret" "sm_service_credentials_secret_basic" { + instance_id = "%s" + region = "%s" + name = "%s" + source_service { + instance { + crn = "%s" + } + role { + crn = "%s" + } + } + ttl = "%s" + }` + +var serviceCredentialsSecretFullConfigFormat = ` + resource "ibm_sm_service_credentials_secret" "sm_service_credentials_secret" { + instance_id = "%s" + region = "%s" + name = "%s" + description = "%s" + labels = ["%s"] + source_service { + instance { + crn = "%s" + } + parameters = %s + role { + crn = "%s" + } + } + ttl = "%s" + custom_metadata = %s + secret_group_id = "default" + rotation %s + }` + +var serviceCredentialsSecretFullConfigFormatWithExistingServiceId = ` + resource "ibm_sm_service_credentials_secret" "sm_service_credentials_secret_service_id" { + instance_id = "%s" + region = "%s" + name = "%s" + description = "%s" + labels = ["%s"] + source_service { + instance { + crn = "%s" + } + parameters = %s + role { + crn = "%s" + } + } + ttl = "%s" + custom_metadata = %s + secret_group_id = "default" + rotation %s + }` + +func iamServiceIdConfig() string { + return fmt.Sprintf(` + resource "ibm_iam_service_id" "ibm_iam_service_id_instance" { + name = "service-id-terraform-tests-sc" + }`) +} + +func serviceCredentialsSecretConfigBasic() string { + return fmt.Sprintf(serviceCredentialsSecretBasicConfigFormat, acc.SecretsManagerInstanceID, acc.SecretsManagerInstanceRegion, + serviceCredentialsSecretName, acc.SecretsManagerServiceCredentialsCosCrn, serviceCredentialsRoleCrn, serviceCredentialsTtl) +} + +func serviceCredentialsSecretConfigAllArgs() string { + return fmt.Sprintf(serviceCredentialsSecretFullConfigFormat, acc.SecretsManagerInstanceID, acc.SecretsManagerInstanceRegion, + serviceCredentialsSecretName, description, label, acc.SecretsManagerServiceCredentialsCosCrn, serviceCredentialsParameters, serviceCredentialsRoleCrn, serviceCredentialsTtl, customMetadata, rotationPolicy) +} + +func serviceCredentialsSecretConfigAllArgsWithExistingServiceId() string { + return iamServiceIdConfig() + fmt.Sprintf(serviceCredentialsSecretFullConfigFormatWithExistingServiceId, acc.SecretsManagerInstanceID, acc.SecretsManagerInstanceRegion, + serviceCredentialsSecretName, description, label, acc.SecretsManagerServiceCredentialsCosCrn, serviceCredentialsParametersWithServiceId, serviceCredentialsRoleCrn, serviceCredentialsTtl, customMetadata, rotationPolicy) +} + +func serviceCredentialsSecretConfigUpdated() string { + return fmt.Sprintf(serviceCredentialsSecretFullConfigFormat, acc.SecretsManagerInstanceID, acc.SecretsManagerInstanceRegion, + modifiedServiceCredentialsSecretName, modifiedDescription, modifiedLabel, acc.SecretsManagerServiceCredentialsCosCrn, serviceCredentialsParameters, serviceCredentialsRoleCrn, + modifiedServiceCredentialsTtl, modifiedCustomMetadata, modifiedRotationPolicy) +} + +func testAccCheckIbmSmServiceCredentialsSecretCreated(n string) resource.TestCheckFunc { + return func(s *terraform.State) error { + serviceCredentialsSecretIntf, err := getSecret(s, n) + if err != nil { + return err + } + secret := serviceCredentialsSecretIntf.(*secretsmanagerv2.ServiceCredentialsSecret) + + if err := verifyAttr(*secret.Name, serviceCredentialsSecretName, "secret name"); err != nil { + return err + } + if err := verifyAttr(*secret.Description, description, "secret description"); err != nil { + return err + } + if len(secret.Labels) != 1 { + return fmt.Errorf("Wrong number of labels: %d", len(secret.Labels)) + } + if err := verifyAttr(secret.Labels[0], label, "label"); err != nil { + return err + } + if err := verifyJsonAttr(secret.CustomMetadata, customMetadata, "custom metadata"); err != nil { + return err + } + if err := verifyAttr(getAutoRotate(secret.Rotation), "true", "auto_rotate"); err != nil { + return err + } + if err := verifyAttr(getRotationUnit(secret.Rotation), "day", "rotation unit"); err != nil { + return err + } + if err := verifyAttr(getRotationInterval(secret.Rotation), "1", "rotation interval"); err != nil { + return err + } + if err := verifyAttr(*secret.TTL, serviceCredentialsTtl, "ttl"); err != nil { + return err + } + if err := verifyAttr(*secret.SourceService.Instance.Crn, acc.SecretsManagerServiceCredentialsCosCrn, "source_service.Instance.Crn"); err != nil { + return err + } + if err := verifyAttr(*secret.SourceService.Role.Crn, serviceCredentialsRoleCrn, "source_service.Role.Crn"); err != nil { + return err + } + if err := verifyAttr(*secret.Credentials.IamRoleCrn, serviceCredentialsRoleCrn, "credentials.IamRoleCrn"); err != nil { + return err + } + return nil + } +} + +func testAccCheckIbmSmServiceCredentialsSecretUpdated(n string) resource.TestCheckFunc { + return func(s *terraform.State) error { + serviceCredentialsSecretIntf, err := getSecret(s, n) + if err != nil { + return err + } + secret := serviceCredentialsSecretIntf.(*secretsmanagerv2.ServiceCredentialsSecret) + + if err := verifyAttr(*secret.Name, modifiedServiceCredentialsSecretName, "secret name"); err != nil { + return err + } + if err := verifyAttr(*secret.Description, modifiedDescription, "secret description after update"); err != nil { + return err + } + if len(secret.Labels) != 1 { + return fmt.Errorf("Wrong number of labels after update: %d", len(secret.Labels)) + } + if err := verifyAttr(secret.Labels[0], modifiedLabel, "label after update"); err != nil { + return err + } + if err := verifyJsonAttr(secret.CustomMetadata, modifiedCustomMetadata, "custom metadata after update"); err != nil { + return err + } + if err := verifyAttr(*secret.TTL, modifiedServiceCredentialsTtl, "ttl after update"); err != nil { + return err + } + if err := verifyAttr(getAutoRotate(secret.Rotation), "true", "auto_rotate after update"); err != nil { + return err + } + if err := verifyAttr(getRotationUnit(secret.Rotation), "month", "rotation unit after update"); err != nil { + return err + } + if err := verifyAttr(getRotationInterval(secret.Rotation), "2", "rotation interval after update"); err != nil { + return err + } + return nil + } +} + +func testAccCheckIbmSmServiceCredentialsSecretDestroy(s *terraform.State) error { + secretsManagerClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).SecretsManagerV2() + if err != nil { + return err + } + + secretsManagerClient = getClientWithInstanceEndpointTest(secretsManagerClient) + + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_sm_service_credentials_secret" { + continue + } + + getSecretOptions := &secretsmanagerv2.GetSecretOptions{} + + id := strings.Split(rs.Primary.ID, "/") + secretId := id[2] + getSecretOptions.SetID(secretId) + + // Try to find the key + _, response, err := secretsManagerClient.GetSecret(getSecretOptions) + + if err == nil { + return fmt.Errorf("ServiceCredentialsSecret still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for ServiceCredentialsSecret (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/ibm/service/secretsmanager/utils.go b/ibm/service/secretsmanager/utils.go index a00f44c9af..07a23380be 100644 --- a/ibm/service/secretsmanager/utils.go +++ b/ibm/service/secretsmanager/utils.go @@ -17,13 +17,14 @@ import ( ) const ( - ArbitrarySecretType = "arbitrary" - UsernamePasswordSecretType = "username_password" - IAMCredentialsSecretType = "iam_credentials" - KvSecretType = "kv" - ImportedCertSecretType = "imported_cert" - PublicCertSecretType = "public_cert" - PrivateCertSecretType = "private_cert" + ArbitrarySecretType = "arbitrary" + UsernamePasswordSecretType = "username_password" + IAMCredentialsSecretType = "iam_credentials" + ServiceCredentialsSecretType = "service_credentials" + KvSecretType = "kv" + ImportedCertSecretType = "imported_cert" + PublicCertSecretType = "public_cert" + PrivateCertSecretType = "private_cert" ) func getRegion(originalClient *secretsmanagerv2.SecretsManagerV2, d *schema.ResourceData) string { diff --git a/website/docs/d/sm_service_credentials_secret.html.markdown b/website/docs/d/sm_service_credentials_secret.html.markdown new file mode 100644 index 0000000000..bef56d1469 --- /dev/null +++ b/website/docs/d/sm_service_credentials_secret.html.markdown @@ -0,0 +1,156 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_sm_service_credentials_secret" +description: |- + Get information about ServiceCredentialsSecret +subcategory: "Secrets Manager" +--- + +# ibm_sm_service_credentials_secret + +Provides a read-only data source for a service credentials secret. You can then reference the fields of the data source in other resources within the same configuration using interpolation syntax. +The data source can be defined by providing the secret ID or the secret and secret group names. + +## Example Usage + +By secret id +```hcl +data "ibm_sm_service_credentials_secret" "service_credentials_secret" { + instance_id = ibm_resource_instance.sm_instance.guid + region = "us-south" + secret_id = "0b5571f7-21e6-42b7-91c5-3f5ac9793a46" +} +``` + +By secret name and group name +```hcl +data "ibm_sm_service_credentials_secret" "service_credentials_secret" { + instance_id = ibm_resource_instance.sm_instance.guid + region = "us-south" + name = "secret-name" + secret_group_name = "group-name" +} +``` + +### Example to access resource credentials using credentials attribute: + +```terraform +data "ibm_sm_service_credentials_secret" "service_credentials_secret" { + instance_id = ibm_resource_instance.sm_instance.guid + region = "us-south" + secret_id = "0b5571f7-21e6-42b7-91c5-3f5ac9793a46" +} +output "access_key_id" { + value = data.ibm_sm_service_credentials_secret.service_credentials_secret.credentials["cos_hmac_keys.access_key_id"] +} +output "secret_access_key" { + value = data.ibm_sm_service_credentials_secret.service_credentials_secret.credentials["cos_hmac_keys.secret_access_key"] +} +``` + +## Argument Reference + +Review the argument reference that you can specify for your data source. + +* `instance_id` - (Required, Forces new resource, String) The GUID of the Secrets Manager instance. +* `region` - (Optional, Forces new resource, String) The region of the Secrets Manager instance. If not provided defaults to the region defined in the IBM provider configuration. +* `endpoint_type` - (Optional, String) - The endpoint type. If not provided the endpoint type is determined by the `visibility` argument provided in the provider configuration. + * Constraints: Allowable values are: `private`, `public`. +* `secret_id` - (Optional, String) The ID of the secret. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/`. +* `name` - (Optional, String) The human-readable name of your secret. To be used in combination with `secret_group_name`. + * Constraints: The maximum length is `256` characters. The minimum length is `2` characters. The value must match regular expression `^[A-Za-z0-9][A-Za-z0-9]*(?:_*-*\\.*[A-Za-z0-9]+)*$`. +* `secret_group_name` - (Optional, String) The name of your existing secret group. To be used in combination with `name`. + * Constraints: The maximum length is `64` characters. The minimum length is `2` characters. The value must match regular expression `/(.*?)/`. + +## Attribute Reference + +In addition to all argument references listed, you can access the following attribute references after your data source is created. + +* `created_at` - (String) The date when a resource was created. The date format follows RFC 3339. + +* `created_by` - (String) The unique identifier that is associated with the entity that created the secret. + * Constraints: The maximum length is `128` characters. The minimum length is `4` characters. + +* `credentials` - (List) The properties of the service credentials secret payload. + Nested scheme for **credentials**: + * `apikey` - (String) The API key that is generated for this secret. + * `cos_hmac_keys` - (String) The Cloud Object Storage HMAC keys that are returned after you create a service credentials secret. + Nested scheme for **cos_hmac_keys**: + * `access_key_id` - (String) The access key ID for Cloud Object Storage HMAC credentials. + * `secret_access_key` - (String) The secret access key ID for Cloud Object Storage HMAC credentials. + * `endpoints` - (String) The endpoints that are returned after you create a service credentials secret. + * `iam_apikey_description` - (String) The description of the generated IAM API key. + * `iam_apikey_name` - (String) The name of the generated IAM API key. + * `iam_role_crn` - (String) The IAM role CRN that is returned after you create a service credentials secret. + * `iam_serviceid_crn` - (String) The IAM serviceId CRN that is returned after you create a service credentials secret. + * `resource_instance_id` - (String) The resource instance CRN that is returned after you create a service credentials secret. + +* `crn` - (String) A CRN that uniquely identifies an IBM Cloud resource. + * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + +* `custom_metadata` - (Map) The secret metadata that a user can customize. + +* `description` - (String) An extended description of your secret.To protect your privacy, do not use personal data, such as your name or location, as a description for your secret group. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/(.*?)/`. + +* `downloaded` - (Boolean) Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service API. + +* `labels` - (List) Labels that you can use to search for secrets in your instance.Up to 30 labels can be created. + * Constraints: The list items must match regular expression `/(.*?)/`. The maximum length is `30` items. The minimum length is `0` items. + +* `locks_total` - (Integer) The number of locks of the secret. + * Constraints: The maximum value is `1000`. The minimum value is `0`. + +* `name` - (String) The human-readable name of your secret. + * Constraints: The maximum length is `256` characters. The minimum length is `2` characters. + +* `next_rotation_date` - (String) The date that the secret is scheduled for automatic rotation.The service automatically creates a new version of the secret on its next rotation date. This field exists only for secrets that have an existing rotation policy. + +* `rotation` - (List) Determines whether Secrets Manager rotates your secrets automatically. + Nested scheme for **rotation**: + * `auto_rotate` - (Boolean) Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval. + * `interval` - (Integer) The length of the secret rotation time interval. + * Constraints: The minimum value is `1`. + * `unit` - (String) The units for the secret rotation time interval. + * Constraints: Allowable values are: `day`, `month`. + +* `secret_group_id` - (String) A v4 UUID identifier, or `default` secret group. + * Constraints: The maximum length is `36` characters. The minimum length is `7` characters. The value must match regular expression `/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|default)$/`. + +* `secret_type` - (String) The secret type. Supported types are arbitrary, certificates (imported, public, and private), IAM credentials, key-value, and user credentials. + * Constraints: Allowable values are: `arbitrary`, `imported_cert`, `public_cert`, `iam_credentials`, `kv`, `username_password`, `private_cert`. + +* `source_service` - (List) The properties required for creating the service credentials for the specified source service instance. + Nested scheme for **source_service**: + * `iam` - (List) The source service IAM data is returned in case IAM credentials where created for this secret. + Nested scheme for **iam**: + * `apikey` - (String) The IAM apikey metadata for the IAM credentials that were generated. + Nested scheme for **apikey**: + * `name` - (String) The IAM API key name for the generated service credentials. + * `description` - (String) The IAM API key description for the generated service credentials. + * `role` - (String) The IAM role for the generate service credentials. + Nested scheme for **role**: + * `crn` - (String) The IAM role CRN assigned to the generated service credentials. + * `serviceid` - (String) The IAM serviceid for the generated service credentials. + Nested scheme for **serviceid**: + * `crn` - (String) The IAM Service ID CRN. + * `resource_key` - (List) The source service resource key data of the generated service credentials. + Nested scheme for **resource_key**: + * `crn` - (String) The resource key CRN of the generated service credentials. + * `name` - (String) The resource key name of the generated service credentials. + +* `state` - (Integer) The secret state that is based on NIST SP 800-57. States are integers and correspond to the `Pre-activation = 0`, `Active = 1`, `Suspended = 2`, `Deactivated = 3`, and `Destroyed = 5` values. + * Constraints: Allowable values are: `0`, `1`, `2`, `3`, `5`. + +* `state_description` - (String) A text representation of the secret state. + * Constraints: Allowable values are: `pre_activation`, `active`, `suspended`, `deactivated`, `destroyed`. + +* `ttl` - (String) The time-to-live (TTL) or lease duration to assign to generated credentials. The TTL defines for how long generated credentials remain valid. The value should be a string that specifies the number of seconds. Minimum duration is 86400 (1 day). Maximum is 7776000 seconds (90 days). + * Constraints: The maximum length is `7` characters. The minimum length is `2` characters. + +* `updated_at` - (String) The date when a resource was recently modified. The date format follows RFC 3339. + +* `versions_total` - (Integer) The number of versions of the secret. + * Constraints: The maximum value is `50`. The minimum value is `0`. + diff --git a/website/docs/d/sm_service_credentials_secret_metadata.html.markdown b/website/docs/d/sm_service_credentials_secret_metadata.html.markdown new file mode 100644 index 0000000000..94b9d8d648 --- /dev/null +++ b/website/docs/d/sm_service_credentials_secret_metadata.html.markdown @@ -0,0 +1,113 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_sm_service_credentials_secret_metadata" +description: |- + Get information about ServiceCredentialsSecretMetadata +subcategory: "Secrets Manager" +--- + +# ibm_sm_service_credentials_secret_metadata + +Provides a read-only data source for the metadata of an service credentials secret. You can then reference the fields of the data source in other resources within the same configuration using interpolation syntax. + + +## Example Usage + +```hcl +data "ibm_sm_service_credentials_secret_metadata" "service_credentials_secret_metadata" { + instance_id = ibm_resource_instance.sm_instance.guid + region = "us-south" + secret_id = "0b5571f7-21e6-42b7-91c5-3f5ac9793a46" +} +``` + +## Argument Reference + +Review the argument reference that you can specify for your data source. + +* `instance_id` - (Required, Forces new resource, String) The GUID of the Secrets Manager instance. +* `region` - (Optional, Forces new resource, String) The region of the Secrets Manager instance. If not provided defaults to the region defined in the IBM provider configuration. +* `endpoint_type` - (Optional, String) - The endpoint type. If not provided the endpoint type is determined by the `visibility` argument provided in the provider configuration. + * Constraints: Allowable values are: `private`, `public`. +* `secret_id` - (Optional, String) The ID of the secret. + * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/`. + +## Attribute Reference + +In addition to all argument references listed, you can access the following attribute references after your data source is created. + +* `id` - The unique identifier of the data source. + +* `created_at` - (String) The date when a resource was created. The date format follows RFC 3339. + +* `created_by` - (String) The unique identifier that is associated with the entity that created the secret. + * Constraints: The maximum length is `128` characters. The minimum length is `4` characters. + +* `crn` - (String) A CRN that uniquely identifies an IBM Cloud resource. + * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. + +* `custom_metadata` - (Map) The secret metadata that a user can customize. + +* `description` - (String) An extended description of your secret.To protect your privacy, do not use personal data, such as your name or location, as a description for your secret group. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/(.*?)/`. + +* `downloaded` - (Boolean) Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service API. + +* `labels` - (List) Labels that you can use to search for secrets in your instance.Up to 30 labels can be created. + * Constraints: The list items must match regular expression `/(.*?)/`. The maximum length is `30` items. The minimum length is `0` items. + +* `locks_total` - (Integer) The number of locks of the secret. + * Constraints: The maximum value is `1000`. The minimum value is `0`. + +* `name` - (String) The human-readable name of your secret. + * Constraints: The maximum length is `256` characters. The minimum length is `2` characters. + +* `next_rotation_date` - (String) The date that the secret is scheduled for automatic rotation.The service automatically creates a new version of the secret on its next rotation date. This field exists only for secrets that have an existing rotation policy. + +* `rotation` - (List) Determines whether Secrets Manager rotates your secrets automatically. + Nested scheme for **rotation**: + * `auto_rotate` - (Boolean) Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval. + * `interval` - (Integer) The length of the secret rotation time interval. + * Constraints: The minimum value is `1`. + * `unit` - (String) The units for the secret rotation time interval. + * Constraints: Allowable values are: `day`, `month`. + +* `secret_group_id` - (String) A v4 UUID identifier, or `default` secret group. + * Constraints: The maximum length is `36` characters. The minimum length is `7` characters. The value must match regular expression `/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|default)$/`. + +* `secret_type` - (String) The secret type. Supported types are arbitrary, certificates (imported, public, and private), IAM credentials, key-value, and user credentials. + * Constraints: Allowable values are: `arbitrary`, `imported_cert`, `public_cert`, `iam_credentials`, `kv`, `username_password`, `private_cert`. + +* `source_service` - (List) The properties required for creating the service credentials for the specified source service instance. + Nested scheme for **source_service**: + * `iam` - (List) The source service IAM data is returned in case IAM credentials where created for this secret. + Nested scheme for **iam**: + * `apikey` - (String) The IAM apikey metadata for the IAM credentials that were generated. + Nested scheme for **apikey**: + * `name` - (String) The IAM API key name for the generated service credentials. + * `description` - (String) The IAM API key description for the generated service credentials. + * `role` - (String) The IAM role for the generate service credentials. + Nested scheme for **role**: + * `crn` - (String) The IAM role CRN assigned to the generated service credentials. + * `serviceid` - (String) The IAM serviceid for the generated service credentials. + Nested scheme for **serviceid**: + * `crn` - (String) The IAM Service ID CRN. + * `resource_key` - (List) The source service resource key data of the generated service credentials. + Nested scheme for **resource_key**: + * `crn` - (String) The resource key CRN of the generated service credentials. + * `name` - (String) The resource key name of the generated service credentials. + +* `state` - (Integer) The secret state that is based on NIST SP 800-57. States are integers and correspond to the `Pre-activation = 0`, `Active = 1`, `Suspended = 2`, `Deactivated = 3`, and `Destroyed = 5` values. + * Constraints: Allowable values are: `0`, `1`, `2`, `3`, `5`. + +* `state_description` - (String) A text representation of the secret state. + * Constraints: Allowable values are: `pre_activation`, `active`, `suspended`, `deactivated`, `destroyed`. + +* `ttl` - (String) The time-to-live (TTL) or lease duration to assign to generated credentials. The TTL defines for how long generated credentials remain valid. The value should be a string that specifies the number of seconds. Minimum duration is 86400 (1 day). Maximum is 7776000 seconds (90 days). + * Constraints: The maximum length is `7` characters. The minimum length is `2` characters. + +* `updated_at` - (String) The date when a resource was recently modified. The date format follows RFC 3339. + +* `versions_total` - (Integer) The number of versions of the secret. + * Constraints: The maximum value is `50`. The minimum value is `0`. + diff --git a/website/docs/r/sm_service_credentials_secret.html.markdown b/website/docs/r/sm_service_credentials_secret.html.markdown new file mode 100644 index 0000000000..cdf60c3e9f --- /dev/null +++ b/website/docs/r/sm_service_credentials_secret.html.markdown @@ -0,0 +1,222 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_sm_service_credentials_secret" +description: |- + Manages ServiceCredentialsSecret. +subcategory: "Secrets Manager" +--- + +# ibm_sm_service_credentials_secret + +Provides a resource for ServiceCredentialsSecret. This allows ServiceCredentialsSecret to be created, updated and deleted. + +## Example Usage + +```hcl +resource "ibm_sm_service_credentials_secret" "sm_service_credentials_secret" { + instance_id = ibm_resource_instance.sm_instance.guid + region = "us-south" + name = "secret-name" + custom_metadata = {"key":"value"} + description = "Extended description for this secret." + labels = ["my-label"] + rotation { + auto_rotate = true + interval = 1 + unit = "day" + } + secret_group_id = ibm_sm_secret_group.sm_secret_group.secret_group_id + source_service { + instance { + crn = "crn:v1:staging:public:cloud-object-storage:global:a/111f5fb10986423e9saa8512f1db7e65:111133c8-49ea-41xe-8c40-122038246f5b::" + } + role { + crn = "crn:v1:bluemix:public:iam::::serviceRole:Writer" + } + parameters = {"HMAC": true} + } + ttl = "1800" +} +``` + +### Example to access resource credentials using credentials attribute: + +```terraform +resource "ibm_sm_service_credentials_secret" "sm_service_credentials_secret" { + region = "us-south" + name = "secret-name" + source_service { + instance { + crn = "crn:v1:staging:public:cloud-object-storage:global:a/111f5fb10986423e9saa8512f1db7e65:111133c8-49ea-41xe-8c40-122038246f5b::" + } + role { + crn = "crn:v1:bluemix:public:iam::::serviceRole:Writer" + } + parameters = {"HMAC": true} + } + ttl = "1800" +} + +output "access_key_id" { + value = ibm_sm_service_credentials_secret.sm_service_credentials_secret.credentials["cos_hmac_keys.access_key_id"] +} +output "secret_access_key" { + value = ibm_sm_service_credentials_secret.sm_service_credentials_secret.credentials["cos_hmac_keys.secret_access_key"] +} +``` + +## Argument Reference + +Review the argument reference that you can specify for your resource. + +* `instance_id` - (Required, Forces new resource, String) The GUID of the Secrets Manager instance. +* `region` - (Optional, Forces new resource, String) The region of the Secrets Manager instance. If not provided defaults to the region defined in the IBM provider configuration. +* `endpoint_type` - (Optional, String) - The endpoint type. If not provided the endpoint type is determined by the `visibility` argument provided in the provider configuration. + * Constraints: Allowable values are: `private`, `public`. +* `name` - (Required, String) The human-readable name of your secret. + * Constraints: The maximum length is `256` characters. The minimum length is `2` characters. The value must match regular expression `^[A-Za-z0-9][A-Za-z0-9]*(?:_*-*\\.*[A-Za-z0-9]+)*$`. +* `custom_metadata` - (Optional, Map) The secret metadata that a user can customize. +* `description` - (Optional, String) An extended description of your secret.To protect your privacy, do not use personal data, such as your name or location, as a description for your secret group. + * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/(.*?)/`. +* `labels` - (Optional, List) Labels that you can use to search for secrets in your instance.Up to 30 labels can be created. + * Constraints: The list items must match regular expression `/(.*?)/`. The maximum length is `30` items. The minimum length is `0` items. +* `rotation` - (Optional, List) Determines whether Secrets Manager rotates your secrets automatically. +Nested scheme for **rotation**: + * `auto_rotate` - (Optional, Boolean) Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval. + * `interval` - (Optional, Integer) The length of the secret rotation time interval. + * Constraints: The minimum value is `1`. + * `unit` - (Optional, String) The units for the secret rotation time interval. + * Constraints: Allowable values are: `day`, `month`. +* `secret_group_id` - (Optional, Forces new resource, String) A v4 UUID identifier, or `default` secret group. + * Constraints: The maximum length is `36` characters. The minimum length is `7` characters. The value must match regular expression `/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|default)$/`. +* `source_service` - (Optional, List) The properties required for creating the service credentials for the specified source service instance. +Nested scheme for **source_service**: + * `instance` - (Optional, List) The source service instance identifier. + Nested scheme for **instance**: + * `crn` - (Optional, String) A CRN that uniquely identifies a service credentials source. + * `role` - (Optional, List) The service-specific custom role object, CRN role is accepted. Refer to the service’s documentation for supported roles. + Nested scheme for **role**: + * `crn` - (Optional, String) The service role CRN. + * `parameters` - (Optional, List) Configuration options represented as key-value pairs. Service-defined options are used in the generation of credentials for some services. For example, Cloud Object Storage accepts the optional boolean parameter HMAC for creating specific kind of credentials. +* `ttl` - (Required, String) The time-to-live (TTL) or lease duration to assign to generated credentials. The TTL defines for how long generated credentials remain valid. The value should be a string that specifies the number of seconds. Minimum duration is 86400 (1 day). Maximum is 7776000 seconds (90 days). + * Constraints: The maximum length is `7` characters. The minimum length is `2` characters. + +## Attribute Reference + +In addition to all argument references listed, you can access the following attribute references after your resource is created. + +* `secret_id` - The unique identifier of the ServiceCredentialsSecret. +* `created_at` - (String) The date when a resource was created. The date format follows RFC 3339. +* `created_by` - (String) The unique identifier that is associated with the entity that created the secret. + * Constraints: The maximum length is `128` characters. The minimum length is `4` characters. +* `credentials` - (List) The properties of the service credentials secret payload. + Nested scheme for **credentials**: + * `apikey` - (String) The API key that is generated for this secret. + * `cos_hmac_keys` - (String) The Cloud Object Storage HMAC keys that are returned after you create a service credentials secret. + Nested scheme for **cos_hmac_keys**: + * `access_key_id` - (String) The access key ID for Cloud Object Storage HMAC credentials. + * `secret_access_key` - (String) The secret access key ID for Cloud Object Storage HMAC credentials. + * `endpoints` - (String) The endpoints that are returned after you create a service credentials secret. + * `iam_apikey_description` - (String) The description of the generated IAM API key. + * `iam_apikey_name` - (String) The name of the generated IAM API key. + * `iam_role_crn` - (String) The IAM role CRN that is returned after you create a service credentials secret. + * `iam_serviceid_crn` - (String) The IAM serviceId CRN that is returned after you create a service credentials secret. + * `resource_instance_id` - (String) The resource instance CRN that is returned after you create a service credentials secret. +* `crn` - (String) A CRN that uniquely identifies an IBM Cloud resource. + * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. The value must match regular expression `/^crn:v[0-9](:([A-Za-z0-9-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. +* `downloaded` - (Boolean) Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service API. +* `locks_total` - (Integer) The number of locks of the secret. + * Constraints: The maximum value is `1000`. The minimum value is `0`. +* `next_rotation_date` - (String) The date that the secret is scheduled for automatic rotation.The service automatically creates a new version of the secret on its next rotation date. This field exists only for secrets that have an existing rotation policy. +* `source_service` - (List) The properties required for creating the service credentials for the specified source service instance. + Nested scheme for **source_service**: + * `iam` - (List) The source service IAM data is returned in case IAM credentials where created for this secret. + Nested scheme for **iam**: + * `apikey` - (String) The IAM apikey metadata for the IAM credentials that were generated. + Nested scheme for **apikey**: + * `name` - (String) The IAM API key name for the generated service credentials. + * `description` - (String) The IAM API key description for the generated service credentials. + * `role` - (String) The IAM role for the generate service credentials. + Nested scheme for **role**: + * `crn` - (String) The IAM role CRN assigned to the generated service credentials. + * `serviceid` - (String) The IAM serviceid for the generated service credentials. + Nested scheme for **serviceid**: + * `crn` - (String) The IAM Service ID CRN. + * `resource_key` - (List) The source service resource key data of the generated service credentials. + Nested scheme for **resource_key**: + * `crn` - (String) The resource key CRN of the generated service credentials. + * `name` - (String) The resource key name of the generated service credentials. +* `state` - (Integer) The secret state that is based on NIST SP 800-57. States are integers and correspond to the `Pre-activation = 0`, `Active = 1`, `Suspended = 2`, `Deactivated = 3`, and `Destroyed = 5` values. + * Constraints: Allowable values are: `0`, `1`, `2`, `3`, `5`. +* `state_description` - (String) A text representation of the secret state. + * Constraints: Allowable values are: `pre_activation`, `active`, `suspended`, `deactivated`, `destroyed`. +* `secret_type` - (String) The secret type. Supported types are arbitrary, certificates (imported, public, and private), IAM credentials, key-value, and user credentials. + * Constraints: Allowable values are: `arbitrary`, `imported_cert`, `public_cert`, `iam_credentials`, `kv`, `username_password`, `private_cert`. +* `updated_at` - (String) The date when a resource was recently modified. The date format follows RFC 3339. +* `versions_total` - (Integer) The number of versions of the secret. + * Constraints: The maximum value is `50`. The minimum value is `0`. + +## Provider Configuration + +The IBM Cloud provider offers a flexible means of providing credentials for authentication. The following methods are supported, in this order, and explained below: + +- Static credentials +- Environment variables + +To find which credentials are required for this resource, see the service table [here](https://cloud.ibm.com/docs/ibm-cloud-provider-for-terraform?topic=ibm-cloud-provider-for-terraform-provider-reference#required-parameters). + +### Static credentials + +You can provide your static credentials by adding the `ibmcloud_api_key`, `iaas_classic_username`, and `iaas_classic_api_key` arguments in the IBM Cloud provider block. + +Usage: +``` +provider "ibm" { + ibmcloud_api_key = "" + iaas_classic_username = "" + iaas_classic_api_key = "" +} +``` + +### Environment variables + +You can provide your credentials by exporting the `IC_API_KEY`, `IAAS_CLASSIC_USERNAME`, and `IAAS_CLASSIC_API_KEY` environment variables, representing your IBM Cloud platform API key, IBM Cloud Classic Infrastructure (SoftLayer) user name, and IBM Cloud infrastructure API key, respectively. + +``` +provider "ibm" {} +``` + +Usage: +``` +export IC_API_KEY="ibmcloud_api_key" +export IAAS_CLASSIC_USERNAME="iaas_classic_username" +export IAAS_CLASSIC_API_KEY="iaas_classic_api_key" +terraform plan +``` + +Note: + +1. Create or find your `ibmcloud_api_key` and `iaas_classic_api_key` [here](https://cloud.ibm.com/iam/apikeys). + - Select `My IBM Cloud API Keys` option from view dropdown for `ibmcloud_api_key` + - Select `Classic Infrastructure API Keys` option from view dropdown for `iaas_classic_api_key` +2. For iaas_classic_username + - Go to [Users](https://cloud.ibm.com/iam/users) + - Click on user. + - Find user name in the `VPN password` section under `User Details` tab + +For more informaton, see [here](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs#authentication). + +## Import + +You can import the `ibm_sm_service_credentials_secret` resource by using `region`, `instance_id`, and `secret_id`. +For more information, see [the documentation](https://cloud.ibm.com/docs/secrets-manager) + +# Syntax +```bash +$ terraform import ibm_sm_service_credentials_secret.sm_service_credentials_secret // +``` + +# Example +```bash +$ terraform import ibm_sm_service_credentials_secret.sm_service_credentials_secret us-east/6ebc4224-e983-496a-8a54-f40a0bfa9175/b49ad24d-81d4-5ebc-b9b9-b0937d1c84d5 +``` From dfb68f89fd8afc6d9d9916ee1bc1bcff1713b515 Mon Sep 17 00:00:00 2001 From: SunithaGudisagar <127872893+SunithaGudisagarIBM1@users.noreply.github.com> Date: Wed, 13 Dec 2023 17:04:25 +0530 Subject: [PATCH 101/132] Feature is snapshot consistency group and Migration PR (#4973) * GO-SDK Updated * ibm_is_snapshot_consistency_group development * Consistency Group changes to Snapshot * Documentation changes for snapshot * SDK changes * Bankup Policy Jobs Changes * included_content development * match_resource_type development * Implemented Documentation Fix * PR review comments incorporated * SDK update * Updated to released SDK --- examples/ibm-is-ng/main.tf | 39 +- go.mod | 4 +- go.sum | 3 + ibm/provider/provider.go | 21 +- .../vpc/data_source_ibm_is_backup_policies.go | 24 +- .../vpc/data_source_ibm_is_backup_policy.go | 35 +- .../data_source_ibm_is_backup_policy_job.go | 211 ++++- .../data_source_ibm_is_backup_policy_jobs.go | 161 +++- .../vpc/data_source_ibm_is_snapshot.go | 66 ++ ...ource_ibm_is_snapshot_consistency_group.go | 589 +++++++++++++ ..._ibm_is_snapshot_consistency_group_test.go | 61 ++ ...urce_ibm_is_snapshot_consistency_groups.go | 369 ++++++++ ...ibm_is_snapshot_consistency_groups_test.go | 61 ++ .../vpc/data_source_ibm_is_snapshots.go | 91 +- .../vpc/resource_ibm_is_backup_policy.go | 79 +- ibm/service/vpc/resource_ibm_is_snapshot.go | 68 ++ ...ource_ibm_is_snapshot_consistency_group.go | 815 ++++++++++++++++++ ..._ibm_is_snapshot_consistency_group_test.go | 166 ++++ ...ource_ibm_is_vpc_dns_resolution_binding.go | 2 +- .../docs/d/is_backup_policies.html.markdown | 8 + website/docs/d/is_backup_policy.html.markdown | 3 + .../docs/d/is_backup_policy_job.html.markdown | 17 + .../d/is_backup_policy_jobs.html.markdown | 18 + .../d/is_backup_policy_plan.html.markdown | 5 + website/docs/d/is_snapshot.html.markdown | 12 + ...s_snapshot_consistency_group.html.markdown | 90 ++ ..._snapshot_consistency_groups.html.markdown | 89 ++ website/docs/d/is_snapshots.html.markdown | 18 +- website/docs/r/is_backup_policy.html.markdown | 8 +- website/docs/r/is_snapshot.html.markdown | 12 + ...s_snapshot_consistency_group.html.markdown | 119 +++ 31 files changed, 3197 insertions(+), 67 deletions(-) create mode 100644 ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go create mode 100644 ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group_test.go create mode 100644 ibm/service/vpc/data_source_ibm_is_snapshot_consistency_groups.go create mode 100644 ibm/service/vpc/data_source_ibm_is_snapshot_consistency_groups_test.go create mode 100644 ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go create mode 100644 ibm/service/vpc/resource_ibm_is_snapshot_consistency_group_test.go create mode 100644 website/docs/d/is_snapshot_consistency_group.html.markdown create mode 100644 website/docs/d/is_snapshot_consistency_groups.html.markdown create mode 100644 website/docs/r/is_snapshot_consistency_group.html.markdown diff --git a/examples/ibm-is-ng/main.tf b/examples/ibm-is-ng/main.tf index a3e74809b9..896216cc78 100644 --- a/examples/ibm-is-ng/main.tf +++ b/examples/ibm-is-ng/main.tf @@ -1094,8 +1094,16 @@ data "ibm_is_volumes" "example" { ## Backup Policy resource "ibm_is_backup_policy" "is_backup_policy" { - match_user_tags = ["tag1"] - name = "my-backup-policy" + match_user_tags = ["tag1"] + name = "my-backup-policy" + match_resource_type = "volume" +} + +resource "ibm_is_backup_policy" "is_backup_policy" { + match_user_tags = ["tag1"] + name = "my-backup-policy-instance" + match_resource_type = "instance" + included_content = ["boot_volume", "data_volumes"] } resource "ibm_is_backup_policy_plan" "is_backup_policy_plan" { @@ -1399,3 +1407,30 @@ resource "ibm_is_image_deprecate" "example" { resource "ibm_is_image_obsolete" "example" { image = ibm_is_image.image1.id } + + +//snapshot consistency group + +resource "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group_instance" { + delete_snapshots_on_delete = true + snapshots { + name = "exmaple-snapshot" + source_volume = ibm_is_instance.instance.volume_attachments[0].volume_id + } + snapshots { + name = "example-snapshot-1" + source_volume = ibm_is_instance.instance.volume_attachments[1].volume_id + } + name = "example-snapshot-consistency-group" +} + +data "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group_instance" { + identifier = ibm_is_snapshot_consistency_group.is_snapshot_consistency_group_instance.id +} +data "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group_instance" { + name = "example-snapshot-consistency-group" +} +data "ibm_is_snapshot_consistency_groups" "is_snapshot_consistency_group_instance" { + depends_on = [ibm_is_snapshot_consistency_group.is_snapshot_consistency_group_instance] + name = "example-snapshot-consistency-group" +} \ No newline at end of file diff --git a/go.mod b/go.mod index d69e3df819..638e7af953 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/IBM/schematics-go-sdk v0.2.2 github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2 github.com/IBM/vpc-beta-go-sdk v0.6.0 - github.com/IBM/vpc-go-sdk v0.43.0 + github.com/IBM/vpc-go-sdk v0.45.0 github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5 github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 github.com/akamai/AkamaiOPEN-edgegrid-golang/v5 v5.0.0 @@ -241,4 +241,4 @@ exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible k8s.io/client-go v12.0.0+incompatible -) +) \ No newline at end of file diff --git a/go.sum b/go.sum index 9ee7c97b82..dd2b86dde3 100644 --- a/go.sum +++ b/go.sum @@ -178,6 +178,8 @@ github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQy github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA= github.com/IBM/vpc-go-sdk v0.43.0 h1:uy/qWIqETCXraUG2cq5sjScr6pZ79ZteY1v5iLUVQ3Q= github.com/IBM/vpc-go-sdk v0.43.0/go.mod h1:kRz9tqPvpHoA/qGrC/qVjTbi4ICuTChpG76L89liGL4= +github.com/IBM/vpc-go-sdk v0.45.0 h1:RFbUZH5vBRGAEW5+jRzbDlxB+a+GvG9EBhyYO52Tvrs= +github.com/IBM/vpc-go-sdk v0.45.0/go.mod h1:4Hs5d/aClmsxAzwDQkwG+ri0vW2ykPJdpM6hDLRwKcA= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= @@ -1273,6 +1275,7 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/onsi/gomega v1.18.0/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index 48915f7c9d..0bf1e29b21 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -485,6 +485,8 @@ func Provider() *schema.Provider { "ibm_is_snapshot_clone": vpc.DataSourceSnapshotClone(), "ibm_is_snapshot_clones": vpc.DataSourceSnapshotClones(), "ibm_is_snapshot": vpc.DataSourceSnapshot(), + "ibm_is_snapshot_consistency_group": vpc.DataSourceIBMIsSnapshotConsistencyGroup(), + "ibm_is_snapshot_consistency_groups": vpc.DataSourceIBMIsSnapshotConsistencyGroups(), "ibm_is_snapshots": vpc.DataSourceSnapshots(), "ibm_is_share": vpc.DataSourceIbmIsShare(), "ibm_is_source_share": vpc.DataSourceIbmIsSourceShare(), @@ -1091,6 +1093,7 @@ func Provider() *schema.Provider { "ibm_is_subnet_routing_table_attachment": vpc.ResourceIBMISSubnetRoutingTableAttachment(), "ibm_is_ssh_key": vpc.ResourceIBMISSSHKey(), "ibm_is_snapshot": vpc.ResourceIBMSnapshot(), + "ibm_is_snapshot_consistency_group": vpc.ResourceIBMIsSnapshotConsistencyGroup(), "ibm_is_volume": vpc.ResourceIBMISVolume(), "ibm_is_vpn_gateway": vpc.ResourceIBMISVPNGateway(), "ibm_is_vpn_gateway_connection": vpc.ResourceIBMISVPNGatewayConnection(), @@ -1532,6 +1535,7 @@ func Validator() validate.ValidatorDict { "ibm_is_share_replica_operations": vpc.ResourceIbmIsShareReplicaOperationsValidator(), "ibm_is_share_mount_target": vpc.ResourceIBMIsShareMountTargetValidator(), "ibm_is_snapshot": vpc.ResourceIBMISSnapshotValidator(), + "ibm_is_snapshot_consistency_group": vpc.ResourceIBMIsSnapshotConsistencyGroupValidator(), "ibm_is_ssh_key": vpc.ResourceIBMISSHKeyValidator(), "ibm_is_subnet": vpc.ResourceIBMISSubnetValidator(), "ibm_is_subnet_reserved_ip": vpc.ResourceIBMISSubnetReservedIPValidator(), @@ -1664,14 +1668,15 @@ func Validator() validate.ValidatorDict { "ibm_project_environment": project.ResourceIbmProjectEnvironmentValidator(), }, DataSourceValidatorDictionary: map[string]*validate.ResourceValidator{ - "ibm_is_subnet": vpc.DataSourceIBMISSubnetValidator(), - "ibm_is_snapshot": vpc.DataSourceIBMISSnapshotValidator(), - "ibm_is_images": vpc.DataSourceIBMISImagesValidator(), - "ibm_dl_offering_speeds": directlink.DataSourceIBMDLOfferingSpeedsValidator(), - "ibm_dl_routers": directlink.DataSourceIBMDLRoutersValidator(), - "ibm_resource_instance": resourcecontroller.DataSourceIBMResourceInstanceValidator(), - "ibm_resource_key": resourcecontroller.DataSourceIBMResourceKeyValidator(), - "ibm_resource_group": resourcemanager.DataSourceIBMResourceGroupValidator(), + "ibm_is_subnet": vpc.DataSourceIBMISSubnetValidator(), + "ibm_is_snapshot_consistency_group": vpc.DataSourceIBMISSnapshotConsistencyGroupValidator(), + "ibm_is_snapshot": vpc.DataSourceIBMISSnapshotValidator(), + "ibm_is_images": vpc.DataSourceIBMISImagesValidator(), + "ibm_dl_offering_speeds": directlink.DataSourceIBMDLOfferingSpeedsValidator(), + "ibm_dl_routers": directlink.DataSourceIBMDLRoutersValidator(), + "ibm_resource_instance": resourcecontroller.DataSourceIBMResourceInstanceValidator(), + "ibm_resource_key": resourcecontroller.DataSourceIBMResourceKeyValidator(), + "ibm_resource_group": resourcemanager.DataSourceIBMResourceGroupValidator(), // bare_metal_server "ibm_is_bare_metal_server": vpc.DataSourceIBMIsBareMetalServerValidator(), diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policies.go b/ibm/service/vpc/data_source_ibm_is_backup_policies.go index d9f03c7f53..9e223abac2 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policies.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policies.go @@ -81,6 +81,17 @@ func DataSourceIBMIsBackupPolicies() *schema.Resource { Type: schema.TypeString, }, }, + "match_resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "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.", + }, + "included_content": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The included content for backups created using this policy", + Elem: &schema.Schema{Type: schema.TypeString}, + }, "match_user_tags": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -273,7 +284,10 @@ func dataSourceIBMIsBackupPoliciesRead(context context.Context, d *schema.Resour break } start = flex.GetNext(backupPolicyCollection.Next) - matchBackupPolicies = append(matchBackupPolicies, backupPolicyCollection.BackupPolicies...) + for _, backupPolicyInfo := range backupPolicyCollection.BackupPolicies { + backupPolicies := backupPolicyInfo.(*vpcv1.BackupPolicy) + matchBackupPolicies = append(matchBackupPolicies, *backupPolicies) + } if start == "" { break } @@ -326,12 +340,16 @@ func dataSourceBackupPolicyCollectionBackupPoliciesToMap(backupPoliciesItem vpcv if backupPoliciesItem.LastJobCompletedAt != nil { backupPoliciesMap["last_job_completed_at"] = flex.DateTimeToString(backupPoliciesItem.LastJobCompletedAt) } - if backupPoliciesItem.MatchResourceTypes != nil { - backupPoliciesMap["match_resource_types"] = backupPoliciesItem.MatchResourceTypes + if backupPoliciesItem.MatchResourceType != nil { + backupPoliciesMap["match_resource_types"] = []string{*backupPoliciesItem.MatchResourceType} + backupPoliciesMap["match_resource_type"] = *backupPoliciesItem.MatchResourceType } if backupPoliciesItem.MatchUserTags != nil { backupPoliciesMap["match_user_tags"] = backupPoliciesItem.MatchUserTags } + if backupPoliciesItem.IncludedContent != nil { + backupPoliciesMap["included_content"] = backupPoliciesItem.IncludedContent + } if backupPoliciesItem.Name != nil { backupPoliciesMap["name"] = backupPoliciesItem.Name } diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policy.go b/ibm/service/vpc/data_source_ibm_is_backup_policy.go index 7baaafa6cb..62d152f0ce 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policy.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policy.go @@ -69,6 +69,17 @@ func DataSourceIBMIsBackupPolicy() *schema.Resource { Type: schema.TypeString, }, }, + "match_resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "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.", + }, + "included_content": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The included content for backups created using this policy", + Elem: &schema.Schema{Type: schema.TypeString}, + }, "match_user_tags": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -223,7 +234,7 @@ func dataSourceIBMIsBackupPolicyRead(context context.Context, d *schema.Resource log.Printf("[DEBUG] GetBackupPolicyWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("[ERROR] GetBackupPolicyWithContext failed %s\n%s", err, response)) } - backupPolicy = backupPolicyInfo + backupPolicy = backupPolicyInfo.(*vpcv1.BackupPolicy) } else if v, ok := d.GetOk("name"); ok { @@ -244,7 +255,10 @@ func dataSourceIBMIsBackupPolicyRead(context context.Context, d *schema.Resource break } start = flex.GetNext(backupPolicyCollection.Next) - allrecs = append(allrecs, backupPolicyCollection.BackupPolicies...) + for _, backupPolicyInfo := range backupPolicyCollection.BackupPolicies { + backupPolicies := backupPolicyInfo.(*vpcv1.BackupPolicy) + allrecs = append(allrecs, *backupPolicies) + } if start == "" { break } @@ -316,13 +330,20 @@ func dataSourceIBMIsBackupPolicyRead(context context.Context, d *schema.Resource } } - matchResourceType := make([]string, 0) - if backupPolicy.MatchResourceTypes != nil { - for _, matchResourceTyp := range backupPolicy.MatchResourceTypes { - matchResourceType = append(matchResourceType, matchResourceTyp) + if backupPolicy.MatchResourceType != nil { + if err = d.Set("match_resource_types", []string{*backupPolicy.MatchResourceType}); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting match_resource_types: %s", err)) + } + if err = d.Set("match_resource_type", *backupPolicy.MatchResourceType); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting match_resource_type: %s", err)) + } + } + + if backupPolicy.IncludedContent != nil { + if err = d.Set("included_content", backupPolicy.IncludedContent); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting included_content: %s", err)) } } - d.Set("match_resource_types", matchResourceType) matchUserTags := make([]string, 0) if backupPolicy.MatchUserTags != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policy_job.go b/ibm/service/vpc/data_source_ibm_is_backup_policy_job.go index 6c63a9e255..a7aee98b28 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policy_job.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policy_job.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "log" + "reflect" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" @@ -75,6 +76,25 @@ func DataSourceIBMIsBackupPolicyJob() *schema.Resource { Computed: true, Description: "The unique user-defined name for this backup policy plan.", }, + "remote": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates that the resource associated with this reference is remote and therefore may not be directly retrievable.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this region.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The globally unique name for this region.", + }, + }, + }, + }, "resource_type": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -109,6 +129,73 @@ func DataSourceIBMIsBackupPolicyJob() *schema.Resource { Description: "The resource type.", }, "source_volume": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The source volume this backup was created from (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this volume.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this volume.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this volume.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique user-defined name for this volume.", + }, + "remote": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates that the resource associated with this reference is remote and therefore may not be directly retrievable.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this region.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The globally unique name for this region.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "source_instance": &schema.Schema{ Type: schema.TypeList, Computed: true, Description: "The source volume this backup was created from (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).", @@ -280,11 +367,25 @@ func dataSourceIBMIsBackupPolicyJobRead(context context.Context, d *schema.Resou } if backupPolicyJob.Source != nil { - jobSource := backupPolicyJob.Source.(*vpcv1.BackupPolicyJobSource) - err = d.Set("source_volume", dataSourceBackupPolicyJobFlattenSourceVolume(*jobSource)) - if err != nil { - return diag.FromErr(fmt.Errorf("Error setting source_volume %s", err)) + switch reflect.TypeOf(backupPolicyJob.Source).String() { + case "*vpcv1.BackupPolicyJobSourceVolumeReference": + { + jobSource := backupPolicyJob.Source.(*vpcv1.BackupPolicyJobSourceVolumeReference) + err = d.Set("source_volume", dataSourceBackupPolicyJobFlattenSourceVolume(*jobSource)) + if err != nil { + return diag.FromErr(fmt.Errorf("Error setting source_volume %s", err)) + } + } + case "*vpcv1.BackupPolicyJobSourceInstanceReference": + { + jobSource := backupPolicyJob.Source.(*vpcv1.BackupPolicyJobSourceInstanceReference) + err = d.Set("source_instance", dataSourceBackupPolicyJobFlattenSourceInstance(*jobSource)) + if err != nil { + return diag.FromErr(fmt.Errorf("Error setting source_instance %s", err)) + } + } } + } if err = d.Set("status", backupPolicyJob.Status); err != nil { return diag.FromErr(fmt.Errorf("Error setting status: %s", err)) @@ -333,10 +434,16 @@ func dataSourceBackupPolicyJobBackupPolicyPlanToMap(backupPolicyPlanItem vpcv1.B if backupPolicyPlanItem.Name != nil { backupPolicyPlanMap["name"] = backupPolicyPlanItem.Name } + if backupPolicyPlanItem.Remote != nil { + remoteMap, err := resourceIBMIsBackupPolicyPlanRemoteToMap(backupPolicyPlanItem.Remote) + if err != nil { + return remoteMap + } + backupPolicyPlanMap["remote"] = []map[string]interface{}{remoteMap} + } if backupPolicyPlanItem.ResourceType != nil { backupPolicyPlanMap["resource_type"] = backupPolicyPlanItem.ResourceType } - return backupPolicyPlanMap } @@ -350,7 +457,7 @@ func dataSourceBackupPolicyJobBackupPolicyPlanDeletedToMap(deletedItem vpcv1.Bac return deletedMap } -func dataSourceBackupPolicyJobFlattenSourceVolume(result vpcv1.BackupPolicyJobSource) (finalList []map[string]interface{}) { +func dataSourceBackupPolicyJobFlattenSourceVolume(result vpcv1.BackupPolicyJobSourceVolumeReference) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceBackupPolicyJobSourceVolumeToMap(result) finalList = append(finalList, finalMap) @@ -358,7 +465,7 @@ func dataSourceBackupPolicyJobFlattenSourceVolume(result vpcv1.BackupPolicyJobSo return finalList } -func dataSourceBackupPolicyJobSourceVolumeToMap(sourceVolumeItem vpcv1.BackupPolicyJobSource) (sourceVolumeMap map[string]interface{}) { +func dataSourceBackupPolicyJobSourceVolumeToMap(sourceVolumeItem vpcv1.BackupPolicyJobSourceVolumeReference) (sourceVolumeMap map[string]interface{}) { sourceVolumeMap = map[string]interface{}{} if sourceVolumeItem.CRN != nil { @@ -379,10 +486,57 @@ func dataSourceBackupPolicyJobSourceVolumeToMap(sourceVolumeItem vpcv1.BackupPol if sourceVolumeItem.Name != nil { sourceVolumeMap["name"] = sourceVolumeItem.Name } - + if sourceVolumeItem.ResourceType != nil { + sourceVolumeMap["resource_type"] = sourceVolumeItem.ResourceType + } + if sourceVolumeItem.Remote != nil { + remoteMap, err := resourceIBMIsSnapshotConsistencyGroupVolumeRemoteToMap(sourceVolumeItem.Remote) + if err != nil { + return remoteMap + } + sourceVolumeMap["remote"] = []map[string]interface{}{remoteMap} + } return sourceVolumeMap } +func resourceIBMIsSnapshotConsistencyGroupVolumeRemoteToMap(model *vpcv1.VolumeRemote) (map[string]interface{}, error) { + regionMap := make(map[string]interface{}) + if model.Region != nil { + regionMap, err := resourceIBMIsVolumeConsistencyGroupRegionReferenceToMap(model.Region) + if err != nil { + return regionMap, err + } + return regionMap, nil + } + return regionMap, nil +} + +func resourceIBMIsVolumeConsistencyGroupRegionReferenceToMap(model *vpcv1.RegionReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["href"] = model.Href + modelMap["name"] = model.Name + return modelMap, nil +} + +func resourceIBMIsBackupPolicyPlanRemoteToMap(model *vpcv1.BackupPolicyPlanRemote) (map[string]interface{}, error) { + regionMap := make(map[string]interface{}) + if model.Region != nil { + regionMap, err := resourceIBMIsBackupPolicyPlanRemoteRegionReferenceToMap(model.Region) + if err != nil { + return regionMap, err + } + return regionMap, nil + } + return regionMap, nil +} + +func resourceIBMIsBackupPolicyPlanRemoteRegionReferenceToMap(model *vpcv1.RegionReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["href"] = model.Href + modelMap["name"] = model.Name + return modelMap, nil +} + func dataSourceBackupPolicyJobSourceVolumeDeletedToMap(deletedItem vpcv1.VolumeReferenceDeleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} @@ -392,6 +546,47 @@ func dataSourceBackupPolicyJobSourceVolumeDeletedToMap(deletedItem vpcv1.VolumeR return deletedMap } +func dataSourceBackupPolicyJobFlattenSourceInstance(result vpcv1.BackupPolicyJobSourceInstanceReference) (finalList []map[string]interface{}) { + finalList = []map[string]interface{}{} + finalMap := dataSourceBackupPolicyJobSourceInstanceToMap(result) + finalList = append(finalList, finalMap) + + return finalList +} + +func dataSourceBackupPolicyJobSourceInstanceToMap(sourceVolumeItem vpcv1.BackupPolicyJobSourceInstanceReference) (sourceVolumeMap map[string]interface{}) { + sourceVolumeMap = map[string]interface{}{} + + if sourceVolumeItem.CRN != nil { + sourceVolumeMap["crn"] = sourceVolumeItem.CRN + } + if sourceVolumeItem.Deleted != nil { + deletedList := []map[string]interface{}{} + deletedMap := dataSourceBackupPolicyJobSourceInstanceDeletedToMap(*sourceVolumeItem.Deleted) + deletedList = append(deletedList, deletedMap) + sourceVolumeMap["deleted"] = deletedList + } + if sourceVolumeItem.Href != nil { + sourceVolumeMap["href"] = sourceVolumeItem.Href + } + if sourceVolumeItem.ID != nil { + sourceVolumeMap["id"] = sourceVolumeItem.ID + } + if sourceVolumeItem.Name != nil { + sourceVolumeMap["name"] = sourceVolumeItem.Name + } + return sourceVolumeMap +} + +func dataSourceBackupPolicyJobSourceInstanceDeletedToMap(deletedItem vpcv1.InstanceReferenceDeleted) (deletedMap map[string]interface{}) { + deletedMap = map[string]interface{}{} + + if deletedItem.MoreInfo != nil { + deletedMap["more_info"] = deletedItem.MoreInfo + } + + return deletedMap +} func dataSourceBackupPolicyJobFlattenStatusReasons(result []vpcv1.BackupPolicyJobStatusReason) (statusReasons []map[string]interface{}) { for _, statusReasonsItem := range result { diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go b/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go index c592018f46..0377373cd2 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "log" + "reflect" "strings" "time" @@ -109,6 +110,25 @@ func DataSourceIBMIsBackupPolicyJobs() *schema.Resource { Computed: true, Description: "The unique user-defined name for this backup policy plan.", }, + "remote": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates that the resource associated with this reference is remote and therefore may not be directly retrievable.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this region.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The globally unique name for this region.", + }, + }, + }, + }, "resource_type": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -148,6 +168,73 @@ func DataSourceIBMIsBackupPolicyJobs() *schema.Resource { Description: "The resource type.", }, "source_volume": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The source volume this backup was created from (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this volume.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this volume.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this volume.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique user-defined name for this volume.", + }, + "remote": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates that the resource associated with this reference is remote and therefore may not be directly retrievable.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this region.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The globally unique name for this region.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "source_instance": &schema.Schema{ Type: schema.TypeList, Computed: true, Description: "The source volume this backup was created from (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).", @@ -408,11 +495,24 @@ func dataSourceBackupPolicyJobCollectionJobsToMap(jobsItem vpcv1.BackupPolicyJob log.Println("jobsItem.Source") log.Println(jobsItem.Source) if jobsItem.Source != nil { - sourceVolumeList := []map[string]interface{}{} - jobSource := jobsItem.Source.(*vpcv1.BackupPolicyJobSource) - sourceVolumeMap := dataSourceBackupPolicyJobCollectionJobsSourceVolumeToMap(*jobSource) - sourceVolumeList = append(sourceVolumeList, sourceVolumeMap) - jobsMap["source_volume"] = sourceVolumeList + switch reflect.TypeOf(jobsItem.Source).String() { + case "*vpcv1.BackupPolicyJobSourceVolumeReference": + { + jobSource := jobsItem.Source.(*vpcv1.BackupPolicyJobSourceVolumeReference) + sourceVolumeList := []map[string]interface{}{} + sourceVolumeMap := dataSourceBackupPolicyJobCollectionJobsSourceVolumeToMap(*jobSource) + sourceVolumeList = append(sourceVolumeList, sourceVolumeMap) + jobsMap["source_volume"] = sourceVolumeList + } + case "*vpcv1.BackupPolicyJobSourceInstanceReference": + { + jobSource := jobsItem.Source.(*vpcv1.BackupPolicyJobSourceInstanceReference) + sourceVolumeList := []map[string]interface{}{} + sourceVolumeMap := dataSourceBackupPolicyJobCollectionJobsSourceInstanceToMap(*jobSource) + sourceVolumeList = append(sourceVolumeList, sourceVolumeMap) + jobsMap["source_instance"] = sourceVolumeList + } + } } if jobsItem.Status != nil { jobsMap["status"] = jobsItem.Status @@ -457,6 +557,13 @@ func dataSourceBackupPolicyJobCollectionJobsBackupPolicyPlanToMap(backupPolicyPl if backupPolicyPlanItem.Name != nil { backupPolicyPlanMap["name"] = backupPolicyPlanItem.Name } + if backupPolicyPlanItem.Remote != nil { + remoteMap, err := resourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanRemoteToMap(backupPolicyPlanItem.Remote) + if err != nil { + return remoteMap + } + backupPolicyPlanMap["remote"] = []map[string]interface{}{remoteMap} + } if backupPolicyPlanItem.ResourceType != nil { backupPolicyPlanMap["resource_type"] = backupPolicyPlanItem.ResourceType } @@ -474,7 +581,7 @@ func dataSourceBackupPolicyJobCollectionBackupPolicyPlanDeletedToMap(deletedItem return deletedMap } -func dataSourceBackupPolicyJobCollectionJobsSourceVolumeToMap(sourceVolumeItem vpcv1.BackupPolicyJobSource) (sourceVolumeMap map[string]interface{}) { +func dataSourceBackupPolicyJobCollectionJobsSourceVolumeToMap(sourceVolumeItem vpcv1.BackupPolicyJobSourceVolumeReference) (sourceVolumeMap map[string]interface{}) { sourceVolumeMap = map[string]interface{}{} if sourceVolumeItem.CRN != nil { @@ -495,7 +602,40 @@ func dataSourceBackupPolicyJobCollectionJobsSourceVolumeToMap(sourceVolumeItem v if sourceVolumeItem.Name != nil { sourceVolumeMap["name"] = sourceVolumeItem.Name } + if sourceVolumeItem.Remote != nil { + remoteMap, err := resourceIBMIsSnapshotConsistencyGroupVolumeRemoteToMap(sourceVolumeItem.Remote) + if err != nil { + return remoteMap + } + sourceVolumeMap["remote"] = []map[string]interface{}{remoteMap} + } + if sourceVolumeItem.ResourceType != nil { + sourceVolumeMap["resource_type"] = sourceVolumeItem.ResourceType + } + return sourceVolumeMap +} + +func dataSourceBackupPolicyJobCollectionJobsSourceInstanceToMap(sourceVolumeItem vpcv1.BackupPolicyJobSourceInstanceReference) (sourceVolumeMap map[string]interface{}) { + sourceVolumeMap = map[string]interface{}{} + if sourceVolumeItem.CRN != nil { + sourceVolumeMap["crn"] = sourceVolumeItem.CRN + } + if sourceVolumeItem.Deleted != nil { + deletedList := []map[string]interface{}{} + deletedMap := dataSourceBackupPolicyJobCollectionSourceInstanceDeletedToMap(*sourceVolumeItem.Deleted) + deletedList = append(deletedList, deletedMap) + sourceVolumeMap["deleted"] = deletedList + } + if sourceVolumeItem.Href != nil { + sourceVolumeMap["href"] = sourceVolumeItem.Href + } + if sourceVolumeItem.ID != nil { + sourceVolumeMap["id"] = sourceVolumeItem.ID + } + if sourceVolumeItem.Name != nil { + sourceVolumeMap["name"] = sourceVolumeItem.Name + } return sourceVolumeMap } @@ -508,6 +648,15 @@ func dataSourceBackupPolicyJobCollectionSourceVolumeDeletedToMap(deletedItem vpc return deletedMap } +func dataSourceBackupPolicyJobCollectionSourceInstanceDeletedToMap(deletedItem vpcv1.InstanceReferenceDeleted) (deletedMap map[string]interface{}) { + deletedMap = map[string]interface{}{} + + if deletedItem.MoreInfo != nil { + deletedMap["more_info"] = deletedItem.MoreInfo + } + + return deletedMap +} func dataSourceBackupPolicyJobCollectionJobsStatusReasonsToMap(statusReasonsItem vpcv1.BackupPolicyJobStatusReason) (statusReasonsMap map[string]interface{}) { statusReasonsMap = map[string]interface{}{} diff --git a/ibm/service/vpc/data_source_ibm_is_snapshot.go b/ibm/service/vpc/data_source_ibm_is_snapshot.go index 9a174c4c02..26c94fb09e 100644 --- a/ibm/service/vpc/data_source_ibm_is_snapshot.go +++ b/ibm/service/vpc/data_source_ibm_is_snapshot.go @@ -182,6 +182,54 @@ func DataSourceSnapshot() *schema.Resource { }, }, }, + isSnapshotConsistencyGroup: { + Type: schema.TypeList, + Computed: true, + Description: "The snapshot consistency group which created this snapshot.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN of this snapshot consistency group.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for the snapshot consistency group.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for the snapshot consistency group.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for the snapshot consistency group. The name is unique across all snapshot consistency groups in the region.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, isSnapshotSourceImage: { Type: schema.TypeString, Computed: true, @@ -406,6 +454,24 @@ func snapshotGetByNameOrID(d *schema.ResourceData, meta interface{}, name, id st } d.Set(isSnapshotSourceSnapshot, sourceSnapshotList) + // snapshot consistency group + snapshotConsistencyGroupList := []map[string]interface{}{} + if snapshot.SnapshotConsistencyGroup != nil { + snapshotConsistencyGroup := map[string]interface{}{} + snapshotConsistencyGroup["href"] = snapshot.SnapshotConsistencyGroup.Href + snapshotConsistencyGroup["crn"] = snapshot.SnapshotConsistencyGroup.CRN + if snapshot.SnapshotConsistencyGroup.Deleted != nil { + snapshotConsistencyGroupDeletedMap := map[string]interface{}{} + snapshotConsistencyGroupDeletedMap["more_info"] = snapshot.SnapshotConsistencyGroup.Deleted.MoreInfo + snapshotConsistencyGroup["deleted"] = []map[string]interface{}{snapshotConsistencyGroupDeletedMap} + } + snapshotConsistencyGroup["id"] = snapshot.SnapshotConsistencyGroup.ID + snapshotConsistencyGroup["name"] = snapshot.SnapshotConsistencyGroup.Name + snapshotConsistencyGroup["resource_type"] = snapshot.SnapshotConsistencyGroup.ResourceType + snapshotConsistencyGroupList = append(snapshotConsistencyGroupList, snapshotConsistencyGroup) + } + d.Set(isSnapshotConsistencyGroup, snapshotConsistencyGroupList) + // snapshot copies snapshotCopies := []map[string]interface{}{} if snapshot.Copies != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go new file mode 100644 index 0000000000..74a7efa3c0 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go @@ -0,0 +1,589 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func DataSourceIBMIsSnapshotConsistencyGroup() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIBMIsSnapshotConsistencyGroupRead, + + Schema: map[string]*schema.Schema{ + "identifier": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ExactlyOneOf: []string{"name", "identifier"}, + ValidateFunc: validate.InvokeDataSourceValidator("ibm_is_snapshot_consistency_group", "identifier"), + Description: "The snapshot consistency group identifier.", + }, + "name": { + Type: schema.TypeString, + Optional: true, + ExactlyOneOf: []string{"name", "identifier"}, + ValidateFunc: validate.InvokeDataSourceValidator("ibm_is_snapshot_consistency_group", isSnapshotName), + Description: "The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the region.", + }, + "backup_policy_plan": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, the backup policy plan which created this snapshot consistency group.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this backup policy plan.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this backup policy plan.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this backup policy plan. The name is unique across all plans in the backup policy.", + }, + "remote": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource is remote to this region,and identifies the native region.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this region.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The globally unique name for this region.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date and time that this snapshot consistency group was created.", + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN of this snapshot consistency group.", + }, + "delete_snapshots_on_delete": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this snapshot consistency group.", + }, + "lifecycle_state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The lifecycle state of this snapshot consistency group.", + }, + "resource_group": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The resource group for this snapshot consistency group.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this resource group.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this resource group.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this resource group.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "service_tags": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags)[`is.instance:` prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-faqs) associated with this snapshot consistency group.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "snapshots": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The member snapshots that are data-consistent with respect to captured time. (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN of this snapshot.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this snapshot.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this snapshot.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this snapshot. The name is unique across all snapshots in the region.", + }, + "remote": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource is remote to this region,and identifies the native region.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this region.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The globally unique name for this region.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "tags": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString, ValidateFunc: validate.InvokeValidator("ibm_is_snapshot_consistency_group", "tags")}, + Set: flex.ResourceIBMVPCHash, + Description: "Snapshot Consistency Group tags list", + }, + "access_tags": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString, ValidateFunc: validate.InvokeValidator("ibm_is_snapshot_consistency_group", "access_tags")}, + Set: flex.ResourceIBMVPCHash, + Description: "List of access management tags", + }, + }, + } +} + +func DataSourceIBMISSnapshotConsistencyGroupValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "identifier", + ValidateFunctionIdentifier: validate.ValidateNoZeroValues, + Type: validate.TypeString}) + + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: isSnapshotName, + ValidateFunctionIdentifier: validate.ValidateNoZeroValues, + Type: validate.TypeString}) + + ibmISSnapshotDataSourceValidator := validate.ResourceValidator{ResourceName: "ibm_is_snapshot_consistency_group", Schema: validateSchema} + return &ibmISSnapshotDataSourceValidator +} + +func dataSourceIBMIsSnapshotConsistencyGroupRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := meta.(conns.ClientSession).VpcV1API() + if err != nil { + return diag.FromErr(err) + } + name := d.Get("name").(string) + id := d.Get("identifier").(string) + + if name != "" { + start := "" + allrecs := []vpcv1.SnapshotConsistencyGroup{} + for { + listSnapshotConsistencyGroupsOptions := &vpcv1.ListSnapshotConsistencyGroupsOptions{} + if start != "" { + listSnapshotConsistencyGroupsOptions.Start = &start + } + if rgFilterOk, ok := d.GetOk("resource_group"); ok { + rgFilter := rgFilterOk.(string) + listSnapshotConsistencyGroupsOptions.ResourceGroupID = &rgFilter + } + if nameFilterOk, ok := d.GetOk("name"); ok { + nameFilter := nameFilterOk.(string) + listSnapshotConsistencyGroupsOptions.Name = &nameFilter + } + if backupPolicyPlanIdFilterOk, ok := d.GetOk("backup_policy_plan"); ok { + backupPolicyPlanIdFilter := backupPolicyPlanIdFilterOk.(string) + listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID = &backupPolicyPlanIdFilter + } + + snapshotConsistencyGroup, response, err := vpcClient.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error fetching snapshots %s\n%s", err, response)) + } + start = flex.GetNext(snapshotConsistencyGroup.Next) + allrecs = append(allrecs, snapshotConsistencyGroup.SnapshotConsistencyGroups...) + if start == "" { + break + } + } + for _, snapshotConsistencyGroup := range allrecs { + if *snapshotConsistencyGroup.Name == name || *snapshotConsistencyGroup.ID == id { + + d.SetId(fmt.Sprintf("%s", *snapshotConsistencyGroup.ID)) + + backupPolicyPlan := []map[string]interface{}{} + if snapshotConsistencyGroup.BackupPolicyPlan != nil { + modelMap, err := dataSourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceToMap(snapshotConsistencyGroup.BackupPolicyPlan) + if err != nil { + return diag.FromErr(err) + } + backupPolicyPlan = append(backupPolicyPlan, modelMap) + } + if err = d.Set("backup_policy_plan", backupPolicyPlan); err != nil { + return diag.FromErr(fmt.Errorf("Error setting backup_policy_plan %s", err)) + } + + if err = d.Set("created_at", flex.DateTimeToString(snapshotConsistencyGroup.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + + if err = d.Set("crn", snapshotConsistencyGroup.CRN); err != nil { + return diag.FromErr(fmt.Errorf("Error setting crn: %s", err)) + } + + if err = d.Set("delete_snapshots_on_delete", snapshotConsistencyGroup.DeleteSnapshotsOnDelete); err != nil { + return diag.FromErr(fmt.Errorf("Error setting delete_snapshots_on_delete: %s", err)) + } + + if err = d.Set("href", snapshotConsistencyGroup.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + + if err = d.Set("lifecycle_state", snapshotConsistencyGroup.LifecycleState); err != nil { + return diag.FromErr(fmt.Errorf("Error setting lifecycle_state: %s", err)) + } + + if err = d.Set("name", snapshotConsistencyGroup.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + + resourceGroup := []map[string]interface{}{} + if snapshotConsistencyGroup.ResourceGroup != nil { + modelMap, err := dataSourceIBMIsSnapshotConsistencyGroupResourceGroupReferenceToMap(snapshotConsistencyGroup.ResourceGroup) + if err != nil { + return diag.FromErr(err) + } + resourceGroup = append(resourceGroup, modelMap) + } + if err = d.Set("resource_group", resourceGroup); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_group %s", err)) + } + + if err = d.Set("resource_type", snapshotConsistencyGroup.ResourceType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_type: %s", err)) + } + + snapshots := []map[string]interface{}{} + if snapshotConsistencyGroup.Snapshots != nil { + for _, modelItem := range snapshotConsistencyGroup.Snapshots { + modelMap, err := dataSourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + snapshots = append(snapshots, modelMap) + } + } + if err = d.Set("snapshots", snapshots); err != nil { + return diag.FromErr(fmt.Errorf("Error setting snapshots %s", err)) + } + tags, err := flex.GetGlobalTagsUsingCRN(meta, *snapshotConsistencyGroup.CRN, "", isUserTagType) + if err != nil { + log.Printf( + "Error on get of resource vpc snapshot consistency group (%s) tags: %s", d.Id(), err) + } + d.Set("tags", tags) + + accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *snapshotConsistencyGroup.CRN, "", isAccessTagType) + if err != nil { + log.Printf( + "Error on get of resource VPC snapshot consistency group (%s) access tags: %s", d.Id(), err) + } + d.Set("access_tags", accesstags) + return nil + } + } + return diag.FromErr(fmt.Errorf("[ERROR] No snapshot consistency group found with name %s", name)) + } else { + getSnapshotConsistencyGroupOptions := &vpcv1.GetSnapshotConsistencyGroupOptions{} + + getSnapshotConsistencyGroupOptions.SetID(id) + + snapshotConsistencyGroup, response, err := vpcClient.GetSnapshotConsistencyGroupWithContext(context, getSnapshotConsistencyGroupOptions) + if err != nil { + log.Printf("[DEBUG] GetSnapshotConsistencyGroupWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetSnapshotConsistencyGroupWithContext failed %s\n%s", err, response)) + } + + d.SetId(fmt.Sprintf("%s", *getSnapshotConsistencyGroupOptions.ID)) + + backupPolicyPlan := []map[string]interface{}{} + if snapshotConsistencyGroup.BackupPolicyPlan != nil { + modelMap, err := dataSourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceToMap(snapshotConsistencyGroup.BackupPolicyPlan) + if err != nil { + return diag.FromErr(err) + } + backupPolicyPlan = append(backupPolicyPlan, modelMap) + } + if err = d.Set("backup_policy_plan", backupPolicyPlan); err != nil { + return diag.FromErr(fmt.Errorf("Error setting backup_policy_plan %s", err)) + } + + if err = d.Set("created_at", flex.DateTimeToString(snapshotConsistencyGroup.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + + if err = d.Set("crn", snapshotConsistencyGroup.CRN); err != nil { + return diag.FromErr(fmt.Errorf("Error setting crn: %s", err)) + } + + if err = d.Set("delete_snapshots_on_delete", snapshotConsistencyGroup.DeleteSnapshotsOnDelete); err != nil { + return diag.FromErr(fmt.Errorf("Error setting delete_snapshots_on_delete: %s", err)) + } + + if err = d.Set("href", snapshotConsistencyGroup.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + + if err = d.Set("lifecycle_state", snapshotConsistencyGroup.LifecycleState); err != nil { + return diag.FromErr(fmt.Errorf("Error setting lifecycle_state: %s", err)) + } + + if err = d.Set("name", snapshotConsistencyGroup.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + + resourceGroup := []map[string]interface{}{} + if snapshotConsistencyGroup.ResourceGroup != nil { + modelMap, err := dataSourceIBMIsSnapshotConsistencyGroupResourceGroupReferenceToMap(snapshotConsistencyGroup.ResourceGroup) + if err != nil { + return diag.FromErr(err) + } + resourceGroup = append(resourceGroup, modelMap) + } + if err = d.Set("resource_group", resourceGroup); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_group %s", err)) + } + + if err = d.Set("resource_type", snapshotConsistencyGroup.ResourceType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_type: %s", err)) + } + + snapshots := []map[string]interface{}{} + if snapshotConsistencyGroup.Snapshots != nil { + for _, modelItem := range snapshotConsistencyGroup.Snapshots { + modelMap, err := dataSourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(&modelItem) + if err != nil { + return diag.FromErr(err) + } + snapshots = append(snapshots, modelMap) + } + } + if err = d.Set("snapshots", snapshots); err != nil { + return diag.FromErr(fmt.Errorf("Error setting snapshots %s", err)) + } + tags, err := flex.GetGlobalTagsUsingCRN(meta, *snapshotConsistencyGroup.CRN, "", isUserTagType) + if err != nil { + log.Printf( + "Error on get of resource vpc snapshot consistency group (%s) tags: %s", d.Id(), err) + } + d.Set("tags", tags) + + accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *snapshotConsistencyGroup.CRN, "", isAccessTagType) + if err != nil { + log.Printf( + "Error on get of resource VPC snapshot consistency group (%s) access tags: %s", d.Id(), err) + } + d.Set("access_tags", accesstags) + return nil + } + +} + +func dataSourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceToMap(model *vpcv1.BackupPolicyPlanReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + if model.Remote != nil { + remoteMap, err := dataSourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanRemoteToMap(model.Remote) + if err != nil { + return modelMap, err + } + modelMap["remote"] = []map[string]interface{}{remoteMap} + } + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceDeletedToMap(model *vpcv1.BackupPolicyPlanReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func dataSourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanRemoteToMap(model *vpcv1.BackupPolicyPlanRemote) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Region != nil { + regionMap, err := dataSourceIBMIsSnapshotConsistencyGroupRegionReferenceToMap(model.Region) + if err != nil { + return modelMap, err + } + return regionMap, nil + } + return modelMap, nil +} + +func dataSourceIBMIsSnapshotConsistencyGroupRegionReferenceToMap(model *vpcv1.RegionReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["href"] = model.Href + modelMap["name"] = model.Name + return modelMap, nil +} + +func dataSourceIBMIsSnapshotConsistencyGroupResourceGroupReferenceToMap(model *vpcv1.ResourceGroupReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + return modelMap, nil +} + +func dataSourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotConsistencyGroupSnapshotsItem) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := dataSourceIBMIsSnapshotConsistencyGroupSnapshotReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + if model.Remote != nil { + remoteMap, err := dataSourceIBMIsSnapshotConsistencyGroupSnapshotRemoteToMap(model.Remote) + if err != nil { + return modelMap, err + } + modelMap["remote"] = []map[string]interface{}{remoteMap} + } + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIBMIsSnapshotConsistencyGroupSnapshotReferenceDeletedToMap(model *vpcv1.SnapshotReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func dataSourceIBMIsSnapshotConsistencyGroupSnapshotRemoteToMap(model *vpcv1.SnapshotRemote) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Region != nil { + log.Println("model.Region") + log.Println(model.Region) + regionMap, err := dataSourceIBMIsSnapshotConsistencyGroupRegionReferenceToMap(model.Region) + if err != nil { + return modelMap, err + } + return regionMap, nil + + } + return modelMap, nil +} diff --git a/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group_test.go b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group_test.go new file mode 100644 index 0000000000..37a2c4c9b0 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group_test.go @@ -0,0 +1,61 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIBMIsSnapshotConsistencyGroupDataSourceBasic(t *testing.T) { + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-instance-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tf-subnet-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(` +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR +`) + sshname := fmt.Sprintf("tf-ssh-%d", acctest.RandIntRange(10, 100)) + deleteSnapshotsOnDelete := "true" + scgname := fmt.Sprintf("tf-snap-cons-grp-name-%d", acctest.RandIntRange(10, 100)) + snapname := fmt.Sprintf("tf-snap-name-%d", acctest.RandIntRange(10, 100)) + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsSnapshotConsistencyGroupDataSourceConfigBasic(vpcname, subnetname, sshname, publicKey, name, scgname, snapname, deleteSnapshotsOnDelete), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "delete_snapshots_on_delete"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "lifecycle_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "resource_group.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshots.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshots.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshots.0.name"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshots.0.crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshots.0.href"), + ), + }, + }, + }) +} + +func testAccCheckIBMIsSnapshotConsistencyGroupDataSourceConfigBasic(vpcname, subnetname, sshname, publicKey, name, snapname, scgname, deleteSnapshotsOnDelete string) string { + return testAccCheckIBMIsSnapshotConsistencyGroupConfig(vpcname, subnetname, sshname, publicKey, name, scgname, snapname, deleteSnapshotsOnDelete) + fmt.Sprintf(` + data "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group" { + identifier = ibm_is_snapshot_consistency_group.is_snapshot_consistency_group.id + } +`) +} diff --git a/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_groups.go b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_groups.go new file mode 100644 index 0000000000..50a22ea1e2 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_groups.go @@ -0,0 +1,369 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func DataSourceIBMIsSnapshotConsistencyGroups() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIBMIsSnapshotConsistencyGroupsRead, + + Schema: map[string]*schema.Schema{ + "resource_group": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "Filters the collection to resources with a `resource_group.id` property matching the specified identifier.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "Filters the collection to resources with a `name` property matching the exact specified name.", + }, + "backup_policy_plan": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified identifier.", + }, + "snapshot_consistency_groups": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Collection of snapshot consistency groups.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "backup_policy_plan": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, the backup policy plan which created this snapshot consistency group.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this backup policy plan.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this backup policy plan.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this backup policy plan. The name is unique across all plans in the backup policy.", + }, + "remote": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource is remote to this region,and identifies the native region.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this region.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The globally unique name for this region.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date and time that this snapshot consistency group was created.", + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN of this snapshot consistency group.", + }, + "delete_snapshots_on_delete": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this snapshot consistency group.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this snapshot consistency group.", + }, + "lifecycle_state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The lifecycle state of this snapshot consistency group.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the region.", + }, + "resource_group": { + Type: schema.TypeString, + Computed: true, + Description: "Resource group info", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "service_tags": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags)[`is.instance:` prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-faqs) associated with this snapshot consistency group.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "snapshots": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The member snapshots that are data-consistent with respect to captured time. (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN of this snapshot.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this snapshot.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this snapshot.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this snapshot. The name is unique across all snapshots in the region.", + }, + "remote": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource is remote to this region,and identifies the native region.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this region.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The globally unique name for this region.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + + "tags": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: flex.ResourceIBMVPCHash, + Description: "User Tags for the snapshot consistency group", + }, + + "access_tags": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: flex.ResourceIBMVPCHash, + Description: "List of access tags", + }, + }, + }, + }, + }, + } +} + +func dataSourceIBMIsSnapshotConsistencyGroupsRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := meta.(conns.ClientSession).VpcV1API() + if err != nil { + return diag.FromErr(err) + } + + start := "" + allrecs := []vpcv1.SnapshotConsistencyGroup{} + for { + listSnapshotConsistencyGroupsOptions := &vpcv1.ListSnapshotConsistencyGroupsOptions{} + if start != "" { + listSnapshotConsistencyGroupsOptions.Start = &start + } + if rgFilterOk, ok := d.GetOk("resource_group"); ok { + rgFilter := rgFilterOk.(string) + listSnapshotConsistencyGroupsOptions.ResourceGroupID = &rgFilter + } + if nameFilterOk, ok := d.GetOk("name"); ok { + nameFilter := nameFilterOk.(string) + listSnapshotConsistencyGroupsOptions.Name = &nameFilter + } + if backupPolicyPlanIdFilterOk, ok := d.GetOk("backup_policy_plan"); ok { + backupPolicyPlanIdFilter := backupPolicyPlanIdFilterOk.(string) + listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID = &backupPolicyPlanIdFilter + } + + snapshotConsistencyGroup, response, err := vpcClient.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error fetching snapshots %s\n%s", err, response)) + } + start = flex.GetNext(snapshotConsistencyGroup.Next) + allrecs = append(allrecs, snapshotConsistencyGroup.SnapshotConsistencyGroups...) + if start == "" { + break + } + } + + snapshotConsistencyGroupsInfo := make([]map[string]interface{}, 0) + for _, snapshotConsistencyGroup := range allrecs { + l := map[string]interface{}{ + "id": *snapshotConsistencyGroup.ID, + "name": *snapshotConsistencyGroup.Name, + "href": *snapshotConsistencyGroup.Href, + "crn": *snapshotConsistencyGroup.CRN, + "delete_snapshots_on_delete": *snapshotConsistencyGroup.DeleteSnapshotsOnDelete, + "lifecycle_state": *snapshotConsistencyGroup.LifecycleState, + "resource_type": *snapshotConsistencyGroup.ResourceType, + "created_at": (*snapshotConsistencyGroup.CreatedAt).String(), + } + + //backup policy plan + backupPolicyPlanList := []map[string]interface{}{} + if snapshotConsistencyGroup.BackupPolicyPlan != nil { + backupPolicyPlan := map[string]interface{}{} + if snapshotConsistencyGroup.BackupPolicyPlan.Deleted != nil { + snapshotConsistencyGroupBackupPolicyPlanDeletedMap := map[string]interface{}{} + snapshotConsistencyGroupBackupPolicyPlanDeletedMap["more_info"] = snapshotConsistencyGroup.BackupPolicyPlan.Deleted.MoreInfo + backupPolicyPlan["deleted"] = []map[string]interface{}{snapshotConsistencyGroupBackupPolicyPlanDeletedMap} + } + backupPolicyPlan["href"] = snapshotConsistencyGroup.BackupPolicyPlan.Href + backupPolicyPlan["id"] = snapshotConsistencyGroup.BackupPolicyPlan.ID + backupPolicyPlan["name"] = snapshotConsistencyGroup.BackupPolicyPlan.Name + backupPolicyPlan["resource_type"] = snapshotConsistencyGroup.BackupPolicyPlan.ResourceType + backupPolicyPlanList = append(backupPolicyPlanList, backupPolicyPlan) + } + l[isSnapshotBackupPolicyPlan] = backupPolicyPlanList + + // source snapshot + if !core.IsNil(snapshotConsistencyGroup.Snapshots) { + snapshots := []map[string]interface{}{} + for _, snapshotsItem := range snapshotConsistencyGroup.Snapshots { + snapshotsItemMap, err := resourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(&snapshotsItem) + if err != nil { + return diag.FromErr(err) + } + snapshots = append(snapshots, snapshotsItemMap) + } + l["snapshots"] = snapshots + } else { + l["snapshots"] = []map[string]interface{}{} + } + + if snapshotConsistencyGroup.ResourceGroup != nil && snapshotConsistencyGroup.ResourceGroup.ID != nil { + l["resource_group"] = *snapshotConsistencyGroup.ResourceGroup.ID + } + + if snapshotConsistencyGroup.ServiceTags != nil { + l["service_tags"] = snapshotConsistencyGroup.ServiceTags + } + + tags, err := flex.GetGlobalTagsUsingCRN(meta, *snapshotConsistencyGroup.CRN, "", isUserTagType) + if err != nil { + log.Printf( + "Error on get of resource vpc snapshot consistency group (%s) tags: %s", d.Id(), err) + } + l["tags"] = tags + + accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *snapshotConsistencyGroup.CRN, "", isAccessTagType) + if err != nil { + log.Printf( + "[ERROR] Error on get of resource snapshot (%s) access tags: %s", d.Id(), err) + } + l["access_tags"] = accesstags + + snapshotConsistencyGroupsInfo = append(snapshotConsistencyGroupsInfo, l) + } + + d.SetId(dataSourceIBMIsSnapshotConsistencyGroupsID(d)) + if err = d.Set("snapshot_consistency_groups", snapshotConsistencyGroupsInfo); err != nil { + return diag.FromErr(fmt.Errorf("Error setting snapshot_consistency_groups %s", err)) + } + return nil +} + +// dataSourceIBMIsSnapshotConsistencyGroupsID returns a reasonable ID for the list. +func dataSourceIBMIsSnapshotConsistencyGroupsID(d *schema.ResourceData) string { + return time.Now().UTC().String() +} diff --git a/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_groups_test.go b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_groups_test.go new file mode 100644 index 0000000000..ee04481c60 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_groups_test.go @@ -0,0 +1,61 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIBMIsSnapshotConsistencyGroupsDataSourceBasic(t *testing.T) { + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-instance-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tf-subnet-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(` +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR +`) + sshname := fmt.Sprintf("tf-ssh-%d", acctest.RandIntRange(10, 100)) + deleteSnapshotsOnDelete := "true" + scgname := fmt.Sprintf("tf-snap-cons-grp-name-%d", acctest.RandIntRange(10, 100)) + snapname := fmt.Sprintf("tf-snap-name-%d", acctest.RandIntRange(10, 100)) + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsSnapshotConsistencyGroupsDataSourceConfigBasic(vpcname, subnetname, sshname, publicKey, name, scgname, snapname, deleteSnapshotsOnDelete), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.0.created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.0.crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.0.delete_snapshots_on_delete"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.0.href"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.0.lifecycle_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.0.name"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.0.resource_group"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.0.resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.0.snapshots.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.0.snapshots.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.0.snapshots.0.name"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.0.snapshots.0.crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_groups.is_snapshot_consistency_groups", "snapshot_consistency_groups.0.snapshots.0.href"), + ), + }, + }, + }) +} + +func testAccCheckIBMIsSnapshotConsistencyGroupsDataSourceConfigBasic(vpcname, subnetname, sshname, publicKey, name, snapname, scgname, deleteSnapshotsOnDelete string) string { + return testAccCheckIBMIsSnapshotConsistencyGroupConfig(vpcname, subnetname, sshname, publicKey, name, scgname, snapname, deleteSnapshotsOnDelete) + fmt.Sprintf(` + data "ibm_is_snapshot_consistency_groups" "is_snapshot_consistency_groups" { + } +`) +} diff --git a/ibm/service/vpc/data_source_ibm_is_snapshots.go b/ibm/service/vpc/data_source_ibm_is_snapshots.go index 48f0118668..d110df2798 100644 --- a/ibm/service/vpc/data_source_ibm_is_snapshots.go +++ b/ibm/service/vpc/data_source_ibm_is_snapshots.go @@ -23,6 +23,9 @@ const ( isSnapshotSourceSnapshotId = "source_snapshot_id" isSnapshotSourceSnapshotRemoteRegionName = "source_snapshot_remote_region_name" isSnapshotSourceVolumeRemoteRegionName = "snapshot_source_volume_remote_region_name" + isSnapshotConsistencyGroupId = "snapshot_consistency_group_id" + isSnapshotConsistencyGroupCrn = "snapshot_consistency_group_crn" + isSnapshotConsistencyGroup = "snapshot_consistency_group" ) func DataSourceSnapshots() *schema.Resource { @@ -109,6 +112,18 @@ func DataSourceSnapshots() *schema.Resource { Optional: true, }, + isSnapshotConsistencyGroupId: { + Type: schema.TypeString, + Description: "Filters the collection to resources with a source snapshot with the exact snapshot consistency group id.", + Optional: true, + }, + + isSnapshotConsistencyGroupCrn: { + Type: schema.TypeString, + Description: "Filters the collection to resources with a source snapshot with the exact snapshot consistency group crn.", + Optional: true, + }, + isSnapshots: { Type: schema.TypeList, Description: "List of snapshots", @@ -188,6 +203,55 @@ func DataSourceSnapshots() *schema.Resource { }, }, + isSnapshotConsistencyGroup: { + Type: schema.TypeList, + Computed: true, + Description: "The snapshot consistency group which created this snapshot.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN of this snapshot consistency group.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for the snapshot consistency group.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for the snapshot consistency group.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for the snapshot consistency group. The name is unique across all snapshot consistency groups in the region.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + isSnapshotName: { Type: schema.TypeString, Computed: true, @@ -489,7 +553,14 @@ func getSnapshots(d *schema.ResourceData, meta interface{}) error { sourceVolumeRemoteRegionNameFilter := sourceVolumeRemoteRegionName.(string) listSnapshotOptions.SourceVolumeRemoteRegionName = &sourceVolumeRemoteRegionNameFilter } - + if snapshotConsistencyGroupId, ok := d.GetOk(isSnapshotConsistencyGroupId); ok { + snapshotConsistencyGroupIdFilter := snapshotConsistencyGroupId.(string) + listSnapshotOptions.SnapshotConsistencyGroupID = &snapshotConsistencyGroupIdFilter + } + if snapshotConsistencyGroupCrn, ok := d.GetOk(isSnapshotConsistencyGroupCrn); ok { + snapshotConsistencyGroupCrnFilter := snapshotConsistencyGroupCrn.(string) + listSnapshotOptions.SnapshotConsistencyGroupCRN = &snapshotConsistencyGroupCrnFilter + } snapshots, response, err := sess.ListSnapshots(listSnapshotOptions) if err != nil { return fmt.Errorf("[ERROR] Error fetching snapshots %s\n%s", err, response) @@ -555,6 +626,24 @@ func getSnapshots(d *schema.ResourceData, meta interface{}) error { } l[isSnapshotCopies] = snapshotCopies + // snapshot consistency group + snapshotConsistencyGroupList := []map[string]interface{}{} + if snapshot.SnapshotConsistencyGroup != nil { + snapshotConsistencyGroup := map[string]interface{}{} + snapshotConsistencyGroup["href"] = snapshot.SnapshotConsistencyGroup.Href + snapshotConsistencyGroup["crn"] = snapshot.SnapshotConsistencyGroup.CRN + if snapshot.SnapshotConsistencyGroup.Deleted != nil { + snapshotConsistencyGroupDeletedMap := map[string]interface{}{} + snapshotConsistencyGroupDeletedMap["more_info"] = snapshot.SnapshotConsistencyGroup.Deleted.MoreInfo + snapshotConsistencyGroup["deleted"] = []map[string]interface{}{snapshotConsistencyGroupDeletedMap} + } + snapshotConsistencyGroup["id"] = snapshot.SnapshotConsistencyGroup.ID + snapshotConsistencyGroup["name"] = snapshot.SnapshotConsistencyGroup.Name + snapshotConsistencyGroup["resource_type"] = snapshot.SnapshotConsistencyGroup.ResourceType + snapshotConsistencyGroupList = append(snapshotConsistencyGroupList, snapshotConsistencyGroup) + } + l[isSnapshotConsistencyGroup] = snapshotConsistencyGroupList + if snapshot.UserTags != nil { l[isSnapshotUserTags] = snapshot.UserTags } diff --git a/ibm/service/vpc/resource_ibm_is_backup_policy.go b/ibm/service/vpc/resource_ibm_is_backup_policy.go index 2f9f94e9a6..30aaa3acd1 100644 --- a/ibm/service/vpc/resource_ibm_is_backup_policy.go +++ b/ibm/service/vpc/resource_ibm_is_backup_policy.go @@ -40,8 +40,9 @@ func ResourceIBMIsBackupPolicy() *schema.Resource { Type: schema.TypeString, Optional: true, Default: "volume", + ForceNew: true, ConflictsWith: []string{"match_resource_types"}, - ValidateFunc: validate.InvokeValidator("ibm_is_backup_policy", "match_resource_types"), + ValidateFunc: validate.InvokeValidator("ibm_is_backup_policy", "match_resource_type"), Description: "A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will be subject to the backup policy.", }, "match_user_tags": &schema.Schema{ @@ -51,6 +52,14 @@ func ResourceIBMIsBackupPolicy() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, + "included_content": &schema.Schema{ + Type: schema.TypeSet, + Optional: true, + Computed: true, + Set: schema.HashString, + Description: "The included content for backups created using this policy", + Elem: &schema.Schema{Type: schema.TypeString, ValidateFunc: validate.InvokeValidator("ibm_is_backup_policy", "included_content")}, + }, "name": &schema.Schema{ Type: schema.TypeString, Required: true, @@ -181,15 +190,22 @@ func ResourceIBMIsBackupPolicyValidator() *validate.ResourceValidator { MaxValueLength: 128, }, ) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "included_content", + ValidateFunctionIdentifier: validate.ValidateAllowedStringValue, + Type: validate.TypeString, + Required: true, + AllowedValues: "boot_volume, data_volumes", + }, + ) validateSchema = append(validateSchema, validate.ValidateSchema{ Identifier: "match_resource_type", - ValidateFunctionIdentifier: validate.ValidateRegexpLen, + ValidateFunctionIdentifier: validate.ValidateAllowedStringValue, Type: validate.TypeString, - Optional: true, - Regexp: `^[a-z][a-z0-9]*(_[a-z0-9]+)*$`, - MinValueLength: 1, - MaxValueLength: 128, + Required: true, + AllowedValues: "instance, volume", }, ) resourceValidator := validate.ResourceValidator{ResourceName: "ibm_is_backup_policy", Schema: validateSchema} @@ -203,27 +219,30 @@ func resourceIBMIsBackupPolicyCreate(context context.Context, d *schema.Resource } createBackupPolicyOptions := &vpcv1.CreateBackupPolicyOptions{} + backupPolicyPrototype := &vpcv1.BackupPolicyPrototype{} if matchResourceType, ok := d.GetOk("match_resource_type"); ok { - matchResourceTypes := matchResourceType.(string) - matchResourceTypesList := []string{matchResourceTypes} - createBackupPolicyOptions.SetMatchResourceTypes(matchResourceTypesList) - } else if _, ok := d.GetOk("match_resource_types"); ok { - createBackupPolicyOptions.SetMatchResourceTypes(flex.ExpandStringList((d.Get("match_resource_types").(*schema.Set)).List())) + backupPolicyPrototype.MatchResourceType = core.StringPtr(matchResourceType.(string)) + } else if matchResourceTypes, ok := d.GetOk("match_resource_types"); ok { + matchResourceTypeList := flex.ExpandStringList((matchResourceTypes.(*schema.Set)).List()) + backupPolicyPrototype.MatchResourceType = core.StringPtr(matchResourceTypeList[0]) + } + if _, ok := d.GetOk("included_content"); ok { + backupPolicyPrototype.IncludedContent = flex.ExpandStringList((d.Get("included_content").(*schema.Set)).List()) } if _, ok := d.GetOk("match_user_tags"); ok { - createBackupPolicyOptions.SetMatchUserTags((flex.ExpandStringList((d.Get("match_user_tags").(*schema.Set)).List()))) + backupPolicyPrototype.MatchUserTags = flex.ExpandStringList((d.Get("match_user_tags").(*schema.Set)).List()) } if _, ok := d.GetOk("name"); ok { - createBackupPolicyOptions.SetName(d.Get("name").(string)) + backupPolicyPrototype.Name = core.StringPtr(d.Get("name").(string)) } if resGroup, ok := d.GetOk("resource_group"); ok { resourceGroupStr := resGroup.(string) resourceGroup := vpcv1.ResourceGroupIdentity{ ID: &resourceGroupStr, } - createBackupPolicyOptions.SetResourceGroup(&resourceGroup) + backupPolicyPrototype.ResourceGroup = &resourceGroup } if _, ok := d.GetOk("scope"); ok { @@ -234,15 +253,16 @@ func resourceIBMIsBackupPolicyCreate(context context.Context, d *schema.Resource bkpPolicyScopePrototype.CRN = core.StringPtr(crnStr) } } - createBackupPolicyOptions.SetScope(&bkpPolicyScopePrototype) + backupPolicyPrototype.Scope = &bkpPolicyScopePrototype } - - backupPolicy, response, err := vpcClient.CreateBackupPolicyWithContext(context, createBackupPolicyOptions) + createBackupPolicyOptions.SetBackupPolicyPrototype(backupPolicyPrototype) + backupPolicyIntf, response, err := vpcClient.CreateBackupPolicyWithContext(context, createBackupPolicyOptions) if err != nil { log.Printf("[DEBUG] CreateBackupPolicyWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("[ERROR] CreateBackupPolicyWithContext failed %s\n%s", err, response)) } + backupPolicy := backupPolicyIntf.(*vpcv1.BackupPolicy) d.SetId(*backupPolicy.ID) return resourceIBMIsBackupPolicyRead(context, d, meta) @@ -258,7 +278,7 @@ func resourceIBMIsBackupPolicyRead(context context.Context, d *schema.ResourceDa getBackupPolicyOptions.SetID(d.Id()) - backupPolicy, response, err := vpcClient.GetBackupPolicyWithContext(context, getBackupPolicyOptions) + backupPolicyIntf, response, err := vpcClient.GetBackupPolicyWithContext(context, getBackupPolicyOptions) if err != nil { if response != nil && response.StatusCode == 404 { d.SetId("") @@ -267,19 +287,24 @@ func resourceIBMIsBackupPolicyRead(context context.Context, d *schema.ResourceDa log.Printf("[DEBUG] GetBackupPolicyWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("[ERROR] GetBackupPolicyWithContext failed %s\n%s", err, response)) } + backupPolicy := backupPolicyIntf.(*vpcv1.BackupPolicy) - if backupPolicy.MatchResourceTypes != nil { - if err = d.Set("match_resource_types", backupPolicy.MatchResourceTypes); err != nil { + if backupPolicy.MatchResourceType != nil { + matchResourceTypes := *backupPolicy.MatchResourceType + matchResourceTypesList := []string{matchResourceTypes} + if err = d.Set("match_resource_types", matchResourceTypesList); err != nil { return diag.FromErr(fmt.Errorf("[ERROR] Error setting match_resource_types: %s", err)) } + if err = d.Set("match_resource_type", backupPolicy.MatchResourceType); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting match_resource_type: %s", err)) + } } - if backupPolicy.MatchResourceTypes != nil { - for _, matchResourceTypes := range backupPolicy.MatchResourceTypes { - if err = d.Set("match_resource_type", matchResourceTypes); err != nil { - return diag.FromErr(fmt.Errorf("[ERROR] Error setting match_resource_type: %s", err)) - } + if backupPolicy.IncludedContent != nil { + if err = d.Set("included_content", backupPolicy.IncludedContent); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting included_content: %s", err)) } } + if backupPolicy.MatchUserTags != nil { if err = d.Set("match_user_tags", backupPolicy.MatchUserTags); err != nil { return diag.FromErr(fmt.Errorf("[ERROR] Error setting match_user_tags: %s", err)) @@ -395,6 +420,10 @@ func resourceIBMIsBackupPolicyUpdate(context context.Context, d *schema.Resource patchVals.Name = core.StringPtr(d.Get("name").(string)) hasChange = true } + if d.HasChange("included_content") { + patchVals.IncludedContent = (flex.ExpandStringList((d.Get("included_content").(*schema.Set)).List())) + hasChange = true + } updateBackupPolicyOptions.SetIfMatch(d.Get("version").(string)) if hasChange { updateBackupPolicyOptions.BackupPolicyPatch, _ = patchVals.AsPatch() diff --git a/ibm/service/vpc/resource_ibm_is_snapshot.go b/ibm/service/vpc/resource_ibm_is_snapshot.go index 43d5c737fb..62fa258808 100644 --- a/ibm/service/vpc/resource_ibm_is_snapshot.go +++ b/ibm/service/vpc/resource_ibm_is_snapshot.go @@ -238,6 +238,55 @@ func ResourceIBMSnapshot() *schema.Resource { }, }, + isSnapshotConsistencyGroup: { + Type: schema.TypeList, + Computed: true, + Description: "The snapshot consistency group which created this snapshot.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN of this snapshot consistency group.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for the snapshot consistency group.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for the snapshot consistency group.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for the snapshot consistency group. The name is unique across all snapshot consistency groups in the region.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + isSnapshotSourceVolume: { Type: schema.TypeString, Optional: true, @@ -643,6 +692,25 @@ func snapshotGet(d *schema.ResourceData, meta interface{}, id string) error { sourceSnapshotList = append(sourceSnapshotList, sourceSnapshot) } d.Set(isSnapshotSourceSnapshot, sourceSnapshotList) + + // snapshot consistency group + snapshotConsistencyGroupList := []map[string]interface{}{} + if snapshot.SnapshotConsistencyGroup != nil { + snapshotConsistencyGroup := map[string]interface{}{} + snapshotConsistencyGroup["href"] = snapshot.SnapshotConsistencyGroup.Href + snapshotConsistencyGroup["crn"] = snapshot.SnapshotConsistencyGroup.CRN + if snapshot.SnapshotConsistencyGroup.Deleted != nil { + snapshotConsistencyGroupDeletedMap := map[string]interface{}{} + snapshotConsistencyGroupDeletedMap["more_info"] = snapshot.SnapshotConsistencyGroup.Deleted.MoreInfo + snapshotConsistencyGroup["deleted"] = []map[string]interface{}{snapshotConsistencyGroupDeletedMap} + } + snapshotConsistencyGroup["id"] = snapshot.SnapshotConsistencyGroup.ID + snapshotConsistencyGroup["name"] = snapshot.SnapshotConsistencyGroup.Name + snapshotConsistencyGroup["resource_type"] = snapshot.SnapshotConsistencyGroup.ResourceType + snapshotConsistencyGroupList = append(snapshotConsistencyGroupList, snapshotConsistencyGroup) + } + d.Set(isSnapshotConsistencyGroup, snapshotConsistencyGroupList) + snapshotCopies := []map[string]interface{}{} if snapshot.Copies != nil { for _, copiesItem := range snapshot.Copies { diff --git a/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go b/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go new file mode 100644 index 0000000000..c73112fb3d --- /dev/null +++ b/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go @@ -0,0 +1,815 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + "os" + "strings" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func ResourceIBMIsSnapshotConsistencyGroup() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIBMIsSnapshotConsistencyGroupCreate, + ReadContext: resourceIBMIsSnapshotConsistencyGroupRead, + UpdateContext: resourceIBMIsSnapshotConsistencyGroupUpdate, + DeleteContext: resourceIBMIsSnapshotConsistencyGroupDelete, + Importer: &schema.ResourceImporter{}, + + Schema: map[string]*schema.Schema{ + "delete_snapshots_on_delete": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ValidateFunc: validate.InvokeValidator("ibm_is_snapshot_consistency_group", "name"), + Description: "The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the region.", + }, + "resource_group": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + Description: "Resource group Id", + }, + "snapshots": { + Type: schema.TypeList, + Required: true, + Description: "The member snapshots that are data-consistent with respect to captured time. (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name for this snapshot. The name is unique across all snapshots in the region.", + }, + "source_volume": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The volume to create this snapshot from.", + }, + "tags": { + Type: schema.TypeSet, + Optional: true, + Set: flex.ResourceIBMVPCHash, + Elem: &schema.Schema{Type: schema.TypeString, ValidateFunc: validate.InvokeValidator("ibm_is_snapshot_consistency_group", "tags")}, + Description: "User Tags for the snapshot", + }, + }, + }, + }, + "snapshot_reference": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The member snapshots that are data-consistent with respect to captured time. (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN of this snapshot.", + }, + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this snapshot.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this snapshot.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this snapshot. The name is unique across all snapshots in the region.", + }, + "remote": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource is remote to this region,and identifies the native region.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this region.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The globally unique name for this region.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "backup_policy_plan": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, the backup policy plan which created this snapshot consistency group.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "deleted": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource has been deleted, and providessome supplementary information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "more_info": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Link to documentation about deleted resources.", + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this backup policy plan.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this backup policy plan.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this backup policy plan. The name is unique across all plans in the backup policy.", + }, + "remote": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "If present, this property indicates the referenced resource is remote to this region,and identifies the native region.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this region.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The globally unique name for this region.", + }, + }, + }, + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date and time that this snapshot consistency group was created.", + }, + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN of this snapshot consistency group.", + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this snapshot consistency group.", + }, + "lifecycle_state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The lifecycle state of this snapshot consistency group.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + "service_tags": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags)[`is.instance:` prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-faqs) associated with this snapshot consistency group.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "tags": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString, ValidateFunc: validate.InvokeValidator("ibm_is_snapshot_consistency_group", "tags")}, + Set: flex.ResourceIBMVPCHash, + Description: "Snapshot Consistency Group tags list", + }, + "access_tags": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString, ValidateFunc: validate.InvokeValidator("ibm_is_snapshot_consistency_group", "access_tags")}, + Set: flex.ResourceIBMVPCHash, + Description: "List of access management tags", + }, + }, + } +} + +func ResourceIBMIsSnapshotConsistencyGroupValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "name", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Optional: true, + Regexp: `^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$`, + MinValueLength: 1, + MaxValueLength: 63, + }, + ) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "tags", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Optional: true, + Regexp: `^[A-Za-z0-9:_ .-]+$`, + MinValueLength: 1, + MaxValueLength: 128, + }, + ) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "access_tags", + ValidateFunctionIdentifier: validate.ValidateRegexpLen, + Type: validate.TypeString, + Optional: true, + Regexp: `^([A-Za-z0-9_.-]|[A-Za-z0-9_.-][A-Za-z0-9_ .-]*[A-Za-z0-9_.-]):([A-Za-z0-9_.-]|[A-Za-z0-9_.-][A-Za-z0-9_ .-]*[A-Za-z0-9_.-])$`, + MinValueLength: 1, + MaxValueLength: 128}) + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_is_snapshot_consistency_group", Schema: validateSchema} + return &resourceValidator +} + +func resourceIBMIsSnapshotConsistencyGroupCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := meta.(conns.ClientSession).VpcV1API() + if err != nil { + return diag.FromErr(err) + } + createSnapshotConsistencyGroupOptions := &vpcv1.CreateSnapshotConsistencyGroupOptions{} + snapshotConsistencyGroupPrototype := &vpcv1.SnapshotConsistencyGroupPrototype{} + + if _, ok := d.GetOk("delete_snapshots_on_delete"); ok { + snapshotConsistencyGroupPrototype.DeleteSnapshotsOnDelete = core.BoolPtr(d.Get("delete_snapshots_on_delete").(bool)) + } + + if _, ok := d.GetOk("name"); ok { + snapshotConsistencyGroupPrototype.Name = core.StringPtr(d.Get("name").(string)) + } + + if rgrp, ok := d.GetOk("resource_group"); ok { + rg := rgrp.(string) + snapshotConsistencyGroupPrototype.ResourceGroup = &vpcv1.ResourceGroupIdentity{ + ID: &rg, + } + } + var snapshotConsistencyGroupPrototypeSnapshotsItemArray []vpcv1.SnapshotConsistencyGroupPrototypeSnapshotsItem + snapshotsArray := d.Get("snapshots").([]interface{}) + for _, snapshot := range snapshotsArray { + snapshotVal := snapshot.(map[string]interface{}) + snapshotConsistencyGroupPrototypeSnapshotsItem := &vpcv1.SnapshotConsistencyGroupPrototypeSnapshotsItem{} + + volume := snapshotVal["source_volume"].(string) + snapshotConsistencyGroupPrototypeSnapshotsItem.SourceVolume = &vpcv1.VolumeIdentity{ + ID: &volume, + } + name := snapshotVal["name"].(string) + if name != "" { + snapshotConsistencyGroupPrototypeSnapshotsItem.Name = &name + } + + userTags := snapshotVal["tags"].(*schema.Set) + if userTags != nil && userTags.Len() != 0 { + userTagsArray := make([]string, userTags.Len()) + for i, userTag := range userTags.List() { + userTagStr := userTag.(string) + userTagsArray[i] = userTagStr + } + schematicTags := os.Getenv("IC_ENV_TAGS") + var envTags []string + if schematicTags != "" { + envTags = strings.Split(schematicTags, ",") + userTagsArray = append(userTagsArray, envTags...) + } + snapshotConsistencyGroupPrototypeSnapshotsItem.UserTags = userTagsArray + } + snapshotConsistencyGroupPrototypeSnapshotsItemArray = append(snapshotConsistencyGroupPrototypeSnapshotsItemArray, *snapshotConsistencyGroupPrototypeSnapshotsItem) + } + snapshotConsistencyGroupPrototype.Snapshots = snapshotConsistencyGroupPrototypeSnapshotsItemArray + + createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototype + snapshotConsistencyGroup, response, err := vpcClient.CreateSnapshotConsistencyGroupWithContext(context, createSnapshotConsistencyGroupOptions) + if err != nil { + log.Printf("[DEBUG] CreateSnapshotConsistencyGroupWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CreateSnapshotConsistencyGroupWithContext failed %s\n%s", err, response)) + } + + d.SetId(*snapshotConsistencyGroup.ID) + + _, err = isWaitForSnapshotConsistencyGroupAvailable(vpcClient, d.Id(), d.Timeout(schema.TimeoutCreate)) + + if err != nil { + return diag.FromErr(err) + } + + v := os.Getenv("IC_ENV_TAGS") + if _, ok := d.GetOk("tags"); ok || v != "" { + oldList, newList := d.GetChange("tags") + err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, *snapshotConsistencyGroup.CRN, "", isUserTagType) + if err != nil { + log.Printf( + "Error on create of resource vpc snapshot consistency group (%s) tags: %s", d.Id(), err) + } + } + + if _, ok := d.GetOk("access_tags"); ok { + oldList, newList := d.GetChange("access_tags") + err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, *snapshotConsistencyGroup.CRN, "", isAccessTagType) + if err != nil { + log.Printf( + "Error on create of resource snapshot consistency group (%s) access tags: %s", d.Id(), err) + } + } + + return resourceIBMIsSnapshotConsistencyGroupRead(context, d, meta) +} + +func isWaitForSnapshotConsistencyGroupAvailable(sess *vpcv1.VpcV1, id string, timeout time.Duration) (interface{}, error) { + log.Printf("Waiting for Snapshot Consistency Group(%s) to be available.", id) + + stateConf := &resource.StateChangeConf{ + Pending: []string{"pending"}, + Target: []string{"stable", "failed"}, + Refresh: isSnapshotConsistencyGroupRefreshFunc(sess, id), + Timeout: timeout, + Delay: 10 * time.Second, + MinTimeout: 10 * time.Second, + } + + return stateConf.WaitForState() +} + +func isSnapshotConsistencyGroupRefreshFunc(vpcClient *vpcv1.VpcV1, id string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + + getSnapshotConsistencyGroupOptions := &vpcv1.GetSnapshotConsistencyGroupOptions{} + getSnapshotConsistencyGroupOptions.SetID(id) + + snapshotConsistencyGroup, response, err := vpcClient.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions) + if err != nil { + log.Printf("[DEBUG] GetSnapshotConsistencyGroupWithContext failed %s\n%s", err, response) + return nil, "failed", fmt.Errorf("[ERROR] Error GetSnapshotConsistencyGroupWithContext failed : %s\n%s", err, response) + } + + if *snapshotConsistencyGroup.LifecycleState == "stable" { + return snapshotConsistencyGroup, *snapshotConsistencyGroup.LifecycleState, nil + } else if *snapshotConsistencyGroup.LifecycleState == "failed" { + return snapshotConsistencyGroup, *snapshotConsistencyGroup.LifecycleState, + fmt.Errorf("Snapshot Consistency Group (%s) went into failed state during the operation \n [WARNING] Running terraform apply again will remove the tainted snapshot consistency group and attempt to create the snapshot again replacing the previous configuration", *snapshotConsistencyGroup.ID) + } + + return snapshotConsistencyGroup, "pending", nil + } +} + +func isWaitForSnapshotConsistencyGroupUpdate(sess *vpcv1.VpcV1, id string, timeout time.Duration) (interface{}, error) { + log.Printf("Waiting for Snapshot Consistency Group (%s) to be available.", id) + + stateConf := &resource.StateChangeConf{ + Pending: []string{"updating"}, + Target: []string{"stable", "failed"}, + Refresh: isSnapshotUpdateConsistencyGroupRefreshFunc(sess, id), + Timeout: timeout, + Delay: 10 * time.Second, + MinTimeout: 10 * time.Second, + } + return stateConf.WaitForState() +} + +func isSnapshotUpdateConsistencyGroupRefreshFunc(vpcClient *vpcv1.VpcV1, id string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + getSnapshotConsistencyGroupOptions := &vpcv1.GetSnapshotConsistencyGroupOptions{} + getSnapshotConsistencyGroupOptions.SetID(id) + + snapshotConsistencyGroup, response, err := vpcClient.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions) + if err != nil { + log.Printf("[DEBUG] GetSnapshotConsistencyGroupWithContext failed %s\n%s", err, response) + return nil, "failed", fmt.Errorf("[ERROR] Error GetSnapshotConsistencyGroupWithContext failed : %s\n%s", err, response) + } + + if *snapshotConsistencyGroup.LifecycleState == "stable" || *snapshotConsistencyGroup.LifecycleState == "failed" { + return snapshotConsistencyGroup, *snapshotConsistencyGroup.LifecycleState, nil + } else if *snapshotConsistencyGroup.LifecycleState == isSnapshotFailed { + return snapshotConsistencyGroup, *snapshotConsistencyGroup.LifecycleState, fmt.Errorf("Snapshot Consistency Group (%s) went into failed state during the operation \n [WARNING] Running terraform apply again will remove the tainted snapshot consistency group and attempt to create the snapshot consistency group again replacing the previous configuration", *snapshotConsistencyGroup.ID) + } + + return snapshotConsistencyGroup, isSnapshotUpdating, nil + } +} + +func isWaitForSnapshotConsistencyGroupDeleted(sess *vpcv1.VpcV1, id string, timeout time.Duration) (interface{}, error) { + log.Printf("Waiting for Snapshot Consistency Group (%s) to be deleted.", id) + + stateConf := &resource.StateChangeConf{ + Pending: []string{"deleting"}, + Target: []string{"deleted", "failed"}, + Refresh: isSnapshotDeleteConsistencyGroupRefreshFunc(sess, id), + Timeout: timeout, + Delay: 10 * time.Second, + MinTimeout: 10 * time.Second, + } + + return stateConf.WaitForState() +} + +func isSnapshotDeleteConsistencyGroupRefreshFunc(vpcClient *vpcv1.VpcV1, id string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + log.Printf("[DEBUG] Refresh function for Snapshot Consistency Group delete.") + + getSnapshotConsistencyGroupOptions := &vpcv1.GetSnapshotConsistencyGroupOptions{} + getSnapshotConsistencyGroupOptions.SetID(id) + + snapshotConsistencyGroup, response, err := vpcClient.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + return snapshotConsistencyGroup, "deleted", nil + } + return nil, "failed", fmt.Errorf("[ERROR] The Snapshot Consistency Group %s failed to delete: %s\n%s", id, err, response) + } + return snapshotConsistencyGroup, *snapshotConsistencyGroup.LifecycleState, nil + } +} + +func resourceIBMIsSnapshotConsistencyGroupRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := meta.(conns.ClientSession).VpcV1API() + if err != nil { + return diag.FromErr(err) + } + + getSnapshotConsistencyGroupOptions := &vpcv1.GetSnapshotConsistencyGroupOptions{} + getSnapshotConsistencyGroupOptions.SetID(d.Id()) + + snapshotConsistencyGroup, response, err := vpcClient.GetSnapshotConsistencyGroupWithContext(context, getSnapshotConsistencyGroupOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetSnapshotConsistencyGroupWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetSnapshotConsistencyGroupWithContext failed %s\n%s", err, response)) + } + + if !core.IsNil(snapshotConsistencyGroup.DeleteSnapshotsOnDelete) { + if err = d.Set("delete_snapshots_on_delete", snapshotConsistencyGroup.DeleteSnapshotsOnDelete); err != nil { + return diag.FromErr(fmt.Errorf("Error setting delete_snapshots_on_delete: %s", err)) + } + } + if !core.IsNil(snapshotConsistencyGroup.Name) { + if err = d.Set("name", snapshotConsistencyGroup.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + } + if !core.IsNil(snapshotConsistencyGroup.ResourceGroup) && !core.IsNil(snapshotConsistencyGroup.ResourceGroup.ID) { + d.Set("resource_group", snapshotConsistencyGroup.ResourceGroup.ID) + } + if !core.IsNil(snapshotConsistencyGroup.Snapshots) { + snapshots := []map[string]interface{}{} + for _, snapshotsItem := range snapshotConsistencyGroup.Snapshots { + snapshotsItemMap, err := resourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(&snapshotsItem) + if err != nil { + return diag.FromErr(err) + } + snapshots = append(snapshots, snapshotsItemMap) + } + if err = d.Set("snapshot_reference", snapshots); err != nil { + return diag.FromErr(fmt.Errorf("Error setting snapshots: %s", err)) + } + } + if !core.IsNil(snapshotConsistencyGroup.BackupPolicyPlan) { + backupPolicyPlanMap, err := resourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceToMap(snapshotConsistencyGroup.BackupPolicyPlan) + if err != nil { + return diag.FromErr(err) + } + if err = d.Set("backup_policy_plan", []map[string]interface{}{backupPolicyPlanMap}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting backup_policy_plan: %s", err)) + } + } else { + if err = d.Set("backup_policy_plan", []map[string]interface{}{}); err != nil { + return diag.FromErr(fmt.Errorf("Error setting backup_policy_plan: %s", err)) + } + } + if err = d.Set("created_at", flex.DateTimeToString(snapshotConsistencyGroup.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + if err = d.Set("crn", snapshotConsistencyGroup.CRN); err != nil { + return diag.FromErr(fmt.Errorf("Error setting crn: %s", err)) + } + if err = d.Set("href", snapshotConsistencyGroup.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + if err = d.Set("lifecycle_state", snapshotConsistencyGroup.LifecycleState); err != nil { + return diag.FromErr(fmt.Errorf("Error setting lifecycle_state: %s", err)) + } + if err = d.Set("resource_type", snapshotConsistencyGroup.ResourceType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_type: %s", err)) + } + if err = d.Set("service_tags", snapshotConsistencyGroup.ServiceTags); err != nil { + return diag.FromErr(fmt.Errorf("Error setting service_tags: %s", err)) + } + tags, err := flex.GetGlobalTagsUsingCRN(meta, *snapshotConsistencyGroup.CRN, "", isUserTagType) + if err != nil { + log.Printf( + "Error on get of resource vpc snapshot consistency group (%s) tags: %s", d.Id(), err) + } + d.Set("tags", tags) + + accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *snapshotConsistencyGroup.CRN, "", isAccessTagType) + if err != nil { + log.Printf( + "Error on get of resource VPC snapshot consistency group (%s) access tags: %s", d.Id(), err) + } + d.Set("access_tags", accesstags) + return nil +} + +func resourceIBMIsSnapshotConsistencyGroupUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := meta.(conns.ClientSession).VpcV1API() + if err != nil { + return diag.FromErr(err) + } + + updateSnapshotConsistencyGroupOptions := &vpcv1.UpdateSnapshotConsistencyGroupOptions{} + updateSnapshotConsistencyGroupOptions.SetID(d.Id()) + hasChange := false + + if d.HasChange("tags") { + getSnapshotConsistencyGroupOptions := &vpcv1.GetSnapshotConsistencyGroupOptions{} + getSnapshotConsistencyGroupOptions.SetID(d.Id()) + + snapshotConsistencyGroup, response, err := vpcClient.GetSnapshotConsistencyGroupWithContext(context, getSnapshotConsistencyGroupOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetSnapshotConsistencyGroupWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetSnapshotConsistencyGroupWithContext failed %s\n%s", err, response)) + } + + oldList, newList := d.GetChange("tags") + err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, *snapshotConsistencyGroup.CRN, "", isUserTagType) + if err != nil { + log.Printf( + "Error on update of resource vpc snapshot consistency group (%s) tags: %s", d.Id(), err) + } + } + if d.HasChange("access_tags") { + getSnapshotConsistencyGroupOptions := &vpcv1.GetSnapshotConsistencyGroupOptions{} + getSnapshotConsistencyGroupOptions.SetID(d.Id()) + + snapshotConsistencyGroup, response, err := vpcClient.GetSnapshotConsistencyGroupWithContext(context, getSnapshotConsistencyGroupOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetSnapshotConsistencyGroupWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetSnapshotConsistencyGroupWithContext failed %s\n%s", err, response)) + } + + oldList, newList := d.GetChange("access_tags") + err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, *snapshotConsistencyGroup.CRN, "", isAccessTagType) + if err != nil { + log.Printf( + "Error on update of resource VPC snapshot consistency group (%s) access tags: %s", d.Id(), err) + } + } + + patchVals := &vpcv1.SnapshotConsistencyGroupPatch{} + if d.HasChange("delete_snapshots_on_delete") { + newDeleteSnapshotsOnDelete := d.Get("delete_snapshots_on_delete").(bool) + patchVals.DeleteSnapshotsOnDelete = &newDeleteSnapshotsOnDelete + hasChange = true + } + if d.HasChange("name") { + newName := d.Get("name").(string) + patchVals.Name = &newName + hasChange = true + } + + getSnapshotConsistencyGroupOptions := &vpcv1.GetSnapshotConsistencyGroupOptions{} + getSnapshotConsistencyGroupOptions.SetID(d.Id()) + + _, response, err := vpcClient.GetSnapshotConsistencyGroupWithContext(context, getSnapshotConsistencyGroupOptions) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + log.Printf("[DEBUG] GetSnapshotConsistencyGroupWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetSnapshotConsistencyGroupWithContext failed %s\n%s", err, response)) + } + updateSnapshotConsistencyGroupOptions.SetIfMatch(response.Headers.Get("Etag")) + + if hasChange { + updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch, _ = patchVals.AsPatch() + _, response, err := vpcClient.UpdateSnapshotConsistencyGroupWithContext(context, updateSnapshotConsistencyGroupOptions) + if err != nil { + log.Printf("[DEBUG] UpdateSnapshotConsistencyGroupWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("UpdateSnapshotConsistencyGroupWithContext failed %s\n%s", err, response)) + } + _, err = isWaitForSnapshotConsistencyGroupUpdate(vpcClient, d.Id(), d.Timeout(schema.TimeoutCreate)) + if err != nil { + return diag.FromErr(err) + } + } + + return resourceIBMIsSnapshotConsistencyGroupRead(context, d, meta) +} + +func resourceIBMIsSnapshotConsistencyGroupDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := meta.(conns.ClientSession).VpcV1API() + if err != nil { + return diag.FromErr(err) + } + + deleteSnapshotConsistencyGroupOptions := &vpcv1.DeleteSnapshotConsistencyGroupOptions{} + + deleteSnapshotConsistencyGroupOptions.SetID(d.Id()) + + _, response, err := vpcClient.DeleteSnapshotConsistencyGroupWithContext(context, deleteSnapshotConsistencyGroupOptions) + if err != nil { + log.Printf("[DEBUG] DeleteSnapshotConsistencyGroupWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("DeleteSnapshotConsistencyGroupWithContext failed %s\n%s", err, response)) + } + + _, err = isWaitForSnapshotConsistencyGroupDeleted(vpcClient, d.Id(), d.Timeout(schema.TimeoutDelete)) + if err != nil { + return diag.FromErr(err) + } + + d.SetId("") + + return nil +} + +func resourceIBMIsSnapshotConsistencyGroupResourceGroupReferenceToMap(model *vpcv1.ResourceGroupReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + return modelMap, nil +} + +func resourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotConsistencyGroupSnapshotsItem) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.CRN + if model.Deleted != nil { + deletedMap, err := resourceIBMIsSnapshotConsistencyGroupSnapshotReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + if model.Href != nil { + modelMap["href"] = model.Href + } + if model.ID != nil { + modelMap["id"] = model.ID + } + if model.Name != nil { + modelMap["name"] = model.Name + } + if model.Remote != nil { + remoteMap, err := resourceIBMIsSnapshotConsistencyGroupSnapshotRemoteToMap(model.Remote) + if err != nil { + return modelMap, err + } + modelMap["remote"] = []map[string]interface{}{remoteMap} + } + if model.ResourceType != nil { + modelMap["resource_type"] = model.ResourceType + } + return modelMap, nil +} + +func resourceIBMIsSnapshotConsistencyGroupSnapshotReferenceDeletedToMap(model *vpcv1.SnapshotReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.MoreInfo != nil { + modelMap["more_info"] = model.MoreInfo + } + return modelMap, nil +} + +func resourceIBMIsSnapshotConsistencyGroupSnapshotRemoteToMap(model *vpcv1.SnapshotRemote) (map[string]interface{}, error) { + regionMap := make(map[string]interface{}) + if model.Region != nil { + regionMap, err := resourceIBMIsSnapshotConsistencyGroupRegionReferenceToMap(model.Region) + if err != nil { + return regionMap, err + } + return regionMap, nil + } + return regionMap, nil +} + +func resourceIBMIsSnapshotConsistencyGroupRegionReferenceToMap(model *vpcv1.RegionReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["href"] = model.Href + modelMap["name"] = model.Name + return modelMap, nil +} + +func resourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceToMap(model *vpcv1.BackupPolicyPlanReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Deleted != nil { + deletedMap, err := resourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceDeletedToMap(model.Deleted) + if err != nil { + return modelMap, err + } + modelMap["deleted"] = []map[string]interface{}{deletedMap} + } + modelMap["href"] = model.Href + modelMap["id"] = model.ID + modelMap["name"] = model.Name + if model.Remote != nil { + remoteMap, err := resourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanRemoteToMap(model.Remote) + if err != nil { + return modelMap, err + } + modelMap["remote"] = []map[string]interface{}{remoteMap} + } + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func resourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceDeletedToMap(model *vpcv1.BackupPolicyPlanReferenceDeleted) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["more_info"] = model.MoreInfo + return modelMap, nil +} + +func resourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanRemoteToMap(model *vpcv1.BackupPolicyPlanRemote) (map[string]interface{}, error) { + regionMap := make(map[string]interface{}) + if model.Region != nil { + regionMap, err := resourceIBMIsSnapshotConsistencyGroupRegionReferenceToMap(model.Region) + if err != nil { + return regionMap, err + } + return regionMap, nil + } + return regionMap, nil +} diff --git a/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group_test.go b/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group_test.go new file mode 100644 index 0000000000..5637ad4799 --- /dev/null +++ b/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group_test.go @@ -0,0 +1,166 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func TestAccIBMIsSnapshotConsistencyGroupBasic(t *testing.T) { + var conf vpcv1.SnapshotConsistencyGroup + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-instance-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tf-subnet-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(` +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR +`) + sshname := fmt.Sprintf("tf-ssh-%d", acctest.RandIntRange(10, 100)) + deleteSnapshotsOnDelete := "true" + scgname := fmt.Sprintf("tf-snap-cons-grp-name-%d", acctest.RandIntRange(10, 100)) + deleteSnapshotsOnDeleteUpdate := "false" + snapname := fmt.Sprintf("tf-snap-name-%d", acctest.RandIntRange(10, 100)) + scgnameUpdate := fmt.Sprintf("tf-snap-cons-grp-name-update-%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIsSnapshotConsistencyGroupDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsSnapshotConsistencyGroupConfig(vpcname, subnetname, sshname, publicKey, name, scgname, snapname, deleteSnapshotsOnDelete), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIBMIsSnapshotConsistencyGroupExists("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", conf), + resource.TestCheckResourceAttr("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "delete_snapshots_on_delete", deleteSnapshotsOnDelete), + resource.TestCheckResourceAttr("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "name", scgname), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "id"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "name"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "created_at"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "crn"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "href"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "lifecycle_state"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshot_reference.0.id"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshot_reference.0.crn"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshot_reference.0.name"), + ), + }, + resource.TestStep{ + Config: testAccCheckIBMIsSnapshotConsistencyGroupConfig(vpcname, subnetname, sshname, publicKey, name, scgnameUpdate, snapname, deleteSnapshotsOnDeleteUpdate), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "delete_snapshots_on_delete", deleteSnapshotsOnDeleteUpdate), + resource.TestCheckResourceAttr("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "name", scgnameUpdate), + ), + }, + }, + }) +} + +func testAccCheckIBMIsSnapshotConsistencyGroupConfig(vpcname, subnetname, sshname, publicKey, name, snapname, scgname, deleteSnapshotsOnDelete string) string { + return fmt.Sprintf(` + + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + total_ipv4_address_count = 16 + } + + resource "ibm_is_ssh_key" "testacc_sshkey" { + name = "%s" + public_key = "%s" + } + + resource "ibm_is_instance" "testacc_instance" { + name = "%s" + image = "%s" + profile = "%s" + primary_network_interface { + subnet = ibm_is_subnet.testacc_subnet.id + } + vpc = ibm_is_vpc.testacc_vpc.id + zone = "%s" + keys = [ibm_is_ssh_key.testacc_sshkey.id] + network_interfaces { + subnet = ibm_is_subnet.testacc_subnet.id + name = "eth1" + } + } + + resource "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group" { + delete_snapshots_on_delete = "%s" + snapshots { + name = "%s" + source_volume = ibm_is_instance.testacc_instance.volume_attachments[0].volume_id + } + name = "%s" + } + `, vpcname, subnetname, acc.ISZoneName, sshname, publicKey, name, "r134-f47cc24c-e020-4db5-ad96-1e5be8b5853b", acc.InstanceProfileName, acc.ISZoneName, deleteSnapshotsOnDelete, scgname, snapname) +} + +func testAccCheckIBMIsSnapshotConsistencyGroupExists(n string, obj vpcv1.SnapshotConsistencyGroup) resource.TestCheckFunc { + + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + vpcClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).VpcV1API() + if err != nil { + return err + } + + getSnapshotConsistencyGroupOptions := &vpcv1.GetSnapshotConsistencyGroupOptions{} + + getSnapshotConsistencyGroupOptions.SetID(rs.Primary.ID) + + snapshotConsistencyGroup, _, err := vpcClient.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions) + if err != nil { + return err + } + + obj = *snapshotConsistencyGroup + return nil + } +} + +func testAccCheckIBMIsSnapshotConsistencyGroupDestroy(s *terraform.State) error { + vpcClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).VpcV1API() + if err != nil { + return err + } + for _, rs := range s.RootModule().Resources { + if rs.Type != "ibm_is_snapshot_consistency_group" { + continue + } + + getSnapshotConsistencyGroupOptions := &vpcv1.GetSnapshotConsistencyGroupOptions{} + + getSnapshotConsistencyGroupOptions.SetID(rs.Primary.ID) + + // Try to find the key + _, response, err := vpcClient.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions) + + if err == nil { + return fmt.Errorf("SnapshotConsistencyGroup still exists: %s", rs.Primary.ID) + } else if response.StatusCode != 404 { + return fmt.Errorf("Error checking for SnapshotConsistencyGroup (%s) has been destroyed: %s", rs.Primary.ID, err) + } + } + + return nil +} diff --git a/ibm/service/vpc/resource_ibm_is_vpc_dns_resolution_binding.go b/ibm/service/vpc/resource_ibm_is_vpc_dns_resolution_binding.go index 3ec4a1ff60..b83c374d5b 100644 --- a/ibm/service/vpc/resource_ibm_is_vpc_dns_resolution_binding.go +++ b/ibm/service/vpc/resource_ibm_is_vpc_dns_resolution_binding.go @@ -404,7 +404,7 @@ func resourceIBMIsVPCDnsResolutionBindingDelete(context context.Context, d *sche deleteVPCDnsResolutionBindingOptions.SetVPCID(vpcId) deleteVPCDnsResolutionBindingOptions.SetID(id) - response, err := sess.DeleteVPCDnsResolutionBindingWithContext(context, deleteVPCDnsResolutionBindingOptions) + _, response, err := sess.DeleteVPCDnsResolutionBindingWithContext(context, deleteVPCDnsResolutionBindingOptions) if err != nil { log.Printf("[DEBUG] DeleteVPCDnsResolutionBindingWithContext failed %s\n%s", err, response) if response.StatusCode != 404 { diff --git a/website/docs/d/is_backup_policies.html.markdown b/website/docs/d/is_backup_policies.html.markdown index 3e36540ebe..40b6c6e186 100644 --- a/website/docs/d/is_backup_policies.html.markdown +++ b/website/docs/d/is_backup_policies.html.markdown @@ -54,9 +54,17 @@ In addition to all argument reference list, you can access the following attribu - `health_state` - (String) The health of this resource. - `href` - (String) The URL for this backup policy. - `id` - (String) The unique identifier for this backup policy. + - `included_content` - (Optional, List) The included content for backups created using this policy. + + ~> **Note** + `boot_volume`: Include the instance's boot volume.
+ `data_volumes`: Include the instance's data volumes. - `last_job_completed_at` - (String) he date and time that the most recent job for this backup policy completed. - `lifecycle_state` - (String) The lifecycle state of the backup policy. - `match_resource_types` - (List) A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will be subject to the backup policy. + ~> **Note** + `match_resource_types` is deprecated. Please use `match_resource_type` instead. + - `match_resource_type` - (Optional, String) 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. - `match_user_tags` - (List) 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. - `name` - (String) The unique user-defined name for this backup policy. - `plans` - (List) The plans for the backup policy. diff --git a/website/docs/d/is_backup_policy.html.markdown b/website/docs/d/is_backup_policy.html.markdown index 6513f31bfa..ce883610be 100644 --- a/website/docs/d/is_backup_policy.html.markdown +++ b/website/docs/d/is_backup_policy.html.markdown @@ -53,6 +53,9 @@ In addition to all argument reference list, you can access the following attribu - `last_job_completed_at` - (String) he date and time that the most recent job for this backup policy completed. - `lifecycle_state` - (String) The lifecycle state of the backup policy. - `match_resource_types` - (List) A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will be subject to the backup policy. +~> **Note** + `match_resource_types` is deprecated. Please use `match_resource_type` instead. +- `match_resource_type` - (Optional, String) 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. - `match_user_tags` - (List) 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. - `name` - (String) The unique user-defined name for this backup policy. - `plans` - (List) The plans for the backup policy. diff --git a/website/docs/d/is_backup_policy_job.html.markdown b/website/docs/d/is_backup_policy_job.html.markdown index 18f23ce8b3..3f817ab700 100644 --- a/website/docs/d/is_backup_policy_job.html.markdown +++ b/website/docs/d/is_backup_policy_job.html.markdown @@ -72,7 +72,24 @@ In addition to all argument references listed, you can access the following attr - `href` - (String) The URL for this volume. - `id` - (String) The unique identifier for this volume. - `name` - (String) The unique user-defined name for this volume. + - `remote` - (List) If present, this property indicates that the referenced resource is remote to this region, and identifies the native region. + Nested scheme for `remote`: + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. + - `resource_type` - (String) The resource type. +- `source_instance` - (List) The source instance this backup was created from (may be [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + + Nested scheme for `source_instance`: + - `crn` - (String) The CRN for this virtual server instance. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted and providessome supplementary information. + + Nested scheme for `deleted`: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this virtual server instance. + - `id` - (String) The unique identifier for this virtual server instance. + - `name` - (String) The unique user-defined name for this virtual server instance. + - `resource_type` - (String) The resource type. - `status` - (String) The status of the backup policy job.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the unexpected property value was encountered. - `status_reasons` - (List) The reasons for the current status (if any).The enumerated reason code values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected reason code was encountered. diff --git a/website/docs/d/is_backup_policy_jobs.html.markdown b/website/docs/d/is_backup_policy_jobs.html.markdown index 5dafd73fe3..b686469335 100644 --- a/website/docs/d/is_backup_policy_jobs.html.markdown +++ b/website/docs/d/is_backup_policy_jobs.html.markdown @@ -64,6 +64,18 @@ In addition to all argument references listed, you can access the following attr - `created_at` - (String) The date and time that the backup policy job was created. - `href` - (String) The URL for this backup policy job. - `id` - (String) The unique identifier for this backup policy job. + - `source_instance` - (List) The source instance this backup was created from (may be [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + + Nested scheme for `source_instance`: + - `crn` - (String) The CRN for this virtual server instance. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted and providessome supplementary information. + + Nested scheme for `deleted`: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this virtual server instance. + - `id` - (String) The unique identifier for this virtual server instance. + - `name` - (String) The unique user-defined name for this virtual server instance. + - `resource_type` - (String) The resource type. - `job_type` - (String) The type of backup policy job.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the unexpected property value was encountered. - `resource_type` - (String) The resource type. - `source_volume` - (List) The source volume this backup was created from (may be [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)) @@ -76,7 +88,13 @@ In addition to all argument references listed, you can access the following attr - `more_info` - (String) Link to documentation about deleted resources. - `href` - (String) The URL for this volume. - `id` - (String) The unique identifier for this volume. + - `remote` - (List) If present, this property indicates that the referenced resource is remote to this region, and identifies the native region. + + Nested scheme for `remote`: + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. - `name` - (String) The unique user-defined name for this volume. + - `resource_type` - (String) The resource type. - `status` - (String) The status of the backup policy job.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the unexpected property value was encountered. - `status_reasons` - (List) The reasons for the current status (if any).The enumerated reason code values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected reason code was encountered. diff --git a/website/docs/d/is_backup_policy_plan.html.markdown b/website/docs/d/is_backup_policy_plan.html.markdown index a0e9af1ebd..13a8e3a7bc 100644 --- a/website/docs/d/is_backup_policy_plan.html.markdown +++ b/website/docs/d/is_backup_policy_plan.html.markdown @@ -43,6 +43,11 @@ Review the argument references that you can specify for your data source. In addition to all argument reference list, you can access the following attribute references after your data source is created. - `id` - The unique identifier of the BackupPolicyPlan. +- `included_content` - (Optional, List) The included content for backups created using this policy. + +~> **Note** + `boot_volume`: Include the instance's boot volume.
+ `data_volumes`: Include the instance's data volumes. - `active` - (Boolean) Indicates whether the plan is active. - `attach_user_tags` - (List) User tags to attach to each resource created by this plan. - `copy_user_tags` - (Boolean) Indicates whether to copy the source's user tags to the created resource. diff --git a/website/docs/d/is_snapshot.html.markdown b/website/docs/d/is_snapshot.html.markdown index fb9782077d..7ef79ed732 100644 --- a/website/docs/d/is_snapshot.html.markdown +++ b/website/docs/d/is_snapshot.html.markdown @@ -129,6 +129,18 @@ In addition to all argument reference list, you can access the following attribu - `operating_system` - (String) The globally unique name for the operating system included in this image. - `resource_type` - (String) The resource type. - `size` - (Integer) The size of this snapshot rounded up to the next gigabyte. +- `snapshot_consistency_group` - (List) The snapshot consistency group which created this snapshot. + + Nested scheme for `snapshot_consistency_group`: + - `crn` - (String) The CRN of this snapshot consistency group. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. + + Nested scheme for `deleted`: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for the snapshot consistency group. + - `id` - (String) The unique identifier for the snapshot consistency group. + - `name` - (String) TThe name for the snapshot consistency group. The name is unique across all snapshot consistency groups in the region. + - `resource_type` - (String) The resource type. - `source_image` - (String) If present, the unique identifier for the image from which the data on this volume was most directly provisioned. - `source_snapshot` - (String) If present, the source snapshot this snapshot was created from. Nested scheme for `source_snapshot`: diff --git a/website/docs/d/is_snapshot_consistency_group.html.markdown b/website/docs/d/is_snapshot_consistency_group.html.markdown new file mode 100644 index 0000000000..43110ba9f8 --- /dev/null +++ b/website/docs/d/is_snapshot_consistency_group.html.markdown @@ -0,0 +1,90 @@ +--- +subcategory: "VPC infrastructure" +layout: "ibm" +page_title: "IBM : ibm_is_snapshot_consistency_group" +description: |- + Get information about SnapshotConsistencyGroup +--- + +# ibm_is_snapshot_consistency_group + +Provides a read-only data source to retrieve information about a SnapshotConsistencyGroup. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +**Note:** +VPC infrastructure services are a regional specific based endpoint, by default targets to `us-south`. Please make sure to target right region in the provider block as shown in the `provider.tf` file, if VPC service is created in region other than `us-south`. + +**provider.tf** + +```terraform +provider "ibm" { + region = "eu-gb" +} +``` + +## Example Usage + +```terraform +data "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group" { + identifier = ibm_is_snapshot_consistency_group.is_snapshot_consistency_group.id +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +- `identifier` - (Optional, String) The snapshot consistency group identifier, `name` and `identifier` are mutually exclusive. +- `name` - (Optional, String) The name of the snapshot consistency group,`name` and `identifier` are mutually exclusive. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +- `id` - The unique identifier of the SnapshotConsistencyGroup. +- `backup_policy_plan` - (List) If present, the backup policy plan which created this snapshot consistency group. + + Nested schema for `backup_policy_plan`: + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + Nested schema for `deleted`: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this backup policy plan. + - `id` - (String) The unique identifier for this backup policy plan. + - `name` - (String) The name for this backup policy plan. The name is unique across all plans in the backup policy. + - `remote` - (List) If present, this property indicates that the resource associated with this referenceis remote and therefore may not be directly retrievable. + Nested schema for `remote`: + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. + - `resource_type` - (String) The resource type. + +- `created_at` - (String) The date and time that this snapshot consistency group was created. +- `crn` - (String) The CRN of this snapshot consistency group. +- `delete_snapshots_on_delete` - (Boolean) Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. +- `href` - (String) The URL for this snapshot consistency group. +- `lifecycle_state` - (String) The lifecycle state of this snapshot consistency group. +- `name` - (String) The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the region. +- `resource_group` - (List) The resource group for this snapshot consistency group. + + Nested schema for `resource_group`: + - `href` - (String) The URL for this resource group. + - `id` - (String) The unique identifier for this resource group. + - `name` - (String) The name for this resource group. + +- `resource_type` - (String) The resource type. +- `service_tags` - (List) The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags)[`is.instance:` prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-faqs) associated with this snapshot consistency group. +- `snapshots` - (List) The member snapshots that are data-consistent with respect to captured time. (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + Nested schema for `snapshots`: + - `crn` - (String) The CRN of this snapshot. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + + Nested schema for `deleted`: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this snapshot. + - `id` - (String) The unique identifier for this snapshot. + - `name` - (String) The name for this snapshot. The name is unique across all snapshots in the region. + - `remote` - (List) If present, this property indicates that the resource associated with this referenceis remote and therefore may not be directly retrievable. + + Nested schema for `remote`: + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. + - `resource_type` - (String) The resource type. + diff --git a/website/docs/d/is_snapshot_consistency_groups.html.markdown b/website/docs/d/is_snapshot_consistency_groups.html.markdown new file mode 100644 index 0000000000..447cb1c4b1 --- /dev/null +++ b/website/docs/d/is_snapshot_consistency_groups.html.markdown @@ -0,0 +1,89 @@ +--- +subcategory: "VPC infrastructure" +layout: "ibm" +page_title: "IBM : ibm_is_snapshot_consistency_groups" +description: |- + Get information about SnapshotConsistencyGroupCollection +--- + +# ibm_is_snapshot_consistency_groups + +Provides a read-only data source to retrieve information about a SnapshotConsistencyGroupCollection. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +**Note:** +VPC infrastructure services are a regional specific based endpoint, by default targets to `us-south`. Please make sure to target right region in the provider block as shown in the `provider.tf` file, if VPC service is created in region other than `us-south`. + +**provider.tf** + +```terraform +provider "ibm" { + region = "eu-gb" +} +``` + +## Example Usage + +```terraform +data "ibm_is_snapshot_consistency_groups" "is_snapshot_consistency_groups" { + name = "example-snapshot-consistency-group" +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +- `backup_policy_plan` - (Optional, String) Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified identifier. +- `name` - (Optional, String) Filters the collection to resources with a `name` property matching the exact specified name. +- `resource_group` - (Optional, String) Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +- `id` - The unique identifier of the SnapshotConsistencyGroupCollection. +- `snapshot_consistency_groups` - (List) Collection of snapshot consistency groups. + + Nested schema for `snapshot_consistency_groups`: + - `backup_policy_plan` - (List) If present, the backup policy plan which created this snapshot consistency group. + Nested schema for `backup_policy_plan`: + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + + Nested schema for `deleted`: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this backup policy plan. + - `id` - (String) The unique identifier for this backup policy plan. + - `name` - (String) The name for this backup policy plan. The name is unique across all plans in the backup policy. + - `remote` - (List) If present, this property indicates that the resource associated with this referenceis remote and therefore may not be directly retrievable. + + Nested schema for `remote`: + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. + - `resource_type` - (String) The resource type. + - `created_at` - (String) The date and time that this snapshot consistency group was created. + - `crn` - (String) The CRN of this snapshot consistency group. + - `delete_snapshots_on_delete` - (Boolean) Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. + - `href` - (String) The URL for this snapshot consistency group. + - `id` - (String) The unique identifier for this snapshot consistency group. + - `lifecycle_state` - (String) The lifecycle state of this snapshot consistency group. + - `name` - (String) The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the region. + - `resource_group` - (List) The resource group identifier for this snapshot consistency group. + - `resource_type` - (String) The resource type. + - `service_tags` - (List) The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags)[`is.instance:` prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-faqs) associated with this snapshot consistency group. + - `snapshots` - (List) The member snapshots that are data-consistent with respect to captured time. (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + + Nested schema for `snapshots`: + - `crn` - (String) The CRN of this snapshot. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. + + Nested schema for `deleted`: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this snapshot. + - `id` - (String) The unique identifier for this snapshot. + - `name` - (String) The name for this snapshot. The name is unique across all snapshots in the region. + - `remote` - (List) If present, this property indicates that the resource associated with this referenceis remote and therefore may not be directly retrievable. + + Nested schema for `remote`: + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. + - `resource_type` - (String) The resource type. diff --git a/website/docs/d/is_snapshots.html.markdown b/website/docs/d/is_snapshots.html.markdown index 13f958492d..5c05317e70 100644 --- a/website/docs/d/is_snapshots.html.markdown +++ b/website/docs/d/is_snapshots.html.markdown @@ -37,8 +37,10 @@ Review the argument references that you can specify for your data source. - `resource_group` - (Optional, String) Filter snapshot collection by resource group id of the snapshot. - `source_image` - (Optional, String) Filter snapshot collection by source image of the snapshot. - `source_volume` - (Optional, String) Filter snapshot collection by source volume of the snapshot. -- `backup_policy_plan_tag` - Filters the collection to resources with the exact tag value. -- `backup_policy_plan_id` - Filters the collection to backup policy jobs with the backup plan with the specified identifier +- `backup_policy_plan_tag` - (Optional, String)Filters the collection to resources with the exact tag value. +- `backup_policy_plan_id` - (Optional, String)Filters the collection to backup policy jobs with the backup plan with the specified identifier +- `snapshot_consistency_group_id` - (Optional, String)Filters the collection to snapshots with snapshot consistency group with the specified identifier. +- `snapshot_consistency_group_crn` - (Optional, String)Filters the collection to snapshots with snapshot consistency group with the specified identifier. - `snapshot_copies_id` - Filters the collection to snapshots with copies with the specified identifier. - `snapshot_copies_name` - Filters the collection to snapshots with copies with the exact specified name. - `snapshot_copies_crn` - Filters the collection to snapshots with copies with the specified CRN. @@ -94,6 +96,18 @@ In addition to all argument reference list, you can access the following attribu - `operating_system` - (String) The globally unique name for the operating system included in this image. - `resource_type` - (String) The resource type. - `size` - (Integer) The size of this snapshot rounded up to the next gigabyte. + - `snapshot_consistency_group` - (List) The snapshot consistency group which created this snapshot. + + Nested scheme for `snapshot_consistency_group`: + - `crn` - (String) The CRN of this snapshot consistency group. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. + + Nested scheme for `deleted`: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for the snapshot consistency group. + - `id` - (String) The unique identifier for the snapshot consistency group. + - `name` - (String) TThe name for the snapshot consistency group. The name is unique across all snapshot consistency groups in the region. + - `resource_type` - (String) The resource type. - `source_image` - (String) If present, the unique identifier for the image from which the data on this volume was most directly provisioned. - `source_snapshot` - (String) If present, the source snapshot this snapshot was created from. diff --git a/website/docs/r/is_backup_policy.html.markdown b/website/docs/r/is_backup_policy.html.markdown index 2f079c364b..aa0a61b83d 100644 --- a/website/docs/r/is_backup_policy.html.markdown +++ b/website/docs/r/is_backup_policy.html.markdown @@ -46,12 +46,16 @@ resource "ibm_is_backup_policy" "ent-baas-example1" { ## Argument Reference Review the argument reference that you can specify for your resource. +- `included_content` - (Optional, List) The included content for backups created using this policy. Allowed values are `boot_volume`, `data_volumes`. +~> **Note** + `boot_volume`: Include the instance's boot volume.
+ `data_volumes`: Include the instance's data volumes. - `match_resource_types` - (Optional, List) A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will be subject to the backup policy. The default value is `["volume"]`. - + ~> **Note** `match_resource_types` is deprecated. Please use `match_resource_type` instead. -- `match_resource_type` - (Optional, String) 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. The default value is `["volume"]`. +- `match_resource_type` - (Optional, String) 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. The default value is `["volume"]`. Allowed values are `volume`,`instance`. - `match_user_tags` - (Required, List) 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. - `name` - (Required, String) The user-defined name for this backup policy. Names must be unique within the region this backup policy resides in. - `resource_group` - (Optional, List) The resource group id, to use. If unspecified, the account's [default resource group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. diff --git a/website/docs/r/is_snapshot.html.markdown b/website/docs/r/is_snapshot.html.markdown index 6c4fd4801c..59b901b598 100644 --- a/website/docs/r/is_snapshot.html.markdown +++ b/website/docs/r/is_snapshot.html.markdown @@ -159,6 +159,18 @@ In addition to all argument reference list, you can access the following attribu - `operating_system` - (String) The globally unique name for an Operating System included in this image. - `resource_type` - (String) The resource type. - `size` - (Integer) The size of this snapshot rounded up to the next gigabyte. +- `snapshot_consistency_group` - (List) The snapshot consistency group which created this snapshot. + + Nested scheme for `snapshot_consistency_group`: + - `crn` - (String) The CRN of this snapshot consistency group. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. + + Nested scheme for `deleted`: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for the snapshot consistency group. + - `id` - (String) The unique identifier for the snapshot consistency group. + - `name` - (String) TThe name for the snapshot consistency group. The name is unique across all snapshot consistency groups in the region. + - `resource_type` - (String) The resource type. - `source_image` - (String) If present, the unique identifier for the image from which the data on this volume was most directly provisioned. - `source_snapshot` - (String) If present, the source snapshot this snapshot was created from. diff --git a/website/docs/r/is_snapshot_consistency_group.html.markdown b/website/docs/r/is_snapshot_consistency_group.html.markdown new file mode 100644 index 0000000000..18f944945a --- /dev/null +++ b/website/docs/r/is_snapshot_consistency_group.html.markdown @@ -0,0 +1,119 @@ +--- +subcategory: "VPC infrastructure" +layout: "ibm" +page_title: "IBM : ibm_is_snapshot_consistency_group" +description: |- + Manages SnapshotConsistencyGroup. +--- + +# ibm_is_snapshot_consistency_group + +Create, update, and delete SnapshotConsistencyGroups with this resource. For more information, about snapshot consistency group, see [creating snapshot consistency group](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-create). + +**Note** +VPC infrastructure services are a regional specific based endpoint, by default targets to `us-south`. Please make sure to target right region in the provider block as shown in the `provider.tf` file, if VPC service is created in region other than `us-south`. + +**provider.tf** + +```terraform +provider "ibm" { + region = "eu-gb" +} +``` + +## Example Usage + +```terraform +resource "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group" { + delete_snapshots_on_delete = true + snapshots { + name = "example-snapshot" + source_volume = ibm_is_instance.testacc_instance.volume_attachments[0].volume_id + } + name = "example-snapshot-consistency-group" +} +``` + +## Argument Reference + +You can specify the following arguments for this resource. + +- `access_tags` - (Optional, List of Strings) A list of access management tags to attach to the bare metal server. + + ~> **Note:** + **•** You can attach only those access tags that already exists.
+ **•** For more information, about creating access tags, see [working with tags](https://cloud.ibm.com/docs/account?topic=account-tag&interface=ui#create-access-console).
+ **•** You must have the access listed in the [Granting users access to tag resources](https://cloud.ibm.com/docs/account?topic=account-access) for `access_tags`
+ **•** `access_tags` must be in the format `key:value`. +- `delete_snapshots_on_delete` - (Optional, Boolean) Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. +- `name` - (Optional, String) The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the region. +- `resource_group` - (Optional, Forces new resource, String) The resource group ID where the snapshot consistency group is to be created. +- `snapshots` - (Required, List) The member snapshots that are data-consistent with respect to captured time. (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + + Nested schema for `snapshots`: + - `name` - (Optional, String) The name for this snapshot. + - `source_volume` - (Required, Forces new resource, String) The unique identifier for the volume for which snapshot is to be created. + - `tags`- (Optional, Array of Strings) A list of user tags that you want to add to your snapshot. (https://cloud.ibm.com/apidocs/tagging#types-of-tags) +- `tags`- (Optional, Array of Strings) A list of user tags that you want to add to your snapshot. (https://cloud.ibm.com/apidocs/tagging#types-of-tags) + + +## Attribute Reference + +After your resource is created, you can read values from the listed arguments and the following attributes. + +- `id` - The unique identifier of the SnapshotConsistencyGroup. +- `backup_policy_plan` - (List) If present, the backup policy plan which created this snapshot consistency group. + + Nested scheme for `backup_policy_plan`: + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. + + Nested scheme for `deleted`: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for this backup policy plan. + - `id` - (String) The unique identifier for this backup policy plan. + - `name` - (String) The unique user defined name for this backup policy plan. If unspecified, the name will be a hyphenated list of randomly selected words. + - `resource_type` - (String) The type of resource referenced. + - `remote` - (List) If present, this property indicates that the resource associated with this referenceis remote and therefore may not be directly retrievable. + + Nested schema for `remote`: + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. + +- `created_at` - (String) The date and time that this snapshot consistency group was created. +- `crn` - (String) The CRN of this snapshot consistency group. +- `href` - (String) The URL for this snapshot consistency group. +- `lifecycle_state` - (String) The lifecycle state of this snapshot consistency group. +- `resource_type` - (String) The resource type. +- `snapshots_reference` - (List) The member snapshots that are data-consistent with respect to captured time. (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + + Nested scheme for `snapshots_reference`: + - `crn` - (String) The CRN of the source snapshot. + - `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. + + Nested scheme for `deleted`: + - `more_info` - (String) Link to documentation about deleted resources. + - `href` - (String) The URL for the source snapshot. + - `id` - (String) The unique identifier for the source snapshot. + - `name` - (String) The name for the source snapshot. The name is unique across all snapshots in the source snapshot's native region. + - `remote` - (List) If present, this property indicates the referenced resource is remote to this region,and identifies the native region + + Nested scheme for `remote`: + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. + - `resource_type` - (String) The resource type. +- `service_tags` - (List) The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags)[`is.instance:` prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-faqs) associated with this snapshot consistency group. + + +## Import + +You can import the `ibm_is_snapshot_consistency_group` resource by using `id`. The unique identifier for this snapshot consistency group. + +# Syntax +``` +$ terraform import ibm_is_snapshot_consistency_group.is_snapshot_consistency_group +``` + +# Example +``` +$ terraform import ibm_is_snapshot_consistency_group.is_snapshot_consistency_group r134-fa329f6b-0e36-433f-a3bb-0df632e79263 +``` From fa7de25e2721073cdb481fa4b656ef63e5c1d8f4 Mon Sep 17 00:00:00 2001 From: IDAN ADAR Date: Wed, 13 Dec 2023 13:57:14 +0200 Subject: [PATCH 102/132] Fix typo in filename --- ...as_secret.go => resource_ibm_sm_service_credentials_secret.go} | 0 ...test.go => resource_ibm_sm_service_credentials_secret_test.go} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename ibm/service/secretsmanager/{resource_ibm_sm_service_credentilas_secret.go => resource_ibm_sm_service_credentials_secret.go} (100%) rename ibm/service/secretsmanager/{resource_ibm_sm_service_credentilas_secret_test.go => resource_ibm_sm_service_credentials_secret_test.go} (100%) diff --git a/ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret.go b/ibm/service/secretsmanager/resource_ibm_sm_service_credentials_secret.go similarity index 100% rename from ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret.go rename to ibm/service/secretsmanager/resource_ibm_sm_service_credentials_secret.go diff --git a/ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret_test.go b/ibm/service/secretsmanager/resource_ibm_sm_service_credentials_secret_test.go similarity index 100% rename from ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret_test.go rename to ibm/service/secretsmanager/resource_ibm_sm_service_credentials_secret_test.go From fb2917e3a9830070d2c8c19dae9dac0b96238a1b Mon Sep 17 00:00:00 2001 From: hkantare Date: Wed, 13 Dec 2023 18:39:44 +0530 Subject: [PATCH 103/132] fix detect secret marking false positive --- .secrets.baseline | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index dfa3b8db5b..f3e03c0153 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.mod|go.sum|.*.map|^.secrets.baseline$", "lines": null }, - "generated_at": "2023-12-11T16:26:19Z", + "generated_at": "2023-12-13T13:08:16Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -760,7 +760,7 @@ "hashed_secret": "731438016c5ab94431f61820f35e3ae5f8ad6004", "is_secret": false, "is_verified": false, - "line_number": 417, + "line_number": 426, "type": "Secret Keyword", "verified_result": null }, @@ -768,7 +768,7 @@ "hashed_secret": "12da2e35d6b50c902c014f1ab9e3032650368df7", "is_secret": false, "is_verified": false, - "line_number": 423, + "line_number": 432, "type": "Secret Keyword", "verified_result": null }, @@ -776,7 +776,7 @@ "hashed_secret": "813274ccae5b6b509379ab56982d862f7b5969b6", "is_secret": false, "is_verified": false, - "line_number": 1128, + "line_number": 1143, "type": "Base64 High Entropy String", "verified_result": null } @@ -786,7 +786,7 @@ "hashed_secret": "9184b0c38101bf24d78b2bb0d044deb1d33696fc", "is_secret": false, "is_verified": false, - "line_number": 131, + "line_number": 132, "type": "Secret Keyword", "verified_result": null }, @@ -794,7 +794,7 @@ "hashed_secret": "c427f185ddcb2440be9b77c8e45f1cd487a2e790", "is_secret": false, "is_verified": false, - "line_number": 1438, + "line_number": 1451, "type": "Base64 High Entropy String", "verified_result": null }, @@ -802,7 +802,7 @@ "hashed_secret": "1f7e33de15e22de9d2eaf502df284ed25ca40018", "is_secret": false, "is_verified": false, - "line_number": 1505, + "line_number": 1518, "type": "Secret Keyword", "verified_result": null }, @@ -810,7 +810,7 @@ "hashed_secret": "1f614c2eb6b3da22d89bd1b9fd47d7cb7c8fc670", "is_secret": false, "is_verified": false, - "line_number": 3298, + "line_number": 3338, "type": "Secret Keyword", "verified_result": null }, @@ -818,7 +818,7 @@ "hashed_secret": "7abfce65b8504403afc25c9790f358d513dfbcc6", "is_secret": false, "is_verified": false, - "line_number": 3311, + "line_number": 3351, "type": "Secret Keyword", "verified_result": null }, @@ -826,7 +826,7 @@ "hashed_secret": "0c2d85bf9a9b1579b16f220a4ea8c3d62b2e24b1", "is_secret": false, "is_verified": false, - "line_number": 3352, + "line_number": 3392, "type": "Secret Keyword", "verified_result": null } @@ -864,7 +864,7 @@ "hashed_secret": "c8b6f5ef11b9223ac35a5663975a466ebe7ebba9", "is_secret": false, "is_verified": false, - "line_number": 1806, + "line_number": 1838, "type": "Secret Keyword", "verified_result": null }, @@ -872,7 +872,7 @@ "hashed_secret": "8abf4899c01104241510ba87685ad4de76b0c437", "is_secret": false, "is_verified": false, - "line_number": 1812, + "line_number": 1844, "type": "Secret Keyword", "verified_result": null } @@ -3789,7 +3789,7 @@ "verified_result": null } ], - "ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret.go": [ + "ibm/service/secretsmanager/resource_ibm_sm_service_credentials_secret.go": [ { "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, @@ -5010,7 +5010,7 @@ } ] }, - "version": "0.13.1+ibm.61.dss", + "version": "0.13.1+ibm.51.dss", "word_list": { "file": null, "hash": null From cb423dc702cc886a364f671bb85f2a705db39489 Mon Sep 17 00:00:00 2001 From: alex hemard Date: Thu, 14 Dec 2023 10:37:14 -0600 Subject: [PATCH 104/132] feat(Cloud Databases): Redis Database User RBAC support (#4982) --- .secrets.baseline | 50 +++- go.mod | 2 +- go.sum | 4 +- ibm/service/database/resource_ibm_database.go | 229 ++++++++++++++---- .../resource_ibm_database_redis_test.go | 22 +- .../database/resource_ibm_database_test.go | 90 ++++++- website/docs/r/database.html.markdown | 2 +- 7 files changed, 327 insertions(+), 72 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index f3e03c0153..cb30966a3b 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.mod|go.sum|.*.map|^.secrets.baseline$", "lines": null }, - "generated_at": "2023-12-13T13:08:16Z", + "generated_at": "2023-12-14T01:01:48Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -2056,7 +2056,7 @@ "hashed_secret": "deab23f996709b4e3d14e5499d1cc2de677bfaa8", "is_secret": false, "is_verified": false, - "line_number": 1334, + "line_number": 1367, "type": "Secret Keyword", "verified_result": null }, @@ -2064,7 +2064,7 @@ "hashed_secret": "20a25bac21219ffff1904bde871ded4027eca2f8", "is_secret": false, "is_verified": false, - "line_number": 1923, + "line_number": 1957, "type": "Secret Keyword", "verified_result": null }, @@ -2072,7 +2072,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 1942, + "line_number": 1976, "type": "Secret Keyword", "verified_result": null }, @@ -2080,7 +2080,7 @@ "hashed_secret": "1f5e25be9b575e9f5d39c82dfd1d9f4d73f1975c", "is_secret": false, "is_verified": false, - "line_number": 2155, + "line_number": 2189, "type": "Secret Keyword", "verified_result": null } @@ -2224,7 +2224,15 @@ "hashed_secret": "2317aa72dafa0a07f05af47baa2e388f95dcf6f3", "is_secret": false, "is_verified": false, - "line_number": 272, + "line_number": 273, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "44cdfc3615970ada14420caaaa5c5745fca06002", + "is_secret": false, + "is_verified": false, + "line_number": 277, "type": "Secret Keyword", "verified_result": null } @@ -2234,7 +2242,7 @@ "hashed_secret": "c237978e1983e0caf1c3a84f1c2e72a7fb2981f2", "is_secret": false, "is_verified": false, - "line_number": 19, + "line_number": 20, "type": "Secret Keyword", "verified_result": null }, @@ -2242,7 +2250,7 @@ "hashed_secret": "d67007844d8f7fbc45ea3b27c4bea0bffafb53a0", "is_secret": false, "is_verified": false, - "line_number": 27, + "line_number": 28, "type": "Secret Keyword", "verified_result": null }, @@ -2250,7 +2258,7 @@ "hashed_secret": "279fb854eb9fa001b4629518a45c921cfad6d697", "is_secret": false, "is_verified": false, - "line_number": 35, + "line_number": 36, "type": "Secret Keyword", "verified_result": null }, @@ -2258,7 +2266,7 @@ "hashed_secret": "dad6fac3e5b6be7bb6f274970b4c50739a7e26ee", "is_secret": false, "is_verified": false, - "line_number": 59, + "line_number": 60, "type": "Secret Keyword", "verified_result": null }, @@ -2266,7 +2274,7 @@ "hashed_secret": "8cbbbfad0206e5953901f679b0d26d583c4f5ffe", "is_secret": false, "is_verified": false, - "line_number": 67, + "line_number": 68, "type": "Secret Keyword", "verified_result": null }, @@ -2274,7 +2282,7 @@ "hashed_secret": "f5ecb30890399c7b1d1781583478aaa9d0b0c89d", "is_secret": false, "is_verified": false, - "line_number": 91, + "line_number": 92, "type": "Secret Keyword", "verified_result": null }, @@ -2282,7 +2290,23 @@ "hashed_secret": "6da9eab371358a331c59a76d80a0ffcd589fe3c9", "is_secret": false, "is_verified": false, - "line_number": 101, + "line_number": 102, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "1f5e25be9b575e9f5d39c82dfd1d9f4d73f1975c", + "is_secret": false, + "is_verified": false, + "line_number": 163, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "e03932ac8a17ed1819fe161fd253bf323e0e3ec9", + "is_secret": false, + "is_verified": false, + "line_number": 172, "type": "Secret Keyword", "verified_result": null } diff --git a/go.mod b/go.mod index 638e7af953..4d51f3409c 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca github.com/IBM/appconfiguration-go-admin-sdk v0.3.0 github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f - github.com/IBM/cloud-databases-go-sdk v0.3.2 + github.com/IBM/cloud-databases-go-sdk v0.4.0 github.com/IBM/cloudant-go-sdk v0.0.43 github.com/IBM/code-engine-go-sdk v0.0.0-20231106200405-99e81b3ee752 github.com/IBM/container-registry-go-sdk v1.1.0 diff --git a/go.sum b/go.sum index dd2b86dde3..7f4070efcc 100644 --- a/go.sum +++ b/go.sum @@ -118,8 +118,8 @@ github.com/IBM/appconfiguration-go-admin-sdk v0.3.0 h1:OqFxnDxro0JiRwHBKytCcseY2 github.com/IBM/appconfiguration-go-admin-sdk v0.3.0/go.mod h1:xPxAYhr/uywUIDEo/JqWbkUdTryPdzRdYBfUpA5IjoE= github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f h1:4c1kqY4GqmkQ+tO03rneDb74Tv7BhTj8jDiDB1p8mdM= github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f/go.mod h1:d22kTYY7RYBWcQlZpqrSdshpB/lJ16viWS5Sbjtlc8s= -github.com/IBM/cloud-databases-go-sdk v0.3.2 h1:AUi7/xswqCwuXIlSyuXtDZJIm4d0ZicUBHhPrE9TnH0= -github.com/IBM/cloud-databases-go-sdk v0.3.2/go.mod h1:nCIVfeZnhBYIiwByT959dFP4VWUeNLxomDYy63tTC6M= +github.com/IBM/cloud-databases-go-sdk v0.4.0 h1:pmmMbJb/axolBEpCqq85idcZiimAOTacCyLUfAhXCqI= +github.com/IBM/cloud-databases-go-sdk v0.4.0/go.mod h1:nCIVfeZnhBYIiwByT959dFP4VWUeNLxomDYy63tTC6M= github.com/IBM/cloudant-go-sdk v0.0.43 h1:YxTy4RpAEezX32YIWnds76hrBREmO4u6IkBz1WylNuQ= github.com/IBM/cloudant-go-sdk v0.0.43/go.mod h1:WeYrJPaHTw19943ndWnVfwMIlZ5z0XUM2uEXNBrwZ1M= github.com/IBM/code-engine-go-sdk v0.0.0-20231106200405-99e81b3ee752 h1:S5NT0aKKUqd9hnIrPN/qUijKx9cZjJi3kfFpog0ByDA= diff --git a/ibm/service/database/resource_ibm_database.go b/ibm/service/database/resource_ibm_database.go index aa2808dcbe..8b70da011a 100644 --- a/ibm/service/database/resource_ibm_database.go +++ b/ibm/service/database/resource_ibm_database.go @@ -14,6 +14,7 @@ import ( "reflect" "regexp" "sort" + "strconv" "strings" "time" @@ -57,20 +58,53 @@ const ( ) const ( - redisRBACRoleRegexPattern = `([+-][a-z]+\s?)+` + redisRBACRoleRegexPattern = `[+-]@(?P[a-z]+)` ) type DatabaseUser struct { Username string Password string - Role string + Role *string Type string } +type databaseUserValidationError struct { + user *DatabaseUser + errs []error +} + +func (e *databaseUserValidationError) Error() string { + if len(e.errs) == 0 { + return "" + } + + var b []byte + for i, err := range e.errs { + if i > 0 { + b = append(b, '\n') + } + b = append(b, err.Error()...) + } + + return fmt.Sprintf("database user (%s) validation error:\n%s", e.user.Username, string(b)) +} + +func (e *databaseUserValidationError) Unwrap() []error { + return e.errs +} + type userChange struct { Old, New *DatabaseUser } +func redisRBACAllowedRoles() []string { + return []string{"all", "admin", "read", "write"} +} + +func opsManagerRoles() []string { + return []string{"group_read_only", "group_data_access_admin"} +} + func retry(f func() error) (err error) { attempts := 3 @@ -296,11 +330,10 @@ func ResourceIBMDatabaseInstance() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{"database", "ops_manager", "read_only_replica"}, false), }, "role": { - Description: "User role. Only available for ops_manager user type.", - Type: schema.TypeString, - Optional: true, - Sensitive: false, - ValidateFunc: validation.StringInSlice([]string{"group_read_only", "group_data_access_admin"}, false), + Description: "User role. Only available for ops_manager user type and Redis 6.0 and above.", + Type: schema.TypeString, + Optional: true, + Sensitive: false, }, }, }, @@ -1330,23 +1363,23 @@ func resourceIBMDatabaseInstanceCreate(context context.Context, d *schema.Resour adminUser := deployment.AdminUsernames["database"] - user := &clouddatabasesv5.APasswordSettingUser{ + user := &clouddatabasesv5.UserUpdatePasswordSetting{ Password: &adminPassword, } - changeUserPasswordOptions := &clouddatabasesv5.ChangeUserPasswordOptions{ + updateUserOptions := &clouddatabasesv5.UpdateUserOptions{ ID: core.StringPtr(instanceID), UserType: core.StringPtr("database"), Username: core.StringPtr(adminUser), User: user, } - changeUserPasswordResponse, response, err := cloudDatabasesClient.ChangeUserPassword(changeUserPasswordOptions) + updateUserResponse, response, err := cloudDatabasesClient.UpdateUser(updateUserOptions) if err != nil { - return diag.FromErr(fmt.Errorf("[ERROR] ChangeUserPassword (%s) failed %s\n%s", *changeUserPasswordOptions.Username, err, response)) + return diag.FromErr(fmt.Errorf("[ERROR] UpdateUser (%s) failed %s\n%s", *updateUserOptions.Username, err, response)) } - taskID := *changeUserPasswordResponse.Task.ID + taskID := *updateUserResponse.Task.ID _, err = waitForDatabaseTaskComplete(taskID, d, meta, d.Timeout(schema.TimeoutCreate)) if err != nil { @@ -1919,23 +1952,24 @@ func resourceIBMDatabaseInstanceUpdate(context context.Context, d *schema.Resour if d.HasChange("adminpassword") { adminUser := d.Get("adminuser").(string) password := d.Get("adminpassword").(string) - user := &clouddatabasesv5.APasswordSettingUser{ + + user := &clouddatabasesv5.UserUpdatePasswordSetting{ Password: &password, } - changeUserPasswordOptions := &clouddatabasesv5.ChangeUserPasswordOptions{ + updateUserOptions := &clouddatabasesv5.UpdateUserOptions{ ID: core.StringPtr(instanceID), UserType: core.StringPtr("database"), Username: core.StringPtr(adminUser), User: user, } - changeUserPasswordResponse, response, err := cloudDatabasesClient.ChangeUserPassword(changeUserPasswordOptions) + updateUserResponse, response, err := cloudDatabasesClient.UpdateUser(updateUserOptions) if err != nil { - return diag.FromErr(fmt.Errorf("[ERROR] ChangeUserPassword (%s) failed %s\n%s", *changeUserPasswordOptions.Username, err, response)) + return diag.FromErr(fmt.Errorf("[ERROR] UpdateUser (%s) failed %s\n%s", *updateUserOptions.Username, err, response)) } - taskID := *changeUserPasswordResponse.Task.ID + taskID := *updateUserResponse.Task.ID _, err = waitForDatabaseTaskComplete(taskID, d, meta, d.Timeout(schema.TimeoutUpdate)) if err != nil { @@ -2813,6 +2847,28 @@ func validateGroupsDiff(_ context.Context, diff *schema.ResourceDiff, meta inter } func validateUsersDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) (err error) { + service := diff.Get("service").(string) + + var versionStr string + var version int + + if _version, ok := diff.GetOk("version"); ok { + versionStr = _version.(string) + } + + if versionStr == "" { + // Latest Version + version = 0 + } else { + _v, err := strconv.ParseFloat(versionStr, 64) + + if err != nil { + return fmt.Errorf("invalid version: %s", versionStr) + } + + version = int(_v) + } + oldUsers, newUsers := diff.GetChange("users") userChanges := expandUserChanges(oldUsers.(*schema.Set).List(), newUsers.(*schema.Set).List()) @@ -2822,14 +2878,34 @@ func validateUsersDiff(_ context.Context, diff *schema.ResourceDiff, meta interf } if change.isCreate() || change.isUpdate() { - err = change.New.Validate() + err = change.New.ValidatePassword() + + if err != nil { + return err + } + + // TODO: Use Capability API + // RBAC roles supported for Redis 6.0 and above + if service == "databases-for-redis" && !(version > 0 && version < 6) { + err = change.New.ValidateRBACRole() + } else if service == "databases-for-mongodb" && change.New.Type == "ops_manager" { + err = change.New.ValidateOpsManagerRole() + } else { + if change.New.Role != nil { + if *change.New.Role != "" { + err = errors.New("role is not supported for this deployment or user type") + err = &databaseUserValidationError{user: change.New, errs: []error{err}} + } + } + } + if err != nil { return err } } } - return nil + return } func expandUsers(_users []interface{}) []*DatabaseUser { @@ -2845,10 +2921,17 @@ func expandUsers(_users []interface{}) []*DatabaseUser { user := DatabaseUser{ Username: tfUser["name"].(string), Password: tfUser["password"].(string), - Role: tfUser["role"].(string), Type: tfUser["type"].(string), } + // NOTE: cannot differentiate nil vs empty string + // https://github.com/hashicorp/terraform-plugin-sdk/issues/741 + if role, ok := tfUser["role"].(string); ok { + if tfUser["role"] != "" { + user.Role = &role + } + } + users = append(users, &user) } } @@ -2875,8 +2958,8 @@ func expandUserChanges(_oldUsers []interface{}, _newUsers []interface{}) (userCh userChanges = make([]*userChange, 0, len(userChangeMap)) - for _, user := range userChangeMap { - userChanges = append(userChanges, user) + for _, change := range userChangeMap { + userChanges = append(userChanges, change) } return userChanges @@ -2913,9 +2996,9 @@ func (u *DatabaseUser) Create(instanceID string, d *schema.ResourceData, meta in Password: core.StringPtr(u.Password), } - // User Role only for ops_manager user type - if u.Type == "ops_manager" && u.Role != "" { - userEntry.Role = core.StringPtr(u.Role) + // User Role only for ops_manager user type and Redis 6.0 and above + if u.Role != nil { + userEntry.Role = u.Role } createDatabaseUserOptions := &clouddatabasesv5.CreateDatabaseUserOptions{ @@ -2947,30 +3030,34 @@ func (u *DatabaseUser) Update(instanceID string, d *schema.ResourceData, meta in } // Attempt to update user password - passwordSettingUser := &clouddatabasesv5.APasswordSettingUser{ + user := &clouddatabasesv5.UserUpdate{ Password: core.StringPtr(u.Password), } - changeUserPasswordOptions := &clouddatabasesv5.ChangeUserPasswordOptions{ + if u.Role != nil { + user.Role = u.Role + } + + updateUserOptions := &clouddatabasesv5.UpdateUserOptions{ ID: &instanceID, UserType: core.StringPtr(u.Type), Username: core.StringPtr(u.Username), - User: passwordSettingUser, + User: user, } - changeUserPasswordResponse, response, err := cloudDatabasesClient.ChangeUserPassword(changeUserPasswordOptions) + updateUserResponse, response, err := cloudDatabasesClient.UpdateUser(updateUserOptions) // user was found but an error occurs while triggering task if err != nil || (response.StatusCode < 200 || response.StatusCode >= 300) { - return fmt.Errorf("[ERROR] ChangeUserPassword (%s) failed %w\n%s", *changeUserPasswordOptions.Username, err, response) + return fmt.Errorf("[ERROR] UpdateUser (%s) failed %w\n%s", *updateUserOptions.Username, err, response) } - taskID := *changeUserPasswordResponse.Task.ID + taskID := *updateUserResponse.Task.ID _, err = waitForDatabaseTaskComplete(taskID, d, meta, d.Timeout(schema.TimeoutUpdate)) if err != nil { return fmt.Errorf( - "[ERROR] Error waiting for database (%s) user (%s) create task to complete: %w", instanceID, *changeUserPasswordOptions.Username, err) + "[ERROR] Error waiting for database (%s) user (%s) create task to complete: %w", instanceID, *updateUserOptions.Username, err) } return nil @@ -3011,7 +3098,7 @@ func (u *DatabaseUser) isUpdatable() bool { return u.Type != "ops_manager" } -func (u *DatabaseUser) Validate() error { +func (u *DatabaseUser) ValidatePassword() (err error) { var errs []error var specialChars string @@ -3063,24 +3150,84 @@ func (u *DatabaseUser) Validate() error { } if len(errs) == 0 { - return nil + return } - var b []byte - for i, err := range errs { - if i > 0 { - b = append(b, '\n') + return &databaseUserValidationError{user: u, errs: errs} +} + +func (u *DatabaseUser) ValidateRBACRole() (err error) { + var errs []error + + if u.Role == nil || *u.Role == "" { + return + } + + if u.Type != "database" { + errs = append(errs, errors.New("role is only allowed for the database user")) + return &databaseUserValidationError{user: u, errs: errs} + } + + redisRBACCategoryRegex := regexp.MustCompile(redisRBACRoleRegexPattern) + redisRBACRoleRegex := regexp.MustCompile(fmt.Sprintf(`^(%s\s?)+$`, redisRBACRoleRegexPattern)) + + if !redisRBACRoleRegex.MatchString(*u.Role) { + errs = append(errs, errors.New("role must be in the format +@category or -@category")) + } + + matches := redisRBACCategoryRegex.FindAllStringSubmatch(*u.Role, -1) + + for _, match := range matches { + valid := false + role := match[1] + for _, allowed := range redisRBACAllowedRoles() { + if role == allowed { + valid = true + break + } } - b = append(b, err.Error()...) + + if !valid { + errs = append(errs, fmt.Errorf("role must contain only allowed categories: %s", strings.Join(redisRBACAllowedRoles()[:], ","))) + break + } + } + + if len(errs) == 0 { + return } - return fmt.Errorf("database user (%s) validation error:\n%w", u.Username, errors.New(string(b))) + return &databaseUserValidationError{user: u, errs: errs} +} + +func (u *DatabaseUser) ValidateOpsManagerRole() (err error) { + if u.Role == nil { + return + } + + if u.Type != "ops_manager" { + return + } + + if *u.Role == "" { + return + } + + for _, str := range opsManagerRoles() { + if *u.Role == str { + return + } + } + + err = fmt.Errorf("role must be a valid ops_manager role: %s", strings.Join(opsManagerRoles()[:], ",")) + + return &databaseUserValidationError{user: u, errs: []error{err}} } func DatabaseUserPasswordValidator(userType string) schema.SchemaValidateFunc { return func(i interface{}, k string) (warnings []string, errors []error) { user := &DatabaseUser{Username: "admin", Type: userType, Password: i.(string)} - err := user.Validate() + err := user.ValidatePassword() if err != nil { errors = append(errors, err) } diff --git a/ibm/service/database/resource_ibm_database_redis_test.go b/ibm/service/database/resource_ibm_database_redis_test.go index 64eec792a7..22366d31fe 100644 --- a/ibm/service/database/resource_ibm_database_redis_test.go +++ b/ibm/service/database/resource_ibm_database_redis_test.go @@ -70,14 +70,15 @@ func TestAccIBMDatabaseInstance_Redis_Basic(t *testing.T) { ), }, { - Config: testAccCheckIBMDatabaseInstanceRedisGroupMigration(databaseResourceGroup, testName), + Config: testAccCheckIBMDatabaseInstanceRedisUserRole(databaseResourceGroup, testName), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(name, "name", testName), resource.TestCheckResourceAttr(name, "service", "databases-for-redis"), resource.TestCheckResourceAttr(name, "plan", "standard"), resource.TestCheckResourceAttr(name, "location", acc.Region()), - resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "2048"), - resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "4096"), + resource.TestCheckResourceAttr(name, "users.#", "1"), + resource.TestCheckResourceAttr(name, "users.0.name", "coolguy"), + resource.TestCheckResourceAttr(name, "users.0.role", "-@all +@read"), resource.TestCheckResourceAttr(name, "allowlist.#", "0"), ), }, @@ -257,7 +258,7 @@ func testAccCheckIBMDatabaseInstanceRedisReduced(databaseResourceGroup string, n `, databaseResourceGroup, name, acc.Region()) } -func testAccCheckIBMDatabaseInstanceRedisGroupMigration(databaseResourceGroup string, name string) string { +func testAccCheckIBMDatabaseInstanceRedisUserRole(databaseResourceGroup string, name string) string { return fmt.Sprintf(` data "ibm_resource_group" "test_acc" { is_default = true @@ -271,15 +272,10 @@ func testAccCheckIBMDatabaseInstanceRedisGroupMigration(databaseResourceGroup st location = "%[3]s" adminpassword = "password12345678" - group { - group_id = "member" - - memory { - allocation_mb = 1024 - } - disk { - allocation_mb = 2048 - } + users { + name = "coolguy" + password = "securepassword123" + role = "-@all +@read" } } `, databaseResourceGroup, name, acc.Region()) diff --git a/ibm/service/database/resource_ibm_database_test.go b/ibm/service/database/resource_ibm_database_test.go index d5633469a8..5e58458d58 100644 --- a/ibm/service/database/resource_ibm_database_test.go +++ b/ibm/service/database/resource_ibm_database_test.go @@ -4,6 +4,7 @@ package database import ( + "github.com/IBM/go-sdk-core/v5/core" "gotest.tools/assert" "testing" ) @@ -95,7 +96,7 @@ func TestValidateUserPassword(t *testing.T) { }, } for _, tc := range testcases { - err := tc.user.Validate() + err := tc.user.ValidatePassword() if tc.expectedError == "" { if err != nil { t.Errorf("TestValidateUserPassword: %q, %q unexpected error: %q", tc.user.Username, tc.user.Password, err.Error()) @@ -105,3 +106,90 @@ func TestValidateUserPassword(t *testing.T) { } } } + +func TestValidateRBACRole(t *testing.T) { + testcases := []struct { + user DatabaseUser + expectedError string + }{ + { + user: DatabaseUser{ + Username: "invalid_format", + Password: "", + Type: "database", + Role: core.StringPtr("+admin -all"), + }, + expectedError: "database user (invalid_format) validation error:\nrole must be in the format +@category or -@category", + }, + { + user: DatabaseUser{ + Username: "invalid_operation", + Password: "", + Type: "database", + Role: core.StringPtr("~@admin"), + }, + expectedError: "database user (invalid_operation) validation error:\nrole must be in the format +@category or -@category", + }, + { + user: DatabaseUser{ + Username: "invalid_category", + Password: "", + Type: "database", + Role: core.StringPtr("+@catfood -@dogfood"), + }, + expectedError: "database user (invalid_category) validation error:\nrole must contain only allowed categories: all,admin,read,write", + }, + { + user: DatabaseUser{ + Username: "one_bad_apple", + Password: "", + Type: "database", + Role: core.StringPtr("-@jazz +@read"), + }, + expectedError: "database user (one_bad_apple) validation error:\nrole must contain only allowed categories: all,admin,read,write", + }, + { + user: DatabaseUser{ + Username: "invalid_user_type", + Password: "", + Type: "ops_manager", + Role: core.StringPtr("+@all"), + }, + expectedError: "database user (invalid_user_type) validation error:\nrole is only allowed for the database user", + }, + { + user: DatabaseUser{ + Username: "valid", + Password: "", + Type: "database", + Role: core.StringPtr("-@all +@read"), + }, + expectedError: "", + }, + { + user: DatabaseUser{ + Username: "blank_role", + Password: "-@all +@read", + Type: "database", + Role: core.StringPtr(""), + }, + expectedError: "", + }, + } + for _, tc := range testcases { + err := tc.user.ValidateRBACRole() + if tc.expectedError == "" { + if err != nil { + t.Errorf("TestValidateRBACRole: %q, %q unexpected error: %q", tc.user.Username, *tc.user.Role, err.Error()) + } + } else { + var errMsg string + + if err != nil { + errMsg = err.Error() + } + + assert.Equal(t, tc.expectedError, errMsg) + } + } +} diff --git a/website/docs/r/database.html.markdown b/website/docs/r/database.html.markdown index b27f42deab..cfa9e61d86 100644 --- a/website/docs/r/database.html.markdown +++ b/website/docs/r/database.html.markdown @@ -684,7 +684,7 @@ Review the argument reference that you can specify for your resource. - `name` - (Required, String) The user name to add to the database instance. The user name must be in the range 5 - 32 characters. - `password` - (Required, String) The password for the user. Passwords must be between 15 and 32 characters in length and contain a letter and a number. Users with an `ops_manager` user type must have a password containing a special character `~!@#$%^&*()=+[]{}|;:,.<>/?_-` as well as a letter and a number. Other user types may only use special characters `-_`. - `type` - (Optional, String) The type for the user. Examples: `database`, `ops_manager`, `read_only_replica`. The default value is `database`. - - `role` - (Optional, String) The role for the user. Only available for `ops_manager` user type. Examples: `group_read_only`, `group_data_access_admin`. + - `role` - (Optional, String) The role for the user. Only available for `ops_manager` user type or Redis 6.0 and above. Example roles for `ops_manager`: `group_read_only`, `group_data_access_admin`. For, Redis 6.0 and above, `role` must be in Redis ACL syntax for adding and removing command categories i.e. `+@category` or `-@category`. Allowed command categories are `all`, `admin`, `read`, `write`. Example Redis `role`: `-@all +@read` - `allowlist` - (Optional, List of Objects) A list of allowed IP addresses for the database. Multiple blocks are allowed. From 5c583630df2303c64faf02ec71701ddc237f7546 Mon Sep 17 00:00:00 2001 From: alex hemard Date: Thu, 14 Dec 2023 14:11:55 -0600 Subject: [PATCH 105/132] fix(Cloud Databases): fix Unwrap return value for go 1.18 compat (#4991) Signed-off-by: Alex Hemard --- ibm/service/database/resource_ibm_database.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ibm/service/database/resource_ibm_database.go b/ibm/service/database/resource_ibm_database.go index 8b70da011a..e554580a2a 100644 --- a/ibm/service/database/resource_ibm_database.go +++ b/ibm/service/database/resource_ibm_database.go @@ -89,8 +89,13 @@ func (e *databaseUserValidationError) Error() string { return fmt.Sprintf("database user (%s) validation error:\n%s", e.user.Username, string(b)) } -func (e *databaseUserValidationError) Unwrap() []error { - return e.errs +func (e *databaseUserValidationError) Unwrap() error { + if e == nil || len(e.errs) == 0 { + return nil + } + + // only return the first + return e.errs[0] } type userChange struct { From 0fc44097bb635409cbb8c6edc84509e3b7ec35d0 Mon Sep 17 00:00:00 2001 From: SunithaGudisagar <127872893+SunithaGudisagarIBM1@users.noreply.github.com> Date: Mon, 18 Dec 2023 08:05:09 +0530 Subject: [PATCH 106/132] update issue fixed ibm_is_subnet_reserved_ip (#4988) --- ibm/service/vpc/resource_ibm_is_subnet_reserved_ip.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ibm/service/vpc/resource_ibm_is_subnet_reserved_ip.go b/ibm/service/vpc/resource_ibm_is_subnet_reserved_ip.go index bfe20059a8..9c8523bc22 100644 --- a/ibm/service/vpc/resource_ibm_is_subnet_reserved_ip.go +++ b/ibm/service/vpc/resource_ibm_is_subnet_reserved_ip.go @@ -303,6 +303,11 @@ func resourceIBMISReservedIPUpdate(d *schema.ResourceData, meta interface{}) err if err != nil { return fmt.Errorf("[ERROR] Error updating the reserved IP %s\n%s", err, response) } + + _, err = isWaitForReservedIpAvailable(sess, subnetID, reservedIPID, d.Timeout(schema.TimeoutCreate), d) + if err != nil { + return fmt.Errorf("[ERROR] Error waiting for the reserved IP to be available: %s", err) + } } return resourceIBMISReservedIPRead(d, meta) } From 1141256a6e34d2a1a310cb5b1aff0acbddb1171d Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Sun, 17 Dec 2023 20:37:34 -0600 Subject: [PATCH 107/132] Adding Flexible IOPS (#4992) * - Add IOPs to volume - Update documentation - Make strorageType required for COS import - Update Volume Create Disk Type Required - Update Create Instance Storeage Type to Required - vol_upd_iops_level * Update version to 1.5.6 * update documentation * update power version --------- Co-authored-by: michael kad --- go.mod | 22 ++++---- go.sum | 53 ++++++++----------- .../power/data_source_ibm_pi_volume.go | 6 +++ ibm/service/power/resource_ibm_pi_image.go | 4 +- ibm/service/power/resource_ibm_pi_instance.go | 4 +- .../power/resource_ibm_pi_instance_test.go | 4 +- ibm/service/power/resource_ibm_pi_volume.go | 28 ++++++---- .../power/resource_ibm_pi_volume_test.go | 49 +++++++++++++++++ website/docs/d/pi_volume.html.markdown | 1 + website/docs/r/pi_image.html.markdown | 5 +- website/docs/r/pi_instance.html.markdown | 4 +- website/docs/r/pi_volume.html.markdown | 4 +- 12 files changed, 122 insertions(+), 62 deletions(-) diff --git a/go.mod b/go.mod index 4d51f3409c..6cd9232669 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231116055201-2a84da7b9bd6 - github.com/IBM-Cloud/power-go-client v1.5.4 + github.com/IBM-Cloud/power-go-client v1.5.7 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca github.com/IBM/appconfiguration-go-admin-sdk v0.3.0 github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f @@ -24,7 +24,7 @@ require ( github.com/IBM/ibm-hpcs-uko-sdk v0.0.20-beta github.com/IBM/keyprotect-go-client v0.12.2 github.com/IBM/networking-go-sdk v0.42.2 - github.com/IBM/platform-services-go-sdk v0.54.0 + github.com/IBM/platform-services-go-sdk v0.55.0 github.com/IBM/project-go-sdk v0.1.4 github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 github.com/IBM/scc-go-sdk/v5 v5.1.3 @@ -38,10 +38,10 @@ require ( github.com/apache/openwhisk-client-go v0.0.0-20200201143223-a804fb82d105 github.com/apparentlymart/go-cidr v1.1.0 github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 - github.com/go-openapi/strfmt v0.21.7 + github.com/go-openapi/strfmt v0.21.9 github.com/golang-jwt/jwt v3.2.2+incompatible github.com/google/go-cmp v0.6.0 - github.com/google/uuid v1.3.0 + github.com/google/uuid v1.4.0 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.6.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 @@ -100,17 +100,17 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/go-jose/go-jose/v3 v3.0.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/analysis v0.21.4 // indirect github.com/go-openapi/errors v0.20.4 // indirect - github.com/go-openapi/jsonpointer v0.19.5 // indirect - github.com/go-openapi/jsonreference v0.20.0 // indirect + github.com/go-openapi/jsonpointer v0.20.0 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/loads v0.21.2 // indirect github.com/go-openapi/runtime v0.26.0 // indirect - github.com/go-openapi/spec v0.20.8 // indirect + github.com/go-openapi/spec v0.20.11 // indirect github.com/go-openapi/swag v0.22.4 // indirect - github.com/go-openapi/validate v0.22.1 // indirect + github.com/go-openapi/validate v0.22.3 // indirect github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect @@ -202,7 +202,7 @@ require ( github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/zclconf/go-cty v1.14.1 // indirect - go.mongodb.org/mongo-driver v1.12.1 // indirect + go.mongodb.org/mongo-driver v1.13.1 // indirect go.opentelemetry.io/otel v1.14.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect go.uber.org/ratelimit v0.2.0 // indirect @@ -241,4 +241,4 @@ exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible k8s.io/client-go v12.0.0+incompatible -) \ No newline at end of file +) diff --git a/go.sum b/go.sum index 7f4070efcc..dbb75845d1 100644 --- a/go.sum +++ b/go.sum @@ -103,13 +103,11 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3 github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc h1:AeooCa6UMWycgKJ9n0do9PEZaNlYZZHqspfwUzPvopc= github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc/go.mod h1:jIGLnIfj+uBv2ALz3rVHzNbNwt0V/bEWNeJKECa8Q+k= -github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c h1:tRS4VuOG3lHNG+yrsh3vZZQDVNLuFJB0oZbTJp9YXds= -github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231116055201-2a84da7b9bd6 h1:QXU1Atl/JSI3ZtYB9tHbWLhrFYE1E+5Iww1sjQ7mqdo= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231116055201-2a84da7b9bd6/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs= -github.com/IBM-Cloud/power-go-client v1.5.4 h1:fk+QgOdZvwq696UynehfGrMGMHXDYOJfRCE3Pec9o6c= -github.com/IBM-Cloud/power-go-client v1.5.4/go.mod h1:ZsKqKC4d4MAWujkttW1w9tG7xjlIbkIpVENX476ghVY= +github.com/IBM-Cloud/power-go-client v1.5.7 h1:B1EOApEtlOb7tjZkAg9g8GTZthFKmjNU8XqONocBw7c= +github.com/IBM-Cloud/power-go-client v1.5.7/go.mod h1:jsa4ujstGjKWbfu3SQML8KLJDvpGZLErWnlmfKKCQrs= github.com/IBM-Cloud/softlayer-go v1.0.5-tf h1:koUAyF9b6X78lLLruGYPSOmrfY2YcGYKOj/Ug9nbKNw= github.com/IBM-Cloud/softlayer-go v1.0.5-tf/go.mod h1:6HepcfAXROz0Rf63krk5hPZyHT6qyx2MNvYyHof7ik4= github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca h1:crniVcf+YcmgF03NmmfonXwSQ73oJF+IohFYBwknMxs= @@ -160,8 +158,8 @@ github.com/IBM/mqcloud-go-sdk v0.0.0-20231207105140-14d858932788 h1:cIT0YSzqMGqx github.com/IBM/mqcloud-go-sdk v0.0.0-20231207105140-14d858932788/go.mod h1:R4NBbDMygpHiFywUnOdV0UfBZap4HcHa3QXLlACr9TU= github.com/IBM/networking-go-sdk v0.42.2 h1:caqjx4jyFHi10Vlf3skHvlL6K3YJRVstsmCBmvdyqkA= github.com/IBM/networking-go-sdk v0.42.2/go.mod h1:lTUZwtUkMANMnrLHFIgRhHrkBfwASY/Iho1fabaPHxo= -github.com/IBM/platform-services-go-sdk v0.54.0 h1:WjHWm9ZAJvlq07E1WXXtEe+d/B0sazWD6cEWVT7EMLU= -github.com/IBM/platform-services-go-sdk v0.54.0/go.mod h1:CWSprvsCsXWvujmBzbtoJSmbRZS9FVV3O594b0t/GiM= +github.com/IBM/platform-services-go-sdk v0.55.0 h1:W598xZanL61bwd8O2DQexr4qjIr+/tP0Y845zoms5yA= +github.com/IBM/platform-services-go-sdk v0.55.0/go.mod h1:CWSprvsCsXWvujmBzbtoJSmbRZS9FVV3O594b0t/GiM= github.com/IBM/project-go-sdk v0.1.4 h1:QGehJxpp/QqfrBYSmN2FRYwuGejlHlVscB/9QGQfdLk= github.com/IBM/project-go-sdk v0.1.4/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig= github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 h1:NPUhkoOCRuv3OFWt19PmwjXGGTKlvmbuPg9fUrBUNe4= @@ -176,8 +174,6 @@ github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2 h1:+Svh1OmoFxMBnZQSOUtp2UUzrOGFs github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2/go.mod h1:WII+LS4VkQYykmq65NWSuPb5xGNvsqkcK1aCWZoU2x4= github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc= github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA= -github.com/IBM/vpc-go-sdk v0.43.0 h1:uy/qWIqETCXraUG2cq5sjScr6pZ79ZteY1v5iLUVQ3Q= -github.com/IBM/vpc-go-sdk v0.43.0/go.mod h1:kRz9tqPvpHoA/qGrC/qVjTbi4ICuTChpG76L89liGL4= github.com/IBM/vpc-go-sdk v0.45.0 h1:RFbUZH5vBRGAEW5+jRzbDlxB+a+GvG9EBhyYO52Tvrs= github.com/IBM/vpc-go-sdk v0.45.0/go.mod h1:4Hs5d/aClmsxAzwDQkwG+ri0vW2ykPJdpM6hDLRwKcA= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= @@ -483,8 +479,9 @@ github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTg github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v0.1.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= @@ -497,14 +494,12 @@ github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpR github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU= -github.com/go-openapi/analysis v0.21.2/go.mod h1:HZwRk4RRisyG8vx2Oe6aqeSQcoxRp47Xkp3+K6q+LdY= github.com/go-openapi/analysis v0.21.4 h1:ZDFLvSNxpDaomuCueM0BlSXxpANBlFYiBvr+GXrvIHc= github.com/go-openapi/analysis v0.21.4/go.mod h1:4zQ35W4neeZTqh3ol0rv/O8JBbka9QyAgQRPp9y3pfo= github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.20.0/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.20.3/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk= @@ -515,22 +510,23 @@ github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwds github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ= +github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA= github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= -github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= -github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= github.com/go-openapi/loads v0.19.4/go.mod h1:zZVHonKd8DXyxyw4yfnVjPzBjIQcLt0CCsn0N0ZrQsk= -github.com/go-openapi/loads v0.21.1/go.mod h1:/DtAMXXneXFjbQMGEtbamCZb+4x7eGwkvZCvBmwUG+g= github.com/go-openapi/loads v0.21.2 h1:r2a/xFIYeZ4Qd2TnGpWDIQNcP80dIaZgf704za8enro= github.com/go-openapi/loads v0.21.2/go.mod h1:Jq58Os6SSGz0rzh62ptiu8Z31I+OTHqmULx5e/gJbNw= github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= @@ -543,10 +539,9 @@ github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsd github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= -github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= -github.com/go-openapi/spec v0.20.8 h1:ubHmXNY3FCIOinT8RNrrPfGc9t7I1qhPtdOGoG2AxRU= -github.com/go-openapi/spec v0.20.8/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= +github.com/go-openapi/spec v0.20.11 h1:J/TzFDLTt4Rcl/l1PmyErvkqlJDncGvPTMnCI39I4gY= +github.com/go-openapi/spec v0.20.11/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= @@ -555,12 +550,12 @@ github.com/go-openapi/strfmt v0.19.4/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk github.com/go-openapi/strfmt v0.19.10/go.mod h1:qBBipho+3EoIqn6YDI+4RnQEtj6jT/IdKm+PAlXxSUc= github.com/go-openapi/strfmt v0.20.1/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk= github.com/go-openapi/strfmt v0.20.2/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk= -github.com/go-openapi/strfmt v0.21.0/go.mod h1:ZRQ409bWMj+SOgXofQAGTIo2Ebu72Gs+WaRADcS5iNg= github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= github.com/go-openapi/strfmt v0.21.2/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= -github.com/go-openapi/strfmt v0.21.7 h1:rspiXgNWgeUzhjo1YU01do6qsahtJNByjLVbPLNHb8k= github.com/go-openapi/strfmt v0.21.7/go.mod h1:adeGTkxE44sPyLk0JV235VQAO/ZXUr8KAzYjclFs3ew= +github.com/go-openapi/strfmt v0.21.9 h1:LnEGOO9qyEC1v22Bzr323M98G13paIUGPU7yeJtG9Xs= +github.com/go-openapi/strfmt v0.21.9/go.mod h1:0k3v301mglEaZRJdDDGSlN6Npq4VMVU69DE0LUyf7uA= github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= @@ -568,13 +563,14 @@ github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= -github.com/go-openapi/validate v0.22.1 h1:G+c2ub6q47kfX1sOBLwIQwzBVt8qmOAARyo/9Fqs9NU= -github.com/go-openapi/validate v0.22.1/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg= +github.com/go-openapi/validate v0.22.3 h1:KxG9mu5HBRYbecRb37KRCihvGGtND2aXziBAv0NNfyI= +github.com/go-openapi/validate v0.22.3/go.mod h1:kVxh31KbfsxU8ZyoHaDbLBWU5CnMdqBUEtadQ2G4d5M= github.com/go-ozzo/ozzo-validation v3.6.0+incompatible h1:msy24VGS42fKO9K1vLz82/GeYW1cILu7Nuuj1N3BBkE= github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es= github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew= @@ -737,8 +733,9 @@ github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= @@ -1275,7 +1272,6 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/onsi/gomega v1.18.0/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= @@ -1418,7 +1414,7 @@ github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rook/rook v1.11.4 h1:V5+r8JnVpSCdWGZ8eV5zUX1SnMTgCnz3azux+7Jefzc= github.com/rook/rook v1.11.4/go.mod h1:RwQdIZvb7BGomy9yR9caWYCoT8pHngYsxBXg6Fl8LZk= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= @@ -1570,12 +1566,11 @@ go.mongodb.org/mongo-driver v1.2.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qL go.mongodb.org/mongo-driver v1.4.2/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= go.mongodb.org/mongo-driver v1.5.1/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= go.mongodb.org/mongo-driver v1.7.0/go.mod h1:Q4oFMbo1+MSNqICAdYMlC/zSTrwCogR4R8NzkI+yfU8= -go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= go.mongodb.org/mongo-driver v1.11.3/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g= -go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE= -go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ= +go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk= +go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= go.opencensus.io v0.19.1/go.mod h1:gug0GbSHa8Pafr0d2urOSgoXHZ6x/RUlaiT0d9pqb4A= go.opencensus.io v0.19.2/go.mod h1:NO/8qkisMZLZ1FCsKNqtJPwc8/TaclWyY0B6wcYNg9M= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1747,7 +1742,6 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -1885,7 +1879,6 @@ golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/ibm/service/power/data_source_ibm_pi_volume.go b/ibm/service/power/data_source_ibm_pi_volume.go index faa1d47a0f..f54ccd75db 100644 --- a/ibm/service/power/data_source_ibm_pi_volume.go +++ b/ibm/service/power/data_source_ibm_pi_volume.go @@ -110,6 +110,11 @@ func DataSourceIBMPIVolume() *schema.Resource { Computed: true, Description: "Indicates master volume name", }, + "io_throttle_rate": { + Type: schema.TypeString, + Computed: true, + Description: "Amount of iops assigned to the volume", + }, }, } } @@ -145,6 +150,7 @@ func dataSourceIBMPIVolumeRead(ctx context.Context, d *schema.ResourceData, meta d.Set("primary_role", volumedata.PrimaryRole) d.Set("auxiliary_volume_name", volumedata.AuxVolumeName) d.Set("master_volume_name", volumedata.MasterVolumeName) + d.Set("io_throttle_rate", volumedata.IoThrottleRate) return nil } diff --git a/ibm/service/power/resource_ibm_pi_image.go b/ibm/service/power/resource_ibm_pi_image.go index 3f83a8df26..f2f5ab423c 100644 --- a/ibm/service/power/resource_ibm_pi_image.go +++ b/ibm/service/power/resource_ibm_pi_image.go @@ -113,13 +113,13 @@ func ResourceIBMPIImage() *schema.Resource { helpers.PIImageStorageType: { Type: schema.TypeString, Optional: true, - Description: "Type of storage", + Description: "Type of storage; If not specified, default is tier3", ForceNew: true, }, helpers.PIImageStoragePool: { Type: schema.TypeString, Optional: true, - Description: "Storage pool where the image will be loaded, if provided then pi_image_storage_type and pi_affinity_policy will be ignored", + Description: "Storage pool where the image will be loaded, if provided then pi_affinity_policy will be ignored", ForceNew: true, }, PIAffinityPolicy: { diff --git a/ibm/service/power/resource_ibm_pi_instance.go b/ibm/service/power/resource_ibm_pi_instance.go index 610bf44813..37236ed8ae 100644 --- a/ibm/service/power/resource_ibm_pi_instance.go +++ b/ibm/service/power/resource_ibm_pi_instance.go @@ -101,13 +101,13 @@ func ResourceIBMPIInstance() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - Description: "Storage type for server deployment", + Description: "Storage type for server deployment; if pi_storage_type is not provided the storage type will default to tier3", }, PIInstanceStoragePool: { Type: schema.TypeString, Optional: true, Computed: true, - Description: "Storage Pool for server deployment; if provided then pi_affinity_policy and pi_storage_type will be ignored", + Description: "Storage Pool for server deployment; if provided then pi_storage_pool_affinity will be ignored; Only valid when you deploy one of the IBM supplied stock images. Storage pool for a custom image (an imported image or an image that is created from a VM capture) defaults to the storage pool the image was created in", }, PIAffinityPolicy: { Type: schema.TypeString, diff --git a/ibm/service/power/resource_ibm_pi_instance_test.go b/ibm/service/power/resource_ibm_pi_instance_test.go index 9e5555fadd..d28e294322 100644 --- a/ibm/service/power/resource_ibm_pi_instance_test.go +++ b/ibm/service/power/resource_ibm_pi_instance_test.go @@ -41,6 +41,7 @@ func testAccCheckIBMPIInstanceConfig(name, instanceHealthStatus string) string { pi_volume_name = "%[2]s" pi_volume_shareable = true pi_volume_pool = data.ibm_pi_image.power_image.storage_pool + pi_volume_type = "%[6]s" pi_cloud_instance_id = "%[1]s" } resource "ibm_pi_instance" "power_instance" { @@ -53,13 +54,14 @@ func testAccCheckIBMPIInstanceConfig(name, instanceHealthStatus string) string { pi_sys_type = "s922" pi_cloud_instance_id = "%[1]s" pi_storage_pool = data.ibm_pi_image.power_image.storage_pool + pi_storage_type = "%[6]s" pi_health_status = "%[5]s" pi_volume_ids = [ibm_pi_volume.power_volume.volume_id] pi_network { network_id = data.ibm_pi_network.power_networks.id } } - `, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name, instanceHealthStatus) + `, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name, instanceHealthStatus, acc.PiStorageType) } func testAccCheckIBMPIInstanceUserDataConfig(name, instanceHealthStatus string) string { diff --git a/ibm/service/power/resource_ibm_pi_volume.go b/ibm/service/power/resource_ibm_pi_volume.go index 9ceae9e174..c80b9c2790 100644 --- a/ibm/service/power/resource_ibm_pi_volume.go +++ b/ibm/service/power/resource_ibm_pi_volume.go @@ -51,7 +51,7 @@ func ResourceIBMPIVolume() *schema.Resource { helpers.PIVolumeShareable: { Type: schema.TypeBool, Optional: true, - Description: "Flag to indicate if the volume can be shared across multiple instances?", + Description: "Flag to indicate if the volume can be shared across multiple instances.", }, helpers.PIVolumeSize: { Type: schema.TypeFloat, @@ -62,16 +62,16 @@ func ResourceIBMPIVolume() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - ValidateFunc: validate.ValidateAllowedStringValues([]string{"ssd", "standard", "tier1", "tier3"}), + ValidateFunc: validate.ValidateAllowedStringValues([]string{"tier0", "tier1", "tier3", "tier5k"}), DiffSuppressFunc: flex.ApplyOnce, - Description: "Type of Disk, required if pi_affinity_policy and pi_volume_pool not provided, otherwise ignored", + Description: "Type of disk, if disk type is not provided the disk type will default to tier3", }, helpers.PIVolumePool: { Type: schema.TypeString, Optional: true, Computed: true, DiffSuppressFunc: flex.ApplyOnce, - Description: "Volume pool where the volume will be created; if provided then pi_volume_type and pi_affinity_policy values will be ignored", + Description: "Volume pool where the volume will be created; if provided then pi_affinity_policy values will be ignored", }, PIAffinityPolicy: { Type: schema.TypeString, @@ -184,6 +184,11 @@ func ResourceIBMPIVolume() *schema.Resource { Computed: true, Description: "Indicates master volume name", }, + "io_throttle_rate": { + Type: schema.TypeString, + Computed: true, + Description: "Amount of iops assigned to the volume", + }, }, } } @@ -320,6 +325,7 @@ func resourceIBMPIVolumeRead(ctx context.Context, d *schema.ResourceData, meta i } d.Set("wwn", vol.Wwn) d.Set(helpers.PICloudInstanceId, cloudInstanceID) + d.Set("io_throttle_rate", vol.IoThrottleRate) return nil } @@ -357,12 +363,16 @@ func resourceIBMPIVolumeUpdate(ctx context.Context, d *schema.ResourceData, meta return diag.FromErr(err) } - if d.HasChange(helpers.PIReplicationEnabled) { - replicationEnabled := d.Get(helpers.PIReplicationEnabled).(bool) - volActionBody := models.VolumeAction{ - ReplicationEnabled: &replicationEnabled, + if d.HasChanges(helpers.PIReplicationEnabled, helpers.PIVolumeType) { + var replicationEnabled bool + volActionBody := models.VolumeAction{} + if v, ok := d.GetOk(helpers.PIReplicationEnabled); ok { + replicationEnabled = v.(bool) + volActionBody.ReplicationEnabled = &replicationEnabled + } + if v, ok := d.GetOk(helpers.PIVolumeType); ok { + volActionBody.TargetStorageTier = flex.PtrToString(v.(string)) } - err = client.VolumeAction(volumeID, &volActionBody) if err != nil { return diag.FromErr(err) diff --git a/ibm/service/power/resource_ibm_pi_volume_test.go b/ibm/service/power/resource_ibm_pi_volume_test.go index df5119f75c..5622b183ec 100644 --- a/ibm/service/power/resource_ibm_pi_volume_test.go +++ b/ibm/service/power/resource_ibm_pi_volume_test.go @@ -214,6 +214,55 @@ func testAccCheckIBMPIVolumeGRSBasicConfig(name, piCloudInstanceId, piStoragePoo pi_volume_shareable = true pi_cloud_instance_id = "%[2]s" pi_replication_enabled = %[4]v + pi_volume_type = "tier3" } `, name, piCloudInstanceId, piStoragePool, replicationEnabled) } + +// TestAccIBMPIVolumeUpdate test the volume update +func TestAccIBMPIVolumeUpdate(t *testing.T) { + name := fmt.Sprintf("tf-pi-volume-%d", acctest.RandIntRange(10, 100)) + sType := acc.PiStorageType // tier 3 + sTypeUpdate := "tier1" + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMPIVolumeDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMPIVolumeUpdateStorageConfig(name, sType), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMPIVolumeExists("ibm_pi_volume.power_volume"), + resource.TestCheckResourceAttr( + "ibm_pi_volume.power_volume", "pi_volume_name", name), + ), + }, + { + Config: testAccCheckIBMPIVolumeUpdateStorageConfig(name, sTypeUpdate), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMPIVolumeExists("ibm_pi_volume.power_volume"), + resource.TestCheckResourceAttr( + "ibm_pi_volume.power_volume", "pi_volume_name", name), + resource.TestCheckResourceAttrSet("ibm_pi_volume.power_volume", "pi_volume_type"), + ), + }, + }, + }) +} + +func testAccCheckIBMPIVolumeUpdateStorageConfig(name, piStorageType string) string { + return testAccCheckIBMPIVolumeUpdateBasicConfig(name, acc.Pi_cloud_instance_id, acc.PiStoragePool, piStorageType) +} + +func testAccCheckIBMPIVolumeUpdateBasicConfig(name, piCloudInstanceId, piStoragePool, piStorageType string) string { + return fmt.Sprintf(` + resource "ibm_pi_volume" "power_volume"{ + pi_volume_size = 20 + pi_volume_name = "%[1]s" + pi_volume_pool = "%[3]s" + pi_volume_shareable = true + pi_cloud_instance_id = "%[2]s" + pi_volume_type = "%[4]v" + } + `, name, piCloudInstanceId, piStoragePool, piStorageType) +} diff --git a/website/docs/d/pi_volume.html.markdown b/website/docs/d/pi_volume.html.markdown index 1147a6d164..4d4ef82032 100644 --- a/website/docs/d/pi_volume.html.markdown +++ b/website/docs/d/pi_volume.html.markdown @@ -60,3 +60,4 @@ In addition to all argument reference list, you can access the following attribu - `state` - (String) The state of the volume. - `volume_pool` - (String) Volume pool, name of storage pool where the volume is located. - `wwn` - (String) The world wide name of the volume. +- `io_throttle_rate` -(String) Amount of iops assigned to the volume. diff --git a/website/docs/r/pi_image.html.markdown b/website/docs/r/pi_image.html.markdown index ecdc35a01b..d7558bcea4 100644 --- a/website/docs/r/pi_image.html.markdown +++ b/website/docs/r/pi_image.html.markdown @@ -78,9 +78,8 @@ Review the argument references that you can specify for your resource. - `pi_image_bucket_region` is required with `pi_image_bucket_name` - `pi_image_secret_key` - (Optional, String, Sensitive) Cloud Object Storage secret key; required for buckets with private access. - `pi_image_secret_key` is required with `pi_image_access_key` -- `pi_image_storage_pool` - (Optional, String) Storage pool where the image will be loaded, if provided then `pi_image_storage_type` and `pi_affinity_policy` will be ignored. -- `pi_image_storage_type` - (Optional, String) Type of storage. Will be ignored if `pi_image_storage_pool` or `pi_affinity_policy` is provided. If only using `pi_image_storage_type` for storage selection then the storage pool with the most available space will be selected. - +- `pi_image_storage_pool` - (Optional, String) Storage pool where the image will be loaded, if provided then `pi_affinity_policy` will be ignored. Used only when importing an image from cloud storage. +- `pi_image_storage_type` - (Optional, String) Type of storage; If not provided the storage type will default to 'tier3'. Used only when importing an image from cloud storage. ## Attribute reference In addition to all argument reference list, you can access the following attribute reference after your resource is created. diff --git a/website/docs/r/pi_instance.html.markdown b/website/docs/r/pi_instance.html.markdown index 1001d49f34..429320d53d 100644 --- a/website/docs/r/pi_instance.html.markdown +++ b/website/docs/r/pi_instance.html.markdown @@ -93,9 +93,9 @@ Review the argument references that you can specify for your resource. - Required only when creating SAP instances. - `pi_sap_deployment_type` - (Optional, String) Custom SAP deployment type information (For Internal Use Only). - `pi_shared_processor_pool` - (Optional, String) The shared processor pool for instance deployment. Conflicts with `pi_sap_profile_id`. -- `pi_storage_pool` - (Optional, String) Storage Pool for server deployment; if provided then `pi_affinity_policy` and `pi_storage_type` will be ignored. +- `pi_storage_pool` - (Optional, String) Storage Pool for server deployment; if provided then `pi_affinity_policy` will be ignored; Only valid when you deploy one of the IBM supplied stock images. Storage pool for a custom image (an imported image or an image that is created from a VM capture) defaults to the storage pool the image was created in. - `pi_storage_pool_affinity` - (Optional, Bool) Indicates if all volumes attached to the server must reside in the same storage pool. The default value is `true`. To attach data volumes from a different storage pool (mixed storage) set to `false` and use `pi_volume_attach` resource. Once set to `false`, cannot be set back to `true` unless all volumes attached reside in the same storage type and pool. -- `pi_storage_type` - (Optional, String) - Storage type for server deployment. Only valid when you deploy one of the IBM supplied stock images. Storage type for a custom image (an imported image or an image that is created from a VM capture) defaults to the storage type the image was created in +- `pi_storage_type` - (Optional, String) - Storage type for server deployment; If storage type is not provided the storage type will default to `tier3`. - `pi_storage_connection` - (Optional, String) - Storage Connectivity Group (SCG) for server deployment. Only supported value is `vSCSI`. - `pi_sys_type` - (Optional, String) The type of system on which to create the VM (s922/e880/e980/s1022). - Supported SAP system types are (e880/e980). diff --git a/website/docs/r/pi_volume.html.markdown b/website/docs/r/pi_volume.html.markdown index 31ca91e018..60b0ac5cc0 100644 --- a/website/docs/r/pi_volume.html.markdown +++ b/website/docs/r/pi_volume.html.markdown @@ -57,10 +57,10 @@ Review the argument references that you can specify for your resource. - `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. - `pi_replication_enabled` - (Optional, Bool) Indicates if the volume should be replication enabled or not. - `pi_volume_name` - (Required, String) The name of the volume. -- `pi_volume_pool` - (Optional, String) Volume pool where the volume will be created; if provided then `pi_volume_type` and `pi_affinity_policy` values will be ignored. +- `pi_volume_pool` - (Optional, String) Volume pool where the volume will be created; if provided then `pi_affinity_policy` values will be ignored. - `pi_volume_shareable` - (Required, Bool) If set to **true**, the volume can be shared across Power Systems Virtual Server instances. If set to **false**, you can attach it only to one instance. - `pi_volume_size` - (Required, Integer) The size of the volume in gigabytes. -- `pi_volume_type` - (Optional, String) Type of Disk, required if `pi_affinity_policy` and `pi_volume_pool` not provided, otherwise ignored. Supported values are `ssd`, `standard`, `tier1`, and `tier3`. +- `pi_volume_type` - (Optional, String) Type of disk, if diskType is not provided the disk type will default to `tier3`. ## Attribute reference In addition to all argument reference list, you can access the following attribute reference after your resource is created. From c72e9f8758a57cb2f223fe0f435e09e43cfd0dbf Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Sun, 17 Dec 2023 20:38:31 -0600 Subject: [PATCH 108/132] Removing Support For Power VPN Create (#4993) * Add Deprectated for VPN Create * Update text * Update version to 1.5.6 * Update version to 1.5.6 * update power version --------- Co-authored-by: michael kad --- website/docs/r/pi_vpn_connection.html.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/docs/r/pi_vpn_connection.html.markdown b/website/docs/r/pi_vpn_connection.html.markdown index 06a2b1d428..2b63272631 100644 --- a/website/docs/r/pi_vpn_connection.html.markdown +++ b/website/docs/r/pi_vpn_connection.html.markdown @@ -8,8 +8,10 @@ description: |- --- # ibm_pi_vpn_connection -Create, update, or delete a VPN connection. For more information, about IBM power virtual server cloud, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started). +Update or delete a VPN connection. For more information, about IBM power virtual server cloud, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started). +~> **Deprecated:** + Create VPN connection is deprecated and no longer supported. Existing `pi_vpn_connection` will still have support for `update` and `delete`. ## Example usage The following example creates a VPN Connection. From fc7ba35bd4e804077660c9a2bd5c883603c4cfbd Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Mon, 18 Dec 2023 08:30:06 +0530 Subject: [PATCH 109/132] Feature(share-crr): Share cross region replication (#4995) * feature(share-crr): Share cross region replication * sdk updates * updated last sync options * updated sdk and latest_sync * updated schema and doc * tf example * doc and schema correction * acceptance test * sdk changes * updated sdk * added nil check * doc link added * remove common folder sdk * doc update --- examples/ibm-is-ng/main.tf | 9 +- go.mod | 2 +- go.sum | 2 + ibm/acctest/acctest.go | 14 +++ ibm/service/vpc/data_source_ibm_is_share.go | 36 +++++++- ibm/service/vpc/data_source_ibm_is_shares.go | 35 ++++++++ ibm/service/vpc/resource_ibm_is_share.go | 89 ++++++++++++++----- ibm/service/vpc/resource_ibm_is_share_test.go | 35 +++++++- website/docs/d/is_share.html.markdown | 7 +- website/docs/d/is_shares.html.markdown | 7 +- website/docs/r/is_share.html.markdown | 28 +++++- 11 files changed, 236 insertions(+), 28 deletions(-) diff --git a/examples/ibm-is-ng/main.tf b/examples/ibm-is-ng/main.tf index 896216cc78..c344f98a6c 100644 --- a/examples/ibm-is-ng/main.tf +++ b/examples/ibm-is-ng/main.tf @@ -1408,7 +1408,14 @@ resource "ibm_is_image_obsolete" "example" { image = ibm_is_image.image1.id } - +resource "ibm_is_share" "share" { + zone = "us-east-1" + source_share_crn = "crn:v1:staging:public:is:us-south-1:a/efe5afc483594adaa8325e2b4d1290df::share:r134-d8c8821c-a227-451d-a9ed-0c0cd2358829" + encryption_key = "crn:v1:staging:public:kms:us-south:a/efe5afc483594adaa8325e2b4d1290df:1be45161-6dae-44ca-b248-837f98004057:key:3dd21cc5-cc20-4f7c-bc62-8ec9a8a3d1bd" + replication_cron_spec = "5 * * * *" + name = "tfp-temp-crr" + profile = "dp2" +} //snapshot consistency group resource "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group_instance" { diff --git a/go.mod b/go.mod index 6cd9232669..04a09410f2 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/IBM/schematics-go-sdk v0.2.2 github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2 github.com/IBM/vpc-beta-go-sdk v0.6.0 - github.com/IBM/vpc-go-sdk v0.45.0 + github.com/IBM/vpc-go-sdk v0.46.0 github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5 github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 github.com/akamai/AkamaiOPEN-edgegrid-golang/v5 v5.0.0 diff --git a/go.sum b/go.sum index dbb75845d1..656b4b77ba 100644 --- a/go.sum +++ b/go.sum @@ -176,6 +176,8 @@ github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQy github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA= github.com/IBM/vpc-go-sdk v0.45.0 h1:RFbUZH5vBRGAEW5+jRzbDlxB+a+GvG9EBhyYO52Tvrs= github.com/IBM/vpc-go-sdk v0.45.0/go.mod h1:4Hs5d/aClmsxAzwDQkwG+ri0vW2ykPJdpM6hDLRwKcA= +github.com/IBM/vpc-go-sdk v0.46.0 h1:OwXH3oaYgYmzt559n77AteSpNsW4H1PoeHcR4EOolzk= +github.com/IBM/vpc-go-sdk v0.46.0/go.mod h1:4Hs5d/aClmsxAzwDQkwG+ri0vW2ykPJdpM6hDLRwKcA= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 4968af4c8a..8a90bdea06 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -104,6 +104,8 @@ var ( DedicatedHostGroupFamily string DedicatedHostGroupClass string ShareProfileName string + SourceShareCRN string + ShareEncryptionKey string VNIId string VolumeProfileName string VSIUnattachedBootVolumeID string @@ -848,6 +850,18 @@ func init() { fmt.Println("[INFO] Set the environment variable IS_SHARE_PROFILE for testing ibm_is_instance resource else it is set to default value 'tier-3iops'") } + SourceShareCRN = os.Getenv("IS_SOURCE_SHARE_CRN") + if SourceShareCRN == "" { + SourceShareCRN = "crn:v1:staging:public:is:us-east-1:a/efe5afc483594adaa8325e2b4d1290df::share:r142-a106f162-86e4-4d7f-be75-193cc55a93e9" // for next gen infrastructure + fmt.Println("[INFO] Set the environment variable IS_SHARE_PROFILE for testing ibm_is_instance resource else it is set to default value") + } + + ShareEncryptionKey = os.Getenv("IS_SHARE_ENCRYPTION_KEY") + if ShareEncryptionKey == "" { + ShareEncryptionKey = "crn:v1:staging:public:kms:us-south:a/efe5afc483594adaa8325e2b4d1290df:1be45161-6dae-44ca-b248-837f98004057:key:3dd21cc5-cc20-4f7c-bc62-8ec9a8a3d1bd" // for next gen infrastructure + fmt.Println("[INFO] Set the environment variable IS_SHARE_PROFILE for testing ibm_is_instance resource else it is set to default value") + } + VolumeProfileName = os.Getenv("IS_VOLUME_PROFILE") if VolumeProfileName == "" { VolumeProfileName = "general-purpose" diff --git a/ibm/service/vpc/data_source_ibm_is_share.go b/ibm/service/vpc/data_source_ibm_is_share.go index b1671d68f6..e5bd0c5559 100644 --- a/ibm/service/vpc/data_source_ibm_is_share.go +++ b/ibm/service/vpc/data_source_ibm_is_share.go @@ -64,6 +64,30 @@ func DataSourceIbmIsShare() *schema.Resource { Computed: true, Description: "The maximum input/output operation performance bandwidth per second for the file share.", }, + "latest_sync": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Information about the latest synchronization for this file share.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "completed_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The completed date and time of last synchronization between the replica share and its source.", + }, + "data_transferred": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The data transferred (in bytes) in the last synchronization between the replica and its source.", + }, + "started_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The start date and time of last synchronization between the replica share and its source.", + }, + }, + }, + }, "latest_job": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -410,7 +434,17 @@ func dataSourceIbmIsShareRead(context context.Context, d *schema.ResourceData, m if err = d.Set("iops", share.Iops); err != nil { return diag.FromErr(fmt.Errorf("Error setting iops: %s", err)) } - + latest_syncs := []map[string]interface{}{} + if share.LatestSync != nil { + latest_sync := make(map[string]interface{}) + latest_sync["completed_at"] = flex.DateTimeToString(share.LatestSync.CompletedAt) + if share.LatestSync.DataTransferred != nil { + latest_sync["data_transferred"] = *share.LatestSync.DataTransferred + } + latest_sync["started_at"] = flex.DateTimeToString(share.LatestSync.CompletedAt) + latest_syncs = append(latest_syncs, latest_sync) + } + d.Set("latest_sync", latest_syncs) if share.LatestJob != nil { err = d.Set("latest_job", dataSourceShareFlattenLatestJob(*share.LatestJob)) if err != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_shares.go b/ibm/service/vpc/data_source_ibm_is_shares.go index dbeffabe24..f4829e0671 100644 --- a/ibm/service/vpc/data_source_ibm_is_shares.go +++ b/ibm/service/vpc/data_source_ibm_is_shares.go @@ -78,6 +78,30 @@ func DataSourceIbmIsShares() *schema.Resource { Computed: true, Description: "The maximum input/output operation performance bandwidth per second for the file share.", }, + "latest_sync": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Information about the latest synchronization for this file share.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "completed_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The completed date and time of last synchronization between the replica share and its source.", + }, + "data_transferred": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The data transferred (in bytes) in the last synchronization between the replica and its source.", + }, + "started_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The start date and time of last synchronization between the replica share and its source.", + }, + }, + }, + }, "latest_job": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -455,6 +479,17 @@ func dataSourceShareCollectionSharesToMap(meta interface{}, sharesItem vpcv1.Sha if sharesItem.Iops != nil { sharesMap["iops"] = sharesItem.Iops } + latest_syncs := []map[string]interface{}{} + if sharesItem.LatestSync != nil { + latest_sync := make(map[string]interface{}) + latest_sync["completed_at"] = flex.DateTimeToString(sharesItem.LatestSync.CompletedAt) + if sharesItem.LatestSync.DataTransferred != nil { + latest_sync["data_transferred"] = *sharesItem.LatestSync.DataTransferred + } + latest_sync["started_at"] = flex.DateTimeToString(sharesItem.LatestSync.CompletedAt) + latest_syncs = append(latest_syncs, latest_sync) + } + sharesMap["latest_sync"] = latest_syncs if sharesItem.LifecycleState != nil { sharesMap["lifecycle_state"] = sharesItem.LifecycleState } diff --git a/ibm/service/vpc/resource_ibm_is_share.go b/ibm/service/vpc/resource_ibm_is_share.go index 487479fd42..39fcaa0d72 100644 --- a/ibm/service/vpc/resource_ibm_is_share.go +++ b/ibm/service/vpc/resource_ibm_is_share.go @@ -54,12 +54,11 @@ func ResourceIbmIsShare() *schema.Resource { Schema: map[string]*schema.Schema{ "encryption_key": { - Type: schema.TypeString, - Optional: true, - RequiredWith: []string{"size"}, - ForceNew: true, - Computed: true, - Description: "The CRN of the key to use for encrypting this file share.If no encryption key is provided, the share will not be encrypted.", + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + Description: "The CRN of the key to use for encrypting this file share.If no encryption key is provided, the share will not be encrypted.", }, "initial_owner": { Type: schema.TypeList, @@ -105,8 +104,8 @@ func ResourceIbmIsShare() *schema.Resource { Type: schema.TypeInt, Optional: true, Computed: true, - ExactlyOneOf: []string{"size", "source_share"}, - ConflictsWith: []string{"replication_cron_spec", "source_share"}, + ExactlyOneOf: []string{"size", "source_share", "source_share_crn"}, + ConflictsWith: []string{"replication_cron_spec", "source_share", "source_share_crn"}, ValidateFunc: validate.InvokeValidator("ibm_is_share", "size"), Description: "The size of the file share rounded up to the next gigabyte.", }, @@ -511,16 +510,25 @@ func ResourceIbmIsShare() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, - ConflictsWith: []string{"replica_share", "size"}, + Computed: true, + ConflictsWith: []string{"replica_share", "size", "source_share_crn"}, RequiredWith: []string{"replication_cron_spec"}, Description: "The ID of 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.", }, + "source_share_crn": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + ConflictsWith: []string{"replica_share", "size", "source_share"}, + RequiredWith: []string{"replication_cron_spec"}, + Description: "The CRN of 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.", + }, "replication_cron_spec": &schema.Schema{ Type: schema.TypeString, Optional: true, DiffSuppressFunc: suppressCronSpecDiff, Computed: true, - RequiredWith: []string{"source_share"}, ConflictsWith: []string{"replica_share", "size"}, Description: "The cron specification for the file share replication schedule.Replication of a share can be scheduled to occur at most once per hour.", }, @@ -563,6 +571,30 @@ func ResourceIbmIsShare() *schema.Resource { Computed: true, Description: "The date and time that the file share was last synchronized to its replica.This property will be present when the `replication_role` is `source`.", }, + "latest_sync": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Information about the latest synchronization for this file share.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "completed_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The completed date and time of last synchronization between the replica share and its source.", + }, + "data_transferred": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The data transferred (in bytes) in the last synchronization between the replica and its source.", + }, + "started_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The start date and time of last synchronization between the replica share and its source.", + }, + }, + }, + }, "latest_job": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -727,17 +759,18 @@ func resourceIbmIsShareCreate(context context.Context, d *schema.ResourceData, m accessControlMode := accessControlModeIntf.(string) sharePrototype.AccessControlMode = &accessControlMode } + if encryptionKeyIntf, ok := d.GetOk("encryption_key"); ok { + encryptionKey := encryptionKeyIntf.(string) + encryptionKeyIdentity := &vpcv1.EncryptionKeyIdentity{ + CRN: &encryptionKey, + } + sharePrototype.EncryptionKey = encryptionKeyIdentity + } if sizeIntf, ok := d.GetOk("size"); ok { size := int64(sizeIntf.(int)) sharePrototype.Size = &size - if encryptionKeyIntf, ok := d.GetOk("encryption_key"); ok { - encryptionKey := encryptionKeyIntf.(string) - encryptionKeyIdentity := &vpcv1.EncryptionKeyIdentity{ - CRN: &encryptionKey, - } - sharePrototype.EncryptionKey = encryptionKeyIdentity - } + initial_owner := &vpcv1.ShareInitialOwner{} if initialOwnerIntf, ok := d.GetOk("initial_owner"); ok { initialOwnerMap := initialOwnerIntf.([]interface{})[0].(map[string]interface{}) @@ -823,7 +856,15 @@ func resourceIbmIsShareCreate(context context.Context, d *schema.ResourceData, m sharePrototype.SourceShare = &vpcv1.ShareIdentity{ ID: &sourceShare, } + } else { + sourceShareCRN := d.Get("source_share_crn").(string) + if sourceShareCRN != "" { + sharePrototype.SourceShare = &vpcv1.ShareIdentity{ + CRN: &sourceShareCRN, + } + } } + replicationCronSpec := d.Get("replication_cron_spec").(string) sharePrototype.ReplicationCronSpec = &replicationCronSpec } @@ -1075,9 +1116,17 @@ func resourceIbmIsShareRead(context context.Context, d *schema.ResourceData, met return diag.FromErr(fmt.Errorf("Error setting resource_type: %s", err)) } - // if share.LastSyncAt != nil { - // d.Set("last_sync_at", share.LastSyncAt.String()) - // } + latest_syncs := []map[string]interface{}{} + if share.LatestSync != nil { + latest_sync := make(map[string]interface{}) + latest_sync["completed_at"] = flex.DateTimeToString(share.LatestSync.CompletedAt) + if share.LatestSync.DataTransferred != nil { + latest_sync["data_transferred"] = *share.LatestSync.DataTransferred + } + latest_sync["started_at"] = flex.DateTimeToString(share.LatestSync.CompletedAt) + latest_syncs = append(latest_syncs, latest_sync) + } + d.Set("latest_sync", latest_syncs) latest_jobs := []map[string]interface{}{} if share.LatestJob != nil { latest_job := make(map[string]interface{}) diff --git a/ibm/service/vpc/resource_ibm_is_share_test.go b/ibm/service/vpc/resource_ibm_is_share_test.go index 353e1fe570..b5f4c0d6ae 100644 --- a/ibm/service/vpc/resource_ibm_is_share_test.go +++ b/ibm/service/vpc/resource_ibm_is_share_test.go @@ -38,6 +38,28 @@ func TestAccIbmIsShareBasic(t *testing.T) { }) } +func TestAccIbmIsShareCrossRegionReplication(t *testing.T) { + var conf vpcv1.Share + name := fmt.Sprintf("tf-fs-name-%d", acctest.RandIntRange(10, 100)) + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmIsShareDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmIsShareCrossRegionReplicaConfig(name), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmIsShareExists("ibm_is_share.is_share", conf), + resource.TestCheckResourceAttrSet("ibm_is_share.is_share", "source_share_crn"), + resource.TestCheckResourceAttrSet("ibm_is_share.is_share", "encryption_key"), + resource.TestCheckResourceAttr("ibm_is_share.is_share", "name", name), + resource.TestCheckResourceAttr("ibm_is_share.is_share", "encryption", "user_managed"), + ), + }, + }, + }) +} + func TestAccIbmIsShareAllArgs(t *testing.T) { var conf vpcv1.Share @@ -157,7 +179,18 @@ func testAccCheckIbmIsShareConfigBasic(name string) string { } `, name, acc.ShareProfileName) } - +func testAccCheckIbmIsShareCrossRegionReplicaConfig(name string) string { + return fmt.Sprintf(` + resource "ibm_is_share" "is_share" { + zone = "us-south-2" + encryption_key = "%s" + source_share_crn = "%s" + replication_cron_spec = "0 */5 * * *" + name = "%s" + profile = "%s" + } + `, acc.ShareEncryptionKey, acc.SourceShareCRN, name, acc.ShareProfileName) +} func testAccCheckIbmIsShareConfig(vpcName, name string, size int, shareTergetName string) string { return fmt.Sprintf(` diff --git a/website/docs/d/is_share.html.markdown b/website/docs/d/is_share.html.markdown index c338555af8..45a1875c8b 100644 --- a/website/docs/d/is_share.html.markdown +++ b/website/docs/d/is_share.html.markdown @@ -48,9 +48,14 @@ The following attributes are exported: - `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. -- `encryption_key` - The CRN of the key used to encrypt this file share. Nested `encryption_key` blocks have the following structure: +- `encryption_key` - The CRN of the key used to encrypt this file share. - `href` - The URL for this share. - `iops` - The maximum input/output operation performance bandwidth per second for the file share. +- `latest_sync` - (List) Information about the latest synchronization for this file share. +Nested `latest_sync` blocks have the following structure: + - `completed_at` - (String) The completed date and time of last synchronization between the replica share and its source. + - `data_transferred` - (Integer) The data transferred (in bytes) in the last synchronization between the replica and its source. + - `started_at` - (String) The start date and time of last synchronization between the replica share and its source. - `latest_job` - The latest job associated with this file share.This property will be absent if no jobs have been created for this file share. Nested `latest_job` blocks have the following structure: - `status` - The status of the file share job - `status_reasons` - The reasons for the file share job status (if any). Nested `status_reasons` blocks have the following structure: diff --git a/website/docs/d/is_shares.html.markdown b/website/docs/d/is_shares.html.markdown index 122b519f9e..88a6099736 100644 --- a/website/docs/d/is_shares.html.markdown +++ b/website/docs/d/is_shares.html.markdown @@ -32,10 +32,15 @@ The following attributes are exported: - `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. - - `encryption_key` - The CRN of the key used to encrypt this file share. Nested `encryption_key` blocks have the following structure: + - `encryption_key` - The CRN of the key used to encrypt this file share. - `href` - The URL for this share. - `id` - The unique identifier for this file share. - `iops` - The maximum input/output operation performance bandwidth per second for the file share. + - `latest_sync` - (List) Information about the latest synchronization for this file share. + Nested `latest_sync` blocks have the following structure: + - `completed_at` - (String) The completed date and time of last synchronization between the replica share and its source. + - `data_transferred` - (Integer) The data transferred (in bytes) in the last synchronization between the replica and its source. + - `started_at` - (String) The start date and time of last synchronization between the replica share and its source. - `latest_job` - The latest job associated with this file share.This property will be absent if no jobs have been created for this file share. Nested `latest_job` blocks have the following structure: - `status` - The status of the file share job - `status_reasons` - The reasons for the file share job status (if any). Nested `status_reasons` blocks have the following structure: diff --git a/website/docs/r/is_share.html.markdown b/website/docs/r/is_share.html.markdown index ffaa72f235..2319e75337 100644 --- a/website/docs/r/is_share.html.markdown +++ b/website/docs/r/is_share.html.markdown @@ -8,7 +8,7 @@ subcategory: "VPC infrastructure" # ibm\_is_share -Provides a resource for Share. This allows Share to be created, updated and deleted. +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. @@ -51,6 +51,25 @@ resource "ibm_is_share" "example-2" { } } ``` +## Example Usage (Create a cross regional replication) +```terraform +resource "ibm_is_share" "example-3" { + provider = ibm.syd + access_control_mode = "security_group" + name = "my-share" + size = 200 + profile = "dp2" + zone = "au-syd-2" +} +resource "ibm_is_share" "example-4" { + provider = ibm.ussouth + zone = "us-south-3" + source_share_crn = ibm_is_share.example-3.crn + name = "my-replica1" + profile = "dp2" + replication_cron_spec = "0 */5 * * *" +} +``` ## Argument Reference The following arguments are supported: @@ -130,6 +149,7 @@ The following arguments are supported: - `replication_cron_spec` - (Optional, String) The cron specification for the file share replication schedule. - `size` - (Required, Integer) The size of the file share rounded up to the next gigabyte. - `source_share` - (Optional, String) The ID of 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. +- `source_share_crn` - (Optional, String) The CRN of the source file share. - `tags` - (Optional, List of Strings) The list of user tags to attach to the share. - `zone` - (Required, string) The globally unique name for this zone. @@ -146,7 +166,11 @@ The following attributes are exported: - `href` - (String) The URL for this share. - `id` - (String) The unique identifier of the Share. - `iops` - (Integer) The maximum input/output operation performance bandwidth per second for the file share. -- `last_sync_at` - (String) The date and time that the file share was last synchronized to its replica.This property will be present when the `replication_role` is `source`. +- `latest_sync` - (List) Information about the latest synchronization for this file share. +Nested `latest_sync` blocks have the following structure: + - `completed_at` - (String) The completed date and time of last synchronization between the replica share and its source. + - `data_transferred` - (Integer) The data transferred (in bytes) in the last synchronization between the replica and its source. + - `started_at` - (String) The start date and time of last synchronization between the replica share and its source. - `latest_job` - (List) The latest job associated with this file share.This property will be absent if no jobs have been created for this file share. Nested `latest_job` blocks have the following structure: - `status` - (String) The status of the file share job - `status_reasons` - (List) The reasons for the file share job status (if any). Nested `status_reasons` blocks have the following structure: From c00aa14948c88af56b58dbb0d43546409f9472d3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 00:10:54 +0000 Subject: [PATCH 110/132] dependabot: bump golang.org/x/crypto from 0.16.0 to 0.17.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.16.0 to 0.17.0. - [Commits](https://github.com/golang/crypto/compare/v0.16.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 04a09410f2..511405cb97 100644 --- a/go.mod +++ b/go.mod @@ -53,7 +53,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/rook/rook v1.11.4 github.com/softlayer/softlayer-go v1.0.3 - golang.org/x/crypto v0.16.0 + golang.org/x/crypto v0.17.0 gopkg.in/yaml.v3 v3.0.1 gotest.tools v2.2.0+incompatible k8s.io/api v0.26.3 diff --git a/go.sum b/go.sum index 656b4b77ba..e472724d60 100644 --- a/go.sum +++ b/go.sum @@ -174,8 +174,6 @@ github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2 h1:+Svh1OmoFxMBnZQSOUtp2UUzrOGFs github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2/go.mod h1:WII+LS4VkQYykmq65NWSuPb5xGNvsqkcK1aCWZoU2x4= github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc= github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA= -github.com/IBM/vpc-go-sdk v0.45.0 h1:RFbUZH5vBRGAEW5+jRzbDlxB+a+GvG9EBhyYO52Tvrs= -github.com/IBM/vpc-go-sdk v0.45.0/go.mod h1:4Hs5d/aClmsxAzwDQkwG+ri0vW2ykPJdpM6hDLRwKcA= github.com/IBM/vpc-go-sdk v0.46.0 h1:OwXH3oaYgYmzt559n77AteSpNsW4H1PoeHcR4EOolzk= github.com/IBM/vpc-go-sdk v0.46.0/go.mod h1:4Hs5d/aClmsxAzwDQkwG+ri0vW2ykPJdpM6hDLRwKcA= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= @@ -1642,8 +1640,8 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= From 9c89bf1d8b9a1fe854fe237f5309dc2faf04e5db Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Tue, 19 Dec 2023 10:29:08 +0530 Subject: [PATCH 111/132] Enhancement: Added operating system attributes to is images data sources (#4998) * Enhancement: Added operating system attributes to is images data sources * set the values * test and doc changes --- ibm/service/vpc/data_source_ibm_is_image.go | 196 +++++++++++++++++- .../vpc/data_source_ibm_is_image_test.go | 37 ++++ ibm/service/vpc/data_source_ibm_is_images.go | 111 ++++++++++ .../vpc/data_source_ibm_is_images_test.go | 34 +++ website/docs/d/is_image.html.markdown | 24 +++ website/docs/d/is_images.html.markdown | 22 ++ 6 files changed, 422 insertions(+), 2 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_image.go b/ibm/service/vpc/data_source_ibm_is_image.go index 760014aff7..61248d9c81 100644 --- a/ibm/service/vpc/data_source_ibm_is_image.go +++ b/ibm/service/vpc/data_source_ibm_is_image.go @@ -48,13 +48,107 @@ func DataSourceIBMISImage() *schema.Resource { ValidateFunc: validate.ValidateAllowedStringValues([]string{"public", "private"}), Description: "Whether the image is publicly visible or private to the account", }, - + "resource_group": { + Type: schema.TypeList, + Computed: true, + Description: "The resource group for this IPsec policy.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this resource group.", + }, + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this resource group.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "The user-defined name for this resource group.", + }, + }, + }, + }, "status": { Type: schema.TypeString, Computed: true, Description: "The status of this image", }, - + "status_reasons": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The reasons for the current status (if any).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "code": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A snake case string succinctly identifying the status reason.", + }, + "message": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "An explanation of the status reason.", + }, + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about this status reason.", + }, + }, + }, + }, + "operating_system": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "architecture": { + Type: schema.TypeString, + Computed: true, + Description: "The operating system architecture", + }, + "dedicated_host_only": { + Type: schema.TypeBool, + Computed: true, + Description: "Images with this operating system can only be used on dedicated hosts or dedicated host groups", + }, + "display_name": { + Type: schema.TypeString, + Computed: true, + Description: "A unique, display-friendly name for the operating system", + }, + "family": { + Type: schema.TypeString, + Computed: true, + Description: "The software family for this operating system", + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this operating system", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "The globally unique name for this operating system", + }, + "vendor": { + Type: schema.TypeString, + Computed: true, + Description: "The vendor of the operating system", + }, + "version": { + Type: schema.TypeString, + Computed: true, + Description: "The major release version of this operating system", + }, + }, + }, + }, "os": { Type: schema.TypeString, Computed: true, @@ -207,6 +301,9 @@ func imageGetByName(d *schema.ResourceData, meta interface{}, name, visibility s if *image.Status == "deprecated" { fmt.Printf("[WARN] Given image %s is deprecated and soon will be obsolete.", name) } + if len(image.StatusReasons) > 0 { + d.Set("status_reasons", dataSourceIBMIsImageFlattenStatusReasons(image.StatusReasons)) + } d.Set("name", *image.Name) accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *image.CRN, "", isImageAccessTagType) if err != nil { @@ -215,6 +312,19 @@ func imageGetByName(d *schema.ResourceData, meta interface{}, name, visibility s } d.Set(isImageAccessTags, accesstags) d.Set("visibility", *image.Visibility) + + if image.OperatingSystem != nil { + operatingSystemList := []map[string]interface{}{} + operatingSystemMap := dataSourceIBMISImageOperatingSystemToMap(*image.OperatingSystem) + operatingSystemList = append(operatingSystemList, operatingSystemMap) + d.Set("operating_system", operatingSystemList) + } + if image.ResourceGroup != nil { + resourceGroupList := []map[string]interface{}{} + resourceGroupMap := dataSourceImageResourceGroupToMap(*image.ResourceGroup) + resourceGroupList = append(resourceGroupList, resourceGroupMap) + d.Set("resource_group", resourceGroupList) + } d.Set("os", *image.OperatingSystem.Name) d.Set("architecture", *image.OperatingSystem.Architecture) d.Set("crn", *image.CRN) @@ -271,8 +381,23 @@ func imageGetById(d *schema.ResourceData, meta interface{}, identifier string) e if *image.Status == "deprecated" { fmt.Printf("[WARN] Given image %s is deprecated and soon will be obsolete.", name) } + if len(image.StatusReasons) > 0 { + d.Set("status_reasons", dataSourceIBMIsImageFlattenStatusReasons(image.StatusReasons)) + } d.Set("name", *image.Name) d.Set("visibility", *image.Visibility) + if image.OperatingSystem != nil { + operatingSystemList := []map[string]interface{}{} + operatingSystemMap := dataSourceIBMISImageOperatingSystemToMap(*image.OperatingSystem) + operatingSystemList = append(operatingSystemList, operatingSystemMap) + d.Set("operating_system", operatingSystemList) + } + if image.ResourceGroup != nil { + resourceGroupList := []map[string]interface{}{} + resourceGroupMap := dataSourceImageResourceGroupToMap(*image.ResourceGroup) + resourceGroupList = append(resourceGroupList, resourceGroupMap) + d.Set("resource_group", resourceGroupList) + } d.Set("os", *image.OperatingSystem.Name) d.Set("architecture", *image.OperatingSystem.Architecture) d.Set("crn", *image.CRN) @@ -297,6 +422,36 @@ func imageGetById(d *schema.ResourceData, meta interface{}, identifier string) e return nil } +func dataSourceIBMISImageOperatingSystemToMap(operatingSystemItem vpcv1.OperatingSystem) (operatingSystemMap map[string]interface{}) { + operatingSystemMap = map[string]interface{}{} + + if operatingSystemItem.Architecture != nil { + operatingSystemMap["architecture"] = operatingSystemItem.Architecture + } + if operatingSystemItem.DedicatedHostOnly != nil { + operatingSystemMap["dedicated_host_only"] = operatingSystemItem.DedicatedHostOnly + } + if operatingSystemItem.DisplayName != nil { + operatingSystemMap["display_name"] = operatingSystemItem.DisplayName + } + if operatingSystemItem.Family != nil { + operatingSystemMap["family"] = operatingSystemItem.Family + } + if operatingSystemItem.Href != nil { + operatingSystemMap["href"] = operatingSystemItem.Href + } + if operatingSystemItem.Name != nil { + operatingSystemMap["name"] = operatingSystemItem.Name + } + if operatingSystemItem.Vendor != nil { + operatingSystemMap["vendor"] = operatingSystemItem.Vendor + } + if operatingSystemItem.Version != nil { + operatingSystemMap["version"] = operatingSystemItem.Version + } + return operatingSystemMap +} + func dataSourceImageCollectionCatalogOfferingToMap(imageCatalogOfferingItem vpcv1.ImageCatalogOffering) (imageCatalogOfferingMap map[string]interface{}) { imageCatalogOfferingMap = map[string]interface{}{} if imageCatalogOfferingItem.Managed != nil { @@ -320,3 +475,40 @@ func dataSourceImageCollectionCatalogOfferingToMap(imageCatalogOfferingItem vpcv return imageCatalogOfferingMap } + +func dataSourceIBMIsImageFlattenStatusReasons(result []vpcv1.ImageStatusReason) (statusReasons []map[string]interface{}) { + for _, statusReasonsItem := range result { + statusReasons = append(statusReasons, dataSourceIBMIsImageStatusReasonToMap(&statusReasonsItem)) + } + + return statusReasons +} + +func dataSourceIBMIsImageStatusReasonToMap(model *vpcv1.ImageStatusReason) map[string]interface{} { + modelMap := make(map[string]interface{}) + if model.Code != nil { + modelMap["code"] = *model.Code + } + if model.Message != nil { + modelMap["message"] = *model.Message + } + if model.MoreInfo != nil { + modelMap["more_info"] = *model.MoreInfo + } + return modelMap +} +func dataSourceImageResourceGroupToMap(resourceGroupItem vpcv1.ResourceGroupReference) (resourceGroupMap map[string]interface{}) { + resourceGroupMap = map[string]interface{}{} + + if resourceGroupItem.Href != nil { + resourceGroupMap["href"] = resourceGroupItem.Href + } + if resourceGroupItem.ID != nil { + resourceGroupMap["id"] = resourceGroupItem.ID + } + if resourceGroupItem.Name != nil { + resourceGroupMap["name"] = resourceGroupItem.Name + } + + return resourceGroupMap +} diff --git a/ibm/service/vpc/data_source_ibm_is_image_test.go b/ibm/service/vpc/data_source_ibm_is_image_test.go index 9c7c126b5e..425a160dc5 100644 --- a/ibm/service/vpc/data_source_ibm_is_image_test.go +++ b/ibm/service/vpc/data_source_ibm_is_image_test.go @@ -34,6 +34,33 @@ func TestAccIBMISImageDataSource_basic(t *testing.T) { }, }) } +func TestAccIBMISImageDataSource_All(t *testing.T) { + resName := "data.ibm_is_image.test1" + imageName := fmt.Sprintf("tfimage-name-%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISImageDataSourceAllConfig(imageName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(resName, "operating_system.0.name"), + resource.TestCheckResourceAttrSet(resName, "operating_system.0.dedicated_host_only"), + resource.TestCheckResourceAttrSet(resName, "operating_system.0.display_name"), + resource.TestCheckResourceAttrSet(resName, "operating_system.0.family"), + resource.TestCheckResourceAttrSet(resName, "operating_system.0.href"), + resource.TestCheckResourceAttrSet(resName, "operating_system.0.vendor"), + resource.TestCheckResourceAttrSet(resName, "operating_system.0.version"), + resource.TestCheckResourceAttrSet(resName, "operating_system.0.architecture"), + resource.TestCheckResourceAttrSet(resName, "status"), + resource.TestCheckResourceAttrSet(resName, "resource_group.0.id"), + resource.TestCheckResourceAttrSet(resName, "resource_group.0.name"), + ), + }, + }, + }) +} func TestAccIBMISImageDataSource_ilc(t *testing.T) { resName := "data.ibm_is_image.test1" imageName := fmt.Sprintf("tfimage-name-%d", acctest.RandIntRange(10, 100)) @@ -144,6 +171,16 @@ func testAccCheckIBMISImageDataSourceConfig(imageName string) string { }`, acc.Image_cos_url, imageName, acc.Image_operating_system) } +func testAccCheckIBMISImageDataSourceAllConfig(imageName string) string { + return fmt.Sprintf(` + data "ibm_is_images" "test1" { + status = "available" + } + data "ibm_is_image" "test1" { + name = data.ibm_is_images.test1.images.0.name + }`) +} + func testAccCheckIBMISImageDataSourceConfigIlc(imageName string) string { return fmt.Sprintf(` resource "ibm_is_image" "isExampleImage" { diff --git a/ibm/service/vpc/data_source_ibm_is_images.go b/ibm/service/vpc/data_source_ibm_is_images.go index e1d22caf44..bd9c059110 100644 --- a/ibm/service/vpc/data_source_ibm_is_images.go +++ b/ibm/service/vpc/data_source_ibm_is_images.go @@ -74,11 +74,83 @@ func DataSourceIBMISImages() *schema.Resource { Computed: true, Description: "The status of this image", }, + "status_reasons": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The reasons for the current status (if any).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "code": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A snake case string succinctly identifying the status reason.", + }, + "message": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "An explanation of the status reason.", + }, + "more_info": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about this status reason.", + }, + }, + }, + }, "visibility": { Type: schema.TypeString, Computed: true, Description: "Whether the image is publicly visible or private to the account", }, + "operating_system": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "architecture": { + Type: schema.TypeString, + Computed: true, + Description: "The operating system architecture", + }, + "dedicated_host_only": { + Type: schema.TypeBool, + Computed: true, + Description: "Images with this operating system can only be used on dedicated hosts or dedicated host groups", + }, + "display_name": { + Type: schema.TypeString, + Computed: true, + Description: "A unique, display-friendly name for the operating system", + }, + "family": { + Type: schema.TypeString, + Computed: true, + Description: "The software family for this operating system", + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this operating system", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "The globally unique name for this operating system", + }, + "vendor": { + Type: schema.TypeString, + Computed: true, + Description: "The vendor of the operating system", + }, + "version": { + Type: schema.TypeString, + Computed: true, + Description: "The major release version of this operating system", + }, + }, + }, + }, "os": { Type: schema.TypeString, Computed: true, @@ -89,6 +161,30 @@ func DataSourceIBMISImages() *schema.Resource { Computed: true, Description: "The operating system architecture", }, + "resource_group": { + Type: schema.TypeList, + Computed: true, + Description: "The resource group for this IPsec policy.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The URL for this resource group.", + }, + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this resource group.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "The user-defined name for this resource group.", + }, + }, + }, + }, "crn": { Type: schema.TypeString, Computed: true, @@ -283,6 +379,21 @@ func imageList(d *schema.ResourceData, meta interface{}) error { "os": *image.OperatingSystem.Name, "architecture": *image.OperatingSystem.Architecture, } + if len(image.StatusReasons) > 0 { + l["status_reasons"] = dataSourceIBMIsImageFlattenStatusReasons(image.StatusReasons) + } + if image.ResourceGroup != nil { + resourceGroupList := []map[string]interface{}{} + resourceGroupMap := dataSourceImageResourceGroupToMap(*image.ResourceGroup) + resourceGroupList = append(resourceGroupList, resourceGroupMap) + l["resource_group"] = resourceGroupList + } + if image.OperatingSystem != nil { + operatingSystemList := []map[string]interface{}{} + operatingSystemMap := dataSourceIBMISImageOperatingSystemToMap(*image.OperatingSystem) + operatingSystemList = append(operatingSystemList, operatingSystemMap) + l["operating_system"] = operatingSystemList + } if image.File != nil && image.File.Checksums != nil { l[isImageCheckSum] = *image.File.Checksums.Sha256 } diff --git a/ibm/service/vpc/data_source_ibm_is_images_test.go b/ibm/service/vpc/data_source_ibm_is_images_test.go index 2bbbbda009..08c30998de 100644 --- a/ibm/service/vpc/data_source_ibm_is_images_test.go +++ b/ibm/service/vpc/data_source_ibm_is_images_test.go @@ -9,6 +9,7 @@ import ( acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -30,6 +31,33 @@ func TestAccIBMISImagesDataSource_basic(t *testing.T) { }, }) } +func TestAccIBMISImagesDataSource_All(t *testing.T) { + resName := "data.ibm_is_images.test1" + imageName := fmt.Sprintf("tfimage-name-%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISImagesDataSourceAllConfig(imageName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(resName, "images.0.operating_system.0.name"), + resource.TestCheckResourceAttrSet(resName, "images.0.operating_system.0.dedicated_host_only"), + resource.TestCheckResourceAttrSet(resName, "images.0.operating_system.0.display_name"), + resource.TestCheckResourceAttrSet(resName, "images.0.operating_system.0.family"), + resource.TestCheckResourceAttrSet(resName, "images.0.operating_system.0.href"), + resource.TestCheckResourceAttrSet(resName, "images.0.operating_system.0.vendor"), + resource.TestCheckResourceAttrSet(resName, "images.0.operating_system.0.version"), + resource.TestCheckResourceAttrSet(resName, "images.0.operating_system.0.architecture"), + resource.TestCheckResourceAttrSet(resName, "images.0.status"), + resource.TestCheckResourceAttrSet(resName, "images.0.resource_group.0.id"), + resource.TestCheckResourceAttrSet(resName, "images.0.resource_group.0.name"), + ), + }, + }, + }) +} func TestAccIBMISImagesDataSource_catalog(t *testing.T) { resName := "data.ibm_is_images.test1" @@ -92,6 +120,12 @@ func testAccCheckIBMISImagesDataSourceConfig() string { data "ibm_is_images" "test1" { }`) } +func testAccCheckIBMISImagesDataSourceAllConfig(imageName string) string { + return fmt.Sprintf(` + data "ibm_is_images" "test1" { + status = "available" + }`) +} func testAccCheckIBMISCatalogImagesDataSourceConfig() string { // status filter defaults to empty return fmt.Sprintf(` diff --git a/website/docs/d/is_image.html.markdown b/website/docs/d/is_image.html.markdown index 4b7f19ebd2..994d2f510e 100644 --- a/website/docs/d/is_image.html.markdown +++ b/website/docs/d/is_image.html.markdown @@ -69,5 +69,29 @@ In addition to all argument reference list, you can access the following attribu - `id` - (String) The unique identifier of the image. - `obsolescence_at` - (String) The obsolescence date and time (UTC) for this image. If absent, no obsolescence date and time has been set. - `os` - (String) The name of the operating system. +- `operating_system` - (List) The operating system details. + + Nested scheme for `operating_system`: + - `architecture` - (String) The operating system architecture. + - `dedicated_host_only` - (Bool) Images with this operating system can only be used on dedicated hosts or dedicated host groups. + - `display_name` - (String) A unique, display-friendly name for the operating system. + - `family` - (String) The software family for this operating system. + - `href` - (String) The URL for this operating system. + - `name` - (String) The globally unique name for this operating system. + - `vendor` - (String) The vendor of the operating system. + - `version` - (String) The major release version of this operating system. +- `resource_group` - (List) The resource group object, for this image. + + Nested scheme for `resource_group`: + - `href` - (String) The URL for this resource group. + - `id` - (String) The unique identifier for this resource group. + - `name` - (String) The user-defined name for this resource group. - `status` - (String) The status of this image. +- `status_reasons` - (List) The reasons for the current status (if any). + + Nested scheme for `status_reasons`: + - `code` - (String) The status reason code + - `message` - (String) An explanation of the status reason + - `more_info` - (String) Link to documentation about this status reason + - `source_volume` - The source volume id of the image. diff --git a/website/docs/d/is_images.html.markdown b/website/docs/d/is_images.html.markdown index d5a63840af..012e1beb74 100644 --- a/website/docs/d/is_images.html.markdown +++ b/website/docs/d/is_images.html.markdown @@ -65,7 +65,29 @@ You can access the following attribute references after your data source is crea - `id` - (String) The unique identifier for this image. - `name` - (String) The name for this image. - `os` - (String) The name of the Operating System. + - `operating_system` - (List) The operating system details. + + Nested scheme for `operating_system`: + - `architecture` - (String) The operating system architecture. + - `dedicated_host_only` - (Bool) Images with this operating system can only be used on dedicated hosts or dedicated host groups. + - `display_name` - (String) A unique, display-friendly name for the operating system. + - `family` - (String) The software family for this operating system. + - `href` - (String) The URL for this operating system. + - `name` - (String) The globally unique name for this operating system. + - `vendor` - (String) The vendor of the operating system. + - `version` - (String) The major release version of this operating system. + - `resource_group` - (List) The resource group object, for this image. + Nested scheme for `resource_group`: + - `href` - (String) The URL for this resource group. + - `id` - (String) The unique identifier for this resource group. + - `name` - (String) The user-defined name for this resource group. - `status` - (String) The status of this image. + - `status_reasons` - (List) The reasons for the current status (if any). + + Nested scheme for `status_reasons`: + - `code` - (String) The status reason code + - `message` - (String) An explanation of the status reason + - `more_info` - (String) Link to documentation about this status reason - `visibility` - (String) The visibility of the image public or private. - `source_volume` - The source volume id of the image. From c69efb6f0a0c19a0df932f436697f2fee289b6c9 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 19 Dec 2023 10:27:49 +0530 Subject: [PATCH 112/132] added enhancement to one step delegate resolver in is_vpc --- ibm/service/vpc/resource_ibm_is_vpc.go | 96 ++++++++++++++++- ibm/service/vpc/resource_ibm_is_vpc_test.go | 110 ++++++++++++++++++++ website/docs/r/is_vpc.html.markdown | 21 +++- 3 files changed, 225 insertions(+), 2 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_vpc.go b/ibm/service/vpc/resource_ibm_is_vpc.go index 68e75e6fad..da9104f86c 100644 --- a/ibm/service/vpc/resource_ibm_is_vpc.go +++ b/ibm/service/vpc/resource_ibm_is_vpc.go @@ -190,6 +190,18 @@ func ResourceIBMISVPC() *schema.Resource { Computed: true, Description: "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.", }, + + "dns_binding_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The VPC dns binding id whose DNS resolver provides the DNS server addresses for this VPC.", + }, + "dns_binding_name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The VPC dns binding name whose DNS resolver provides the DNS server addresses for this VPC.", + }, "vpc_id": &schema.Schema{ Type: schema.TypeString, Optional: true, @@ -714,6 +726,51 @@ func vpcCreate(d *schema.ResourceData, meta interface{}, name, apm, rg string, i return err } + if dnsresolvertpeOk, ok := d.GetOk("dns.0.resolver.0.type"); ok { + if dnsresolvertpeOk.(string) == "delegated" && d.Get("dns.0.resolver.0.vpc_id").(string) != "" { + vpcId := d.Get("dns.0.resolver.0.vpc_id").(string) + createDnsBindings := &vpcv1.CreateVPCDnsResolutionBindingOptions{ + VPCID: vpc.ID, + VPC: &vpcv1.VPCIdentity{ + ID: &vpcId, + }, + } + if bindingNameOk, ok := d.GetOk("dns.0.resolver.0.dns_binding_name"); ok { + bindingName := bindingNameOk.(string) + createDnsBindings.Name = &bindingName + } + _, response, err := sess.CreateVPCDnsResolutionBinding(createDnsBindings) + if err != nil { + log.Printf("[DEBUG] CreateVPCDnsResolutionBindingWithContext failed %s\n%s", err, response) + return fmt.Errorf("[ERROR] CreateVPCDnsResolutionBinding failed in vpc resource %s\n%s", err, response) + } + resolverType := "delegated" + dnsPatch := &vpcv1.VpcdnsPatch{ + Resolver: &vpcv1.VpcdnsResolverPatch{ + Type: &resolverType, + VPC: &vpcv1.VpcdnsResolverVPCPatch{ + ID: &vpcId, + }, + }, + } + vpcPatchModel := &vpcv1.VPCPatch{} + vpcPatchModel.Dns = dnsPatch + vpcPatchModelAsPatch, err := vpcPatchModel.AsPatch() + if err != nil { + return fmt.Errorf("[ERROR] CreateVPCDnsResolutionBinding failed in vpcpatch as patch %s", err) + } + updateVpcOptions := &vpcv1.UpdateVPCOptions{ + ID: vpc.ID, + } + updateVpcOptions.VPCPatch = vpcPatchModelAsPatch + _, response, err = sess.UpdateVPC(updateVpcOptions) + if err != nil { + log.Printf("[DEBUG] Update vpc with delegated failed %s\n%s", err, response) + return fmt.Errorf("[ERROR] Update vpc with delegated failed in vpc resource %s\n%s", err, response) + } + } + } + if sgAclRules, ok := d.GetOk(isVPCNoSgAclRules); ok { sgAclRules := sgAclRules.(bool) if sgAclRules { @@ -920,6 +977,38 @@ func vpcGet(d *schema.ResourceData, meta interface{}, id string) error { if err != nil { return err } + resolverMapArray := dnsMap["resolver"].([]map[string]interface{}) + resolverMap := resolverMapArray[0] + if resolverMap["type"] != nil && resolverMap["vpc_id"] != nil { + resType := resolverMap["type"].(*string) + resVpc := resolverMap["vpc_id"].(string) + if *resType == "delegated" { + listVPCDnsResolutionBindingOptions := &vpcv1.ListVPCDnsResolutionBindingsOptions{ + VPCID: vpc.ID, + } + + pager, err := sess.NewVPCDnsResolutionBindingsPager(listVPCDnsResolutionBindingOptions) + if err != nil { + return fmt.Errorf("[ERROR] Error getting VPC dns bindings: %s", err) + } + var allResults []vpcv1.VpcdnsResolutionBinding + for pager.HasNext() { + nextPage, err := pager.GetNext() + if err != nil { + return fmt.Errorf("[ERROR] Error getting VPC dns bindings pager next: %s", err) + } + allResults = append(allResults, nextPage...) + } + for _, binding := range allResults { + if *binding.VPC.ID == resVpc { + resolverMap["dns_binding_id"] = binding.ID + resolverMap["dns_binding_name"] = binding.Name + resolverMapArray[0] = resolverMap + dnsMap["resolver"] = resolverMapArray + } + } + } + } if err = d.Set(isVPCDns, []map[string]interface{}{dnsMap}); err != nil { return fmt.Errorf("[ERROR] Error setting dns: %s", err) } @@ -1543,7 +1632,11 @@ func resourceIBMIsVPCMapToVpcdnsPrototype(modelMap map[string]interface{}) (*vpc func resourceIBMIsVPCMapToVpcdnsResolverPrototype(modelMap map[string]interface{}) (vpcv1.VpcdnsResolverPrototypeIntf, error) { model := &vpcv1.VpcdnsResolverPrototype{} if modelMap["type"] != nil && modelMap["type"].(string) != "" { - model.Type = core.StringPtr(modelMap["type"].(string)) + if modelMap["type"].(string) == "delegated" { + model.Type = core.StringPtr("system") + } else { + model.Type = core.StringPtr(modelMap["type"].(string)) + } } if modelMap["manual_servers"] != nil && modelMap["manual_servers"].(*schema.Set).Len() > 0 { model.Type = core.StringPtr("manual") @@ -1583,6 +1676,7 @@ func resourceIBMIsVPCVpcdnsToMap(model *vpcv1.Vpcdns, vpcId, vpcCrn string) (map return modelMap, err } modelMap["resolver"] = []map[string]interface{}{resolverMap} + return modelMap, nil } diff --git a/ibm/service/vpc/resource_ibm_is_vpc_test.go b/ibm/service/vpc/resource_ibm_is_vpc_test.go index 6f9cc88a66..5468af48d1 100644 --- a/ibm/service/vpc/resource_ibm_is_vpc_test.go +++ b/ibm/service/vpc/resource_ibm_is_vpc_test.go @@ -298,6 +298,53 @@ func TestAccIBMISVPC_dns_delegated(t *testing.T) { }, }) } +func TestAccIBMISVPC_dns_delegated_first(t *testing.T) { + var vpc string + name1 := fmt.Sprintf("terraformvpcuat-%d", acctest.RandIntRange(10, 100)) + name2 := fmt.Sprintf("terraformvpcuat-%d", acctest.RandIntRange(10, 100)) + subnet1 := fmt.Sprintf("terraformsubnet-%d", acctest.RandIntRange(10, 100)) + subnet2 := fmt.Sprintf("terraformsubnet-%d", acctest.RandIntRange(10, 100)) + resourecinstance := fmt.Sprintf("terraformresource-%d", acctest.RandIntRange(10, 100)) + resolver1 := fmt.Sprintf("terraformresolver-%d", acctest.RandIntRange(10, 100)) + binding := fmt.Sprintf("terraformbinding-%d", acctest.RandIntRange(10, 100)) + enableHubTrue := true + enableHubFalse := false + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMISVPCDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISVPCDnsDelegatedFirstConfig(name1, name2, subnet1, subnet2, resourecinstance, resolver1, binding, enableHubTrue, enableHubFalse), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMISVPCExists("ibm_is_vpc.hub_true", vpc), + resource.TestCheckResourceAttr( + "ibm_is_vpc.hub_true", "name", name1), + resource.TestCheckResourceAttr( + "ibm_is_vpc.hub_false_delegated", "name", name2), + resource.TestCheckResourceAttr( + "ibm_is_vpc.hub_true", "dns.0.enable_hub", fmt.Sprintf("%t", enableHubTrue)), + resource.TestCheckResourceAttr( + "ibm_is_vpc.hub_true", "dns.0.resolver.0.type", "system"), + resource.TestCheckResourceAttr( + "ibm_is_vpc.hub_false_delegated", "dns.0.enable_hub", fmt.Sprintf("%t", enableHubFalse)), + resource.TestCheckResourceAttr( + "ibm_is_vpc.hub_false_delegated", "dns.0.resolver.0.type", "delegated"), + resource.TestCheckResourceAttr( + "ibm_is_vpc.hub_false_delegated", "dns.0.resolution_binding_count", "1"), + resource.TestCheckResourceAttr( + "ibm_is_vpc.hub_false_delegated", "dns.0.resolver.0.dns_binding_name", binding), + resource.TestCheckResourceAttrSet( + "ibm_is_vpc.hub_false_delegated", "dns.0.resolver.0.dns_binding_id"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpc.hub_false_delegated", "dns.0.resolver.0.vpc_id"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpc.hub_false_delegated", "dns.0.resolver.0.vpc_name"), + ), + }, + }, + }) +} func TestAccIBMISVPC_basic_apm(t *testing.T) { var vpc string @@ -597,6 +644,69 @@ func testAccCheckIBMISVPCDnsDelegatedConfig(vpcname, vpcname2, subnetname1, subn `, vpcname, enableHub, vpcname2, enablehubfalse, subnetname1, acc.ISZoneName, subnetname2, acc.ISZoneName, subnetname3, acc.ISZoneName, subnetname4, acc.ISZoneName, resourceinstance, resolver1, resolver2, bindingname) +} +func testAccCheckIBMISVPCDnsDelegatedFirstConfig(vpcname, vpcname2, subnetname1, subnetname2, resourceinstance, resolver1, bindingname string, enableHub, enablehubfalse bool) string { + return fmt.Sprintf(` + data "ibm_resource_group" "rg" { + is_default = true + } + + resource ibm_is_vpc hub_true { + name = "%s" + dns { + enable_hub = %t + } + } + + resource ibm_is_vpc hub_false_delegated { + depends_on = [ ibm_dns_custom_resolver.test_hub_true ] + name = "%s" + dns { + enable_hub = %t + resolver { + type = "delegated" + vpc_id = ibm_is_vpc.hub_true.id + dns_binding_name = "%s" + } + } + } + + resource "ibm_is_subnet" "hub_true_sub1" { + name = "%s" + vpc = ibm_is_vpc.hub_true.id + zone = "%s" + total_ipv4_address_count = 16 + } + resource "ibm_is_subnet" "hub_true_sub2" { + name = "%s" + vpc = ibm_is_vpc.hub_true.id + zone = "%s" + total_ipv4_address_count = 16 + } + resource "ibm_resource_instance" "dns-cr-instance" { + name = "%s" + resource_group_id = data.ibm_resource_group.rg.id + location = "global" + service = "dns-svcs" + plan = "standard-dns" + } + resource "ibm_dns_custom_resolver" "test_hub_true" { + name = "%s" + instance_id = ibm_resource_instance.dns-cr-instance.guid + description = "new test CR - TF" + high_availability = true + enabled = true + locations { + subnet_crn = ibm_is_subnet.hub_true_sub1.crn + enabled = true + } + locations { + subnet_crn = ibm_is_subnet.hub_true_sub2.crn + enabled = true + } + } + `, vpcname, enableHub, vpcname2, enablehubfalse, bindingname, subnetname1, acc.ISZoneName, subnetname2, acc.ISZoneName, resourceinstance, resolver1) + } func testAccCheckIBMISVPCDnsDelegatedUpdate1Config(vpcname, vpcname2, subnetname1, subnetname2, subnetname3, subnetname4, resourceinstance, resolver1, resolver2, bindingname string, enableHub, enablehubfalse bool) string { return fmt.Sprintf(` diff --git a/website/docs/r/is_vpc.html.markdown b/website/docs/r/is_vpc.html.markdown index 0249e5778b..1ef48546e8 100644 --- a/website/docs/r/is_vpc.html.markdown +++ b/website/docs/r/is_vpc.html.markdown @@ -83,6 +83,22 @@ resource "ibm_is_vpc" "example-system" { } } +// delegated type resolver + +resource "ibm_is_vpc" "example-delegated" { + // required : add a dependency on ibm dns custom resolver of the hub vpc + depends_on = [ ibm_dns_custom_resolver.example-hub ] + name = "example-hub-false-delegated" + dns { + enable_hub = false + resolver { + type = "delegated" + vpc_id = ibm_is_vpc.example.id + dns_binding_name = "example-vpc-binding" + } + } +} + ``` ## Timeouts @@ -116,6 +132,9 @@ Review the argument references that you can specify for your resource. - `resolver` - (Optional, List) The zone list this backup policy plan will create snapshot clones in. Nested scheme for `resolver`: + - `dns_binding_id` - (String) The VPC dns binding id whose DNS resolver provides the DNS server addresses for this VPC. (If any) + - `dns_binding_name` - (Optional, String) The VPC dns binding name whose DNS resolver provides the DNS server addresses for this VPC. Only applicable for `delegated`, providing value would create binding with this name. + ~> **Note:** `manual_servers` must be set if and only if `dns.resolver.type` is manual. - `manual_servers` - (Optional, List) 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**. @@ -139,7 +158,7 @@ Review the argument references that you can specify for your resource. ~> **Note:** 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. + Updating from `delegated` requires `dns.resolver.vpc` to be specified as null. If type is `delegated` while creation then `vpc_id` is required - `vpc_id` - (Optional, List) (update only) The VPC ID to provide DNS server addresses for this VPC. The specified VPC must be configured with a DNS Services custom resolver and must be in one of this VPC's DNS resolution bindings. Mutually exclusive with `vpc_crn` ~> **Note:** From 8034c1352147fa12624e958a12219290a1284e47 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 19 Dec 2023 10:33:58 +0530 Subject: [PATCH 113/132] resolved delete issue for the floated nics on bm server --- ..._bare_metal_server_network_interface_allow_float.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_interface_allow_float.go b/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_interface_allow_float.go index bb620d77ed..5bc30cd5aa 100644 --- a/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_interface_allow_float.go +++ b/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_interface_allow_float.go @@ -370,10 +370,12 @@ func resourceIBMISBareMetalServerNetworkInterfaceAllowFloatRead(context context. // if response returns an error if err != nil || nicIntf == nil { if response != nil { - return diag.FromErr(fmt.Errorf("[ERROR] Error getting Bare Metal Server (%s) network interface (%s): %s\n%s", bareMetalServerId, nicID, err, response)) + return diag.FromErr(fmt.Errorf("[ERROR] Error getting Bare Metal Server (%s) network interface during read (%s): %s\n%s", bareMetalServerId, nicID, err, response)) } else { - return diag.FromErr(fmt.Errorf("[ERROR] Error getting Bare Metal Server (%s) network interface (%s): %s", bareMetalServerId, nicID, err)) - } + d.SetId("") + return nil + // return diag.FromErr(fmt.Errorf("[ERROR] Error getting Bare Metal Server2 (%s) network interface (%s): %s", bareMetalServerId, nicID, err)) + } // else is returning that the nic is not found anywhere } } err = bareMetalServerNICAllowFloatGet(d, meta, sess, nicIntf, bareMetalServerId) @@ -717,7 +719,7 @@ func bareMetalServerNetworkInterfaceAllowFloatDelete(context context.Context, d if response != nil && response.StatusCode == 404 { return nil } - return fmt.Errorf("[ERROR] Error getting Bare Metal Server (%s) network interface(%s) : %s\n%s", bareMetalServerId, nicId, err, response) + return fmt.Errorf("[ERROR] Error getting Bare Metal Server (%s) network interface(%s) during delete : %s\n%s", bareMetalServerId, nicId, err, response) } nicType := "" switch reflect.TypeOf(nicIntf).String() { From 17e3dfbf08121f48c82785ebfc45851bb48faf72 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 20 Dec 2023 19:01:58 +0530 Subject: [PATCH 114/132] removed sdk dependency on common folder --- .../IBM/vpc-go-sdk/.bumpversion.cfg | 13 - .../github.com/IBM/vpc-go-sdk/.gitattributes | 1 - common/github.com/IBM/vpc-go-sdk/.gitignore | 18 - common/github.com/IBM/vpc-go-sdk/.releaserc | 21 - common/github.com/IBM/vpc-go-sdk/.travis.yml | 39 - common/github.com/IBM/vpc-go-sdk/CHANGELOG.md | 96 - .../IBM/vpc-go-sdk/CODE_OF_CONDUCT.md | 76 - .../github.com/IBM/vpc-go-sdk/CONTRIBUTING.md | 14 - common/github.com/IBM/vpc-go-sdk/LICENSE | 201 - common/github.com/IBM/vpc-go-sdk/Makefile | 23 - common/github.com/IBM/vpc-go-sdk/README.md | 195 - .../IBM/vpc-go-sdk/common/headers.go | 67 - .../IBM/vpc-go-sdk/common/headers_test.go | 30 - .../IBM/vpc-go-sdk/common/version.go | 4 - common/github.com/IBM/vpc-go-sdk/go.mod | 18 - common/github.com/IBM/vpc-go-sdk/go.sum | 143 - .../IBM/vpc-go-sdk/package-lock.json | 828 - .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 115411 --------------- go.mod | 4 +- go.sum | 2 + 20 files changed, 3 insertions(+), 117201 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 87cc2bfcd9..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/common/headers.go +++ /dev/null @@ -1,67 +0,0 @@ -package common - -import ( - "fmt" - "runtime" - - "github.com/google/uuid" -) - -const ( - HEADER_NAME_USER_AGENT = "User-Agent" - - SDK_NAME = "vpc-go-sdk" - - X_CORRELATION_ID = "X-Correlation-Id" - - X_REQUEST_ID = "X-Request-Id" -) - -// GetSdkHeaders - returns the set of SDK-specific headers to be included in an outgoing request. -// -// This function is invoked by generated service methods (i.e. methods which implement the REST API operations -// defined within the API definition). The purpose of this function is to give the SDK implementor the opportunity -// to provide SDK-specific HTTP headers that will be sent with an outgoing REST API request. -// This function is invoked for each invocation of a generated service method, -// so the set of HTTP headers could be request-specific. -// As an optimization, if your SDK will be returning the same set of HTTP headers for each invocation of this -// function, it is recommended that you initialize the returned map just once (perhaps by using -// lazy initialization) and simply return it each time the function is invoked, instead of building it each time -// as in the example below. -// -// Parameters: -// -// serviceName - the name of the service as defined in the API definition (e.g. "MyService1") -// serviceVersion - the version of the service as defined in the API definition (e.g. "V1") -// operationId - the operationId as defined in the API definition (e.g. getContext) -// -// Returns: -// -// a Map which contains the set of headers to be included in the REST API request -func GetSdkHeaders(serviceName string, serviceVersion string, operationId string) map[string]string { - sdkHeaders := make(map[string]string) - - sdkHeaders[HEADER_NAME_USER_AGENT] = GetUserAgentInfo() - sdkHeaders[X_CORRELATION_ID] = GetNewXCorrelationID() - sdkHeaders[X_REQUEST_ID] = GetNewXRequestID() - - return sdkHeaders -} - -var UserAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo()) - -func GetUserAgentInfo() string { - return UserAgent -} -func GetNewXCorrelationID() string { - return uuid.New().String() -} -func GetNewXRequestID() string { - return uuid.New().String() -} - -var systemInfo = fmt.Sprintf("(arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version()) - -func GetSystemInfo() string { - return systemInfo -} diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go deleted file mode 100644 index c8e610ed55..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package common - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestGetSystemInfo(t *testing.T) { - var sysinfo = GetSystemInfo() - assert.NotNil(t, sysinfo) - assert.True(t, strings.Contains(sysinfo, "arch=")) - assert.True(t, strings.Contains(sysinfo, "os=")) - assert.True(t, strings.Contains(sysinfo, "go.version=")) -} - -func TestGetSdkHeaders(t *testing.T) { - var headers = GetSdkHeaders("myService", "v123", "myOperation") - assert.NotNil(t, headers) - - var foundIt bool - - _, foundIt = headers[HEADER_NAME_USER_AGENT] - assert.True(t, foundIt) - _, foundIt = headers[X_CORRELATION_ID] - assert.True(t, foundIt) - _, foundIt = headers[X_REQUEST_ID] - assert.True(t, foundIt) -} diff --git a/common/github.com/IBM/vpc-go-sdk/common/version.go b/common/github.com/IBM/vpc-go-sdk/common/version.go deleted file mode 100644 index 623548bdac..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/common/version.go +++ /dev/null @@ -1,4 +0,0 @@ -package common - -// Version of the SDK -const Version = "0.6.0" diff --git a/common/github.com/IBM/vpc-go-sdk/go.mod b/common/github.com/IBM/vpc-go-sdk/go.mod deleted file mode 100644 index 84658a9757..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/go.mod +++ /dev/null @@ -1,18 +0,0 @@ -module github.com/IBM/vpc-go-sdk - -go 1.16 - -require ( - github.com/IBM/go-sdk-core/v5 v5.12.1 - github.com/go-openapi/strfmt v0.21.3 - github.com/google/uuid v1.1.1 - github.com/onsi/ginkgo v1.16.5 - github.com/onsi/gomega v1.20.0 - github.com/stretchr/testify v1.8.0 -) - -retract ( - v1.0.2 - v1.0.1 - v1.0.0 -) \ No newline at end of file diff --git a/common/github.com/IBM/vpc-go-sdk/go.sum b/common/github.com/IBM/vpc-go-sdk/go.sum deleted file mode 100644 index 88c822dd8e..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/go.sum +++ /dev/null @@ -1,143 +0,0 @@ -github.com/IBM/go-sdk-core/v5 v5.9.1 h1:06pXbD9Rgmqqe2HA5YAeQbB4eYRRFgIoOT+Kh3cp1zo= -github.com/IBM/go-sdk-core/v5 v5.9.1/go.mod h1:axE2JrRq79gIJTjKPBwV6gWHswvVptBjbcvvCPIxARM= -github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= -github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/go-openapi/errors v0.19.8 h1:doM+tQdZbUm9gydV9yR+iQNmztbjj7I3sW4sIcAwIzc= -github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/strfmt v0.21.1 h1:G6s2t5V5kGCHLVbSdZ/6lI8Wm4OzoPFkc3/cjAsKQrM= -github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= -github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= -github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4= -github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= -github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M= -github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ= -github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= -github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= -github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= -go.mongodb.org/mongo-driver v1.7.5 h1:ny3p0reEpgsR2cfA5cjgwFZg3Cv/ofFh/8jbhGtz9VI= -go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+an+ZQdDaD1M= -gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo= -gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/common/github.com/IBM/vpc-go-sdk/package-lock.json b/common/github.com/IBM/vpc-go-sdk/package-lock.json 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 34493ac285..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ /dev/null @@ -1,115411 +0,0 @@ -/** - * (C) Copyright IBM Corp. 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.78.0-67aec9b7-20230818-174940 - */ - -// Package vpcv1 : Operations and models for the VpcV1 service -package vpcv1 - -import ( - "context" - "encoding/json" - "fmt" - "net/http" - "reflect" - "strings" - "time" - - "github.com/IBM/go-sdk-core/v5/core" - common "github.com/IBM/vpc-go-sdk/common" - "github.com/go-openapi/strfmt" -) - -// VpcV1 : The IBM Cloud Virtual Private Cloud (VPC) API can be used to programmatically provision and manage virtual -// server instances, along with subnets, volumes, load balancers, and more. -// -// API Version: 2023-10-10 -type VpcV1 struct { - Service *core.BaseService - - // The infrastructure generation. For the API behavior documented here, specify - // `2`. - generation *int64 - - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-10-10` - // and `2023-10-18`. - Version *string -} - -// DefaultServiceURL is the default URL to make service requests to. -const DefaultServiceURL = "https://us-south.iaas.cloud.ibm.com/v1" - -// DefaultServiceName is the default key used to find external configuration information. -const DefaultServiceName = "vpc" - -// VpcV1Options : Service options -type VpcV1Options struct { - ServiceName string - URL string - Authenticator core.Authenticator - - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-10-10` - // and `2023-10-18`. - Version *string -} - -// NewVpcV1UsingExternalConfig : constructs an instance of VpcV1 with passed in options and external configuration. -func NewVpcV1UsingExternalConfig(options *VpcV1Options) (vpc *VpcV1, err error) { - if options.ServiceName == "" { - options.ServiceName = DefaultServiceName - } - - if options.Authenticator == nil { - options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) - if err != nil { - return - } - } - - vpc, err = NewVpcV1(options) - if err != nil { - return - } - - err = vpc.Service.ConfigureService(options.ServiceName) - if err != nil { - return - } - - if options.URL != "" { - err = vpc.Service.SetServiceURL(options.URL) - } - return -} - -// NewVpcV1 : constructs an instance of VpcV1 with passed in options. -func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { - serviceOptions := &core.ServiceOptions{ - URL: DefaultServiceURL, - Authenticator: options.Authenticator, - } - - err = core.ValidateStruct(options, "options") - if err != nil { - return - } - - baseService, err := core.NewBaseService(serviceOptions) - if err != nil { - return - } - - if options.URL != "" { - err = baseService.SetServiceURL(options.URL) - if err != nil { - return - } - } - - if options.Version == nil { - options.Version = core.StringPtr("2023-10-20") - } - - service = &VpcV1{ - Service: baseService, - generation: core.Int64Ptr(2), - Version: options.Version, - } - - return -} - -// GetServiceURLForRegion returns the service URL to be used for the specified region -func GetServiceURLForRegion(region string) (string, error) { - return "", fmt.Errorf("service does not support regional URLs") -} - -// Clone makes a copy of "vpc" suitable for processing requests. -func (vpc *VpcV1) Clone() *VpcV1 { - if core.IsNil(vpc) { - return nil - } - clone := *vpc - clone.Service = vpc.Service.Clone() - return &clone -} - -// SetServiceURL sets the service URL -func (vpc *VpcV1) SetServiceURL(url string) error { - return vpc.Service.SetServiceURL(url) -} - -// GetServiceURL returns the service URL -func (vpc *VpcV1) GetServiceURL() string { - return vpc.Service.GetServiceURL() -} - -// SetDefaultHeaders sets HTTP headers to be sent in every request -func (vpc *VpcV1) SetDefaultHeaders(headers http.Header) { - vpc.Service.SetDefaultHeaders(headers) -} - -// SetEnableGzipCompression sets the service's EnableGzipCompression field -func (vpc *VpcV1) SetEnableGzipCompression(enableGzip bool) { - vpc.Service.SetEnableGzipCompression(enableGzip) -} - -// GetEnableGzipCompression returns the service's EnableGzipCompression field -func (vpc *VpcV1) GetEnableGzipCompression() bool { - return vpc.Service.GetEnableGzipCompression() -} - -// EnableRetries enables automatic retries for requests invoked for this service instance. -// If either parameter is specified as 0, then a default value is used instead. -func (vpc *VpcV1) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { - vpc.Service.EnableRetries(maxRetries, maxRetryInterval) -} - -// DisableRetries disables automatic retries for requests invoked for this service instance. -func (vpc *VpcV1) DisableRetries() { - vpc.Service.DisableRetries() -} - -// CreateVPC : Create a VPC -// This request creates a new VPC from a VPC prototype object. The prototype object is structured in the same way as a -// retrieved VPC, and contains the information necessary to create the new VPC. -func (vpc *VpcV1) CreateVPC(createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - return vpc.CreateVPCWithContext(context.Background(), createVPCOptions) -} - -// CreateVPCWithContext is an alternate form of the CreateVPC method which supports a Context parameter -func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(createVPCOptions, "createVPCOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createVPCOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPC") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createVPCOptions.AddressPrefixManagement != nil { - body["address_prefix_management"] = createVPCOptions.AddressPrefixManagement - } - if createVPCOptions.ClassicAccess != nil { - body["classic_access"] = createVPCOptions.ClassicAccess - } - if createVPCOptions.Dns != nil { - body["dns"] = createVPCOptions.Dns - } - if createVPCOptions.Name != nil { - body["name"] = createVPCOptions.Name - } - if createVPCOptions.ResourceGroup != nil { - body["resource_group"] = createVPCOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateVPCAddressPrefix : Create an address prefix for a VPC -// This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way -// as a retrieved prefix, and contains the information necessary to create the new prefix. -func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - return vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) -} - -// CreateVPCAddressPrefixWithContext is an alternate form of the CreateVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *createVPCAddressPrefixOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createVPCAddressPrefixOptions.CIDR != nil { - body["cidr"] = createVPCAddressPrefixOptions.CIDR - } - if createVPCAddressPrefixOptions.Zone != nil { - body["zone"] = createVPCAddressPrefixOptions.Zone - } - if createVPCAddressPrefixOptions.IsDefault != nil { - body["is_default"] = createVPCAddressPrefixOptions.IsDefault - } - if createVPCAddressPrefixOptions.Name != nil { - body["name"] = createVPCAddressPrefixOptions.Name - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateVPCDnsResolutionBinding : Create a DNS resolution binding -// This request creates a new DNS resolution binding from a DNS resolution binding prototype object. The prototype -// object is structured in the same way as a retrieved DNS resolution binding, and contains the information necessary to -// create the new DNS resolution binding. -// -// For this request to succeed, `dns.enable_hub` must be `false` for the VPC specified by the identifier in the URL, and -// the VPC must not already have a DNS resolution binding. -// -// See [About DNS sharing for VPE gateways](/docs/vpc?topic=vpc-hub-spoke-model) for more information. -func (vpc *VpcV1) CreateVPCDnsResolutionBinding(createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - return vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) -} - -// CreateVPCDnsResolutionBindingWithContext is an alternate form of the CreateVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *createVPCDnsResolutionBindingOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createVPCDnsResolutionBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCDnsResolutionBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createVPCDnsResolutionBindingOptions.VPC != nil { - body["vpc"] = createVPCDnsResolutionBindingOptions.VPC - } - if createVPCDnsResolutionBindingOptions.Name != nil { - body["name"] = createVPCDnsResolutionBindingOptions.Name - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateVPCRoute : Create a route in a VPC's default routing table -// This request creates a new route in the VPC's default routing table. The route prototype object is structured in the -// same way as a retrieved route, and contains the information necessary to create the new route. The request will fail -// if the new route will cause a loop. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) -} - -// CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") - err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *createVPCRouteOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createVPCRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createVPCRouteOptions.Destination != nil { - body["destination"] = createVPCRouteOptions.Destination - } - if createVPCRouteOptions.Zone != nil { - body["zone"] = createVPCRouteOptions.Zone - } - if createVPCRouteOptions.Action != nil { - body["action"] = createVPCRouteOptions.Action - } - if createVPCRouteOptions.Name != nil { - body["name"] = createVPCRouteOptions.Name - } - if createVPCRouteOptions.NextHop != nil { - body["next_hop"] = createVPCRouteOptions.NextHop - } - if createVPCRouteOptions.Priority != nil { - body["priority"] = createVPCRouteOptions.Priority - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateVPCRoutingTable : Create a routing table for a VPC -// This request creates a routing table from a routing table prototype object. The prototype object is structured in the -// same way as a retrieved routing table, and contains the information necessary to create the new routing table. -func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) -} - -// CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *createVPCRoutingTableOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createVPCRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { - body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom - } - if createVPCRoutingTableOptions.Name != nil { - body["name"] = createVPCRoutingTableOptions.Name - } - if createVPCRoutingTableOptions.RouteDirectLinkIngress != nil { - body["route_direct_link_ingress"] = createVPCRoutingTableOptions.RouteDirectLinkIngress - } - if createVPCRoutingTableOptions.RouteInternetIngress != nil { - body["route_internet_ingress"] = createVPCRoutingTableOptions.RouteInternetIngress - } - if createVPCRoutingTableOptions.RouteTransitGatewayIngress != nil { - body["route_transit_gateway_ingress"] = createVPCRoutingTableOptions.RouteTransitGatewayIngress - } - if createVPCRoutingTableOptions.RouteVPCZoneIngress != nil { - body["route_vpc_zone_ingress"] = createVPCRoutingTableOptions.RouteVPCZoneIngress - } - if createVPCRoutingTableOptions.Routes != nil { - body["routes"] = createVPCRoutingTableOptions.Routes - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateVPCRoutingTableRoute : Create a route in a VPC routing table -// This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the -// same way as a retrieved VPC route and contains the information necessary to create the route. -func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) -} - -// CreateVPCRoutingTableRouteWithContext is an alternate form of the CreateVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *createVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *createVPCRoutingTableRouteOptions.RoutingTableID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createVPCRoutingTableRouteOptions.Destination != nil { - body["destination"] = createVPCRoutingTableRouteOptions.Destination - } - if createVPCRoutingTableRouteOptions.Zone != nil { - body["zone"] = createVPCRoutingTableRouteOptions.Zone - } - if createVPCRoutingTableRouteOptions.Action != nil { - body["action"] = createVPCRoutingTableRouteOptions.Action - } - if createVPCRoutingTableRouteOptions.Name != nil { - body["name"] = createVPCRoutingTableRouteOptions.Name - } - if createVPCRoutingTableRouteOptions.NextHop != nil { - body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop - } - if createVPCRoutingTableRouteOptions.Priority != nil { - body["priority"] = createVPCRoutingTableRouteOptions.Priority - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteVPC : Delete a VPC -// This request deletes a VPC. This operation cannot be reversed. -// -// For this request to succeed: -// - Instances, subnets, public gateways, and endpoint gateways must not reside in this VPC -// - The VPC must not be providing DNS resolution for any other VPCs -// - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero -// -// All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with -// `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. -func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) -} - -// DeleteVPCWithContext is an alternate form of the DeleteVPC method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCOptions, "deleteVPCOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteVPCOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVPCOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - if deleteVPCOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteVPCAddressPrefix : Delete an address prefix -// This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses -// from this prefix. -func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) -} - -// DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, - "id": *deleteVPCAddressPrefixOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteVPCDnsResolutionBinding : Delete a DNS resolution binding -// This request deletes a DNS resolution binding. This operation cannot be reversed. -// -// A DNS resolution binding for a VPC with `dns.enable_hub` set to `true` cannot be deleted. -func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) -} - -// DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCDnsResolutionBindingOptions.VPCID, - "id": *deleteVPCDnsResolutionBindingOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVPCDnsResolutionBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteVPCRoute : Delete a VPC route -// This request deletes a route. This operation cannot be reversed. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) -} - -// DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: DeleteVPCRoute") - err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRouteOptions.VPCID, - "id": *deleteVPCRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVPCRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteVPCRoutingTable : Delete a VPC routing table -// This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the -// VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. -func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) -} - -// DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRoutingTableOptions.VPCID, - "id": *deleteVPCRoutingTableOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVPCRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - if deleteVPCRoutingTableOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCRoutingTableOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteVPCRoutingTableRoute : Delete a VPC routing table route -// This request deletes a VPC route. This operation cannot be reversed. Only VPC routes with an `origin` of `user` are -// allowed to be deleted. -func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) -} - -// DeleteVPCRoutingTableRouteWithContext is an alternate form of the DeleteVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *deleteVPCRoutingTableRouteOptions.RoutingTableID, - "id": *deleteVPCRoutingTableRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetVPC : Retrieve a VPC -// This request retrieves a single VPC specified by the identifier in the URL. -func (vpc *VpcV1) GetVPC(getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - return vpc.GetVPCWithContext(context.Background(), getVPCOptions) -} - -// GetVPCWithContext is an alternate form of the GetVPC method which supports a Context parameter -func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCOptions, "getVPCOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPCOptions, "getVPCOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getVPCOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPCOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVPCAddressPrefix : Retrieve an address prefix -// This request retrieves a single prefix specified by the identifier in the URL. -func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - return vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) -} - -// GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *getVPCAddressPrefixOptions.VPCID, - "id": *getVPCAddressPrefixOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVPCDefaultNetworkACL : Retrieve a VPC's default network ACL -// This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default -// network ACL is applied to any new subnets in the VPC which do not specify a network ACL. -func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { - return vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) -} - -// GetVPCDefaultNetworkACLWithContext is an alternate form of the GetVPCDefaultNetworkACL method which supports a Context parameter -func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getVPCDefaultNetworkACLOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_network_acl`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVPCDefaultRoutingTable : Retrieve a VPC's default routing table -// This request retrieves the default routing table for the VPC specified by the identifier in the URL. The default -// routing table is associated with any subnets in the VPC which have not been explicitly associated with another -// routing table. -func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { - return vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) -} - -// GetVPCDefaultRoutingTableWithContext is an alternate form of the GetVPCDefaultRoutingTable method which supports a Context parameter -func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getVPCDefaultRoutingTableOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_routing_table`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVPCDefaultSecurityGroup : Retrieve a VPC's default security group -// This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources -// created in this VPC that allow a security group to be optionally specified will use this security group by default. -func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { - return vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) -} - -// GetVPCDefaultSecurityGroupWithContext is an alternate form of the GetVPCDefaultSecurityGroup method which supports a Context parameter -func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getVPCDefaultSecurityGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_security_group`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVPCDnsResolutionBinding : Retrieve a DNS resolution binding -// This request retrieves a single DNS resolution binding specified by the identifier in the URL. -func (vpc *VpcV1) GetVPCDnsResolutionBinding(getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - return vpc.GetVPCDnsResolutionBindingWithContext(context.Background(), getVPCDnsResolutionBindingOptions) -} - -// GetVPCDnsResolutionBindingWithContext is an alternate form of the GetVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *getVPCDnsResolutionBindingOptions.VPCID, - "id": *getVPCDnsResolutionBindingOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPCDnsResolutionBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDnsResolutionBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVPCRoute : Retrieve a VPC route -// This request retrieves a single route specified by the identifier in the URL. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) -} - -// GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") - err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *getVPCRouteOptions.VPCID, - "id": *getVPCRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPCRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVPCRoutingTable : Retrieve a VPC routing table -// This request retrieves a single routing table specified by the identifier in the URL. -func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) -} - -// GetVPCRoutingTableWithContext is an alternate form of the GetVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCRoutingTableOptions, "getVPCRoutingTableOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *getVPCRoutingTableOptions.VPCID, - "id": *getVPCRoutingTableOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPCRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVPCRoutingTableRoute : Retrieve a VPC routing table route -// This request retrieves a single VPC route specified by the identifier in the URL path. -func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) -} - -// GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *getVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *getVPCRoutingTableRouteOptions.RoutingTableID, - "id": *getVPCRoutingTableRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVPCAddressPrefixes : List all address prefixes for a VPC -// This request lists all address pool prefixes for a VPC. -func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) -} - -// ListVPCAddressPrefixesWithContext is an alternate form of the ListVPCAddressPrefixes method which supports a Context parameter -func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *listVPCAddressPrefixesOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPCAddressPrefixesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) - } - if listVPCAddressPrefixesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVPCDnsResolutionBindings : List all DNS resolution bindings for a VPC -// This request lists all DNS resolution bindings for a VPC. A DNS resolution binding represents an association with -// another VPC for centralizing DNS name resolution. -// -// If the VPC specified by the identifier in the URL is a DNS hub VPC (has `dns.enable_hub` set to `true`) then there is -// one binding for each VPC bound to the hub VPC. The endpoint gateways in the bound VPCs can allow (using -// `allow_dns_resolution_binding`) the hub VPC to centralize resolution of their DNS names. -// -// If the VPC specified by the identifier in the URL is not a DNS hub VPC, then there is at most one binding (to a hub -// VPC). The endpoint gateways in the VPC specified by the identifier in the URL can allow (using -// `allow_dns_resolution_binding`) its hub VPC to centralize resolution of their DNS names. -// -// To make use of centralized DNS resolution, a VPC bound to a DNS hub VPC must delegate DNS resolution to its hub VPC -// by setting `dns.resolver.type` to `delegate`. -// -// The bindings will be sorted by their `created_at` property values, with newest bindings first. Bindings with -// identical `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListVPCDnsResolutionBindings(listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) -} - -// ListVPCDnsResolutionBindingsWithContext is an alternate form of the ListVPCDnsResolutionBindings method which supports a Context parameter -func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *listVPCDnsResolutionBindingsOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listVPCDnsResolutionBindingsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPCDnsResolutionBindingsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Sort)) - } - if listVPCDnsResolutionBindingsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Start)) - } - if listVPCDnsResolutionBindingsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Limit)) - } - if listVPCDnsResolutionBindingsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Name)) - } - if listVPCDnsResolutionBindingsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCCRN)) - } - if listVPCDnsResolutionBindingsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCName)) - } - if listVPCDnsResolutionBindingsOptions.AccountID != nil { - builder.AddQuery("account.id", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.AccountID)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBindingCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVPCRoutes : List all routes in a VPC's default routing table -// This request lists all routes in the VPC's default routing table. Each route is zone-specific and directs any packets -// matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's -// destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { - return vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) -} - -// ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") - err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutesOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listVPCRoutesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPCRoutesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) - } - if listVPCRoutesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutesOptions.Start)) - } - if listVPCRoutesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutesOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollectionVPCContext) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVPCRoutingTableRoutes : List all routes in a VPC routing table -// This request lists all routes in a VPC routing table. If subnets are associated with this routing table, delivery of -// packets sent on a subnet is performed according to the action of the most specific matching route in the table -// (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, the route with the -// highest priority will be used. If two matching routes have the same destination and priority, traffic will be -// distributed between them. If no routes match, delivery will be controlled by the system's built-in routes. -func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) -} - -// ListVPCRoutingTableRoutesWithContext is an alternate form of the ListVPCRoutingTableRoutes method which supports a Context parameter -func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutingTableRoutesOptions.VPCID, - "routing_table_id": *listVPCRoutingTableRoutesOptions.RoutingTableID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPCRoutingTableRoutesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) - } - if listVPCRoutingTableRoutesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVPCRoutingTables : List all routing tables for a VPC -// This request lists all routing tables for a VPC. Each subnet in a VPC is associated with a routing table, which -// controls delivery of packets sent on that subnet according to the action of the most specific matching route in the -// table. If multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, -// delivery will be controlled by the system's built-in routes. -func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) -} - -// ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter -func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutingTablesOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPCRoutingTablesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) - } - if listVPCRoutingTablesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTablesOptions.Limit)) - } - if listVPCRoutingTablesOptions.IsDefault != nil { - builder.AddQuery("is_default", fmt.Sprint(*listVPCRoutingTablesOptions.IsDefault)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVpcs : List all VPCs -// This request lists all VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical -// isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC -// can contain resources in multiple zones in a region. -func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { - return vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) -} - -// ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter -func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listVpcsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVpcsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) - } - if listVpcsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVpcsOptions.Limit)) - } - if listVpcsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVpcsOptions.ResourceGroupID)) - } - if listVpcsOptions.ClassicAccess != nil { - builder.AddQuery("classic_access", fmt.Sprint(*listVpcsOptions.ClassicAccess)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateVPC : Update a VPC -// This request updates a VPC with the information provided in a VPC patch object. The patch object is structured in the -// same way as a retrieved VPC and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) -} - -// UpdateVPCWithContext is an alternate form of the UpdateVPC method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCOptions, "updateVPCOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateVPCOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateVPCOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVPCOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPCOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateVPCAddressPrefix : Update an address prefix -// This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured -// in the same way as a retrieved prefix and contains only the information to be updated. -func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) -} - -// UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *updateVPCAddressPrefixOptions.VPCID, - "id": *updateVPCAddressPrefixOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPCAddressPrefixOptions.AddressPrefixPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateVPCDnsResolutionBinding : Update a DNS resolution binding -// This request updates a DNS resolution binding with the information in a provided DNS resolution binding patch. The -// DNS resolution binding patch object is structured in the same way as a retrieved DNS resolution binding and contains -// only the information to be updated. -func (vpc *VpcV1) UpdateVPCDnsResolutionBinding(updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) -} - -// UpdateVPCDnsResolutionBindingWithContext is an alternate form of the UpdateVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *updateVPCDnsResolutionBindingOptions.VPCID, - "id": *updateVPCDnsResolutionBindingOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateVPCDnsResolutionBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCDnsResolutionBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateVPCRoute : Update a VPC route -// This request updates a route with the information in a provided route patch. The route patch object is structured in -// the same way as a retrieved route and contains only the information to be updated. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) -} - -// UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") - err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRouteOptions.VPCID, - "id": *updateVPCRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateVPCRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPCRouteOptions.RoutePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateVPCRoutingTable : Update a VPC routing table -// This request updates a routing table with the information in a provided routing table patch. The patch object is -// structured in the same way as a retrieved table and contains only the information to be updated. -func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) -} - -// UpdateVPCRoutingTableWithContext is an alternate form of the UpdateVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRoutingTableOptions.VPCID, - "id": *updateVPCRoutingTableOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVPCRoutingTableOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPCRoutingTableOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateVPCRoutingTableRoute : Update a VPC routing table route -// This request updates a VPC route with the information provided in a route patch object. The patch object is -// structured in the same way as a retrieved VPC route and needs to contain only the information to be updated. Only VPC -// routes with an `origin` of `user` are allowed to be updated. -func (vpc *VpcV1) UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCRoutingTableRouteWithContext(context.Background(), updateVPCRoutingTableRouteOptions) -} - -// UpdateVPCRoutingTableRouteWithContext is an alternate form of the UpdateVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *updateVPCRoutingTableRouteOptions.RoutingTableID, - "id": *updateVPCRoutingTableRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateVPCRoutingTableRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTableRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPCRoutingTableRouteOptions.RoutePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateSubnet : Create a subnet -// This request creates a new subnet from a subnet prototype object. The prototype object is structured in the same way -// as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, -// the prototype's CIDR block must not overlap with an existing subnet in the VPC. -func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - return vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) -} - -// CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter -func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createSubnetOptions.SubnetPrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateSubnetReservedIP : Reserve an IP in a subnet -// This request reserves an IP address in a subnet. If the provided prototype object includes an `address`, the address -// must not already be reserved. -func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) -} - -// CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "subnet_id": *createSubnetReservedIPOptions.SubnetID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createSubnetReservedIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createSubnetReservedIPOptions.Address != nil { - body["address"] = createSubnetReservedIPOptions.Address - } - if createSubnetReservedIPOptions.AutoDelete != nil { - body["auto_delete"] = createSubnetReservedIPOptions.AutoDelete - } - if createSubnetReservedIPOptions.Name != nil { - body["name"] = createSubnetReservedIPOptions.Name - } - if createSubnetReservedIPOptions.Target != nil { - body["target"] = createSubnetReservedIPOptions.Target - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteSubnet : Delete a subnet -// This request deletes a subnet. This operation cannot be reversed. For this request to succeed, the subnet must not be -// referenced by any bare metal server network interfaces, instance network interfaces, virtual network interfaces, VPN -// gateways, or load balancers. A delete operation automatically detaches the subnet from any network ACLs, public -// gateways, or endpoint gateways. All flow log collectors with `auto_delete` set to `true` targeting the subnet or any -// resource in the subnet are automatically deleted. -func (vpc *VpcV1) DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) -} - -// DeleteSubnetWithContext is an alternate form of the DeleteSubnet method which supports a Context parameter -func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSubnetOptions, "deleteSubnetOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteSubnetOptions, "deleteSubnetOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteSubnetOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnet") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteSubnetReservedIP : Delete a reserved IP -// This request releases a reserved IP. This operation cannot be reversed. -// -// For this request to succeed, the reserved IP must not be required by another resource, such as a bare metal server -// network interface, instance network interface or virtual network interface for which it is the primary IP. A -// provider-owned reserved IP is not allowed to be deleted. -func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) -} - -// DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "subnet_id": *deleteSubnetReservedIPOptions.SubnetID, - "id": *deleteSubnetReservedIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetSubnet : Retrieve a subnet -// This request retrieves a single subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - return vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) -} - -// GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter -func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getSubnetOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetSubnetNetworkACL : Retrieve a subnet's attached network ACL -// This request retrieves the network ACL attached to the subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetNetworkACL(getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - return vpc.GetSubnetNetworkACLWithContext(context.Background(), getSubnetNetworkACLOptions) -} - -// GetSubnetNetworkACLWithContext is an alternate form of the GetSubnetNetworkACL method which supports a Context parameter -func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getSubnetNetworkACLOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getSubnetNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetSubnetPublicGateway : Retrieve a subnet's attached public gateway -// This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - return vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) -} - -// GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getSubnetPublicGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetSubnetReservedIP : Retrieve a reserved IP -// This request retrieves a single reserved IP specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) -} - -// GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "subnet_id": *getSubnetReservedIPOptions.SubnetID, - "id": *getSubnetReservedIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getSubnetReservedIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetSubnetRoutingTable : Retrieve a subnet's attached routing table -// This request retrieves the routing table attached to the subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) -} - -// GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter -func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getSubnetRoutingTableOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListSubnetReservedIps : List all reserved IPs in a subnet -// This request lists all reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet -// which is not available for use. -func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { - return vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) -} - -// ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter -func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "subnet_id": *listSubnetReservedIpsOptions.SubnetID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSubnetReservedIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) - } - if listSubnetReservedIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSubnetReservedIpsOptions.Limit)) - } - if listSubnetReservedIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) - } - if listSubnetReservedIpsOptions.TargetID != nil { - builder.AddQuery("target.id", fmt.Sprint(*listSubnetReservedIpsOptions.TargetID)) - } - if listSubnetReservedIpsOptions.TargetCRN != nil { - builder.AddQuery("target.crn", fmt.Sprint(*listSubnetReservedIpsOptions.TargetCRN)) - } - if listSubnetReservedIpsOptions.TargetName != nil { - builder.AddQuery("target.name", fmt.Sprint(*listSubnetReservedIpsOptions.TargetName)) - } - if listSubnetReservedIpsOptions.TargetResourceType != nil { - builder.AddQuery("target.resource_type", fmt.Sprint(*listSubnetReservedIpsOptions.TargetResourceType)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListSubnets : List all subnets -// This request lists all subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block -// notation. Each subnet is within a particular zone and cannot span multiple zones or regions. -func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { - return vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) -} - -// ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter -func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listSubnetsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSubnetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) - } - if listSubnetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSubnetsOptions.Limit)) - } - if listSubnetsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) - } - if listSubnetsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listSubnetsOptions.ZoneName)) - } - if listSubnetsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listSubnetsOptions.VPCID)) - } - if listSubnetsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listSubnetsOptions.VPCCRN)) - } - if listSubnetsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listSubnetsOptions.VPCName)) - } - if listSubnetsOptions.RoutingTableID != nil { - builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) - } - if listSubnetsOptions.RoutingTableName != nil { - builder.AddQuery("routing_table.name", fmt.Sprint(*listSubnetsOptions.RoutingTableName)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ReplaceSubnetNetworkACL : Replace the network ACL for a subnet -// This request replaces the existing network ACL for a subnet with the network ACL specified in the request body. -func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - return vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) -} - -// ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter -func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *replaceSubnetNetworkACLOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(replaceSubnetNetworkACLOptions.NetworkACLIdentity) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ReplaceSubnetRoutingTable : Replace the routing table for a subnet -// This request replaces the existing routing table for a subnet with the routing table specified in the request body. -// -// For this request to succeed, the routing table `route_direct_link_ingress`, -// `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. -func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) -} - -// ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter -func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *replaceSubnetRoutingTableOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(replaceSubnetRoutingTableOptions.RoutingTableIdentity) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) - if err != nil { - return - } - response.Result = result - } - - return -} - -// SetSubnetPublicGateway : Attach a public gateway to a subnet -// This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet -// identifier in the URL. The public gateway must have the same VPC and zone as the subnet. -func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - return vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) -} - -// SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *setSubnetPublicGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(setSubnetPublicGatewayOptions.PublicGatewayIdentity) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UnsetSubnetPublicGateway : Detach a public gateway from a subnet -// This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. -func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { - return vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) -} - -// UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *unsetSubnetPublicGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// UpdateSubnet : Update a subnet -// This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured -// in the same way as a retrieved subnet and contains only the information to be updated. -func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - return vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) -} - -// UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter -func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateSubnetOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateSubnetOptions.SubnetPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateSubnetReservedIP : Update a reserved IP -// This request updates a reserved IP with the information in a provided reserved IP patch. The reserved IP patch object -// is structured in the same way as a retrieved reserved IP and contains only the information to be updated. -// -// A provider-owned reserved IP is not allowed to be updated. -func (vpc *VpcV1) UpdateSubnetReservedIP(updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.UpdateSubnetReservedIPWithContext(context.Background(), updateSubnetReservedIPOptions) -} - -// UpdateSubnetReservedIPWithContext is an alternate form of the UpdateSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "subnet_id": *updateSubnetReservedIPOptions.SubnetID, - "id": *updateSubnetReservedIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateSubnetReservedIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateSubnetReservedIPOptions.ReservedIPPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateImage : Create an image -// This request creates a new image from an image prototype object. The prototype object is structured in the same way -// as a retrieved image, and contains the information necessary to create the new image. If an image is being imported, -// a URL to the image file on object storage must be specified. If an image is being created from an existing volume, -// that volume must be specified. -func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - return vpc.CreateImageWithContext(context.Background(), createImageOptions) -} - -// CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter -func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createImageOptions, "createImageOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateImageExportJob : Create an image export job -// This request creates and queues a new export job for the image specified in the URL using the image export job -// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or -// `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains -// the information necessary to create and queue the new image export job. -func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - return vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) -} - -// CreateImageExportJobWithContext is an alternate form of the CreateImageExportJob method which supports a Context parameter -func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createImageExportJobOptions, "createImageExportJobOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "image_id": *createImageExportJobOptions.ImageID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createImageExportJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createImageExportJobOptions.StorageBucket != nil { - body["storage_bucket"] = createImageExportJobOptions.StorageBucket - } - if createImageExportJobOptions.Format != nil { - body["format"] = createImageExportJobOptions.Format - } - if createImageExportJobOptions.Name != nil { - body["name"] = createImageExportJobOptions.Name - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteImage : Delete an image -// This request deletes an image. Any active image export jobs will be completed first. This operation cannot be -// reversed. A system-provided image is not allowed to be deleted. Additionally, an image cannot be deleted if it: -// - has a `status` of `deleting` -// - has a `status` of `pending` with a `status_reasons` code of `image_request_in_progress` -// - has `catalog_offering.managed` set to `true`. -func (vpc *VpcV1) DeleteImage(deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteImageWithContext(context.Background(), deleteImageOptions) -} - -// DeleteImageWithContext is an alternate form of the DeleteImage method which supports a Context parameter -func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteImageOptions, "deleteImageOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteImageOptions, "deleteImageOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteImageOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImage") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteImageExportJob : Delete an image export job -// This request deletes an image export job. This operation cannot be reversed. If the job has not completed, the job -// will be canceled, and the incomplete exported image object deleted. If the job has completed, the exported image -// object will not be deleted. -func (vpc *VpcV1) DeleteImageExportJob(deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) -} - -// DeleteImageExportJobWithContext is an alternate form of the DeleteImageExportJob method which supports a Context parameter -func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteImageExportJobOptions, "deleteImageExportJobOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "image_id": *deleteImageExportJobOptions.ImageID, - "id": *deleteImageExportJobOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteImageExportJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeprecateImage : Deprecate an image -// This request deprecates an image, resulting in its `status` becoming `deprecated` and -// `deprecation_at` being set to the current date and time. -// -// The image must: -// - have a `status` of `available` -// - have `catalog_offering.managed` set to `false` -// - not have `deprecation_at` set -// -// The image must not have `deprecation_at` set, must have `catalog_offering.managed` set to -// `false`, and must have a `status` of `available`. -// -// A system-provided image is not allowed to be deprecated. -func (vpc *VpcV1) DeprecateImage(deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { - return vpc.DeprecateImageWithContext(context.Background(), deprecateImageOptions) -} - -// DeprecateImageWithContext is an alternate form of the DeprecateImage method which supports a Context parameter -func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deprecateImageOptions, "deprecateImageOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deprecateImageOptions, "deprecateImageOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deprecateImageOptions.ID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/deprecate`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deprecateImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeprecateImage") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetImage : Retrieve an image -// This request retrieves a single image specified by the identifier in the URL. -func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { - return vpc.GetImageWithContext(context.Background(), getImageOptions) -} - -// GetImageWithContext is an alternate form of the GetImage method which supports a Context parameter -func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getImageOptions, "getImageOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getImageOptions, "getImageOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getImageOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetImageExportJob : Retrieve an image export job -// This request retrieves a single image export job specified by the identifier in the URL. -func (vpc *VpcV1) GetImageExportJob(getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - return vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) -} - -// GetImageExportJobWithContext is an alternate form of the GetImageExportJob method which supports a Context parameter -func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getImageExportJobOptions, "getImageExportJobOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "image_id": *getImageExportJobOptions.ImageID, - "id": *getImageExportJobOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getImageExportJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImageExportJob") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetOperatingSystem : Retrieve an operating system -// This request retrieves a single operating system specified by the name in the URL. -func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { - return vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) -} - -// GetOperatingSystemWithContext is an alternate form of the GetOperatingSystem method which supports a Context parameter -func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getOperatingSystemOptions, "getOperatingSystemOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "name": *getOperatingSystemOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems/{name}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getOperatingSystemOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListImageExportJobs : List all image export jobs -// This request lists all export jobs for an image. Each job tracks the exporting of the image to another location, such -// as a bucket within cloud object storage. -// -// The jobs will be sorted by their `created_at` property values, with newest jobs first. Jobs with identical -// `created_at` property values will in turn be sorted by ascending -// `name` property values. -func (vpc *VpcV1) ListImageExportJobs(listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListImageExportJobsWithContext(context.Background(), listImageExportJobsOptions) -} - -// ListImageExportJobsWithContext is an alternate form of the ListImageExportJobs method which supports a Context parameter -func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listImageExportJobsOptions, "listImageExportJobsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listImageExportJobsOptions, "listImageExportJobsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "image_id": *listImageExportJobsOptions.ImageID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listImageExportJobsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageExportJobs") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listImageExportJobsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJobUnpaginatedCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListImages : List all images -// This request lists all images available in the region. An image provides source data for a volume. Images are either -// system-provided, or created from another source, such as importing from Cloud Object Storage. -func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { - return vpc.ListImagesWithContext(context.Background(), listImagesOptions) -} - -// ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter -func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listImagesOptions, "listImagesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listImagesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listImagesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) - } - if listImagesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listImagesOptions.Limit)) - } - if listImagesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listImagesOptions.ResourceGroupID)) - } - if listImagesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) - } - if listImagesOptions.Status != nil { - builder.AddQuery("status", strings.Join(listImagesOptions.Status, ",")) - } - if listImagesOptions.Visibility != nil { - builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListOperatingSystems : List all operating systems -// This request lists all operating systems in the region. -func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { - return vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) -} - -// ListOperatingSystemsWithContext is an alternate form of the ListOperatingSystems method which supports a Context parameter -func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listOperatingSystemsOptions, "listOperatingSystemsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listOperatingSystemsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listOperatingSystemsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) - } - if listOperatingSystemsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listOperatingSystemsOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ObsoleteImage : Obsolete an image -// This request obsoletes an image, resulting in its `status` becoming `obsolete` and -// `obsolescence_at` being set to the current date and time. -// -// The image must: -// - have a `status` of `available` or `deprecated` -// - have `catalog_offering.managed` set to `false` -// - not have `deprecation_at` set in the future -// - not have `obsolescence_at` set -// -// A system-provided image is not allowed to be obsoleted. -func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { - return vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) -} - -// ObsoleteImageWithContext is an alternate form of the ObsoleteImage method which supports a Context parameter -func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(obsoleteImageOptions, "obsoleteImageOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *obsoleteImageOptions.ID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/obsolete`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range obsoleteImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// UpdateImage : Update an image -// This request updates an image with the information in a provided image patch. The image patch object is structured in -// the same way as a retrieved image and contains only the information to be updated. A system-provided image is not -// allowed to be updated. An image with a `status` of `deleting` cannot be updated. -func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - return vpc.UpdateImageWithContext(context.Background(), updateImageOptions) -} - -// UpdateImageWithContext is an alternate form of the UpdateImage method which supports a Context parameter -func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateImageOptions, "updateImageOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateImageOptions, "updateImageOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateImageOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateImageOptions.ImagePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateImageExportJob : Update an image export job -// This request updates an image export job with the information in a provided image export job patch. The image export -// job patch object is structured in the same way as a retrieved image export job and contains only the information to -// be updated. -func (vpc *VpcV1) UpdateImageExportJob(updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - return vpc.UpdateImageExportJobWithContext(context.Background(), updateImageExportJobOptions) -} - -// UpdateImageExportJobWithContext is an alternate form of the UpdateImageExportJob method which supports a Context parameter -func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateImageExportJobOptions, "updateImageExportJobOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateImageExportJobOptions, "updateImageExportJobOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "image_id": *updateImageExportJobOptions.ImageID, - "id": *updateImageExportJobOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateImageExportJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImageExportJob") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateImageExportJobOptions.ImageExportJobPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateKey : Create a key -// This request creates a new SSH key from an key prototype object. The prototype object is structured in the same way -// as a retrieved key, and contains the information necessary to create the new key. The public key value must be -// provided. -func (vpc *VpcV1) CreateKey(createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - return vpc.CreateKeyWithContext(context.Background(), createKeyOptions) -} - -// CreateKeyWithContext is an alternate form of the CreateKey method which supports a Context parameter -func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createKeyOptions, "createKeyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createKeyOptions, "createKeyOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createKeyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateKey") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createKeyOptions.PublicKey != nil { - body["public_key"] = createKeyOptions.PublicKey - } - if createKeyOptions.Name != nil { - body["name"] = createKeyOptions.Name - } - if createKeyOptions.ResourceGroup != nil { - body["resource_group"] = createKeyOptions.ResourceGroup - } - if createKeyOptions.Type != nil { - body["type"] = createKeyOptions.Type - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteKey : Delete a key -// This request deletes a key. This operation cannot be reversed. -func (vpc *VpcV1) DeleteKey(deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteKeyWithContext(context.Background(), deleteKeyOptions) -} - -// DeleteKeyWithContext is an alternate form of the DeleteKey method which supports a Context parameter -func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteKeyOptions, "deleteKeyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteKeyOptions, "deleteKeyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteKeyOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteKeyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteKey") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetKey : Retrieve a key -// This request retrieves a single key specified by the identifier in the URL. -func (vpc *VpcV1) GetKey(getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - return vpc.GetKeyWithContext(context.Background(), getKeyOptions) -} - -// GetKeyWithContext is an alternate form of the GetKey method which supports a Context parameter -func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getKeyOptions, "getKeyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getKeyOptions, "getKeyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getKeyOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getKeyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetKey") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListKeys : List all keys -// This request lists all keys in the region. A key contains a public SSH key which may be installed on instances when -// they are created. Private keys are not stored. -func (vpc *VpcV1) ListKeys(listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { - return vpc.ListKeysWithContext(context.Background(), listKeysOptions) -} - -// ListKeysWithContext is an alternate form of the ListKeys method which supports a Context parameter -func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listKeysOptions, "listKeysOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listKeysOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListKeys") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listKeysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listKeysOptions.Start)) - } - if listKeysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listKeysOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKeyCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateKey : Update a key -// This request updates a key's name. -func (vpc *VpcV1) UpdateKey(updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - return vpc.UpdateKeyWithContext(context.Background(), updateKeyOptions) -} - -// UpdateKeyWithContext is an alternate form of the UpdateKey method which supports a Context parameter -func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateKeyOptions, "updateKeyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateKeyOptions, "updateKeyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateKeyOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateKeyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateKey") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateKeyOptions.KeyPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) - if err != nil { - return - } - response.Result = result - } - - return -} - -// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with an instance network interface -// This request associates the specified floating IP with the specified instance network interface, replacing any -// existing association. For this request to succeed, the existing floating IP must not be required by another resource, -// such as a public gateway. A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) -} - -// AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *addInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *addInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *addInstanceNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateInstance : Create an instance -// This request provisions a new instance from an instance prototype object. The prototype object is structured in the -// same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance -// is automatically started. -func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) -} - -// CreateInstanceWithContext is an alternate form of the CreateInstance method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceOptions, "createInstanceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createInstanceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createInstanceOptions.InstancePrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateInstanceAction : Create an instance action -// This request creates a new action which will be queued up to run as soon as any pending or running actions have -// completed. -func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) -} - -// CreateInstanceActionWithContext is an alternate form of the CreateInstanceAction method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceActionOptions, "createInstanceActionOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *createInstanceActionOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/actions`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createInstanceActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createInstanceActionOptions.Type != nil { - body["type"] = createInstanceActionOptions.Type - } - if createInstanceActionOptions.Force != nil { - body["force"] = createInstanceActionOptions.Force - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateInstanceConsoleAccessToken : Create a console access token for an instance -// This request creates a new single-use console access token for an instance. All console configuration is provided at -// token create time, and the token is subsequently used in the `access_token` query parameter for the WebSocket -// request. The access token is only valid for a short period of time, and a maximum of one token is valid for a given -// instance at a time. -func (vpc *VpcV1) CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) -} - -// CreateInstanceConsoleAccessTokenWithContext is an alternate form of the CreateInstanceConsoleAccessToken method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Context, createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *createInstanceConsoleAccessTokenOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/console_access_token`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createInstanceConsoleAccessTokenOptions.ConsoleType != nil { - body["console_type"] = createInstanceConsoleAccessTokenOptions.ConsoleType - } - if createInstanceConsoleAccessTokenOptions.Force != nil { - body["force"] = createInstanceConsoleAccessTokenOptions.Force - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateInstanceNetworkAttachment : Create a network attachment on an instance -// This request creates a new instance network attachment from an instance network attachment prototype object. The -// prototype object is structured in the same way as a retrieved instance network attachment, and contains the -// information necessary to create the new instance network attachment. -func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) -} - -// CreateInstanceNetworkAttachmentWithContext is an alternate form of the CreateInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context, createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *createInstanceNetworkAttachmentOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createInstanceNetworkAttachmentOptions.VirtualNetworkInterface != nil { - body["virtual_network_interface"] = createInstanceNetworkAttachmentOptions.VirtualNetworkInterface - } - if createInstanceNetworkAttachmentOptions.Name != nil { - body["name"] = createInstanceNetworkAttachmentOptions.Name - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) - if err != nil { - return - } - response.Result = result - } - - return -} - -// 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. -func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) -} - -// CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *createInstanceNetworkInterfaceOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createInstanceNetworkInterfaceOptions.Subnet != nil { - body["subnet"] = createInstanceNetworkInterfaceOptions.Subnet - } - if createInstanceNetworkInterfaceOptions.AllowIPSpoofing != nil { - body["allow_ip_spoofing"] = createInstanceNetworkInterfaceOptions.AllowIPSpoofing - } - if createInstanceNetworkInterfaceOptions.Name != nil { - body["name"] = createInstanceNetworkInterfaceOptions.Name - } - if createInstanceNetworkInterfaceOptions.PrimaryIP != nil { - body["primary_ip"] = createInstanceNetworkInterfaceOptions.PrimaryIP - } - if createInstanceNetworkInterfaceOptions.SecurityGroups != nil { - body["security_groups"] = createInstanceNetworkInterfaceOptions.SecurityGroups - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateInstanceTemplate : Create an instance template -// This request creates a new instance template. The prototype object is structured in the same way as a retrieved -// instance template, and contains the information necessary to provision a new instance from the template. -// -// If a `source_template` is specified in the prototype object, its contents are copied into the new template prior to -// copying any other properties provided in the prototype object. -func (vpc *VpcV1) CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) -} - -// CreateInstanceTemplateWithContext is an alternate form of the CreateInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceTemplateOptions, "createInstanceTemplateOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createInstanceTemplateOptions, "createInstanceTemplateOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createInstanceTemplateOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceTemplate") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createInstanceTemplateOptions.InstanceTemplatePrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateInstanceVolumeAttachment : Create a volume attachment on an instance -// This request creates a new volume attachment from a volume attachment prototype object, connecting a volume to an -// instance. For this request to succeed, the specified volume must not be busy. The prototype object is structured in -// the same way as a retrieved volume attachment, and contains the information necessary to create the new volume -// attachment. -func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) -} - -// CreateInstanceVolumeAttachmentWithContext is an alternate form of the CreateInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *createInstanceVolumeAttachmentOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createInstanceVolumeAttachmentOptions.Volume != nil { - body["volume"] = createInstanceVolumeAttachmentOptions.Volume - } - if createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete != nil { - body["delete_volume_on_instance_delete"] = createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete - } - if createInstanceVolumeAttachmentOptions.Name != nil { - body["name"] = createInstanceVolumeAttachmentOptions.Name - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteInstance : Delete an instance -// This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with instance -// network interfaces are implicitly disassociated. All virtual network interfaces with `auto_delete` set to `true` -// targeting instance network attachments on the instance are automatically deleted. All flow log collectors with -// `auto_delete` set to `true` targeting the instance, the instance network attachments, the instance network -// interfaces, or the automatically deleted virtual network interfaces are automatically deleted. -func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) -} - -// DeleteInstanceWithContext is an alternate form of the DeleteInstance method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceOptions, "deleteInstanceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceOptions, "deleteInstanceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteInstanceOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteInstanceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstance") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteInstanceNetworkAttachment : Delete an instance network attachment -// This request deletes an instance network attachment. This operation cannot be reversed. Any floating IPs associated -// with the instance network attachment are implicitly disassociated. All flow log collectors with `auto_delete` set to -// `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment -// is not allowed to be deleted. -func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) -} - -// DeleteInstanceNetworkAttachmentWithContext is an alternate form of the DeleteInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context, deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceNetworkAttachmentOptions.InstanceID, - "id": *deleteInstanceNetworkAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteInstanceNetworkInterface : Delete an instance network interface -// This request deletes an instance network interface. This operation cannot be reversed. Any floating IPs associated -// with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to -// `true` targeting the instance network interface are automatically deleted. The primary instance network interface is -// not allowed to be deleted. -func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) -} - -// DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceNetworkInterfaceOptions.InstanceID, - "id": *deleteInstanceNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteInstanceTemplate : Delete an instance template -// This request deletes the instance template. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) -} - -// DeleteInstanceTemplateWithContext is an alternate form of the DeleteInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteInstanceTemplateOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteInstanceVolumeAttachment : Delete a volume attachment -// This request deletes a volume attachment. This operation cannot be reversed, but a new volume attachment may -// subsequently be created for the volume. For this request to succeed, the volume must not be busy. -func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) -} - -// DeleteInstanceVolumeAttachmentWithContext is an alternate form of the DeleteInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceVolumeAttachmentOptions.InstanceID, - "id": *deleteInstanceVolumeAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetInstance : Retrieve an instance -// This request retrieves a single instance specified by the identifier in the URL. -func (vpc *VpcV1) GetInstance(getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - return vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) -} - -// GetInstanceWithContext is an alternate form of the GetInstance method which supports a Context parameter -func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceOptions, "getInstanceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceOptions, "getInstanceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getInstanceOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstance") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetInstanceDisk : Retrieve an instance disk -// This request retrieves a single instance disk specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - return vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) -} - -// GetInstanceDiskWithContext is an alternate form of the GetInstanceDisk method which supports a Context parameter -func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceDiskOptions, "getInstanceDiskOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *getInstanceDiskOptions.InstanceID, - "id": *getInstanceDiskOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetInstanceInitialization : Retrieve initialization configuration for an instance -// This request retrieves configuration used to initialize the instance, such as SSH keys and the Windows administrator -// password. These can subsequently be changed on the instance and therefore may not be current. -func (vpc *VpcV1) GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { - return vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) -} - -// GetInstanceInitializationWithContext is an alternate form of the GetInstanceInitialization method which supports a Context parameter -func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceInitializationOptions, "getInstanceInitializationOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceInitializationOptions, "getInstanceInitializationOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getInstanceInitializationOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}/initialization`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceInitializationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceInitialization") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceInitialization) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetInstanceNetworkAttachment : Retrieve an instance network attachment -// This request retrieves a single instance network attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) -} - -// GetInstanceNetworkAttachmentWithContext is an alternate form of the GetInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkAttachmentOptions.InstanceID, - "id": *getInstanceNetworkAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetInstanceNetworkInterface : Retrieve an instance network interface -// This request retrieves a single instance network interface specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) -} - -// GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceOptions.InstanceID, - "id": *getInstanceNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP address if it is associated with the instance network interface and -// instance specified in the URL. -func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) -} - -// GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *getInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *getInstanceNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP -// This request retrieves the primary reserved IP for an instance network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) -} - -// GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceIP") - err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceIPOptions.InstanceID, - "network_interface_id": *getInstanceNetworkInterfaceIPOptions.NetworkInterfaceID, - "id": *getInstanceNetworkInterfaceIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetInstanceProfile : Retrieve an instance profile -// This request retrieves a single instance profile specified by the name in the URL. -func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { - return vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) -} - -// GetInstanceProfileWithContext is an alternate form of the GetInstanceProfile method which supports a Context parameter -func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceProfileOptions, "getInstanceProfileOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "name": *getInstanceProfileOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetInstanceTemplate : Retrieve an instance template -// This request retrieves a single instance template specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) -} - -// GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getInstanceTemplateOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceTemplateOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetInstanceVolumeAttachment : Retrieve a volume attachment -// This request retrieves a single volume attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - return vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) -} - -// GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, - "id": *getInstanceVolumeAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstanceDisks : List all disks on an instance -// This request lists all disks on an instance. A disk is a block device that is locally attached to the instance's -// physical host and is also referred to as instance storage. By default, the listed disks are sorted by their -// `created_at` property values, with the newest disk first. -func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) -} - -// ListInstanceDisksWithContext is an alternate form of the ListInstanceDisks method which supports a Context parameter -func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceDisksOptions, "listInstanceDisksOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *listInstanceDisksOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listInstanceDisksOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstanceNetworkAttachments : List all network attachments on an instance -// This request lists all network attachments on an instance. A network attachment represents a device on the instance -// to which a virtual network interface is attached. -// -// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. -// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property -// values. -func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) -} - -// ListInstanceNetworkAttachmentsWithContext is an alternate form of the ListInstanceNetworkAttachments method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkAttachmentsOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachmentCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with an instance network interface -// This request lists all floating IPs associated with an instance network interface. -func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) -} - -// ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfaceFloatingIpsOptions.InstanceID, - "network_interface_id": *listInstanceNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface -// This request lists the primary reserved IP for an instance network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) -} - -// ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceIps") - err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfaceIpsOptions.InstanceID, - "network_interface_id": *listInstanceNetworkInterfaceIpsOptions.NetworkInterfaceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listInstanceNetworkInterfaceIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listInstanceNetworkInterfaceIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) - } - if listInstanceNetworkInterfaceIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstanceNetworkInterfaces : List all network interfaces on an instance -// This request lists all network interfaces on an instance. An instance network interface is an abstract representation -// of a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to -// any subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on -// the instance may also attach to the same subnet. -func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) -} - -// ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfacesOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstanceProfiles : List all instance profiles -// This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the -// region. An instance profile specifies the performance characteristics and pricing model for an instance. -func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) -} - -// ListInstanceProfilesWithContext is an alternate form of the ListInstanceProfiles method which supports a Context parameter -func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstanceProfilesOptions, "listInstanceProfilesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listInstanceProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstanceTemplates : List all instance templates -// This request lists all instance templates in the region. -func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) -} - -// ListInstanceTemplatesWithContext is an alternate form of the ListInstanceTemplates method which supports a Context parameter -func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstanceTemplatesOptions, "listInstanceTemplatesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listInstanceTemplatesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplateCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstanceVolumeAttachments : List all volumes attachments on an instance -// This request lists all volume attachments on an instance. A volume attachment connects a volume to an instance. Each -// instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one -// volume. -func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) -} - -// ListInstanceVolumeAttachmentsWithContext is an alternate form of the ListInstanceVolumeAttachments method which supports a Context parameter -func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *listInstanceVolumeAttachmentsOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachmentCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstances : List all instances -// This request lists all instances in the region. -func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) -} - -// ListInstancesWithContext is an alternate form of the ListInstances method which supports a Context parameter -func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstancesOptions, "listInstancesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listInstancesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listInstancesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) - } - if listInstancesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstancesOptions.Limit)) - } - if listInstancesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listInstancesOptions.ResourceGroupID)) - } - if listInstancesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) - } - if listInstancesOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) - } - if listInstancesOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) - } - if listInstancesOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) - } - if listInstancesOptions.DedicatedHostID != nil { - builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) - } - if listInstancesOptions.DedicatedHostCRN != nil { - builder.AddQuery("dedicated_host.crn", fmt.Sprint(*listInstancesOptions.DedicatedHostCRN)) - } - if listInstancesOptions.DedicatedHostName != nil { - builder.AddQuery("dedicated_host.name", fmt.Sprint(*listInstancesOptions.DedicatedHostName)) - } - if listInstancesOptions.PlacementGroupID != nil { - builder.AddQuery("placement_group.id", fmt.Sprint(*listInstancesOptions.PlacementGroupID)) - } - if listInstancesOptions.PlacementGroupCRN != nil { - builder.AddQuery("placement_group.crn", fmt.Sprint(*listInstancesOptions.PlacementGroupCRN)) - } - if listInstancesOptions.PlacementGroupName != nil { - builder.AddQuery("placement_group.name", fmt.Sprint(*listInstancesOptions.PlacementGroupName)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from an instance network interface -// This request disassociates the specified floating IP from the specified instance network interface. -func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) -} - -// RemoveInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *removeInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *removeInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *removeInstanceNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range removeInstanceNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveInstanceNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// UpdateInstance : Update an instance -// This request updates an instance with the information in a provided instance patch. The instance patch object is -// structured in the same way as a retrieved instance and contains only the information to be updated. -func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) -} - -// UpdateInstanceWithContext is an alternate form of the UpdateInstance method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceOptions, "updateInstanceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateInstanceOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateInstanceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateInstanceDisk : Update an instance disk -// This request updates the instance disk with the information in a provided patch. -func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) -} - -// UpdateInstanceDiskWithContext is an alternate form of the UpdateInstanceDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceDiskOptions, "updateInstanceDiskOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *updateInstanceDiskOptions.InstanceID, - "id": *updateInstanceDiskOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateInstanceDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateInstanceDiskOptions.InstanceDiskPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateInstanceNetworkAttachment : Update an instance network attachment -// This request updates an instance network attachment with the information provided in an instance network interface -// patch object. The instance network attachment patch object is structured in the same way as a retrieved instance -// network attachment and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) -} - -// UpdateInstanceNetworkAttachmentWithContext is an alternate form of the UpdateInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context, updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *updateInstanceNetworkAttachmentOptions.InstanceID, - "id": *updateInstanceNetworkAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateInstanceNetworkInterface : Update an instance network interface -// This request updates an instance network interface with the information provided in an instance network interface -// patch object. The instance network interface patch object is structured in the same way as a retrieved instance -// network interface and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) -} - -// UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *updateInstanceNetworkInterfaceOptions.InstanceID, - "id": *updateInstanceNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateInstanceTemplate : Update an instance template -// This request updates an instance template with the information provided in the instance template patch. The instance -// template patch object is structured in the same way as a retrieved instance template and contains only the -// information to be updated. -func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) -} - -// UpdateInstanceTemplateWithContext is an alternate form of the UpdateInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceTemplateOptions, "updateInstanceTemplateOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateInstanceTemplateOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateInstanceTemplateOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateInstanceTemplateOptions.InstanceTemplatePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateInstanceVolumeAttachment : Update a volume attachment -// This request updates a volume attachment with the information provided in a volume attachment patch object. The -// volume attachment patch object is structured in the same way as a retrieved volume attachment and needs to contain -// only the information to be updated. -func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) -} - -// UpdateInstanceVolumeAttachmentWithContext is an alternate form of the UpdateInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_id": *updateInstanceVolumeAttachmentOptions.InstanceID, - "id": *updateInstanceVolumeAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateInstanceGroup : Create an instance group -// This request creates a new instance group. -func (vpc *VpcV1) CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupWithContext(context.Background(), createInstanceGroupOptions) -} - -// CreateInstanceGroupWithContext is an alternate form of the CreateInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupOptions, "createInstanceGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createInstanceGroupOptions, "createInstanceGroupOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createInstanceGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createInstanceGroupOptions.InstanceTemplate != nil { - body["instance_template"] = createInstanceGroupOptions.InstanceTemplate - } - if createInstanceGroupOptions.Subnets != nil { - body["subnets"] = createInstanceGroupOptions.Subnets - } - if createInstanceGroupOptions.ApplicationPort != nil { - body["application_port"] = createInstanceGroupOptions.ApplicationPort - } - if createInstanceGroupOptions.LoadBalancer != nil { - body["load_balancer"] = createInstanceGroupOptions.LoadBalancer - } - if createInstanceGroupOptions.LoadBalancerPool != nil { - body["load_balancer_pool"] = createInstanceGroupOptions.LoadBalancerPool - } - if createInstanceGroupOptions.MembershipCount != nil { - body["membership_count"] = createInstanceGroupOptions.MembershipCount - } - if createInstanceGroupOptions.Name != nil { - body["name"] = createInstanceGroupOptions.Name - } - if createInstanceGroupOptions.ResourceGroup != nil { - body["resource_group"] = createInstanceGroupOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateInstanceGroupManager : Create a manager for an instance group -// This request creates a new instance group manager. -func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) -} - -// CreateInstanceGroupManagerWithContext is an alternate form of the CreateInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateInstanceGroupManagerAction : Create an instance group manager action -// This request creates a new instance group manager action. -func (vpc *VpcV1) CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) -} - -// CreateInstanceGroupManagerActionWithContext is an alternate form of the CreateInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Context, createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *createInstanceGroupManagerActionOptions.InstanceGroupManagerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerAction") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager -// This request creates a new instance group manager policy. -func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) -} - -// CreateInstanceGroupManagerPolicyWithContext is an alternate form of the CreateInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Context, createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteInstanceGroup : Delete an instance group -// This request deletes an instance group. This operation cannot be reversed. Any instances associated with the group -// will be deleted. -func (vpc *VpcV1) DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) -} - -// DeleteInstanceGroupWithContext is an alternate form of the DeleteInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupOptions, "deleteInstanceGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceGroupOptions, "deleteInstanceGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteInstanceGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteInstanceGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer -// This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. -func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) -} - -// DeleteInstanceGroupLoadBalancerWithContext is an alternate form of the DeleteInstanceGroupLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context, deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupLoadBalancerOptions.InstanceGroupID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/load_balancer`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteInstanceGroupManager : Delete an instance group manager -// This request deletes an instance group manager. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) -} - -// DeleteInstanceGroupManagerWithContext is an alternate form of the DeleteInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerOptions.InstanceGroupID, - "id": *deleteInstanceGroupManagerOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteInstanceGroupManagerAction : Delete specified instance group manager action -// This request deletes an instance group manager action. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) -} - -// DeleteInstanceGroupManagerActionWithContext is an alternate form of the DeleteInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Context, deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *deleteInstanceGroupManagerActionOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy -// This request deletes an instance group manager policy. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) -} - -// DeleteInstanceGroupManagerPolicyWithContext is an alternate form of the DeleteInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Context, deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *deleteInstanceGroupManagerPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteInstanceGroupMembership : Delete an instance group membership -// This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the -// membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. -func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) -} - -// DeleteInstanceGroupMembershipWithContext is an alternate form of the DeleteInstanceGroupMembership method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupMembershipOptions.InstanceGroupID, - "id": *deleteInstanceGroupMembershipOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteInstanceGroupMemberships : Delete all memberships from an instance group -// This request deletes all memberships of an instance group. This operation cannot be reversed. reversed. Any -// memberships that have `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. -func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) -} - -// DeleteInstanceGroupMembershipsWithContext is an alternate form of the DeleteInstanceGroupMemberships method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupMembershipsOptions.InstanceGroupID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetInstanceGroup : Retrieve an instance group -// This request retrieves a single instance group specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) -} - -// GetInstanceGroupWithContext is an alternate form of the GetInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupOptions, "getInstanceGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getInstanceGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetInstanceGroupManager : Retrieve an instance group manager -// This request retrieves a single instance group manager specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) -} - -// GetInstanceGroupManagerWithContext is an alternate form of the GetInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupManagerOptions.InstanceGroupID, - "id": *getInstanceGroupManagerOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetInstanceGroupManagerAction : Retrieve specified instance group manager action -// This request retrieves a single instance group manager action specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupManagerActionWithContext(context.Background(), getInstanceGroupManagerActionOptions) -} - -// GetInstanceGroupManagerActionWithContext is an alternate form of the GetInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *getInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *getInstanceGroupManagerActionOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceGroupManagerActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerAction") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy -// This request retrieves a single instance group manager policy specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) -} - -// GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *getInstanceGroupManagerPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetInstanceGroupMembership : Retrieve an instance group membership -// This request retrieves a single instance group membership specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) -} - -// GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupMembershipOptions.InstanceGroupID, - "id": *getInstanceGroupMembershipOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstanceGroupManagerActions : List all actions for an instance group manager -// This request lists all instance group actions for an instance group manager. -func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) -} - -// ListInstanceGroupManagerActionsWithContext is an alternate form of the ListInstanceGroupManagerActions method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context, listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagerActionsOptions.InstanceGroupID, - "instance_group_manager_id": *listInstanceGroupManagerActionsOptions.InstanceGroupManagerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listInstanceGroupManagerActionsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listInstanceGroupManagerActionsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) - } - if listInstanceGroupManagerActionsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerActionsCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstanceGroupManagerPolicies : List all policies for an instance group manager -// This request lists all policies for an instance group manager. -func (vpc *VpcV1) ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) -} - -// ListInstanceGroupManagerPoliciesWithContext is an alternate form of the ListInstanceGroupManagerPolicies method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Context, listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupID, - "instance_group_manager_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupManagerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listInstanceGroupManagerPoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerPolicies") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listInstanceGroupManagerPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Start)) - } - if listInstanceGroupManagerPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicyCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstanceGroupManagers : List all managers for an instance group -// This request lists all managers for an instance group. -func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) -} - -// ListInstanceGroupManagersWithContext is an alternate form of the ListInstanceGroupManagers method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagersOptions.InstanceGroupID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listInstanceGroupManagersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) - } - if listInstanceGroupManagersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagersOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstanceGroupMemberships : List all memberships for an instance group -// This request lists all instance group memberships for an instance group. -func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) -} - -// ListInstanceGroupMembershipsWithContext is an alternate form of the ListInstanceGroupMemberships method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupMembershipsOptions.InstanceGroupID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listInstanceGroupMembershipsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) - } - if listInstanceGroupMembershipsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListInstanceGroups : List all instance groups -// This request lists all instance groups in the region. -func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) -} - -// ListInstanceGroupsWithContext is an alternate form of the ListInstanceGroups method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstanceGroupsOptions, "listInstanceGroupsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listInstanceGroupsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listInstanceGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) - } - if listInstanceGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupsOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateInstanceGroup : Update an instance group -// This request updates an instance group with the information provided instance group patch. The instance group patch -// object is structured in the same way as a retrieved instance group and contains only the information to be updated. -func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) -} - -// UpdateInstanceGroupWithContext is an alternate form of the UpdateInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupOptions, "updateInstanceGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateInstanceGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateInstanceGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateInstanceGroupOptions.InstanceGroupPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateInstanceGroupManager : Update an instance group manager -// This request updates an instance group manager with the information provided instance group manager patch. -func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) -} - -// UpdateInstanceGroupManagerWithContext is an alternate form of the UpdateInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerOptions.InstanceGroupID, - "id": *updateInstanceGroupManagerOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateInstanceGroupManagerAction : Update specified instance group manager action -// This request updates an instance group manager action. -func (vpc *VpcV1) UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) -} - -// UpdateInstanceGroupManagerActionWithContext is an alternate form of the UpdateInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Context, updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *updateInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *updateInstanceGroupManagerActionOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerAction") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateInstanceGroupManagerPolicy : Update an instance group manager policy -// This request updates an instance group manager policy. -func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) -} - -// UpdateInstanceGroupManagerPolicyWithContext is an alternate form of the UpdateInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Context, updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *updateInstanceGroupManagerPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateInstanceGroupMembership : Update an instance group membership -// This request updates an instance group membership with the information provided instance group membership patch. -func (vpc *VpcV1) UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupMembershipWithContext(context.Background(), updateInstanceGroupMembershipOptions) -} - -// UpdateInstanceGroupMembershipWithContext is an alternate form of the UpdateInstanceGroupMembership method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupMembershipOptions.InstanceGroupID, - "id": *updateInstanceGroupMembershipOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateInstanceGroupMembershipOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupMembership") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateInstanceGroupMembershipOptions.InstanceGroupMembershipPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateDedicatedHost : Create a dedicated host -// This request creates a new dedicated host. -func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - return vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) -} - -// CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createDedicatedHostOptions.DedicatedHostPrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateDedicatedHostGroup : Create a dedicated host group -// This request creates a new dedicated host group. -func (vpc *VpcV1) CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - return vpc.CreateDedicatedHostGroupWithContext(context.Background(), createDedicatedHostGroupOptions) -} - -// CreateDedicatedHostGroupWithContext is an alternate form of the CreateDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createDedicatedHostGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHostGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createDedicatedHostGroupOptions.Class != nil { - body["class"] = createDedicatedHostGroupOptions.Class - } - if createDedicatedHostGroupOptions.Family != nil { - body["family"] = createDedicatedHostGroupOptions.Family - } - if createDedicatedHostGroupOptions.Zone != nil { - body["zone"] = createDedicatedHostGroupOptions.Zone - } - if createDedicatedHostGroupOptions.Name != nil { - body["name"] = createDedicatedHostGroupOptions.Name - } - if createDedicatedHostGroupOptions.ResourceGroup != nil { - body["resource_group"] = createDedicatedHostGroupOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteDedicatedHost : Delete a dedicated host -// This request deletes a dedicated host. -func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) -} - -// DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteDedicatedHostOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteDedicatedHostGroup : Delete a dedicated host group -// This request deletes a dedicated host group. -func (vpc *VpcV1) DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteDedicatedHostGroupWithContext(context.Background(), deleteDedicatedHostGroupOptions) -} - -// DeleteDedicatedHostGroupWithContext is an alternate form of the DeleteDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteDedicatedHostGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteDedicatedHostGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHostGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetDedicatedHost : Retrieve a dedicated host -// This request retrieves a single dedicated host specified by the identifiers in the URL. -func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) -} - -// GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getDedicatedHostOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetDedicatedHostDisk : Retrieve a dedicated host disk -// This request retrieves a single dedicated host disk specified by the identifier in the URL. -func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) -} - -// GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "dedicated_host_id": *getDedicatedHostDiskOptions.DedicatedHostID, - "id": *getDedicatedHostDiskOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetDedicatedHostGroup : Retrieve a dedicated host group -// This request retrieves a single dedicated host group specified by the identifier in the URL. -func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) -} - -// GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getDedicatedHostGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetDedicatedHostProfile : Retrieve a dedicated host profile -// This request retrieves a single dedicated host profile specified by the name in the URL. -func (vpc *VpcV1) GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostProfileWithContext(context.Background(), getDedicatedHostProfileOptions) -} - -// GetDedicatedHostProfileWithContext is an alternate form of the GetDedicatedHostProfile method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "name": *getDedicatedHostProfileOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles/{name}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getDedicatedHostProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostProfile") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfile) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListDedicatedHostDisks : List all disks on a dedicated host -// This request lists all disks on a dedicated host. A disk is a physical device that is locally attached to the -// compute node. By default, the listed disks are sorted by their -// `created_at` property values, with the newest disk first. -func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) -} - -// ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "dedicated_host_id": *listDedicatedHostDisksOptions.DedicatedHostID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListDedicatedHostGroups : List all dedicated host groups -// This request lists all dedicated host groups in the region. Host groups are a collection of dedicated hosts for -// placement of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. -func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) -} - -// ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listDedicatedHostGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) - } - if listDedicatedHostGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) - } - if listDedicatedHostGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostGroupsOptions.ResourceGroupID)) - } - if listDedicatedHostGroupsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostGroupsOptions.ZoneName)) - } - if listDedicatedHostGroupsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listDedicatedHostGroupsOptions.Name)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListDedicatedHostProfiles : List all dedicated host profiles -// This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in -// the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. -func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) -} - -// ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listDedicatedHostProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) - } - if listDedicatedHostProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListDedicatedHosts : List all dedicated hosts -// This request lists all dedicated hosts in the region. -func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) -} - -// ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listDedicatedHostsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listDedicatedHostsOptions.DedicatedHostGroupID != nil { - builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) - } - if listDedicatedHostsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostsOptions.Start)) - } - if listDedicatedHostsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostsOptions.Limit)) - } - if listDedicatedHostsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostsOptions.ResourceGroupID)) - } - if listDedicatedHostsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostsOptions.ZoneName)) - } - if listDedicatedHostsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listDedicatedHostsOptions.Name)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateDedicatedHost : Update a dedicated host -// This request updates a dedicated host with the information in a provided dedicated host patch. The dedicated host -// patch object is structured in the same way as a retrieved dedicated host and contains only the information to be -// updated. -func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - return vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) -} - -// UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateDedicatedHostOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateDedicatedHostDisk : Update a dedicated host disk -// This request updates the dedicated host disk with the information in a provided patch. -func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - return vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) -} - -// UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "dedicated_host_id": *updateDedicatedHostDiskOptions.DedicatedHostID, - "id": *updateDedicatedHostDiskOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateDedicatedHostGroup : Update a dedicated host group -// This request updates a dedicated host group with the information in a provided dedicated host group patch. The -// dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only -// the information to be updated. -func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - return vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) -} - -// UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateDedicatedHostGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateBackupPolicy : Create a backup policy -// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in -// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. -func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { - return vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) -} - -// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createBackupPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createBackupPolicyOptions.MatchUserTags != nil { - body["match_user_tags"] = createBackupPolicyOptions.MatchUserTags - } - if createBackupPolicyOptions.MatchResourceTypes != nil { - body["match_resource_types"] = createBackupPolicyOptions.MatchResourceTypes - } - if createBackupPolicyOptions.Name != nil { - body["name"] = createBackupPolicyOptions.Name - } - if createBackupPolicyOptions.Plans != nil { - body["plans"] = createBackupPolicyOptions.Plans - } - if createBackupPolicyOptions.ResourceGroup != nil { - body["resource_group"] = createBackupPolicyOptions.ResourceGroup - } - if createBackupPolicyOptions.Scope != nil { - body["scope"] = createBackupPolicyOptions.Scope - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateBackupPolicyPlan : Create a plan for a backup policy -// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is -// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the -// new backup policy plan. -// -// Backups created by this plan will use the resource group of the source being backed up. -// -// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character -// suffix. -func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) -} - -// CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createBackupPolicyPlanOptions.CronSpec != nil { - body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec - } - if createBackupPolicyPlanOptions.Active != nil { - body["active"] = createBackupPolicyPlanOptions.Active - } - if createBackupPolicyPlanOptions.AttachUserTags != nil { - body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags - } - if createBackupPolicyPlanOptions.ClonePolicy != nil { - body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy - } - if createBackupPolicyPlanOptions.CopyUserTags != nil { - body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags - } - if createBackupPolicyPlanOptions.DeletionTrigger != nil { - body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger - } - if createBackupPolicyPlanOptions.Name != nil { - body["name"] = createBackupPolicyPlanOptions.Name - } - if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil { - body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteBackupPolicy : Delete a backup policy -// This request deletes a backup policy. This operation cannot be reversed. -// -// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, -// the backup policy will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { - return vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) -} - -// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteBackupPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteBackupPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteBackupPolicyPlan : Delete a backup policy plan -// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by -// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with -// the plan will run to completion before the plan is deleted. -// -// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing -// completes, the backup policy plan will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) -} - -// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, - "id": *deleteBackupPolicyPlanOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetBackupPolicy : Retrieve a backup policy -// This request retrieves a single backup policy specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) -} - -// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getBackupPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBackupPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetBackupPolicyJob : Retrieve a backup policy job -// This request retrieves a single backup policy job specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) -} - -// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, - "id": *getBackupPolicyJobOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBackupPolicyJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetBackupPolicyPlan : Retrieve a backup policy plan -// This request retrieves a single backup policy plan specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) -} - -// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, - "id": *getBackupPolicyPlanOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListBackupPolicies : List all backup policies -// This request lists all backup policies in the region. Backup policies control which sources are selected for backup -// and include a set of backup policy plans that provide the backup schedules and deletion triggers. -func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) -} - -// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter -func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listBackupPoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBackupPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) - } - if listBackupPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) - } - if listBackupPoliciesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) - } - if listBackupPoliciesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) - } - if listBackupPoliciesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListBackupPolicyJobs : List all jobs for a backup policy -// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan -// for a resource matching the policy's criteria. -func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) -} - -// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBackupPolicyJobsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) - } - if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) - } - if listBackupPolicyJobsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) - } - if listBackupPolicyJobsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) - } - if listBackupPolicyJobsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) - } - if listBackupPolicyJobsOptions.SourceID != nil { - builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { - builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { - builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListBackupPolicyPlans : List all plans for a backup policy -// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. -func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) -} - -// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBackupPolicyPlansOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateBackupPolicy : Update a backup policy -// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch -// object is structured in the same way as a retrieved backup policy and contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { - return vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) -} - -// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateBackupPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateBackupPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateBackupPolicyPlan : Update a backup policy plan -// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is -// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) -} - -// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, - "id": *updateBackupPolicyPlanOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreatePlacementGroup : Create a placement group -// This request creates a new placement group. -func (vpc *VpcV1) CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - return vpc.CreatePlacementGroupWithContext(context.Background(), createPlacementGroupOptions) -} - -// CreatePlacementGroupWithContext is an alternate form of the CreatePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPlacementGroupOptions, "createPlacementGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createPlacementGroupOptions, "createPlacementGroupOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createPlacementGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePlacementGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createPlacementGroupOptions.Strategy != nil { - body["strategy"] = createPlacementGroupOptions.Strategy - } - if createPlacementGroupOptions.Name != nil { - body["name"] = createPlacementGroupOptions.Name - } - if createPlacementGroupOptions.ResourceGroup != nil { - body["resource_group"] = createPlacementGroupOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeletePlacementGroup : Delete a placement group -// This request deletes a placement group. This operation cannot be reversed. For this request to succeed, the placement -// group must not be associated with an instance. -func (vpc *VpcV1) DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { - return vpc.DeletePlacementGroupWithContext(context.Background(), deletePlacementGroupOptions) -} - -// DeletePlacementGroupWithContext is an alternate form of the DeletePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deletePlacementGroupOptions, "deletePlacementGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deletePlacementGroupOptions, "deletePlacementGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deletePlacementGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deletePlacementGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePlacementGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetPlacementGroup : Retrieve a placement group -// This request retrieves a single placement group specified by identifier in the URL. -func (vpc *VpcV1) GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - return vpc.GetPlacementGroupWithContext(context.Background(), getPlacementGroupOptions) -} - -// GetPlacementGroupWithContext is an alternate form of the GetPlacementGroup method which supports a Context parameter -func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPlacementGroupOptions, "getPlacementGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getPlacementGroupOptions, "getPlacementGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getPlacementGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getPlacementGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPlacementGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListPlacementGroups : List all placement groups -// This request lists all placement groups in the region. -func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) -} - -// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter -func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listPlacementGroupsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listPlacementGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) - } - if listPlacementGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdatePlacementGroup : Update a placement group -// This request updates a placement group with the information provided placement group patch. The placement group patch -// object is structured in the same way as a retrieved placement group and contains only the information to be updated. -func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - return vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) -} - -// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updatePlacementGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updatePlacementGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updatePlacementGroupOptions.PlacementGroupPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface -// This request associates the specified floating IP with the specified bare metal server network interface. If -// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` -// is `true`, this replaces any existing association. For this request to succeed, the existing floating IP must not be -// required by another resource, such as a public gateway. A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) -} - -// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateBareMetalServer : Create a bare metal server -// This request provisions a new bare metal server from a prototype object. The prototype object is structured in the -// same way as a retrieved bare metal server, and contains the information necessary to provision the new bare metal -// server. The bare metal server is automatically started. -func (vpc *VpcV1) CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerWithContext(context.Background(), createBareMetalServerOptions) -} - -// CreateBareMetalServerWithContext is an alternate form of the CreateBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerOptions, "createBareMetalServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createBareMetalServerOptions, "createBareMetalServerOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createBareMetalServerOptions.BareMetalServerPrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateBareMetalServerConsoleAccessToken : Create a console access token for a bare metal server -// This request creates a new single-use console access token for a bare metal server. All console configuration is -// provided at token create time, and the token is subsequently used in the `access_token` query parameter for the -// WebSocket request. The access token is only valid for a short period of time, and a maximum of one token is valid -// for a given bare metal server at a time. -func (vpc *VpcV1) CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerConsoleAccessTokenWithContext(context.Background(), createBareMetalServerConsoleAccessTokenOptions) -} - -// CreateBareMetalServerConsoleAccessTokenWithContext is an alternate form of the CreateBareMetalServerConsoleAccessToken method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context.Context, createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerConsoleAccessTokenOptions.BareMetalServerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/console_access_token`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createBareMetalServerConsoleAccessTokenOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerConsoleAccessToken") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createBareMetalServerConsoleAccessTokenOptions.ConsoleType != nil { - body["console_type"] = createBareMetalServerConsoleAccessTokenOptions.ConsoleType - } - if createBareMetalServerConsoleAccessTokenOptions.Force != nil { - body["force"] = createBareMetalServerConsoleAccessTokenOptions.Force - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerConsoleAccessToken) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server -// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and -// contains the information necessary to create the new bare metal server network attachment. -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) -} - -// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server -// This request creates a new bare metal server network interface from a bare metal server network interface prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and -// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare -// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. -// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. -func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) -} - -// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteBareMetalServer : Delete a bare metal server -// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the -// bare metal server network interfaces are implicitly disassociated. -func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) -} - -// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment -// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network attachment are implicitly disassociated. -// -// The bare metal server's primary network attachment cannot be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) -} - -// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface -// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server -// network interface is not allowed to be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) -} - -// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetBareMetalServer : Retrieve a bare metal server -// This request retrieves a single bare metal server specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) -} - -// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerDisk : Retrieve a bare metal server disk -// This request retrieves a single disk specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) -} - -// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, - "id": *getBareMetalServerDiskOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server -// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and -// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be -// current. -func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) -} - -// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getBareMetalServerInitializationOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment -// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) -} - -// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface -// This request retrieves a single bare metal server network interface specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) -} - -// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the bare metal server network interface -// specified in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) -} - -// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP -// This request retrieves the primary reserved IP for a bare metal server network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) -} - -// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerProfile : Retrieve a bare metal server profile -// This request retrieves a single bare metal server profile specified by the name in the URL. -func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) -} - -// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "name": *getBareMetalServerProfileOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles/{name}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerDisks : List all disks on a bare metal server -// This request lists all disks on a bare metal server. A disk is a block device that is locally attached to the -// physical server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk -// first. -func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) -} - -// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server -// This request lists all network attachments on a bare metal server. A network attachment represents a device on the -// bare metal server to which a virtual network interface is attached. Network attachments can be `pci` or `vlan` -// devices. -// -// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. -// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property -// values. -func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) -} - -// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServerNetworkAttachmentsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) - } - if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface -// This request lists all floating IPs associated with a bare metal server network interface. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) -} - -// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, - "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerNetworkInterfaceIps : List the primary reserved IP for a bare metal server network interface -// This request lists the primary reserved IP for a bare metal server network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) -} - -// ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaceIps") - err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfaceIpsOptions.BareMetalServerID, - "network_interface_id": *listBareMetalServerNetworkInterfaceIpsOptions.NetworkInterfaceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listBareMetalServerNetworkInterfaceIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server -// This request lists all network interfaces on a bare metal server. A bare metal server network interface is an -// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network -// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to -// the bare metal server. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) -} - -// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServerNetworkInterfacesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) - } - if listBareMetalServerNetworkInterfacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerProfiles : List all bare metal server profiles -// This request lists all [bare metal server -// profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) available in the region. A bare metal -// server profile specifies the performance characteristics and pricing model for a bare metal server. -func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) -} - -// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServerProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) - } - if listBareMetalServerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListBareMetalServers : List all bare metal servers -// This request lists all bare metal servers in the region. -func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) -} - -// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listBareMetalServersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) - } - if listBareMetalServersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) - } - if listBareMetalServersOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) - } - if listBareMetalServersOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) - } - if listBareMetalServersOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) - } - if listBareMetalServersOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) - } - if listBareMetalServersOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface -// This request disassociates the specified floating IP from the specified bare metal server network interface. -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) -} - -// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// RestartBareMetalServer : Restart a bare metal server -// This request restarts a bare metal server. It will run immediately regardless of the state of the server. -func (vpc *VpcV1) RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.RestartBareMetalServerWithContext(context.Background(), restartBareMetalServerOptions) -} - -// RestartBareMetalServerWithContext is an alternate form of the RestartBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(restartBareMetalServerOptions, "restartBareMetalServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(restartBareMetalServerOptions, "restartBareMetalServerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *restartBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/restart`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range restartBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RestartBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// StartBareMetalServer : Start a bare metal server -// This request starts a bare metal server. It will run immediately provided the server is stopped. -func (vpc *VpcV1) StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.StartBareMetalServerWithContext(context.Background(), startBareMetalServerOptions) -} - -// StartBareMetalServerWithContext is an alternate form of the StartBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(startBareMetalServerOptions, "startBareMetalServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(startBareMetalServerOptions, "startBareMetalServerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *startBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/start`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range startBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StartBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// StopBareMetalServer : Stop a bare metal server -// This request stops a bare metal server. It will run immediately provided the server is running. Note: A soft stop may -// not complete as it relies on the operating system to perform the operation. -func (vpc *VpcV1) StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.StopBareMetalServerWithContext(context.Background(), stopBareMetalServerOptions) -} - -// StopBareMetalServerWithContext is an alternate form of the StopBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(stopBareMetalServerOptions, "stopBareMetalServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(stopBareMetalServerOptions, "stopBareMetalServerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *stopBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/stop`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range stopBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StopBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if stopBareMetalServerOptions.Type != nil { - body["type"] = stopBareMetalServerOptions.Type - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// UpdateBareMetalServer : Update a bare metal server -// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object -// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) -} - -// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateBareMetalServerOptions.BareMetalServerPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateBareMetalServerDisk : Update a bare metal server disk -// This request updates the bare metal server disk with the information in a provided patch. -func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) -} - -// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, - "id": *updateBareMetalServerDiskOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment -// This request updates a bare metal server network attachment with the information provided in a bare metal server -// network attachment patch object. The bare metal server network attachment patch object is structured in the same way -// as a retrieved bare metal server network attachment and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) -} - -// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface -// This request updates a bare metal server network interface with the information provided in a bare metal server -// network interface patch object. The bare metal server network interface patch object is structured in the same way as -// a retrieved bare metal server network interface and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) -} - -// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateVolume : Create a volume -// This request creates a new volume from a volume prototype object. The prototype object is structured in the same way -// as a retrieved volume, and contains the information necessary to create the new volume. -func (vpc *VpcV1) CreateVolume(createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - return vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) -} - -// CreateVolumeWithContext is an alternate form of the CreateVolume method which supports a Context parameter -func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVolumeOptions, "createVolumeOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createVolumeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createVolumeOptions.VolumePrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteVolume : Delete a volume -// This request deletes a volume. This operation cannot be reversed. For this request to succeed, the volume must not be -// attached to any instances. -func (vpc *VpcV1) DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) -} - -// DeleteVolumeWithContext is an alternate form of the DeleteVolume method which supports a Context parameter -func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVolumeOptions, "deleteVolumeOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteVolumeOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVolumeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - if deleteVolumeOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVolumeOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetVolume : Retrieve a volume -// This request retrieves a single volume specified by the identifier in the URL. -func (vpc *VpcV1) GetVolume(getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - return vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) -} - -// GetVolumeWithContext is an alternate form of the GetVolume method which supports a Context parameter -func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVolumeOptions, "getVolumeOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getVolumeOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVolumeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVolumeProfile : Retrieve a volume profile -// This request retrieves a single volume profile specified by the name in the URL. -func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - return vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) -} - -// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter -func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "name": *getVolumeProfileOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVolumeProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVolumeProfiles : List all volume profiles -// This request lists all [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available -// in the region. A volume profile specifies the performance characteristics and pricing model for a volume. -func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) -} - -// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter -func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listVolumeProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVolumeProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) - } - if listVolumeProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVolumes : List all volumes -// This request lists all volumes in the region. Volumes are network-connected block storage devices that may be -// attached to one or more instances in the same region. -func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - return vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) -} - -// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter -func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listVolumesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVolumesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) - } - if listVolumesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) - } - if listVolumesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) - } - if listVolumesOptions.AttachmentState != nil { - builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) - } - if listVolumesOptions.Encryption != nil { - builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) - } - if listVolumesOptions.OperatingSystemFamily != nil { - builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) - } - if listVolumesOptions.OperatingSystemArchitecture != nil { - builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) - } - if listVolumesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateVolume : Update a volume -// This request updates a volume with the information in a provided volume patch. The volume patch object is structured -// in the same way as a retrieved volume and contains only the information to be updated. -func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - return vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) -} - -// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter -func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateVolumeOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateVolumeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVolumeOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateSnapshot : Create a snapshot -// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same -// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. -func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) -} - -// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createSnapshotOptions.SnapshotPrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateSnapshotClone : Create a clone for a snapshot -// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if -// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. -func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - return vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) -} - -// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *createSnapshotCloneOptions.ID, - "zone_name": *createSnapshotCloneOptions.ZoneName, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createSnapshotCloneOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteSnapshot : Delete a snapshot -// This request deletes a snapshot. This operation cannot be reversed. -func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) -} - -// DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteSnapshotOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - if deleteSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteSnapshotClone : Delete a snapshot clone -// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated -// from the snapshot. -func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) -} - -// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteSnapshotCloneOptions.ID, - "zone_name": *deleteSnapshotCloneOptions.ZoneName, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteSnapshots : Delete a filtered collection of snapshots -// This request deletes all snapshots created from a specific source volume. -func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) -} - -// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) - if err != nil { - return - } - - for headerName, headerValue := range deleteSnapshotsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetSnapshot : Retrieve a snapshot -// This request retrieves a single snapshot specified by the identifier in the URL. -func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) -} - -// GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getSnapshotOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetSnapshotClone : Retrieve a snapshot clone -// This request retrieves a single clone specified by the snapshot identifier and zone name in the URL. -func (vpc *VpcV1) GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - return vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions) -} - -// GetSnapshotCloneWithContext is an alternate form of the GetSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotCloneOptions, "getSnapshotCloneOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getSnapshotCloneOptions.ID, - "zone_name": *getSnapshotCloneOptions.ZoneName, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getSnapshotCloneOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListSnapshotClones : List all clones for a snapshot -// This request lists all clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. -func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - return vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) -} - -// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *listSnapshotClonesOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listSnapshotClonesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListSnapshots : List all snapshots -// This request lists all snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is -// created. -func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - return vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) -} - -// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listSnapshotsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSnapshotsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) - } - if listSnapshotsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) - } - if listSnapshotsOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) - } - if listSnapshotsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) - } - if listSnapshotsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) - } - if listSnapshotsOptions.SourceVolumeID != nil { - builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) - } - if listSnapshotsOptions.SourceVolumeCRN != nil { - builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) - } - if listSnapshotsOptions.SourceImageID != nil { - builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) - } - if listSnapshotsOptions.SourceImageCRN != nil { - builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) - } - if listSnapshotsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) - } - if listSnapshotsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) - } - 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)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateSnapshot : Update a snapshot -// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group -// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. -func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) -} - -// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter -func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateSnapshotOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateShare : Create a file share -// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, -// a replica share, or both a source and replica share. -// -// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to -// provision the new file shares. -func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.CreateShareWithContext(context.Background(), createShareOptions) -} - -// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter -func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createShareOptions, "createShareOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createShareOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateShareMountTarget : Create a mount target for a file share -// This request creates a new share mount target from a share mount target prototype object. -// -// The prototype object is structured in the same way as a retrieved share mount target, and contains the information -// necessary to provision the new file share mount target. -func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) -} - -// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "share_id": *createShareMountTargetOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteShare : Delete a file share -// This request deletes a share. This operation cannot be reversed. A share cannot be deleted if it: -// - has share mount targets -// - has a `lifecycle_state` of `updating` -// - has a replication operation in progress -// -// If the request is accepted, the share `lifecycle_state` will be set to `deleting`. Once deletion processing -// completes, it will no longer be retrievable. -func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) -} - -// DeleteShareWithContext is an alternate form of the DeleteShare method which supports a Context parameter -func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareOptions, "deleteShareOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteShareOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteShareOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - if deleteShareOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteShareOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteShareMountTarget : Delete a share mount target -// This request deletes a share mount target. This operation cannot be reversed. -// -// If the request is accepted, the share mount target `lifecycle_state` will be set to -// `deleting`. Once deletion processing completes, it will no longer be retrievable. -func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) -} - -// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "share_id": *deleteShareMountTargetOptions.ShareID, - "id": *deleteShareMountTargetOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteShareSource : Split the source file share from a replica share -// This request removes the replication relationship between a source share and the replica share specified by the -// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a -// `lifecycle_state` of `updating`, or has a replication operation in progress. -// -// This operation cannot be reversed. -func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) -} - -// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter -func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "share_id": *deleteShareSourceOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteShareSourceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// FailoverShare : Failover to replica file share -// This request triggers a failover to the replica file share specified by the identifier in the URL. The failover -// cannot be started if a source share or the replica share has a `lifecycle_state` of `updating`, or has a replication -// operation in progress. -// -// If `fallback_policy` is specified as `split`, and the request is accepted but the failover operation cannot be -// performed, a split will be triggered. -func (vpc *VpcV1) FailoverShare(failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { - return vpc.FailoverShareWithContext(context.Background(), failoverShareOptions) -} - -// FailoverShareWithContext is an alternate form of the FailoverShare method which supports a Context parameter -func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(failoverShareOptions, "failoverShareOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(failoverShareOptions, "failoverShareOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "share_id": *failoverShareOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/failover`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range failoverShareOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if failoverShareOptions.FallbackPolicy != nil { - body["fallback_policy"] = failoverShareOptions.FallbackPolicy - } - if failoverShareOptions.Timeout != nil { - body["timeout"] = failoverShareOptions.Timeout - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetShare : Retrieve a file share -// This request retrieves a single file share specified by the identifier in the URL. -func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.GetShareWithContext(context.Background(), getShareOptions) -} - -// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter -func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getShareOptions, "getShareOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getShareOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getShareOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetShareMountTarget : Retrieve a share mount target -// This request retrieves a single share mount target specified by the identifier in the URL. -func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) -} - -// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "share_id": *getShareMountTargetOptions.ShareID, - "id": *getShareMountTargetOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetShareProfile : Retrieve a file share profile -// This request retrieves a single file share profile specified by the name in the URL. -func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - return vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) -} - -// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter -func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "name": *getShareProfileOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getShareProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetShareSource : Retrieve the source file share for a replica file share -// This request retrieves the source file share associated with the replica file share specified by the identifier in -// the URL. -func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) -} - -// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter -func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "share_id": *getShareSourceOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getShareSourceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListShareMountTargets : List all mount targets for a file share -// This request retrieves all share mount targets for a file share. A share mount target is a network endpoint at which -// a file share may be mounted. The file share can be mounted by clients in the same VPC and zone after creating share -// mount targets. -// -// The share mount targets will be sorted by their `created_at` property values, with newest targets first. -func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - return vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) -} - -// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter -func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "share_id": *listShareMountTargetsOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listShareMountTargetsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listShareMountTargetsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) - } - if listShareMountTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) - } - if listShareMountTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListShareProfiles : List all file share profiles -// This request lists all [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) -// available in the region. A file share profile specifies the performance characteristics and pricing model for a file -// share. -func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) -} - -// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter -func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listShareProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listShareProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) - } - if listShareProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) - } - if listShareProfilesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListShares : List all file shares -// This request lists all file shares in the region. -func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - return vpc.ListSharesWithContext(context.Background(), listSharesOptions) -} - -// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter -func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSharesOptions, "listSharesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listSharesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSharesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) - } - if listSharesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) - } - if listSharesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) - } - if listSharesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) - } - if listSharesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) - } - if listSharesOptions.ReplicationRole != nil { - builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateShare : Update a file share -// This request updates a share with the information in a provided share patch. The share patch object is structured in -// the same way as a retrieved share and contains only the information to be updated. -func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.UpdateShareWithContext(context.Background(), updateShareOptions) -} - -// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter -func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateShareOptions, "updateShareOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateShareOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateShareOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateShareOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateShareMountTarget : Update a share mount target -// This request updates a share mount target with the information provided in a share mount target patch object. The -// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain -// only the information to be updated. -func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) -} - -// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "share_id": *updateShareMountTargetOptions.ShareID, - "id": *updateShareMountTargetOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateShareMountTargetOptions.ShareMountTargetPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetRegion : Retrieve a region -// This request retrieves a single region specified by the name in the URL. -func (vpc *VpcV1) GetRegion(getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { - return vpc.GetRegionWithContext(context.Background(), getRegionOptions) -} - -// GetRegionWithContext is an alternate form of the GetRegion method which supports a Context parameter -func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getRegionOptions, "getRegionOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getRegionOptions, "getRegionOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "name": *getRegionOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{name}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getRegionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegion) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetRegionZone : Retrieve a zone -// This request retrieves a single zone specified by the region and zone names in the URL. -func (vpc *VpcV1) GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { - return vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) -} - -// GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter -func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "region_name": *getRegionZoneOptions.RegionName, - "name": *getRegionZoneOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones/{name}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getRegionZoneOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListRegionZones : List all zones in a region -// This request lists all zones in a region. Zones represent logically-isolated data centers with high-bandwidth and -// low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. -func (vpc *VpcV1) ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { - return vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) -} - -// ListRegionZonesWithContext is an alternate form of the ListRegionZones method which supports a Context parameter -func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listRegionZonesOptions, "listRegionZonesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "region_name": *listRegionZonesOptions.RegionName, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listRegionZonesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListRegions : List all regions -// This request lists all regions. Each region is a separate geographic area that contains multiple isolated zones. -// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones -// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation -// available. Resources deployed within a single region also benefit from the low latency afforded by geographic -// proximity. -func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { - return vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) -} - -// ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter -func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listRegionsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// AddNetworkInterfaceFloatingIP : Associate a floating IP with a virtual network interface -// This request associates the specified floating IP with the specified virtual network interface. A request body is not -// required, and if provided, is ignored. -// -// If `enable_infrastructure_nat` is `true`, this replaces any existing floating IP association. -// -// If `enable_infrastructure_nat` is `false`, this adds the floating IP to any existing associations. -// -// The floating IP must not currently be associated with another resource. The virtual network interface's `target` must -// not currently be a file share mount target. -func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - return vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) -} - -// AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *addNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) - if err != nil { - return - } - response.Result = result - } - - return -} - -// 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 same subnet as the `primary_ip`. The virtual network interface's -// `target` must not currently be a file share mount target. -func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - return vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) -} - -// AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, - "id": *addVirtualNetworkInterfaceIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateVirtualNetworkInterface : Create a virtual network interface -// This request creates a new virtual network interface from a virtual network interface prototype object. The prototype -// object is structured in the same way as a retrieved virtual network interface, and contains the information necessary -// to create the new virtual network interface. -func (vpc *VpcV1) CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - return vpc.CreateVirtualNetworkInterfaceWithContext(context.Background(), createVirtualNetworkInterfaceOptions) -} - -// CreateVirtualNetworkInterfaceWithContext is an alternate form of the CreateVirtualNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createVirtualNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVirtualNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createVirtualNetworkInterfaceOptions.AllowIPSpoofing != nil { - body["allow_ip_spoofing"] = createVirtualNetworkInterfaceOptions.AllowIPSpoofing - } - if createVirtualNetworkInterfaceOptions.AutoDelete != nil { - body["auto_delete"] = createVirtualNetworkInterfaceOptions.AutoDelete - } - if createVirtualNetworkInterfaceOptions.EnableInfrastructureNat != nil { - body["enable_infrastructure_nat"] = createVirtualNetworkInterfaceOptions.EnableInfrastructureNat - } - if createVirtualNetworkInterfaceOptions.Ips != nil { - body["ips"] = createVirtualNetworkInterfaceOptions.Ips - } - if createVirtualNetworkInterfaceOptions.Name != nil { - body["name"] = createVirtualNetworkInterfaceOptions.Name - } - if createVirtualNetworkInterfaceOptions.PrimaryIP != nil { - body["primary_ip"] = createVirtualNetworkInterfaceOptions.PrimaryIP - } - if createVirtualNetworkInterfaceOptions.ResourceGroup != nil { - body["resource_group"] = createVirtualNetworkInterfaceOptions.ResourceGroup - } - if createVirtualNetworkInterfaceOptions.SecurityGroups != nil { - body["security_groups"] = createVirtualNetworkInterfaceOptions.SecurityGroups - } - if createVirtualNetworkInterfaceOptions.Subnet != nil { - body["subnet"] = createVirtualNetworkInterfaceOptions.Subnet - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteVirtualNetworkInterfaces : Delete a virtual network interface -// This request deletes a virtual network interface. This operation cannot be reversed. For this request to succeed, the -// virtual network interface must not be required by another resource, such as the primary network attachment for an -// instance. -func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) -} - -// DeleteVirtualNetworkInterfacesWithContext is an alternate form of the DeleteVirtualNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteVirtualNetworkInterfacesOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVirtualNetworkInterfacesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVirtualNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the virtual network interface specified in -// the URL. -func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - return vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) -} - -// GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *getNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVirtualNetworkInterface : Retrieve a virtual network interface -// This request retrieves a single virtual network interface specified by the identifier in the URL. -func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - return vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions) -} - -// GetVirtualNetworkInterfaceWithContext is an alternate form of the GetVirtualNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getVirtualNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVirtualNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in -// the URL. -func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - return vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) -} - -// GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *getVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, - "id": *getVirtualNetworkInterfaceIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListNetworkInterfaceFloatingIps : List all floating IPs associated with a virtual network interface -// This request lists all floating IPs associated with a virtual network interface. -func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) -} - -// ListNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *listNetworkInterfaceFloatingIpsOptions.VirtualNetworkInterfaceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listNetworkInterfaceFloatingIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) - } - if listNetworkInterfaceFloatingIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Limit)) - } - if listNetworkInterfaceFloatingIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Sort)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVirtualNetworkInterfaceIps : List all reserved IPs bound to a virtual network interface -// This request lists all reserved IPs bound to a virtual network interface. -func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) -} - -// ListVirtualNetworkInterfaceIpsWithContext is an alternate form of the ListVirtualNetworkInterfaceIps method which supports a Context parameter -func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *listVirtualNetworkInterfaceIpsOptions.VirtualNetworkInterfaceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listVirtualNetworkInterfaceIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaceIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVirtualNetworkInterfaceIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start)) - } - if listVirtualNetworkInterfaceIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Limit)) - } - if listVirtualNetworkInterfaceIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Sort)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVirtualNetworkInterfaces : List all virtual network interfaces -// This request lists all virtual network interfaces in the region. A virtual network interface is a logical abstraction -// of a virtual network interface in a subnet, and may be attached to a target resource. -// -// The virtual network interfaces will be sorted by their `created_at` property values, with newest virtual network -// interfaces first. Virtual network interfaces with identical -// `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - return vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) -} - -// ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVirtualNetworkInterfacesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) - } - if listVirtualNetworkInterfacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Limit)) - } - if listVirtualNetworkInterfacesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVirtualNetworkInterfacesOptions.ResourceGroupID)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface -// This request disassociates the specified floating IP from the specified virtual network interface. -func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) -} - -// RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *removeNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *removeNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// RemoveVirtualNetworkInterfaceIP : Unbind a reserved IP from a virtual network interface -// This request unbinds the specified reserved IP from the specified virtual network interface. If the reserved IP has -// `auto_delete` set to `true`, the reserved IP will be deleted. -// -// The reserved IP for the `primary_ip` cannot be unbound. -func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveVirtualNetworkInterfaceIPWithContext(context.Background(), removeVirtualNetworkInterfaceIPOptions) -} - -// RemoveVirtualNetworkInterfaceIPWithContext is an alternate form of the RemoveVirtualNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context, removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *removeVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, - "id": *removeVirtualNetworkInterfaceIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range removeVirtualNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVirtualNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// UpdateVirtualNetworkInterface : Update a virtual network interface -// This request updates a virtual network interface with the information in a provided virtual network interface patch. -// The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and -// contains only the information to be updated. -func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - return vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) -} - -// UpdateVirtualNetworkInterfaceWithContext is an alternate form of the UpdateVirtualNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateVirtualNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateVirtualNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreatePublicGateway : Create a public gateway -// This request creates a new public gateway from a public gateway prototype object. For this to succeed, the VPC must -// not already have a public gateway in the specified zone. -// -// If a floating IP is provided, it must be unbound. If a floating IP is not provided, one will be created and bound to -// the public gateway. Once a public gateway has been created, its floating IP cannot be unbound. A public gateway must -// be explicitly attached to each subnet it will provide connectivity for. -func (vpc *VpcV1) CreatePublicGateway(createPublicGatewayOptions *CreatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - return vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions) -} - -// CreatePublicGatewayWithContext is an alternate form of the CreatePublicGateway method which supports a Context parameter -func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPublicGatewayOptions *CreatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPublicGatewayOptions, "createPublicGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createPublicGatewayOptions.VPC != nil { - body["vpc"] = createPublicGatewayOptions.VPC - } - if createPublicGatewayOptions.Zone != nil { - body["zone"] = createPublicGatewayOptions.Zone - } - if createPublicGatewayOptions.FloatingIP != nil { - body["floating_ip"] = createPublicGatewayOptions.FloatingIP - } - if createPublicGatewayOptions.Name != nil { - body["name"] = createPublicGatewayOptions.Name - } - if createPublicGatewayOptions.ResourceGroup != nil { - body["resource_group"] = createPublicGatewayOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeletePublicGateway : Delete a public gateway -// This request deletes a public gateway. This operation cannot be reversed. For this request to succeed, the public -// gateway must not be attached to any subnets. The public gateway's floating IP will be automatically unbound. If the -// floating IP was created when the public gateway was created, it will be deleted. -func (vpc *VpcV1) DeletePublicGateway(deletePublicGatewayOptions *DeletePublicGatewayOptions) (response *core.DetailedResponse, err error) { - return vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions) -} - -// DeletePublicGatewayWithContext is an alternate form of the DeletePublicGateway method which supports a Context parameter -func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePublicGatewayOptions *DeletePublicGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deletePublicGatewayOptions, "deletePublicGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deletePublicGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deletePublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetPublicGateway : Retrieve a public gateway -// This request retrieves a single public gateway specified by the identifier in the URL. -func (vpc *VpcV1) GetPublicGateway(getPublicGatewayOptions *GetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - return vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions) -} - -// GetPublicGatewayWithContext is an alternate form of the GetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGatewayOptions *GetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPublicGatewayOptions, "getPublicGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getPublicGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListPublicGateways : List all public gateways -// This request lists all public gateways in the region. A public gateway is a virtual network device associated with a -// VPC, which allows access to the Internet. A public gateway resides in a zone and can be connected to subnets in the -// same zone only. -func (vpc *VpcV1) ListPublicGateways(listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { - return vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) -} - -// ListPublicGatewaysWithContext is an alternate form of the ListPublicGateways method which supports a Context parameter -func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listPublicGatewaysOptions, "listPublicGatewaysOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listPublicGatewaysOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listPublicGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) - } - if listPublicGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) - } - if listPublicGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdatePublicGateway : Update a public gateway -// This request updates a public gateway's name. -func (vpc *VpcV1) UpdatePublicGateway(updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - return vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) -} - -// UpdatePublicGatewayWithContext is an alternate form of the UpdatePublicGateway method which supports a Context parameter -func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePublicGatewayOptions, "updatePublicGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updatePublicGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updatePublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateFloatingIP : Reserve a floating IP -// This request reserves a new floating IP. -func (vpc *VpcV1) CreateFloatingIP(createFloatingIPOptions *CreateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions) -} - -// CreateFloatingIPWithContext is an alternate form of the CreateFloatingIP method which supports a Context parameter -func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatingIPOptions *CreateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createFloatingIPOptions, "createFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createFloatingIPOptions.FloatingIPPrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteFloatingIP : Delete a floating IP -// This request disassociates (if associated) and releases a floating IP. This operation cannot be reversed. For this -// request to succeed, the floating IP must not be required by another resource, such as a public gateway. -func (vpc *VpcV1) DeleteFloatingIP(deleteFloatingIPOptions *DeleteFloatingIPOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions) -} - -// DeleteFloatingIPWithContext is an alternate form of the DeleteFloatingIP method which supports a Context parameter -func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatingIPOptions *DeleteFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteFloatingIPOptions, "deleteFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetFloatingIP : Retrieve a floating IP -// This request retrieves a single floating IP specified by the identifier in the URL. -func (vpc *VpcV1) GetFloatingIP(getFloatingIPOptions *GetFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions) -} - -// GetFloatingIPWithContext is an alternate form of the GetFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOptions *GetFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getFloatingIPOptions, "getFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListFloatingIps : List all floating IPs -// This request lists all floating IPs in the region. Floating IPs allow inbound and outbound traffic from the Internet -// to an instance. -func (vpc *VpcV1) ListFloatingIps(listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { - return vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) -} - -// ListFloatingIpsWithContext is an alternate form of the ListFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listFloatingIpsOptions, "listFloatingIpsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listFloatingIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listFloatingIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listFloatingIpsOptions.Start)) - } - if listFloatingIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listFloatingIpsOptions.Limit)) - } - if listFloatingIpsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listFloatingIpsOptions.ResourceGroupID)) - } - if listFloatingIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listFloatingIpsOptions.Sort)) - } - if listFloatingIpsOptions.TargetID != nil { - builder.AddQuery("target.id", fmt.Sprint(*listFloatingIpsOptions.TargetID)) - } - if listFloatingIpsOptions.TargetCRN != nil { - builder.AddQuery("target.crn", fmt.Sprint(*listFloatingIpsOptions.TargetCRN)) - } - if listFloatingIpsOptions.TargetName != nil { - builder.AddQuery("target.name", fmt.Sprint(*listFloatingIpsOptions.TargetName)) - } - if listFloatingIpsOptions.TargetResourceType != nil { - builder.AddQuery("target.resource_type", fmt.Sprint(*listFloatingIpsOptions.TargetResourceType)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateFloatingIP : Update a floating IP -// This request updates a floating IP's name and/or target. -func (vpc *VpcV1) UpdateFloatingIP(updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) -} - -// UpdateFloatingIPWithContext is an alternate form of the UpdateFloatingIP method which supports a Context parameter -func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateFloatingIPOptions, "updateFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateFloatingIPOptions.FloatingIPPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateNetworkACL : Create a network ACL -// This request creates a new stateless network ACL from a network ACL prototype object. The prototype object is -// structured in the same way as a retrieved network ACL, and contains the information necessary to create the new -// network ACL. -func (vpc *VpcV1) CreateNetworkACL(createNetworkACLOptions *CreateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - return vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions) -} - -// CreateNetworkACLWithContext is an alternate form of the CreateNetworkACL method which supports a Context parameter -func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetworkACLOptions *CreateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createNetworkACLOptions, "createNetworkACLOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createNetworkACLOptions.NetworkACLPrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateNetworkACLRule : Create a rule for a network ACL -// This request creates a new rule from a network ACL rule prototype object. The prototype object is structured in the -// same way as a retrieved rule, and contains the information necessary to create the new rule. -func (vpc *VpcV1) CreateNetworkACLRule(createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - return vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) -} - -// CreateNetworkACLRuleWithContext is an alternate form of the CreateNetworkACLRule method which supports a Context parameter -func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createNetworkACLRuleOptions, "createNetworkACLRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteNetworkACL : Delete a network ACL -// This request deletes a network ACL. This operation cannot be reversed. For this request to succeed, the network ACL -// must not be the default network ACL for any VPCs, and the network ACL must not be attached to any subnets. -func (vpc *VpcV1) DeleteNetworkACL(deleteNetworkACLOptions *DeleteNetworkACLOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions) -} - -// DeleteNetworkACLWithContext is an alternate form of the DeleteNetworkACL method which supports a Context parameter -func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetworkACLOptions *DeleteNetworkACLOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteNetworkACLOptions, "deleteNetworkACLOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteNetworkACLOptions, "deleteNetworkACLOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteNetworkACLOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteNetworkACLRule : Delete a network ACL rule -// This request deletes a rule. This operation cannot be reversed. -func (vpc *VpcV1) DeleteNetworkACLRule(deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) -} - -// DeleteNetworkACLRuleWithContext is an alternate form of the DeleteNetworkACLRule method which supports a Context parameter -func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "network_acl_id": *deleteNetworkACLRuleOptions.NetworkACLID, - "id": *deleteNetworkACLRuleOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetNetworkACL : Retrieve a network ACL -// This request retrieves a single network ACL specified by the identifier in the URL. -func (vpc *VpcV1) GetNetworkACL(getNetworkACLOptions *GetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - return vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions) -} - -// GetNetworkACLWithContext is an alternate form of the GetNetworkACL method which supports a Context parameter -func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOptions *GetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getNetworkACLOptions, "getNetworkACLOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getNetworkACLOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetNetworkACLRule : Retrieve a network ACL rule -// This request retrieves a single rule specified by the identifier in the URL. -func (vpc *VpcV1) GetNetworkACLRule(getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - return vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) -} - -// GetNetworkACLRuleWithContext is an alternate form of the GetNetworkACLRule method which supports a Context parameter -func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getNetworkACLRuleOptions, "getNetworkACLRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "network_acl_id": *getNetworkACLRuleOptions.NetworkACLID, - "id": *getNetworkACLRuleOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListNetworkACLRules : List all rules for a network ACL -// This request lists all rules for a network ACL. These rules can allow or deny traffic between a source CIDR block and -// a destination CIDR block over a particular protocol and port range. -func (vpc *VpcV1) ListNetworkACLRules(listNetworkACLRulesOptions *ListNetworkACLRulesOptions) (result *NetworkACLRuleCollection, response *core.DetailedResponse, err error) { - return vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions) -} - -// ListNetworkACLRulesWithContext is an alternate form of the ListNetworkACLRules method which supports a Context parameter -func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetworkACLRulesOptions *ListNetworkACLRulesOptions) (result *NetworkACLRuleCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listNetworkACLRulesOptions, "listNetworkACLRulesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "network_acl_id": *listNetworkACLRulesOptions.NetworkACLID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listNetworkACLRulesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listNetworkACLRulesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listNetworkACLRulesOptions.Start)) - } - if listNetworkACLRulesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listNetworkACLRulesOptions.Limit)) - } - if listNetworkACLRulesOptions.Direction != nil { - builder.AddQuery("direction", fmt.Sprint(*listNetworkACLRulesOptions.Direction)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRuleCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListNetworkAcls : List all network ACLs -// This request lists all network ACLs in the region. A network ACL defines a set of packet filtering (5-tuple) rules -// for all traffic in and out of a subnet. Both allow and deny rules can be defined, and rules are stateless such that -// reverse traffic in response to allowed traffic is not automatically permitted. -func (vpc *VpcV1) ListNetworkAcls(listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { - return vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) -} - -// ListNetworkAclsWithContext is an alternate form of the ListNetworkAcls method which supports a Context parameter -func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listNetworkAclsOptions, "listNetworkAclsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listNetworkAclsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listNetworkAclsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) - } - if listNetworkAclsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listNetworkAclsOptions.Limit)) - } - if listNetworkAclsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listNetworkAclsOptions.ResourceGroupID)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateNetworkACL : Update a network ACL -// This request updates a network ACL's name. -func (vpc *VpcV1) UpdateNetworkACL(updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - return vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) -} - -// UpdateNetworkACLWithContext is an alternate form of the UpdateNetworkACL method which supports a Context parameter -func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateNetworkACLOptions, "updateNetworkACLOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateNetworkACLOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateNetworkACLRule : Update a network ACL rule -// This request updates a rule with the information in a provided rule patch. The rule patch object contains only the -// information to be updated. The request will fail if the information is not applicable to the rule's protocol. -func (vpc *VpcV1) UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions) -} - -// UpdateNetworkACLRuleWithContext is an alternate form of the UpdateNetworkACLRule method which supports a Context parameter -func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "network_acl_id": *updateNetworkACLRuleOptions.NetworkACLID, - "id": *updateNetworkACLRuleOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACLRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateSecurityGroup : Create a security group -// This request creates a new security group from a security group prototype object. The prototype object is structured -// in the same way as a retrieved security group, and contains the information necessary to create the new security -// group. If security group rules are included in the prototype object, those rules will be added to the security group. -// Each security group is scoped to one VPC. Only resources in that VPC can be added to the security group. -func (vpc *VpcV1) CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - return vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) -} - -// CreateSecurityGroupWithContext is an alternate form of the CreateSecurityGroup method which supports a Context parameter -func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSecurityGroupOptions, "createSecurityGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createSecurityGroupOptions.VPC != nil { - body["vpc"] = createSecurityGroupOptions.VPC - } - if createSecurityGroupOptions.Name != nil { - body["name"] = createSecurityGroupOptions.Name - } - if createSecurityGroupOptions.ResourceGroup != nil { - body["resource_group"] = createSecurityGroupOptions.ResourceGroup - } - if createSecurityGroupOptions.Rules != nil { - body["rules"] = createSecurityGroupOptions.Rules - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateSecurityGroupRule : Create a rule for a security group -// This request creates a new security group rule from a security group rule prototype object. The prototype object is -// structured in the same way as a retrieved security group rule and contains the information necessary to create the -// rule. As part of creating a new rule in a security group, the rule is applied to all the networking interfaces in the -// security group. Rules specify which IP traffic a security group will allow. Security group rules are stateful, such -// that reverse traffic in response to allowed traffic is automatically permitted. A rule allowing inbound TCP traffic -// on port 80 also allows outbound TCP traffic on port 80 without the need for an additional rule. -func (vpc *VpcV1) CreateSecurityGroupRule(createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - return vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) -} - -// CreateSecurityGroupRuleWithContext is an alternate form of the CreateSecurityGroupRule method which supports a Context parameter -func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "security_group_id": *createSecurityGroupRuleOptions.SecurityGroupID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateSecurityGroupTargetBinding : Add a target to a security group -// This request adds a resource to an existing security group. The specified target identifier can be: -// -// - A bare metal server network interface identifier -// - A virtual network interface identifier -// - A VPN server identifier -// - An application load balancer identifier -// - An endpoint gateway identifier -// - An instance network interface identifier -// -// When a target is added to a security group, the security group rules are applied to the target. A request body is not -// required, and if provided, is ignored. -func (vpc *VpcV1) CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { - return vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions) -} - -// CreateSecurityGroupTargetBindingWithContext is an alternate form of the CreateSecurityGroupTargetBinding method which supports a Context parameter -func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Context, createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "security_group_id": *createSecurityGroupTargetBindingOptions.SecurityGroupID, - "id": *createSecurityGroupTargetBindingOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteSecurityGroup : Delete a security group -// This request deletes a security group. A security group cannot be deleted if it is referenced by any security group -// targets or rules. Additionally, a VPC's default security group cannot be deleted. This operation cannot be reversed. -func (vpc *VpcV1) DeleteSecurityGroup(deleteSecurityGroupOptions *DeleteSecurityGroupOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) -} - -// DeleteSecurityGroupWithContext is an alternate form of the DeleteSecurityGroup method which supports a Context parameter -func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecurityGroupOptions *DeleteSecurityGroupOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSecurityGroupOptions, "deleteSecurityGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteSecurityGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteSecurityGroupRule : Delete a security group rule -// This request deletes a security group rule. This operation cannot be reversed. Removing a security group rule will -// not end existing connections allowed by that rule. -func (vpc *VpcV1) DeleteSecurityGroupRule(deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) -} - -// DeleteSecurityGroupRuleWithContext is an alternate form of the DeleteSecurityGroupRule method which supports a Context parameter -func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "security_group_id": *deleteSecurityGroupRuleOptions.SecurityGroupID, - "id": *deleteSecurityGroupRuleOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteSecurityGroupTargetBinding : Remove a target from a security group -// This request removes a target from a security group. For this request to succeed, the target must be attached to at -// least one other security group. The specified target identifier can be: -// -// - A bare metal server network interface identifier -// - A virtual network interface identifier -// - A VPN server identifier -// - An application load balancer identifier -// - An endpoint gateway identifier -// - An instance network interface identifier -// -// Security groups are stateful, so any changes to a target's security groups are applied to new connections. Existing -// connections are not affected. -func (vpc *VpcV1) DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) -} - -// DeleteSecurityGroupTargetBindingWithContext is an alternate form of the DeleteSecurityGroupTargetBinding method which supports a Context parameter -func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Context, deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, - "id": *deleteSecurityGroupTargetBindingOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetSecurityGroup : Retrieve a security group -// This request retrieves a single security group specified by the identifier in the URL path. -func (vpc *VpcV1) GetSecurityGroup(getSecurityGroupOptions *GetSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - return vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) -} - -// GetSecurityGroupWithContext is an alternate form of the GetSecurityGroup method which supports a Context parameter -func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGroupOptions *GetSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSecurityGroupOptions, "getSecurityGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getSecurityGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetSecurityGroupRule : Retrieve a security group rule -// This request retrieves a single security group rule specified by the identifier in the URL path. -func (vpc *VpcV1) GetSecurityGroupRule(getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - return vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions) -} - -// GetSecurityGroupRuleWithContext is an alternate form of the GetSecurityGroupRule method which supports a Context parameter -func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "security_group_id": *getSecurityGroupRuleOptions.SecurityGroupID, - "id": *getSecurityGroupRuleOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetSecurityGroupTarget : Retrieve a security group target -// This request retrieves a single target specified by the identifier in the URL path. The target must be an existing -// target of the security group. -func (vpc *VpcV1) GetSecurityGroupTarget(getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { - return vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) -} - -// GetSecurityGroupTargetWithContext is an alternate form of the GetSecurityGroupTarget method which supports a Context parameter -func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "security_group_id": *getSecurityGroupTargetOptions.SecurityGroupID, - "id": *getSecurityGroupTargetOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListSecurityGroupRules : List all rules in a security group -// This request lists all rules in a security group. These rules define what traffic the security group permits. -// Security group rules are stateful, such that reverse traffic in response to allowed traffic is automatically -// permitted. -func (vpc *VpcV1) ListSecurityGroupRules(listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) (result *SecurityGroupRuleCollection, response *core.DetailedResponse, err error) { - return vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) -} - -// ListSecurityGroupRulesWithContext is an alternate form of the ListSecurityGroupRules method which supports a Context parameter -func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) (result *SecurityGroupRuleCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "security_group_id": *listSecurityGroupRulesOptions.SecurityGroupID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListSecurityGroupTargets : List all targets associated with a security group -// This request lists all targets associated with a security group, to which the rules in the security group are -// applied. -func (vpc *VpcV1) ListSecurityGroupTargets(listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) (result *SecurityGroupTargetCollection, response *core.DetailedResponse, err error) { - return vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) -} - -// ListSecurityGroupTargetsWithContext is an alternate form of the ListSecurityGroupTargets method which supports a Context parameter -func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) (result *SecurityGroupTargetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "security_group_id": *listSecurityGroupTargetsOptions.SecurityGroupID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSecurityGroupTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) - } - if listSecurityGroupTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListSecurityGroups : List all security groups -// This request lists all security groups in the region. Security groups provide a way to apply IP filtering rules to -// instances in the associated VPC. With security groups, all traffic is denied by default, and rules added to security -// groups define which traffic the security group permits. Security group rules are stateful such that reverse traffic -// in response to allowed traffic is automatically permitted. -func (vpc *VpcV1) ListSecurityGroups(listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) -} - -// ListSecurityGroupsWithContext is an alternate form of the ListSecurityGroups method which supports a Context parameter -func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSecurityGroupsOptions, "listSecurityGroupsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listSecurityGroupsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSecurityGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSecurityGroupsOptions.Start)) - } - if listSecurityGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupsOptions.Limit)) - } - if listSecurityGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSecurityGroupsOptions.ResourceGroupID)) - } - if listSecurityGroupsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listSecurityGroupsOptions.VPCID)) - } - if listSecurityGroupsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listSecurityGroupsOptions.VPCCRN)) - } - if listSecurityGroupsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listSecurityGroupsOptions.VPCName)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateSecurityGroup : Update a security group -// This request updates a security group with the information provided in a security group patch object. The security -// group patch object is structured in the same way as a retrieved security group and contains only the information to -// be updated. -func (vpc *VpcV1) UpdateSecurityGroup(updateSecurityGroupOptions *UpdateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - return vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) -} - -// UpdateSecurityGroupWithContext is an alternate form of the UpdateSecurityGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecurityGroupOptions *UpdateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSecurityGroupOptions, "updateSecurityGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateSecurityGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateSecurityGroupOptions.SecurityGroupPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateSecurityGroupRule : Update a security group rule -// This request updates a security group rule with the information in a provided rule patch object. The rule patch -// object contains only the information to be updated. The request will fail if the information is not applicable to the -// rule's protocol. -func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) -} - -// UpdateSecurityGroupRuleWithContext is an alternate form of the UpdateSecurityGroupRule method which supports a Context parameter -func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "security_group_id": *updateSecurityGroupRuleOptions.SecurityGroupID, - "id": *updateSecurityGroupRuleOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) - if err != nil { - return - } - response.Result = result - } - - return -} - -// AddVPNGatewayConnectionLocalCIDR : Set a local CIDR on a VPN gateway connection -// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified -// CIDR already exists. A request body is not required, and if provided, is ignored. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.AddVPNGatewayConnectionLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionLocalCIDROptions) -} - -// AddVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the AddVPNGatewayConnectionLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *addVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, - "id": *addVPNGatewayConnectionLocalCIDROptions.ID, - "cidr_prefix": *addVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, - "prefix_length": *addVPNGatewayConnectionLocalCIDROptions.PrefixLength, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range addVPNGatewayConnectionLocalCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionLocalCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// AddVPNGatewayConnectionPeerCIDR : Set a peer CIDR on a VPN gateway connection -// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified -// CIDR already exists. A request body is not required, and if provided, is ignored. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.AddVPNGatewayConnectionPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionPeerCIDROptions) -} - -// AddVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the AddVPNGatewayConnectionPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *addVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, - "id": *addVPNGatewayConnectionPeerCIDROptions.ID, - "cidr_prefix": *addVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, - "prefix_length": *addVPNGatewayConnectionPeerCIDROptions.PrefixLength, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range addVPNGatewayConnectionPeerCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionPeerCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// CheckVPNGatewayConnectionLocalCIDR : Check if the specified local CIDR exists on a VPN gateway connection -// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.CheckVPNGatewayConnectionLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionLocalCIDROptions) -} - -// CheckVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *checkVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, - "id": *checkVPNGatewayConnectionLocalCIDROptions.ID, - "cidr_prefix": *checkVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, - "prefix_length": *checkVPNGatewayConnectionLocalCIDROptions.PrefixLength, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range checkVPNGatewayConnectionLocalCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionLocalCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// CheckVPNGatewayConnectionPeerCIDR : Check if the specified peer CIDR exists on a VPN gateway connection -// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.CheckVPNGatewayConnectionPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionPeerCIDROptions) -} - -// CheckVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *checkVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, - "id": *checkVPNGatewayConnectionPeerCIDROptions.ID, - "cidr_prefix": *checkVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, - "prefix_length": *checkVPNGatewayConnectionPeerCIDROptions.PrefixLength, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range checkVPNGatewayConnectionPeerCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionPeerCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// CreateIkePolicy : Create an IKE policy -// This request creates a new IKE policy. -func (vpc *VpcV1) CreateIkePolicy(createIkePolicyOptions *CreateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - return vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) -} - -// CreateIkePolicyWithContext is an alternate form of the CreateIkePolicy method which supports a Context parameter -func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolicyOptions *CreateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createIkePolicyOptions, "createIkePolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createIkePolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createIkePolicyOptions.AuthenticationAlgorithm != nil { - body["authentication_algorithm"] = createIkePolicyOptions.AuthenticationAlgorithm - } - if createIkePolicyOptions.DhGroup != nil { - body["dh_group"] = createIkePolicyOptions.DhGroup - } - if createIkePolicyOptions.EncryptionAlgorithm != nil { - body["encryption_algorithm"] = createIkePolicyOptions.EncryptionAlgorithm - } - if createIkePolicyOptions.IkeVersion != nil { - body["ike_version"] = createIkePolicyOptions.IkeVersion - } - if createIkePolicyOptions.KeyLifetime != nil { - body["key_lifetime"] = createIkePolicyOptions.KeyLifetime - } - if createIkePolicyOptions.Name != nil { - body["name"] = createIkePolicyOptions.Name - } - if createIkePolicyOptions.ResourceGroup != nil { - body["resource_group"] = createIkePolicyOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateIpsecPolicy : Create an IPsec policy -// This request creates a new IPsec policy. -func (vpc *VpcV1) CreateIpsecPolicy(createIpsecPolicyOptions *CreateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - return vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) -} - -// CreateIpsecPolicyWithContext is an alternate form of the CreateIpsecPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecPolicyOptions *CreateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createIpsecPolicyOptions, "createIpsecPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createIpsecPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIpsecPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createIpsecPolicyOptions.AuthenticationAlgorithm != nil { - body["authentication_algorithm"] = createIpsecPolicyOptions.AuthenticationAlgorithm - } - if createIpsecPolicyOptions.EncryptionAlgorithm != nil { - body["encryption_algorithm"] = createIpsecPolicyOptions.EncryptionAlgorithm - } - if createIpsecPolicyOptions.Pfs != nil { - body["pfs"] = createIpsecPolicyOptions.Pfs - } - if createIpsecPolicyOptions.KeyLifetime != nil { - body["key_lifetime"] = createIpsecPolicyOptions.KeyLifetime - } - if createIpsecPolicyOptions.Name != nil { - body["name"] = createIpsecPolicyOptions.Name - } - if createIpsecPolicyOptions.ResourceGroup != nil { - body["resource_group"] = createIpsecPolicyOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateVPNGateway : Create a VPN gateway -// This request creates a new VPN gateway. -func (vpc *VpcV1) CreateVPNGateway(createVPNGatewayOptions *CreateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - return vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) -} - -// CreateVPNGatewayWithContext is an alternate form of the CreateVPNGateway method which supports a Context parameter -func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGatewayOptions *CreateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPNGatewayOptions, "createVPNGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createVPNGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateVPNGatewayConnection : Create a connection for a VPN gateway -// This request creates a new VPN gateway connection. -func (vpc *VpcV1) CreateVPNGatewayConnection(createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - return vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) -} - -// CreateVPNGatewayConnectionWithContext is an alternate form of the CreateVPNGatewayConnection method which supports a Context parameter -func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteIkePolicy : Delete an IKE policy -// This request deletes an IKE policy. This operation cannot be reversed. For this request to succeed, there must not be -// any VPN gateway connections using this policy. -func (vpc *VpcV1) DeleteIkePolicy(deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) -} - -// DeleteIkePolicyWithContext is an alternate form of the DeleteIkePolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteIkePolicyOptions, "deleteIkePolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteIkePolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteIkePolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteIpsecPolicy : Delete an IPsec policy -// This request deletes an IPsec policy. This operation cannot be reversed. For this request to succeed, there must not -// be any VPN gateway connections using this policy. -func (vpc *VpcV1) DeleteIpsecPolicy(deleteIpsecPolicyOptions *DeleteIpsecPolicyOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions) -} - -// DeleteIpsecPolicyWithContext is an alternate form of the DeleteIpsecPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecPolicyOptions *DeleteIpsecPolicyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteIpsecPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteVPNGateway : Delete a VPN gateway -// This request deletes a VPN gateway. This operation cannot be reversed. For this request to succeed, the VPN gateway -// must not have a `status` of `pending`, and there must not be any VPC routes using the VPN gateway's connections as a -// next hop. -func (vpc *VpcV1) DeleteVPNGateway(deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) -} - -// DeleteVPNGatewayWithContext is an alternate form of the DeleteVPNGateway method which supports a Context parameter -func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPNGatewayOptions, "deleteVPNGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteVPNGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVPNGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteVPNGatewayConnection : Delete a VPN gateway connection -// This request deletes a VPN gateway connection. This operation cannot be reversed. For this request to succeed, there -// must not be VPC routes using this VPN connection as a next hop. -func (vpc *VpcV1) DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) -} - -// DeleteVPNGatewayConnectionWithContext is an alternate form of the DeleteVPNGatewayConnection method which supports a Context parameter -func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *deleteVPNGatewayConnectionOptions.VPNGatewayID, - "id": *deleteVPNGatewayConnectionOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetIkePolicy : Retrieve an IKE policy -// This request retrieves a single IKE policy specified by the identifier in the URL. -func (vpc *VpcV1) GetIkePolicy(getIkePolicyOptions *GetIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - return vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) -} - -// GetIkePolicyWithContext is an alternate form of the GetIkePolicy method which supports a Context parameter -func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptions *GetIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getIkePolicyOptions, "getIkePolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getIkePolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getIkePolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetIpsecPolicy : Retrieve an IPsec policy -// This request retrieves a single IPsec policy specified by the identifier in the URL. -func (vpc *VpcV1) GetIpsecPolicy(getIpsecPolicyOptions *GetIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - return vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) -} - -// GetIpsecPolicyWithContext is an alternate form of the GetIpsecPolicy method which supports a Context parameter -func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyOptions *GetIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getIpsecPolicyOptions, "getIpsecPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getIpsecPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getIpsecPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVPNGateway : Retrieve a VPN gateway -// This request retrieves a single VPN gateway specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNGateway(getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - return vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) -} - -// GetVPNGatewayWithContext is an alternate form of the GetVPNGateway method which supports a Context parameter -func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNGatewayOptions, "getVPNGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getVPNGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPNGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVPNGatewayConnection : Retrieve a VPN gateway connection -// This request retrieves a single VPN gateway connection specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNGatewayConnection(getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - return vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions) -} - -// GetVPNGatewayConnectionWithContext is an alternate form of the GetVPNGatewayConnection method which supports a Context parameter -func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *getVPNGatewayConnectionOptions.VPNGatewayID, - "id": *getVPNGatewayConnectionOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListIkePolicies : List all IKE policies -// This request lists all IKE policies in the region. -func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) -} - -// ListIkePoliciesWithContext is an alternate form of the ListIkePolicies method which supports a Context parameter -func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listIkePoliciesOptions, "listIkePoliciesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listIkePoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listIkePoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listIkePoliciesOptions.Start)) - } - if listIkePoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listIkePoliciesOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListIkePolicyConnections : List all VPN gateway connections that use a specified IKE policy -// This request lists all VPN gateway connections that use a policy. -func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) -} - -// ListIkePolicyConnectionsWithContext is an alternate form of the ListIkePolicyConnections method which supports a Context parameter -func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *listIkePolicyConnectionsOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}/connections`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListIpsecPolicies : List all IPsec policies -// This request lists all IPsec policies in the region. -func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) -} - -// ListIpsecPoliciesWithContext is an alternate form of the ListIpsecPolicies method which supports a Context parameter -func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listIpsecPoliciesOptions, "listIpsecPoliciesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listIpsecPoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listIpsecPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listIpsecPoliciesOptions.Start)) - } - if listIpsecPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listIpsecPoliciesOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListIpsecPolicyConnections : List all VPN gateway connections that use a specified IPsec policy -// This request lists all VPN gateway connections that use a policy. -func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) -} - -// ListIpsecPolicyConnectionsWithContext is an alternate form of the ListIpsecPolicyConnections method which supports a Context parameter -func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *listIpsecPolicyConnectionsOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}/connections`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVPNGatewayConnectionLocalCIDRs : List all local CIDRs for a VPN gateway connection -// This request lists all local CIDRs for a VPN gateway connection. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionLocalCIDRsOptions) -} - -// ListVPNGatewayConnectionLocalCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionLocalCIDRs method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionLocalCIDRsOptions.VPNGatewayID, - "id": *listVPNGatewayConnectionLocalCIDRsOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listVPNGatewayConnectionLocalCIDRsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionLocalCIDRs") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionLocalCIDRs) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVPNGatewayConnectionPeerCIDRs : List all peer CIDRs for a VPN gateway connection -// This request lists all peer CIDRs for a VPN gateway connection. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionPeerCIDRsOptions) -} - -// ListVPNGatewayConnectionPeerCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionPeerCIDRs method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionPeerCIDRsOptions.VPNGatewayID, - "id": *listVPNGatewayConnectionPeerCIDRsOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listVPNGatewayConnectionPeerCIDRsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionPeerCIDRs") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionPeerCIDRs) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVPNGatewayConnections : List all connections of a VPN gateway -// This request lists all connections of a VPN gateway. -func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) -} - -// ListVPNGatewayConnectionsWithContext is an alternate form of the ListVPNGatewayConnections method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionsOptions.VPNGatewayID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPNGatewayConnectionsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVPNGateways : List all VPN gateways -// This request lists all VPN gateways in the region. -func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions) -} - -// ListVPNGatewaysWithContext is an alternate form of the ListVPNGateways method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVPNGatewaysOptions, "listVPNGatewaysOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listVPNGatewaysOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPNGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNGatewaysOptions.Start)) - } - if listVPNGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNGatewaysOptions.Limit)) - } - if listVPNGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNGatewaysOptions.ResourceGroupID)) - } - if listVPNGatewaysOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNGatewaysOptions.Sort)) - } - if listVPNGatewaysOptions.Mode != nil { - builder.AddQuery("mode", fmt.Sprint(*listVPNGatewaysOptions.Mode)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// RemoveVPNGatewayConnectionLocalCIDR : Remove a local CIDR from a VPN gateway connection -// This request removes a CIDR from a VPN gateway connection. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveVPNGatewayConnectionLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionLocalCIDROptions) -} - -// RemoveVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *removeVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, - "id": *removeVPNGatewayConnectionLocalCIDROptions.ID, - "cidr_prefix": *removeVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, - "prefix_length": *removeVPNGatewayConnectionLocalCIDROptions.PrefixLength, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range removeVPNGatewayConnectionLocalCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionLocalCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// RemoveVPNGatewayConnectionPeerCIDR : Remove a peer CIDR from a VPN gateway connection -// This request removes a CIDR from a VPN gateway connection. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveVPNGatewayConnectionPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionPeerCIDROptions) -} - -// RemoveVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *removeVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, - "id": *removeVPNGatewayConnectionPeerCIDROptions.ID, - "cidr_prefix": *removeVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, - "prefix_length": *removeVPNGatewayConnectionPeerCIDROptions.PrefixLength, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range removeVPNGatewayConnectionPeerCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionPeerCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// UpdateIkePolicy : Update an IKE policy -// This request updates the properties of an existing IKE policy. -func (vpc *VpcV1) UpdateIkePolicy(updateIkePolicyOptions *UpdateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - return vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) -} - -// UpdateIkePolicyWithContext is an alternate form of the UpdateIkePolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolicyOptions *UpdateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateIkePolicyOptions, "updateIkePolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateIkePolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateIkePolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIkePolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateIkePolicyOptions.IkePolicyPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateIpsecPolicy : Update an IPsec policy -// This request updates the properties of an existing IPsec policy. -func (vpc *VpcV1) UpdateIpsecPolicy(updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - return vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) -} - -// UpdateIpsecPolicyWithContext is an alternate form of the UpdateIpsecPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateIpsecPolicyOptions, "updateIpsecPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateIpsecPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateIpsecPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateVPNGateway : Update a VPN gateway -// This request updates the properties of an existing VPN gateway. -func (vpc *VpcV1) UpdateVPNGateway(updateVPNGatewayOptions *UpdateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) -} - -// UpdateVPNGatewayWithContext is an alternate form of the UpdateVPNGateway method which supports a Context parameter -func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGatewayOptions *UpdateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPNGatewayOptions, "updateVPNGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateVPNGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateVPNGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPNGatewayOptions.VPNGatewayPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateVPNGatewayConnection : Update a VPN gateway connection -// This request updates the properties of an existing VPN gateway connection. -func (vpc *VpcV1) UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) -} - -// UpdateVPNGatewayConnectionWithContext is an alternate form of the UpdateVPNGatewayConnection method which supports a Context parameter -func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *updateVPNGatewayConnectionOptions.VPNGatewayID, - "id": *updateVPNGatewayConnectionOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGatewayConnection") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateVPNServer : Create a VPN server -// This request creates a new VPN server. -func (vpc *VpcV1) CreateVPNServer(createVPNServerOptions *CreateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - return vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions) -} - -// CreateVPNServerWithContext is an alternate form of the CreateVPNServer method which supports a Context parameter -func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServerOptions *CreateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPNServerOptions, "createVPNServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createVPNServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createVPNServerOptions.Certificate != nil { - body["certificate"] = createVPNServerOptions.Certificate - } - if createVPNServerOptions.ClientAuthentication != nil { - body["client_authentication"] = createVPNServerOptions.ClientAuthentication - } - if createVPNServerOptions.ClientIPPool != nil { - body["client_ip_pool"] = createVPNServerOptions.ClientIPPool - } - if createVPNServerOptions.Subnets != nil { - body["subnets"] = createVPNServerOptions.Subnets - } - if createVPNServerOptions.ClientDnsServerIps != nil { - body["client_dns_server_ips"] = createVPNServerOptions.ClientDnsServerIps - } - if createVPNServerOptions.ClientIdleTimeout != nil { - body["client_idle_timeout"] = createVPNServerOptions.ClientIdleTimeout - } - if createVPNServerOptions.EnableSplitTunneling != nil { - body["enable_split_tunneling"] = createVPNServerOptions.EnableSplitTunneling - } - if createVPNServerOptions.Name != nil { - body["name"] = createVPNServerOptions.Name - } - if createVPNServerOptions.Port != nil { - body["port"] = createVPNServerOptions.Port - } - if createVPNServerOptions.Protocol != nil { - body["protocol"] = createVPNServerOptions.Protocol - } - if createVPNServerOptions.ResourceGroup != nil { - body["resource_group"] = createVPNServerOptions.ResourceGroup - } - if createVPNServerOptions.SecurityGroups != nil { - body["security_groups"] = createVPNServerOptions.SecurityGroups - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateVPNServerRoute : Create a VPN route for a VPN server -// This request creates a new VPN route in the VPN server. All VPN routes are provided to the VPN client when the -// connection is established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN -// route matching their specified destinations. All VPN routes must be unique within the VPN server. destination of the -// packet. -func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - return vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) -} - -// CreateVPNServerRouteWithContext is an alternate form of the CreateVPNServerRoute method which supports a Context parameter -func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPNServerRouteOptions, "createVPNServerRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_server_id": *createVPNServerRouteOptions.VPNServerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createVPNServerRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createVPNServerRouteOptions.Destination != nil { - body["destination"] = createVPNServerRouteOptions.Destination - } - if createVPNServerRouteOptions.Action != nil { - body["action"] = createVPNServerRouteOptions.Action - } - if createVPNServerRouteOptions.Name != nil { - body["name"] = createVPNServerRouteOptions.Name - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteVPNServer : Delete a VPN server -// This request deletes a VPN server. This operation cannot be reversed. -func (vpc *VpcV1) DeleteVPNServer(deleteVPNServerOptions *DeleteVPNServerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions) -} - -// DeleteVPNServerWithContext is an alternate form of the DeleteVPNServer method which supports a Context parameter -func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServerOptions *DeleteVPNServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPNServerOptions, "deleteVPNServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteVPNServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVPNServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - if deleteVPNServerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPNServerOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteVPNServerClient : Delete a VPN client -// This request disconnects and deletes the VPN client from the VPN server. The VPN client may reconnect unless its -// authentication permissions for the configured authentication methods (such as its client certificate) have been -// revoked. -func (vpc *VpcV1) DeleteVPNServerClient(deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) -} - -// DeleteVPNServerClientWithContext is an alternate form of the DeleteVPNServerClient method which supports a Context parameter -func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPNServerClientOptions, "deleteVPNServerClientOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_server_id": *deleteVPNServerClientOptions.VPNServerID, - "id": *deleteVPNServerClientOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVPNServerClientOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteVPNServerRoute : Delete a VPN route -// This request deletes a VPN route. This operation cannot be reversed. -func (vpc *VpcV1) DeleteVPNServerRoute(deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) -} - -// DeleteVPNServerRouteWithContext is an alternate form of the DeleteVPNServerRoute method which supports a Context parameter -func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_server_id": *deleteVPNServerRouteOptions.VPNServerID, - "id": *deleteVPNServerRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DisconnectVPNClient : Disconnect a VPN client -// This request disconnects the specified VPN client, and deletes the client according to the VPN server's auto-deletion -// policy. The VPN client may reconnect unless its authentication permissions for the configured authentication methods -// (such as its client certificate) have been revoked. -func (vpc *VpcV1) DisconnectVPNClient(disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) { - return vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) -} - -// DisconnectVPNClientWithContext is an alternate form of the DisconnectVPNClient method which supports a Context parameter -func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(disconnectVPNClientOptions, "disconnectVPNClientOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_server_id": *disconnectVPNClientOptions.VPNServerID, - "id": *disconnectVPNClientOptions.ID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}/disconnect`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range disconnectVPNClientOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetVPNServer : Retrieve a VPN server -// This request retrieves a single VPN server specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNServer(getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - return vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) -} - -// GetVPNServerWithContext is an alternate form of the GetVPNServer method which supports a Context parameter -func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNServerOptions, "getVPNServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getVPNServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPNServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVPNServerClient : Retrieve a VPN client -// This request retrieves a single VPN client specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) { - return vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) -} - -// GetVPNServerClientWithContext is an alternate form of the GetVPNServerClient method which supports a Context parameter -func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNServerClientOptions, "getVPNServerClientOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_server_id": *getVPNServerClientOptions.VPNServerID, - "id": *getVPNServerClientOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPNServerClientOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetVPNServerClientConfiguration : Retrieve client configuration -// This request retrieves OpenVPN client configuration on a single VPN server specified by the identifier in the URL. -// This configuration includes directives compatible with OpenVPN releases 2.4 and 2.5. -func (vpc *VpcV1) GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) { - return vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) -} - -// GetVPNServerClientConfigurationWithContext is an alternate form of the GetVPNServerClientConfiguration method which supports a Context parameter -func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context, getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getVPNServerClientConfigurationOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}/client_configuration`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "text/plain") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, &result) - - return -} - -// GetVPNServerRoute : Retrieve a VPN route -// This request retrieves a single VPN route specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNServerRoute(getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - return vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) -} - -// GetVPNServerRouteWithContext is an alternate form of the GetVPNServerRoute method which supports a Context parameter -func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNServerRouteOptions, "getVPNServerRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getVPNServerRouteOptions, "getVPNServerRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_server_id": *getVPNServerRouteOptions.VPNServerID, - "id": *getVPNServerRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getVPNServerRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVPNServerClients : List all VPN clients for a VPN server -// This request retrieves all connected VPN clients, and any disconnected VPN clients that the VPN server has not yet -// deleted based on its auto-deletion policy. -func (vpc *VpcV1) ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) -} - -// ListVPNServerClientsWithContext is an alternate form of the ListVPNServerClients method which supports a Context parameter -func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNServerClientsOptions, "listVPNServerClientsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_server_id": *listVPNServerClientsOptions.VPNServerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listVPNServerClientsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPNServerClientsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start)) - } - if listVPNServerClientsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNServerClientsOptions.Limit)) - } - if listVPNServerClientsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNServerClientsOptions.Sort)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVPNServerRoutes : List all VPN routes for a VPN server -// This request lists all VPN routes in a VPN server. All VPN routes are provided to the VPN client when the connection -// is established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN route -// matching their specified destinations. All VPN routes must be unique within the VPN server. -func (vpc *VpcV1) ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) -} - -// ListVPNServerRoutesWithContext is an alternate form of the ListVPNServerRoutes method which supports a Context parameter -func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNServerRoutesOptions, "listVPNServerRoutesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_server_id": *listVPNServerRoutesOptions.VPNServerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listVPNServerRoutesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPNServerRoutesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNServerRoutesOptions.Start)) - } - if listVPNServerRoutesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNServerRoutesOptions.Limit)) - } - if listVPNServerRoutesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNServerRoutesOptions.Sort)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRouteCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListVPNServers : List all VPN servers -// This request lists all VPN servers. -func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) -} - -// ListVPNServersWithContext is an alternate form of the ListVPNServers method which supports a Context parameter -func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVPNServersOptions, "listVPNServersOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listVPNServersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVPNServersOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) - } - if listVPNServersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNServersOptions.Start)) - } - if listVPNServersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNServersOptions.Limit)) - } - if listVPNServersOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNServersOptions.ResourceGroupID)) - } - if listVPNServersOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNServersOptions.Sort)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateVPNServer : Update a VPN server -// This request updates the properties of an existing VPN server. Any property changes will cause all connected VPN -// clients are disconnected from this VPN server except for the name change. -func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - return vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) -} - -// UpdateVPNServerWithContext is an alternate form of the UpdateVPNServer method which supports a Context parameter -func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPNServerOptions, "updateVPNServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateVPNServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateVPNServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVPNServerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPNServerOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateVPNServerRoute : Update a VPN route -// This request updates a VPN route with the information in a provided VPN route patch. The VPN route patch object is -// structured in the same way as a retrieved VPN route and contains only the information to be updated. -func (vpc *VpcV1) UpdateVPNServerRoute(updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - return vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions) -} - -// UpdateVPNServerRouteWithContext is an alternate form of the UpdateVPNServerRoute method which supports a Context parameter -func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPNServerRouteOptions, "updateVPNServerRouteOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "vpn_server_id": *updateVPNServerRouteOptions.VPNServerID, - "id": *updateVPNServerRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateVPNServerRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPNServerRouteOptions.VPNServerRoutePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateLoadBalancer : Create a load balancer -// This request creates and provisions a new load balancer. -func (vpc *VpcV1) CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) -} - -// CreateLoadBalancerWithContext is an alternate form of the CreateLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerOptions, "createLoadBalancerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createLoadBalancerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createLoadBalancerOptions.IsPublic != nil { - body["is_public"] = createLoadBalancerOptions.IsPublic - } - if createLoadBalancerOptions.Subnets != nil { - body["subnets"] = createLoadBalancerOptions.Subnets - } - if createLoadBalancerOptions.Datapath != nil { - body["datapath"] = createLoadBalancerOptions.Datapath - } - if createLoadBalancerOptions.Dns != nil { - body["dns"] = createLoadBalancerOptions.Dns - } - if createLoadBalancerOptions.Listeners != nil { - body["listeners"] = createLoadBalancerOptions.Listeners - } - if createLoadBalancerOptions.Logging != nil { - body["logging"] = createLoadBalancerOptions.Logging - } - if createLoadBalancerOptions.Name != nil { - body["name"] = createLoadBalancerOptions.Name - } - if createLoadBalancerOptions.Pools != nil { - body["pools"] = createLoadBalancerOptions.Pools - } - if createLoadBalancerOptions.Profile != nil { - body["profile"] = createLoadBalancerOptions.Profile - } - if createLoadBalancerOptions.ResourceGroup != nil { - body["resource_group"] = createLoadBalancerOptions.ResourceGroup - } - if createLoadBalancerOptions.RouteMode != nil { - body["route_mode"] = createLoadBalancerOptions.RouteMode - } - if createLoadBalancerOptions.SecurityGroups != nil { - body["security_groups"] = createLoadBalancerOptions.SecurityGroups - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateLoadBalancerListener : Create a listener for a load balancer -// This request creates a new listener for a load balancer. -func (vpc *VpcV1) CreateLoadBalancerListener(createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) -} - -// CreateLoadBalancerListenerWithContext is an alternate form of the CreateLoadBalancerListener method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createLoadBalancerListenerOptions.Protocol != nil { - body["protocol"] = createLoadBalancerListenerOptions.Protocol - } - if createLoadBalancerListenerOptions.AcceptProxyProtocol != nil { - body["accept_proxy_protocol"] = createLoadBalancerListenerOptions.AcceptProxyProtocol - } - if createLoadBalancerListenerOptions.CertificateInstance != nil { - body["certificate_instance"] = createLoadBalancerListenerOptions.CertificateInstance - } - if createLoadBalancerListenerOptions.ConnectionLimit != nil { - body["connection_limit"] = createLoadBalancerListenerOptions.ConnectionLimit - } - if createLoadBalancerListenerOptions.DefaultPool != nil { - body["default_pool"] = createLoadBalancerListenerOptions.DefaultPool - } - if createLoadBalancerListenerOptions.HTTPSRedirect != nil { - body["https_redirect"] = createLoadBalancerListenerOptions.HTTPSRedirect - } - if createLoadBalancerListenerOptions.IdleConnectionTimeout != nil { - body["idle_connection_timeout"] = createLoadBalancerListenerOptions.IdleConnectionTimeout - } - if createLoadBalancerListenerOptions.Policies != nil { - body["policies"] = createLoadBalancerListenerOptions.Policies - } - if createLoadBalancerListenerOptions.Port != nil { - body["port"] = createLoadBalancerListenerOptions.Port - } - if createLoadBalancerListenerOptions.PortMax != nil { - body["port_max"] = createLoadBalancerListenerOptions.PortMax - } - if createLoadBalancerListenerOptions.PortMin != nil { - body["port_min"] = createLoadBalancerListenerOptions.PortMin - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener -// Creates a new policy for a load balancer listener. -func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) -} - -// CreateLoadBalancerListenerPolicyWithContext is an alternate form of the CreateLoadBalancerListenerPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Context, createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *createLoadBalancerListenerPolicyOptions.ListenerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createLoadBalancerListenerPolicyOptions.Action != nil { - body["action"] = createLoadBalancerListenerPolicyOptions.Action - } - if createLoadBalancerListenerPolicyOptions.Priority != nil { - body["priority"] = createLoadBalancerListenerPolicyOptions.Priority - } - if createLoadBalancerListenerPolicyOptions.Name != nil { - body["name"] = createLoadBalancerListenerPolicyOptions.Name - } - if createLoadBalancerListenerPolicyOptions.Rules != nil { - body["rules"] = createLoadBalancerListenerPolicyOptions.Rules - } - if createLoadBalancerListenerPolicyOptions.Target != nil { - body["target"] = createLoadBalancerListenerPolicyOptions.Target - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateLoadBalancerListenerPolicyRule : Create a rule for a load balancer listener policy -// Creates a new rule for the load balancer listener policy. -func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) -} - -// CreateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the CreateLoadBalancerListenerPolicyRule method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createLoadBalancerListenerPolicyRuleOptions.Condition != nil { - body["condition"] = createLoadBalancerListenerPolicyRuleOptions.Condition - } - if createLoadBalancerListenerPolicyRuleOptions.Type != nil { - body["type"] = createLoadBalancerListenerPolicyRuleOptions.Type - } - if createLoadBalancerListenerPolicyRuleOptions.Value != nil { - body["value"] = createLoadBalancerListenerPolicyRuleOptions.Value - } - if createLoadBalancerListenerPolicyRuleOptions.Field != nil { - body["field"] = createLoadBalancerListenerPolicyRuleOptions.Field - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateLoadBalancerPool : Create a load balancer pool -// This request creates a new pool from a pool prototype object. -func (vpc *VpcV1) CreateLoadBalancerPool(createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) -} - -// CreateLoadBalancerPoolWithContext is an alternate form of the CreateLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerPoolOptions.LoadBalancerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createLoadBalancerPoolOptions.Algorithm != nil { - body["algorithm"] = createLoadBalancerPoolOptions.Algorithm - } - if createLoadBalancerPoolOptions.HealthMonitor != nil { - body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor - } - if createLoadBalancerPoolOptions.Protocol != nil { - body["protocol"] = createLoadBalancerPoolOptions.Protocol - } - if createLoadBalancerPoolOptions.Members != nil { - body["members"] = createLoadBalancerPoolOptions.Members - } - if createLoadBalancerPoolOptions.Name != nil { - body["name"] = createLoadBalancerPoolOptions.Name - } - if createLoadBalancerPoolOptions.ProxyProtocol != nil { - body["proxy_protocol"] = createLoadBalancerPoolOptions.ProxyProtocol - } - if createLoadBalancerPoolOptions.SessionPersistence != nil { - body["session_persistence"] = createLoadBalancerPoolOptions.SessionPersistence - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateLoadBalancerPoolMember : Create a member in a load balancer pool -// This request creates a new member and adds the member to the pool. -func (vpc *VpcV1) CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) -} - -// CreateLoadBalancerPoolMemberWithContext is an alternate form of the CreateLoadBalancerPoolMember method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createLoadBalancerPoolMemberOptions.Port != nil { - body["port"] = createLoadBalancerPoolMemberOptions.Port - } - if createLoadBalancerPoolMemberOptions.Target != nil { - body["target"] = createLoadBalancerPoolMemberOptions.Target - } - if createLoadBalancerPoolMemberOptions.Weight != nil { - body["weight"] = createLoadBalancerPoolMemberOptions.Weight - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteLoadBalancer : Delete a load balancer -// This request deletes a load balancer. This operation cannot be reversed. A load balancer cannot be deleted if its -// `provisioning_status` is `delete_pending`. -func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) -} - -// DeleteLoadBalancerWithContext is an alternate form of the DeleteLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerOptions, "deleteLoadBalancerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteLoadBalancerOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteLoadBalancerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - 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 { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteLoadBalancerListener : Delete a load balancer listener -// This request deletes a load balancer listener. This operation cannot be reversed. For this operation to succeed, the -// listener must not be the target of another load balancer listener. -func (vpc *VpcV1) DeleteLoadBalancerListener(deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) -} - -// DeleteLoadBalancerListenerWithContext is an alternate form of the DeleteLoadBalancerListener method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerOptions.LoadBalancerID, - "id": *deleteLoadBalancerListenerOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteLoadBalancerListenerPolicy : Delete a load balancer listener policy -// Deletes a policy of the load balancer listener. This operation cannot be reversed. -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) -} - -// DeleteLoadBalancerListenerPolicyWithContext is an alternate form of the DeleteLoadBalancerListenerPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *deleteLoadBalancerListenerPolicyOptions.ListenerID, - "id": *deleteLoadBalancerListenerPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteLoadBalancerListenerPolicyRule : Delete a load balancer listener policy rule -// Deletes a rule from the load balancer listener policy. This operation cannot be reversed. -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) -} - -// DeleteLoadBalancerListenerPolicyRuleWithContext is an alternate form of the DeleteLoadBalancerListenerPolicyRule method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *deleteLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *deleteLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *deleteLoadBalancerListenerPolicyRuleOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteLoadBalancerPool : Delete a load balancer pool -// This request deletes a load balancer pool. This operation cannot be reversed. The pool must not currently be the -// default pool for any listener in the load balancer. -func (vpc *VpcV1) DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) -} - -// DeleteLoadBalancerPoolWithContext is an alternate form of the DeleteLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerPoolOptions.LoadBalancerID, - "id": *deleteLoadBalancerPoolOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// DeleteLoadBalancerPoolMember : Delete a load balancer pool member -// This request deletes a member from the pool. This operation cannot be reversed. -func (vpc *VpcV1) DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) -} - -// DeleteLoadBalancerPoolMemberWithContext is an alternate form of the DeleteLoadBalancerPoolMember method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *deleteLoadBalancerPoolMemberOptions.PoolID, - "id": *deleteLoadBalancerPoolMemberOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetLoadBalancer : Retrieve a load balancer -// This request retrieves a single load balancer specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancer(getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) -} - -// GetLoadBalancerWithContext is an alternate form of the GetLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerOptions, "getLoadBalancerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getLoadBalancerOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getLoadBalancerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetLoadBalancerListener : Retrieve a load balancer listener -// This request retrieves a single listener specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerListener(getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) -} - -// GetLoadBalancerListenerWithContext is an alternate form of the GetLoadBalancerListener method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerOptions.LoadBalancerID, - "id": *getLoadBalancerListenerOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetLoadBalancerListenerPolicy : Retrieve a load balancer listener policy -// Retrieve a single policy specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) -} - -// GetLoadBalancerListenerPolicyWithContext is an alternate form of the GetLoadBalancerListenerPolicy method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, - "id": *getLoadBalancerListenerPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetLoadBalancerListenerPolicyRule : Retrieve a load balancer listener policy rule -// Retrieves a single rule specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) -} - -// GetLoadBalancerListenerPolicyRuleWithContext is an alternate form of the GetLoadBalancerListenerPolicyRule method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *getLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *getLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *getLoadBalancerListenerPolicyRuleOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetLoadBalancerPool : Retrieve a load balancer pool -// This request retrieves a single pool specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerPool(getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) -} - -// GetLoadBalancerPoolWithContext is an alternate form of the GetLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerPoolOptions.LoadBalancerID, - "id": *getLoadBalancerPoolOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetLoadBalancerPoolMember : Retrieve a load balancer pool member -// This request retrieves a single member specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) -} - -// GetLoadBalancerPoolMemberWithContext is an alternate form of the GetLoadBalancerPoolMember method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *getLoadBalancerPoolMemberOptions.PoolID, - "id": *getLoadBalancerPoolMemberOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetLoadBalancerProfile : Retrieve a load balancer profile -// This request retrieves a load balancer profile specified by the name in the URL. -func (vpc *VpcV1) GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) -} - -// GetLoadBalancerProfileWithContext is an alternate form of the GetLoadBalancerProfile method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "name": *getLoadBalancerProfileOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles/{name}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetLoadBalancerStatistics : List all statistics of a load balancer -// This request lists statistics of a load balancer. -func (vpc *VpcV1) GetLoadBalancerStatistics(getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) -} - -// GetLoadBalancerStatisticsWithContext is an alternate form of the GetLoadBalancerStatistics method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getLoadBalancerStatisticsOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}/statistics`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListLoadBalancerListenerPolicies : List all policies for a load balancer listener -// This request lists all policies for a load balancer listener. -func (vpc *VpcV1) ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) -} - -// ListLoadBalancerListenerPoliciesWithContext is an alternate form of the ListLoadBalancerListenerPolicies method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Context, listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenerPoliciesOptions.LoadBalancerID, - "listener_id": *listLoadBalancerListenerPoliciesOptions.ListenerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy -// This request lists all rules of a load balancer listener policy. -func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) -} - -// ListLoadBalancerListenerPolicyRulesWithContext is an alternate form of the ListLoadBalancerListenerPolicyRules method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Context, listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, - "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, - "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListLoadBalancerListeners : List all listeners for a load balancer -// This request lists all listeners for a load balancer. -func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) -} - -// ListLoadBalancerListenersWithContext is an alternate form of the ListLoadBalancerListeners method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListLoadBalancerPoolMembers : List all members of a load balancer pool -// This request lists all members of a load balancer pool. -func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) -} - -// ListLoadBalancerPoolMembersWithContext is an alternate form of the ListLoadBalancerPoolMembers method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerPoolMembersOptions.LoadBalancerID, - "pool_id": *listLoadBalancerPoolMembersOptions.PoolID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListLoadBalancerPools : List all pools of a load balancer -// This request lists all pools of a load balancer. -func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) -} - -// ListLoadBalancerPoolsWithContext is an alternate form of the ListLoadBalancerPools method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerPoolsOptions.LoadBalancerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListLoadBalancerProfiles : List all load balancer profiles -// This request lists all load balancer profiles available in the region. A load balancer profile specifies the -// performance characteristics and pricing model for a load balancer. -func (vpc *VpcV1) ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) -} - -// ListLoadBalancerProfilesWithContext is an alternate form of the ListLoadBalancerProfiles method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listLoadBalancerProfilesOptions, "listLoadBalancerProfilesOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listLoadBalancerProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) - } - if listLoadBalancerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerProfilesOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListLoadBalancers : List all load balancers -// This request lists all load balancers in the region. -func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) -} - -// ListLoadBalancersWithContext is an alternate form of the ListLoadBalancers method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listLoadBalancersOptions, "listLoadBalancersOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listLoadBalancersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listLoadBalancersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start)) - } - if listLoadBalancersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listLoadBalancersOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ReplaceLoadBalancerPoolMembers : Replace load balancer pool members -// This request replaces the existing members of the load balancer pool with new members created from the collection of -// member prototype objects. -func (vpc *VpcV1) ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - return vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) -} - -// ReplaceLoadBalancerPoolMembersWithContext is an alternate form of the ReplaceLoadBalancerPoolMembers method which supports a Context parameter -func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, - "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if replaceLoadBalancerPoolMembersOptions.Members != nil { - body["members"] = replaceLoadBalancerPoolMembersOptions.Members - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateLoadBalancer : Update a load balancer -// This request updates a load balancer with the information in a provided load balancer patch. The load balancer patch -// object is structured in the same way as a retrieved load balancer and contains only the information to be updated. A -// load balancer can only be updated if its `provisioning_status` is `active`. -func (vpc *VpcV1) UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) -} - -// UpdateLoadBalancerWithContext is an alternate form of the UpdateLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerOptions, "updateLoadBalancerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateLoadBalancerOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateLoadBalancerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateLoadBalancerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateLoadBalancerOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateLoadBalancerListener : Update a load balancer listener -// This request updates a load balancer listener from a listener patch. -func (vpc *VpcV1) UpdateLoadBalancerListener(updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) -} - -// UpdateLoadBalancerListenerWithContext is an alternate form of the UpdateLoadBalancerListener method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerOptions.LoadBalancerID, - "id": *updateLoadBalancerListenerOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy -// Updates a policy from a policy patch. -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) -} - -// UpdateLoadBalancerListenerPolicyWithContext is an alternate form of the UpdateLoadBalancerListenerPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Context, updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, - "id": *updateLoadBalancerListenerPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateLoadBalancerListenerPolicyRule : Update a load balancer listener policy rule -// Updates a rule of the load balancer listener policy. -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) -} - -// UpdateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the UpdateLoadBalancerListenerPolicyRule method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *updateLoadBalancerListenerPolicyRuleOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateLoadBalancerPool : Update a load balancer pool -// This request updates a load balancer pool from a pool patch. -func (vpc *VpcV1) UpdateLoadBalancerPool(updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) -} - -// UpdateLoadBalancerPoolWithContext is an alternate form of the UpdateLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerPoolOptions.LoadBalancerID, - "id": *updateLoadBalancerPoolOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateLoadBalancerPoolMember : Update a load balancer pool member -// This request updates an existing member from a member patch. -func (vpc *VpcV1) UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) -} - -// UpdateLoadBalancerPoolMemberWithContext is an alternate form of the UpdateLoadBalancerPoolMember method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *updateLoadBalancerPoolMemberOptions.PoolID, - "id": *updateLoadBalancerPoolMemberOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) - if err != nil { - return - } - response.Result = result - } - - return -} - -// AddEndpointGatewayIP : Bind a reserved IP to an endpoint gateway -// This request binds the specified reserved IP to the specified endpoint gateway. The reserved IP: -// -// - must currently be unbound, or not required by its target -// - must not be in the same zone as any other reserved IP bound to the endpoint gateway. -func (vpc *VpcV1) AddEndpointGatewayIP(addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) -} - -// AddEndpointGatewayIPWithContext is an alternate form of the AddEndpointGatewayIP method which supports a Context parameter -func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, - "id": *addEndpointGatewayIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateEndpointGateway : Create an endpoint gateway -// This request creates a new endpoint gateway. An endpoint gateway maps one or more reserved IPs in a VPC to a target -// outside the VPC. -func (vpc *VpcV1) CreateEndpointGateway(createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - return vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) -} - -// CreateEndpointGatewayWithContext is an alternate form of the CreateEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createEndpointGatewayOptions, "createEndpointGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createEndpointGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createEndpointGatewayOptions.Target != nil { - body["target"] = createEndpointGatewayOptions.Target - } - if createEndpointGatewayOptions.VPC != nil { - body["vpc"] = createEndpointGatewayOptions.VPC - } - if createEndpointGatewayOptions.AllowDnsResolutionBinding != nil { - body["allow_dns_resolution_binding"] = createEndpointGatewayOptions.AllowDnsResolutionBinding - } - if createEndpointGatewayOptions.Ips != nil { - body["ips"] = createEndpointGatewayOptions.Ips - } - if createEndpointGatewayOptions.Name != nil { - body["name"] = createEndpointGatewayOptions.Name - } - if createEndpointGatewayOptions.ResourceGroup != nil { - body["resource_group"] = createEndpointGatewayOptions.ResourceGroup - } - if createEndpointGatewayOptions.SecurityGroups != nil { - body["security_groups"] = createEndpointGatewayOptions.SecurityGroups - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteEndpointGateway : Delete an endpoint gateway -// This request deletes an endpoint gateway. This operation cannot be reversed. -// -// Reserved IPs that were bound to the endpoint gateway will be released if their -// `auto_delete` property is set to true. -func (vpc *VpcV1) DeleteEndpointGateway(deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) -} - -// DeleteEndpointGatewayWithContext is an alternate form of the DeleteEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteEndpointGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetEndpointGateway : Retrieve an endpoint gateway -// This request retrieves a single endpoint gateway specified by the identifier in the URL. -func (vpc *VpcV1) GetEndpointGateway(getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - return vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) -} - -// GetEndpointGatewayWithContext is an alternate form of the GetEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getEndpointGatewayOptions, "getEndpointGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getEndpointGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getEndpointGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetEndpointGatewayIP : Retrieve a reserved IP bound to an endpoint gateway -// This request retrieves the specified reserved IP address if it is bound to the endpoint gateway specified in the URL. -func (vpc *VpcV1) GetEndpointGatewayIP(getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) -} - -// GetEndpointGatewayIPWithContext is an alternate form of the GetEndpointGatewayIP method which supports a Context parameter -func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "endpoint_gateway_id": *getEndpointGatewayIPOptions.EndpointGatewayID, - "id": *getEndpointGatewayIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway -// This request lists all reserved IPs bound to an endpoint gateway. -func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { - return vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) -} - -// ListEndpointGatewayIpsWithContext is an alternate form of the ListEndpointGatewayIps method which supports a Context parameter -func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listEndpointGatewayIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listEndpointGatewayIpsOptions.Start)) - } - if listEndpointGatewayIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewayIpsOptions.Limit)) - } - if listEndpointGatewayIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listEndpointGatewayIpsOptions.Sort)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListEndpointGateways : List all endpoint gateways -// This request lists all endpoint gateways in the region. An endpoint gateway maps one or more reserved IPs in a VPC to -// a target outside the VPC. -func (vpc *VpcV1) ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { - return vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) -} - -// ListEndpointGatewaysWithContext is an alternate form of the ListEndpointGateways method which supports a Context parameter -func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listEndpointGatewaysOptions, "listEndpointGatewaysOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listEndpointGatewaysOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listEndpointGatewaysOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listEndpointGatewaysOptions.Name)) - } - if listEndpointGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listEndpointGatewaysOptions.Start)) - } - if listEndpointGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewaysOptions.Limit)) - } - if listEndpointGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listEndpointGatewaysOptions.ResourceGroupID)) - } - if listEndpointGatewaysOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listEndpointGatewaysOptions.VPCID)) - } - if listEndpointGatewaysOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listEndpointGatewaysOptions.VPCCRN)) - } - if listEndpointGatewaysOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listEndpointGatewaysOptions.VPCName)) - } - if listEndpointGatewaysOptions.AllowDnsResolutionBinding != nil { - builder.AddQuery("allow_dns_resolution_binding", fmt.Sprint(*listEndpointGatewaysOptions.AllowDnsResolutionBinding)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// RemoveEndpointGatewayIP : Unbind a reserved IP from an endpoint gateway -// This request unbinds the specified reserved IP from the specified endpoint gateway. If the reserved IP has -// `auto_delete` set to `true`, the reserved IP will be deleted. -func (vpc *VpcV1) RemoveEndpointGatewayIP(removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) -} - -// RemoveEndpointGatewayIPWithContext is an alternate form of the RemoveEndpointGatewayIP method which supports a Context parameter -func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "endpoint_gateway_id": *removeEndpointGatewayIPOptions.EndpointGatewayID, - "id": *removeEndpointGatewayIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// UpdateEndpointGateway : Update an endpoint gateway -// This request updates an endpoint gateway's name. -func (vpc *VpcV1) UpdateEndpointGateway(updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - return vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) -} - -// UpdateEndpointGatewayWithContext is an alternate form of the UpdateEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateEndpointGatewayOptions, "updateEndpointGatewayOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateEndpointGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateEndpointGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateEndpointGatewayOptions.EndpointGatewayPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) - if err != nil { - return - } - response.Result = result - } - - return -} - -// CreateFlowLogCollector : Create a flow log collector -// This request creates and starts a new flow log collector from a flow log collector prototype object. The prototype -// object is structured in the same way as a retrieved flow log collector, and contains the information necessary to -// create and start the new flow log collector. -func (vpc *VpcV1) CreateFlowLogCollector(createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - return vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions) -} - -// CreateFlowLogCollectorWithContext is an alternate form of the CreateFlowLogCollector method which supports a Context parameter -func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createFlowLogCollectorOptions, "createFlowLogCollectorOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createFlowLogCollectorOptions, "createFlowLogCollectorOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) - if err != nil { - return - } - - for headerName, headerValue := range createFlowLogCollectorOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFlowLogCollector") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - body := make(map[string]interface{}) - if createFlowLogCollectorOptions.StorageBucket != nil { - body["storage_bucket"] = createFlowLogCollectorOptions.StorageBucket - } - if createFlowLogCollectorOptions.Target != nil { - body["target"] = createFlowLogCollectorOptions.Target - } - if createFlowLogCollectorOptions.Active != nil { - body["active"] = createFlowLogCollectorOptions.Active - } - if createFlowLogCollectorOptions.Name != nil { - body["name"] = createFlowLogCollectorOptions.Name - } - if createFlowLogCollectorOptions.ResourceGroup != nil { - body["resource_group"] = createFlowLogCollectorOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) - if err != nil { - return - } - response.Result = result - } - - return -} - -// DeleteFlowLogCollector : Delete a flow log collector -// This request stops and deletes a flow log collector. This operation cannot be reversed. -// -// Collected flow logs remain available within the flow log collector's Cloud Object Storage bucket. -func (vpc *VpcV1) DeleteFlowLogCollector(deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) -} - -// DeleteFlowLogCollectorWithContext is an alternate form of the DeleteFlowLogCollector method which supports a Context parameter -func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteFlowLogCollectorOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetFlowLogCollector : Retrieve a flow log collector -// This request retrieves a single flow log collector specified by the identifier in the URL. -func (vpc *VpcV1) GetFlowLogCollector(getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - return vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) -} - -// GetFlowLogCollectorWithContext is an alternate form of the GetFlowLogCollector method which supports a Context parameter -func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getFlowLogCollectorOptions, "getFlowLogCollectorOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *getFlowLogCollectorOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getFlowLogCollectorOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) - if err != nil { - return - } - response.Result = result - } - - return -} - -// ListFlowLogCollectors : List all flow log collectors -// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over the instance -// network interfaces and instance network attachments contained within its target. -func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { - return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) -} - -// ListFlowLogCollectorsWithContext is an alternate form of the ListFlowLogCollectors method which supports a Context parameter -func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listFlowLogCollectorsOptions, "listFlowLogCollectorsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listFlowLogCollectorsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listFlowLogCollectorsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listFlowLogCollectorsOptions.Start)) - } - if listFlowLogCollectorsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listFlowLogCollectorsOptions.Limit)) - } - if listFlowLogCollectorsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listFlowLogCollectorsOptions.ResourceGroupID)) - } - if listFlowLogCollectorsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listFlowLogCollectorsOptions.Name)) - } - if listFlowLogCollectorsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listFlowLogCollectorsOptions.VPCID)) - } - if listFlowLogCollectorsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listFlowLogCollectorsOptions.VPCCRN)) - } - if listFlowLogCollectorsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listFlowLogCollectorsOptions.VPCName)) - } - if listFlowLogCollectorsOptions.TargetID != nil { - builder.AddQuery("target.id", fmt.Sprint(*listFlowLogCollectorsOptions.TargetID)) - } - if listFlowLogCollectorsOptions.TargetResourceType != nil { - builder.AddQuery("target.resource_type", fmt.Sprint(*listFlowLogCollectorsOptions.TargetResourceType)) - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection) - if err != nil { - return - } - response.Result = result - } - - return -} - -// UpdateFlowLogCollector : Update a flow log collector -// This request updates a flow log collector with the information in a provided flow log collector patch. The flow log -// collector patch object is structured in the same way as a retrieved flow log collector and contains only the -// information to be updated. -func (vpc *VpcV1) UpdateFlowLogCollector(updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - return vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) -} - -// UpdateFlowLogCollectorWithContext is an alternate form of the UpdateFlowLogCollector method which supports a Context parameter -func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *updateFlowLogCollectorOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFlowLogCollector") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateFlowLogCollectorOptions.FlowLogCollectorPatch) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) - if err != nil { - return - } - response.Result = result - } - - return -} - -// AccountReference : AccountReference struct -type AccountReference struct { - // The unique identifier for this account. - ID *string `json:"id" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the AccountReference.ResourceType property. -// The resource type. -const ( - AccountReferenceResourceTypeAccountConst = "account" -) - -// UnmarshalAccountReference unmarshals an instance of AccountReference from the specified map of raw messages. -func UnmarshalAccountReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AccountReference) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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 -} - -// AddVPNGatewayConnectionLocalCIDROptions : The AddVPNGatewayConnectionLocalCIDR options. -type AddVPNGatewayConnectionLocalCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` - - // The address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewAddVPNGatewayConnectionLocalCIDROptions : Instantiate AddVPNGatewayConnectionLocalCIDROptions -func (*VpcV1) NewAddVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { - return &AddVPNGatewayConnectionLocalCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} - -// SetPrefixLength : Allow user to set PrefixLength -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *AddVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionLocalCIDROptions { - options.Headers = param - return options -} - -// AddVPNGatewayConnectionPeerCIDROptions : The AddVPNGatewayConnectionPeerCIDR options. -type AddVPNGatewayConnectionPeerCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` - - // The address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewAddVPNGatewayConnectionPeerCIDROptions : Instantiate AddVPNGatewayConnectionPeerCIDROptions -func (*VpcV1) NewAddVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { - return &AddVPNGatewayConnectionPeerCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetID(id string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} - -// SetPrefixLength : Allow user to set PrefixLength -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *AddVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionPeerCIDROptions { - options.Headers = param - return options -} - -// AddressPrefix : AddressPrefix struct -type AddressPrefix struct { - // The CIDR block for this prefix. - CIDR *string `json:"cidr" validate:"required"` - - // The date and time that the prefix was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // Indicates whether subnets exist with addresses from this prefix. - HasSubnets *bool `json:"has_subnets" validate:"required"` - - // The URL for this address prefix. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this address prefix. - ID *string `json:"id" validate:"required"` - - // Indicates whether this is the default prefix for this zone in this VPC. If a default prefix was automatically - // created when the VPC was created, the prefix is automatically named using a hyphenated list of randomly-selected - // words, but may be changed. - IsDefault *bool `json:"is_default" validate:"required"` - - // The name for this address prefix. The name must not be used by another address prefix for the VPC. - Name *string `json:"name" validate:"required"` - - // The zone this address prefix resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// UnmarshalAddressPrefix unmarshals an instance of AddressPrefix from the specified map of raw messages. -func UnmarshalAddressPrefix(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefix) - err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "has_subnets", &obj.HasSubnets) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AddressPrefixCollection : AddressPrefixCollection struct -type AddressPrefixCollection struct { - // Collection of address prefixes. - AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"` - - // A link to the first page of resources. - First *AddressPrefixCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *AddressPrefixCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalAddressPrefixCollection unmarshals an instance of AddressPrefixCollection from the specified map of raw messages. -func UnmarshalAddressPrefixCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefixCollection) - err = core.UnmarshalModel(m, "address_prefixes", &obj.AddressPrefixes, UnmarshalAddressPrefix) - if err != nil { - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalAddressPrefixCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalAddressPrefixCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *AddressPrefixCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// AddressPrefixCollectionFirst : A link to the first page of resources. -type AddressPrefixCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalAddressPrefixCollectionFirst unmarshals an instance of AddressPrefixCollectionFirst from the specified map of raw messages. -func UnmarshalAddressPrefixCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefixCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AddressPrefixCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type AddressPrefixCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalAddressPrefixCollectionNext unmarshals an instance of AddressPrefixCollectionNext from the specified map of raw messages. -func UnmarshalAddressPrefixCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefixCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AddressPrefixPatch : AddressPrefixPatch struct -type AddressPrefixPatch struct { - // Indicates whether this is the default prefix for this zone in this VPC. Updating to true makes this prefix the - // default prefix for this zone in this VPC, provided the VPC currently has no default address prefix for this zone. - // Updating to false removes the default prefix for this zone in this VPC. - IsDefault *bool `json:"is_default,omitempty"` - - // The name for this address prefix. The name must not be used by another address prefix for the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalAddressPrefixPatch unmarshals an instance of AddressPrefixPatch from the specified map of raw messages. -func UnmarshalAddressPrefixPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefixPatch) - err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the AddressPrefixPatch -func (addressPrefixPatch *AddressPrefixPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(addressPrefixPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// BackupPolicy : BackupPolicy struct -type BackupPolicy struct { - // The date and time that the backup policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this backup policy. - CRN *string `json:"crn" validate:"required"` - - // The reasons for the current `health_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - HealthReasons []BackupPolicyHealthReason `json:"health_reasons" validate:"required"` - - // The health of this resource. - // - `ok`: No abnormal behavior detected - // - `degraded`: Experiencing compromised performance, capacity, or connectivity - // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated - // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a - // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also - // have this state. - HealthState *string `json:"health_state" validate:"required"` - - // The URL for this backup policy. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this backup policy. - ID *string `json:"id" validate:"required"` - - // The date and time that the most recent job for this backup policy completed. - // - // If absent, no job has yet completed for this backup policy. - LastJobCompletedAt *strfmt.DateTime `json:"last_job_completed_at,omitempty"` - - // The lifecycle state of the backup policy. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The resource types this backup policy applies to. Resources that have both a matching type and a matching user tag - // will be subject to the backup policy. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. - MatchResourceTypes []string `json:"match_resource_types" validate:"required"` - - // The 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"` -} - -// 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.MatchResourceTypes property. -// The resource type. -const ( - BackupPolicyMatchResourceTypesVolumeConst = "volume" -) - -// Constants associated with the BackupPolicy.ResourceType property. -// The resource type. -const ( - BackupPolicyResourceTypeBackupPolicyConst = "backup_policy" -) - -// UnmarshalBackupPolicy unmarshals an instance of BackupPolicy from the specified map of raw messages. -func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicy) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBackupPolicyHealthReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "match_resource_types", &obj.MatchResourceTypes) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScope) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyCollection : BackupPolicyCollection struct -type BackupPolicyCollection struct { - // Collection of backup policies. - BackupPolicies []BackupPolicy `json:"backup_policies" validate:"required"` - - // A link to the first page of resources. - First *BackupPolicyCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *BackupPolicyCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalBackupPolicyCollection unmarshals an instance of BackupPolicyCollection from the specified map of raw messages. -func UnmarshalBackupPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyCollection) - err = core.UnmarshalModel(m, "backup_policies", &obj.BackupPolicies, UnmarshalBackupPolicy) - if err != nil { - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *BackupPolicyCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// BackupPolicyCollectionFirst : A link to the first page of resources. -type BackupPolicyCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBackupPolicyCollectionFirst unmarshals an instance of BackupPolicyCollectionFirst from the specified map of raw messages. -func UnmarshalBackupPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BackupPolicyCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBackupPolicyCollectionNext unmarshals an instance of BackupPolicyCollectionNext from the specified map of raw messages. -func UnmarshalBackupPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyHealthReason : BackupPolicyHealthReason struct -type BackupPolicyHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this health state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the BackupPolicyHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. -const ( - BackupPolicyHealthReasonCodeMissingServiceAuthorizationPoliciesConst = "missing_service_authorization_policies" -) - -// UnmarshalBackupPolicyHealthReason unmarshals an instance of BackupPolicyHealthReason from the specified map of raw messages. -func UnmarshalBackupPolicyHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyHealthReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyJob : BackupPolicyJob struct -type BackupPolicyJob struct { - // Indicates whether this backup policy job will be automatically deleted after it completes. At present, this is - // always `true`, but may be modifiable in the future. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // If `auto_delete` is `true`, the days after completion that this backup policy job will be deleted. This value may be - // modifiable in the future. - AutoDeleteAfter *int64 `json:"auto_delete_after" validate:"required"` - - // The backup policy plan operated this backup policy job (may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan" validate:"required"` - - // The date and time that the backup policy job was completed. - // - // If absent, the backup policy job has not yet completed. - CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` - - // The date and time that the backup policy job was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this backup policy job. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this backup policy job. - ID *string `json:"id" validate:"required"` - - // The type of backup policy job. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the - // unexpected property value was encountered. - JobType *string `json:"job_type" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The source this backup was created from (may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - Source BackupPolicyJobSourceIntf `json:"source" validate:"required"` - - // The status of the backup policy job. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the - // unexpected property value was encountered. - Status *string `json:"status" validate:"required"` - - // The reasons for the current status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []BackupPolicyJobStatusReason `json:"status_reasons" validate:"required"` - - // The snapshots operated on by this backup policy job (may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - TargetSnapshots []SnapshotReference `json:"target_snapshots" validate:"required"` -} - -// Constants associated with the BackupPolicyJob.JobType property. -// The type of backup policy job. -// -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the -// unexpected property value was encountered. -const ( - BackupPolicyJobJobTypeCreationConst = "creation" - BackupPolicyJobJobTypeDeletionConst = "deletion" -) - -// Constants associated with the BackupPolicyJob.ResourceType property. -// The resource type. -const ( - BackupPolicyJobResourceTypeBackupPolicyJobConst = "backup_policy_job" -) - -// Constants associated with the BackupPolicyJob.Status property. -// The status of the backup policy job. -// -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the -// unexpected property value was encountered. -const ( - BackupPolicyJobStatusFailedConst = "failed" - BackupPolicyJobStatusRunningConst = "running" - BackupPolicyJobStatusSucceededConst = "succeeded" -) - -// UnmarshalBackupPolicyJob unmarshals an instance of BackupPolicyJob from the specified map of raw messages. -func UnmarshalBackupPolicyJob(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJob) - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete_after", &obj.AutoDeleteAfter) - if err != nil { - return - } - err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "job_type", &obj.JobType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalBackupPolicyJobSource) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBackupPolicyJobStatusReason) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target_snapshots", &obj.TargetSnapshots, UnmarshalSnapshotReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyJobCollection : BackupPolicyJobCollection struct -type BackupPolicyJobCollection struct { - // A link to the first page of resources. - First *BackupPolicyJobCollectionFirst `json:"first" validate:"required"` - - // Collection of backup policy jobs. - Jobs []BackupPolicyJob `json:"jobs" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *BackupPolicyJobCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalBackupPolicyJobCollection unmarshals an instance of BackupPolicyJobCollection from the specified map of raw messages. -func UnmarshalBackupPolicyJobCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyJobCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "jobs", &obj.Jobs, UnmarshalBackupPolicyJob) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyJobCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *BackupPolicyJobCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// BackupPolicyJobCollectionFirst : A link to the first page of resources. -type BackupPolicyJobCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBackupPolicyJobCollectionFirst unmarshals an instance of BackupPolicyJobCollectionFirst from the specified map of raw messages. -func UnmarshalBackupPolicyJobCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyJobCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BackupPolicyJobCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBackupPolicyJobCollectionNext unmarshals an instance of BackupPolicyJobCollectionNext from the specified map of raw messages. -func UnmarshalBackupPolicyJobCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyJobSource : The source this backup was created from (may be -// [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). -// Models which "extend" this model: -// - BackupPolicyJobSourceVolumeReference -type BackupPolicyJobSource struct { - // The CRN for this volume. - CRN *string `json:"crn,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this volume. - Href *string `json:"href,omitempty"` - - // The unique identifier for this volume. - ID *string `json:"id,omitempty"` - - // The name for this volume. The name is unique across all volumes in the region. - Name *string `json:"name,omitempty"` - - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *VolumeRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the BackupPolicyJobSource.ResourceType property. -// The resource type. -const ( - BackupPolicyJobSourceResourceTypeVolumeConst = "volume" -) - -func (*BackupPolicyJobSource) isaBackupPolicyJobSource() bool { - return true -} - -type BackupPolicyJobSourceIntf interface { - isaBackupPolicyJobSource() bool -} - -// UnmarshalBackupPolicyJobSource unmarshals an instance of BackupPolicyJobSource from the specified map of raw messages. -func UnmarshalBackupPolicyJobSource(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobSource) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyJobStatusReason : BackupPolicyJobStatusReason struct -type BackupPolicyJobStatusReason struct { - // A snake case string succinctly identifying the status reason: - // - `internal_error`: Internal error (contact IBM support) - // - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state - // - `snapshot_volume_limit`: The snapshot limit for the source volume has been reached - // - `source_volume_busy`: The source volume has `busy` set (after multiple retries). - Code *string `json:"code" validate:"required"` - - // An explanation of the status reason. - Message *string `json:"message" validate:"required"` - - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the BackupPolicyJobStatusReason.Code property. -// A snake case string succinctly identifying the status reason: -// - `internal_error`: Internal error (contact IBM support) -// - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state -// - `snapshot_volume_limit`: The snapshot limit for the source volume has been reached -// - `source_volume_busy`: The source volume has `busy` set (after multiple retries). -const ( - BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" - BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" - BackupPolicyJobStatusReasonCodeSnapshotVolumeLimitConst = "snapshot_volume_limit" - BackupPolicyJobStatusReasonCodeSourceVolumeBusyConst = "source_volume_busy" -) - -// UnmarshalBackupPolicyJobStatusReason unmarshals an instance of BackupPolicyJobStatusReason from the specified map of raw messages. -func UnmarshalBackupPolicyJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobStatusReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPatch : BackupPolicyPatch struct -type BackupPolicyPatch struct { - // The user tags this backup policy will apply to (replacing any existing tags). Resources that have both a matching - // user tag and a matching type will be subject to the backup policy. - MatchUserTags []string `json:"match_user_tags,omitempty"` - - // The name for this backup policy. The name must not be used by another backup policy in the region. - Name *string `json:"name,omitempty"` -} - -// UnmarshalBackupPolicyPatch unmarshals an instance of BackupPolicyPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPatch) - err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the BackupPolicyPatch -func (backupPolicyPatch *BackupPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(backupPolicyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// BackupPolicyPlan : BackupPolicyPlan struct -type BackupPolicyPlan struct { - // Indicates whether the plan is active. - Active *bool `json:"active" validate:"required"` - - // The user tags to attach to backups (snapshots) created by this plan. - AttachUserTags []string `json:"attach_user_tags" validate:"required"` - - ClonePolicy *BackupPolicyPlanClonePolicy `json:"clone_policy" validate:"required"` - - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags" validate:"required"` - - // The date and time that the backup policy plan was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The cron specification for the backup schedule. The backup policy jobs - // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes - // after this time. - // - // All backup schedules for plans in the same policy must be at least an hour apart. - CronSpec *string `json:"cron_spec" validate:"required"` - - DeletionTrigger *BackupPolicyPlanDeletionTrigger `json:"deletion_trigger" validate:"required"` - - // The URL for this backup policy plan. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this backup policy plan. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of this backup policy plan. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this backup policy plan. The name is unique across all plans in the backup policy. - Name *string `json:"name" validate:"required"` - - // The policies for additional backups in remote regions. - RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicy `json:"remote_region_policies" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the BackupPolicyPlan.LifecycleState property. -// The lifecycle state of this backup policy plan. -const ( - BackupPolicyPlanLifecycleStateDeletingConst = "deleting" - BackupPolicyPlanLifecycleStateFailedConst = "failed" - BackupPolicyPlanLifecycleStatePendingConst = "pending" - BackupPolicyPlanLifecycleStateStableConst = "stable" - BackupPolicyPlanLifecycleStateSuspendedConst = "suspended" - BackupPolicyPlanLifecycleStateUpdatingConst = "updating" - BackupPolicyPlanLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the BackupPolicyPlan.ResourceType property. -// The resource type. -const ( - BackupPolicyPlanResourceTypeBackupPolicyPlanConst = "backup_policy_plan" -) - -// UnmarshalBackupPolicyPlan unmarshals an instance of BackupPolicyPlan from the specified map of raw messages. -func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlan) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicy) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTrigger) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicy) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanClonePolicy : BackupPolicyPlanClonePolicy struct -type BackupPolicyPlanClonePolicy struct { - // The maximum number of recent snapshots (per source) that will keep clones. - MaxSnapshots *int64 `json:"max_snapshots" validate:"required"` - - // The zone this backup policy plan will create snapshot clones in. - Zones []ZoneReference `json:"zones" validate:"required"` -} - -// UnmarshalBackupPolicyPlanClonePolicy unmarshals an instance of BackupPolicyPlanClonePolicy from the specified map of raw messages. -func UnmarshalBackupPolicyPlanClonePolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanClonePolicy) - err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanClonePolicyPatch : BackupPolicyPlanClonePolicyPatch struct -type BackupPolicyPlanClonePolicyPatch struct { - // The maximum number of recent snapshots (per source) that will keep clones. - MaxSnapshots *int64 `json:"max_snapshots,omitempty"` - - // The zones this backup policy plan will create snapshot clones in. Updating this value does not change the clones for - // snapshots that have already been created by this plan. - Zones []ZoneIdentityIntf `json:"zones,omitempty"` -} - -// UnmarshalBackupPolicyPlanClonePolicyPatch unmarshals an instance of BackupPolicyPlanClonePolicyPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPlanClonePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanClonePolicyPatch) - err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanClonePolicyPrototype : BackupPolicyPlanClonePolicyPrototype struct -type BackupPolicyPlanClonePolicyPrototype struct { - // The maximum number of recent snapshots (per source) that will keep clones. - MaxSnapshots *int64 `json:"max_snapshots,omitempty"` - - // The zone this backup policy plan will create snapshot clones in. - Zones []ZoneIdentityIntf `json:"zones" validate:"required"` -} - -// NewBackupPolicyPlanClonePolicyPrototype : Instantiate BackupPolicyPlanClonePolicyPrototype (Generic Model Constructor) -func (*VpcV1) NewBackupPolicyPlanClonePolicyPrototype(zones []ZoneIdentityIntf) (_model *BackupPolicyPlanClonePolicyPrototype, err error) { - _model = &BackupPolicyPlanClonePolicyPrototype{ - Zones: zones, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalBackupPolicyPlanClonePolicyPrototype unmarshals an instance of BackupPolicyPlanClonePolicyPrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPlanClonePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanClonePolicyPrototype) - err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanCollection : BackupPolicyPlanCollection struct -type BackupPolicyPlanCollection struct { - // Collection of backup policy plans. - Plans []BackupPolicyPlan `json:"plans" validate:"required"` -} - -// UnmarshalBackupPolicyPlanCollection unmarshals an instance of BackupPolicyPlanCollection from the specified map of raw messages. -func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanCollection) - err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanDeletionTrigger : BackupPolicyPlanDeletionTrigger struct -type BackupPolicyPlanDeletionTrigger struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after" validate:"required"` - - // The maximum number of recent backups to keep. If absent, there is no maximum. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` -} - -// UnmarshalBackupPolicyPlanDeletionTrigger unmarshals an instance of BackupPolicyPlanDeletionTrigger from the specified map of raw messages. -func UnmarshalBackupPolicyPlanDeletionTrigger(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanDeletionTrigger) - err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanDeletionTriggerPatch : BackupPolicyPlanDeletionTriggerPatch struct -type BackupPolicyPlanDeletionTriggerPatch struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after,omitempty"` - - // The maximum number of recent backups to keep. Specify `null` to remove any existing maximum. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` -} - -// UnmarshalBackupPolicyPlanDeletionTriggerPatch unmarshals an instance of BackupPolicyPlanDeletionTriggerPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPlanDeletionTriggerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanDeletionTriggerPatch) - err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanDeletionTriggerPrototype : BackupPolicyPlanDeletionTriggerPrototype struct -type BackupPolicyPlanDeletionTriggerPrototype struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after,omitempty"` - - // The maximum number of recent backups to keep. If unspecified, there will be no maximum. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` -} - -// UnmarshalBackupPolicyPlanDeletionTriggerPrototype unmarshals an instance of BackupPolicyPlanDeletionTriggerPrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPlanDeletionTriggerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanDeletionTriggerPrototype) - err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanPatch : BackupPolicyPlanPatch struct -type BackupPolicyPlanPatch struct { - // Indicates whether the plan is active. - Active *bool `json:"active,omitempty"` - - // The user tags to attach to backups (snapshots) created by this plan. Updating this value does not change the user - // tags for backups that have already been created by this plan. - AttachUserTags []string `json:"attach_user_tags,omitempty"` - - ClonePolicy *BackupPolicyPlanClonePolicyPatch `json:"clone_policy,omitempty"` - - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags,omitempty"` - - // The cron specification for the backup schedule. The backup policy jobs - // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes - // after this time. - // - // All backup schedules for plans in the same policy must be at least an hour apart. - CronSpec *string `json:"cron_spec,omitempty"` - - DeletionTrigger *BackupPolicyPlanDeletionTriggerPatch `json:"deletion_trigger,omitempty"` - - // The name for this backup policy plan. The name must not be used by another plan for the backup policy. - Name *string `json:"name,omitempty"` - - // The policies for additional backups in remote regions (replacing any existing policies). - RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` -} - -// UnmarshalBackupPolicyPlanPatch unmarshals an instance of BackupPolicyPlanPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanPatch) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the BackupPolicyPlanPatch -func (backupPolicyPlanPatch *BackupPolicyPlanPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(backupPolicyPlanPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// BackupPolicyPlanPrototype : BackupPolicyPlanPrototype struct -type BackupPolicyPlanPrototype struct { - // Indicates whether the plan is active. - Active *bool `json:"active,omitempty"` - - // User tags to attach to each backup (snapshot) created by this plan. If unspecified, no user tags will be attached. - AttachUserTags []string `json:"attach_user_tags,omitempty"` - - ClonePolicy *BackupPolicyPlanClonePolicyPrototype `json:"clone_policy,omitempty"` - - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags,omitempty"` - - // The cron specification for the backup schedule. The backup policy jobs - // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes - // after this time. - // - // All backup schedules for plans in the same policy must be at least an hour apart. - CronSpec *string `json:"cron_spec" validate:"required"` - - DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` - - // The name for this backup policy plan. The name must not be used by another plan for the backup policy. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The policies for additional backups in remote regions. - RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` -} - -// NewBackupPolicyPlanPrototype : Instantiate BackupPolicyPlanPrototype (Generic Model Constructor) -func (*VpcV1) NewBackupPolicyPlanPrototype(cronSpec string) (_model *BackupPolicyPlanPrototype, err error) { - _model = &BackupPolicyPlanPrototype{ - CronSpec: core.StringPtr(cronSpec), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalBackupPolicyPlanPrototype unmarshals an instance of BackupPolicyPlanPrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanPrototype) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanReference : BackupPolicyPlanReference struct -type BackupPolicyPlanReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BackupPolicyPlanReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this backup policy plan. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this backup policy plan. - ID *string `json:"id" validate:"required"` - - // The name for this backup policy plan. The name is unique across all plans in the backup policy. - Name *string `json:"name" validate:"required"` - - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *BackupPolicyPlanRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the BackupPolicyPlanReference.ResourceType property. -// The resource type. -const ( - BackupPolicyPlanReferenceResourceTypeBackupPolicyPlanConst = "backup_policy_plan" -) - -// UnmarshalBackupPolicyPlanReference unmarshals an instance of BackupPolicyPlanReference from the specified map of raw messages. -func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBackupPolicyPlanReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalBackupPolicyPlanRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BackupPolicyPlanReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBackupPolicyPlanReferenceDeleted unmarshals an instance of BackupPolicyPlanReferenceDeleted from the specified map of raw messages. -func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type BackupPolicyPlanRemote struct { - // If present, this property indicates that the referenced resource is remote to this - // region, and identifies the native region. - Region *RegionReference `json:"region,omitempty"` -} - -// UnmarshalBackupPolicyPlanRemote unmarshals an instance of BackupPolicyPlanRemote from the specified map of raw messages. -func UnmarshalBackupPolicyPlanRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanRemote) - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanRemoteRegionPolicy : BackupPolicyPlanRemoteRegionPolicy struct -type BackupPolicyPlanRemoteRegionPolicy struct { - // The region this backup policy plan will create backups in. - DeleteOverCount *int64 `json:"delete_over_count" validate:"required"` - - // The root key used to rewrap the data encryption key for the backup (snapshot). - EncryptionKey *EncryptionKeyReference `json:"encryption_key" validate:"required"` - - // The region this backup policy plan will create backups in. - Region *RegionReference `json:"region" validate:"required"` -} - -// UnmarshalBackupPolicyPlanRemoteRegionPolicy unmarshals an instance of BackupPolicyPlanRemoteRegionPolicy from the specified map of raw messages. -func UnmarshalBackupPolicyPlanRemoteRegionPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanRemoteRegionPolicy) - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanRemoteRegionPolicyPrototype : BackupPolicyPlanRemoteRegionPolicyPrototype struct -type BackupPolicyPlanRemoteRegionPolicyPrototype struct { - // The region this backup policy plan will create backups in. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` - - // The root key to use to rewrap the data encryption key for the backup (snapshot). - // - // If unspecified, the source's `encryption_key` will be used. - // The specified key may be in a different account, subject to IAM policies. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The region this backup policy plan will create backups in. - Region RegionIdentityIntf `json:"region" validate:"required"` -} - -// NewBackupPolicyPlanRemoteRegionPolicyPrototype : Instantiate BackupPolicyPlanRemoteRegionPolicyPrototype (Generic Model Constructor) -func (*VpcV1) NewBackupPolicyPlanRemoteRegionPolicyPrototype(region RegionIdentityIntf) (_model *BackupPolicyPlanRemoteRegionPolicyPrototype, err error) { - _model = &BackupPolicyPlanRemoteRegionPolicyPrototype{ - Region: region, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype unmarshals an instance of BackupPolicyPlanRemoteRegionPolicyPrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanRemoteRegionPolicyPrototype) - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyScope : The scope for this backup policy. -// Models which "extend" this model: -// - BackupPolicyScopeEnterpriseReference -// - BackupPolicyScopeAccountReference -type BackupPolicyScope struct { - // The CRN for this enterprise. - CRN *string `json:"crn,omitempty"` - - // The unique identifier for this enterprise. - ID *string `json:"id,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the BackupPolicyScope.ResourceType property. -// The resource type. -const ( - BackupPolicyScopeResourceTypeEnterpriseConst = "enterprise" -) - -func (*BackupPolicyScope) isaBackupPolicyScope() bool { - return true -} - -type BackupPolicyScopeIntf interface { - isaBackupPolicyScope() bool -} - -// UnmarshalBackupPolicyScope unmarshals an instance of BackupPolicyScope from the specified map of raw messages. -func UnmarshalBackupPolicyScope(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyScope) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyScopePrototype : The scope to use for this backup policy. -// -// If unspecified, the policy will be scoped to the account. -// Models which "extend" this model: -// - BackupPolicyScopePrototypeEnterpriseIdentity -type BackupPolicyScopePrototype struct { - // The CRN for this enterprise. - CRN *string `json:"crn,omitempty"` -} - -func (*BackupPolicyScopePrototype) isaBackupPolicyScopePrototype() bool { - return true -} - -type BackupPolicyScopePrototypeIntf interface { - isaBackupPolicyScopePrototype() bool -} - -// UnmarshalBackupPolicyScopePrototype unmarshals an instance of BackupPolicyScopePrototype from the specified map of raw messages. -func UnmarshalBackupPolicyScopePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyScopePrototype) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServer : BareMetalServer struct -type BareMetalServer struct { - // The total bandwidth (in megabits per second) shared across the bare metal server network attachments or bare metal - // server network interfaces. - Bandwidth *int64 `json:"bandwidth" validate:"required"` - - // The possible resource types for this property are expected to expand in the future. - BootTarget BareMetalServerBootTargetIntf `json:"boot_target" validate:"required"` - - // The bare metal server CPU configuration. - Cpu *BareMetalServerCpu `json:"cpu" validate:"required"` - - // The date and time that the bare metal server was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this bare metal server. - CRN *string `json:"crn" validate:"required"` - - // The disks for this bare metal server, including any disks that are associated with the - // `boot_target`. - Disks []BareMetalServerDisk `json:"disks" validate:"required"` - - // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to - // boot. - EnableSecureBoot *bool `json:"enable_secure_boot" validate:"required"` - - // The URL for this bare metal server. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server. - ID *string `json:"id" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - LifecycleReasons []BareMetalServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the bare metal server. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The amount of memory, truncated to whole gibibytes. - Memory *int64 `json:"memory" validate:"required"` - - // The name for this bare metal server. The name is unique across all bare metal servers in the region. - Name *string `json:"name" validate:"required"` - - // The network attachments for this bare metal server, including the primary network attachment. - NetworkAttachments []BareMetalServerNetworkAttachmentReference `json:"network_attachments,omitempty"` - - // The network interfaces for this bare metal server, including the primary network interface. - 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. - PrimaryNetworkInterface *NetworkInterfaceBareMetalServerContextReference `json:"primary_network_interface" validate:"required"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) - // for this bare metal server. - Profile *BareMetalServerProfileReference `json:"profile" validate:"required"` - - // The resource group for this bare metal server. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the bare metal server. - Status *string `json:"status" validate:"required"` - - // The reasons for the current status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []BareMetalServerStatusReason `json:"status_reasons" validate:"required"` - - TrustedPlatformModule *BareMetalServerTrustedPlatformModule `json:"trusted_platform_module" validate:"required"` - - // The VPC this bare metal server resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // The zone this bare metal server resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the BareMetalServer.LifecycleState property. -// The lifecycle state of the bare metal server. -const ( - BareMetalServerLifecycleStateDeletingConst = "deleting" - BareMetalServerLifecycleStateFailedConst = "failed" - BareMetalServerLifecycleStatePendingConst = "pending" - BareMetalServerLifecycleStateStableConst = "stable" - BareMetalServerLifecycleStateSuspendedConst = "suspended" - BareMetalServerLifecycleStateUpdatingConst = "updating" - BareMetalServerLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the BareMetalServer.ResourceType property. -// The resource type. -const ( - BareMetalServerResourceTypeBareMetalServerConst = "bare_metal_server" -) - -// Constants associated with the BareMetalServer.Status property. -// The status of the bare metal server. -const ( - BareMetalServerStatusDeletingConst = "deleting" - BareMetalServerStatusFailedConst = "failed" - BareMetalServerStatusMaintenanceConst = "maintenance" - BareMetalServerStatusPendingConst = "pending" - BareMetalServerStatusRestartingConst = "restarting" - BareMetalServerStatusRunningConst = "running" - BareMetalServerStatusStartingConst = "starting" - BareMetalServerStatusStoppedConst = "stopped" - BareMetalServerStatusStoppingConst = "stopping" -) - -// UnmarshalBareMetalServer unmarshals an instance of BareMetalServer from the specified map of raw messages. -func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServer) - err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_target", &obj.BootTarget, UnmarshalBareMetalServerBootTarget) - if err != nil { - return - } - err = core.UnmarshalModel(m, "cpu", &obj.Cpu, UnmarshalBareMetalServerCpu) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalBareMetalServerLifecycleReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerNetworkAttachmentReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceBareMetalServerContextReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBareMetalServerStatusReason) - if err != nil { - return - } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModule) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerBootTarget : The possible resource types for this property are expected to expand in the future. -// Models which "extend" this model: -// - BareMetalServerBootTargetBareMetalServerDiskReference -type BareMetalServerBootTarget struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this bare metal server disk. - Href *string `json:"href,omitempty"` - - // The unique identifier for this bare metal server disk. - ID *string `json:"id,omitempty"` - - // The name for this bare metal server disk. The name is unique across all disks on the bare metal server. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the BareMetalServerBootTarget.ResourceType property. -// The resource type. -const ( - BareMetalServerBootTargetResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" -) - -func (*BareMetalServerBootTarget) isaBareMetalServerBootTarget() bool { - return true -} - -type BareMetalServerBootTargetIntf interface { - isaBareMetalServerBootTarget() bool -} - -// UnmarshalBareMetalServerBootTarget unmarshals an instance of BareMetalServerBootTarget from the specified map of raw messages. -func UnmarshalBareMetalServerBootTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerBootTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerCpu : The bare metal server CPU configuration. -type BareMetalServerCpu struct { - // The CPU architecture. - Architecture *string `json:"architecture" validate:"required"` - - // The total number of cores. - CoreCount *int64 `json:"core_count" validate:"required"` - - // The total number of CPU sockets. - SocketCount *int64 `json:"socket_count" validate:"required"` - - // The total number of hardware threads per core. - ThreadsPerCore *int64 `json:"threads_per_core" validate:"required"` -} - -// UnmarshalBareMetalServerCpu unmarshals an instance of BareMetalServerCpu from the specified map of raw messages. -func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerCpu) - err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "core_count", &obj.CoreCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "threads_per_core", &obj.ThreadsPerCore) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerCollection : BareMetalServerCollection struct -type BareMetalServerCollection struct { - // Collection of bare metal servers. - BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` - - // A link to the first page of resources. - First *BareMetalServerCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *BareMetalServerCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalBareMetalServerCollection unmarshals an instance of BareMetalServerCollection from the specified map of raw messages. -func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerCollection) - err = core.UnmarshalModel(m, "bare_metal_servers", &obj.BareMetalServers, UnmarshalBareMetalServer) - if err != nil { - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *BareMetalServerCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// BareMetalServerCollectionFirst : A link to the first page of resources. -type BareMetalServerCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBareMetalServerCollectionFirst unmarshals an instance of BareMetalServerCollectionFirst from the specified map of raw messages. -func UnmarshalBareMetalServerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBareMetalServerCollectionNext unmarshals an instance of BareMetalServerCollectionNext from the specified map of raw messages. -func UnmarshalBareMetalServerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerConsoleAccessToken : The bare metal server console access token information. -type BareMetalServerConsoleAccessToken struct { - // A URL safe single-use token used to access the console WebSocket. - AccessToken *string `json:"access_token" validate:"required"` - - // The bare metal server console type for which this token may be used. - ConsoleType *string `json:"console_type" validate:"required"` - - // The date and time that the access token was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The date and time that the access token will expire. - ExpiresAt *strfmt.DateTime `json:"expires_at" validate:"required"` - - // Indicates whether to disconnect an existing serial console session as the serial console cannot be shared. This has - // no effect on VNC consoles. - Force *bool `json:"force" validate:"required"` - - // The URL to access this bare metal server console. - Href *string `json:"href" validate:"required"` -} - -// Constants associated with the BareMetalServerConsoleAccessToken.ConsoleType property. -// The bare metal server console type for which this token may be used. -const ( - BareMetalServerConsoleAccessTokenConsoleTypeSerialConst = "serial" - BareMetalServerConsoleAccessTokenConsoleTypeVncConst = "vnc" -) - -// UnmarshalBareMetalServerConsoleAccessToken unmarshals an instance of BareMetalServerConsoleAccessToken from the specified map of raw messages. -func UnmarshalBareMetalServerConsoleAccessToken(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerConsoleAccessToken) - err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "force", &obj.Force) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerDisk : BareMetalServerDisk struct -type BareMetalServerDisk struct { - // The date and time that the disk was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this bare metal server disk. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server disk. - ID *string `json:"id" validate:"required"` - - // The disk interface used for attaching the disk. - // - // - `fcp`: Attached using Fiber Channel Protocol - // - `sata`: Attached using Serial Advanced Technology Attachment - // - `nvme`: Attached using Non-Volatile Memory Express - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The name for this bare metal server disk. The name is unique across all disks on the bare metal server. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The size of the disk in GB (gigabytes). - Size *int64 `json:"size" validate:"required"` -} - -// Constants associated with the BareMetalServerDisk.InterfaceType property. -// The disk interface used for attaching the disk. -// -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using Non-Volatile Memory Express -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - BareMetalServerDiskInterfaceTypeFcpConst = "fcp" - BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" - BareMetalServerDiskInterfaceTypeSataConst = "sata" -) - -// Constants associated with the BareMetalServerDisk.ResourceType property. -// The resource type. -const ( - BareMetalServerDiskResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" -) - -// UnmarshalBareMetalServerDisk unmarshals an instance of BareMetalServerDisk from the specified map of raw messages. -func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDisk) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerDiskCollection : BareMetalServerDiskCollection struct -type BareMetalServerDiskCollection struct { - // Collection of the bare metal server's disks. - Disks []BareMetalServerDisk `json:"disks" validate:"required"` -} - -// UnmarshalBareMetalServerDiskCollection unmarshals an instance of BareMetalServerDiskCollection from the specified map of raw messages. -func UnmarshalBareMetalServerDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDiskCollection) - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerDiskPatch : BareMetalServerDiskPatch struct -type BareMetalServerDiskPatch struct { - // The name for this bare metal server disk. The name must not be used by another disk on the bare metal server. - Name *string `json:"name,omitempty"` -} - -// UnmarshalBareMetalServerDiskPatch unmarshals an instance of BareMetalServerDiskPatch from the specified map of raw messages. -func UnmarshalBareMetalServerDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDiskPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the BareMetalServerDiskPatch -func (bareMetalServerDiskPatch *BareMetalServerDiskPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(bareMetalServerDiskPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// BareMetalServerDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerDiskReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerDiskReferenceDeleted unmarshals an instance of BareMetalServerDiskReferenceDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDiskReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerInitialization : BareMetalServerInitialization struct -type BareMetalServerInitialization struct { - // The image the bare metal server was provisioned from. - Image *ImageReference `json:"image" validate:"required"` - - // The public SSH keys used at initialization. - Keys []KeyReference `json:"keys" validate:"required"` - - // The user accounts that are created at initialization. There can be multiple account types distinguished by the - // `resource_type` property. - UserAccounts []BareMetalServerInitializationUserAccountIntf `json:"user_accounts" validate:"required"` -} - -// UnmarshalBareMetalServerInitialization unmarshals an instance of BareMetalServerInitialization from the specified map of raw messages. -func UnmarshalBareMetalServerInitialization(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerInitialization) - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerInitializationPrototype : BareMetalServerInitializationPrototype struct -type BareMetalServerInitializationPrototype struct { - // The image to be used when provisioning the bare metal server. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The public SSH keys to install on the bare metal server. Keys will be made available to the bare metal server as - // cloud-init vendor data. For cloud-init enabled images, these keys will also be added as SSH authorized keys for the - // administrative user. - // - // For Windows images, at least one key must be specified, and one will be selected to encrypt the administrator - // password. Keys are optional for other images, but if no keys are specified, the instance will be inaccessible unless - // the specified image provides another means of access. - Keys []KeyIdentityIntf `json:"keys" validate:"required"` - - // User data to be made available when initializing the bare metal server. - UserData *string `json:"user_data,omitempty"` -} - -// NewBareMetalServerInitializationPrototype : Instantiate BareMetalServerInitializationPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerInitializationPrototype(image ImageIdentityIntf, keys []KeyIdentityIntf) (_model *BareMetalServerInitializationPrototype, err error) { - _model = &BareMetalServerInitializationPrototype{ - Image: image, - Keys: keys, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalBareMetalServerInitializationPrototype unmarshals an instance of BareMetalServerInitializationPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerInitializationPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerInitializationPrototype) - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerInitializationUserAccount : BareMetalServerInitializationUserAccount struct -// Models which "extend" this model: -// - BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount -type BareMetalServerInitializationUserAccount struct { - // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. - EncryptedPassword *[]byte `json:"encrypted_password,omitempty"` - - // The public SSH key used to encrypt the password. - EncryptionKey *KeyReference `json:"encryption_key,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` - - // The username for the account created at initialization. - Username *string `json:"username,omitempty"` -} - -// Constants associated with the BareMetalServerInitializationUserAccount.ResourceType property. -// The resource type. -const ( - BareMetalServerInitializationUserAccountResourceTypeHostUserAccountConst = "host_user_account" -) - -func (*BareMetalServerInitializationUserAccount) isaBareMetalServerInitializationUserAccount() bool { - return true -} - -type BareMetalServerInitializationUserAccountIntf interface { - isaBareMetalServerInitializationUserAccount() bool -} - -// UnmarshalBareMetalServerInitializationUserAccount unmarshals an instance of BareMetalServerInitializationUserAccount from the specified map of raw messages. -func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerInitializationUserAccount) - err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "username", &obj.Username) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerLifecycleReason : BareMetalServerLifecycleReason struct -type BareMetalServerLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this lifecycle state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this lifecycle state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the BareMetalServerLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. -const ( - BareMetalServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalBareMetalServerLifecycleReason unmarshals an instance of BareMetalServerLifecycleReason from the specified map of raw messages. -func UnmarshalBareMetalServerLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerLifecycleReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachment : BareMetalServerNetworkAttachment struct -// Models which "extend" this model: -// - BareMetalServerNetworkAttachmentByPci -// - BareMetalServerNetworkAttachmentByVlan -type BareMetalServerNetworkAttachment struct { - // The date and time that the bare metal server network attachment was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this bare metal server network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network attachment. - ID *string `json:"id" validate:"required"` - - // The network attachment's interface type: - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI attachment - // - Cannot directly use an IEEE 802.1q VLAN tag. - // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its - // array of `allowed_vlans`. - // - Must use an IEEE 802.1q tag. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The lifecycle state of the bare metal server network attachment. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this bare metal server network attachment. The name is unique across all network attachments for the - // bare metal server. - Name *string `json:"name" validate:"required"` - - // The port speed for this bare metal server network attachment in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - // The primary IP address of the virtual network interface for the bare metal server - // network attachment. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The subnet of the virtual network interface for the bare metal server network - // attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The bare metal server network attachment type. - Type *string `json:"type" validate:"required"` - - // The virtual network interface for this bare metal server network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` - - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - - // Indicates if the bare metal server network attachment can automatically float to any other server within the same - // `resource_group`. The bare metal server network attachment will float automatically if the network detects a GARP or - // RARP on another bare metal server in the resource group. Applies only to bare metal server network attachments with - // `vlan` interface type. - AllowToFloat *bool `json:"allow_to_float,omitempty"` - - // Indicates the 802.1Q VLAN ID tag 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 VLAN tag. -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its -// array of `allowed_vlans`. -// - Must use an IEEE 802.1q tag. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - BareMetalServerNetworkAttachmentInterfaceTypePciConst = "pci" - BareMetalServerNetworkAttachmentInterfaceTypeVlanConst = "vlan" -) - -// Constants associated with the BareMetalServerNetworkAttachment.LifecycleState property. -// The lifecycle state of the bare metal server network attachment. -const ( - BareMetalServerNetworkAttachmentLifecycleStateDeletingConst = "deleting" - BareMetalServerNetworkAttachmentLifecycleStateFailedConst = "failed" - BareMetalServerNetworkAttachmentLifecycleStatePendingConst = "pending" - BareMetalServerNetworkAttachmentLifecycleStateStableConst = "stable" - BareMetalServerNetworkAttachmentLifecycleStateSuspendedConst = "suspended" - BareMetalServerNetworkAttachmentLifecycleStateUpdatingConst = "updating" - BareMetalServerNetworkAttachmentLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the BareMetalServerNetworkAttachment.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkAttachmentResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" -) - -// Constants associated with the BareMetalServerNetworkAttachment.Type property. -// The bare metal server network attachment type. -const ( - BareMetalServerNetworkAttachmentTypePrimaryConst = "primary" - BareMetalServerNetworkAttachmentTypeSecondaryConst = "secondary" -) - -func (*BareMetalServerNetworkAttachment) isaBareMetalServerNetworkAttachment() bool { - return true -} - -type BareMetalServerNetworkAttachmentIntf interface { - isaBareMetalServerNetworkAttachment() bool -} - -// UnmarshalBareMetalServerNetworkAttachment unmarshals an instance of BareMetalServerNetworkAttachment from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachment) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentCollection : BareMetalServerNetworkAttachmentCollection struct -type BareMetalServerNetworkAttachmentCollection struct { - // A link to the first page of resources. - First *BareMetalServerNetworkAttachmentCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of bare metal server network attachments. - NetworkAttachments []BareMetalServerNetworkAttachmentIntf `json:"network_attachments" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *BareMetalServerNetworkAttachmentCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkAttachmentCollection unmarshals an instance of BareMetalServerNetworkAttachmentCollection from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerNetworkAttachmentCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachment) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkAttachmentCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *BareMetalServerNetworkAttachmentCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// BareMetalServerNetworkAttachmentCollectionFirst : A link to the first page of resources. -type BareMetalServerNetworkAttachmentCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkAttachmentCollectionFirst unmarshals an instance of BareMetalServerNetworkAttachmentCollectionFirst from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerNetworkAttachmentCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkAttachmentCollectionNext unmarshals an instance of BareMetalServerNetworkAttachmentCollectionNext from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentPatch : BareMetalServerNetworkAttachmentPatch struct -type BareMetalServerNetworkAttachmentPatch struct { - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) attachment. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - - // The name for this network attachment. The name must not be used by another network attachment for the bare metal - // server. - Name *string `json:"name,omitempty"` -} - -// UnmarshalBareMetalServerNetworkAttachmentPatch unmarshals an instance of BareMetalServerNetworkAttachmentPatch from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPatch) - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the BareMetalServerNetworkAttachmentPatch -func (bareMetalServerNetworkAttachmentPatch *BareMetalServerNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(bareMetalServerNetworkAttachmentPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// BareMetalServerNetworkAttachmentPrototype : BareMetalServerNetworkAttachmentPrototype struct -// Models which "extend" this model: -// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype -// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype -type BareMetalServerNetworkAttachmentPrototype struct { - // The network attachment's interface type: - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI attachment - // - Cannot directly use an IEEE 802.1q VLAN tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x` - // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its - // array of `allowed_vlans`. - // - Must use an IEEE 802.1q tag. - // - 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"` - - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) attachment. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - - // Indicates if the bare metal server network attachment can automatically float to any other server within the same - // `resource_group`. The bare metal server network attachment will float automatically if the network detects a GARP or - // RARP on another bare metal server in the resource group. Applies only to bare metal server network attachments with - // `vlan` interface type. - AllowToFloat *bool `json:"allow_to_float,omitempty"` - - // Indicates the 802.1Q VLAN ID tag 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 VLAN tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x` -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its -// array of `allowed_vlans`. -// - Must use an IEEE 802.1q tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. -const ( - BareMetalServerNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" - BareMetalServerNetworkAttachmentPrototypeInterfaceTypeVlanConst = "vlan" -) - -func (*BareMetalServerNetworkAttachmentPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { - return true -} - -type BareMetalServerNetworkAttachmentPrototypeIntf interface { - isaBareMetalServerNetworkAttachmentPrototype() bool -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototype) - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface : A virtual network interface for the bare metal server network attachment. This can be specified using an existing -// virtual network interface, or a prototype object for a new virtual network interface. -// -// If an existing virtual network interface is specified, it must not be the target of a flow log collector. -// Models which "extend" this model: -// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext -// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface struct { - // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on - // this interface. If `true`, source IP spoofing is allowed on this interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the virtual network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - If the virtual network interface is attached, the target `resource_type` must be - // `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 - // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // same subnet as the primary IP. - // - // If reserved IP identities are provided, the specified reserved IPs must be unbound. - // - // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network - // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet - // will be automatically selected and reserved. - Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are - // reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the virtual network interface. May be either a - // reserved IP identity, or a reserved IP prototype object which will be used to create a - // new reserved IP. - // - // If a reserved IP identity is provided, the specified reserved IP must be unbound. - // - // If a reserved IP prototype object with an address is provided, the address must be - // available on the virtual network interface's subnet. If no address is specified, - // an available address on the subnet will be automatically selected and reserved. - PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The resource group to use for this virtual network interface. If unspecified, the - // bare metal server's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. Required if `primary_ip` does not specify a reserved IP. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { - isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentReference : BareMetalServerNetworkAttachmentReference struct -type BareMetalServerNetworkAttachmentReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BareMetalServerNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this bare metal server network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network attachment. - ID *string `json:"id" validate:"required"` - - // The name for this bare metal server network attachment. The name is unique across all network attachments for the - // bare metal server. - Name *string `json:"name" validate:"required"` - - // The primary IP address of the virtual network interface for the bare metal server - // network attachment. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The subnet of the virtual network interface for the bare metal server network - // attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkAttachmentReference.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkAttachmentReferenceResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" -) - -// UnmarshalBareMetalServerNetworkAttachmentReference unmarshals an instance of BareMetalServerNetworkAttachmentReference from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkAttachmentReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted unmarshals an instance of BareMetalServerNetworkAttachmentReferenceDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct -// Models which "extend" this model: -// - BareMetalServerNetworkInterfaceByHiperSocket -// - BareMetalServerNetworkInterfaceByPci -// - BareMetalServerNetworkInterfaceByVlan -type BareMetalServerNetworkInterface struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // The date and time that the bare metal server network interface was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The floating IPs associated with this bare metal server network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network interface. - ID *string `json:"id" validate:"required"` - - // The interface type: - // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity - // within a `s390x` based system - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI interface - // - Cannot directly use an IEEE 802.1q VLAN tag. - // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its - // array of `allowed_vlans`. - // - Must use an IEEE 802.1q tag. - // - Has its own security groups and does not inherit those of the PCI device through - // which traffic flows. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value - // will be an empty string. - MacAddress *string `json:"mac_address" validate:"required"` - - // The name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - // The bare metal server network interface port speed in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The security groups targeting this bare metal server network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the bare metal server network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The bare metal server network interface type. - Type *string `json:"type" validate:"required"` - - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - - // Indicates if the interface can float to any other server within the same - // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal - // server in the resource group. Applies only to `vlan` type interfaces. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` - - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. - Vlan *int64 `json:"vlan,omitempty"` -} - -// Constants associated with the BareMetalServerNetworkInterface.InterfaceType property. -// The interface type: -// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity -// within a `s390x` based system -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped -// - Has an `allowed_vlans` property which controls the VLANs that will be permitted -// to use the PCI interface -// - Cannot directly use an IEEE 802.1q VLAN tag. -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its -// array of `allowed_vlans`. -// - Must use an IEEE 802.1q tag. -// - Has its own security groups and does not inherit those of the PCI device through -// which traffic flows. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - 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. -const ( - BareMetalServerNetworkInterfaceStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceStatusPendingConst = "pending" -) - -// Constants associated with the BareMetalServerNetworkInterface.Type property. -// The bare metal server network interface type. -const ( - BareMetalServerNetworkInterfaceTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceTypeSecondaryConst = "secondary" -) - -func (*BareMetalServerNetworkInterface) isaBareMetalServerNetworkInterface() bool { - return true -} - -type BareMetalServerNetworkInterfaceIntf interface { - isaBareMetalServerNetworkInterface() bool -} - -// UnmarshalBareMetalServerNetworkInterface unmarshals an instance of BareMetalServerNetworkInterface from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "interface_type", &discValue) - if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) - return - } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") - return - } - if discValue == "hipersocket" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByHiperSocket) - } else if discValue == "pci" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci) - } else if discValue == "vlan" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) - } - return -} - -// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct -type BareMetalServerNetworkInterfaceCollection struct { - // A link to the first page of resources. - First *BareMetalServerNetworkInterfaceCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of bare metal server network interfaces. - NetworkInterfaces []BareMetalServerNetworkInterfaceIntf `json:"network_interfaces" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *BareMetalServerNetworkInterfaceCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceCollection unmarshals an instance of BareMetalServerNetworkInterfaceCollection from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerNetworkInterfaceCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// BareMetalServerNetworkInterfaceCollectionFirst : A link to the first page of resources. -type BareMetalServerNetworkInterfaceCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceCollectionFirst unmarshals an instance of BareMetalServerNetworkInterfaceCollectionFirst from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfaceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerNetworkInterfaceCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceCollectionNext unmarshals an instance of BareMetalServerNetworkInterfaceCollectionNext from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct -type BareMetalServerNetworkInterfacePatch struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - - // The name for this bare metal server network interface. The name must not be used by another network interface on the - // bare metal server. - Name *string `json:"name,omitempty"` -} - -// UnmarshalBareMetalServerNetworkInterfacePatch unmarshals an instance of BareMetalServerNetworkInterfacePatch from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfacePatch) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the BareMetalServerNetworkInterfacePatch -func (bareMetalServerNetworkInterfacePatch *BareMetalServerNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(bareMetalServerNetworkInterfacePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct -// Models which "extend" this model: -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype -type BareMetalServerNetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - - // The interface type: - // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity - // within a `s390x` based system - // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI interface - // - Cannot directly use an IEEE 802.1q VLAN tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x` - // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its - // array of `allowed_vlans`. - // - Must use an IEEE 802.1q tag. - // - Has its own security groups and does not inherit those of the PCI device through - // which traffic flows. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The name for this 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 what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - - // Indicates if the interface can float to any other server within the same - // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal - // server in the resource group. Applies only to `vlan` type interfaces. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` - - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. - Vlan *int64 `json:"vlan,omitempty"` -} - -// Constants associated with the BareMetalServerNetworkInterfacePrototype.InterfaceType property. -// The interface type: -// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity -// within a `s390x` based system -// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped -// - Has an `allowed_vlans` property which controls the VLANs that will be permitted -// to use the PCI interface -// - Cannot directly use an IEEE 802.1q VLAN tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x` -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its -// array of `allowed_vlans`. -// - Must use an IEEE 802.1q tag. -// - Has its own security groups and does not inherit those of the PCI device through -// which traffic flows. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. -const ( - BareMetalServerNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerNetworkInterfacePrototypeInterfaceTypePciConst = "pci" - BareMetalServerNetworkInterfacePrototypeInterfaceTypeVlanConst = "vlan" -) - -func (*BareMetalServerNetworkInterfacePrototype) isaBareMetalServerNetworkInterfacePrototype() bool { - return true -} - -type BareMetalServerNetworkInterfacePrototypeIntf interface { - isaBareMetalServerNetworkInterfacePrototype() bool -} - -// UnmarshalBareMetalServerNetworkInterfacePrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "interface_type", &discValue) - if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) - return - } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") - return - } - if discValue == "hipersocket" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - } else if discValue == "pci" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) - } else if discValue == "vlan" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) - } - return -} - -// BareMetalServerNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkInterfaceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkInterfaceReferenceTargetContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPatch : BareMetalServerPatch struct -type BareMetalServerPatch struct { - // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the bare metal server - // will fail to boot. - // - // For `enable_secure_boot` to be changed, the bare metal server `status` must be - // `stopped`. - EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` - - // The name for this bare metal server. The name must not be used by another bare metal server in the region. Changing - // the name will not affect the system hostname. - Name *string `json:"name,omitempty"` - - TrustedPlatformModule *BareMetalServerTrustedPlatformModulePatch `json:"trusted_platform_module,omitempty"` -} - -// UnmarshalBareMetalServerPatch unmarshals an instance of BareMetalServerPatch from the specified map of raw messages. -func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPatch) - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the BareMetalServerPatch -func (bareMetalServerPatch *BareMetalServerPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(bareMetalServerPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// BareMetalServerPrimaryNetworkAttachmentPrototype : BareMetalServerPrimaryNetworkAttachmentPrototype struct -// Models which "extend" this model: -// - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype -type BareMetalServerPrimaryNetworkAttachmentPrototype struct { - // The network attachment's interface type: - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI attachment - // - Cannot directly use an IEEE 802.1q VLAN tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type,omitempty"` - - // The name for this bare metal server network 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"` - - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) 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 VLAN tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. -const ( - BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" -) - -func (*BareMetalServerPrimaryNetworkAttachmentPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { - return true -} - -type BareMetalServerPrimaryNetworkAttachmentPrototypeIntf interface { - isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool -} - -// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrimaryNetworkAttachmentPrototype) - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct -type BareMetalServerPrimaryNetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - - // The interface type: - // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity - // within a `s390x` based system. - // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI interface - // - Cannot directly use an IEEE 802.1q VLAN tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type,omitempty"` - - // The name for this bare metal server network interface. The name must not be used by another network interface on the - // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the bare metal server network interface. This can be - // specified using an existing reserved IP, or a prototype object for a new reserved IP. - // - // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the bare metal server network interface's subnet. Otherwise, an - // available address on the subnet will be automatically selected and reserved. - PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security - // group is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` -} - -// Constants associated with the BareMetalServerPrimaryNetworkInterfacePrototype.InterfaceType property. -// The interface type: -// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity -// within a `s390x` based system. -// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped -// - Has an `allowed_vlans` property which controls the VLANs that will be permitted -// to use the PCI interface -// - Cannot directly use an IEEE 802.1q VLAN tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. -const ( - BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypePciConst = "pci" -) - -// NewBareMetalServerPrimaryNetworkInterfacePrototype : Instantiate BareMetalServerPrimaryNetworkInterfacePrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrimaryNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *BareMetalServerPrimaryNetworkInterfacePrototype, err error) { - _model = &BareMetalServerPrimaryNetworkInterfacePrototype{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype unmarshals an instance of BareMetalServerPrimaryNetworkInterfacePrototype from the specified map of raw messages. -func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrimaryNetworkInterfacePrototype) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfile : BareMetalServerProfile struct -type BareMetalServerProfile struct { - Bandwidth BareMetalServerProfileBandwidthIntf `json:"bandwidth" validate:"required"` - - // The console type configuration for a bare metal server with this profile. - ConsoleTypes *BareMetalServerProfileConsoleTypes `json:"console_types" validate:"required"` - - CpuArchitecture *BareMetalServerProfileCpuArchitecture `json:"cpu_architecture" validate:"required"` - - CpuCoreCount BareMetalServerProfileCpuCoreCountIntf `json:"cpu_core_count" validate:"required"` - - CpuSocketCount BareMetalServerProfileCpuSocketCountIntf `json:"cpu_socket_count" validate:"required"` - - // Collection of the bare metal server profile's disks. - Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"` - - // The product family this bare metal server profile belongs to. - Family *string `json:"family" validate:"required"` - - // The URL for this bare metal server profile. - Href *string `json:"href" validate:"required"` - - Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` - - // The name for this bare metal server profile. - Name *string `json:"name" validate:"required"` - - NetworkAttachmentCount BareMetalServerProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"` - - NetworkInterfaceCount BareMetalServerProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` - - OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The supported trusted platform module modes for this bare metal server profile. - SupportedTrustedPlatformModuleModes *BareMetalServerProfileSupportedTrustedPlatformModuleModes `json:"supported_trusted_platform_module_modes" validate:"required"` - - // Indicates whether this profile supports virtual network interfaces. - VirtualNetworkInterfacesSupported *BareMetalServerProfileVirtualNetworkInterfacesSupported `json:"virtual_network_interfaces_supported" validate:"required"` -} - -// Constants associated with the BareMetalServerProfile.ResourceType property. -// The resource type. -const ( - BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" -) - -// UnmarshalBareMetalServerProfile unmarshals an instance of BareMetalServerProfile from the specified map of raw messages. -func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfile) - err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalBareMetalServerProfileBandwidth) - if err != nil { - return - } - err = core.UnmarshalModel(m, "console_types", &obj.ConsoleTypes, UnmarshalBareMetalServerProfileConsoleTypes) - if err != nil { - return - } - err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture) - if err != nil { - return - } - err = core.UnmarshalModel(m, "cpu_core_count", &obj.CpuCoreCount, UnmarshalBareMetalServerProfileCpuCoreCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalBareMetalServerProfileNetworkAttachmentCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interfaces_supported", &obj.VirtualNetworkInterfacesSupported, UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileBandwidth : BareMetalServerProfileBandwidth struct -// Models which "extend" this model: -// - BareMetalServerProfileBandwidthFixed -// - BareMetalServerProfileBandwidthRange -// - BareMetalServerProfileBandwidthEnum -// - BareMetalServerProfileBandwidthDependent -type BareMetalServerProfileBandwidth struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the BareMetalServerProfileBandwidth.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileBandwidthTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileBandwidth) isaBareMetalServerProfileBandwidth() bool { - return true -} - -type BareMetalServerProfileBandwidthIntf interface { - isaBareMetalServerProfileBandwidth() bool -} - -// UnmarshalBareMetalServerProfileBandwidth unmarshals an instance of BareMetalServerProfileBandwidth from the specified map of raw messages. -func UnmarshalBareMetalServerProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileBandwidth) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCpuArchitecture : BareMetalServerProfileCpuArchitecture struct -type BareMetalServerProfileCpuArchitecture struct { - // The default CPU architecture for a bare metal server with this profile. - Default *string `json:"default,omitempty"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The CPU architecture for a bare metal server with this profile. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuArchitecture.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuArchitectureTypeFixedConst = "fixed" -) - -// UnmarshalBareMetalServerProfileCpuArchitecture unmarshals an instance of BareMetalServerProfileCpuArchitecture from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuArchitecture) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCpuCoreCount : BareMetalServerProfileCpuCoreCount struct -// Models which "extend" this model: -// - BareMetalServerProfileCpuCoreCountFixed -// - BareMetalServerProfileCpuCoreCountRange -// - BareMetalServerProfileCpuCoreCountEnum -// - BareMetalServerProfileCpuCoreCountDependent -type BareMetalServerProfileCpuCoreCount struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the BareMetalServerProfileCpuCoreCount.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuCoreCountTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileCpuCoreCount) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} - -type BareMetalServerProfileCpuCoreCountIntf interface { - isaBareMetalServerProfileCpuCoreCount() bool -} - -// UnmarshalBareMetalServerProfileCpuCoreCount unmarshals an instance of BareMetalServerProfileCpuCoreCount from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuCoreCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuCoreCount) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCpuSocketCount : BareMetalServerProfileCpuSocketCount struct -// Models which "extend" this model: -// - BareMetalServerProfileCpuSocketCountFixed -// - BareMetalServerProfileCpuSocketCountRange -// - BareMetalServerProfileCpuSocketCountEnum -// - BareMetalServerProfileCpuSocketCountDependent -type BareMetalServerProfileCpuSocketCount struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the BareMetalServerProfileCpuSocketCount.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuSocketCountTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileCpuSocketCount) isaBareMetalServerProfileCpuSocketCount() bool { - return true -} - -type BareMetalServerProfileCpuSocketCountIntf interface { - isaBareMetalServerProfileCpuSocketCount() bool -} - -// UnmarshalBareMetalServerProfileCpuSocketCount unmarshals an instance of BareMetalServerProfileCpuSocketCount from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuSocketCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuSocketCount) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct -type BareMetalServerProfileCollection struct { - // A link to the first page of resources. - First *BareMetalServerProfileCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *BareMetalServerProfileCollectionNext `json:"next,omitempty"` - - // Collection of bare metal server profiles. - Profiles []BareMetalServerProfile `json:"profiles" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalBareMetalServerProfileCollection unmarshals an instance of BareMetalServerProfileCollection from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerProfileCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerProfileCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// BareMetalServerProfileCollectionFirst : A link to the first page of resources. -type BareMetalServerProfileCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBareMetalServerProfileCollectionFirst unmarshals an instance of BareMetalServerProfileCollectionFirst from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerProfileCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBareMetalServerProfileCollectionNext unmarshals an instance of BareMetalServerProfileCollectionNext from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileConsoleTypes : The console type configuration for a bare metal server with this profile. -type BareMetalServerProfileConsoleTypes struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The console types for a bare metal server with this profile. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileConsoleTypes.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileConsoleTypesTypeEnumConst = "enum" -) - -// Constants associated with the BareMetalServerProfileConsoleTypes.Values property. -// A console type. -const ( - BareMetalServerProfileConsoleTypesValuesSerialConst = "serial" - BareMetalServerProfileConsoleTypesValuesVncConst = "vnc" -) - -// UnmarshalBareMetalServerProfileConsoleTypes unmarshals an instance of BareMetalServerProfileConsoleTypes from the specified map of raw messages. -func UnmarshalBareMetalServerProfileConsoleTypes(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileConsoleTypes) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDisk : Disks provided by this profile. -type BareMetalServerProfileDisk struct { - Quantity BareMetalServerProfileDiskQuantityIntf `json:"quantity" validate:"required"` - - Size BareMetalServerProfileDiskSizeIntf `json:"size" validate:"required"` - - SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` -} - -// UnmarshalBareMetalServerProfileDisk unmarshals an instance of BareMetalServerProfileDisk from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDisk) - err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalBareMetalServerProfileDiskQuantity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize) - if err != nil { - return - } - err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskQuantity : BareMetalServerProfileDiskQuantity struct -// Models which "extend" this model: -// - BareMetalServerProfileDiskQuantityFixed -// - BareMetalServerProfileDiskQuantityRange -// - BareMetalServerProfileDiskQuantityEnum -// - BareMetalServerProfileDiskQuantityDependent -type BareMetalServerProfileDiskQuantity struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the BareMetalServerProfileDiskQuantity.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileDiskQuantity) isaBareMetalServerProfileDiskQuantity() bool { - return true -} - -type BareMetalServerProfileDiskQuantityIntf interface { - isaBareMetalServerProfileDiskQuantity() bool -} - -// UnmarshalBareMetalServerProfileDiskQuantity unmarshals an instance of BareMetalServerProfileDiskQuantity from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskQuantity) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskSize : BareMetalServerProfileDiskSize struct -// Models which "extend" this model: -// - BareMetalServerProfileDiskSizeFixed -// - BareMetalServerProfileDiskSizeRange -// - BareMetalServerProfileDiskSizeEnum -// - BareMetalServerProfileDiskSizeDependent -type BareMetalServerProfileDiskSize struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the BareMetalServerProfileDiskSize.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { - return true -} - -type BareMetalServerProfileDiskSizeIntf interface { - isaBareMetalServerProfileDiskSize() bool -} - -// UnmarshalBareMetalServerProfileDiskSize unmarshals an instance of BareMetalServerProfileDiskSize from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSize) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct -type BareMetalServerProfileDiskSupportedInterfaces struct { - // The disk interface used for attaching the disk. - // - // - `fcp`: Attached using Fiber Channel Protocol - // - `sata`: Attached using Serial Advanced Technology Attachment - // - `nvme`: Attached using Non-Volatile Memory Express - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - Default *string `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The supported disk interfaces used for attaching the disk. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. -// The disk interface used for attaching the disk. -// -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using Non-Volatile Memory Express -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp" - BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" - BareMetalServerProfileDiskSupportedInterfacesDefaultSataConst = "sata" -) - -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSupportedInterfacesTypeEnumConst = "enum" -) - -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Values property. -// The disk interface used for attaching the disk. -// -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using Non-Volatile Memory Express -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - BareMetalServerProfileDiskSupportedInterfacesValuesFcpConst = "fcp" - BareMetalServerProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" - BareMetalServerProfileDiskSupportedInterfacesValuesSataConst = "sata" -) - -// UnmarshalBareMetalServerProfileDiskSupportedInterfaces unmarshals an instance of BareMetalServerProfileDiskSupportedInterfaces from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSupportedInterfaces) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileIdentity : Identifies a bare metal server profile by a unique property. -// Models which "extend" this model: -// - BareMetalServerProfileIdentityByName -// - BareMetalServerProfileIdentityByHref -type BareMetalServerProfileIdentity struct { - // The name for this bare metal server profile. - Name *string `json:"name,omitempty"` - - // The URL for this bare metal server profile. - Href *string `json:"href,omitempty"` -} - -func (*BareMetalServerProfileIdentity) isaBareMetalServerProfileIdentity() bool { - return true -} - -type BareMetalServerProfileIdentityIntf interface { - isaBareMetalServerProfileIdentity() bool -} - -// UnmarshalBareMetalServerProfileIdentity unmarshals an instance of BareMetalServerProfileIdentity from the specified map of raw messages. -func UnmarshalBareMetalServerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileMemory : BareMetalServerProfileMemory struct -// Models which "extend" this model: -// - BareMetalServerProfileMemoryFixed -// - BareMetalServerProfileMemoryRange -// - BareMetalServerProfileMemoryEnum -// - BareMetalServerProfileMemoryDependent -type BareMetalServerProfileMemory struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the BareMetalServerProfileMemory.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileMemoryTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileMemory) isaBareMetalServerProfileMemory() bool { - return true -} - -type BareMetalServerProfileMemoryIntf interface { - isaBareMetalServerProfileMemory() bool -} - -// UnmarshalBareMetalServerProfileMemory unmarshals an instance of BareMetalServerProfileMemory from the specified map of raw messages. -func UnmarshalBareMetalServerProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileMemory) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileNetworkAttachmentCount : BareMetalServerProfileNetworkAttachmentCount struct -// Models which "extend" this model: -// - BareMetalServerProfileNetworkAttachmentCountRange -// - BareMetalServerProfileNetworkAttachmentCountDependent -type BareMetalServerProfileNetworkAttachmentCount struct { - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The type for this profile field. - Type *string `json:"type,omitempty"` -} - -// Constants associated with the BareMetalServerProfileNetworkAttachmentCount.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkAttachmentCountTypeRangeConst = "range" -) - -func (*BareMetalServerProfileNetworkAttachmentCount) isaBareMetalServerProfileNetworkAttachmentCount() bool { - return true -} - -type BareMetalServerProfileNetworkAttachmentCountIntf interface { - isaBareMetalServerProfileNetworkAttachmentCount() bool -} - -// UnmarshalBareMetalServerProfileNetworkAttachmentCount unmarshals an instance of BareMetalServerProfileNetworkAttachmentCount from the specified map of raw messages. -func UnmarshalBareMetalServerProfileNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileNetworkAttachmentCount) - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileNetworkInterfaceCount : BareMetalServerProfileNetworkInterfaceCount struct -// Models which "extend" this model: -// - BareMetalServerProfileNetworkInterfaceCountRange -// - BareMetalServerProfileNetworkInterfaceCountDependent -type BareMetalServerProfileNetworkInterfaceCount struct { - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The type for this profile field. - Type *string `json:"type,omitempty"` -} - -// Constants associated with the BareMetalServerProfileNetworkInterfaceCount.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkInterfaceCountTypeRangeConst = "range" -) - -func (*BareMetalServerProfileNetworkInterfaceCount) isaBareMetalServerProfileNetworkInterfaceCount() bool { - return true -} - -type BareMetalServerProfileNetworkInterfaceCountIntf interface { - isaBareMetalServerProfileNetworkInterfaceCount() bool -} - -// UnmarshalBareMetalServerProfileNetworkInterfaceCount unmarshals an instance of BareMetalServerProfileNetworkInterfaceCount from the specified map of raw messages. -func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileNetworkInterfaceCount) - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileOsArchitecture : BareMetalServerProfileOsArchitecture struct -type BareMetalServerProfileOsArchitecture struct { - // The default OS architecture for a bare metal server with this profile. - Default *string `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The supported OS architecture(s) for a bare metal server with this profile. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileOsArchitecture.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileOsArchitectureTypeEnumConst = "enum" -) - -// UnmarshalBareMetalServerProfileOsArchitecture unmarshals an instance of BareMetalServerProfileOsArchitecture from the specified map of raw messages. -func UnmarshalBareMetalServerProfileOsArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileOsArchitecture) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileReference : BareMetalServerProfileReference struct -type BareMetalServerProfileReference struct { - // The URL for this bare metal server profile. - Href *string `json:"href" validate:"required"` - - // The name for this bare metal server profile. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileReference.ResourceType property. -// The resource type. -const ( - BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" -) - -// UnmarshalBareMetalServerProfileReference unmarshals an instance of BareMetalServerProfileReference from the specified map of raw messages. -func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module modes for this bare metal server profile. -type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The supported trusted platform module modes. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesTypeEnumConst = "enum" -) - -// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Values property. -// The trusted platform module (TPM) mode: -// - `disabled`: No TPM functionality -// - `tpm_2`: TPM 2.0 -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" -) - -// UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes unmarshals an instance of BareMetalServerProfileSupportedTrustedPlatformModuleModes from the specified map of raw messages. -func UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileSupportedTrustedPlatformModuleModes) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileVirtualNetworkInterfacesSupported : Indicates whether this profile supports virtual network interfaces. -type BareMetalServerProfileVirtualNetworkInterfacesSupported struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *bool `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileVirtualNetworkInterfacesSupported.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileVirtualNetworkInterfacesSupportedTypeFixedConst = "fixed" -) - -// UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported unmarshals an instance of BareMetalServerProfileVirtualNetworkInterfacesSupported from the specified map of raw messages. -func UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileVirtualNetworkInterfacesSupported) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPrototype : BareMetalServerPrototype struct -// Models which "extend" this model: -// - BareMetalServerPrototypeBareMetalServerByNetworkAttachment -// - BareMetalServerPrototypeBareMetalServerByNetworkInterface -type BareMetalServerPrototype struct { - // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to - // boot. - EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` - - Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` - - // The name for this bare metal server. The name must not be used by another bare metal server in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) - // to use for this bare metal server. - Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` - - // The VPC this bare metal server will reside in. - // - // If specified, it must match the VPC for the subnets that the network attachments or - // network interfaces of the bare metal server are attached to. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The zone this bare metal server will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the bare metal server. - NetworkAttachments []BareMetalServerNetworkAttachmentPrototypeIntf `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the bare metal server. - PrimaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf `json:"primary_network_attachment,omitempty"` - - // The additional bare metal server network interfaces to create. - NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` - - // The primary bare metal server network interface to create. - PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*BareMetalServerPrototype) isaBareMetalServerPrototype() bool { - return true -} - -type BareMetalServerPrototypeIntf interface { - isaBareMetalServerPrototype() bool -} - -// UnmarshalBareMetalServerPrototype unmarshals an instance of BareMetalServerPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototype) - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) - if err != nil { - return - } - err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerStatusReason : BareMetalServerStatusReason struct -type BareMetalServerStatusReason struct { - // The status reason code: - // - `cannot_start`: Failed to start due to an internal error - // - `cannot_start_capacity`: Insufficient capacity within the selected zone - // - `cannot_start_compute`: An error occurred while allocating compute resources - // - `cannot_start_ip_address`: An error occurred while allocating an IP address - // - `cannot_start_network`: An error occurred while allocating network resources. - Code *string `json:"code" validate:"required"` - - // An explanation of the status reason. - Message *string `json:"message" validate:"required"` - - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the BareMetalServerStatusReason.Code property. -// The status reason code: -// - `cannot_start`: Failed to start due to an internal error -// - `cannot_start_capacity`: Insufficient capacity within the selected zone -// - `cannot_start_compute`: An error occurred while allocating compute resources -// - `cannot_start_ip_address`: An error occurred while allocating an IP address -// - `cannot_start_network`: An error occurred while allocating network resources. -const ( - BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" - BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" - BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" - BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" - BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" -) - -// UnmarshalBareMetalServerStatusReason unmarshals an instance of BareMetalServerStatusReason from the specified map of raw messages. -func UnmarshalBareMetalServerStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerStatusReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerTrustedPlatformModule : BareMetalServerTrustedPlatformModule struct -type BareMetalServerTrustedPlatformModule struct { - // Indicates whether the trusted platform module is enabled. - Enabled *bool `json:"enabled" validate:"required"` - - // The trusted platform module (TPM) mode: - // - `disabled`: No TPM functionality - // - `tpm_2`: TPM 2.0 - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - Mode *string `json:"mode" validate:"required"` - - // The supported trusted platform module modes. - SupportedModes []string `json:"supported_modes" validate:"required"` -} - -// Constants associated with the BareMetalServerTrustedPlatformModule.Mode property. -// The trusted platform module (TPM) mode: -// - `disabled`: No TPM functionality -// - `tpm_2`: TPM 2.0 -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - BareMetalServerTrustedPlatformModuleModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModuleModeTpm2Const = "tpm_2" -) - -// Constants associated with the BareMetalServerTrustedPlatformModule.SupportedModes property. -// The trusted platform module (TPM) mode: -// - `disabled`: No TPM functionality -// - `tpm_2`: TPM 2.0 -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - BareMetalServerTrustedPlatformModuleSupportedModesDisabledConst = "disabled" - BareMetalServerTrustedPlatformModuleSupportedModesTpm2Const = "tpm_2" -) - -// UnmarshalBareMetalServerTrustedPlatformModule unmarshals an instance of BareMetalServerTrustedPlatformModule from the specified map of raw messages. -func UnmarshalBareMetalServerTrustedPlatformModule(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerTrustedPlatformModule) - err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerTrustedPlatformModulePatch : BareMetalServerTrustedPlatformModulePatch struct -type BareMetalServerTrustedPlatformModulePatch struct { - // The trusted platform module mode to use. The specified value must be listed in the bare metal server's - // `supported_modes`. - // - // For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the BareMetalServerTrustedPlatformModulePatch.Mode property. -// The trusted platform module mode to use. The specified value must be listed in the bare metal server's -// `supported_modes`. -// -// For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`. -const ( - BareMetalServerTrustedPlatformModulePatchModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModulePatchModeTpm2Const = "tpm_2" -) - -// UnmarshalBareMetalServerTrustedPlatformModulePatch unmarshals an instance of BareMetalServerTrustedPlatformModulePatch from the specified map of raw messages. -func UnmarshalBareMetalServerTrustedPlatformModulePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerTrustedPlatformModulePatch) - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerTrustedPlatformModulePrototype : BareMetalServerTrustedPlatformModulePrototype struct -type BareMetalServerTrustedPlatformModulePrototype struct { - // The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's - // `supported_trusted_platform_module_modes`. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the BareMetalServerTrustedPlatformModulePrototype.Mode property. -// The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's -// `supported_trusted_platform_module_modes`. -const ( - BareMetalServerTrustedPlatformModulePrototypeModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModulePrototypeModeTpm2Const = "tpm_2" -) - -// UnmarshalBareMetalServerTrustedPlatformModulePrototype unmarshals an instance of BareMetalServerTrustedPlatformModulePrototype from the specified map of raw messages. -func UnmarshalBareMetalServerTrustedPlatformModulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerTrustedPlatformModulePrototype) - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CatalogOfferingIdentity : Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique -// property. -// Models which "extend" this model: -// - CatalogOfferingIdentityCatalogOfferingByCRN -type CatalogOfferingIdentity struct { - // The CRN for this - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. - CRN *string `json:"crn,omitempty"` -} - -func (*CatalogOfferingIdentity) isaCatalogOfferingIdentity() bool { - return true -} - -type CatalogOfferingIdentityIntf interface { - isaCatalogOfferingIdentity() bool -} - -// UnmarshalCatalogOfferingIdentity unmarshals an instance of CatalogOfferingIdentity from the specified map of raw messages. -func UnmarshalCatalogOfferingIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingIdentity) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CatalogOfferingVersionIdentity : Identifies a version of a -// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique property. -// Models which "extend" this model: -// - CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN -type CatalogOfferingVersionIdentity struct { - // The CRN for this version of a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. - CRN *string `json:"crn,omitempty"` -} - -func (*CatalogOfferingVersionIdentity) isaCatalogOfferingVersionIdentity() bool { - return true -} - -type CatalogOfferingVersionIdentityIntf interface { - isaCatalogOfferingVersionIdentity() bool -} - -// UnmarshalCatalogOfferingVersionIdentity unmarshals an instance of CatalogOfferingVersionIdentity from the specified map of raw messages. -func UnmarshalCatalogOfferingVersionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingVersionIdentity) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CatalogOfferingVersionReference : CatalogOfferingVersionReference struct -type CatalogOfferingVersionReference struct { - // The CRN for this version of a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. - CRN *string `json:"crn" validate:"required"` -} - -// UnmarshalCatalogOfferingVersionReference unmarshals an instance of CatalogOfferingVersionReference from the specified map of raw messages. -func UnmarshalCatalogOfferingVersionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingVersionReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CertificateInstanceIdentity : Identifies a certificate instance by a unique property. -// Models which "extend" this model: -// - CertificateInstanceIdentityByCRN -type CertificateInstanceIdentity struct { - // The CRN for this certificate instance. - CRN *string `json:"crn,omitempty"` -} - -func (*CertificateInstanceIdentity) isaCertificateInstanceIdentity() bool { - return true -} - -type CertificateInstanceIdentityIntf interface { - isaCertificateInstanceIdentity() bool -} - -// UnmarshalCertificateInstanceIdentity unmarshals an instance of CertificateInstanceIdentity from the specified map of raw messages. -func UnmarshalCertificateInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CertificateInstanceIdentity) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CertificateInstanceReference : CertificateInstanceReference struct -type CertificateInstanceReference struct { - // The CRN for this certificate instance. - CRN *string `json:"crn" validate:"required"` -} - -// UnmarshalCertificateInstanceReference unmarshals an instance of CertificateInstanceReference from the specified map of raw messages. -func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CertificateInstanceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CheckVPNGatewayConnectionLocalCIDROptions : The CheckVPNGatewayConnectionLocalCIDR options. -type CheckVPNGatewayConnectionLocalCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` - - // The address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCheckVPNGatewayConnectionLocalCIDROptions : Instantiate CheckVPNGatewayConnectionLocalCIDROptions -func (*VpcV1) NewCheckVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { - return &CheckVPNGatewayConnectionLocalCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionLocalCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetID(id string) *CheckVPNGatewayConnectionLocalCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionLocalCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} - -// SetPrefixLength : Allow user to set PrefixLength -func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CheckVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionLocalCIDROptions { - options.Headers = param - return options -} - -// CheckVPNGatewayConnectionPeerCIDROptions : The CheckVPNGatewayConnectionPeerCIDR options. -type CheckVPNGatewayConnectionPeerCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` - - // The address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCheckVPNGatewayConnectionPeerCIDROptions : Instantiate CheckVPNGatewayConnectionPeerCIDROptions -func (*VpcV1) NewCheckVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { - return &CheckVPNGatewayConnectionPeerCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionPeerCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetID(id string) *CheckVPNGatewayConnectionPeerCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionPeerCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} - -// SetPrefixLength : Allow user to set PrefixLength -func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CheckVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionPeerCIDROptions { - options.Headers = param - return options -} - -// CloudObjectStorageBucketIdentity : Identifies a Cloud Object Storage bucket by a unique property. -// Models which "extend" this model: -// - CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName -// - CloudObjectStorageBucketIdentityByCRN -type CloudObjectStorageBucketIdentity struct { - // The globally unique name of this Cloud Object Storage bucket. - Name *string `json:"name,omitempty"` - - // The CRN of this Cloud Object Storage bucket. - CRN *string `json:"crn,omitempty"` -} - -func (*CloudObjectStorageBucketIdentity) isaCloudObjectStorageBucketIdentity() bool { - return true -} - -type CloudObjectStorageBucketIdentityIntf interface { - isaCloudObjectStorageBucketIdentity() bool -} - -// UnmarshalCloudObjectStorageBucketIdentity unmarshals an instance of CloudObjectStorageBucketIdentity from the specified map of raw messages. -func UnmarshalCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CloudObjectStorageBucketIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CloudObjectStorageBucketReference : CloudObjectStorageBucketReference struct -type CloudObjectStorageBucketReference struct { - // The CRN of this Cloud Object Storage bucket. - CRN *string `json:"crn" validate:"required"` - - // The globally unique name of this Cloud Object Storage bucket. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalCloudObjectStorageBucketReference unmarshals an instance of CloudObjectStorageBucketReference from the specified map of raw messages. -func UnmarshalCloudObjectStorageBucketReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CloudObjectStorageBucketReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CloudObjectStorageObjectReference : CloudObjectStorageObjectReference struct -type CloudObjectStorageObjectReference struct { - // The name of this Cloud Object Storage object. Names are unique within a Cloud Object Storage bucket. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalCloudObjectStorageObjectReference unmarshals an instance of CloudObjectStorageObjectReference from the specified map of raw messages. -func UnmarshalCloudObjectStorageObjectReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CloudObjectStorageObjectReference) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CreateBackupPolicyOptions : The CreateBackupPolicy options. -type CreateBackupPolicyOptions struct { - // The user tags this backup policy will apply to. Resources that have both a matching user tag and a matching type - // will be subject to the backup policy. - MatchUserTags []string `json:"match_user_tags" validate:"required"` - - // The resource types this backup policy will apply to. Resources that have both a matching type and a matching user - // tag will be subject to the backup policy. - MatchResourceTypes []string `json:"match_resource_types,omitempty"` - - // The name for this backup policy. The name must not be used by another backup policy in the region. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The prototype objects for backup plans to be created for this backup policy. - Plans []BackupPolicyPlanPrototype `json:"plans,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The scope to use for this backup policy. - // - // If unspecified, the policy will be scoped to the account. - Scope BackupPolicyScopePrototypeIntf `json:"scope,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateBackupPolicyOptions.MatchResourceTypes property. -// The resource type. -const ( - CreateBackupPolicyOptionsMatchResourceTypesVolumeConst = "volume" -) - -// NewCreateBackupPolicyOptions : Instantiate CreateBackupPolicyOptions -func (*VpcV1) NewCreateBackupPolicyOptions(matchUserTags []string) *CreateBackupPolicyOptions { - return &CreateBackupPolicyOptions{ - MatchUserTags: matchUserTags, - } -} - -// SetMatchUserTags : Allow user to set MatchUserTags -func (_options *CreateBackupPolicyOptions) SetMatchUserTags(matchUserTags []string) *CreateBackupPolicyOptions { - _options.MatchUserTags = matchUserTags - return _options -} - -// SetMatchResourceTypes : Allow user to set MatchResourceTypes -func (_options *CreateBackupPolicyOptions) SetMatchResourceTypes(matchResourceTypes []string) *CreateBackupPolicyOptions { - _options.MatchResourceTypes = matchResourceTypes - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateBackupPolicyOptions) SetName(name string) *CreateBackupPolicyOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetPlans : Allow user to set Plans -func (_options *CreateBackupPolicyOptions) SetPlans(plans []BackupPolicyPlanPrototype) *CreateBackupPolicyOptions { - _options.Plans = plans - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateBackupPolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateBackupPolicyOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetScope : Allow user to set Scope -func (_options *CreateBackupPolicyOptions) SetScope(scope BackupPolicyScopePrototypeIntf) *CreateBackupPolicyOptions { - _options.Scope = scope - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateBackupPolicyOptions) SetHeaders(param map[string]string) *CreateBackupPolicyOptions { - options.Headers = param - return options -} - -// CreateBackupPolicyPlanOptions : The CreateBackupPolicyPlan options. -type CreateBackupPolicyPlanOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // The cron specification for the backup schedule. The backup policy jobs - // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes - // after this time. - // - // All backup schedules for plans in the same policy must be at least an hour apart. - CronSpec *string `json:"cron_spec" validate:"required"` - - // Indicates whether the plan is active. - Active *bool `json:"active,omitempty"` - - // User tags to attach to each backup (snapshot) created by this plan. If unspecified, no user tags will be attached. - AttachUserTags []string `json:"attach_user_tags,omitempty"` - - ClonePolicy *BackupPolicyPlanClonePolicyPrototype `json:"clone_policy,omitempty"` - - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags,omitempty"` - - DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` - - // The name for this backup policy plan. The name must not be used by another plan for the backup policy. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The policies for additional backups in remote regions. - RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateBackupPolicyPlanOptions : Instantiate CreateBackupPolicyPlanOptions -func (*VpcV1) NewCreateBackupPolicyPlanOptions(backupPolicyID string, cronSpec string) *CreateBackupPolicyPlanOptions { - return &CreateBackupPolicyPlanOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - CronSpec: core.StringPtr(cronSpec), - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *CreateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *CreateBackupPolicyPlanOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetCronSpec : Allow user to set CronSpec -func (_options *CreateBackupPolicyPlanOptions) SetCronSpec(cronSpec string) *CreateBackupPolicyPlanOptions { - _options.CronSpec = core.StringPtr(cronSpec) - return _options -} - -// SetActive : Allow user to set Active -func (_options *CreateBackupPolicyPlanOptions) SetActive(active bool) *CreateBackupPolicyPlanOptions { - _options.Active = core.BoolPtr(active) - return _options -} - -// SetAttachUserTags : Allow user to set AttachUserTags -func (_options *CreateBackupPolicyPlanOptions) SetAttachUserTags(attachUserTags []string) *CreateBackupPolicyPlanOptions { - _options.AttachUserTags = attachUserTags - return _options -} - -// SetClonePolicy : Allow user to set ClonePolicy -func (_options *CreateBackupPolicyPlanOptions) SetClonePolicy(clonePolicy *BackupPolicyPlanClonePolicyPrototype) *CreateBackupPolicyPlanOptions { - _options.ClonePolicy = clonePolicy - return _options -} - -// SetCopyUserTags : Allow user to set CopyUserTags -func (_options *CreateBackupPolicyPlanOptions) SetCopyUserTags(copyUserTags bool) *CreateBackupPolicyPlanOptions { - _options.CopyUserTags = core.BoolPtr(copyUserTags) - return _options -} - -// SetDeletionTrigger : Allow user to set DeletionTrigger -func (_options *CreateBackupPolicyPlanOptions) SetDeletionTrigger(deletionTrigger *BackupPolicyPlanDeletionTriggerPrototype) *CreateBackupPolicyPlanOptions { - _options.DeletionTrigger = deletionTrigger - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateBackupPolicyPlanOptions) SetName(name string) *CreateBackupPolicyPlanOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetRemoteRegionPolicies : Allow user to set RemoteRegionPolicies -func (_options *CreateBackupPolicyPlanOptions) SetRemoteRegionPolicies(remoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype) *CreateBackupPolicyPlanOptions { - _options.RemoteRegionPolicies = remoteRegionPolicies - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *CreateBackupPolicyPlanOptions { - options.Headers = param - return options -} - -// CreateBareMetalServerConsoleAccessTokenOptions : The CreateBareMetalServerConsoleAccessToken options. -type CreateBareMetalServerConsoleAccessTokenOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server console type for which this token may be used - // - // Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. - ConsoleType *string `json:"console_type" validate:"required"` - - // Indicates whether to disconnect an existing serial console session as the serial console cannot be shared. This has - // no effect on VNC consoles. - Force *bool `json:"force,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateBareMetalServerConsoleAccessTokenOptions.ConsoleType property. -// The bare metal server console type for which this token may be used -// -// Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. -const ( - CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeSerialConst = "serial" - CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeVncConst = "vnc" -) - -// NewCreateBareMetalServerConsoleAccessTokenOptions : Instantiate CreateBareMetalServerConsoleAccessTokenOptions -func (*VpcV1) NewCreateBareMetalServerConsoleAccessTokenOptions(bareMetalServerID string, consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { - return &CreateBareMetalServerConsoleAccessTokenOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ConsoleType: core.StringPtr(consoleType), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerConsoleAccessTokenOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetConsoleType : Allow user to set ConsoleType -func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetConsoleType(consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { - _options.ConsoleType = core.StringPtr(consoleType) - return _options -} - -// SetForce : Allow user to set Force -func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetForce(force bool) *CreateBareMetalServerConsoleAccessTokenOptions { - _options.Force = core.BoolPtr(force) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateBareMetalServerConsoleAccessTokenOptions) SetHeaders(param map[string]string) *CreateBareMetalServerConsoleAccessTokenOptions { - options.Headers = param - return options -} - -// CreateBareMetalServerNetworkAttachmentOptions : The CreateBareMetalServerNetworkAttachment options. -type CreateBareMetalServerNetworkAttachmentOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network attachment prototype object. - BareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf `json:"BareMetalServerNetworkAttachmentPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateBareMetalServerNetworkAttachmentOptions : Instantiate CreateBareMetalServerNetworkAttachmentOptions -func (*VpcV1) NewCreateBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, bareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf) *CreateBareMetalServerNetworkAttachmentOptions { - return &CreateBareMetalServerNetworkAttachmentOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - BareMetalServerNetworkAttachmentPrototype: bareMetalServerNetworkAttachmentPrototype, - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *CreateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkAttachmentOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetBareMetalServerNetworkAttachmentPrototype : Allow user to set BareMetalServerNetworkAttachmentPrototype -func (_options *CreateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerNetworkAttachmentPrototype(bareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf) *CreateBareMetalServerNetworkAttachmentOptions { - _options.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkAttachmentOptions { - options.Headers = param - return options -} - -// CreateBareMetalServerNetworkInterfaceOptions : The CreateBareMetalServerNetworkInterface options. -type CreateBareMetalServerNetworkInterfaceOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network interface prototype object. - BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateBareMetalServerNetworkInterfaceOptions : Instantiate CreateBareMetalServerNetworkInterfaceOptions -func (*VpcV1) NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { - return &CreateBareMetalServerNetworkInterfaceOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - BareMetalServerNetworkInterfacePrototype: bareMetalServerNetworkInterfacePrototype, - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetBareMetalServerNetworkInterfacePrototype : Allow user to set BareMetalServerNetworkInterfacePrototype -func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkInterfaceOptions { - options.Headers = param - return options -} - -// CreateBareMetalServerOptions : The CreateBareMetalServer options. -type CreateBareMetalServerOptions struct { - // The bare metal server prototype object. - BareMetalServerPrototype BareMetalServerPrototypeIntf `json:"BareMetalServerPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateBareMetalServerOptions : Instantiate CreateBareMetalServerOptions -func (*VpcV1) NewCreateBareMetalServerOptions(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions { - return &CreateBareMetalServerOptions{ - BareMetalServerPrototype: bareMetalServerPrototype, - } -} - -// SetBareMetalServerPrototype : Allow user to set BareMetalServerPrototype -func (_options *CreateBareMetalServerOptions) SetBareMetalServerPrototype(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions { - _options.BareMetalServerPrototype = bareMetalServerPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateBareMetalServerOptions) SetHeaders(param map[string]string) *CreateBareMetalServerOptions { - options.Headers = param - return options -} - -// CreateDedicatedHostGroupOptions : The CreateDedicatedHostGroup options. -type CreateDedicatedHostGroupOptions struct { - // The dedicated host profile class for hosts in this group. - Class *string `json:"class" validate:"required"` - - // The dedicated host profile family for hosts in this group. - Family *string `json:"family" validate:"required"` - - // The zone this dedicated host group will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateDedicatedHostGroupOptions.Family property. -// The dedicated host profile family for hosts in this group. -const ( - CreateDedicatedHostGroupOptionsFamilyBalancedConst = "balanced" - CreateDedicatedHostGroupOptionsFamilyComputeConst = "compute" - CreateDedicatedHostGroupOptionsFamilyMemoryConst = "memory" -) - -// NewCreateDedicatedHostGroupOptions : Instantiate CreateDedicatedHostGroupOptions -func (*VpcV1) NewCreateDedicatedHostGroupOptions(class string, family string, zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions { - return &CreateDedicatedHostGroupOptions{ - Class: core.StringPtr(class), - Family: core.StringPtr(family), - Zone: zone, - } -} - -// SetClass : Allow user to set Class -func (_options *CreateDedicatedHostGroupOptions) SetClass(class string) *CreateDedicatedHostGroupOptions { - _options.Class = core.StringPtr(class) - return _options -} - -// SetFamily : Allow user to set Family -func (_options *CreateDedicatedHostGroupOptions) SetFamily(family string) *CreateDedicatedHostGroupOptions { - _options.Family = core.StringPtr(family) - return _options -} - -// SetZone : Allow user to set Zone -func (_options *CreateDedicatedHostGroupOptions) SetZone(zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions { - _options.Zone = zone - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateDedicatedHostGroupOptions) SetName(name string) *CreateDedicatedHostGroupOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateDedicatedHostGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateDedicatedHostGroupOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateDedicatedHostGroupOptions) SetHeaders(param map[string]string) *CreateDedicatedHostGroupOptions { - options.Headers = param - return options -} - -// CreateDedicatedHostOptions : The CreateDedicatedHost options. -type CreateDedicatedHostOptions struct { - // The dedicated host prototype object. - DedicatedHostPrototype DedicatedHostPrototypeIntf `json:"DedicatedHostPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateDedicatedHostOptions : Instantiate CreateDedicatedHostOptions -func (*VpcV1) NewCreateDedicatedHostOptions(dedicatedHostPrototype DedicatedHostPrototypeIntf) *CreateDedicatedHostOptions { - return &CreateDedicatedHostOptions{ - DedicatedHostPrototype: dedicatedHostPrototype, - } -} - -// SetDedicatedHostPrototype : Allow user to set DedicatedHostPrototype -func (_options *CreateDedicatedHostOptions) SetDedicatedHostPrototype(dedicatedHostPrototype DedicatedHostPrototypeIntf) *CreateDedicatedHostOptions { - _options.DedicatedHostPrototype = dedicatedHostPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateDedicatedHostOptions) SetHeaders(param map[string]string) *CreateDedicatedHostOptions { - options.Headers = param - return options -} - -// CreateEndpointGatewayOptions : The CreateEndpointGateway options. -type CreateEndpointGatewayOptions struct { - // The target to use for this endpoint gateway. Must not already be the target of another - // endpoint gateway in the VPC. - Target EndpointGatewayTargetPrototypeIntf `json:"target" validate:"required"` - - // The VPC this endpoint gateway will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in - // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. - // - // Must be `true` if the VPC this endpoint gateway resides in has `dns.enable_hub` set to - // `true`. - AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` - - // The reserved IPs to bind to this endpoint gateway. At most one reserved IP per zone is allowed. - Ips []EndpointGatewayReservedIPIntf `json:"ips,omitempty"` - - // The name for this endpoint gateway. The name must not be used by another endpoint gateway in the VPC. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The security groups to use for this endpoint gateway. If unspecified, the VPC's default security group is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateEndpointGatewayOptions : Instantiate CreateEndpointGatewayOptions -func (*VpcV1) NewCreateEndpointGatewayOptions(target EndpointGatewayTargetPrototypeIntf, vpc VPCIdentityIntf) *CreateEndpointGatewayOptions { - return &CreateEndpointGatewayOptions{ - Target: target, - VPC: vpc, - } -} - -// SetTarget : Allow user to set Target -func (_options *CreateEndpointGatewayOptions) SetTarget(target EndpointGatewayTargetPrototypeIntf) *CreateEndpointGatewayOptions { - _options.Target = target - return _options -} - -// SetVPC : Allow user to set VPC -func (_options *CreateEndpointGatewayOptions) SetVPC(vpc VPCIdentityIntf) *CreateEndpointGatewayOptions { - _options.VPC = vpc - return _options -} - -// SetAllowDnsResolutionBinding : Allow user to set AllowDnsResolutionBinding -func (_options *CreateEndpointGatewayOptions) SetAllowDnsResolutionBinding(allowDnsResolutionBinding bool) *CreateEndpointGatewayOptions { - _options.AllowDnsResolutionBinding = core.BoolPtr(allowDnsResolutionBinding) - return _options -} - -// SetIps : Allow user to set Ips -func (_options *CreateEndpointGatewayOptions) SetIps(ips []EndpointGatewayReservedIPIntf) *CreateEndpointGatewayOptions { - _options.Ips = ips - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateEndpointGatewayOptions) SetName(name string) *CreateEndpointGatewayOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateEndpointGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateEndpointGatewayOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetSecurityGroups : Allow user to set SecurityGroups -func (_options *CreateEndpointGatewayOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateEndpointGatewayOptions { - _options.SecurityGroups = securityGroups - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateEndpointGatewayOptions) SetHeaders(param map[string]string) *CreateEndpointGatewayOptions { - options.Headers = param - return options -} - -// CreateFloatingIPOptions : The CreateFloatingIP options. -type CreateFloatingIPOptions struct { - // The floating IP prototype object. - FloatingIPPrototype FloatingIPPrototypeIntf `json:"FloatingIPPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateFloatingIPOptions : Instantiate CreateFloatingIPOptions -func (*VpcV1) NewCreateFloatingIPOptions(floatingIPPrototype FloatingIPPrototypeIntf) *CreateFloatingIPOptions { - return &CreateFloatingIPOptions{ - FloatingIPPrototype: floatingIPPrototype, - } -} - -// SetFloatingIPPrototype : Allow user to set FloatingIPPrototype -func (_options *CreateFloatingIPOptions) SetFloatingIPPrototype(floatingIPPrototype FloatingIPPrototypeIntf) *CreateFloatingIPOptions { - _options.FloatingIPPrototype = floatingIPPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateFloatingIPOptions) SetHeaders(param map[string]string) *CreateFloatingIPOptions { - options.Headers = param - return options -} - -// CreateFlowLogCollectorOptions : The CreateFlowLogCollector options. -type CreateFlowLogCollectorOptions struct { - // The Cloud Object Storage bucket where the collected flows will be logged. - // The bucket must exist and an IAM service authorization must grant - // `IBM Cloud Flow Logs` resources of `VPC Infrastructure Services` writer - // access to the bucket. - 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 - // `false`. - 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 interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // The name for the instance network interface. The name must not be used by another network interface on the virtual - // server instance. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the instance network interface. This can be - // specified using an existing reserved IP, or a prototype object for a new reserved IP. - // - // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the instance network interface's subnet. Otherwise, an - // available address on the subnet will be automatically selected and reserved. - PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The security groups to use for this instance network interface. If unspecified, the VPC's default security group is - // used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateInstanceNetworkInterfaceOptions : Instantiate CreateInstanceNetworkInterfaceOptions -func (*VpcV1) NewCreateInstanceNetworkInterfaceOptions(instanceID string, subnet SubnetIdentityIntf) *CreateInstanceNetworkInterfaceOptions { - return &CreateInstanceNetworkInterfaceOptions{ - InstanceID: core.StringPtr(instanceID), - Subnet: subnet, - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *CreateInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *CreateInstanceNetworkInterfaceOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetSubnet : Allow user to set Subnet -func (_options *CreateInstanceNetworkInterfaceOptions) SetSubnet(subnet SubnetIdentityIntf) *CreateInstanceNetworkInterfaceOptions { - _options.Subnet = subnet - return _options -} - -// SetAllowIPSpoofing : Allow user to set AllowIPSpoofing -func (_options *CreateInstanceNetworkInterfaceOptions) SetAllowIPSpoofing(allowIPSpoofing bool) *CreateInstanceNetworkInterfaceOptions { - _options.AllowIPSpoofing = core.BoolPtr(allowIPSpoofing) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateInstanceNetworkInterfaceOptions) SetName(name string) *CreateInstanceNetworkInterfaceOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetPrimaryIP : Allow user to set PrimaryIP -func (_options *CreateInstanceNetworkInterfaceOptions) SetPrimaryIP(primaryIP NetworkInterfaceIPPrototypeIntf) *CreateInstanceNetworkInterfaceOptions { - _options.PrimaryIP = primaryIP - return _options -} - -// SetSecurityGroups : Allow user to set SecurityGroups -func (_options *CreateInstanceNetworkInterfaceOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateInstanceNetworkInterfaceOptions { - _options.SecurityGroups = securityGroups - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateInstanceNetworkInterfaceOptions { - options.Headers = param - return options -} - -// CreateInstanceOptions : The CreateInstance options. -type CreateInstanceOptions struct { - // The instance prototype object. - InstancePrototype InstancePrototypeIntf `json:"InstancePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateInstanceOptions : Instantiate CreateInstanceOptions -func (*VpcV1) NewCreateInstanceOptions(instancePrototype InstancePrototypeIntf) *CreateInstanceOptions { - return &CreateInstanceOptions{ - InstancePrototype: instancePrototype, - } -} - -// SetInstancePrototype : Allow user to set InstancePrototype -func (_options *CreateInstanceOptions) SetInstancePrototype(instancePrototype InstancePrototypeIntf) *CreateInstanceOptions { - _options.InstancePrototype = instancePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceOptions) SetHeaders(param map[string]string) *CreateInstanceOptions { - options.Headers = param - return options -} - -// CreateInstanceTemplateOptions : The CreateInstanceTemplate options. -type CreateInstanceTemplateOptions struct { - // The instance template prototype object. - InstanceTemplatePrototype InstanceTemplatePrototypeIntf `json:"InstanceTemplatePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateInstanceTemplateOptions : Instantiate CreateInstanceTemplateOptions -func (*VpcV1) NewCreateInstanceTemplateOptions(instanceTemplatePrototype InstanceTemplatePrototypeIntf) *CreateInstanceTemplateOptions { - return &CreateInstanceTemplateOptions{ - InstanceTemplatePrototype: instanceTemplatePrototype, - } -} - -// SetInstanceTemplatePrototype : Allow user to set InstanceTemplatePrototype -func (_options *CreateInstanceTemplateOptions) SetInstanceTemplatePrototype(instanceTemplatePrototype InstanceTemplatePrototypeIntf) *CreateInstanceTemplateOptions { - _options.InstanceTemplatePrototype = instanceTemplatePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceTemplateOptions) SetHeaders(param map[string]string) *CreateInstanceTemplateOptions { - options.Headers = param - return options -} - -// CreateInstanceVolumeAttachmentOptions : The CreateInstanceVolumeAttachment options. -type CreateInstanceVolumeAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // An existing volume to attach to the instance, or a prototype object for a new volume. - Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"` - - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - - // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateInstanceVolumeAttachmentOptions : Instantiate CreateInstanceVolumeAttachmentOptions -func (*VpcV1) NewCreateInstanceVolumeAttachmentOptions(instanceID string, volume VolumeAttachmentPrototypeVolumeIntf) *CreateInstanceVolumeAttachmentOptions { - return &CreateInstanceVolumeAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - Volume: volume, - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *CreateInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *CreateInstanceVolumeAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetVolume : Allow user to set Volume -func (_options *CreateInstanceVolumeAttachmentOptions) SetVolume(volume VolumeAttachmentPrototypeVolumeIntf) *CreateInstanceVolumeAttachmentOptions { - _options.Volume = volume - return _options -} - -// SetDeleteVolumeOnInstanceDelete : Allow user to set DeleteVolumeOnInstanceDelete -func (_options *CreateInstanceVolumeAttachmentOptions) SetDeleteVolumeOnInstanceDelete(deleteVolumeOnInstanceDelete bool) *CreateInstanceVolumeAttachmentOptions { - _options.DeleteVolumeOnInstanceDelete = core.BoolPtr(deleteVolumeOnInstanceDelete) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateInstanceVolumeAttachmentOptions) SetName(name string) *CreateInstanceVolumeAttachmentOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *CreateInstanceVolumeAttachmentOptions { - options.Headers = param - return options -} - -// CreateIpsecPolicyOptions : The CreateIpsecPolicy options. -type CreateIpsecPolicyOptions struct { - // The authentication algorithm - // - // Must be `disabled` if and only if the `encryption_algorithm` is - // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. - AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` - - // The encryption algorithm - // - // The `authentication_algorithm` must be `disabled` if and only if - // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or - // `aes256gcm16`. - EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` - - // Perfect Forward Secrecy. - Pfs *string `json:"pfs" validate:"required"` - - // The key lifetime in seconds. - KeyLifetime *int64 `json:"key_lifetime,omitempty"` - - // The name for this IPsec policy. The name must not be used by another IPsec policies in the region. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateIpsecPolicyOptions.AuthenticationAlgorithm property. -// The authentication algorithm -// -// Must be `disabled` if and only if the `encryption_algorithm` is -// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. -const ( - CreateIpsecPolicyOptionsAuthenticationAlgorithmDisabledConst = "disabled" - CreateIpsecPolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" - CreateIpsecPolicyOptionsAuthenticationAlgorithmSha384Const = "sha384" - CreateIpsecPolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" -) - -// Constants associated with the CreateIpsecPolicyOptions.EncryptionAlgorithm property. -// The encryption algorithm -// -// The `authentication_algorithm` must be `disabled` if and only if -// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or -// `aes256gcm16`. -const ( - CreateIpsecPolicyOptionsEncryptionAlgorithmAes128Const = "aes128" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes192Const = "aes192" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes256Const = "aes256" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" -) - -// Constants associated with the CreateIpsecPolicyOptions.Pfs property. -// Perfect Forward Secrecy. -const ( - CreateIpsecPolicyOptionsPfsDisabledConst = "disabled" - CreateIpsecPolicyOptionsPfsGroup14Const = "group_14" - CreateIpsecPolicyOptionsPfsGroup15Const = "group_15" - CreateIpsecPolicyOptionsPfsGroup16Const = "group_16" - CreateIpsecPolicyOptionsPfsGroup17Const = "group_17" - CreateIpsecPolicyOptionsPfsGroup18Const = "group_18" - CreateIpsecPolicyOptionsPfsGroup19Const = "group_19" - CreateIpsecPolicyOptionsPfsGroup20Const = "group_20" - CreateIpsecPolicyOptionsPfsGroup21Const = "group_21" - CreateIpsecPolicyOptionsPfsGroup22Const = "group_22" - CreateIpsecPolicyOptionsPfsGroup23Const = "group_23" - CreateIpsecPolicyOptionsPfsGroup24Const = "group_24" - CreateIpsecPolicyOptionsPfsGroup31Const = "group_31" -) - -// NewCreateIpsecPolicyOptions : Instantiate CreateIpsecPolicyOptions -func (*VpcV1) NewCreateIpsecPolicyOptions(authenticationAlgorithm string, encryptionAlgorithm string, pfs string) *CreateIpsecPolicyOptions { - return &CreateIpsecPolicyOptions{ - AuthenticationAlgorithm: core.StringPtr(authenticationAlgorithm), - EncryptionAlgorithm: core.StringPtr(encryptionAlgorithm), - Pfs: core.StringPtr(pfs), - } -} - -// SetAuthenticationAlgorithm : Allow user to set AuthenticationAlgorithm -func (_options *CreateIpsecPolicyOptions) SetAuthenticationAlgorithm(authenticationAlgorithm string) *CreateIpsecPolicyOptions { - _options.AuthenticationAlgorithm = core.StringPtr(authenticationAlgorithm) - return _options -} - -// SetEncryptionAlgorithm : Allow user to set EncryptionAlgorithm -func (_options *CreateIpsecPolicyOptions) SetEncryptionAlgorithm(encryptionAlgorithm string) *CreateIpsecPolicyOptions { - _options.EncryptionAlgorithm = core.StringPtr(encryptionAlgorithm) - return _options -} - -// SetPfs : Allow user to set Pfs -func (_options *CreateIpsecPolicyOptions) SetPfs(pfs string) *CreateIpsecPolicyOptions { - _options.Pfs = core.StringPtr(pfs) - return _options -} - -// SetKeyLifetime : Allow user to set KeyLifetime -func (_options *CreateIpsecPolicyOptions) SetKeyLifetime(keyLifetime int64) *CreateIpsecPolicyOptions { - _options.KeyLifetime = core.Int64Ptr(keyLifetime) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateIpsecPolicyOptions) SetName(name string) *CreateIpsecPolicyOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateIpsecPolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateIpsecPolicyOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateIpsecPolicyOptions) SetHeaders(param map[string]string) *CreateIpsecPolicyOptions { - options.Headers = param - return options -} - -// CreateKeyOptions : The CreateKey options. -type CreateKeyOptions struct { - // A unique public SSH key to import, in OpenSSH format (consisting of three space-separated fields: the algorithm - // name, base64-encoded key, and a comment). The algorithm and comment fields may be omitted, as only the key field is - // imported. - // - // Keys of type `rsa` may be 2048 or 4096 bits in length, however 4096 is recommended. Keys of type `ed25519` are 256 - // bits in length. - PublicKey *string `json:"public_key" validate:"required"` - - // The name for this key. The name must not be used by another key in the region. If unspecified, the name will be a - // hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The crypto-system used by this key. - Type *string `json:"type,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateKeyOptions.Type property. -// The crypto-system used by this key. -const ( - CreateKeyOptionsTypeEd25519Const = "ed25519" - CreateKeyOptionsTypeRsaConst = "rsa" -) - -// NewCreateKeyOptions : Instantiate CreateKeyOptions -func (*VpcV1) NewCreateKeyOptions(publicKey string) *CreateKeyOptions { - return &CreateKeyOptions{ - PublicKey: core.StringPtr(publicKey), - } -} - -// SetPublicKey : Allow user to set PublicKey -func (_options *CreateKeyOptions) SetPublicKey(publicKey string) *CreateKeyOptions { - _options.PublicKey = core.StringPtr(publicKey) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateKeyOptions) SetName(name string) *CreateKeyOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateKeyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateKeyOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetType : Allow user to set Type -func (_options *CreateKeyOptions) SetType(typeVar string) *CreateKeyOptions { - _options.Type = core.StringPtr(typeVar) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateKeyOptions) SetHeaders(param map[string]string) *CreateKeyOptions { - options.Headers = param - return options -} - -// CreateLoadBalancerListenerOptions : The CreateLoadBalancerListener options. -type CreateLoadBalancerListenerOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. - // - // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the - // `application` family support `tcp`, `http` and - // `https`. - // - // Additional restrictions: - // - If `default_pool` is set, the pool's protocol must match, or be compatible with - // the listener's protocol. At present, the compatible protocols are `http` and - // `https`. - // - If `https_redirect` is set, the protocol must be `http`. - Protocol *string `json:"protocol" validate:"required"` - - // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in - // the `application` family (otherwise always `false`). Additional restrictions: - // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must - // match the `accept_proxy_protocol` value of the `https_redirect` listener. - // - If this listener is the target of another listener's `https_redirect`, its - // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. - AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` - - // The certificate instance to use for SSL termination. The listener must have a - // `protocol` of `https`. - CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` - - // The connection limit of the listener. - ConnectionLimit *int64 `json:"connection_limit,omitempty"` - - // The default pool for this listener. If specified, the pool must: - // - Belong to this load balancer. - // - Have the same `protocol` as this listener, or have a compatible protocol. - // At present, the compatible protocols are `http` and `https`. - // - Not already be the `default_pool` for another listener. - // - // If unspecified, this listener will be created with no default pool, but one may be - // subsequently set. - DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` - - // The target listener that requests will be redirected to. This listener must have a - // `protocol` of `http`, and the target listener must have a `protocol` of `https`. - HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPrototype `json:"https_redirect,omitempty"` - - // The idle connection timeout of the listener in seconds. Supported for load balancers in the `application` family. - IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` - - // The policy prototype objects for this listener. The load balancer must be in the - // `application` family. - Policies []LoadBalancerListenerPolicyPrototype `json:"policies,omitempty"` - - // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must - // have a unique `port` and `protocol` combination. - // - // Not supported for load balancers operating with route mode enabled. - Port *int64 `json:"port,omitempty"` - - // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. - // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `65535` must be specified. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. - // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `1` must be specified. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. - PortMin *int64 `json:"port_min,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateLoadBalancerListenerOptions.Protocol property. -// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. -// -// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the -// `application` family support `tcp`, `http` and -// `https`. -// -// Additional restrictions: -// - If `default_pool` is set, the pool's protocol must match, or be compatible with -// the listener's protocol. At present, the compatible protocols are `http` and -// `https`. -// - If `https_redirect` is set, the protocol must be `http`. -const ( - CreateLoadBalancerListenerOptionsProtocolHTTPConst = "http" - CreateLoadBalancerListenerOptionsProtocolHTTPSConst = "https" - CreateLoadBalancerListenerOptionsProtocolTCPConst = "tcp" - CreateLoadBalancerListenerOptionsProtocolUDPConst = "udp" -) - -// NewCreateLoadBalancerListenerOptions : Instantiate CreateLoadBalancerListenerOptions -func (*VpcV1) NewCreateLoadBalancerListenerOptions(loadBalancerID string, protocol string) *CreateLoadBalancerListenerOptions { - return &CreateLoadBalancerListenerOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - Protocol: core.StringPtr(protocol), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *CreateLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetProtocol : Allow user to set Protocol -func (_options *CreateLoadBalancerListenerOptions) SetProtocol(protocol string) *CreateLoadBalancerListenerOptions { - _options.Protocol = core.StringPtr(protocol) - return _options -} - -// SetAcceptProxyProtocol : Allow user to set AcceptProxyProtocol -func (_options *CreateLoadBalancerListenerOptions) SetAcceptProxyProtocol(acceptProxyProtocol bool) *CreateLoadBalancerListenerOptions { - _options.AcceptProxyProtocol = core.BoolPtr(acceptProxyProtocol) - return _options -} - -// SetCertificateInstance : Allow user to set CertificateInstance -func (_options *CreateLoadBalancerListenerOptions) SetCertificateInstance(certificateInstance CertificateInstanceIdentityIntf) *CreateLoadBalancerListenerOptions { - _options.CertificateInstance = certificateInstance - return _options -} - -// SetConnectionLimit : Allow user to set ConnectionLimit -func (_options *CreateLoadBalancerListenerOptions) SetConnectionLimit(connectionLimit int64) *CreateLoadBalancerListenerOptions { - _options.ConnectionLimit = core.Int64Ptr(connectionLimit) - return _options -} - -// SetDefaultPool : Allow user to set DefaultPool -func (_options *CreateLoadBalancerListenerOptions) SetDefaultPool(defaultPool LoadBalancerPoolIdentityIntf) *CreateLoadBalancerListenerOptions { - _options.DefaultPool = defaultPool - return _options -} - -// SetHTTPSRedirect : Allow user to set HTTPSRedirect -func (_options *CreateLoadBalancerListenerOptions) SetHTTPSRedirect(httpsRedirect *LoadBalancerListenerHTTPSRedirectPrototype) *CreateLoadBalancerListenerOptions { - _options.HTTPSRedirect = httpsRedirect - return _options -} - -// SetIdleConnectionTimeout : Allow user to set IdleConnectionTimeout -func (_options *CreateLoadBalancerListenerOptions) SetIdleConnectionTimeout(idleConnectionTimeout int64) *CreateLoadBalancerListenerOptions { - _options.IdleConnectionTimeout = core.Int64Ptr(idleConnectionTimeout) - return _options -} - -// SetPolicies : Allow user to set Policies -func (_options *CreateLoadBalancerListenerOptions) SetPolicies(policies []LoadBalancerListenerPolicyPrototype) *CreateLoadBalancerListenerOptions { - _options.Policies = policies - return _options -} - -// SetPort : Allow user to set Port -func (_options *CreateLoadBalancerListenerOptions) SetPort(port int64) *CreateLoadBalancerListenerOptions { - _options.Port = core.Int64Ptr(port) - return _options -} - -// SetPortMax : Allow user to set PortMax -func (_options *CreateLoadBalancerListenerOptions) SetPortMax(portMax int64) *CreateLoadBalancerListenerOptions { - _options.PortMax = core.Int64Ptr(portMax) - return _options -} - -// SetPortMin : Allow user to set PortMin -func (_options *CreateLoadBalancerListenerOptions) SetPortMin(portMin int64) *CreateLoadBalancerListenerOptions { - _options.PortMin = core.Int64Ptr(portMin) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateLoadBalancerListenerOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerOptions { - options.Headers = param - return options -} - -// CreateLoadBalancerListenerPolicyOptions : The CreateLoadBalancerListenerPolicy options. -type CreateLoadBalancerListenerPolicyOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy action. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the - // unexpected property value was encountered. - Action *string `json:"action" validate:"required"` - - // Priority of the policy. Lower value indicates higher priority. - Priority *int64 `json:"priority" validate:"required"` - - // The name for this policy. The name must not be used by another policy for the load balancer listener. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The rule prototype objects for this policy. - Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` - - // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. - // - If `action` is `https_redirect`, specify a - // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. - Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateLoadBalancerListenerPolicyOptions.Action property. -// The policy action. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the -// unexpected property value was encountered. -const ( - CreateLoadBalancerListenerPolicyOptionsActionForwardConst = "forward" - CreateLoadBalancerListenerPolicyOptionsActionHTTPSRedirectConst = "https_redirect" - CreateLoadBalancerListenerPolicyOptionsActionRedirectConst = "redirect" - CreateLoadBalancerListenerPolicyOptionsActionRejectConst = "reject" -) - -// NewCreateLoadBalancerListenerPolicyOptions : Instantiate CreateLoadBalancerListenerPolicyOptions -func (*VpcV1) NewCreateLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, action string, priority int64) *CreateLoadBalancerListenerPolicyOptions { - return &CreateLoadBalancerListenerPolicyOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - Action: core.StringPtr(action), - Priority: core.Int64Ptr(priority), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *CreateLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerPolicyOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *CreateLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *CreateLoadBalancerListenerPolicyOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetAction : Allow user to set Action -func (_options *CreateLoadBalancerListenerPolicyOptions) SetAction(action string) *CreateLoadBalancerListenerPolicyOptions { - _options.Action = core.StringPtr(action) - return _options -} - -// SetPriority : Allow user to set Priority -func (_options *CreateLoadBalancerListenerPolicyOptions) SetPriority(priority int64) *CreateLoadBalancerListenerPolicyOptions { - _options.Priority = core.Int64Ptr(priority) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateLoadBalancerListenerPolicyOptions) SetName(name string) *CreateLoadBalancerListenerPolicyOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetRules : Allow user to set Rules -func (_options *CreateLoadBalancerListenerPolicyOptions) SetRules(rules []LoadBalancerListenerPolicyRulePrototype) *CreateLoadBalancerListenerPolicyOptions { - _options.Rules = rules - return _options -} - -// SetTarget : Allow user to set Target -func (_options *CreateLoadBalancerListenerPolicyOptions) SetTarget(target LoadBalancerListenerPolicyTargetPrototypeIntf) *CreateLoadBalancerListenerPolicyOptions { - _options.Target = target - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerPolicyOptions { - options.Headers = param - return options -} - -// CreateLoadBalancerListenerPolicyRuleOptions : The CreateLoadBalancerListenerPolicyRule options. -type CreateLoadBalancerListenerPolicyRuleOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - PolicyID *string `json:"policy_id" validate:"required,ne="` - - // The condition of the rule. - Condition *string `json:"condition" validate:"required"` - - // The type of the rule. - // - // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. - Type *string `json:"type" validate:"required"` - - // Value to be matched for rule condition. - // - // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. - Value *string `json:"value" validate:"required"` - - // The field. This is applicable to `header`, `query`, and `body` rule types. - // - // If the rule type is `header`, this property is required. - // - // If the rule type is `query`, this is optional. If specified and the rule condition is not - // `matches_regex`, the value must be percent-encoded. - // - // If the rule type is `body`, this is optional. - Field *string `json:"field,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Condition property. -// The condition of the rule. -const ( - CreateLoadBalancerListenerPolicyRuleOptionsConditionContainsConst = "contains" - CreateLoadBalancerListenerPolicyRuleOptionsConditionEqualsConst = "equals" - CreateLoadBalancerListenerPolicyRuleOptionsConditionMatchesRegexConst = "matches_regex" -) - -// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Type property. -// The type of the rule. -// -// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. -const ( - CreateLoadBalancerListenerPolicyRuleOptionsTypeBodyConst = "body" - CreateLoadBalancerListenerPolicyRuleOptionsTypeHeaderConst = "header" - CreateLoadBalancerListenerPolicyRuleOptionsTypeHostnameConst = "hostname" - CreateLoadBalancerListenerPolicyRuleOptionsTypePathConst = "path" - CreateLoadBalancerListenerPolicyRuleOptionsTypeQueryConst = "query" -) - -// NewCreateLoadBalancerListenerPolicyRuleOptions : Instantiate CreateLoadBalancerListenerPolicyRuleOptions -func (*VpcV1) NewCreateLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, condition string, typeVar string, value string) *CreateLoadBalancerListenerPolicyRuleOptions { - return &CreateLoadBalancerListenerPolicyRuleOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - PolicyID: core.StringPtr(policyID), - Condition: core.StringPtr(condition), - Type: core.StringPtr(typeVar), - Value: core.StringPtr(value), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetPolicyID : Allow user to set PolicyID -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.PolicyID = core.StringPtr(policyID) - return _options -} - -// SetCondition : Allow user to set Condition -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetCondition(condition string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.Condition = core.StringPtr(condition) - return _options -} - -// SetType : Allow user to set Type -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetType(typeVar string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.Type = core.StringPtr(typeVar) - return _options -} - -// SetValue : Allow user to set Value -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetValue(value string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.Value = core.StringPtr(value) - return _options -} - -// SetField : Allow user to set Field -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetField(field string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.Field = core.StringPtr(field) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerPolicyRuleOptions { - options.Headers = param - return options -} - -// CreateLoadBalancerOptions : The CreateLoadBalancer options. -type CreateLoadBalancerOptions struct { - // Indicates whether this load balancer is public. - // - // At present, if route mode is enabled, the load balancer must not be public. - IsPublic *bool `json:"is_public" validate:"required"` - - // The subnets to provision this load balancer in. The subnets must be in the same VPC. The load balancer's - // availability will depend on the availability of the zones that the subnets reside in. - // - // Load balancers in the `network` family allow only one subnet to be specified. - Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` - - // The datapath logging configuration for this load balancer. - Datapath *LoadBalancerLoggingDatapathPrototype `json:"datapath,omitempty"` - - // The DNS configuration for this load balancer. - // - // If unspecified, DNS `A` records for this load balancer's `hostname` property will be added - // to the public DNS zone `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be - // added to the specified `zone`. - Dns *LoadBalancerDnsPrototype `json:"dns,omitempty"` - - // The listeners of this load balancer. - Listeners []LoadBalancerListenerPrototypeLoadBalancerContext `json:"listeners,omitempty"` - - // The logging configuration to use for this load balancer. See [VPC Datapath - // Logging](https://cloud.ibm.com/docs/vpc?topic=vpc-datapath-logging) on the logging - // format, fields and permitted values. - // - // To activate logging, the load balancer profile must support the specified logging type. - Logging *LoadBalancerLoggingPrototype `json:"logging,omitempty"` - - // The name for this load balancer. The name must not be used by another load balancer in the VPC. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The pools of this load balancer. - Pools []LoadBalancerPoolPrototype `json:"pools,omitempty"` - - // The profile to use for this load balancer. - // - // If unspecified, `application` will be used. - Profile LoadBalancerProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // Indicates whether route mode is enabled for this load balancer. - // - // At present, public load balancers are not supported with route mode enabled. - RouteMode *bool `json:"route_mode,omitempty"` - - // The security groups to use for this load balancer. If unspecified, the VPC's default security group is used. - // - // The load balancer profile must support security groups. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateLoadBalancerOptions : Instantiate CreateLoadBalancerOptions -func (*VpcV1) NewCreateLoadBalancerOptions(isPublic bool, subnets []SubnetIdentityIntf) *CreateLoadBalancerOptions { - return &CreateLoadBalancerOptions{ - IsPublic: core.BoolPtr(isPublic), - Subnets: subnets, - } -} - -// SetIsPublic : Allow user to set IsPublic -func (_options *CreateLoadBalancerOptions) SetIsPublic(isPublic bool) *CreateLoadBalancerOptions { - _options.IsPublic = core.BoolPtr(isPublic) - return _options -} - -// SetSubnets : Allow user to set Subnets -func (_options *CreateLoadBalancerOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateLoadBalancerOptions { - _options.Subnets = subnets - return _options -} - -// SetDatapath : Allow user to set Datapath -func (_options *CreateLoadBalancerOptions) SetDatapath(datapath *LoadBalancerLoggingDatapathPrototype) *CreateLoadBalancerOptions { - _options.Datapath = datapath - return _options -} - -// SetDns : Allow user to set Dns -func (_options *CreateLoadBalancerOptions) SetDns(dns *LoadBalancerDnsPrototype) *CreateLoadBalancerOptions { - _options.Dns = dns - return _options -} - -// SetListeners : Allow user to set Listeners -func (_options *CreateLoadBalancerOptions) SetListeners(listeners []LoadBalancerListenerPrototypeLoadBalancerContext) *CreateLoadBalancerOptions { - _options.Listeners = listeners - return _options -} - -// SetLogging : Allow user to set Logging -func (_options *CreateLoadBalancerOptions) SetLogging(logging *LoadBalancerLoggingPrototype) *CreateLoadBalancerOptions { - _options.Logging = logging - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateLoadBalancerOptions) SetName(name string) *CreateLoadBalancerOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetPools : Allow user to set Pools -func (_options *CreateLoadBalancerOptions) SetPools(pools []LoadBalancerPoolPrototype) *CreateLoadBalancerOptions { - _options.Pools = pools - return _options -} - -// SetProfile : Allow user to set Profile -func (_options *CreateLoadBalancerOptions) SetProfile(profile LoadBalancerProfileIdentityIntf) *CreateLoadBalancerOptions { - _options.Profile = profile - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateLoadBalancerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateLoadBalancerOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetRouteMode : Allow user to set RouteMode -func (_options *CreateLoadBalancerOptions) SetRouteMode(routeMode bool) *CreateLoadBalancerOptions { - _options.RouteMode = core.BoolPtr(routeMode) - return _options -} - -// SetSecurityGroups : Allow user to set SecurityGroups -func (_options *CreateLoadBalancerOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateLoadBalancerOptions { - _options.SecurityGroups = securityGroups - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateLoadBalancerOptions) SetHeaders(param map[string]string) *CreateLoadBalancerOptions { - options.Headers = param - return options -} - -// CreateLoadBalancerPoolMemberOptions : The CreateLoadBalancerPoolMember options. -type CreateLoadBalancerPoolMemberOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - PoolID *string `json:"pool_id" validate:"required,ne="` - - // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a - // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive - // the traffic on the same port the listener received it on.) - // - // This port will also be used for health checks unless the `port` property of - // `health_monitor` property is specified. - // - // The port must be unique across all members for all pools associated with this pool's listener. - Port *int64 `json:"port" validate:"required"` - - // The pool member target. Load balancers in the `network` family support virtual server - // instances. Load balancers in the `application` family support IP addresses. If the load - // balancer has route mode enabled, the member must be in a zone the load balancer has a - // subnet in. - Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` - - // Weight of the server member. Applicable only if the pool algorithm is - // `weighted_round_robin`. - Weight *int64 `json:"weight,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateLoadBalancerPoolMemberOptions : Instantiate CreateLoadBalancerPoolMemberOptions -func (*VpcV1) NewCreateLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, port int64, target LoadBalancerPoolMemberTargetPrototypeIntf) *CreateLoadBalancerPoolMemberOptions { - return &CreateLoadBalancerPoolMemberOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - PoolID: core.StringPtr(poolID), - Port: core.Int64Ptr(port), - Target: target, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *CreateLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerPoolMemberOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetPoolID : Allow user to set PoolID -func (_options *CreateLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *CreateLoadBalancerPoolMemberOptions { - _options.PoolID = core.StringPtr(poolID) - return _options -} - -// SetPort : Allow user to set Port -func (_options *CreateLoadBalancerPoolMemberOptions) SetPort(port int64) *CreateLoadBalancerPoolMemberOptions { - _options.Port = core.Int64Ptr(port) - return _options -} - -// SetTarget : Allow user to set Target -func (_options *CreateLoadBalancerPoolMemberOptions) SetTarget(target LoadBalancerPoolMemberTargetPrototypeIntf) *CreateLoadBalancerPoolMemberOptions { - _options.Target = target - return _options -} - -// SetWeight : Allow user to set Weight -func (_options *CreateLoadBalancerPoolMemberOptions) SetWeight(weight int64) *CreateLoadBalancerPoolMemberOptions { - _options.Weight = core.Int64Ptr(weight) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *CreateLoadBalancerPoolMemberOptions { - options.Headers = param - return options -} - -// CreateLoadBalancerPoolOptions : The CreateLoadBalancerPool options. -type CreateLoadBalancerPoolOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The load balancing algorithm. - Algorithm *string `json:"algorithm" validate:"required"` - - // The health monitor of this pool. - HealthMonitor *LoadBalancerPoolHealthMonitorPrototype `json:"health_monitor" validate:"required"` - - // The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if - // `udp_supported` is `true`). Load balancers in the - // `application` family support `tcp`, `http`, and `https`. - Protocol *string `json:"protocol" validate:"required"` - - // The members for this load balancer pool. For load balancers in the `network` family, the same `port` and `target` - // tuple cannot be shared by a pool member of any other load balancer in the same VPC. - Members []LoadBalancerPoolMemberPrototype `json:"members,omitempty"` - - // The name for this load balancer pool. The name must not be used by another pool for the load balancer. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The PROXY protocol setting for this pool: - // - `v1`: Enabled with version 1 (human-readable header format) - // - `v2`: Enabled with version 2 (binary header format) - // - `disabled`: Disabled - // - // Supported by load balancers in the `application` family (otherwise always `disabled`). - ProxyProtocol *string `json:"proxy_protocol,omitempty"` - - // The session persistence of this pool. - SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateLoadBalancerPoolOptions.Algorithm property. -// The load balancing algorithm. -const ( - CreateLoadBalancerPoolOptionsAlgorithmLeastConnectionsConst = "least_connections" - CreateLoadBalancerPoolOptionsAlgorithmRoundRobinConst = "round_robin" - CreateLoadBalancerPoolOptionsAlgorithmWeightedRoundRobinConst = "weighted_round_robin" -) - -// Constants associated with the CreateLoadBalancerPoolOptions.Protocol property. -// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if -// `udp_supported` is `true`). Load balancers in the -// `application` family support `tcp`, `http`, and `https`. -const ( - CreateLoadBalancerPoolOptionsProtocolHTTPConst = "http" - CreateLoadBalancerPoolOptionsProtocolHTTPSConst = "https" - CreateLoadBalancerPoolOptionsProtocolTCPConst = "tcp" - CreateLoadBalancerPoolOptionsProtocolUDPConst = "udp" -) - -// Constants associated with the CreateLoadBalancerPoolOptions.ProxyProtocol property. -// The PROXY protocol setting for this pool: -// - `v1`: Enabled with version 1 (human-readable header format) -// - `v2`: Enabled with version 2 (binary header format) -// - `disabled`: Disabled -// -// Supported by load balancers in the `application` family (otherwise always `disabled`). -const ( - CreateLoadBalancerPoolOptionsProxyProtocolDisabledConst = "disabled" - CreateLoadBalancerPoolOptionsProxyProtocolV1Const = "v1" - CreateLoadBalancerPoolOptionsProxyProtocolV2Const = "v2" -) - -// NewCreateLoadBalancerPoolOptions : Instantiate CreateLoadBalancerPoolOptions -func (*VpcV1) NewCreateLoadBalancerPoolOptions(loadBalancerID string, algorithm string, healthMonitor *LoadBalancerPoolHealthMonitorPrototype, protocol string) *CreateLoadBalancerPoolOptions { - return &CreateLoadBalancerPoolOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - Algorithm: core.StringPtr(algorithm), - HealthMonitor: healthMonitor, - Protocol: core.StringPtr(protocol), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *CreateLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerPoolOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetAlgorithm : Allow user to set Algorithm -func (_options *CreateLoadBalancerPoolOptions) SetAlgorithm(algorithm string) *CreateLoadBalancerPoolOptions { - _options.Algorithm = core.StringPtr(algorithm) - return _options -} - -// SetHealthMonitor : Allow user to set HealthMonitor -func (_options *CreateLoadBalancerPoolOptions) SetHealthMonitor(healthMonitor *LoadBalancerPoolHealthMonitorPrototype) *CreateLoadBalancerPoolOptions { - _options.HealthMonitor = healthMonitor - return _options -} - -// SetProtocol : Allow user to set Protocol -func (_options *CreateLoadBalancerPoolOptions) SetProtocol(protocol string) *CreateLoadBalancerPoolOptions { - _options.Protocol = core.StringPtr(protocol) - return _options -} - -// SetMembers : Allow user to set Members -func (_options *CreateLoadBalancerPoolOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *CreateLoadBalancerPoolOptions { - _options.Members = members - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateLoadBalancerPoolOptions) SetName(name string) *CreateLoadBalancerPoolOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetProxyProtocol : Allow user to set ProxyProtocol -func (_options *CreateLoadBalancerPoolOptions) SetProxyProtocol(proxyProtocol string) *CreateLoadBalancerPoolOptions { - _options.ProxyProtocol = core.StringPtr(proxyProtocol) - return _options -} - -// SetSessionPersistence : Allow user to set SessionPersistence -func (_options *CreateLoadBalancerPoolOptions) SetSessionPersistence(sessionPersistence *LoadBalancerPoolSessionPersistencePrototype) *CreateLoadBalancerPoolOptions { - _options.SessionPersistence = sessionPersistence - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateLoadBalancerPoolOptions) SetHeaders(param map[string]string) *CreateLoadBalancerPoolOptions { - options.Headers = param - return options -} - -// CreateNetworkACLOptions : The CreateNetworkACL options. -type CreateNetworkACLOptions struct { - // The network ACL prototype object. - NetworkACLPrototype NetworkACLPrototypeIntf `json:"NetworkACLPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateNetworkACLOptions : Instantiate CreateNetworkACLOptions -func (*VpcV1) NewCreateNetworkACLOptions(networkACLPrototype NetworkACLPrototypeIntf) *CreateNetworkACLOptions { - return &CreateNetworkACLOptions{ - NetworkACLPrototype: networkACLPrototype, - } -} - -// SetNetworkACLPrototype : Allow user to set NetworkACLPrototype -func (_options *CreateNetworkACLOptions) SetNetworkACLPrototype(networkACLPrototype NetworkACLPrototypeIntf) *CreateNetworkACLOptions { - _options.NetworkACLPrototype = networkACLPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateNetworkACLOptions) SetHeaders(param map[string]string) *CreateNetworkACLOptions { - options.Headers = param - return options -} - -// CreateNetworkACLRuleOptions : The CreateNetworkACLRule options. -type CreateNetworkACLRuleOptions struct { - // The network ACL identifier. - NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` - - // The network ACL rule prototype object. - NetworkACLRulePrototype NetworkACLRulePrototypeIntf `json:"NetworkACLRulePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateNetworkACLRuleOptions : Instantiate CreateNetworkACLRuleOptions -func (*VpcV1) NewCreateNetworkACLRuleOptions(networkACLID string, networkACLRulePrototype NetworkACLRulePrototypeIntf) *CreateNetworkACLRuleOptions { - return &CreateNetworkACLRuleOptions{ - NetworkACLID: core.StringPtr(networkACLID), - NetworkACLRulePrototype: networkACLRulePrototype, - } -} - -// SetNetworkACLID : Allow user to set NetworkACLID -func (_options *CreateNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *CreateNetworkACLRuleOptions { - _options.NetworkACLID = core.StringPtr(networkACLID) - return _options -} - -// SetNetworkACLRulePrototype : Allow user to set NetworkACLRulePrototype -func (_options *CreateNetworkACLRuleOptions) SetNetworkACLRulePrototype(networkACLRulePrototype NetworkACLRulePrototypeIntf) *CreateNetworkACLRuleOptions { - _options.NetworkACLRulePrototype = networkACLRulePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateNetworkACLRuleOptions) SetHeaders(param map[string]string) *CreateNetworkACLRuleOptions { - options.Headers = param - return options -} - -// CreatePlacementGroupOptions : The CreatePlacementGroup options. -type CreatePlacementGroupOptions struct { - // The strategy for this placement group - // - `host_spread`: place on different compute hosts - // - `power_spread`: place on compute hosts that use different power sources - // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the - // unexpected strategy was encountered. - Strategy *string `json:"strategy" validate:"required"` - - // The name for this placement group. The name must not be used by another placement group in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreatePlacementGroupOptions.Strategy property. -// The strategy for this placement group -// - `host_spread`: place on different compute hosts -// - `power_spread`: place on compute hosts that use different power sources -// -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the -// unexpected strategy was encountered. -const ( - CreatePlacementGroupOptionsStrategyHostSpreadConst = "host_spread" - CreatePlacementGroupOptionsStrategyPowerSpreadConst = "power_spread" -) - -// NewCreatePlacementGroupOptions : Instantiate CreatePlacementGroupOptions -func (*VpcV1) NewCreatePlacementGroupOptions(strategy string) *CreatePlacementGroupOptions { - return &CreatePlacementGroupOptions{ - Strategy: core.StringPtr(strategy), - } -} - -// SetStrategy : Allow user to set Strategy -func (_options *CreatePlacementGroupOptions) SetStrategy(strategy string) *CreatePlacementGroupOptions { - _options.Strategy = core.StringPtr(strategy) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreatePlacementGroupOptions) SetName(name string) *CreatePlacementGroupOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreatePlacementGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePlacementGroupOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreatePlacementGroupOptions) SetHeaders(param map[string]string) *CreatePlacementGroupOptions { - options.Headers = param - return options -} - -// CreatePublicGatewayOptions : The CreatePublicGateway options. -type CreatePublicGatewayOptions struct { - // The VPC this public gateway will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The zone this public gateway will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - FloatingIP PublicGatewayFloatingIPPrototypeIntf `json:"floating_ip,omitempty"` - - // The name for this public gateway. The name must not be used by another public gateway in the VPC. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreatePublicGatewayOptions : Instantiate CreatePublicGatewayOptions -func (*VpcV1) NewCreatePublicGatewayOptions(vpc VPCIdentityIntf, zone ZoneIdentityIntf) *CreatePublicGatewayOptions { - return &CreatePublicGatewayOptions{ - VPC: vpc, - Zone: zone, - } -} - -// SetVPC : Allow user to set VPC -func (_options *CreatePublicGatewayOptions) SetVPC(vpc VPCIdentityIntf) *CreatePublicGatewayOptions { - _options.VPC = vpc - return _options -} - -// SetZone : Allow user to set Zone -func (_options *CreatePublicGatewayOptions) SetZone(zone ZoneIdentityIntf) *CreatePublicGatewayOptions { - _options.Zone = zone - return _options -} - -// SetFloatingIP : Allow user to set FloatingIP -func (_options *CreatePublicGatewayOptions) SetFloatingIP(floatingIP PublicGatewayFloatingIPPrototypeIntf) *CreatePublicGatewayOptions { - _options.FloatingIP = floatingIP - return _options -} - -// SetName : Allow user to set Name -func (_options *CreatePublicGatewayOptions) SetName(name string) *CreatePublicGatewayOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreatePublicGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePublicGatewayOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreatePublicGatewayOptions) SetHeaders(param map[string]string) *CreatePublicGatewayOptions { - options.Headers = param - return options -} - -// CreateSecurityGroupOptions : The CreateSecurityGroup options. -type CreateSecurityGroupOptions struct { - // The VPC this security group will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The name for this security group. The name must not be used by another security group for the VPC. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The prototype objects for rules to be created for this security group. If unspecified, no rules will be created, - // resulting in all traffic being denied. - Rules []SecurityGroupRulePrototypeIntf `json:"rules,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSecurityGroupOptions : Instantiate CreateSecurityGroupOptions -func (*VpcV1) NewCreateSecurityGroupOptions(vpc VPCIdentityIntf) *CreateSecurityGroupOptions { - return &CreateSecurityGroupOptions{ - VPC: vpc, - } -} - -// SetVPC : Allow user to set VPC -func (_options *CreateSecurityGroupOptions) SetVPC(vpc VPCIdentityIntf) *CreateSecurityGroupOptions { - _options.VPC = vpc - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateSecurityGroupOptions) SetName(name string) *CreateSecurityGroupOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateSecurityGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateSecurityGroupOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetRules : Allow user to set Rules -func (_options *CreateSecurityGroupOptions) SetRules(rules []SecurityGroupRulePrototypeIntf) *CreateSecurityGroupOptions { - _options.Rules = rules - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSecurityGroupOptions) SetHeaders(param map[string]string) *CreateSecurityGroupOptions { - options.Headers = param - return options -} - -// CreateSecurityGroupRuleOptions : The CreateSecurityGroupRule options. -type CreateSecurityGroupRuleOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The properties of the security group rule to be created. - SecurityGroupRulePrototype SecurityGroupRulePrototypeIntf `json:"SecurityGroupRulePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSecurityGroupRuleOptions : Instantiate CreateSecurityGroupRuleOptions -func (*VpcV1) NewCreateSecurityGroupRuleOptions(securityGroupID string, securityGroupRulePrototype SecurityGroupRulePrototypeIntf) *CreateSecurityGroupRuleOptions { - return &CreateSecurityGroupRuleOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - SecurityGroupRulePrototype: securityGroupRulePrototype, - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *CreateSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *CreateSecurityGroupRuleOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetSecurityGroupRulePrototype : Allow user to set SecurityGroupRulePrototype -func (_options *CreateSecurityGroupRuleOptions) SetSecurityGroupRulePrototype(securityGroupRulePrototype SecurityGroupRulePrototypeIntf) *CreateSecurityGroupRuleOptions { - _options.SecurityGroupRulePrototype = securityGroupRulePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSecurityGroupRuleOptions) SetHeaders(param map[string]string) *CreateSecurityGroupRuleOptions { - options.Headers = param - return options -} - -// CreateSecurityGroupTargetBindingOptions : The CreateSecurityGroupTargetBinding options. -type CreateSecurityGroupTargetBindingOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The security group target identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSecurityGroupTargetBindingOptions : Instantiate CreateSecurityGroupTargetBindingOptions -func (*VpcV1) NewCreateSecurityGroupTargetBindingOptions(securityGroupID string, id string) *CreateSecurityGroupTargetBindingOptions { - return &CreateSecurityGroupTargetBindingOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - ID: core.StringPtr(id), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *CreateSecurityGroupTargetBindingOptions) SetSecurityGroupID(securityGroupID string) *CreateSecurityGroupTargetBindingOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *CreateSecurityGroupTargetBindingOptions) SetID(id string) *CreateSecurityGroupTargetBindingOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSecurityGroupTargetBindingOptions) SetHeaders(param map[string]string) *CreateSecurityGroupTargetBindingOptions { - options.Headers = param - return options -} - -// CreateShareMountTargetOptions : The CreateShareMountTarget options. -type CreateShareMountTargetOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // The share mount target prototype object. - ShareMountTargetPrototype ShareMountTargetPrototypeIntf `json:"ShareMountTargetPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateShareMountTargetOptions : Instantiate CreateShareMountTargetOptions -func (*VpcV1) NewCreateShareMountTargetOptions(shareID string, shareMountTargetPrototype ShareMountTargetPrototypeIntf) *CreateShareMountTargetOptions { - return &CreateShareMountTargetOptions{ - ShareID: core.StringPtr(shareID), - ShareMountTargetPrototype: shareMountTargetPrototype, - } -} - -// SetShareID : Allow user to set ShareID -func (_options *CreateShareMountTargetOptions) SetShareID(shareID string) *CreateShareMountTargetOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetShareMountTargetPrototype : Allow user to set ShareMountTargetPrototype -func (_options *CreateShareMountTargetOptions) SetShareMountTargetPrototype(shareMountTargetPrototype ShareMountTargetPrototypeIntf) *CreateShareMountTargetOptions { - _options.ShareMountTargetPrototype = shareMountTargetPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateShareMountTargetOptions) SetHeaders(param map[string]string) *CreateShareMountTargetOptions { - options.Headers = param - return options -} - -// CreateShareOptions : The CreateShare options. -type CreateShareOptions struct { - // The file share prototype object. - SharePrototype SharePrototypeIntf `json:"SharePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateShareOptions : Instantiate CreateShareOptions -func (*VpcV1) NewCreateShareOptions(sharePrototype SharePrototypeIntf) *CreateShareOptions { - return &CreateShareOptions{ - SharePrototype: sharePrototype, - } -} - -// SetSharePrototype : Allow user to set SharePrototype -func (_options *CreateShareOptions) SetSharePrototype(sharePrototype SharePrototypeIntf) *CreateShareOptions { - _options.SharePrototype = sharePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateShareOptions) SetHeaders(param map[string]string) *CreateShareOptions { - options.Headers = param - return options -} - -// CreateSnapshotCloneOptions : The CreateSnapshotClone options. -type CreateSnapshotCloneOptions struct { - // The snapshot identifier. - ID *string `json:"id" validate:"required,ne="` - - // The zone name. - ZoneName *string `json:"zone_name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSnapshotCloneOptions : Instantiate CreateSnapshotCloneOptions -func (*VpcV1) NewCreateSnapshotCloneOptions(id string, zoneName string) *CreateSnapshotCloneOptions { - return &CreateSnapshotCloneOptions{ - ID: core.StringPtr(id), - ZoneName: core.StringPtr(zoneName), - } -} - -// SetID : Allow user to set ID -func (_options *CreateSnapshotCloneOptions) SetID(id string) *CreateSnapshotCloneOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *CreateSnapshotCloneOptions) SetZoneName(zoneName string) *CreateSnapshotCloneOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSnapshotCloneOptions) SetHeaders(param map[string]string) *CreateSnapshotCloneOptions { - options.Headers = param - return options -} - -// CreateSnapshotOptions : The CreateSnapshot options. -type CreateSnapshotOptions struct { - // The snapshot prototype object. - SnapshotPrototype SnapshotPrototypeIntf `json:"SnapshotPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSnapshotOptions : Instantiate CreateSnapshotOptions -func (*VpcV1) NewCreateSnapshotOptions(snapshotPrototype SnapshotPrototypeIntf) *CreateSnapshotOptions { - return &CreateSnapshotOptions{ - SnapshotPrototype: snapshotPrototype, - } -} - -// SetSnapshotPrototype : Allow user to set SnapshotPrototype -func (_options *CreateSnapshotOptions) SetSnapshotPrototype(snapshotPrototype SnapshotPrototypeIntf) *CreateSnapshotOptions { - _options.SnapshotPrototype = snapshotPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSnapshotOptions) SetHeaders(param map[string]string) *CreateSnapshotOptions { - options.Headers = param - return options -} - -// CreateSubnetOptions : The CreateSubnet options. -type CreateSubnetOptions struct { - // The subnet prototype object. - SubnetPrototype SubnetPrototypeIntf `json:"SubnetPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSubnetOptions : Instantiate CreateSubnetOptions -func (*VpcV1) NewCreateSubnetOptions(subnetPrototype SubnetPrototypeIntf) *CreateSubnetOptions { - return &CreateSubnetOptions{ - SubnetPrototype: subnetPrototype, - } -} - -// SetSubnetPrototype : Allow user to set SubnetPrototype -func (_options *CreateSubnetOptions) SetSubnetPrototype(subnetPrototype SubnetPrototypeIntf) *CreateSubnetOptions { - _options.SubnetPrototype = subnetPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSubnetOptions) SetHeaders(param map[string]string) *CreateSubnetOptions { - options.Headers = param - return options -} - -// CreateSubnetReservedIPOptions : The CreateSubnetReservedIP options. -type CreateSubnetReservedIPOptions struct { - // The subnet identifier. - SubnetID *string `json:"subnet_id" validate:"required,ne="` - - // The IP address to reserve, which must not already be reserved on the subnet. - // - // If unspecified, an available address on the subnet will automatically be selected. - Address *string `json:"address,omitempty"` - - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with - // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated - // list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The target to bind this reserved IP to. The target must be in the same VPC. - // - // The following targets are supported: - // - An endpoint gateway not already bound to a reserved IP in the subnet's zone. - // - A virtual network interface. - // - // If unspecified, the reserved IP will be created unbound. - Target ReservedIPTargetPrototypeIntf `json:"target,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSubnetReservedIPOptions : Instantiate CreateSubnetReservedIPOptions -func (*VpcV1) NewCreateSubnetReservedIPOptions(subnetID string) *CreateSubnetReservedIPOptions { - return &CreateSubnetReservedIPOptions{ - SubnetID: core.StringPtr(subnetID), - } -} - -// SetSubnetID : Allow user to set SubnetID -func (_options *CreateSubnetReservedIPOptions) SetSubnetID(subnetID string) *CreateSubnetReservedIPOptions { - _options.SubnetID = core.StringPtr(subnetID) - return _options -} - -// SetAddress : Allow user to set Address -func (_options *CreateSubnetReservedIPOptions) SetAddress(address string) *CreateSubnetReservedIPOptions { - _options.Address = core.StringPtr(address) - return _options -} - -// SetAutoDelete : Allow user to set AutoDelete -func (_options *CreateSubnetReservedIPOptions) SetAutoDelete(autoDelete bool) *CreateSubnetReservedIPOptions { - _options.AutoDelete = core.BoolPtr(autoDelete) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateSubnetReservedIPOptions) SetName(name string) *CreateSubnetReservedIPOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetTarget : Allow user to set Target -func (_options *CreateSubnetReservedIPOptions) SetTarget(target ReservedIPTargetPrototypeIntf) *CreateSubnetReservedIPOptions { - _options.Target = target - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSubnetReservedIPOptions) SetHeaders(param map[string]string) *CreateSubnetReservedIPOptions { - options.Headers = param - return options -} - -// CreateVirtualNetworkInterfaceOptions : The CreateVirtualNetworkInterface options. -type CreateVirtualNetworkInterfaceOptions struct { - // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on - // this interface. If `true`, source IP spoofing is allowed on this interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. Must be `false` if the virtual network interface is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the virtual network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - If the virtual network interface is attached, the target `resource_type` must be - // `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 - // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // same subnet as the primary IP. - // - // If reserved IP identities are provided, the specified reserved IPs must be unbound. - // - // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network - // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet - // will be automatically selected and reserved. - Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are - // reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the virtual network interface. May be either a - // reserved IP identity, or a reserved IP prototype object which will be used to create a - // new reserved IP. - // - // If a reserved IP identity is provided, the specified reserved IP must be unbound. - // - // If a reserved IP prototype object with an address is provided, the address must be - // available on the virtual network interface's subnet. If no address is specified, - // an available address on the subnet will be automatically selected and reserved. - PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. Required if `primary_ip` does not specify a reserved IP. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateVirtualNetworkInterfaceOptions : Instantiate CreateVirtualNetworkInterfaceOptions -func (*VpcV1) NewCreateVirtualNetworkInterfaceOptions() *CreateVirtualNetworkInterfaceOptions { - return &CreateVirtualNetworkInterfaceOptions{} -} - -// SetAllowIPSpoofing : Allow user to set AllowIPSpoofing -func (_options *CreateVirtualNetworkInterfaceOptions) SetAllowIPSpoofing(allowIPSpoofing bool) *CreateVirtualNetworkInterfaceOptions { - _options.AllowIPSpoofing = core.BoolPtr(allowIPSpoofing) - return _options -} - -// SetAutoDelete : Allow user to set AutoDelete -func (_options *CreateVirtualNetworkInterfaceOptions) SetAutoDelete(autoDelete bool) *CreateVirtualNetworkInterfaceOptions { - _options.AutoDelete = core.BoolPtr(autoDelete) - return _options -} - -// SetEnableInfrastructureNat : Allow user to set EnableInfrastructureNat -func (_options *CreateVirtualNetworkInterfaceOptions) SetEnableInfrastructureNat(enableInfrastructureNat bool) *CreateVirtualNetworkInterfaceOptions { - _options.EnableInfrastructureNat = core.BoolPtr(enableInfrastructureNat) - return _options -} - -// SetIps : Allow user to set Ips -func (_options *CreateVirtualNetworkInterfaceOptions) SetIps(ips []VirtualNetworkInterfaceIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { - _options.Ips = ips - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVirtualNetworkInterfaceOptions) SetName(name string) *CreateVirtualNetworkInterfaceOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetPrimaryIP : Allow user to set PrimaryIP -func (_options *CreateVirtualNetworkInterfaceOptions) SetPrimaryIP(primaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { - _options.PrimaryIP = primaryIP - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateVirtualNetworkInterfaceOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetSecurityGroups : Allow user to set SecurityGroups -func (_options *CreateVirtualNetworkInterfaceOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions { - _options.SecurityGroups = securityGroups - return _options -} - -// SetSubnet : Allow user to set Subnet -func (_options *CreateVirtualNetworkInterfaceOptions) SetSubnet(subnet SubnetIdentityIntf) *CreateVirtualNetworkInterfaceOptions { - _options.Subnet = subnet - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateVirtualNetworkInterfaceOptions { - options.Headers = param - return options -} - -// CreateVolumeOptions : The CreateVolume options. -type CreateVolumeOptions struct { - // The volume prototype object. - VolumePrototype VolumePrototypeIntf `json:"VolumePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateVolumeOptions : Instantiate CreateVolumeOptions -func (*VpcV1) NewCreateVolumeOptions(volumePrototype VolumePrototypeIntf) *CreateVolumeOptions { - return &CreateVolumeOptions{ - VolumePrototype: volumePrototype, - } -} - -// SetVolumePrototype : Allow user to set VolumePrototype -func (_options *CreateVolumeOptions) SetVolumePrototype(volumePrototype VolumePrototypeIntf) *CreateVolumeOptions { - _options.VolumePrototype = volumePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVolumeOptions) SetHeaders(param map[string]string) *CreateVolumeOptions { - options.Headers = param - return options -} - -// CreateVPCAddressPrefixOptions : The CreateVPCAddressPrefix options. -type CreateVPCAddressPrefixOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The IPv4 range of the address prefix, expressed in CIDR format. The range must not overlap with any existing address - // prefixes in the VPC or any of the following reserved address ranges: - // - // - `127.0.0.0/8` (IPv4 loopback addresses) - // - `161.26.0.0/16` (IBM services) - // - `166.8.0.0/14` (Cloud Service Endpoints) - // - `169.254.0.0/16` (IPv4 link-local addresses) - // - `224.0.0.0/4` (IPv4 multicast addresses) - // - // The prefix length of the address prefix's CIDR must be between `/9` (8,388,608 addresses) and `/29` (8 addresses). - CIDR *string `json:"cidr" validate:"required"` - - // The zone this address prefix will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // Indicates whether this will be the default address prefix for this zone in this VPC. If `true`, the VPC must not - // have a default address prefix for this zone. - IsDefault *bool `json:"is_default,omitempty"` - - // The name for this address prefix. The name must not be used by another address prefix for the VPC. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateVPCAddressPrefixOptions : Instantiate CreateVPCAddressPrefixOptions -func (*VpcV1) NewCreateVPCAddressPrefixOptions(vpcID string, cidr string, zone ZoneIdentityIntf) *CreateVPCAddressPrefixOptions { - return &CreateVPCAddressPrefixOptions{ - VPCID: core.StringPtr(vpcID), - CIDR: core.StringPtr(cidr), - Zone: zone, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *CreateVPCAddressPrefixOptions) SetVPCID(vpcID string) *CreateVPCAddressPrefixOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetCIDR : Allow user to set CIDR -func (_options *CreateVPCAddressPrefixOptions) SetCIDR(cidr string) *CreateVPCAddressPrefixOptions { - _options.CIDR = core.StringPtr(cidr) - return _options -} - -// SetZone : Allow user to set Zone -func (_options *CreateVPCAddressPrefixOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCAddressPrefixOptions { - _options.Zone = zone - return _options -} - -// SetIsDefault : Allow user to set IsDefault -func (_options *CreateVPCAddressPrefixOptions) SetIsDefault(isDefault bool) *CreateVPCAddressPrefixOptions { - _options.IsDefault = core.BoolPtr(isDefault) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPCAddressPrefixOptions) SetName(name string) *CreateVPCAddressPrefixOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPCAddressPrefixOptions) SetHeaders(param map[string]string) *CreateVPCAddressPrefixOptions { - options.Headers = param - return options -} - -// CreateVPCDnsResolutionBindingOptions : The CreateVPCDnsResolutionBinding options. -type CreateVPCDnsResolutionBindingOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // Another VPC to bind this VPC to for DNS resolution. The VPC must have - // `dns.enable_hub` set to `true`, and may be in a different account (subject to - // IAM policies). - // - // Additionally, the VPC specified in the URL (this VPC) must have `dns.enable_hub` - // set to `false` and a `dns.resolution_binding_count` of zero. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC. - // If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateVPCDnsResolutionBindingOptions : Instantiate CreateVPCDnsResolutionBindingOptions -func (*VpcV1) NewCreateVPCDnsResolutionBindingOptions(vpcID string, vpc VPCIdentityIntf) *CreateVPCDnsResolutionBindingOptions { - return &CreateVPCDnsResolutionBindingOptions{ - VPCID: core.StringPtr(vpcID), - VPC: vpc, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *CreateVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *CreateVPCDnsResolutionBindingOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPC : Allow user to set VPC -func (_options *CreateVPCDnsResolutionBindingOptions) SetVPC(vpc VPCIdentityIntf) *CreateVPCDnsResolutionBindingOptions { - _options.VPC = vpc - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPCDnsResolutionBindingOptions) SetName(name string) *CreateVPCDnsResolutionBindingOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *CreateVPCDnsResolutionBindingOptions { - options.Headers = param - return options -} - -// CreateVPCOptions : The CreateVPC options. -type CreateVPCOptions struct { - // Indicates whether a [default address prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes) - // will be automatically created for each zone in this VPC. If `manual`, this VPC will be created with no default - // address prefixes. - // - // Since address prefixes are managed identically regardless of whether they were automatically created, the value is - // not preserved as a VPC property. - AddressPrefixManagement *string `json:"address_prefix_management,omitempty"` - - // Indicates whether this VPC will be connected to Classic Infrastructure. If true, this VPC's resources will have - // private network connectivity to the account's Classic Infrastructure resources. Only one VPC, per region, may be - // connected in this way. This value is set at creation and subsequently immutable. - ClassicAccess *bool `json:"classic_access,omitempty"` - - // The DNS configuration for this VPC. - // - // If unspecified, the system will assign DNS servers capable of resolving hosts and endpoint - // gateways within this VPC, and hosts on the internet. - Dns *VpcdnsPrototype `json:"dns,omitempty"` - - // The name for this VPC. The name must not be used by another VPC in the region. If unspecified, the name will be a - // hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateVPCOptions.AddressPrefixManagement property. -// Indicates whether a [default address prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes) -// will be automatically created for each zone in this VPC. If `manual`, this VPC will be created with no default -// address prefixes. -// -// Since address prefixes are managed identically regardless of whether they were automatically created, the value is -// not preserved as a VPC property. -const ( - CreateVPCOptionsAddressPrefixManagementAutoConst = "auto" - CreateVPCOptionsAddressPrefixManagementManualConst = "manual" -) - -// NewCreateVPCOptions : Instantiate CreateVPCOptions -func (*VpcV1) NewCreateVPCOptions() *CreateVPCOptions { - return &CreateVPCOptions{} -} - -// SetAddressPrefixManagement : Allow user to set AddressPrefixManagement -func (_options *CreateVPCOptions) SetAddressPrefixManagement(addressPrefixManagement string) *CreateVPCOptions { - _options.AddressPrefixManagement = core.StringPtr(addressPrefixManagement) - return _options -} - -// SetClassicAccess : Allow user to set ClassicAccess -func (_options *CreateVPCOptions) SetClassicAccess(classicAccess bool) *CreateVPCOptions { - _options.ClassicAccess = core.BoolPtr(classicAccess) - return _options -} - -// SetDns : Allow user to set Dns -func (_options *CreateVPCOptions) SetDns(dns *VpcdnsPrototype) *CreateVPCOptions { - _options.Dns = dns - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPCOptions) SetName(name string) *CreateVPCOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateVPCOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVPCOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPCOptions) SetHeaders(param map[string]string) *CreateVPCOptions { - options.Headers = param - return options -} - -// CreateVPCRouteOptions : The CreateVPCRoute options. -type CreateVPCRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The destination CIDR of the route. The host identifier in the CIDR must be zero. - // - // At most two routes per `zone` in a table can have the same `destination` and - // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. - Destination *string `json:"destination" validate:"required"` - - // The zone to apply the route to. (Traffic from subnets in this zone will be - // subject to this route.). - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The action to perform with a packet matching the route: - // - `delegate`: delegate to system-provided routes - // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes - // - `deliver`: deliver the packet to the specified `next_hop` - // - `drop`: drop the packet. - Action *string `json:"action,omitempty"` - - // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` - // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of - // randomly-selected words. - Name *string `json:"name,omitempty"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, it must be omitted or specified as `0.0.0.0`. - // - // At most two routes per `zone` in a table can have the same `destination` and `priority`, - // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. - NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` - - // The priority of this route. Smaller values have higher priority. - // - // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest - // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is - // distributed between them. - Priority *int64 `json:"priority,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateVPCRouteOptions.Action property. -// The action to perform with a packet matching the route: -// - `delegate`: delegate to system-provided routes -// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes -// - `deliver`: deliver the packet to the specified `next_hop` -// - `drop`: drop the packet. -const ( - CreateVPCRouteOptionsActionDelegateConst = "delegate" - CreateVPCRouteOptionsActionDelegateVPCConst = "delegate_vpc" - CreateVPCRouteOptionsActionDeliverConst = "deliver" - CreateVPCRouteOptionsActionDropConst = "drop" -) - -// NewCreateVPCRouteOptions : Instantiate CreateVPCRouteOptions -func (*VpcV1) NewCreateVPCRouteOptions(vpcID string, destination string, zone ZoneIdentityIntf) *CreateVPCRouteOptions { - return &CreateVPCRouteOptions{ - VPCID: core.StringPtr(vpcID), - Destination: core.StringPtr(destination), - Zone: zone, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *CreateVPCRouteOptions) SetVPCID(vpcID string) *CreateVPCRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetDestination : Allow user to set Destination -func (_options *CreateVPCRouteOptions) SetDestination(destination string) *CreateVPCRouteOptions { - _options.Destination = core.StringPtr(destination) - return _options -} - -// SetZone : Allow user to set Zone -func (_options *CreateVPCRouteOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCRouteOptions { - _options.Zone = zone - return _options -} - -// SetAction : Allow user to set Action -func (_options *CreateVPCRouteOptions) SetAction(action string) *CreateVPCRouteOptions { - _options.Action = core.StringPtr(action) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPCRouteOptions) SetName(name string) *CreateVPCRouteOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetNextHop : Allow user to set NextHop -func (_options *CreateVPCRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRouteOptions { - _options.NextHop = nextHop - return _options -} - -// SetPriority : Allow user to set Priority -func (_options *CreateVPCRouteOptions) SetPriority(priority int64) *CreateVPCRouteOptions { - _options.Priority = core.Int64Ptr(priority) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPCRouteOptions) SetHeaders(param map[string]string) *CreateVPCRouteOptions { - options.Headers = param - return options -} - -// CreateVPCRoutingTableOptions : The CreateVPCRoutingTable options. -type CreateVPCRoutingTableOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The filters specifying the resources that may create routes in this routing table. - // - // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter - // support is expected to expand in the future. - AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` - - // The 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 -} - -// NewCreateVPCRoutingTableOptions : Instantiate CreateVPCRoutingTableOptions -func (*VpcV1) NewCreateVPCRoutingTableOptions(vpcID string) *CreateVPCRoutingTableOptions { - return &CreateVPCRoutingTableOptions{ - VPCID: core.StringPtr(vpcID), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *CreateVPCRoutingTableOptions) SetVPCID(vpcID string) *CreateVPCRoutingTableOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetAcceptRoutesFrom : Allow user to set AcceptRoutesFrom -func (_options *CreateVPCRoutingTableOptions) SetAcceptRoutesFrom(acceptRoutesFrom []ResourceFilter) *CreateVPCRoutingTableOptions { - _options.AcceptRoutesFrom = acceptRoutesFrom - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPCRoutingTableOptions) SetName(name string) *CreateVPCRoutingTableOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetRouteDirectLinkIngress : Allow user to set RouteDirectLinkIngress -func (_options *CreateVPCRoutingTableOptions) SetRouteDirectLinkIngress(routeDirectLinkIngress bool) *CreateVPCRoutingTableOptions { - _options.RouteDirectLinkIngress = core.BoolPtr(routeDirectLinkIngress) - return _options -} - -// 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. (Traffic from subnets in this zone will be - // subject to this route.). - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The action to perform with a packet matching the route: - // - `delegate`: delegate to system-provided routes - // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes - // - `deliver`: deliver the packet to the specified `next_hop` - // - `drop`: drop the packet. - Action *string `json:"action,omitempty"` - - // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` - // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of - // randomly-selected words. - Name *string `json:"name,omitempty"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, it must be omitted or specified as `0.0.0.0`. - // - // At most two routes per `zone` in a table can have the same `destination` and `priority`, - // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. - NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` - - // The priority of this route. Smaller values have higher priority. - // - // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest - // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is - // distributed between them. - Priority *int64 `json:"priority,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateVPCRoutingTableRouteOptions.Action property. -// The action to perform with a packet matching the route: -// - `delegate`: delegate to system-provided routes -// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes -// - `deliver`: deliver the packet to the specified `next_hop` -// - `drop`: drop the packet. -const ( - CreateVPCRoutingTableRouteOptionsActionDelegateConst = "delegate" - CreateVPCRoutingTableRouteOptionsActionDelegateVPCConst = "delegate_vpc" - CreateVPCRoutingTableRouteOptionsActionDeliverConst = "deliver" - CreateVPCRoutingTableRouteOptionsActionDropConst = "drop" -) - -// NewCreateVPCRoutingTableRouteOptions : Instantiate CreateVPCRoutingTableRouteOptions -func (*VpcV1) NewCreateVPCRoutingTableRouteOptions(vpcID string, routingTableID string, destination string, zone ZoneIdentityIntf) *CreateVPCRoutingTableRouteOptions { - return &CreateVPCRoutingTableRouteOptions{ - VPCID: core.StringPtr(vpcID), - RoutingTableID: core.StringPtr(routingTableID), - Destination: core.StringPtr(destination), - Zone: zone, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *CreateVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *CreateVPCRoutingTableRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetRoutingTableID : Allow user to set RoutingTableID -func (_options *CreateVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *CreateVPCRoutingTableRouteOptions { - _options.RoutingTableID = core.StringPtr(routingTableID) - return _options -} - -// SetDestination : Allow user to set Destination -func (_options *CreateVPCRoutingTableRouteOptions) SetDestination(destination string) *CreateVPCRoutingTableRouteOptions { - _options.Destination = core.StringPtr(destination) - return _options -} - -// SetZone : Allow user to set Zone -func (_options *CreateVPCRoutingTableRouteOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCRoutingTableRouteOptions { - _options.Zone = zone - return _options -} - -// SetAction : Allow user to set Action -func (_options *CreateVPCRoutingTableRouteOptions) SetAction(action string) *CreateVPCRoutingTableRouteOptions { - _options.Action = core.StringPtr(action) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPCRoutingTableRouteOptions) SetName(name string) *CreateVPCRoutingTableRouteOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetNextHop : Allow user to set NextHop -func (_options *CreateVPCRoutingTableRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRoutingTableRouteOptions { - _options.NextHop = nextHop - return _options -} - -// SetPriority : Allow user to set Priority -func (_options *CreateVPCRoutingTableRouteOptions) SetPriority(priority int64) *CreateVPCRoutingTableRouteOptions { - _options.Priority = core.Int64Ptr(priority) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *CreateVPCRoutingTableRouteOptions { - options.Headers = param - return options -} - -// CreateVPNGatewayConnectionOptions : The CreateVPNGatewayConnection options. -type CreateVPNGatewayConnectionOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection prototype object. - VPNGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf `json:"VPNGatewayConnectionPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateVPNGatewayConnectionOptions : Instantiate CreateVPNGatewayConnectionOptions -func (*VpcV1) NewCreateVPNGatewayConnectionOptions(vpnGatewayID string, vpnGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf) *CreateVPNGatewayConnectionOptions { - return &CreateVPNGatewayConnectionOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - VPNGatewayConnectionPrototype: vpnGatewayConnectionPrototype, - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *CreateVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *CreateVPNGatewayConnectionOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetVPNGatewayConnectionPrototype : Allow user to set VPNGatewayConnectionPrototype -func (_options *CreateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPrototype(vpnGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf) *CreateVPNGatewayConnectionOptions { - _options.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *CreateVPNGatewayConnectionOptions { - options.Headers = param - return options -} - -// CreateVPNGatewayOptions : The CreateVPNGateway options. -type CreateVPNGatewayOptions struct { - // The VPN gateway prototype object. - VPNGatewayPrototype VPNGatewayPrototypeIntf `json:"VPNGatewayPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateVPNGatewayOptions : Instantiate CreateVPNGatewayOptions -func (*VpcV1) NewCreateVPNGatewayOptions(vpnGatewayPrototype VPNGatewayPrototypeIntf) *CreateVPNGatewayOptions { - return &CreateVPNGatewayOptions{ - VPNGatewayPrototype: vpnGatewayPrototype, - } -} - -// SetVPNGatewayPrototype : Allow user to set VPNGatewayPrototype -func (_options *CreateVPNGatewayOptions) SetVPNGatewayPrototype(vpnGatewayPrototype VPNGatewayPrototypeIntf) *CreateVPNGatewayOptions { - _options.VPNGatewayPrototype = vpnGatewayPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPNGatewayOptions) SetHeaders(param map[string]string) *CreateVPNGatewayOptions { - options.Headers = param - return options -} - -// CreateVPNServerOptions : The CreateVPNServer options. -type CreateVPNServerOptions struct { - // The certificate instance for this VPN server. - Certificate CertificateInstanceIdentityIntf `json:"certificate" validate:"required"` - - // The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all specified - // methods. - ClientAuthentication []VPNServerAuthenticationPrototypeIntf `json:"client_authentication" validate:"required"` - - // The VPN client IPv4 address pool, expressed in CIDR format. The request must not overlap with any existing address - // prefixes in the VPC or any of the following reserved address ranges: - // - `127.0.0.0/8` (IPv4 loopback addresses) - // - `161.26.0.0/16` (IBM services) - // - `166.8.0.0/14` (Cloud Service Endpoints) - // - `169.254.0.0/16` (IPv4 link-local addresses) - // - `224.0.0.0/4` (IPv4 multicast addresses) - // - // The prefix length of the client IP address pool's CIDR must be between - // `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that contains twice the number of IP addresses - // that are required to enable the maximum number of concurrent connections is recommended. - ClientIPPool *string `json:"client_ip_pool" validate:"required"` - - // The subnets to provision this VPN server in. Use subnets in different zones for high availability. - Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` - - // The DNS server addresses that will be provided to VPN clients connected to this VPN server. - ClientDnsServerIps []IP `json:"client_dns_server_ips,omitempty"` - - // The seconds a VPN client can be idle before this VPN server will disconnect it. Specify `0` to prevent the server - // from disconnecting idle clients. - ClientIdleTimeout *int64 `json:"client_idle_timeout,omitempty"` - - // Indicates whether the split tunneling is enabled on this VPN server. - EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` - - // The name for this VPN server. The name must not be used by another VPN server in the VPC. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The port number to use for this VPN server. - Port *int64 `json:"port,omitempty"` - - // The transport protocol to use for this VPN server. - Protocol *string `json:"protocol,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The security groups to use for this VPN server. If unspecified, the VPC's default security group is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateVPNServerOptions.Protocol property. -// The transport protocol to use for this VPN server. -const ( - CreateVPNServerOptionsProtocolTCPConst = "tcp" - CreateVPNServerOptionsProtocolUDPConst = "udp" -) - -// NewCreateVPNServerOptions : Instantiate CreateVPNServerOptions -func (*VpcV1) NewCreateVPNServerOptions(certificate CertificateInstanceIdentityIntf, clientAuthentication []VPNServerAuthenticationPrototypeIntf, clientIPPool string, subnets []SubnetIdentityIntf) *CreateVPNServerOptions { - return &CreateVPNServerOptions{ - Certificate: certificate, - ClientAuthentication: clientAuthentication, - ClientIPPool: core.StringPtr(clientIPPool), - Subnets: subnets, - } -} - -// SetCertificate : Allow user to set Certificate -func (_options *CreateVPNServerOptions) SetCertificate(certificate CertificateInstanceIdentityIntf) *CreateVPNServerOptions { - _options.Certificate = certificate - return _options -} - -// SetClientAuthentication : Allow user to set ClientAuthentication -func (_options *CreateVPNServerOptions) SetClientAuthentication(clientAuthentication []VPNServerAuthenticationPrototypeIntf) *CreateVPNServerOptions { - _options.ClientAuthentication = clientAuthentication - return _options -} - -// SetClientIPPool : Allow user to set ClientIPPool -func (_options *CreateVPNServerOptions) SetClientIPPool(clientIPPool string) *CreateVPNServerOptions { - _options.ClientIPPool = core.StringPtr(clientIPPool) - return _options -} - -// SetSubnets : Allow user to set Subnets -func (_options *CreateVPNServerOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateVPNServerOptions { - _options.Subnets = subnets - return _options -} - -// SetClientDnsServerIps : Allow user to set ClientDnsServerIps -func (_options *CreateVPNServerOptions) SetClientDnsServerIps(clientDnsServerIps []IP) *CreateVPNServerOptions { - _options.ClientDnsServerIps = clientDnsServerIps - return _options -} - -// SetClientIdleTimeout : Allow user to set ClientIdleTimeout -func (_options *CreateVPNServerOptions) SetClientIdleTimeout(clientIdleTimeout int64) *CreateVPNServerOptions { - _options.ClientIdleTimeout = core.Int64Ptr(clientIdleTimeout) - return _options -} - -// SetEnableSplitTunneling : Allow user to set EnableSplitTunneling -func (_options *CreateVPNServerOptions) SetEnableSplitTunneling(enableSplitTunneling bool) *CreateVPNServerOptions { - _options.EnableSplitTunneling = core.BoolPtr(enableSplitTunneling) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPNServerOptions) SetName(name string) *CreateVPNServerOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetPort : Allow user to set Port -func (_options *CreateVPNServerOptions) SetPort(port int64) *CreateVPNServerOptions { - _options.Port = core.Int64Ptr(port) - return _options -} - -// SetProtocol : Allow user to set Protocol -func (_options *CreateVPNServerOptions) SetProtocol(protocol string) *CreateVPNServerOptions { - _options.Protocol = core.StringPtr(protocol) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateVPNServerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVPNServerOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetSecurityGroups : Allow user to set SecurityGroups -func (_options *CreateVPNServerOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateVPNServerOptions { - _options.SecurityGroups = securityGroups - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPNServerOptions) SetHeaders(param map[string]string) *CreateVPNServerOptions { - options.Headers = param - return options -} - -// CreateVPNServerRouteOptions : The CreateVPNServerRoute options. -type CreateVPNServerRouteOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The destination to use for this VPN route in the VPN server. Must be unique within the VPN server. If an incoming - // packet does not match any destination, it will be dropped. - Destination *string `json:"destination" validate:"required"` - - // The action to perform with a packet matching the VPN route: - // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver - // the packet to target. - // - `deliver`: deliver the packet to the target. - // - `drop`: drop the packet - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the - // unexpected property value was encountered. - Action *string `json:"action,omitempty"` - - // The name for this VPN server route. The name must not be used by another route for the VPN server. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateVPNServerRouteOptions.Action property. -// The action to perform with a packet matching the VPN route: -// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver the -// packet to target. -// - `deliver`: deliver the packet to the target. -// - `drop`: drop the packet -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the -// unexpected property value was encountered. -const ( - CreateVPNServerRouteOptionsActionDeliverConst = "deliver" - CreateVPNServerRouteOptionsActionDropConst = "drop" - CreateVPNServerRouteOptionsActionTranslateConst = "translate" -) - -// NewCreateVPNServerRouteOptions : Instantiate CreateVPNServerRouteOptions -func (*VpcV1) NewCreateVPNServerRouteOptions(vpnServerID string, destination string) *CreateVPNServerRouteOptions { - return &CreateVPNServerRouteOptions{ - VPNServerID: core.StringPtr(vpnServerID), - Destination: core.StringPtr(destination), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *CreateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *CreateVPNServerRouteOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetDestination : Allow user to set Destination -func (_options *CreateVPNServerRouteOptions) SetDestination(destination string) *CreateVPNServerRouteOptions { - _options.Destination = core.StringPtr(destination) - return _options -} - -// SetAction : Allow user to set Action -func (_options *CreateVPNServerRouteOptions) SetAction(action string) *CreateVPNServerRouteOptions { - _options.Action = core.StringPtr(action) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPNServerRouteOptions) SetName(name string) *CreateVPNServerRouteOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPNServerRouteOptions) SetHeaders(param map[string]string) *CreateVPNServerRouteOptions { - options.Headers = param - return options -} - -// DnsInstanceIdentity : Identifies a DNS instance by a unique property. -// Models which "extend" this model: -// - DnsInstanceIdentityByCRN -type DnsInstanceIdentity struct { - // The CRN for this DNS instance. - CRN *string `json:"crn,omitempty"` -} - -func (*DnsInstanceIdentity) isaDnsInstanceIdentity() bool { - return true -} - -type DnsInstanceIdentityIntf interface { - isaDnsInstanceIdentity() bool -} - -// UnmarshalDnsInstanceIdentity unmarshals an instance of DnsInstanceIdentity from the specified map of raw messages. -func UnmarshalDnsInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsInstanceIdentity) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DnsInstanceReference : DnsInstanceReference struct -type DnsInstanceReference struct { - // The CRN for this DNS instance. - CRN *string `json:"crn" validate:"required"` -} - -// UnmarshalDnsInstanceReference unmarshals an instance of DnsInstanceReference from the specified map of raw messages. -func UnmarshalDnsInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsInstanceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DnsServer : A DNS server. -type DnsServer struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` - - // If present, DHCP configuration for this zone will have this DNS server listed first. - ZoneAffinity *ZoneReference `json:"zone_affinity,omitempty"` -} - -// UnmarshalDnsServer unmarshals an instance of DnsServer from the specified map of raw messages. -func UnmarshalDnsServer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsServer) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DnsServerPrototype : DnsServerPrototype struct -type DnsServerPrototype struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` - - // DHCP configuration for the specified zone will have this DNS server listed first. - ZoneAffinity ZoneIdentityIntf `json:"zone_affinity,omitempty"` -} - -// NewDnsServerPrototype : Instantiate DnsServerPrototype (Generic Model Constructor) -func (*VpcV1) NewDnsServerPrototype(address string) (_model *DnsServerPrototype, err error) { - _model = &DnsServerPrototype{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalDnsServerPrototype unmarshals an instance of DnsServerPrototype from the specified map of raw messages. -func UnmarshalDnsServerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsServerPrototype) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DnsZoneIdentity : Identifies a DNS zone by a unique property. -// Models which "extend" this model: -// - DnsZoneIdentityByID -type DnsZoneIdentity struct { - ID *string `json:"id,omitempty"` -} - -func (*DnsZoneIdentity) isaDnsZoneIdentity() bool { - return true -} - -type DnsZoneIdentityIntf interface { - isaDnsZoneIdentity() bool -} - -// UnmarshalDnsZoneIdentity unmarshals an instance of DnsZoneIdentity from the specified map of raw messages. -func UnmarshalDnsZoneIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsZoneIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DnsZoneReference : DnsZoneReference struct -type DnsZoneReference struct { - ID *string `json:"id" validate:"required"` -} - -// UnmarshalDnsZoneReference unmarshals an instance of DnsZoneReference from the specified map of raw messages. -func UnmarshalDnsZoneReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsZoneReference) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHost : DedicatedHost struct -type DedicatedHost struct { - // The amount of memory in gibibytes that is currently available for instances. - AvailableMemory *int64 `json:"available_memory" validate:"required"` - - // The available VCPU for the dedicated host. - AvailableVcpu *Vcpu `json:"available_vcpu" validate:"required"` - - // The date and time that the dedicated host was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` - - // Collection of the dedicated host's disks. - Disks []DedicatedHostDisk `json:"disks" validate:"required"` - - // The dedicated host group this dedicated host is in. - Group *DedicatedHostGroupReference `json:"group" validate:"required"` - - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this dedicated host. - ID *string `json:"id" validate:"required"` - - // If set to true, instances can be placed on this dedicated host. - InstancePlacementEnabled *bool `json:"instance_placement_enabled" validate:"required"` - - // The instances that are allocated to this dedicated host. - Instances []InstanceReference `json:"instances" validate:"required"` - - // The lifecycle state of the dedicated host. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The total amount of memory in gibibytes for this host. - Memory *int64 `json:"memory" validate:"required"` - - // The name for this dedicated host. The name is unique across all dedicated hosts in the region. - Name *string `json:"name" validate:"required"` - - // The dedicated host NUMA configuration. - Numa *DedicatedHostNuma `json:"numa" validate:"required"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) for this - // dedicated host. - Profile *DedicatedHostProfileReference `json:"profile" validate:"required"` - - // Indicates whether this dedicated host is available for instance creation. - Provisionable *bool `json:"provisionable" validate:"required"` - - // The resource group for this dedicated host. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The total number of sockets for this host. - SocketCount *int64 `json:"socket_count" validate:"required"` - - // The administrative state of the dedicated host. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which - // the unexpected property value was encountered. - State *string `json:"state" validate:"required"` - - // The instance profiles usable by instances placed on this dedicated host. - SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` - - // The total VCPU of the dedicated host. - Vcpu *Vcpu `json:"vcpu" validate:"required"` - - // The zone this dedicated host resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the DedicatedHost.LifecycleState property. -// The lifecycle state of the dedicated host. -const ( - DedicatedHostLifecycleStateDeletingConst = "deleting" - DedicatedHostLifecycleStateFailedConst = "failed" - DedicatedHostLifecycleStatePendingConst = "pending" - DedicatedHostLifecycleStateStableConst = "stable" - DedicatedHostLifecycleStateSuspendedConst = "suspended" - DedicatedHostLifecycleStateUpdatingConst = "updating" - DedicatedHostLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the DedicatedHost.ResourceType property. -// The resource type. -const ( - DedicatedHostResourceTypeDedicatedHostConst = "dedicated_host" -) - -// Constants associated with the DedicatedHost.State property. -// The administrative state of the dedicated host. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which -// the unexpected property value was encountered. -const ( - DedicatedHostStateAvailableConst = "available" - DedicatedHostStateDegradedConst = "degraded" - DedicatedHostStateMigratingConst = "migrating" - DedicatedHostStateUnavailableConst = "unavailable" -) - -// UnmarshalDedicatedHost unmarshals an instance of DedicatedHost from the specified map of raw messages. -func UnmarshalDedicatedHost(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHost) - err = core.UnmarshalPrimitive(m, "available_memory", &obj.AvailableMemory) - if err != nil { - return - } - err = core.UnmarshalModel(m, "available_vcpu", &obj.AvailableVcpu, UnmarshalVcpu) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) - if err != nil { - return - } - err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstanceReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "numa", &obj.Numa, UnmarshalDedicatedHostNuma) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "state", &obj.State) - if err != nil { - return - } - err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalVcpu) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostCollection : DedicatedHostCollection struct -type DedicatedHostCollection struct { - // Collection of dedicated hosts. - DedicatedHosts []DedicatedHost `json:"dedicated_hosts" validate:"required"` - - // A link to the first page of resources. - First *DedicatedHostCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *DedicatedHostCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalDedicatedHostCollection unmarshals an instance of DedicatedHostCollection from the specified map of raw messages. -func UnmarshalDedicatedHostCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostCollection) - err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHost) - if err != nil { - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *DedicatedHostCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// DedicatedHostCollectionFirst : A link to the first page of resources. -type DedicatedHostCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalDedicatedHostCollectionFirst unmarshals an instance of DedicatedHostCollectionFirst from the specified map of raw messages. -func UnmarshalDedicatedHostCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type DedicatedHostCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalDedicatedHostCollectionNext unmarshals an instance of DedicatedHostCollectionNext from the specified map of raw messages. -func UnmarshalDedicatedHostCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostDisk : DedicatedHostDisk struct -type DedicatedHostDisk struct { - // The remaining space left for instance placement in GB (gigabytes). - Available *int64 `json:"available" validate:"required"` - - // The date and time that the disk was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this disk. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this disk. - ID *string `json:"id" validate:"required"` - - // Instance disks that are on this dedicated host disk. - InstanceDisks []InstanceDiskReference `json:"instance_disks" validate:"required"` - - // The disk interface used for attaching the disk - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The lifecycle state of this dedicated host disk. - LifecycleState *string `json:"lifecycle_state,omitempty"` - - // The name for this dedicated host disk. The name is unique across all disks on the dedicated host. - Name *string `json:"name" validate:"required"` - - // Indicates whether this dedicated host disk is available for instance disk creation. - Provisionable *bool `json:"provisionable" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The size of the disk in GB (gigabytes). - Size *int64 `json:"size" validate:"required"` - - // The instance disk interfaces supported for this dedicated host disk. - SupportedInstanceInterfaceTypes []string `json:"supported_instance_interface_types" validate:"required"` -} - -// Constants associated with the DedicatedHostDisk.InterfaceType property. -// The disk interface used for attaching the disk -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - DedicatedHostDiskInterfaceTypeNvmeConst = "nvme" -) - -// Constants associated with the DedicatedHostDisk.LifecycleState property. -// The lifecycle state of this dedicated host disk. -const ( - DedicatedHostDiskLifecycleStateDeletingConst = "deleting" - DedicatedHostDiskLifecycleStateFailedConst = "failed" - DedicatedHostDiskLifecycleStatePendingConst = "pending" - DedicatedHostDiskLifecycleStateStableConst = "stable" - DedicatedHostDiskLifecycleStateSuspendedConst = "suspended" - DedicatedHostDiskLifecycleStateUpdatingConst = "updating" - DedicatedHostDiskLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the DedicatedHostDisk.ResourceType property. -// The resource type. -const ( - DedicatedHostDiskResourceTypeDedicatedHostDiskConst = "dedicated_host_disk" -) - -// Constants associated with the DedicatedHostDisk.SupportedInstanceInterfaceTypes property. -// The disk interface used for attaching the disk. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - DedicatedHostDiskSupportedInstanceInterfaceTypesNvmeConst = "nvme" - DedicatedHostDiskSupportedInstanceInterfaceTypesVirtioBlkConst = "virtio_blk" -) - -// UnmarshalDedicatedHostDisk unmarshals an instance of DedicatedHostDisk from the specified map of raw messages. -func UnmarshalDedicatedHostDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostDisk) - err = core.UnmarshalPrimitive(m, "available", &obj.Available) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "instance_disks", &obj.InstanceDisks, UnmarshalInstanceDiskReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostDiskCollection : DedicatedHostDiskCollection struct -type DedicatedHostDiskCollection struct { - // Collection of the dedicated host's disks. - Disks []DedicatedHostDisk `json:"disks" validate:"required"` -} - -// UnmarshalDedicatedHostDiskCollection unmarshals an instance of DedicatedHostDiskCollection from the specified map of raw messages. -func UnmarshalDedicatedHostDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostDiskCollection) - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostDiskPatch : DedicatedHostDiskPatch struct -type DedicatedHostDiskPatch struct { - // The name for this dedicated host disk. The name must not be used by another disk on the dedicated host. - Name *string `json:"name,omitempty"` -} - -// UnmarshalDedicatedHostDiskPatch unmarshals an instance of DedicatedHostDiskPatch from the specified map of raw messages. -func UnmarshalDedicatedHostDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostDiskPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the DedicatedHostDiskPatch -func (dedicatedHostDiskPatch *DedicatedHostDiskPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(dedicatedHostDiskPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// DedicatedHostGroup : DedicatedHostGroup struct -type DedicatedHostGroup struct { - // The dedicated host profile class for hosts in this group. - Class *string `json:"class" validate:"required"` - - // The date and time that the dedicated host group was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` - - // The dedicated hosts that are in this dedicated host group. - DedicatedHosts []DedicatedHostReference `json:"dedicated_hosts" validate:"required"` - - // The dedicated host profile family for hosts in this group. - Family *string `json:"family" validate:"required"` - - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` - - // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. - Name *string `json:"name" validate:"required"` - - // The resource group for this dedicated host group. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The instance profiles usable by instances placed on this dedicated host group. - SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` - - // The zone this dedicated host group resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the DedicatedHostGroup.Family property. -// The dedicated host profile family for hosts in this group. -const ( - DedicatedHostGroupFamilyBalancedConst = "balanced" - DedicatedHostGroupFamilyComputeConst = "compute" - DedicatedHostGroupFamilyMemoryConst = "memory" -) - -// Constants associated with the DedicatedHostGroup.ResourceType property. -// The resource type. -const ( - DedicatedHostGroupResourceTypeDedicatedHostGroupConst = "dedicated_host_group" -) - -// UnmarshalDedicatedHostGroup unmarshals an instance of DedicatedHostGroup from the specified map of raw messages. -func UnmarshalDedicatedHostGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroup) - err = core.UnmarshalPrimitive(m, "class", &obj.Class) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHostReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostGroupCollection : DedicatedHostGroupCollection struct -type DedicatedHostGroupCollection struct { - // A link to the first page of resources. - First *DedicatedHostGroupCollectionFirst `json:"first" validate:"required"` - - // Collection of dedicated host groups. - Groups []DedicatedHostGroup `json:"groups" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *DedicatedHostGroupCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalDedicatedHostGroupCollection unmarshals an instance of DedicatedHostGroupCollection from the specified map of raw messages. -func UnmarshalDedicatedHostGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostGroupCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "groups", &obj.Groups, UnmarshalDedicatedHostGroup) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostGroupCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *DedicatedHostGroupCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// DedicatedHostGroupCollectionFirst : A link to the first page of resources. -type DedicatedHostGroupCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalDedicatedHostGroupCollectionFirst unmarshals an instance of DedicatedHostGroupCollectionFirst from the specified map of raw messages. -func UnmarshalDedicatedHostGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type DedicatedHostGroupCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalDedicatedHostGroupCollectionNext unmarshals an instance of DedicatedHostGroupCollectionNext from the specified map of raw messages. -func UnmarshalDedicatedHostGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. -// Models which "extend" this model: -// - DedicatedHostGroupIdentityByID -// - DedicatedHostGroupIdentityByCRN -// - DedicatedHostGroupIdentityByHref -type DedicatedHostGroupIdentity struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host group. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host group. - Href *string `json:"href,omitempty"` -} - -func (*DedicatedHostGroupIdentity) isaDedicatedHostGroupIdentity() bool { - return true -} - -type DedicatedHostGroupIdentityIntf interface { - isaDedicatedHostGroupIdentity() bool -} - -// UnmarshalDedicatedHostGroupIdentity unmarshals an instance of DedicatedHostGroupIdentity from the specified map of raw messages. -func UnmarshalDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostGroupPatch : DedicatedHostGroupPatch struct -type DedicatedHostGroupPatch struct { - // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. - Name *string `json:"name,omitempty"` -} - -// UnmarshalDedicatedHostGroupPatch unmarshals an instance of DedicatedHostGroupPatch from the specified map of raw messages. -func UnmarshalDedicatedHostGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the DedicatedHostGroupPatch -func (dedicatedHostGroupPatch *DedicatedHostGroupPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(dedicatedHostGroupPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// DedicatedHostGroupPrototypeDedicatedHostByZoneContext : DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct -type DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct { - // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the host's resource group is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` -} - -// UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext unmarshals an instance of DedicatedHostGroupPrototypeDedicatedHostByZoneContext from the specified map of raw messages. -func UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupPrototypeDedicatedHostByZoneContext) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostGroupReference : DedicatedHostGroupReference struct -type DedicatedHostGroupReference struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` - - // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the DedicatedHostGroupReference.ResourceType property. -// The resource type. -const ( - DedicatedHostGroupReferenceResourceTypeDedicatedHostGroupConst = "dedicated_host_group" -) - -// UnmarshalDedicatedHostGroupReference unmarshals an instance of DedicatedHostGroupReference from the specified map of raw messages. -func UnmarshalDedicatedHostGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type DedicatedHostGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalDedicatedHostGroupReferenceDeleted unmarshals an instance of DedicatedHostGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalDedicatedHostGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostNuma : The dedicated host NUMA configuration. -type DedicatedHostNuma struct { - // The total number of NUMA nodes for this dedicated host. - Count *int64 `json:"count" validate:"required"` - - // The NUMA nodes for this dedicated host. - Nodes []DedicatedHostNumaNode `json:"nodes" validate:"required"` -} - -// UnmarshalDedicatedHostNuma unmarshals an instance of DedicatedHostNuma from the specified map of raw messages. -func UnmarshalDedicatedHostNuma(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostNuma) - err = core.UnmarshalPrimitive(m, "count", &obj.Count) - if err != nil { - return - } - err = core.UnmarshalModel(m, "nodes", &obj.Nodes, UnmarshalDedicatedHostNumaNode) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostNumaNode : The dedicated host NUMA node configuration. -type DedicatedHostNumaNode struct { - // The available VCPU for this NUMA node. - AvailableVcpu *int64 `json:"available_vcpu" validate:"required"` - - // The total VCPU capacity for this NUMA node. - Vcpu *int64 `json:"vcpu" validate:"required"` -} - -// UnmarshalDedicatedHostNumaNode unmarshals an instance of DedicatedHostNumaNode from the specified map of raw messages. -func UnmarshalDedicatedHostNumaNode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostNumaNode) - err = core.UnmarshalPrimitive(m, "available_vcpu", &obj.AvailableVcpu) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "vcpu", &obj.Vcpu) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostPatch : DedicatedHostPatch struct -type DedicatedHostPatch struct { - // If set to true, instances can be placed on this dedicated host. - InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` - - // The name for this dedicated host. The name must not be used by another dedicated host in the region. - Name *string `json:"name,omitempty"` -} - -// UnmarshalDedicatedHostPatch unmarshals an instance of DedicatedHostPatch from the specified map of raw messages. -func UnmarshalDedicatedHostPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostPatch) - err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the DedicatedHostPatch -func (dedicatedHostPatch *DedicatedHostPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(dedicatedHostPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// DedicatedHostProfile : DedicatedHostProfile struct -type DedicatedHostProfile struct { - // The product class this dedicated host profile belongs to. - Class *string `json:"class" validate:"required"` - - // Collection of the dedicated host profile's disks. - Disks []DedicatedHostProfileDisk `json:"disks" validate:"required"` - - // The product family this dedicated host profile belongs to - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - Family *string `json:"family" validate:"required"` - - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` - - Memory DedicatedHostProfileMemoryIntf `json:"memory" validate:"required"` - - // The globally unique name for this dedicated host profile. - Name *string `json:"name" validate:"required"` - - SocketCount DedicatedHostProfileSocketIntf `json:"socket_count" validate:"required"` - - // The status of the dedicated host profile: - // - `previous`: This dedicated host profile is an older revision, but remains provisionable - // and usable. - // - `current`: This profile is the latest revision. - // - // Note that revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming - // conventions] - // (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how - // generations are defined within a dedicated host profile. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the - // unexpected property value was encountered. - Status *string `json:"status" validate:"required"` - - // The instance profiles usable by instances placed on dedicated hosts with this profile. - SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` - - VcpuArchitecture *DedicatedHostProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` - - VcpuCount DedicatedHostProfileVcpuIntf `json:"vcpu_count" validate:"required"` - - VcpuManufacturer *DedicatedHostProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"` -} - -// Constants associated with the DedicatedHostProfile.Family property. -// The product family this dedicated host profile belongs to -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - DedicatedHostProfileFamilyBalancedConst = "balanced" - DedicatedHostProfileFamilyComputeConst = "compute" - DedicatedHostProfileFamilyMemoryConst = "memory" -) - -// Constants associated with the DedicatedHostProfile.Status property. -// The status of the dedicated host profile: -// - `previous`: This dedicated host profile is an older revision, but remains provisionable -// and usable. -// - `current`: This profile is the latest revision. -// -// Note that revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming -// conventions] -// (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how -// generations are defined within a dedicated host profile. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the -// unexpected property value was encountered. -const ( - DedicatedHostProfileStatusCurrentConst = "current" - DedicatedHostProfileStatusPreviousConst = "previous" -) - -// UnmarshalDedicatedHostProfile unmarshals an instance of DedicatedHostProfile from the specified map of raw messages. -func UnmarshalDedicatedHostProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfile) - err = core.UnmarshalPrimitive(m, "class", &obj.Class) - if err != nil { - return - } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostProfileDisk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalDedicatedHostProfileMemory) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "socket_count", &obj.SocketCount, UnmarshalDedicatedHostProfileSocket) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalDedicatedHostProfileVcpuArchitecture) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalDedicatedHostProfileVcpu) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalDedicatedHostProfileVcpuManufacturer) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileCollection : DedicatedHostProfileCollection struct -type DedicatedHostProfileCollection struct { - // A link to the first page of resources. - First *DedicatedHostProfileCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *DedicatedHostProfileCollectionNext `json:"next,omitempty"` - - // Collection of dedicated host profiles. - Profiles []DedicatedHostProfile `json:"profiles" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalDedicatedHostProfileCollection unmarshals an instance of DedicatedHostProfileCollection from the specified map of raw messages. -func UnmarshalDedicatedHostProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostProfileCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostProfileCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalDedicatedHostProfile) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *DedicatedHostProfileCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// DedicatedHostProfileCollectionFirst : A link to the first page of resources. -type DedicatedHostProfileCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalDedicatedHostProfileCollectionFirst unmarshals an instance of DedicatedHostProfileCollectionFirst from the specified map of raw messages. -func UnmarshalDedicatedHostProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type DedicatedHostProfileCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalDedicatedHostProfileCollectionNext unmarshals an instance of DedicatedHostProfileCollectionNext from the specified map of raw messages. -func UnmarshalDedicatedHostProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileDisk : Disks provided by this profile. -type DedicatedHostProfileDisk struct { - InterfaceType *DedicatedHostProfileDiskInterface `json:"interface_type" validate:"required"` - - // The number of disks of this type for a dedicated host with this profile. - Quantity *DedicatedHostProfileDiskQuantity `json:"quantity" validate:"required"` - - // The size of the disk in GB (gigabytes). - Size *DedicatedHostProfileDiskSize `json:"size" validate:"required"` - - SupportedInstanceInterfaceTypes *DedicatedHostProfileDiskSupportedInterfaces `json:"supported_instance_interface_types" validate:"required"` -} - -// UnmarshalDedicatedHostProfileDisk unmarshals an instance of DedicatedHostProfileDisk from the specified map of raw messages. -func UnmarshalDedicatedHostProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileDisk) - err = core.UnmarshalModel(m, "interface_type", &obj.InterfaceType, UnmarshalDedicatedHostProfileDiskInterface) - if err != nil { - return - } - err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalDedicatedHostProfileDiskQuantity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalDedicatedHostProfileDiskSize) - if err != nil { - return - } - err = core.UnmarshalModel(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes, UnmarshalDedicatedHostProfileDiskSupportedInterfaces) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileDiskInterface : DedicatedHostProfileDiskInterface struct -type DedicatedHostProfileDiskInterface struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The interface of the disk for a dedicated host with this profile - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileDiskInterface.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileDiskInterfaceTypeFixedConst = "fixed" -) - -// Constants associated with the DedicatedHostProfileDiskInterface.Value property. -// The interface of the disk for a dedicated host with this profile -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - DedicatedHostProfileDiskInterfaceValueNvmeConst = "nvme" -) - -// UnmarshalDedicatedHostProfileDiskInterface unmarshals an instance of DedicatedHostProfileDiskInterface from the specified map of raw messages. -func UnmarshalDedicatedHostProfileDiskInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileDiskInterface) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileDiskQuantity : The number of disks of this type for a dedicated host with this profile. -type DedicatedHostProfileDiskQuantity struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileDiskQuantity.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileDiskQuantityTypeFixedConst = "fixed" -) - -// UnmarshalDedicatedHostProfileDiskQuantity unmarshals an instance of DedicatedHostProfileDiskQuantity from the specified map of raw messages. -func UnmarshalDedicatedHostProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileDiskQuantity) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileDiskSize : The size of the disk in GB (gigabytes). -type DedicatedHostProfileDiskSize struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The size of the disk in GB (gigabytes). - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileDiskSize.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileDiskSizeTypeFixedConst = "fixed" -) - -// UnmarshalDedicatedHostProfileDiskSize unmarshals an instance of DedicatedHostProfileDiskSize from the specified map of raw messages. -func UnmarshalDedicatedHostProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileDiskSize) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileDiskSupportedInterfaces : DedicatedHostProfileDiskSupportedInterfaces struct -type DedicatedHostProfileDiskSupportedInterfaces struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The instance disk interfaces supported for a dedicated host with this profile. - Value []string `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileDiskSupportedInterfacesTypeFixedConst = "fixed" -) - -// Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Value property. -// The disk interface used for attaching the disk. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - DedicatedHostProfileDiskSupportedInterfacesValueNvmeConst = "nvme" - DedicatedHostProfileDiskSupportedInterfacesValueVirtioBlkConst = "virtio_blk" -) - -// UnmarshalDedicatedHostProfileDiskSupportedInterfaces unmarshals an instance of DedicatedHostProfileDiskSupportedInterfaces from the specified map of raw messages. -func UnmarshalDedicatedHostProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileDiskSupportedInterfaces) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileIdentity : Identifies a dedicated host profile by a unique property. -// Models which "extend" this model: -// - DedicatedHostProfileIdentityByName -// - DedicatedHostProfileIdentityByHref -type DedicatedHostProfileIdentity struct { - // The globally unique name for this dedicated host profile. - Name *string `json:"name,omitempty"` - - // The URL for this dedicated host profile. - Href *string `json:"href,omitempty"` -} - -func (*DedicatedHostProfileIdentity) isaDedicatedHostProfileIdentity() bool { - return true -} - -type DedicatedHostProfileIdentityIntf interface { - isaDedicatedHostProfileIdentity() bool -} - -// UnmarshalDedicatedHostProfileIdentity unmarshals an instance of DedicatedHostProfileIdentity from the specified map of raw messages. -func UnmarshalDedicatedHostProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileMemory : DedicatedHostProfileMemory struct -// Models which "extend" this model: -// - DedicatedHostProfileMemoryFixed -// - DedicatedHostProfileMemoryRange -// - DedicatedHostProfileMemoryEnum -// - DedicatedHostProfileMemoryDependent -type DedicatedHostProfileMemory struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the DedicatedHostProfileMemory.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileMemoryTypeFixedConst = "fixed" -) - -func (*DedicatedHostProfileMemory) isaDedicatedHostProfileMemory() bool { - return true -} - -type DedicatedHostProfileMemoryIntf interface { - isaDedicatedHostProfileMemory() bool -} - -// UnmarshalDedicatedHostProfileMemory unmarshals an instance of DedicatedHostProfileMemory from the specified map of raw messages. -func UnmarshalDedicatedHostProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileMemory) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileReference : DedicatedHostProfileReference struct -type DedicatedHostProfileReference struct { - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this dedicated host profile. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalDedicatedHostProfileReference unmarshals an instance of DedicatedHostProfileReference from the specified map of raw messages. -func UnmarshalDedicatedHostProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileSocket : DedicatedHostProfileSocket struct -// Models which "extend" this model: -// - DedicatedHostProfileSocketFixed -// - DedicatedHostProfileSocketRange -// - DedicatedHostProfileSocketEnum -// - DedicatedHostProfileSocketDependent -type DedicatedHostProfileSocket struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the DedicatedHostProfileSocket.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileSocketTypeFixedConst = "fixed" -) - -func (*DedicatedHostProfileSocket) isaDedicatedHostProfileSocket() bool { - return true -} - -type DedicatedHostProfileSocketIntf interface { - isaDedicatedHostProfileSocket() bool -} - -// UnmarshalDedicatedHostProfileSocket unmarshals an instance of DedicatedHostProfileSocket from the specified map of raw messages. -func UnmarshalDedicatedHostProfileSocket(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileSocket) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileVcpu : DedicatedHostProfileVcpu struct -// Models which "extend" this model: -// - DedicatedHostProfileVcpuFixed -// - DedicatedHostProfileVcpuRange -// - DedicatedHostProfileVcpuEnum -// - DedicatedHostProfileVcpuDependent -type DedicatedHostProfileVcpu struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the DedicatedHostProfileVcpu.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuTypeFixedConst = "fixed" -) - -func (*DedicatedHostProfileVcpu) isaDedicatedHostProfileVcpu() bool { - return true -} - -type DedicatedHostProfileVcpuIntf interface { - isaDedicatedHostProfileVcpu() bool -} - -// UnmarshalDedicatedHostProfileVcpu unmarshals an instance of DedicatedHostProfileVcpu from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpu) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileVcpuArchitecture : DedicatedHostProfileVcpuArchitecture struct -type DedicatedHostProfileVcpuArchitecture struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The VCPU architecture for a dedicated host with this profile. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileVcpuArchitecture.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuArchitectureTypeFixedConst = "fixed" -) - -// UnmarshalDedicatedHostProfileVcpuArchitecture unmarshals an instance of DedicatedHostProfileVcpuArchitecture from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpuArchitecture) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileVcpuManufacturer : DedicatedHostProfileVcpuManufacturer struct -type DedicatedHostProfileVcpuManufacturer struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The VCPU manufacturer for a dedicated host with this profile. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileVcpuManufacturer.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuManufacturerTypeFixedConst = "fixed" -) - -// UnmarshalDedicatedHostProfileVcpuManufacturer unmarshals an instance of DedicatedHostProfileVcpuManufacturer from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpuManufacturer) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostPrototype : DedicatedHostPrototype struct -// Models which "extend" this model: -// - DedicatedHostPrototypeDedicatedHostByGroup -// - DedicatedHostPrototypeDedicatedHostByZone -type DedicatedHostPrototype struct { - // If set to true, instances can be placed on this dedicated host. - InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` - - // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this - // dedicated host. - Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The dedicated host group for this dedicated host. - Group DedicatedHostGroupIdentityIntf `json:"group,omitempty"` - - // The zone this dedicated host will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` -} - -func (*DedicatedHostPrototype) isaDedicatedHostPrototype() bool { - return true -} - -type DedicatedHostPrototypeIntf interface { - isaDedicatedHostPrototype() bool -} - -// UnmarshalDedicatedHostPrototype unmarshals an instance of DedicatedHostPrototype from the specified map of raw messages. -func UnmarshalDedicatedHostPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostPrototype) - err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostReference : DedicatedHostReference struct -type DedicatedHostReference struct { - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *DedicatedHostReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this dedicated host. - ID *string `json:"id" validate:"required"` - - // The name for this dedicated host. The name is unique across all dedicated hosts in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the DedicatedHostReference.ResourceType property. -// The resource type. -const ( - DedicatedHostReferenceResourceTypeDedicatedHostConst = "dedicated_host" -) - -// UnmarshalDedicatedHostReference unmarshals an instance of DedicatedHostReference from the specified map of raw messages. -func UnmarshalDedicatedHostReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type DedicatedHostReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalDedicatedHostReferenceDeleted unmarshals an instance of DedicatedHostReferenceDeleted from the specified map of raw messages. -func UnmarshalDedicatedHostReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DefaultNetworkACL : DefaultNetworkACL struct -type DefaultNetworkACL struct { - // The date and time that the network ACL was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this network ACL. - CRN *string `json:"crn" validate:"required"` - - // The URL for this network ACL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL. - ID *string `json:"id" validate:"required"` - - // The name of the default network ACL created for a VPC. The name will be a hyphenated list of randomly-selected words - // at creation, but may be changed. - Name *string `json:"name" validate:"required"` - - // The resource group for the default network ACL for a VPC. Set to the VPC's - // resource group at creation. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The ordered rules for the default network ACL for a VPC. Defaults to two rules which allow all inbound and outbound - // traffic, respectively. Rules for the default network ACL may be changed, added, or removed. - Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` - - // The subnets to which this network ACL is attached. - Subnets []SubnetReference `json:"subnets" validate:"required"` - - // The VPC this network ACL resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// UnmarshalDefaultNetworkACL unmarshals an instance of DefaultNetworkACL from the specified map of raw messages. -func UnmarshalDefaultNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DefaultNetworkACL) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DefaultRoutingTable : DefaultRoutingTable struct -type DefaultRoutingTable struct { - // The filters specifying the resources that may create routes in this routing table. - // - // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter - // support is expected to expand in the future. - AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` - - // The date and time that this routing table was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this routing table. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this routing table. - ID *string `json:"id" validate:"required"` - - // Indicates whether this is the default routing table for this VPC. - IsDefault *bool `json:"is_default" validate:"required"` - - // The lifecycle state of the routing table. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name of the default routing table created for this VPC. The name will be a hyphenated list of randomly-selected - // words at creation, but may be changed. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from - // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from the internet. - // - // Incoming traffic will be routed according to the routing table with two exceptions: - // - Traffic destined for IP addresses associated with public gateways will not be - // subject to routes in this routing table. - // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is - // an IP address in a subnet in the route's `zone` that is able to accept traffic. - // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from from [Transit - // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this - // VPC. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` - - // The routes for the default routing table for this VPC. The table is created with no routes, but routes may be added, - // changed, or removed with a subsequent request. - Routes []RouteReference `json:"routes" validate:"required"` - - // The subnets to which this routing table is attached. - Subnets []SubnetReference `json:"subnets" validate:"required"` -} - -// Constants associated with the DefaultRoutingTable.LifecycleState property. -// The lifecycle state of the routing table. -const ( - DefaultRoutingTableLifecycleStateDeletingConst = "deleting" - DefaultRoutingTableLifecycleStateFailedConst = "failed" - DefaultRoutingTableLifecycleStatePendingConst = "pending" - DefaultRoutingTableLifecycleStateStableConst = "stable" - DefaultRoutingTableLifecycleStateSuspendedConst = "suspended" - DefaultRoutingTableLifecycleStateUpdatingConst = "updating" - DefaultRoutingTableLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the DefaultRoutingTable.ResourceType property. -// The resource type. -const ( - DefaultRoutingTableResourceTypeRoutingTableConst = "routing_table" -) - -// UnmarshalDefaultRoutingTable unmarshals an instance of DefaultRoutingTable from the specified map of raw messages. -func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DefaultRoutingTable) - err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) - if err != nil { - return - } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DefaultSecurityGroup : DefaultSecurityGroup struct -type DefaultSecurityGroup struct { - // The date and time that this security group was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` - - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` - - // The name for the default security group for a VPC. The name will be a hyphenated list of randomly-selected words at - // creation, but may changed. - Name *string `json:"name" validate:"required"` - - // The resource group for this security group. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The rules for the default security group for a VPC. Defaults to allowing all outbound traffic, and allowing all - // inbound traffic from other interfaces in the VPC's default security group. Rules for the default security group may - // be changed, added or removed. - Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` - - // The targets for this security group. - Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` - - // The VPC this security group resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// UnmarshalDefaultSecurityGroup unmarshals an instance of DefaultSecurityGroup from the specified map of raw messages. -func UnmarshalDefaultSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DefaultSecurityGroup) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) - if err != nil { - return - } - err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DeleteBackupPolicyOptions : The DeleteBackupPolicy options. -type DeleteBackupPolicyOptions struct { - // The backup policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteBackupPolicyOptions : Instantiate DeleteBackupPolicyOptions -func (*VpcV1) NewDeleteBackupPolicyOptions(id string) *DeleteBackupPolicyOptions { - return &DeleteBackupPolicyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteBackupPolicyOptions) SetID(id string) *DeleteBackupPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteBackupPolicyOptions) SetIfMatch(ifMatch string) *DeleteBackupPolicyOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteBackupPolicyOptions) SetHeaders(param map[string]string) *DeleteBackupPolicyOptions { - options.Headers = param - return options -} - -// DeleteBackupPolicyPlanOptions : The DeleteBackupPolicyPlan options. -type DeleteBackupPolicyPlanOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // The backup policy plan identifier. - ID *string `json:"id" validate:"required,ne="` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteBackupPolicyPlanOptions : Instantiate DeleteBackupPolicyPlanOptions -func (*VpcV1) NewDeleteBackupPolicyPlanOptions(backupPolicyID string, id string) *DeleteBackupPolicyPlanOptions { - return &DeleteBackupPolicyPlanOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - ID: core.StringPtr(id), - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *DeleteBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *DeleteBackupPolicyPlanOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteBackupPolicyPlanOptions) SetID(id string) *DeleteBackupPolicyPlanOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteBackupPolicyPlanOptions) SetIfMatch(ifMatch string) *DeleteBackupPolicyPlanOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteBackupPolicyPlanOptions) SetHeaders(param map[string]string) *DeleteBackupPolicyPlanOptions { - options.Headers = param - return options -} - -// DeleteBareMetalServerNetworkAttachmentOptions : The DeleteBareMetalServerNetworkAttachment options. -type DeleteBareMetalServerNetworkAttachmentOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteBareMetalServerNetworkAttachmentOptions : Instantiate DeleteBareMetalServerNetworkAttachmentOptions -func (*VpcV1) NewDeleteBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string) *DeleteBareMetalServerNetworkAttachmentOptions { - return &DeleteBareMetalServerNetworkAttachmentOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *DeleteBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *DeleteBareMetalServerNetworkAttachmentOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteBareMetalServerNetworkAttachmentOptions) SetID(id string) *DeleteBareMetalServerNetworkAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerNetworkAttachmentOptions { - options.Headers = param - return options -} - -// DeleteBareMetalServerNetworkInterfaceOptions : The DeleteBareMetalServerNetworkInterface options. -type DeleteBareMetalServerNetworkInterfaceOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteBareMetalServerNetworkInterfaceOptions : Instantiate DeleteBareMetalServerNetworkInterfaceOptions -func (*VpcV1) NewDeleteBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string) *DeleteBareMetalServerNetworkInterfaceOptions { - return &DeleteBareMetalServerNetworkInterfaceOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *DeleteBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *DeleteBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteBareMetalServerNetworkInterfaceOptions) SetID(id string) *DeleteBareMetalServerNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerNetworkInterfaceOptions { - options.Headers = param - return options -} - -// DeleteBareMetalServerOptions : The DeleteBareMetalServer options. -type DeleteBareMetalServerOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteBareMetalServerOptions : Instantiate DeleteBareMetalServerOptions -func (*VpcV1) NewDeleteBareMetalServerOptions(id string) *DeleteBareMetalServerOptions { - return &DeleteBareMetalServerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteBareMetalServerOptions) SetID(id string) *DeleteBareMetalServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteBareMetalServerOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerOptions { - options.Headers = param - return options -} - -// DeleteDedicatedHostGroupOptions : The DeleteDedicatedHostGroup options. -type DeleteDedicatedHostGroupOptions struct { - // The dedicated host group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteDedicatedHostGroupOptions : Instantiate DeleteDedicatedHostGroupOptions -func (*VpcV1) NewDeleteDedicatedHostGroupOptions(id string) *DeleteDedicatedHostGroupOptions { - return &DeleteDedicatedHostGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteDedicatedHostGroupOptions) SetID(id string) *DeleteDedicatedHostGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteDedicatedHostGroupOptions) SetHeaders(param map[string]string) *DeleteDedicatedHostGroupOptions { - options.Headers = param - return options -} - -// DeleteDedicatedHostOptions : The DeleteDedicatedHost options. -type DeleteDedicatedHostOptions struct { - // The dedicated host identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteDedicatedHostOptions : Instantiate DeleteDedicatedHostOptions -func (*VpcV1) NewDeleteDedicatedHostOptions(id string) *DeleteDedicatedHostOptions { - return &DeleteDedicatedHostOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteDedicatedHostOptions) SetID(id string) *DeleteDedicatedHostOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteDedicatedHostOptions) SetHeaders(param map[string]string) *DeleteDedicatedHostOptions { - options.Headers = param - return options -} - -// DeleteEndpointGatewayOptions : The DeleteEndpointGateway options. -type DeleteEndpointGatewayOptions struct { - // The endpoint gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteEndpointGatewayOptions : Instantiate DeleteEndpointGatewayOptions -func (*VpcV1) NewDeleteEndpointGatewayOptions(id string) *DeleteEndpointGatewayOptions { - return &DeleteEndpointGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteEndpointGatewayOptions) SetID(id string) *DeleteEndpointGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteEndpointGatewayOptions) SetHeaders(param map[string]string) *DeleteEndpointGatewayOptions { - options.Headers = param - return options -} - -// DeleteFloatingIPOptions : The DeleteFloatingIP options. -type DeleteFloatingIPOptions struct { - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteFloatingIPOptions : Instantiate DeleteFloatingIPOptions -func (*VpcV1) NewDeleteFloatingIPOptions(id string) *DeleteFloatingIPOptions { - return &DeleteFloatingIPOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteFloatingIPOptions) SetID(id string) *DeleteFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteFloatingIPOptions) SetHeaders(param map[string]string) *DeleteFloatingIPOptions { - options.Headers = param - return options -} - -// DeleteFlowLogCollectorOptions : The DeleteFlowLogCollector options. -type DeleteFlowLogCollectorOptions struct { - // The flow log collector identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteFlowLogCollectorOptions : Instantiate DeleteFlowLogCollectorOptions -func (*VpcV1) NewDeleteFlowLogCollectorOptions(id string) *DeleteFlowLogCollectorOptions { - return &DeleteFlowLogCollectorOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteFlowLogCollectorOptions) SetID(id string) *DeleteFlowLogCollectorOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteFlowLogCollectorOptions) SetHeaders(param map[string]string) *DeleteFlowLogCollectorOptions { - options.Headers = param - return options -} - -// DeleteIkePolicyOptions : The DeleteIkePolicy options. -type DeleteIkePolicyOptions struct { - // The IKE policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteIkePolicyOptions : Instantiate DeleteIkePolicyOptions -func (*VpcV1) NewDeleteIkePolicyOptions(id string) *DeleteIkePolicyOptions { - return &DeleteIkePolicyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteIkePolicyOptions) SetID(id string) *DeleteIkePolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteIkePolicyOptions) SetHeaders(param map[string]string) *DeleteIkePolicyOptions { - options.Headers = param - return options -} - -// DeleteImageExportJobOptions : The DeleteImageExportJob options. -type DeleteImageExportJobOptions struct { - // The image identifier. - ImageID *string `json:"image_id" validate:"required,ne="` - - // The image export job identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteImageExportJobOptions : Instantiate DeleteImageExportJobOptions -func (*VpcV1) NewDeleteImageExportJobOptions(imageID string, id string) *DeleteImageExportJobOptions { - return &DeleteImageExportJobOptions{ - ImageID: core.StringPtr(imageID), - ID: core.StringPtr(id), - } -} - -// SetImageID : Allow user to set ImageID -func (_options *DeleteImageExportJobOptions) SetImageID(imageID string) *DeleteImageExportJobOptions { - _options.ImageID = core.StringPtr(imageID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteImageExportJobOptions) SetID(id string) *DeleteImageExportJobOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteImageExportJobOptions) SetHeaders(param map[string]string) *DeleteImageExportJobOptions { - options.Headers = param - return options -} - -// DeleteImageOptions : The DeleteImage options. -type DeleteImageOptions struct { - // The image identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteImageOptions : Instantiate DeleteImageOptions -func (*VpcV1) NewDeleteImageOptions(id string) *DeleteImageOptions { - return &DeleteImageOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteImageOptions) SetID(id string) *DeleteImageOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteImageOptions) SetHeaders(param map[string]string) *DeleteImageOptions { - options.Headers = param - return options -} - -// DeleteInstanceGroupLoadBalancerOptions : The DeleteInstanceGroupLoadBalancer options. -type DeleteInstanceGroupLoadBalancerOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceGroupLoadBalancerOptions : Instantiate DeleteInstanceGroupLoadBalancerOptions -func (*VpcV1) NewDeleteInstanceGroupLoadBalancerOptions(instanceGroupID string) *DeleteInstanceGroupLoadBalancerOptions { - return &DeleteInstanceGroupLoadBalancerOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *DeleteInstanceGroupLoadBalancerOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupLoadBalancerOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupLoadBalancerOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupLoadBalancerOptions { - options.Headers = param - return options -} - -// DeleteInstanceGroupManagerActionOptions : The DeleteInstanceGroupManagerAction options. -type DeleteInstanceGroupManagerActionOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager action identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceGroupManagerActionOptions : Instantiate DeleteInstanceGroupManagerActionOptions -func (*VpcV1) NewDeleteInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string) *DeleteInstanceGroupManagerActionOptions { - return &DeleteInstanceGroupManagerActionOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *DeleteInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerActionOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *DeleteInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *DeleteInstanceGroupManagerActionOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceGroupManagerActionOptions) SetID(id string) *DeleteInstanceGroupManagerActionOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerActionOptions { - options.Headers = param - return options -} - -// DeleteInstanceGroupManagerOptions : The DeleteInstanceGroupManager options. -type DeleteInstanceGroupManagerOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceGroupManagerOptions : Instantiate DeleteInstanceGroupManagerOptions -func (*VpcV1) NewDeleteInstanceGroupManagerOptions(instanceGroupID string, id string) *DeleteInstanceGroupManagerOptions { - return &DeleteInstanceGroupManagerOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *DeleteInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceGroupManagerOptions) SetID(id string) *DeleteInstanceGroupManagerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupManagerOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerOptions { - options.Headers = param - return options -} - -// DeleteInstanceGroupManagerPolicyOptions : The DeleteInstanceGroupManagerPolicy options. -type DeleteInstanceGroupManagerPolicyOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceGroupManagerPolicyOptions : Instantiate DeleteInstanceGroupManagerPolicyOptions -func (*VpcV1) NewDeleteInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string) *DeleteInstanceGroupManagerPolicyOptions { - return &DeleteInstanceGroupManagerPolicyOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *DeleteInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerPolicyOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *DeleteInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *DeleteInstanceGroupManagerPolicyOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceGroupManagerPolicyOptions) SetID(id string) *DeleteInstanceGroupManagerPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerPolicyOptions { - options.Headers = param - return options -} - -// DeleteInstanceGroupMembershipOptions : The DeleteInstanceGroupMembership options. -type DeleteInstanceGroupMembershipOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group membership identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceGroupMembershipOptions : Instantiate DeleteInstanceGroupMembershipOptions -func (*VpcV1) NewDeleteInstanceGroupMembershipOptions(instanceGroupID string, id string) *DeleteInstanceGroupMembershipOptions { - return &DeleteInstanceGroupMembershipOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *DeleteInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupMembershipOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceGroupMembershipOptions) SetID(id string) *DeleteInstanceGroupMembershipOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupMembershipOptions { - options.Headers = param - return options -} - -// DeleteInstanceGroupMembershipsOptions : The DeleteInstanceGroupMemberships options. -type DeleteInstanceGroupMembershipsOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceGroupMembershipsOptions : Instantiate DeleteInstanceGroupMembershipsOptions -func (*VpcV1) NewDeleteInstanceGroupMembershipsOptions(instanceGroupID string) *DeleteInstanceGroupMembershipsOptions { - return &DeleteInstanceGroupMembershipsOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *DeleteInstanceGroupMembershipsOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupMembershipsOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupMembershipsOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupMembershipsOptions { - options.Headers = param - return options -} - -// DeleteInstanceGroupOptions : The DeleteInstanceGroup options. -type DeleteInstanceGroupOptions struct { - // The instance group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceGroupOptions : Instantiate DeleteInstanceGroupOptions -func (*VpcV1) NewDeleteInstanceGroupOptions(id string) *DeleteInstanceGroupOptions { - return &DeleteInstanceGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceGroupOptions) SetID(id string) *DeleteInstanceGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupOptions { - options.Headers = param - return options -} - -// DeleteInstanceNetworkAttachmentOptions : The DeleteInstanceNetworkAttachment options. -type DeleteInstanceNetworkAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceNetworkAttachmentOptions : Instantiate DeleteInstanceNetworkAttachmentOptions -func (*VpcV1) NewDeleteInstanceNetworkAttachmentOptions(instanceID string, id string) *DeleteInstanceNetworkAttachmentOptions { - return &DeleteInstanceNetworkAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *DeleteInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceNetworkAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceNetworkAttachmentOptions) SetID(id string) *DeleteInstanceNetworkAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceNetworkAttachmentOptions { - options.Headers = param - return options -} - -// DeleteInstanceNetworkInterfaceOptions : The DeleteInstanceNetworkInterface options. -type DeleteInstanceNetworkInterfaceOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceNetworkInterfaceOptions : Instantiate DeleteInstanceNetworkInterfaceOptions -func (*VpcV1) NewDeleteInstanceNetworkInterfaceOptions(instanceID string, id string) *DeleteInstanceNetworkInterfaceOptions { - return &DeleteInstanceNetworkInterfaceOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *DeleteInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *DeleteInstanceNetworkInterfaceOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceNetworkInterfaceOptions) SetID(id string) *DeleteInstanceNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *DeleteInstanceNetworkInterfaceOptions { - options.Headers = param - return options -} - -// DeleteInstanceOptions : The DeleteInstance options. -type DeleteInstanceOptions struct { - // The virtual server instance identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceOptions : Instantiate DeleteInstanceOptions -func (*VpcV1) NewDeleteInstanceOptions(id string) *DeleteInstanceOptions { - return &DeleteInstanceOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceOptions) SetID(id string) *DeleteInstanceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceOptions) SetHeaders(param map[string]string) *DeleteInstanceOptions { - options.Headers = param - return options -} - -// DeleteInstanceTemplateOptions : The DeleteInstanceTemplate options. -type DeleteInstanceTemplateOptions struct { - // The instance template identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceTemplateOptions : Instantiate DeleteInstanceTemplateOptions -func (*VpcV1) NewDeleteInstanceTemplateOptions(id string) *DeleteInstanceTemplateOptions { - return &DeleteInstanceTemplateOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceTemplateOptions) SetID(id string) *DeleteInstanceTemplateOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceTemplateOptions) SetHeaders(param map[string]string) *DeleteInstanceTemplateOptions { - options.Headers = param - return options -} - -// DeleteInstanceVolumeAttachmentOptions : The DeleteInstanceVolumeAttachment options. -type DeleteInstanceVolumeAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The volume attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceVolumeAttachmentOptions : Instantiate DeleteInstanceVolumeAttachmentOptions -func (*VpcV1) NewDeleteInstanceVolumeAttachmentOptions(instanceID string, id string) *DeleteInstanceVolumeAttachmentOptions { - return &DeleteInstanceVolumeAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *DeleteInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceVolumeAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceVolumeAttachmentOptions) SetID(id string) *DeleteInstanceVolumeAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceVolumeAttachmentOptions { - options.Headers = param - return options -} - -// DeleteIpsecPolicyOptions : The DeleteIpsecPolicy options. -type DeleteIpsecPolicyOptions struct { - // The IPsec policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteIpsecPolicyOptions : Instantiate DeleteIpsecPolicyOptions -func (*VpcV1) NewDeleteIpsecPolicyOptions(id string) *DeleteIpsecPolicyOptions { - return &DeleteIpsecPolicyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteIpsecPolicyOptions) SetID(id string) *DeleteIpsecPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteIpsecPolicyOptions) SetHeaders(param map[string]string) *DeleteIpsecPolicyOptions { - options.Headers = param - return options -} - -// DeleteKeyOptions : The DeleteKey options. -type DeleteKeyOptions struct { - // The key identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteKeyOptions : Instantiate DeleteKeyOptions -func (*VpcV1) NewDeleteKeyOptions(id string) *DeleteKeyOptions { - return &DeleteKeyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteKeyOptions) SetID(id string) *DeleteKeyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteKeyOptions) SetHeaders(param map[string]string) *DeleteKeyOptions { - options.Headers = param - return options -} - -// DeleteLoadBalancerListenerOptions : The DeleteLoadBalancerListener options. -type DeleteLoadBalancerListenerOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteLoadBalancerListenerOptions : Instantiate DeleteLoadBalancerListenerOptions -func (*VpcV1) NewDeleteLoadBalancerListenerOptions(loadBalancerID string, id string) *DeleteLoadBalancerListenerOptions { - return &DeleteLoadBalancerListenerOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *DeleteLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteLoadBalancerListenerOptions) SetID(id string) *DeleteLoadBalancerListenerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteLoadBalancerListenerOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerOptions { - options.Headers = param - return options -} - -// DeleteLoadBalancerListenerPolicyOptions : The DeleteLoadBalancerListenerPolicy options. -type DeleteLoadBalancerListenerPolicyOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteLoadBalancerListenerPolicyOptions : Instantiate DeleteLoadBalancerListenerPolicyOptions -func (*VpcV1) NewDeleteLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string) *DeleteLoadBalancerListenerPolicyOptions { - return &DeleteLoadBalancerListenerPolicyOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *DeleteLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerPolicyOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *DeleteLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *DeleteLoadBalancerListenerPolicyOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteLoadBalancerListenerPolicyOptions) SetID(id string) *DeleteLoadBalancerListenerPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerPolicyOptions { - options.Headers = param - return options -} - -// DeleteLoadBalancerListenerPolicyRuleOptions : The DeleteLoadBalancerListenerPolicyRule options. -type DeleteLoadBalancerListenerPolicyRuleOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - PolicyID *string `json:"policy_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteLoadBalancerListenerPolicyRuleOptions : Instantiate DeleteLoadBalancerListenerPolicyRuleOptions -func (*VpcV1) NewDeleteLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string) *DeleteLoadBalancerListenerPolicyRuleOptions { - return &DeleteLoadBalancerListenerPolicyRuleOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - PolicyID: core.StringPtr(policyID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerPolicyRuleOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *DeleteLoadBalancerListenerPolicyRuleOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetPolicyID : Allow user to set PolicyID -func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *DeleteLoadBalancerListenerPolicyRuleOptions { - _options.PolicyID = core.StringPtr(policyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetID(id string) *DeleteLoadBalancerListenerPolicyRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerPolicyRuleOptions { - options.Headers = param - return options -} - -// DeleteLoadBalancerOptions : The DeleteLoadBalancer options. -type DeleteLoadBalancerOptions struct { - // The load balancer identifier. - ID *string `json:"id" validate:"required,ne="` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteLoadBalancerOptions : Instantiate DeleteLoadBalancerOptions -func (*VpcV1) NewDeleteLoadBalancerOptions(id string) *DeleteLoadBalancerOptions { - return &DeleteLoadBalancerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteLoadBalancerOptions) SetID(id string) *DeleteLoadBalancerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteLoadBalancerOptions) SetIfMatch(ifMatch string) *DeleteLoadBalancerOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteLoadBalancerOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerOptions { - options.Headers = param - return options -} - -// DeleteLoadBalancerPoolMemberOptions : The DeleteLoadBalancerPoolMember options. -type DeleteLoadBalancerPoolMemberOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - PoolID *string `json:"pool_id" validate:"required,ne="` - - // The member identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteLoadBalancerPoolMemberOptions : Instantiate DeleteLoadBalancerPoolMemberOptions -func (*VpcV1) NewDeleteLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string) *DeleteLoadBalancerPoolMemberOptions { - return &DeleteLoadBalancerPoolMemberOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - PoolID: core.StringPtr(poolID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *DeleteLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerPoolMemberOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetPoolID : Allow user to set PoolID -func (_options *DeleteLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *DeleteLoadBalancerPoolMemberOptions { - _options.PoolID = core.StringPtr(poolID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteLoadBalancerPoolMemberOptions) SetID(id string) *DeleteLoadBalancerPoolMemberOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerPoolMemberOptions { - options.Headers = param - return options -} - -// DeleteLoadBalancerPoolOptions : The DeleteLoadBalancerPool options. -type DeleteLoadBalancerPoolOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteLoadBalancerPoolOptions : Instantiate DeleteLoadBalancerPoolOptions -func (*VpcV1) NewDeleteLoadBalancerPoolOptions(loadBalancerID string, id string) *DeleteLoadBalancerPoolOptions { - return &DeleteLoadBalancerPoolOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *DeleteLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerPoolOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteLoadBalancerPoolOptions) SetID(id string) *DeleteLoadBalancerPoolOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteLoadBalancerPoolOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerPoolOptions { - options.Headers = param - return options -} - -// DeleteNetworkACLOptions : The DeleteNetworkACL options. -type DeleteNetworkACLOptions struct { - // The network ACL identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteNetworkACLOptions : Instantiate DeleteNetworkACLOptions -func (*VpcV1) NewDeleteNetworkACLOptions(id string) *DeleteNetworkACLOptions { - return &DeleteNetworkACLOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteNetworkACLOptions) SetID(id string) *DeleteNetworkACLOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteNetworkACLOptions) SetHeaders(param map[string]string) *DeleteNetworkACLOptions { - options.Headers = param - return options -} - -// DeleteNetworkACLRuleOptions : The DeleteNetworkACLRule options. -type DeleteNetworkACLRuleOptions struct { - // The network ACL identifier. - NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteNetworkACLRuleOptions : Instantiate DeleteNetworkACLRuleOptions -func (*VpcV1) NewDeleteNetworkACLRuleOptions(networkACLID string, id string) *DeleteNetworkACLRuleOptions { - return &DeleteNetworkACLRuleOptions{ - NetworkACLID: core.StringPtr(networkACLID), - ID: core.StringPtr(id), - } -} - -// SetNetworkACLID : Allow user to set NetworkACLID -func (_options *DeleteNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *DeleteNetworkACLRuleOptions { - _options.NetworkACLID = core.StringPtr(networkACLID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteNetworkACLRuleOptions) SetID(id string) *DeleteNetworkACLRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteNetworkACLRuleOptions) SetHeaders(param map[string]string) *DeleteNetworkACLRuleOptions { - options.Headers = param - return options -} - -// DeletePlacementGroupOptions : The DeletePlacementGroup options. -type DeletePlacementGroupOptions struct { - // The placement group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeletePlacementGroupOptions : Instantiate DeletePlacementGroupOptions -func (*VpcV1) NewDeletePlacementGroupOptions(id string) *DeletePlacementGroupOptions { - return &DeletePlacementGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeletePlacementGroupOptions) SetID(id string) *DeletePlacementGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeletePlacementGroupOptions) SetHeaders(param map[string]string) *DeletePlacementGroupOptions { - options.Headers = param - return options -} - -// DeletePublicGatewayOptions : The DeletePublicGateway options. -type DeletePublicGatewayOptions struct { - // The public gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeletePublicGatewayOptions : Instantiate DeletePublicGatewayOptions -func (*VpcV1) NewDeletePublicGatewayOptions(id string) *DeletePublicGatewayOptions { - return &DeletePublicGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeletePublicGatewayOptions) SetID(id string) *DeletePublicGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeletePublicGatewayOptions) SetHeaders(param map[string]string) *DeletePublicGatewayOptions { - options.Headers = param - return options -} - -// DeleteSecurityGroupOptions : The DeleteSecurityGroup options. -type DeleteSecurityGroupOptions struct { - // The security group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSecurityGroupOptions : Instantiate DeleteSecurityGroupOptions -func (*VpcV1) NewDeleteSecurityGroupOptions(id string) *DeleteSecurityGroupOptions { - return &DeleteSecurityGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteSecurityGroupOptions) SetID(id string) *DeleteSecurityGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSecurityGroupOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupOptions { - options.Headers = param - return options -} - -// DeleteSecurityGroupRuleOptions : The DeleteSecurityGroupRule options. -type DeleteSecurityGroupRuleOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSecurityGroupRuleOptions : Instantiate DeleteSecurityGroupRuleOptions -func (*VpcV1) NewDeleteSecurityGroupRuleOptions(securityGroupID string, id string) *DeleteSecurityGroupRuleOptions { - return &DeleteSecurityGroupRuleOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - ID: core.StringPtr(id), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *DeleteSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *DeleteSecurityGroupRuleOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteSecurityGroupRuleOptions) SetID(id string) *DeleteSecurityGroupRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSecurityGroupRuleOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupRuleOptions { - options.Headers = param - return options -} - -// DeleteSecurityGroupTargetBindingOptions : The DeleteSecurityGroupTargetBinding options. -type DeleteSecurityGroupTargetBindingOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The security group target identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSecurityGroupTargetBindingOptions : Instantiate DeleteSecurityGroupTargetBindingOptions -func (*VpcV1) NewDeleteSecurityGroupTargetBindingOptions(securityGroupID string, id string) *DeleteSecurityGroupTargetBindingOptions { - return &DeleteSecurityGroupTargetBindingOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - ID: core.StringPtr(id), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *DeleteSecurityGroupTargetBindingOptions) SetSecurityGroupID(securityGroupID string) *DeleteSecurityGroupTargetBindingOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteSecurityGroupTargetBindingOptions) SetID(id string) *DeleteSecurityGroupTargetBindingOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSecurityGroupTargetBindingOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupTargetBindingOptions { - options.Headers = param - return options -} - -// DeleteShareMountTargetOptions : The DeleteShareMountTarget options. -type DeleteShareMountTargetOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // The share mount target identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteShareMountTargetOptions : Instantiate DeleteShareMountTargetOptions -func (*VpcV1) NewDeleteShareMountTargetOptions(shareID string, id string) *DeleteShareMountTargetOptions { - return &DeleteShareMountTargetOptions{ - ShareID: core.StringPtr(shareID), - ID: core.StringPtr(id), - } -} - -// SetShareID : Allow user to set ShareID -func (_options *DeleteShareMountTargetOptions) SetShareID(shareID string) *DeleteShareMountTargetOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteShareMountTargetOptions) SetID(id string) *DeleteShareMountTargetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteShareMountTargetOptions) SetHeaders(param map[string]string) *DeleteShareMountTargetOptions { - options.Headers = param - return options -} - -// DeleteShareOptions : The DeleteShare options. -type DeleteShareOptions struct { - // The file share identifier. - ID *string `json:"id" validate:"required,ne="` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteShareOptions : Instantiate DeleteShareOptions -func (*VpcV1) NewDeleteShareOptions(id string) *DeleteShareOptions { - return &DeleteShareOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteShareOptions) SetID(id string) *DeleteShareOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteShareOptions) SetIfMatch(ifMatch string) *DeleteShareOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteShareOptions) SetHeaders(param map[string]string) *DeleteShareOptions { - options.Headers = param - return options -} - -// DeleteShareSourceOptions : The DeleteShareSource options. -type DeleteShareSourceOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteShareSourceOptions : Instantiate DeleteShareSourceOptions -func (*VpcV1) NewDeleteShareSourceOptions(shareID string) *DeleteShareSourceOptions { - return &DeleteShareSourceOptions{ - ShareID: core.StringPtr(shareID), - } -} - -// SetShareID : Allow user to set ShareID -func (_options *DeleteShareSourceOptions) SetShareID(shareID string) *DeleteShareSourceOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteShareSourceOptions) SetHeaders(param map[string]string) *DeleteShareSourceOptions { - options.Headers = param - return options -} - -// DeleteSnapshotCloneOptions : The DeleteSnapshotClone options. -type DeleteSnapshotCloneOptions struct { - // The snapshot identifier. - ID *string `json:"id" validate:"required,ne="` - - // The zone name. - ZoneName *string `json:"zone_name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSnapshotCloneOptions : Instantiate DeleteSnapshotCloneOptions -func (*VpcV1) NewDeleteSnapshotCloneOptions(id string, zoneName string) *DeleteSnapshotCloneOptions { - return &DeleteSnapshotCloneOptions{ - ID: core.StringPtr(id), - ZoneName: core.StringPtr(zoneName), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteSnapshotCloneOptions) SetID(id string) *DeleteSnapshotCloneOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *DeleteSnapshotCloneOptions) SetZoneName(zoneName string) *DeleteSnapshotCloneOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSnapshotCloneOptions) SetHeaders(param map[string]string) *DeleteSnapshotCloneOptions { - options.Headers = param - return options -} - -// DeleteSnapshotOptions : The DeleteSnapshot options. -type DeleteSnapshotOptions struct { - // The snapshot identifier. - ID *string `json:"id" validate:"required,ne="` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSnapshotOptions : Instantiate DeleteSnapshotOptions -func (*VpcV1) NewDeleteSnapshotOptions(id string) *DeleteSnapshotOptions { - return &DeleteSnapshotOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteSnapshotOptions) SetID(id string) *DeleteSnapshotOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteSnapshotOptions) SetIfMatch(ifMatch string) *DeleteSnapshotOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSnapshotOptions) SetHeaders(param map[string]string) *DeleteSnapshotOptions { - options.Headers = param - return options -} - -// DeleteSnapshotsOptions : The DeleteSnapshots options. -type DeleteSnapshotsOptions struct { - // Filters the collection to resources with a `source_volume.id` property matching the specified identifier. - SourceVolumeID *string `json:"source_volume.id" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSnapshotsOptions : Instantiate DeleteSnapshotsOptions -func (*VpcV1) NewDeleteSnapshotsOptions(sourceVolumeID string) *DeleteSnapshotsOptions { - return &DeleteSnapshotsOptions{ - SourceVolumeID: core.StringPtr(sourceVolumeID), - } -} - -// SetSourceVolumeID : Allow user to set SourceVolumeID -func (_options *DeleteSnapshotsOptions) SetSourceVolumeID(sourceVolumeID string) *DeleteSnapshotsOptions { - _options.SourceVolumeID = core.StringPtr(sourceVolumeID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSnapshotsOptions) SetHeaders(param map[string]string) *DeleteSnapshotsOptions { - options.Headers = param - return options -} - -// DeleteSubnetOptions : The DeleteSubnet options. -type DeleteSubnetOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSubnetOptions : Instantiate DeleteSubnetOptions -func (*VpcV1) NewDeleteSubnetOptions(id string) *DeleteSubnetOptions { - return &DeleteSubnetOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteSubnetOptions) SetID(id string) *DeleteSubnetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSubnetOptions) SetHeaders(param map[string]string) *DeleteSubnetOptions { - options.Headers = param - return options -} - -// DeleteSubnetReservedIPOptions : The DeleteSubnetReservedIP options. -type DeleteSubnetReservedIPOptions struct { - // The subnet identifier. - SubnetID *string `json:"subnet_id" validate:"required,ne="` - - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSubnetReservedIPOptions : Instantiate DeleteSubnetReservedIPOptions -func (*VpcV1) NewDeleteSubnetReservedIPOptions(subnetID string, id string) *DeleteSubnetReservedIPOptions { - return &DeleteSubnetReservedIPOptions{ - SubnetID: core.StringPtr(subnetID), - ID: core.StringPtr(id), - } -} - -// SetSubnetID : Allow user to set SubnetID -func (_options *DeleteSubnetReservedIPOptions) SetSubnetID(subnetID string) *DeleteSubnetReservedIPOptions { - _options.SubnetID = core.StringPtr(subnetID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteSubnetReservedIPOptions) SetID(id string) *DeleteSubnetReservedIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSubnetReservedIPOptions) SetHeaders(param map[string]string) *DeleteSubnetReservedIPOptions { - options.Headers = param - return options -} - -// DeleteVirtualNetworkInterfacesOptions : The DeleteVirtualNetworkInterfaces options. -type DeleteVirtualNetworkInterfacesOptions struct { - // The virtual network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVirtualNetworkInterfacesOptions : Instantiate DeleteVirtualNetworkInterfacesOptions -func (*VpcV1) NewDeleteVirtualNetworkInterfacesOptions(id string) *DeleteVirtualNetworkInterfacesOptions { - return &DeleteVirtualNetworkInterfacesOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteVirtualNetworkInterfacesOptions) SetID(id string) *DeleteVirtualNetworkInterfacesOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVirtualNetworkInterfacesOptions) SetHeaders(param map[string]string) *DeleteVirtualNetworkInterfacesOptions { - options.Headers = param - return options -} - -// DeleteVolumeOptions : The DeleteVolume options. -type DeleteVolumeOptions struct { - // The volume identifier. - ID *string `json:"id" validate:"required,ne="` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVolumeOptions : Instantiate DeleteVolumeOptions -func (*VpcV1) NewDeleteVolumeOptions(id string) *DeleteVolumeOptions { - return &DeleteVolumeOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteVolumeOptions) SetID(id string) *DeleteVolumeOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteVolumeOptions) SetIfMatch(ifMatch string) *DeleteVolumeOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVolumeOptions) SetHeaders(param map[string]string) *DeleteVolumeOptions { - options.Headers = param - return options -} - -// DeleteVPCAddressPrefixOptions : The DeleteVPCAddressPrefix options. -type DeleteVPCAddressPrefixOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The prefix identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPCAddressPrefixOptions : Instantiate DeleteVPCAddressPrefixOptions -func (*VpcV1) NewDeleteVPCAddressPrefixOptions(vpcID string, id string) *DeleteVPCAddressPrefixOptions { - return &DeleteVPCAddressPrefixOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *DeleteVPCAddressPrefixOptions) SetVPCID(vpcID string) *DeleteVPCAddressPrefixOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPCAddressPrefixOptions) SetID(id string) *DeleteVPCAddressPrefixOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPCAddressPrefixOptions) SetHeaders(param map[string]string) *DeleteVPCAddressPrefixOptions { - options.Headers = param - return options -} - -// DeleteVPCDnsResolutionBindingOptions : The DeleteVPCDnsResolutionBinding options. -type DeleteVPCDnsResolutionBindingOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The DNS resolution binding identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPCDnsResolutionBindingOptions : Instantiate DeleteVPCDnsResolutionBindingOptions -func (*VpcV1) NewDeleteVPCDnsResolutionBindingOptions(vpcID string, id string) *DeleteVPCDnsResolutionBindingOptions { - return &DeleteVPCDnsResolutionBindingOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *DeleteVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *DeleteVPCDnsResolutionBindingOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPCDnsResolutionBindingOptions) SetID(id string) *DeleteVPCDnsResolutionBindingOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *DeleteVPCDnsResolutionBindingOptions { - options.Headers = param - return options -} - -// DeleteVPCOptions : The DeleteVPC options. -type DeleteVPCOptions struct { - // The VPC identifier. - ID *string `json:"id" validate:"required,ne="` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPCOptions : Instantiate DeleteVPCOptions -func (*VpcV1) NewDeleteVPCOptions(id string) *DeleteVPCOptions { - return &DeleteVPCOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteVPCOptions) SetID(id string) *DeleteVPCOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteVPCOptions) SetIfMatch(ifMatch string) *DeleteVPCOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPCOptions) SetHeaders(param map[string]string) *DeleteVPCOptions { - options.Headers = param - return options -} - -// DeleteVPCRouteOptions : The DeleteVPCRoute options. -type DeleteVPCRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The route identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPCRouteOptions : Instantiate DeleteVPCRouteOptions -func (*VpcV1) NewDeleteVPCRouteOptions(vpcID string, id string) *DeleteVPCRouteOptions { - return &DeleteVPCRouteOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *DeleteVPCRouteOptions) SetVPCID(vpcID string) *DeleteVPCRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPCRouteOptions) SetID(id string) *DeleteVPCRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPCRouteOptions) SetHeaders(param map[string]string) *DeleteVPCRouteOptions { - options.Headers = param - return options -} - -// DeleteVPCRoutingTableOptions : The DeleteVPCRoutingTable options. -type DeleteVPCRoutingTableOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table identifier. - ID *string `json:"id" validate:"required,ne="` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPCRoutingTableOptions : Instantiate DeleteVPCRoutingTableOptions -func (*VpcV1) NewDeleteVPCRoutingTableOptions(vpcID string, id string) *DeleteVPCRoutingTableOptions { - return &DeleteVPCRoutingTableOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *DeleteVPCRoutingTableOptions) SetVPCID(vpcID string) *DeleteVPCRoutingTableOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPCRoutingTableOptions) SetID(id string) *DeleteVPCRoutingTableOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteVPCRoutingTableOptions) SetIfMatch(ifMatch string) *DeleteVPCRoutingTableOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPCRoutingTableOptions) SetHeaders(param map[string]string) *DeleteVPCRoutingTableOptions { - options.Headers = param - return options -} - -// DeleteVPCRoutingTableRouteOptions : The DeleteVPCRoutingTableRoute options. -type DeleteVPCRoutingTableRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table identifier. - RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` - - // The VPC routing table route identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPCRoutingTableRouteOptions : Instantiate DeleteVPCRoutingTableRouteOptions -func (*VpcV1) NewDeleteVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string) *DeleteVPCRoutingTableRouteOptions { - return &DeleteVPCRoutingTableRouteOptions{ - VPCID: core.StringPtr(vpcID), - RoutingTableID: core.StringPtr(routingTableID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *DeleteVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *DeleteVPCRoutingTableRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetRoutingTableID : Allow user to set RoutingTableID -func (_options *DeleteVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *DeleteVPCRoutingTableRouteOptions { - _options.RoutingTableID = core.StringPtr(routingTableID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPCRoutingTableRouteOptions) SetID(id string) *DeleteVPCRoutingTableRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *DeleteVPCRoutingTableRouteOptions { - options.Headers = param - return options -} - -// DeleteVPNGatewayConnectionOptions : The DeleteVPNGatewayConnection options. -type DeleteVPNGatewayConnectionOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPNGatewayConnectionOptions : Instantiate DeleteVPNGatewayConnectionOptions -func (*VpcV1) NewDeleteVPNGatewayConnectionOptions(vpnGatewayID string, id string) *DeleteVPNGatewayConnectionOptions { - return &DeleteVPNGatewayConnectionOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *DeleteVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *DeleteVPNGatewayConnectionOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPNGatewayConnectionOptions) SetID(id string) *DeleteVPNGatewayConnectionOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayConnectionOptions { - options.Headers = param - return options -} - -// DeleteVPNGatewayOptions : The DeleteVPNGateway options. -type DeleteVPNGatewayOptions struct { - // The VPN gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPNGatewayOptions : Instantiate DeleteVPNGatewayOptions -func (*VpcV1) NewDeleteVPNGatewayOptions(id string) *DeleteVPNGatewayOptions { - return &DeleteVPNGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteVPNGatewayOptions) SetID(id string) *DeleteVPNGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPNGatewayOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayOptions { - options.Headers = param - return options -} - -// DeleteVPNServerClientOptions : The DeleteVPNServerClient options. -type DeleteVPNServerClientOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The VPN client identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPNServerClientOptions : Instantiate DeleteVPNServerClientOptions -func (*VpcV1) NewDeleteVPNServerClientOptions(vpnServerID string, id string) *DeleteVPNServerClientOptions { - return &DeleteVPNServerClientOptions{ - VPNServerID: core.StringPtr(vpnServerID), - ID: core.StringPtr(id), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *DeleteVPNServerClientOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerClientOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPNServerClientOptions) SetID(id string) *DeleteVPNServerClientOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPNServerClientOptions) SetHeaders(param map[string]string) *DeleteVPNServerClientOptions { - options.Headers = param - return options -} - -// DeleteVPNServerOptions : The DeleteVPNServer options. -type DeleteVPNServerOptions struct { - // The VPN server identifier. - ID *string `json:"id" validate:"required,ne="` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPNServerOptions : Instantiate DeleteVPNServerOptions -func (*VpcV1) NewDeleteVPNServerOptions(id string) *DeleteVPNServerOptions { - return &DeleteVPNServerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteVPNServerOptions) SetID(id string) *DeleteVPNServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteVPNServerOptions) SetIfMatch(ifMatch string) *DeleteVPNServerOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPNServerOptions) SetHeaders(param map[string]string) *DeleteVPNServerOptions { - options.Headers = param - return options -} - -// DeleteVPNServerRouteOptions : The DeleteVPNServerRoute options. -type DeleteVPNServerRouteOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The VPN route identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPNServerRouteOptions : Instantiate DeleteVPNServerRouteOptions -func (*VpcV1) NewDeleteVPNServerRouteOptions(vpnServerID string, id string) *DeleteVPNServerRouteOptions { - return &DeleteVPNServerRouteOptions{ - VPNServerID: core.StringPtr(vpnServerID), - ID: core.StringPtr(id), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *DeleteVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerRouteOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPNServerRouteOptions) SetID(id string) *DeleteVPNServerRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPNServerRouteOptions) SetHeaders(param map[string]string) *DeleteVPNServerRouteOptions { - options.Headers = param - return options -} - -// DeprecateImageOptions : The DeprecateImage options. -type DeprecateImageOptions struct { - // The image identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeprecateImageOptions : Instantiate DeprecateImageOptions -func (*VpcV1) NewDeprecateImageOptions(id string) *DeprecateImageOptions { - return &DeprecateImageOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeprecateImageOptions) SetID(id string) *DeprecateImageOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeprecateImageOptions) SetHeaders(param map[string]string) *DeprecateImageOptions { - options.Headers = param - return options -} - -// DisconnectVPNClientOptions : The DisconnectVPNClient options. -type DisconnectVPNClientOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The VPN client identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDisconnectVPNClientOptions : Instantiate DisconnectVPNClientOptions -func (*VpcV1) NewDisconnectVPNClientOptions(vpnServerID string, id string) *DisconnectVPNClientOptions { - return &DisconnectVPNClientOptions{ - VPNServerID: core.StringPtr(vpnServerID), - ID: core.StringPtr(id), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *DisconnectVPNClientOptions) SetVPNServerID(vpnServerID string) *DisconnectVPNClientOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DisconnectVPNClientOptions) SetID(id string) *DisconnectVPNClientOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DisconnectVPNClientOptions) SetHeaders(param map[string]string) *DisconnectVPNClientOptions { - options.Headers = param - return options -} - -// EncryptionKeyIdentity : Identifies an encryption key by a unique property. -// Models which "extend" this model: -// - EncryptionKeyIdentityByCRN -type EncryptionKeyIdentity struct { - // The CRN of the [Key Protect Root - // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto - // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. - CRN *string `json:"crn,omitempty"` -} - -func (*EncryptionKeyIdentity) isaEncryptionKeyIdentity() bool { - return true -} - -type EncryptionKeyIdentityIntf interface { - isaEncryptionKeyIdentity() bool -} - -// UnmarshalEncryptionKeyIdentity unmarshals an instance of EncryptionKeyIdentity from the specified map of raw messages. -func UnmarshalEncryptionKeyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EncryptionKeyIdentity) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EncryptionKeyReference : EncryptionKeyReference struct -type EncryptionKeyReference struct { - // The CRN of the [Key Protect Root - // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto - // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. - CRN *string `json:"crn" validate:"required"` -} - -// UnmarshalEncryptionKeyReference unmarshals an instance of EncryptionKeyReference from the specified map of raw messages. -func UnmarshalEncryptionKeyReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EncryptionKeyReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGateway : EndpointGateway struct -type EndpointGateway struct { - // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in - // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. - AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding" validate:"required"` - - // The date and time that the endpoint gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this endpoint gateway. - CRN *string `json:"crn" validate:"required"` - - // The health of this resource. - // - `ok`: No abnormal behavior detected - // - `degraded`: Experiencing compromised performance, capacity, or connectivity - // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated - // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a - // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also - // have this state. - HealthState *string `json:"health_state" validate:"required"` - - // The URL for this endpoint gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this endpoint gateway. - ID *string `json:"id" validate:"required"` - - // The reserved IPs bound to this endpoint gateway. - Ips []ReservedIPReference `json:"ips" validate:"required"` - - // The lifecycle state of the endpoint gateway. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this endpoint gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The security groups targeting this endpoint gateway. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The fully qualified domain name for the target service. - // Deprecated: this field is deprecated and may be removed in a future release. - ServiceEndpoint *string `json:"service_endpoint,omitempty"` - - // The fully qualified domain names for the target service. - ServiceEndpoints []string `json:"service_endpoints" validate:"required"` - - // The target for this endpoint gateway. - Target EndpointGatewayTargetIntf `json:"target" validate:"required"` - - // The VPC this endpoint gateway resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// Constants associated with the EndpointGateway.HealthState property. -// The health of this resource. -// - `ok`: No abnormal behavior detected -// - `degraded`: Experiencing compromised performance, capacity, or connectivity -// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated -// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle -// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this -// state. -const ( - EndpointGatewayHealthStateDegradedConst = "degraded" - EndpointGatewayHealthStateFaultedConst = "faulted" - EndpointGatewayHealthStateInapplicableConst = "inapplicable" - EndpointGatewayHealthStateOkConst = "ok" -) - -// Constants associated with the EndpointGateway.LifecycleState property. -// The lifecycle state of the endpoint gateway. -const ( - EndpointGatewayLifecycleStateDeletingConst = "deleting" - EndpointGatewayLifecycleStateFailedConst = "failed" - EndpointGatewayLifecycleStatePendingConst = "pending" - EndpointGatewayLifecycleStateStableConst = "stable" - EndpointGatewayLifecycleStateSuspendedConst = "suspended" - EndpointGatewayLifecycleStateUpdatingConst = "updating" - EndpointGatewayLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the EndpointGateway.ResourceType property. -// The resource type. -const ( - EndpointGatewayResourceTypeEndpointGatewayConst = "endpoint_gateway" -) - -// UnmarshalEndpointGateway unmarshals an instance of EndpointGateway from the specified map of raw messages. -func UnmarshalEndpointGateway(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGateway) - err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "service_endpoint", &obj.ServiceEndpoint) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "service_endpoints", &obj.ServiceEndpoints) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalEndpointGatewayTarget) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayCollection : EndpointGatewayCollection struct -type EndpointGatewayCollection struct { - // Collection of endpoint gateways. - EndpointGateways []EndpointGateway `json:"endpoint_gateways" validate:"required"` - - // A link to the first page of resources. - First *EndpointGatewayCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *EndpointGatewayCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalEndpointGatewayCollection unmarshals an instance of EndpointGatewayCollection from the specified map of raw messages. -func UnmarshalEndpointGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayCollection) - err = core.UnmarshalModel(m, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGateway) - if err != nil { - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalEndpointGatewayCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalEndpointGatewayCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *EndpointGatewayCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// EndpointGatewayCollectionFirst : A link to the first page of resources. -type EndpointGatewayCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalEndpointGatewayCollectionFirst unmarshals an instance of EndpointGatewayCollectionFirst from the specified map of raw messages. -func UnmarshalEndpointGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type EndpointGatewayCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalEndpointGatewayCollectionNext unmarshals an instance of EndpointGatewayCollectionNext from the specified map of raw messages. -func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayPatch : EndpointGatewayPatch struct -type EndpointGatewayPatch struct { - // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in - // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. - // - // Must be `true` if the VPC this endpoint gateway resides in has `dns.enable_hub` set to - // `true`. - AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` - - // The name for this endpoint gateway. The name must not be used by another endpoint gateway in the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalEndpointGatewayPatch unmarshals an instance of EndpointGatewayPatch from the specified map of raw messages. -func UnmarshalEndpointGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayPatch) - err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the EndpointGatewayPatch -func (endpointGatewayPatch *EndpointGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(endpointGatewayPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// EndpointGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type EndpointGatewayReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalEndpointGatewayReferenceDeleted unmarshals an instance of EndpointGatewayReferenceDeleted from the specified map of raw messages. -func UnmarshalEndpointGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayReferenceRemote : EndpointGatewayReferenceRemote struct -type EndpointGatewayReferenceRemote struct { - // The CRN for this endpoint gateway. - CRN *string `json:"crn" validate:"required"` - - // The URL for this endpoint gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this endpoint gateway. - ID *string `json:"id" validate:"required"` - - // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *EndpointGatewayRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the EndpointGatewayReferenceRemote.ResourceType property. -// The resource type. -const ( - EndpointGatewayReferenceRemoteResourceTypeEndpointGatewayConst = "endpoint_gateway" -) - -// UnmarshalEndpointGatewayReferenceRemote unmarshals an instance of EndpointGatewayReferenceRemote from the specified map of raw messages. -func UnmarshalEndpointGatewayReferenceRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReferenceRemote) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalEndpointGatewayRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type EndpointGatewayRemote struct { - // If present, this property indicates that the referenced resource is remote to this - // account, and identifies the owning account. - Account *AccountReference `json:"account,omitempty"` - - // If present, this property indicates that the referenced resource is remote to this - // region, and identifies the native region. - Region *RegionReference `json:"region,omitempty"` -} - -// UnmarshalEndpointGatewayRemote unmarshals an instance of EndpointGatewayRemote from the specified map of raw messages. -func UnmarshalEndpointGatewayRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayRemote) - err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayReservedIP : A reserved IP to bind to the endpoint gateway. This can be specified using an existing reserved IP, or a prototype -// object for a new reserved IP. The reserved IP will be bound to the endpoint gateway to function as a virtual private -// endpoint for the service. -// Models which "extend" this model: -// - EndpointGatewayReservedIPReservedIPIdentity -// - EndpointGatewayReservedIPReservedIPPrototypeTargetContext -type EndpointGatewayReservedIP struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` - - // The IP address to reserve, which must not already be reserved on the subnet. - // - // If unspecified, an available address on the subnet will automatically be selected. - Address *string `json:"address,omitempty"` - - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with - // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated - // list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The subnet in which to create this reserved IP. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` -} - -func (*EndpointGatewayReservedIP) isaEndpointGatewayReservedIP() bool { - return true -} - -type EndpointGatewayReservedIPIntf interface { - isaEndpointGatewayReservedIP() bool -} - -// UnmarshalEndpointGatewayReservedIP unmarshals an instance of EndpointGatewayReservedIP from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIP) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayTarget : The target for this endpoint gateway. -// Models which "extend" this model: -// - EndpointGatewayTargetProviderCloudServiceReference -// - EndpointGatewayTargetProviderInfrastructureServiceReference -type EndpointGatewayTarget struct { - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. - CRN *string `json:"crn,omitempty"` - - // The type of target. - ResourceType *string `json:"resource_type,omitempty"` - - // The name of a provider infrastructure service. Must be: - // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. - Name *string `json:"name,omitempty"` -} - -// Constants associated with the EndpointGatewayTarget.ResourceType property. -// The type of target. -const ( - EndpointGatewayTargetResourceTypeProviderCloudServiceConst = "provider_cloud_service" -) - -func (*EndpointGatewayTarget) isaEndpointGatewayTarget() bool { - return true -} - -type EndpointGatewayTargetIntf interface { - isaEndpointGatewayTarget() bool -} - -// UnmarshalEndpointGatewayTarget unmarshals an instance of EndpointGatewayTarget from the specified map of raw messages. -func UnmarshalEndpointGatewayTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTarget) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayTargetPrototype : The target to use for this endpoint gateway. Must not already be the target of another endpoint gateway in the VPC. -// Models which "extend" this model: -// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentity -// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity -type EndpointGatewayTargetPrototype struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. - CRN *string `json:"crn,omitempty"` - - // The name of a provider infrastructure service. Must be: - // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. - Name *string `json:"name,omitempty"` -} - -// Constants associated with the EndpointGatewayTargetPrototype.ResourceType property. -// The type of target for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -func (*EndpointGatewayTargetPrototype) isaEndpointGatewayTargetPrototype() bool { - return true -} - -type EndpointGatewayTargetPrototypeIntf interface { - isaEndpointGatewayTargetPrototype() bool -} - -// UnmarshalEndpointGatewayTargetPrototype unmarshals an instance of EndpointGatewayTargetPrototype from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "resource_type", &discValue) - if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'resource_type': %s", err.Error()) - return - } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'resource_type' not found in JSON object") - return - } - if discValue == "provider_cloud_service" { - err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity) - } else if discValue == "provider_infrastructure_service" { - err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'resource_type': %s", discValue) - } - return -} - -// FailoverShareOptions : The FailoverShare options. -type FailoverShareOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // The action to take if the failover request is accepted but cannot be performed or times out: - // - `fail`: Fail the operation, resulting in the replication relationship being unchanged. - // - `split`: Split the replica from its source, resulting in two individual read-write - // file shares. Because the final sync was not completed, the replica may be - // out-of-date. This is useful in disaster recovery scenarios where the source is known - // to be unreachable. - FallbackPolicy *string `json:"fallback_policy,omitempty"` - - // The failover timeout in seconds. - // - // If the timeout is reached, the `fallback_policy` will be triggered. - Timeout *int64 `json:"timeout,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the FailoverShareOptions.FallbackPolicy property. -// The action to take if the failover request is accepted but cannot be performed or times out: -// - `fail`: Fail the operation, resulting in the replication relationship being unchanged. -// - `split`: Split the replica from its source, resulting in two individual read-write -// file shares. Because the final sync was not completed, the replica may be -// out-of-date. This is useful in disaster recovery scenarios where the source is known -// to be unreachable. -const ( - FailoverShareOptionsFallbackPolicyFailConst = "fail" - FailoverShareOptionsFallbackPolicySplitConst = "split" -) - -// NewFailoverShareOptions : Instantiate FailoverShareOptions -func (*VpcV1) NewFailoverShareOptions(shareID string) *FailoverShareOptions { - return &FailoverShareOptions{ - ShareID: core.StringPtr(shareID), - } -} - -// SetShareID : Allow user to set ShareID -func (_options *FailoverShareOptions) SetShareID(shareID string) *FailoverShareOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetFallbackPolicy : Allow user to set FallbackPolicy -func (_options *FailoverShareOptions) SetFallbackPolicy(fallbackPolicy string) *FailoverShareOptions { - _options.FallbackPolicy = core.StringPtr(fallbackPolicy) - return _options -} - -// SetTimeout : Allow user to set Timeout -func (_options *FailoverShareOptions) SetTimeout(timeout int64) *FailoverShareOptions { - _options.Timeout = core.Int64Ptr(timeout) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *FailoverShareOptions) SetHeaders(param map[string]string) *FailoverShareOptions { - options.Headers = param - return options -} - -// FloatingIP : FloatingIP struct -type FloatingIP struct { - // The globally unique IP address. - Address *string `json:"address" validate:"required"` - - // The date and time that the floating IP was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this floating IP. - CRN *string `json:"crn" validate:"required"` - - // The URL for this floating IP. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this floating IP. - ID *string `json:"id" validate:"required"` - - // The name for this floating IP. The name is unique across all floating IPs in the region. - Name *string `json:"name" validate:"required"` - - // The resource group for this floating IP. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The status of the floating IP. - Status *string `json:"status" validate:"required"` - - // The target of this floating IP. - Target FloatingIPTargetIntf `json:"target,omitempty"` - - // The zone this floating IP resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the FloatingIP.Status property. -// The status of the floating IP. -const ( - FloatingIPStatusAvailableConst = "available" - FloatingIPStatusDeletingConst = "deleting" - FloatingIPStatusFailedConst = "failed" - FloatingIPStatusPendingConst = "pending" -) - -// UnmarshalFloatingIP unmarshals an instance of FloatingIP from the specified map of raw messages. -func UnmarshalFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTarget) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPCollection : FloatingIPCollection struct -type FloatingIPCollection struct { - // A link to the first page of resources. - First *FloatingIPCollectionFirst `json:"first" validate:"required"` - - // Collection of floating IPs. - FloatingIps []FloatingIP `json:"floating_ips" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *FloatingIPCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalFloatingIPCollection unmarshals an instance of FloatingIPCollection from the specified map of raw messages. -func UnmarshalFloatingIPCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFloatingIPCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFloatingIPCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *FloatingIPCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// FloatingIPCollectionFirst : A link to the first page of resources. -type FloatingIPCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalFloatingIPCollectionFirst unmarshals an instance of FloatingIPCollectionFirst from the specified map of raw messages. -func UnmarshalFloatingIPCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type FloatingIPCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalFloatingIPCollectionNext unmarshals an instance of FloatingIPCollectionNext from the specified map of raw messages. -func UnmarshalFloatingIPCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPCollectionVirtualNetworkInterfaceContext : FloatingIPCollectionVirtualNetworkInterfaceContext struct -type FloatingIPCollectionVirtualNetworkInterfaceContext struct { - // A link to the first page of resources. - First *FloatingIPCollectionVirtualNetworkInterfaceContextFirst `json:"first" validate:"required"` - - // Collection of floating IPs bound to the virtual network interface specified by the identifier in the URL. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *FloatingIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext unmarshals an instance of FloatingIPCollectionVirtualNetworkInterfaceContext from the specified map of raw messages. -func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPCollectionVirtualNetworkInterfaceContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *FloatingIPCollectionVirtualNetworkInterfaceContext) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// FloatingIPCollectionVirtualNetworkInterfaceContextFirst : A link to the first page of resources. -type FloatingIPCollectionVirtualNetworkInterfaceContextFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst unmarshals an instance of FloatingIPCollectionVirtualNetworkInterfaceContextFirst from the specified map of raw messages. -func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPCollectionVirtualNetworkInterfaceContextFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPCollectionVirtualNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type FloatingIPCollectionVirtualNetworkInterfaceContextNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext unmarshals an instance of FloatingIPCollectionVirtualNetworkInterfaceContextNext from the specified map of raw messages. -func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPCollectionVirtualNetworkInterfaceContextNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPPatch : FloatingIPPatch struct -type FloatingIPPatch struct { - // The name for this floating IP. The name must not be used by another floating IP in the region. - Name *string `json:"name,omitempty"` - - // The target resource to bind this floating IP to, replacing any existing binding. - // The floating IP must not be required by another resource, such as a public gateway. - // - // The target resource must not already have a floating IP bound to it if the target - // resource is: - // - // - an instance network interface - // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` - // - a virtual network interface with `enable_infrastructure_nat` set to `true` - // - // Specify `null` to remove an existing binding. - Target FloatingIPTargetPatchIntf `json:"target,omitempty"` -} - -// UnmarshalFloatingIPPatch unmarshals an instance of FloatingIPPatch from the specified map of raw messages. -func UnmarshalFloatingIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPatch) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the FloatingIPPatch -func (floatingIPPatch *FloatingIPPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(floatingIPPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// FloatingIPPrototype : FloatingIPPrototype struct -// Models which "extend" this model: -// - FloatingIPPrototypeFloatingIPByZone -// - FloatingIPPrototypeFloatingIPByTarget -type FloatingIPPrototype struct { - // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The zone this floating IP will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` - - // The target resource to bind this floating IP to. - // - // The target resource must not already have a floating IP bound to it if the target - // resource is: - // - // - an instance network interface - // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` - // - a virtual network interface with `enable_infrastructure_nat` set to `true`. - Target FloatingIPTargetPrototypeIntf `json:"target,omitempty"` -} - -func (*FloatingIPPrototype) isaFloatingIPPrototype() bool { - return true -} - -type FloatingIPPrototypeIntf interface { - isaFloatingIPPrototype() bool -} - -// UnmarshalFloatingIPPrototype unmarshals an instance of FloatingIPPrototype from the specified map of raw messages. -func UnmarshalFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPReference : FloatingIPReference struct -type FloatingIPReference struct { - // The globally unique IP address. - Address *string `json:"address" validate:"required"` - - // The CRN for this floating IP. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this floating IP. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this floating IP. - ID *string `json:"id" validate:"required"` - - // The name for this floating IP. The name is unique across all floating IPs in the region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalFloatingIPReference unmarshals an instance of FloatingIPReference from the specified map of raw messages. -func UnmarshalFloatingIPReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPReference) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type FloatingIPReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalFloatingIPReferenceDeleted unmarshals an instance of FloatingIPReferenceDeleted from the specified map of raw messages. -func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTarget : The target of this floating IP. -// Models which "extend" this model: -// - FloatingIPTargetNetworkInterfaceReference -// - FloatingIPTargetBareMetalServerNetworkInterfaceReference -// - FloatingIPTargetPublicGatewayReference -// - FloatingIPTargetVirtualNetworkInterfaceReference -type FloatingIPTarget struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - Href *string `json:"href,omitempty"` - - // The unique identifier for this instance network interface. - ID *string `json:"id,omitempty"` - - // The name for this instance network interface. - Name *string `json:"name,omitempty"` - - PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` - - // The CRN for this public gateway. - CRN *string `json:"crn,omitempty"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet,omitempty"` -} - -// Constants associated with the FloatingIPTarget.ResourceType property. -// The resource type. -const ( - FloatingIPTargetResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*FloatingIPTarget) isaFloatingIPTarget() bool { - return true -} - -type FloatingIPTargetIntf interface { - isaFloatingIPTarget() bool -} - -// UnmarshalFloatingIPTarget unmarshals an instance of FloatingIPTarget from the specified map of raw messages. -func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatch : The target resource to bind this floating IP to, replacing any existing binding. The floating IP must not be required -// by another resource, such as a public gateway. -// -// The target resource must not already have a floating IP bound to it if the target resource is: -// -// - an instance network interface -// - a bare metal server network interface with `enable_infrastructure_nat` set to `true` -// - a virtual network interface with `enable_infrastructure_nat` set to `true` -// -// Specify `null` to remove an existing binding. -// Models which "extend" this model: -// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity -// - FloatingIPTargetPatchNetworkInterfaceIdentity -// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentity -type FloatingIPTargetPatch struct { - // The unique identifier for this bare metal server network interface. - ID *string `json:"id,omitempty"` - - // The URL for this bare metal server network interface. - Href *string `json:"href,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*FloatingIPTargetPatch) isaFloatingIPTargetPatch() bool { - return true -} - -type FloatingIPTargetPatchIntf interface { - isaFloatingIPTargetPatch() bool -} - -// UnmarshalFloatingIPTargetPatch unmarshals an instance of FloatingIPTargetPatch from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPrototype : The target resource to bind this floating IP to. -// -// The target resource must not already have a floating IP bound to it if the target resource is: -// -// - an instance network interface -// - a bare metal server network interface with `enable_infrastructure_nat` set to `true` -// - a virtual network interface with `enable_infrastructure_nat` set to `true`. -// Models which "extend" this model: -// - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity -// - FloatingIPTargetPrototypeNetworkInterfaceIdentity -// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity -type FloatingIPTargetPrototype struct { - // The unique identifier for this bare metal server network interface. - ID *string `json:"id,omitempty"` - - // The URL for this bare metal server network interface. - Href *string `json:"href,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*FloatingIPTargetPrototype) isaFloatingIPTargetPrototype() bool { - return true -} - -type FloatingIPTargetPrototypeIntf interface { - isaFloatingIPTargetPrototype() bool -} - -// UnmarshalFloatingIPTargetPrototype unmarshals an instance of FloatingIPTargetPrototype from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPUnpaginatedCollection : FloatingIPUnpaginatedCollection struct -type FloatingIPUnpaginatedCollection struct { - // Collection of floating IPs. - FloatingIps []FloatingIP `json:"floating_ips" validate:"required"` -} - -// UnmarshalFloatingIPUnpaginatedCollection unmarshals an instance of FloatingIPUnpaginatedCollection from the specified map of raw messages. -func UnmarshalFloatingIPUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPUnpaginatedCollection) - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollector : FlowLogCollector struct -type FlowLogCollector struct { - // Indicates whether this collector is active. - Active *bool `json:"active" validate:"required"` - - // Indicates whether this flow log collector will be automatically deleted when `target` is deleted. At present, this - // is always `true`, but may be modifiable in the future. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // The date and time that the flow log collector was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this flow log collector. - CRN *string `json:"crn" validate:"required"` - - // The URL for this flow log collector. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this flow log collector. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the flow log collector. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this flow log collector. The name is unique across all flow log collectors in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this flow log collector. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The Cloud Object Storage bucket where the collected flows are logged. - StorageBucket *LegacyCloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` - - // The target this collector is collecting flow logs for. - // - If the target is an instance network attachment, flow logs will be collected - // for that instance network attachment. - // - If the target is an instance network interface, flow logs will be collected - // for that instance network interface. - // - If the target is a virtual network interface, flow logs will be collected for the - // the virtual network interface's `target` resource if the resource is: - // - an instance network attachment - // - If the target is a virtual server instance, flow logs will be collected - // for all network attachments or network interfaces on that instance. - // - If the target is a subnet, flow logs will be collected - // for all instance network interfaces and virtual network interfaces - // attached to that subnet. - // - If the target is a VPC, flow logs will be collected for all instance network - // interfaces and virtual network interfaces attached to all subnets within that VPC. - // If the target is an instance, subnet, or VPC, flow logs will not be collected - // for any instance network attachments or instance network interfaces within the target - // that are themselves the target of a more specific flow log collector. - Target FlowLogCollectorTargetIntf `json:"target" validate:"required"` - - // The VPC this flow log collector resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// Constants associated with the FlowLogCollector.LifecycleState property. -// The lifecycle state of the flow log collector. -const ( - FlowLogCollectorLifecycleStateDeletingConst = "deleting" - FlowLogCollectorLifecycleStateFailedConst = "failed" - FlowLogCollectorLifecycleStatePendingConst = "pending" - FlowLogCollectorLifecycleStateStableConst = "stable" - FlowLogCollectorLifecycleStateSuspendedConst = "suspended" - FlowLogCollectorLifecycleStateUpdatingConst = "updating" - FlowLogCollectorLifecycleStateWaitingConst = "waiting" -) - -// UnmarshalFlowLogCollector unmarshals an instance of FlowLogCollector from the specified map of raw messages. -func UnmarshalFlowLogCollector(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollector) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalLegacyCloudObjectStorageBucketReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFlowLogCollectorTarget) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorCollection : FlowLogCollectorCollection struct -type FlowLogCollectorCollection struct { - // A link to the first page of resources. - First *FlowLogCollectorCollectionFirst `json:"first" validate:"required"` - - // Collection of flow log collectors. - FlowLogCollectors []FlowLogCollector `json:"flow_log_collectors" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *FlowLogCollectorCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalFlowLogCollectorCollection unmarshals an instance of FlowLogCollectorCollection from the specified map of raw messages. -func UnmarshalFlowLogCollectorCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFlowLogCollectorCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "flow_log_collectors", &obj.FlowLogCollectors, UnmarshalFlowLogCollector) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFlowLogCollectorCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *FlowLogCollectorCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// FlowLogCollectorCollectionFirst : A link to the first page of resources. -type FlowLogCollectorCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalFlowLogCollectorCollectionFirst unmarshals an instance of FlowLogCollectorCollectionFirst from the specified map of raw messages. -func UnmarshalFlowLogCollectorCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type FlowLogCollectorCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalFlowLogCollectorCollectionNext unmarshals an instance of FlowLogCollectorCollectionNext from the specified map of raw messages. -func UnmarshalFlowLogCollectorCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorPatch : FlowLogCollectorPatch struct -type FlowLogCollectorPatch struct { - // Indicates whether this collector is active. Updating to false deactivates the collector and updating to true - // activates the collector. - Active *bool `json:"active,omitempty"` - - // The name for this flow log collector. The name must not be used by another flow log collector in the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalFlowLogCollectorPatch unmarshals an instance of FlowLogCollectorPatch from the specified map of raw messages. -func UnmarshalFlowLogCollectorPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorPatch) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the FlowLogCollectorPatch -func (flowLogCollectorPatch *FlowLogCollectorPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(flowLogCollectorPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// FlowLogCollectorTarget : The target this collector is collecting flow logs for. -// - If the target is an instance network attachment, flow logs will be collected -// for that instance network attachment. -// - If the target is an instance network interface, flow logs will be collected -// for that instance network interface. -// - If the target is a virtual network interface, flow logs will be collected for the -// the virtual network interface's `target` resource if the resource is: -// - an instance network attachment -// - If the target is a virtual server instance, flow logs will be collected -// for all network attachments or network interfaces on that instance. -// - If the target is a subnet, flow logs will be collected -// for all instance network interfaces and virtual network interfaces -// attached to that subnet. -// - If the target is a VPC, flow logs will be collected for all instance network -// interfaces and virtual network interfaces attached to all subnets within that VPC. If the target is an instance, -// -// subnet, or VPC, flow logs will not be collected for any instance network attachments or instance network interfaces -// within the target that are themselves the target of a more specific flow log collector. -// Models which "extend" this model: -// - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext -// - FlowLogCollectorTargetInstanceReference -// - FlowLogCollectorTargetSubnetReference -// - FlowLogCollectorTargetVPCReference -// - FlowLogCollectorTargetInstanceNetworkAttachmentReference -// - FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext -type FlowLogCollectorTarget struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - Href *string `json:"href,omitempty"` - - // The unique identifier for this instance network interface. - ID *string `json:"id,omitempty"` - - // The name for this instance network interface. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` - - // The CRN for this virtual server instance. - CRN *string `json:"crn,omitempty"` - - // The primary IP address of the virtual network interface for the instance network - // attachment. - PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` - - // The subnet of the virtual network interface for the instance network attachment. - Subnet *SubnetReference `json:"subnet,omitempty"` -} - -// Constants associated with the FlowLogCollectorTarget.ResourceType property. -// The resource type. -const ( - FlowLogCollectorTargetResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*FlowLogCollectorTarget) isaFlowLogCollectorTarget() bool { - return true -} - -type FlowLogCollectorTargetIntf interface { - isaFlowLogCollectorTarget() bool -} - -// UnmarshalFlowLogCollectorTarget unmarshals an instance of FlowLogCollectorTarget from the specified map of raw messages. -func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototype : The target this collector will collect flow logs for. -// -// If the target is an instance, subnet, or VPC, flow logs will not be collected for any instance network attachments, -// virtual network interfaces or instance network interfaces within the target that are themselves the target of a more -// specific flow log collector. -// -// The target must not be a virtual network interface that is attached to a bare metal server network attachment or to a -// file share mount target. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity -// - FlowLogCollectorTargetPrototypeInstanceIdentity -// - FlowLogCollectorTargetPrototypeSubnetIdentity -// - FlowLogCollectorTargetPrototypeVPCIdentity -// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity -// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity -type FlowLogCollectorTargetPrototype struct { - // The unique identifier for this instance network interface. - ID *string `json:"id,omitempty"` - - // The URL for this instance network interface. - Href *string `json:"href,omitempty"` - - // The CRN for this virtual server instance. - CRN *string `json:"crn,omitempty"` -} - -func (*FlowLogCollectorTargetPrototype) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -type FlowLogCollectorTargetPrototypeIntf interface { - isaFlowLogCollectorTargetPrototype() bool -} - -// UnmarshalFlowLogCollectorTargetPrototype unmarshals an instance of FlowLogCollectorTargetPrototype from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// GenericResourceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type GenericResourceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalGenericResourceReferenceDeleted unmarshals an instance of GenericResourceReferenceDeleted from the specified map of raw messages. -func UnmarshalGenericResourceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(GenericResourceReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// GetBackupPolicyJobOptions : The GetBackupPolicyJob options. -type GetBackupPolicyJobOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // The backup policy job identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBackupPolicyJobOptions : Instantiate GetBackupPolicyJobOptions -func (*VpcV1) NewGetBackupPolicyJobOptions(backupPolicyID string, id string) *GetBackupPolicyJobOptions { - return &GetBackupPolicyJobOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - ID: core.StringPtr(id), - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *GetBackupPolicyJobOptions) SetBackupPolicyID(backupPolicyID string) *GetBackupPolicyJobOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBackupPolicyJobOptions) SetID(id string) *GetBackupPolicyJobOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBackupPolicyJobOptions) SetHeaders(param map[string]string) *GetBackupPolicyJobOptions { - options.Headers = param - return options -} - -// GetBackupPolicyOptions : The GetBackupPolicy options. -type GetBackupPolicyOptions struct { - // The backup policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBackupPolicyOptions : Instantiate GetBackupPolicyOptions -func (*VpcV1) NewGetBackupPolicyOptions(id string) *GetBackupPolicyOptions { - return &GetBackupPolicyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetBackupPolicyOptions) SetID(id string) *GetBackupPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBackupPolicyOptions) SetHeaders(param map[string]string) *GetBackupPolicyOptions { - options.Headers = param - return options -} - -// GetBackupPolicyPlanOptions : The GetBackupPolicyPlan options. -type GetBackupPolicyPlanOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // The backup policy plan identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBackupPolicyPlanOptions : Instantiate GetBackupPolicyPlanOptions -func (*VpcV1) NewGetBackupPolicyPlanOptions(backupPolicyID string, id string) *GetBackupPolicyPlanOptions { - return &GetBackupPolicyPlanOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - ID: core.StringPtr(id), - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *GetBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *GetBackupPolicyPlanOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBackupPolicyPlanOptions) SetID(id string) *GetBackupPolicyPlanOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBackupPolicyPlanOptions) SetHeaders(param map[string]string) *GetBackupPolicyPlanOptions { - options.Headers = param - return options -} - -// GetBareMetalServerDiskOptions : The GetBareMetalServerDisk options. -type GetBareMetalServerDiskOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server disk identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerDiskOptions : Instantiate GetBareMetalServerDiskOptions -func (*VpcV1) NewGetBareMetalServerDiskOptions(bareMetalServerID string, id string) *GetBareMetalServerDiskOptions { - return &GetBareMetalServerDiskOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *GetBareMetalServerDiskOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerDiskOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerDiskOptions) SetID(id string) *GetBareMetalServerDiskOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerDiskOptions) SetHeaders(param map[string]string) *GetBareMetalServerDiskOptions { - options.Headers = param - return options -} - -// GetBareMetalServerInitializationOptions : The GetBareMetalServerInitialization options. -type GetBareMetalServerInitializationOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerInitializationOptions : Instantiate GetBareMetalServerInitializationOptions -func (*VpcV1) NewGetBareMetalServerInitializationOptions(id string) *GetBareMetalServerInitializationOptions { - return &GetBareMetalServerInitializationOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerInitializationOptions) SetID(id string) *GetBareMetalServerInitializationOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerInitializationOptions) SetHeaders(param map[string]string) *GetBareMetalServerInitializationOptions { - options.Headers = param - return options -} - -// GetBareMetalServerNetworkAttachmentOptions : The GetBareMetalServerNetworkAttachment options. -type GetBareMetalServerNetworkAttachmentOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerNetworkAttachmentOptions : Instantiate GetBareMetalServerNetworkAttachmentOptions -func (*VpcV1) NewGetBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string) *GetBareMetalServerNetworkAttachmentOptions { - return &GetBareMetalServerNetworkAttachmentOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *GetBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkAttachmentOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerNetworkAttachmentOptions) SetID(id string) *GetBareMetalServerNetworkAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkAttachmentOptions { - options.Headers = param - return options -} - -// GetBareMetalServerNetworkInterfaceFloatingIPOptions : The GetBareMetalServerNetworkInterfaceFloatingIP options. -type GetBareMetalServerNetworkInterfaceFloatingIPOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate GetBareMetalServerNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewGetBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { - return &GetBareMetalServerNetworkInterfaceFloatingIPOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} - -// GetBareMetalServerNetworkInterfaceIPOptions : The GetBareMetalServerNetworkInterfaceIP options. -type GetBareMetalServerNetworkInterfaceIPOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerNetworkInterfaceIPOptions : Instantiate GetBareMetalServerNetworkInterfaceIPOptions -func (*VpcV1) NewGetBareMetalServerNetworkInterfaceIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *GetBareMetalServerNetworkInterfaceIPOptions { - return &GetBareMetalServerNetworkInterfaceIPOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceIPOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetBareMetalServerNetworkInterfaceIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceIPOptions { - options.Headers = param - return options -} - -// GetBareMetalServerNetworkInterfaceOptions : The GetBareMetalServerNetworkInterface options. -type GetBareMetalServerNetworkInterfaceOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerNetworkInterfaceOptions : Instantiate GetBareMetalServerNetworkInterfaceOptions -func (*VpcV1) NewGetBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string) *GetBareMetalServerNetworkInterfaceOptions { - return &GetBareMetalServerNetworkInterfaceOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *GetBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerNetworkInterfaceOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceOptions { - options.Headers = param - return options -} - -// GetBareMetalServerOptions : The GetBareMetalServer options. -type GetBareMetalServerOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerOptions : Instantiate GetBareMetalServerOptions -func (*VpcV1) NewGetBareMetalServerOptions(id string) *GetBareMetalServerOptions { - return &GetBareMetalServerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerOptions) SetID(id string) *GetBareMetalServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerOptions) SetHeaders(param map[string]string) *GetBareMetalServerOptions { - options.Headers = param - return options -} - -// GetBareMetalServerProfileOptions : The GetBareMetalServerProfile options. -type GetBareMetalServerProfileOptions struct { - // The bare metal server profile name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerProfileOptions : Instantiate GetBareMetalServerProfileOptions -func (*VpcV1) NewGetBareMetalServerProfileOptions(name string) *GetBareMetalServerProfileOptions { - return &GetBareMetalServerProfileOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetBareMetalServerProfileOptions) SetName(name string) *GetBareMetalServerProfileOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerProfileOptions) SetHeaders(param map[string]string) *GetBareMetalServerProfileOptions { - options.Headers = param - return options -} - -// GetDedicatedHostDiskOptions : The GetDedicatedHostDisk options. -type GetDedicatedHostDiskOptions struct { - // The dedicated host identifier. - DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="` - - // The dedicated host disk identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetDedicatedHostDiskOptions : Instantiate GetDedicatedHostDiskOptions -func (*VpcV1) NewGetDedicatedHostDiskOptions(dedicatedHostID string, id string) *GetDedicatedHostDiskOptions { - return &GetDedicatedHostDiskOptions{ - DedicatedHostID: core.StringPtr(dedicatedHostID), - ID: core.StringPtr(id), - } -} - -// SetDedicatedHostID : Allow user to set DedicatedHostID -func (_options *GetDedicatedHostDiskOptions) SetDedicatedHostID(dedicatedHostID string) *GetDedicatedHostDiskOptions { - _options.DedicatedHostID = core.StringPtr(dedicatedHostID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetDedicatedHostDiskOptions) SetID(id string) *GetDedicatedHostDiskOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetDedicatedHostDiskOptions) SetHeaders(param map[string]string) *GetDedicatedHostDiskOptions { - options.Headers = param - return options -} - -// GetDedicatedHostGroupOptions : The GetDedicatedHostGroup options. -type GetDedicatedHostGroupOptions struct { - // The dedicated host group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetDedicatedHostGroupOptions : Instantiate GetDedicatedHostGroupOptions -func (*VpcV1) NewGetDedicatedHostGroupOptions(id string) *GetDedicatedHostGroupOptions { - return &GetDedicatedHostGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetDedicatedHostGroupOptions) SetID(id string) *GetDedicatedHostGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetDedicatedHostGroupOptions) SetHeaders(param map[string]string) *GetDedicatedHostGroupOptions { - options.Headers = param - return options -} - -// GetDedicatedHostOptions : The GetDedicatedHost options. -type GetDedicatedHostOptions struct { - // The dedicated host identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetDedicatedHostOptions : Instantiate GetDedicatedHostOptions -func (*VpcV1) NewGetDedicatedHostOptions(id string) *GetDedicatedHostOptions { - return &GetDedicatedHostOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetDedicatedHostOptions) SetID(id string) *GetDedicatedHostOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetDedicatedHostOptions) SetHeaders(param map[string]string) *GetDedicatedHostOptions { - options.Headers = param - return options -} - -// GetDedicatedHostProfileOptions : The GetDedicatedHostProfile options. -type GetDedicatedHostProfileOptions struct { - // The dedicated host profile name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetDedicatedHostProfileOptions : Instantiate GetDedicatedHostProfileOptions -func (*VpcV1) NewGetDedicatedHostProfileOptions(name string) *GetDedicatedHostProfileOptions { - return &GetDedicatedHostProfileOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetDedicatedHostProfileOptions) SetName(name string) *GetDedicatedHostProfileOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetDedicatedHostProfileOptions) SetHeaders(param map[string]string) *GetDedicatedHostProfileOptions { - options.Headers = param - return options -} - -// GetEndpointGatewayIPOptions : The GetEndpointGatewayIP options. -type GetEndpointGatewayIPOptions struct { - // The endpoint gateway identifier. - EndpointGatewayID *string `json:"endpoint_gateway_id" validate:"required,ne="` - - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetEndpointGatewayIPOptions : Instantiate GetEndpointGatewayIPOptions -func (*VpcV1) NewGetEndpointGatewayIPOptions(endpointGatewayID string, id string) *GetEndpointGatewayIPOptions { - return &GetEndpointGatewayIPOptions{ - EndpointGatewayID: core.StringPtr(endpointGatewayID), - ID: core.StringPtr(id), - } -} - -// SetEndpointGatewayID : Allow user to set EndpointGatewayID -func (_options *GetEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *GetEndpointGatewayIPOptions { - _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetEndpointGatewayIPOptions) SetID(id string) *GetEndpointGatewayIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetEndpointGatewayIPOptions) SetHeaders(param map[string]string) *GetEndpointGatewayIPOptions { - options.Headers = param - return options -} - -// GetEndpointGatewayOptions : The GetEndpointGateway options. -type GetEndpointGatewayOptions struct { - // The endpoint gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetEndpointGatewayOptions : Instantiate GetEndpointGatewayOptions -func (*VpcV1) NewGetEndpointGatewayOptions(id string) *GetEndpointGatewayOptions { - return &GetEndpointGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetEndpointGatewayOptions) SetID(id string) *GetEndpointGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetEndpointGatewayOptions) SetHeaders(param map[string]string) *GetEndpointGatewayOptions { - options.Headers = param - return options -} - -// GetFloatingIPOptions : The GetFloatingIP options. -type GetFloatingIPOptions struct { - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetFloatingIPOptions : Instantiate GetFloatingIPOptions -func (*VpcV1) NewGetFloatingIPOptions(id string) *GetFloatingIPOptions { - return &GetFloatingIPOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetFloatingIPOptions) SetID(id string) *GetFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetFloatingIPOptions) SetHeaders(param map[string]string) *GetFloatingIPOptions { - options.Headers = param - return options -} - -// GetFlowLogCollectorOptions : The GetFlowLogCollector options. -type GetFlowLogCollectorOptions struct { - // The flow log collector identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetFlowLogCollectorOptions : Instantiate GetFlowLogCollectorOptions -func (*VpcV1) NewGetFlowLogCollectorOptions(id string) *GetFlowLogCollectorOptions { - return &GetFlowLogCollectorOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetFlowLogCollectorOptions) SetID(id string) *GetFlowLogCollectorOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetFlowLogCollectorOptions) SetHeaders(param map[string]string) *GetFlowLogCollectorOptions { - options.Headers = param - return options -} - -// GetIkePolicyOptions : The GetIkePolicy options. -type GetIkePolicyOptions struct { - // The IKE policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetIkePolicyOptions : Instantiate GetIkePolicyOptions -func (*VpcV1) NewGetIkePolicyOptions(id string) *GetIkePolicyOptions { - return &GetIkePolicyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetIkePolicyOptions) SetID(id string) *GetIkePolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetIkePolicyOptions) SetHeaders(param map[string]string) *GetIkePolicyOptions { - options.Headers = param - return options -} - -// GetImageExportJobOptions : The GetImageExportJob options. -type GetImageExportJobOptions struct { - // The image identifier. - ImageID *string `json:"image_id" validate:"required,ne="` - - // The image export job identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetImageExportJobOptions : Instantiate GetImageExportJobOptions -func (*VpcV1) NewGetImageExportJobOptions(imageID string, id string) *GetImageExportJobOptions { - return &GetImageExportJobOptions{ - ImageID: core.StringPtr(imageID), - ID: core.StringPtr(id), - } -} - -// SetImageID : Allow user to set ImageID -func (_options *GetImageExportJobOptions) SetImageID(imageID string) *GetImageExportJobOptions { - _options.ImageID = core.StringPtr(imageID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetImageExportJobOptions) SetID(id string) *GetImageExportJobOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetImageExportJobOptions) SetHeaders(param map[string]string) *GetImageExportJobOptions { - options.Headers = param - return options -} - -// GetImageOptions : The GetImage options. -type GetImageOptions struct { - // The image identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetImageOptions : Instantiate GetImageOptions -func (*VpcV1) NewGetImageOptions(id string) *GetImageOptions { - return &GetImageOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetImageOptions) SetID(id string) *GetImageOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetImageOptions) SetHeaders(param map[string]string) *GetImageOptions { - options.Headers = param - return options -} - -// GetInstanceDiskOptions : The GetInstanceDisk options. -type GetInstanceDiskOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance disk identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceDiskOptions : Instantiate GetInstanceDiskOptions -func (*VpcV1) NewGetInstanceDiskOptions(instanceID string, id string) *GetInstanceDiskOptions { - return &GetInstanceDiskOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *GetInstanceDiskOptions) SetInstanceID(instanceID string) *GetInstanceDiskOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceDiskOptions) SetID(id string) *GetInstanceDiskOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceDiskOptions) SetHeaders(param map[string]string) *GetInstanceDiskOptions { - options.Headers = param - return options -} - -// GetInstanceGroupManagerActionOptions : The GetInstanceGroupManagerAction options. -type GetInstanceGroupManagerActionOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager action identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceGroupManagerActionOptions : Instantiate GetInstanceGroupManagerActionOptions -func (*VpcV1) NewGetInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string) *GetInstanceGroupManagerActionOptions { - return &GetInstanceGroupManagerActionOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *GetInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerActionOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *GetInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *GetInstanceGroupManagerActionOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceGroupManagerActionOptions) SetID(id string) *GetInstanceGroupManagerActionOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerActionOptions { - options.Headers = param - return options -} - -// GetInstanceGroupManagerOptions : The GetInstanceGroupManager options. -type GetInstanceGroupManagerOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceGroupManagerOptions : Instantiate GetInstanceGroupManagerOptions -func (*VpcV1) NewGetInstanceGroupManagerOptions(instanceGroupID string, id string) *GetInstanceGroupManagerOptions { - return &GetInstanceGroupManagerOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *GetInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceGroupManagerOptions) SetID(id string) *GetInstanceGroupManagerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceGroupManagerOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerOptions { - options.Headers = param - return options -} - -// GetInstanceGroupManagerPolicyOptions : The GetInstanceGroupManagerPolicy options. -type GetInstanceGroupManagerPolicyOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceGroupManagerPolicyOptions : Instantiate GetInstanceGroupManagerPolicyOptions -func (*VpcV1) NewGetInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string) *GetInstanceGroupManagerPolicyOptions { - return &GetInstanceGroupManagerPolicyOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *GetInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerPolicyOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *GetInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *GetInstanceGroupManagerPolicyOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceGroupManagerPolicyOptions) SetID(id string) *GetInstanceGroupManagerPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerPolicyOptions { - options.Headers = param - return options -} - -// GetInstanceGroupMembershipOptions : The GetInstanceGroupMembership options. -type GetInstanceGroupMembershipOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group membership identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceGroupMembershipOptions : Instantiate GetInstanceGroupMembershipOptions -func (*VpcV1) NewGetInstanceGroupMembershipOptions(instanceGroupID string, id string) *GetInstanceGroupMembershipOptions { - return &GetInstanceGroupMembershipOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *GetInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupMembershipOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceGroupMembershipOptions) SetID(id string) *GetInstanceGroupMembershipOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *GetInstanceGroupMembershipOptions { - options.Headers = param - return options -} - -// GetInstanceGroupOptions : The GetInstanceGroup options. -type GetInstanceGroupOptions struct { - // The instance group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceGroupOptions : Instantiate GetInstanceGroupOptions -func (*VpcV1) NewGetInstanceGroupOptions(id string) *GetInstanceGroupOptions { - return &GetInstanceGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetInstanceGroupOptions) SetID(id string) *GetInstanceGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceGroupOptions) SetHeaders(param map[string]string) *GetInstanceGroupOptions { - options.Headers = param - return options -} - -// GetInstanceInitializationOptions : The GetInstanceInitialization options. -type GetInstanceInitializationOptions struct { - // The instance identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceInitializationOptions : Instantiate GetInstanceInitializationOptions -func (*VpcV1) NewGetInstanceInitializationOptions(id string) *GetInstanceInitializationOptions { - return &GetInstanceInitializationOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetInstanceInitializationOptions) SetID(id string) *GetInstanceInitializationOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceInitializationOptions) SetHeaders(param map[string]string) *GetInstanceInitializationOptions { - options.Headers = param - return options -} - -// GetInstanceNetworkAttachmentOptions : The GetInstanceNetworkAttachment options. -type GetInstanceNetworkAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceNetworkAttachmentOptions : Instantiate GetInstanceNetworkAttachmentOptions -func (*VpcV1) NewGetInstanceNetworkAttachmentOptions(instanceID string, id string) *GetInstanceNetworkAttachmentOptions { - return &GetInstanceNetworkAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *GetInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceNetworkAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceNetworkAttachmentOptions) SetID(id string) *GetInstanceNetworkAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceNetworkAttachmentOptions { - options.Headers = param - return options -} - -// GetInstanceNetworkInterfaceFloatingIPOptions : The GetInstanceNetworkInterfaceFloatingIP options. -type GetInstanceNetworkInterfaceFloatingIPOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceNetworkInterfaceFloatingIPOptions : Instantiate GetInstanceNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewGetInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *GetInstanceNetworkInterfaceFloatingIPOptions { - return &GetInstanceNetworkInterfaceFloatingIPOptions{ - InstanceID: core.StringPtr(instanceID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *GetInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceFloatingIPOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *GetInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetInstanceNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *GetInstanceNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} - -// GetInstanceNetworkInterfaceIPOptions : The GetInstanceNetworkInterfaceIP options. -type GetInstanceNetworkInterfaceIPOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceNetworkInterfaceIPOptions : Instantiate GetInstanceNetworkInterfaceIPOptions -func (*VpcV1) NewGetInstanceNetworkInterfaceIPOptions(instanceID string, networkInterfaceID string, id string) *GetInstanceNetworkInterfaceIPOptions { - return &GetInstanceNetworkInterfaceIPOptions{ - InstanceID: core.StringPtr(instanceID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *GetInstanceNetworkInterfaceIPOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceIPOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *GetInstanceNetworkInterfaceIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetInstanceNetworkInterfaceIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceNetworkInterfaceIPOptions) SetID(id string) *GetInstanceNetworkInterfaceIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceIPOptions { - options.Headers = param - return options -} - -// GetInstanceNetworkInterfaceOptions : The GetInstanceNetworkInterface options. -type GetInstanceNetworkInterfaceOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceNetworkInterfaceOptions : Instantiate GetInstanceNetworkInterfaceOptions -func (*VpcV1) NewGetInstanceNetworkInterfaceOptions(instanceID string, id string) *GetInstanceNetworkInterfaceOptions { - return &GetInstanceNetworkInterfaceOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *GetInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceNetworkInterfaceOptions) SetID(id string) *GetInstanceNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceOptions { - options.Headers = param - return options -} - -// GetInstanceOptions : The GetInstance options. -type GetInstanceOptions struct { - // The virtual server instance identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceOptions : Instantiate GetInstanceOptions -func (*VpcV1) NewGetInstanceOptions(id string) *GetInstanceOptions { - return &GetInstanceOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetInstanceOptions) SetID(id string) *GetInstanceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceOptions) SetHeaders(param map[string]string) *GetInstanceOptions { - options.Headers = param - return options -} - -// GetInstanceProfileOptions : The GetInstanceProfile options. -type GetInstanceProfileOptions struct { - // The instance profile name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceProfileOptions : Instantiate GetInstanceProfileOptions -func (*VpcV1) NewGetInstanceProfileOptions(name string) *GetInstanceProfileOptions { - return &GetInstanceProfileOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetInstanceProfileOptions) SetName(name string) *GetInstanceProfileOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceProfileOptions) SetHeaders(param map[string]string) *GetInstanceProfileOptions { - options.Headers = param - return options -} - -// GetInstanceTemplateOptions : The GetInstanceTemplate options. -type GetInstanceTemplateOptions struct { - // The instance template identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceTemplateOptions : Instantiate GetInstanceTemplateOptions -func (*VpcV1) NewGetInstanceTemplateOptions(id string) *GetInstanceTemplateOptions { - return &GetInstanceTemplateOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetInstanceTemplateOptions) SetID(id string) *GetInstanceTemplateOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceTemplateOptions) SetHeaders(param map[string]string) *GetInstanceTemplateOptions { - options.Headers = param - return options -} - -// GetInstanceVolumeAttachmentOptions : The GetInstanceVolumeAttachment options. -type GetInstanceVolumeAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The volume attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceVolumeAttachmentOptions : Instantiate GetInstanceVolumeAttachmentOptions -func (*VpcV1) NewGetInstanceVolumeAttachmentOptions(instanceID string, id string) *GetInstanceVolumeAttachmentOptions { - return &GetInstanceVolumeAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *GetInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceVolumeAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceVolumeAttachmentOptions) SetID(id string) *GetInstanceVolumeAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceVolumeAttachmentOptions { - options.Headers = param - return options -} - -// GetIpsecPolicyOptions : The GetIpsecPolicy options. -type GetIpsecPolicyOptions struct { - // The IPsec policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetIpsecPolicyOptions : Instantiate GetIpsecPolicyOptions -func (*VpcV1) NewGetIpsecPolicyOptions(id string) *GetIpsecPolicyOptions { - return &GetIpsecPolicyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetIpsecPolicyOptions) SetID(id string) *GetIpsecPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetIpsecPolicyOptions) SetHeaders(param map[string]string) *GetIpsecPolicyOptions { - options.Headers = param - return options -} - -// GetKeyOptions : The GetKey options. -type GetKeyOptions struct { - // The key identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetKeyOptions : Instantiate GetKeyOptions -func (*VpcV1) NewGetKeyOptions(id string) *GetKeyOptions { - return &GetKeyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetKeyOptions) SetID(id string) *GetKeyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetKeyOptions) SetHeaders(param map[string]string) *GetKeyOptions { - options.Headers = param - return options -} - -// GetLoadBalancerListenerOptions : The GetLoadBalancerListener options. -type GetLoadBalancerListenerOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerListenerOptions : Instantiate GetLoadBalancerListenerOptions -func (*VpcV1) NewGetLoadBalancerListenerOptions(loadBalancerID string, id string) *GetLoadBalancerListenerOptions { - return &GetLoadBalancerListenerOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *GetLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerListenerOptions) SetID(id string) *GetLoadBalancerListenerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerListenerOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerOptions { - options.Headers = param - return options -} - -// GetLoadBalancerListenerPolicyOptions : The GetLoadBalancerListenerPolicy options. -type GetLoadBalancerListenerPolicyOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerListenerPolicyOptions : Instantiate GetLoadBalancerListenerPolicyOptions -func (*VpcV1) NewGetLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string) *GetLoadBalancerListenerPolicyOptions { - return &GetLoadBalancerListenerPolicyOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *GetLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerPolicyOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *GetLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *GetLoadBalancerListenerPolicyOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerListenerPolicyOptions) SetID(id string) *GetLoadBalancerListenerPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerPolicyOptions { - options.Headers = param - return options -} - -// GetLoadBalancerListenerPolicyRuleOptions : The GetLoadBalancerListenerPolicyRule options. -type GetLoadBalancerListenerPolicyRuleOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - PolicyID *string `json:"policy_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerListenerPolicyRuleOptions : Instantiate GetLoadBalancerListenerPolicyRuleOptions -func (*VpcV1) NewGetLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string) *GetLoadBalancerListenerPolicyRuleOptions { - return &GetLoadBalancerListenerPolicyRuleOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - PolicyID: core.StringPtr(policyID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerPolicyRuleOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *GetLoadBalancerListenerPolicyRuleOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetPolicyID : Allow user to set PolicyID -func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *GetLoadBalancerListenerPolicyRuleOptions { - _options.PolicyID = core.StringPtr(policyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetID(id string) *GetLoadBalancerListenerPolicyRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerPolicyRuleOptions { - options.Headers = param - return options -} - -// GetLoadBalancerOptions : The GetLoadBalancer options. -type GetLoadBalancerOptions struct { - // The load balancer identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerOptions : Instantiate GetLoadBalancerOptions -func (*VpcV1) NewGetLoadBalancerOptions(id string) *GetLoadBalancerOptions { - return &GetLoadBalancerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerOptions) SetID(id string) *GetLoadBalancerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerOptions) SetHeaders(param map[string]string) *GetLoadBalancerOptions { - options.Headers = param - return options -} - -// GetLoadBalancerPoolMemberOptions : The GetLoadBalancerPoolMember options. -type GetLoadBalancerPoolMemberOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - PoolID *string `json:"pool_id" validate:"required,ne="` - - // The member identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerPoolMemberOptions : Instantiate GetLoadBalancerPoolMemberOptions -func (*VpcV1) NewGetLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string) *GetLoadBalancerPoolMemberOptions { - return &GetLoadBalancerPoolMemberOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - PoolID: core.StringPtr(poolID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *GetLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerPoolMemberOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetPoolID : Allow user to set PoolID -func (_options *GetLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *GetLoadBalancerPoolMemberOptions { - _options.PoolID = core.StringPtr(poolID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerPoolMemberOptions) SetID(id string) *GetLoadBalancerPoolMemberOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *GetLoadBalancerPoolMemberOptions { - options.Headers = param - return options -} - -// GetLoadBalancerPoolOptions : The GetLoadBalancerPool options. -type GetLoadBalancerPoolOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerPoolOptions : Instantiate GetLoadBalancerPoolOptions -func (*VpcV1) NewGetLoadBalancerPoolOptions(loadBalancerID string, id string) *GetLoadBalancerPoolOptions { - return &GetLoadBalancerPoolOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *GetLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerPoolOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerPoolOptions) SetID(id string) *GetLoadBalancerPoolOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerPoolOptions) SetHeaders(param map[string]string) *GetLoadBalancerPoolOptions { - options.Headers = param - return options -} - -// GetLoadBalancerProfileOptions : The GetLoadBalancerProfile options. -type GetLoadBalancerProfileOptions struct { - // The load balancer profile name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerProfileOptions : Instantiate GetLoadBalancerProfileOptions -func (*VpcV1) NewGetLoadBalancerProfileOptions(name string) *GetLoadBalancerProfileOptions { - return &GetLoadBalancerProfileOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetLoadBalancerProfileOptions) SetName(name string) *GetLoadBalancerProfileOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerProfileOptions) SetHeaders(param map[string]string) *GetLoadBalancerProfileOptions { - options.Headers = param - return options -} - -// GetLoadBalancerStatisticsOptions : The GetLoadBalancerStatistics options. -type GetLoadBalancerStatisticsOptions struct { - // The load balancer identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerStatisticsOptions : Instantiate GetLoadBalancerStatisticsOptions -func (*VpcV1) NewGetLoadBalancerStatisticsOptions(id string) *GetLoadBalancerStatisticsOptions { - return &GetLoadBalancerStatisticsOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerStatisticsOptions) SetID(id string) *GetLoadBalancerStatisticsOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerStatisticsOptions) SetHeaders(param map[string]string) *GetLoadBalancerStatisticsOptions { - options.Headers = param - return options -} - -// GetNetworkACLOptions : The GetNetworkACL options. -type GetNetworkACLOptions struct { - // The network ACL identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetNetworkACLOptions : Instantiate GetNetworkACLOptions -func (*VpcV1) NewGetNetworkACLOptions(id string) *GetNetworkACLOptions { - return &GetNetworkACLOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetNetworkACLOptions) SetID(id string) *GetNetworkACLOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetNetworkACLOptions) SetHeaders(param map[string]string) *GetNetworkACLOptions { - options.Headers = param - return options -} - -// GetNetworkACLRuleOptions : The GetNetworkACLRule options. -type GetNetworkACLRuleOptions struct { - // The network ACL identifier. - NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetNetworkACLRuleOptions : Instantiate GetNetworkACLRuleOptions -func (*VpcV1) NewGetNetworkACLRuleOptions(networkACLID string, id string) *GetNetworkACLRuleOptions { - return &GetNetworkACLRuleOptions{ - NetworkACLID: core.StringPtr(networkACLID), - ID: core.StringPtr(id), - } -} - -// SetNetworkACLID : Allow user to set NetworkACLID -func (_options *GetNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *GetNetworkACLRuleOptions { - _options.NetworkACLID = core.StringPtr(networkACLID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetNetworkACLRuleOptions) SetID(id string) *GetNetworkACLRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetNetworkACLRuleOptions) SetHeaders(param map[string]string) *GetNetworkACLRuleOptions { - options.Headers = param - return options -} - -// GetNetworkInterfaceFloatingIPOptions : The GetNetworkInterfaceFloatingIP options. -type GetNetworkInterfaceFloatingIPOptions struct { - // The virtual network interface identifier. - VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` - - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetNetworkInterfaceFloatingIPOptions : Instantiate GetNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewGetNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *GetNetworkInterfaceFloatingIPOptions { - return &GetNetworkInterfaceFloatingIPOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *GetNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetNetworkInterfaceFloatingIPOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetNetworkInterfaceFloatingIPOptions) SetID(id string) *GetNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} - -// GetOperatingSystemOptions : The GetOperatingSystem options. -type GetOperatingSystemOptions struct { - // The operating system name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetOperatingSystemOptions : Instantiate GetOperatingSystemOptions -func (*VpcV1) NewGetOperatingSystemOptions(name string) *GetOperatingSystemOptions { - return &GetOperatingSystemOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetOperatingSystemOptions) SetName(name string) *GetOperatingSystemOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetOperatingSystemOptions) SetHeaders(param map[string]string) *GetOperatingSystemOptions { - options.Headers = param - return options -} - -// GetPlacementGroupOptions : The GetPlacementGroup options. -type GetPlacementGroupOptions struct { - // The placement group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetPlacementGroupOptions : Instantiate GetPlacementGroupOptions -func (*VpcV1) NewGetPlacementGroupOptions(id string) *GetPlacementGroupOptions { - return &GetPlacementGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetPlacementGroupOptions) SetID(id string) *GetPlacementGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetPlacementGroupOptions) SetHeaders(param map[string]string) *GetPlacementGroupOptions { - options.Headers = param - return options -} - -// GetPublicGatewayOptions : The GetPublicGateway options. -type GetPublicGatewayOptions struct { - // The public gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetPublicGatewayOptions : Instantiate GetPublicGatewayOptions -func (*VpcV1) NewGetPublicGatewayOptions(id string) *GetPublicGatewayOptions { - return &GetPublicGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetPublicGatewayOptions) SetID(id string) *GetPublicGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetPublicGatewayOptions) SetHeaders(param map[string]string) *GetPublicGatewayOptions { - options.Headers = param - return options -} - -// GetRegionOptions : The GetRegion options. -type GetRegionOptions struct { - // The region name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetRegionOptions : Instantiate GetRegionOptions -func (*VpcV1) NewGetRegionOptions(name string) *GetRegionOptions { - return &GetRegionOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetRegionOptions) SetName(name string) *GetRegionOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetRegionOptions) SetHeaders(param map[string]string) *GetRegionOptions { - options.Headers = param - return options -} - -// GetRegionZoneOptions : The GetRegionZone options. -type GetRegionZoneOptions struct { - // The region name. - RegionName *string `json:"region_name" validate:"required,ne="` - - // The zone name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetRegionZoneOptions : Instantiate GetRegionZoneOptions -func (*VpcV1) NewGetRegionZoneOptions(regionName string, name string) *GetRegionZoneOptions { - return &GetRegionZoneOptions{ - RegionName: core.StringPtr(regionName), - Name: core.StringPtr(name), - } -} - -// SetRegionName : Allow user to set RegionName -func (_options *GetRegionZoneOptions) SetRegionName(regionName string) *GetRegionZoneOptions { - _options.RegionName = core.StringPtr(regionName) - return _options -} - -// SetName : Allow user to set Name -func (_options *GetRegionZoneOptions) SetName(name string) *GetRegionZoneOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetRegionZoneOptions) SetHeaders(param map[string]string) *GetRegionZoneOptions { - options.Headers = param - return options -} - -// GetSecurityGroupOptions : The GetSecurityGroup options. -type GetSecurityGroupOptions struct { - // The security group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSecurityGroupOptions : Instantiate GetSecurityGroupOptions -func (*VpcV1) NewGetSecurityGroupOptions(id string) *GetSecurityGroupOptions { - return &GetSecurityGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetSecurityGroupOptions) SetID(id string) *GetSecurityGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSecurityGroupOptions) SetHeaders(param map[string]string) *GetSecurityGroupOptions { - options.Headers = param - return options -} - -// GetSecurityGroupRuleOptions : The GetSecurityGroupRule options. -type GetSecurityGroupRuleOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSecurityGroupRuleOptions : Instantiate GetSecurityGroupRuleOptions -func (*VpcV1) NewGetSecurityGroupRuleOptions(securityGroupID string, id string) *GetSecurityGroupRuleOptions { - return &GetSecurityGroupRuleOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - ID: core.StringPtr(id), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *GetSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *GetSecurityGroupRuleOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetSecurityGroupRuleOptions) SetID(id string) *GetSecurityGroupRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSecurityGroupRuleOptions) SetHeaders(param map[string]string) *GetSecurityGroupRuleOptions { - options.Headers = param - return options -} - -// GetSecurityGroupTargetOptions : The GetSecurityGroupTarget options. -type GetSecurityGroupTargetOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The security group target identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSecurityGroupTargetOptions : Instantiate GetSecurityGroupTargetOptions -func (*VpcV1) NewGetSecurityGroupTargetOptions(securityGroupID string, id string) *GetSecurityGroupTargetOptions { - return &GetSecurityGroupTargetOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - ID: core.StringPtr(id), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *GetSecurityGroupTargetOptions) SetSecurityGroupID(securityGroupID string) *GetSecurityGroupTargetOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetSecurityGroupTargetOptions) SetID(id string) *GetSecurityGroupTargetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSecurityGroupTargetOptions) SetHeaders(param map[string]string) *GetSecurityGroupTargetOptions { - options.Headers = param - return options -} - -// GetShareMountTargetOptions : The GetShareMountTarget options. -type GetShareMountTargetOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // The share mount target identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetShareMountTargetOptions : Instantiate GetShareMountTargetOptions -func (*VpcV1) NewGetShareMountTargetOptions(shareID string, id string) *GetShareMountTargetOptions { - return &GetShareMountTargetOptions{ - ShareID: core.StringPtr(shareID), - ID: core.StringPtr(id), - } -} - -// SetShareID : Allow user to set ShareID -func (_options *GetShareMountTargetOptions) SetShareID(shareID string) *GetShareMountTargetOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetShareMountTargetOptions) SetID(id string) *GetShareMountTargetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetShareMountTargetOptions) SetHeaders(param map[string]string) *GetShareMountTargetOptions { - options.Headers = param - return options -} - -// GetShareOptions : The GetShare options. -type GetShareOptions struct { - // The file share identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetShareOptions : Instantiate GetShareOptions -func (*VpcV1) NewGetShareOptions(id string) *GetShareOptions { - return &GetShareOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetShareOptions) SetID(id string) *GetShareOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetShareOptions) SetHeaders(param map[string]string) *GetShareOptions { - options.Headers = param - return options -} - -// GetShareProfileOptions : The GetShareProfile options. -type GetShareProfileOptions struct { - // The file share profile name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetShareProfileOptions : Instantiate GetShareProfileOptions -func (*VpcV1) NewGetShareProfileOptions(name string) *GetShareProfileOptions { - return &GetShareProfileOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetShareProfileOptions) SetName(name string) *GetShareProfileOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetShareProfileOptions) SetHeaders(param map[string]string) *GetShareProfileOptions { - options.Headers = param - return options -} - -// GetShareSourceOptions : The GetShareSource options. -type GetShareSourceOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetShareSourceOptions : Instantiate GetShareSourceOptions -func (*VpcV1) NewGetShareSourceOptions(shareID string) *GetShareSourceOptions { - return &GetShareSourceOptions{ - ShareID: core.StringPtr(shareID), - } -} - -// SetShareID : Allow user to set ShareID -func (_options *GetShareSourceOptions) SetShareID(shareID string) *GetShareSourceOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetShareSourceOptions) SetHeaders(param map[string]string) *GetShareSourceOptions { - options.Headers = param - return options -} - -// GetSnapshotCloneOptions : The GetSnapshotClone options. -type GetSnapshotCloneOptions struct { - // The snapshot identifier. - ID *string `json:"id" validate:"required,ne="` - - // The zone name. - ZoneName *string `json:"zone_name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSnapshotCloneOptions : Instantiate GetSnapshotCloneOptions -func (*VpcV1) NewGetSnapshotCloneOptions(id string, zoneName string) *GetSnapshotCloneOptions { - return &GetSnapshotCloneOptions{ - ID: core.StringPtr(id), - ZoneName: core.StringPtr(zoneName), - } -} - -// SetID : Allow user to set ID -func (_options *GetSnapshotCloneOptions) SetID(id string) *GetSnapshotCloneOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *GetSnapshotCloneOptions) SetZoneName(zoneName string) *GetSnapshotCloneOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSnapshotCloneOptions) SetHeaders(param map[string]string) *GetSnapshotCloneOptions { - options.Headers = param - return options -} - -// GetSnapshotOptions : The GetSnapshot options. -type GetSnapshotOptions struct { - // The snapshot identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSnapshotOptions : Instantiate GetSnapshotOptions -func (*VpcV1) NewGetSnapshotOptions(id string) *GetSnapshotOptions { - return &GetSnapshotOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetSnapshotOptions) SetID(id string) *GetSnapshotOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSnapshotOptions) SetHeaders(param map[string]string) *GetSnapshotOptions { - options.Headers = param - return options -} - -// GetSubnetNetworkACLOptions : The GetSubnetNetworkACL options. -type GetSubnetNetworkACLOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSubnetNetworkACLOptions : Instantiate GetSubnetNetworkACLOptions -func (*VpcV1) NewGetSubnetNetworkACLOptions(id string) *GetSubnetNetworkACLOptions { - return &GetSubnetNetworkACLOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetSubnetNetworkACLOptions) SetID(id string) *GetSubnetNetworkACLOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSubnetNetworkACLOptions) SetHeaders(param map[string]string) *GetSubnetNetworkACLOptions { - options.Headers = param - return options -} - -// GetSubnetOptions : The GetSubnet options. -type GetSubnetOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSubnetOptions : Instantiate GetSubnetOptions -func (*VpcV1) NewGetSubnetOptions(id string) *GetSubnetOptions { - return &GetSubnetOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetSubnetOptions) SetID(id string) *GetSubnetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSubnetOptions) SetHeaders(param map[string]string) *GetSubnetOptions { - options.Headers = param - return options -} - -// GetSubnetPublicGatewayOptions : The GetSubnetPublicGateway options. -type GetSubnetPublicGatewayOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSubnetPublicGatewayOptions : Instantiate GetSubnetPublicGatewayOptions -func (*VpcV1) NewGetSubnetPublicGatewayOptions(id string) *GetSubnetPublicGatewayOptions { - return &GetSubnetPublicGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetSubnetPublicGatewayOptions) SetID(id string) *GetSubnetPublicGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *GetSubnetPublicGatewayOptions { - options.Headers = param - return options -} - -// GetSubnetReservedIPOptions : The GetSubnetReservedIP options. -type GetSubnetReservedIPOptions struct { - // The subnet identifier. - SubnetID *string `json:"subnet_id" validate:"required,ne="` - - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSubnetReservedIPOptions : Instantiate GetSubnetReservedIPOptions -func (*VpcV1) NewGetSubnetReservedIPOptions(subnetID string, id string) *GetSubnetReservedIPOptions { - return &GetSubnetReservedIPOptions{ - SubnetID: core.StringPtr(subnetID), - ID: core.StringPtr(id), - } -} - -// SetSubnetID : Allow user to set SubnetID -func (_options *GetSubnetReservedIPOptions) SetSubnetID(subnetID string) *GetSubnetReservedIPOptions { - _options.SubnetID = core.StringPtr(subnetID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetSubnetReservedIPOptions) SetID(id string) *GetSubnetReservedIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSubnetReservedIPOptions) SetHeaders(param map[string]string) *GetSubnetReservedIPOptions { - options.Headers = param - return options -} - -// GetSubnetRoutingTableOptions : The GetSubnetRoutingTable options. -type GetSubnetRoutingTableOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSubnetRoutingTableOptions : Instantiate GetSubnetRoutingTableOptions -func (*VpcV1) NewGetSubnetRoutingTableOptions(id string) *GetSubnetRoutingTableOptions { - return &GetSubnetRoutingTableOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetSubnetRoutingTableOptions) SetID(id string) *GetSubnetRoutingTableOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSubnetRoutingTableOptions) SetHeaders(param map[string]string) *GetSubnetRoutingTableOptions { - options.Headers = param - return options -} - -// GetVirtualNetworkInterfaceIPOptions : The GetVirtualNetworkInterfaceIP options. -type GetVirtualNetworkInterfaceIPOptions struct { - // The virtual network interface identifier. - VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` - - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVirtualNetworkInterfaceIPOptions : Instantiate GetVirtualNetworkInterfaceIPOptions -func (*VpcV1) NewGetVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *GetVirtualNetworkInterfaceIPOptions { - return &GetVirtualNetworkInterfaceIPOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *GetVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetVirtualNetworkInterfaceIPOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVirtualNetworkInterfaceIPOptions) SetID(id string) *GetVirtualNetworkInterfaceIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetVirtualNetworkInterfaceIPOptions { - options.Headers = param - return options -} - -// GetVirtualNetworkInterfaceOptions : The GetVirtualNetworkInterface options. -type GetVirtualNetworkInterfaceOptions struct { - // The virtual network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVirtualNetworkInterfaceOptions : Instantiate GetVirtualNetworkInterfaceOptions -func (*VpcV1) NewGetVirtualNetworkInterfaceOptions(id string) *GetVirtualNetworkInterfaceOptions { - return &GetVirtualNetworkInterfaceOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVirtualNetworkInterfaceOptions) SetID(id string) *GetVirtualNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetVirtualNetworkInterfaceOptions { - options.Headers = param - return options -} - -// GetVolumeOptions : The GetVolume options. -type GetVolumeOptions struct { - // The volume identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVolumeOptions : Instantiate GetVolumeOptions -func (*VpcV1) NewGetVolumeOptions(id string) *GetVolumeOptions { - return &GetVolumeOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVolumeOptions) SetID(id string) *GetVolumeOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVolumeOptions) SetHeaders(param map[string]string) *GetVolumeOptions { - options.Headers = param - return options -} - -// GetVolumeProfileOptions : The GetVolumeProfile options. -type GetVolumeProfileOptions struct { - // The volume profile name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVolumeProfileOptions : Instantiate GetVolumeProfileOptions -func (*VpcV1) NewGetVolumeProfileOptions(name string) *GetVolumeProfileOptions { - return &GetVolumeProfileOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetVolumeProfileOptions) SetName(name string) *GetVolumeProfileOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVolumeProfileOptions) SetHeaders(param map[string]string) *GetVolumeProfileOptions { - options.Headers = param - return options -} - -// GetVPCAddressPrefixOptions : The GetVPCAddressPrefix options. -type GetVPCAddressPrefixOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The prefix identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCAddressPrefixOptions : Instantiate GetVPCAddressPrefixOptions -func (*VpcV1) NewGetVPCAddressPrefixOptions(vpcID string, id string) *GetVPCAddressPrefixOptions { - return &GetVPCAddressPrefixOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *GetVPCAddressPrefixOptions) SetVPCID(vpcID string) *GetVPCAddressPrefixOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPCAddressPrefixOptions) SetID(id string) *GetVPCAddressPrefixOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCAddressPrefixOptions) SetHeaders(param map[string]string) *GetVPCAddressPrefixOptions { - options.Headers = param - return options -} - -// GetVPCDefaultNetworkACLOptions : The GetVPCDefaultNetworkACL options. -type GetVPCDefaultNetworkACLOptions struct { - // The VPC identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCDefaultNetworkACLOptions : Instantiate GetVPCDefaultNetworkACLOptions -func (*VpcV1) NewGetVPCDefaultNetworkACLOptions(id string) *GetVPCDefaultNetworkACLOptions { - return &GetVPCDefaultNetworkACLOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPCDefaultNetworkACLOptions) SetID(id string) *GetVPCDefaultNetworkACLOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCDefaultNetworkACLOptions) SetHeaders(param map[string]string) *GetVPCDefaultNetworkACLOptions { - options.Headers = param - return options -} - -// GetVPCDefaultRoutingTableOptions : The GetVPCDefaultRoutingTable options. -type GetVPCDefaultRoutingTableOptions struct { - // The VPC identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCDefaultRoutingTableOptions : Instantiate GetVPCDefaultRoutingTableOptions -func (*VpcV1) NewGetVPCDefaultRoutingTableOptions(id string) *GetVPCDefaultRoutingTableOptions { - return &GetVPCDefaultRoutingTableOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPCDefaultRoutingTableOptions) SetID(id string) *GetVPCDefaultRoutingTableOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCDefaultRoutingTableOptions) SetHeaders(param map[string]string) *GetVPCDefaultRoutingTableOptions { - options.Headers = param - return options -} - -// GetVPCDefaultSecurityGroupOptions : The GetVPCDefaultSecurityGroup options. -type GetVPCDefaultSecurityGroupOptions struct { - // The VPC identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCDefaultSecurityGroupOptions : Instantiate GetVPCDefaultSecurityGroupOptions -func (*VpcV1) NewGetVPCDefaultSecurityGroupOptions(id string) *GetVPCDefaultSecurityGroupOptions { - return &GetVPCDefaultSecurityGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPCDefaultSecurityGroupOptions) SetID(id string) *GetVPCDefaultSecurityGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCDefaultSecurityGroupOptions) SetHeaders(param map[string]string) *GetVPCDefaultSecurityGroupOptions { - options.Headers = param - return options -} - -// GetVPCDnsResolutionBindingOptions : The GetVPCDnsResolutionBinding options. -type GetVPCDnsResolutionBindingOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The DNS resolution binding identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCDnsResolutionBindingOptions : Instantiate GetVPCDnsResolutionBindingOptions -func (*VpcV1) NewGetVPCDnsResolutionBindingOptions(vpcID string, id string) *GetVPCDnsResolutionBindingOptions { - return &GetVPCDnsResolutionBindingOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *GetVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *GetVPCDnsResolutionBindingOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPCDnsResolutionBindingOptions) SetID(id string) *GetVPCDnsResolutionBindingOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *GetVPCDnsResolutionBindingOptions { - options.Headers = param - return options -} - -// GetVPCOptions : The GetVPC options. -type GetVPCOptions struct { - // The VPC identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCOptions : Instantiate GetVPCOptions -func (*VpcV1) NewGetVPCOptions(id string) *GetVPCOptions { - return &GetVPCOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPCOptions) SetID(id string) *GetVPCOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCOptions) SetHeaders(param map[string]string) *GetVPCOptions { - options.Headers = param - return options -} - -// GetVPCRouteOptions : The GetVPCRoute options. -type GetVPCRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The route identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCRouteOptions : Instantiate GetVPCRouteOptions -func (*VpcV1) NewGetVPCRouteOptions(vpcID string, id string) *GetVPCRouteOptions { - return &GetVPCRouteOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *GetVPCRouteOptions) SetVPCID(vpcID string) *GetVPCRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPCRouteOptions) SetID(id string) *GetVPCRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCRouteOptions) SetHeaders(param map[string]string) *GetVPCRouteOptions { - options.Headers = param - return options -} - -// GetVPCRoutingTableOptions : The GetVPCRoutingTable options. -type GetVPCRoutingTableOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCRoutingTableOptions : Instantiate GetVPCRoutingTableOptions -func (*VpcV1) NewGetVPCRoutingTableOptions(vpcID string, id string) *GetVPCRoutingTableOptions { - return &GetVPCRoutingTableOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *GetVPCRoutingTableOptions) SetVPCID(vpcID string) *GetVPCRoutingTableOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPCRoutingTableOptions) SetID(id string) *GetVPCRoutingTableOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCRoutingTableOptions) SetHeaders(param map[string]string) *GetVPCRoutingTableOptions { - options.Headers = param - return options -} - -// GetVPCRoutingTableRouteOptions : The GetVPCRoutingTableRoute options. -type GetVPCRoutingTableRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table identifier. - RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` - - // The VPC routing table route identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCRoutingTableRouteOptions : Instantiate GetVPCRoutingTableRouteOptions -func (*VpcV1) NewGetVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string) *GetVPCRoutingTableRouteOptions { - return &GetVPCRoutingTableRouteOptions{ - VPCID: core.StringPtr(vpcID), - RoutingTableID: core.StringPtr(routingTableID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *GetVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *GetVPCRoutingTableRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetRoutingTableID : Allow user to set RoutingTableID -func (_options *GetVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *GetVPCRoutingTableRouteOptions { - _options.RoutingTableID = core.StringPtr(routingTableID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPCRoutingTableRouteOptions) SetID(id string) *GetVPCRoutingTableRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *GetVPCRoutingTableRouteOptions { - options.Headers = param - return options -} - -// GetVPNGatewayConnectionOptions : The GetVPNGatewayConnection options. -type GetVPNGatewayConnectionOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPNGatewayConnectionOptions : Instantiate GetVPNGatewayConnectionOptions -func (*VpcV1) NewGetVPNGatewayConnectionOptions(vpnGatewayID string, id string) *GetVPNGatewayConnectionOptions { - return &GetVPNGatewayConnectionOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *GetVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *GetVPNGatewayConnectionOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPNGatewayConnectionOptions) SetID(id string) *GetVPNGatewayConnectionOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *GetVPNGatewayConnectionOptions { - options.Headers = param - return options -} - -// GetVPNGatewayOptions : The GetVPNGateway options. -type GetVPNGatewayOptions struct { - // The VPN gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPNGatewayOptions : Instantiate GetVPNGatewayOptions -func (*VpcV1) NewGetVPNGatewayOptions(id string) *GetVPNGatewayOptions { - return &GetVPNGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPNGatewayOptions) SetID(id string) *GetVPNGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPNGatewayOptions) SetHeaders(param map[string]string) *GetVPNGatewayOptions { - options.Headers = param - return options -} - -// GetVPNServerClientConfigurationOptions : The GetVPNServerClientConfiguration options. -type GetVPNServerClientConfigurationOptions struct { - // The VPN server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPNServerClientConfigurationOptions : Instantiate GetVPNServerClientConfigurationOptions -func (*VpcV1) NewGetVPNServerClientConfigurationOptions(id string) *GetVPNServerClientConfigurationOptions { - return &GetVPNServerClientConfigurationOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPNServerClientConfigurationOptions) SetID(id string) *GetVPNServerClientConfigurationOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPNServerClientConfigurationOptions) SetHeaders(param map[string]string) *GetVPNServerClientConfigurationOptions { - options.Headers = param - return options -} - -// GetVPNServerClientOptions : The GetVPNServerClient options. -type GetVPNServerClientOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The VPN client identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPNServerClientOptions : Instantiate GetVPNServerClientOptions -func (*VpcV1) NewGetVPNServerClientOptions(vpnServerID string, id string) *GetVPNServerClientOptions { - return &GetVPNServerClientOptions{ - VPNServerID: core.StringPtr(vpnServerID), - ID: core.StringPtr(id), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *GetVPNServerClientOptions) SetVPNServerID(vpnServerID string) *GetVPNServerClientOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPNServerClientOptions) SetID(id string) *GetVPNServerClientOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPNServerClientOptions) SetHeaders(param map[string]string) *GetVPNServerClientOptions { - options.Headers = param - return options -} - -// GetVPNServerOptions : The GetVPNServer options. -type GetVPNServerOptions struct { - // The VPN server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPNServerOptions : Instantiate GetVPNServerOptions -func (*VpcV1) NewGetVPNServerOptions(id string) *GetVPNServerOptions { - return &GetVPNServerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPNServerOptions) SetID(id string) *GetVPNServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPNServerOptions) SetHeaders(param map[string]string) *GetVPNServerOptions { - options.Headers = param - return options -} - -// GetVPNServerRouteOptions : The GetVPNServerRoute options. -type GetVPNServerRouteOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The VPN route identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPNServerRouteOptions : Instantiate GetVPNServerRouteOptions -func (*VpcV1) NewGetVPNServerRouteOptions(vpnServerID string, id string) *GetVPNServerRouteOptions { - return &GetVPNServerRouteOptions{ - VPNServerID: core.StringPtr(vpnServerID), - ID: core.StringPtr(id), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *GetVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *GetVPNServerRouteOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPNServerRouteOptions) SetID(id string) *GetVPNServerRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPNServerRouteOptions) SetHeaders(param map[string]string) *GetVPNServerRouteOptions { - options.Headers = param - return options -} - -// IkePolicy : IkePolicy struct -type IkePolicy struct { - // The authentication algorithm - // - // The `md5` and `sha1` algorithms have been deprecated. - AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` - - // The VPN gateway connections that use this IKE policy. - Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` - - // The date and time that this IKE policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The Diffie-Hellman group - // - // Groups `2` and `5` have been deprecated. - DhGroup *int64 `json:"dh_group" validate:"required"` - - // The encryption algorithm - // - // The `triple_des` algorithm has been deprecated. - EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` - - // The IKE policy's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this IKE policy. - ID *string `json:"id" validate:"required"` - - // The IKE protocol version. - IkeVersion *int64 `json:"ike_version" validate:"required"` - - // The key lifetime in seconds. - KeyLifetime *int64 `json:"key_lifetime" validate:"required"` - - // The name for this IKE policy. The name is unique across all IKE policies in the region. - Name *string `json:"name" validate:"required"` - - // The IKE negotiation mode. Only `main` is supported. - NegotiationMode *string `json:"negotiation_mode" validate:"required"` - - // The resource group for this IKE policy. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the IkePolicy.AuthenticationAlgorithm property. -// The authentication algorithm -// -// The `md5` and `sha1` algorithms have been deprecated. -const ( - IkePolicyAuthenticationAlgorithmMd5Const = "md5" - IkePolicyAuthenticationAlgorithmSha1Const = "sha1" - IkePolicyAuthenticationAlgorithmSha256Const = "sha256" - IkePolicyAuthenticationAlgorithmSha384Const = "sha384" - IkePolicyAuthenticationAlgorithmSha512Const = "sha512" -) - -// Constants associated with the IkePolicy.EncryptionAlgorithm property. -// The encryption algorithm -// -// The `triple_des` algorithm has been deprecated. -const ( - IkePolicyEncryptionAlgorithmAes128Const = "aes128" - IkePolicyEncryptionAlgorithmAes192Const = "aes192" - IkePolicyEncryptionAlgorithmAes256Const = "aes256" - IkePolicyEncryptionAlgorithmTripleDesConst = "triple_des" -) - -// Constants associated with the IkePolicy.NegotiationMode property. -// The IKE negotiation mode. Only `main` is supported. -const ( - IkePolicyNegotiationModeMainConst = "main" -) - -// Constants associated with the IkePolicy.ResourceType property. -// The resource type. -const ( - IkePolicyResourceTypeIkePolicyConst = "ike_policy" -) - -// UnmarshalIkePolicy unmarshals an instance of IkePolicy from the specified map of raw messages. -func UnmarshalIkePolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicy) - err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) - if err != nil { - return - } - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "negotiation_mode", &obj.NegotiationMode) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IkePolicyCollection : IkePolicyCollection struct -type IkePolicyCollection struct { - // A link to the first page of resources. - First *IkePolicyCollectionFirst `json:"first" validate:"required"` - - // Collection of IKE policies. - IkePolicies []IkePolicy `json:"ike_policies" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *IkePolicyCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalIkePolicyCollection unmarshals an instance of IkePolicyCollection from the specified map of raw messages. -func UnmarshalIkePolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIkePolicyCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policies", &obj.IkePolicies, UnmarshalIkePolicy) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIkePolicyCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *IkePolicyCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// IkePolicyPatch : IkePolicyPatch struct -type IkePolicyPatch struct { - // The authentication algorithm. - AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` - - // The Diffie-Hellman group. - DhGroup *int64 `json:"dh_group,omitempty"` - - // The encryption algorithm. - EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` - - // The IKE protocol version. - IkeVersion *int64 `json:"ike_version,omitempty"` - - // The key lifetime in seconds. - KeyLifetime *int64 `json:"key_lifetime,omitempty"` - - // The name for this IKE policy. The name must not be used by another IKE policy in the region. - Name *string `json:"name,omitempty"` -} - -// Constants associated with the IkePolicyPatch.AuthenticationAlgorithm property. -// The authentication algorithm. -const ( - IkePolicyPatchAuthenticationAlgorithmSha256Const = "sha256" - IkePolicyPatchAuthenticationAlgorithmSha384Const = "sha384" - IkePolicyPatchAuthenticationAlgorithmSha512Const = "sha512" -) - -// Constants associated with the IkePolicyPatch.EncryptionAlgorithm property. -// The encryption algorithm. -const ( - IkePolicyPatchEncryptionAlgorithmAes128Const = "aes128" - IkePolicyPatchEncryptionAlgorithmAes192Const = "aes192" - IkePolicyPatchEncryptionAlgorithmAes256Const = "aes256" -) - -// UnmarshalIkePolicyPatch unmarshals an instance of IkePolicyPatch from the specified map of raw messages. -func UnmarshalIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyPatch) - err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the IkePolicyPatch -func (ikePolicyPatch *IkePolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(ikePolicyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// IkePolicyReference : IkePolicyReference struct -type IkePolicyReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *IkePolicyReferenceDeleted `json:"deleted,omitempty"` - - // The IKE policy's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this IKE policy. - ID *string `json:"id" validate:"required"` - - // The name for this IKE policy. The name is unique across all IKE policies in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the IkePolicyReference.ResourceType property. -// The resource type. -const ( - IkePolicyReferenceResourceTypeIkePolicyConst = "ike_policy" -) - -// UnmarshalIkePolicyReference unmarshals an instance of IkePolicyReference from the specified map of raw messages. -func UnmarshalIkePolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIkePolicyReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IP : IP struct -type IP struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} - -// NewIP : Instantiate IP (Generic Model Constructor) -func (*VpcV1) NewIP(address string) (_model *IP, err error) { - _model = &IP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalIP unmarshals an instance of IP from the specified map of raw messages. -func UnmarshalIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IPsecPolicy : IPsecPolicy struct -type IPsecPolicy struct { - // The authentication algorithm - // - // The `md5` and `sha1` algorithms have been deprecated - // - // Must be `disabled` if and only if the `encryption_algorithm` is - // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. - AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` - - // The VPN gateway connections that use this IPsec policy. - Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` - - // The date and time that this IPsec policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The encapsulation mode used. Only `tunnel` is supported. - EncapsulationMode *string `json:"encapsulation_mode" validate:"required"` - - // The encryption algorithm - // - // The `triple_des` algorithm has been deprecated - // - // The `authentication_algorithm` must be `disabled` if and only if - // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or - // `aes256gcm16`. - EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` - - // The IPsec policy's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this IPsec policy. - ID *string `json:"id" validate:"required"` - - // The key lifetime in seconds. - KeyLifetime *int64 `json:"key_lifetime" validate:"required"` - - // The name for this IPsec policy. The name is unique across all IPsec policies in the region. - Name *string `json:"name" validate:"required"` - - // Perfect Forward Secrecy - // - // Groups `group_2` and `group_5` have been deprecated. - Pfs *string `json:"pfs" validate:"required"` - - // The resource group for this IPsec policy. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The transform protocol used. Only `esp` is supported. - TransformProtocol *string `json:"transform_protocol" validate:"required"` -} - -// Constants associated with the IPsecPolicy.AuthenticationAlgorithm property. -// The authentication algorithm -// -// # The `md5` and `sha1` algorithms have been deprecated -// -// Must be `disabled` if and only if the `encryption_algorithm` is -// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. -const ( - IPsecPolicyAuthenticationAlgorithmDisabledConst = "disabled" - IPsecPolicyAuthenticationAlgorithmMd5Const = "md5" - IPsecPolicyAuthenticationAlgorithmSha1Const = "sha1" - IPsecPolicyAuthenticationAlgorithmSha256Const = "sha256" - IPsecPolicyAuthenticationAlgorithmSha384Const = "sha384" - IPsecPolicyAuthenticationAlgorithmSha512Const = "sha512" -) - -// Constants associated with the IPsecPolicy.EncapsulationMode property. -// The encapsulation mode used. Only `tunnel` is supported. -const ( - IPsecPolicyEncapsulationModeTunnelConst = "tunnel" -) - -// Constants associated with the IPsecPolicy.EncryptionAlgorithm property. -// The encryption algorithm -// -// The `triple_des` algorithm has been deprecated -// -// The `authentication_algorithm` must be `disabled` if and only if -// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or -// `aes256gcm16`. -const ( - IPsecPolicyEncryptionAlgorithmAes128Const = "aes128" - IPsecPolicyEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" - IPsecPolicyEncryptionAlgorithmAes192Const = "aes192" - IPsecPolicyEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" - IPsecPolicyEncryptionAlgorithmAes256Const = "aes256" - IPsecPolicyEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" - IPsecPolicyEncryptionAlgorithmTripleDesConst = "triple_des" -) - -// Constants associated with the IPsecPolicy.Pfs property. -// Perfect Forward Secrecy -// -// Groups `group_2` and `group_5` have been deprecated. -const ( - IPsecPolicyPfsDisabledConst = "disabled" - IPsecPolicyPfsGroup14Const = "group_14" - IPsecPolicyPfsGroup15Const = "group_15" - IPsecPolicyPfsGroup16Const = "group_16" - IPsecPolicyPfsGroup17Const = "group_17" - IPsecPolicyPfsGroup18Const = "group_18" - IPsecPolicyPfsGroup19Const = "group_19" - IPsecPolicyPfsGroup2Const = "group_2" - IPsecPolicyPfsGroup20Const = "group_20" - IPsecPolicyPfsGroup21Const = "group_21" - IPsecPolicyPfsGroup22Const = "group_22" - IPsecPolicyPfsGroup23Const = "group_23" - IPsecPolicyPfsGroup24Const = "group_24" - IPsecPolicyPfsGroup31Const = "group_31" - IPsecPolicyPfsGroup5Const = "group_5" -) - -// Constants associated with the IPsecPolicy.ResourceType property. -// The resource type. -const ( - IPsecPolicyResourceTypeIpsecPolicyConst = "ipsec_policy" -) - -// Constants associated with the IPsecPolicy.TransformProtocol property. -// The transform protocol used. Only `esp` is supported. -const ( - IPsecPolicyTransformProtocolEspConst = "esp" -) - -// UnmarshalIPsecPolicy unmarshals an instance of IPsecPolicy from the specified map of raw messages. -func UnmarshalIPsecPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicy) - err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) - if err != nil { - return - } - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "encapsulation_mode", &obj.EncapsulationMode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "pfs", &obj.Pfs) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "transform_protocol", &obj.TransformProtocol) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IPsecPolicyCollection : IPsecPolicyCollection struct -type IPsecPolicyCollection struct { - // A link to the first page of resources. - First *IPsecPolicyCollectionFirst `json:"first" validate:"required"` - - // Collection of IPsec policies. - IpsecPolicies []IPsecPolicy `json:"ipsec_policies" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *IPsecPolicyCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalIPsecPolicyCollection unmarshals an instance of IPsecPolicyCollection from the specified map of raw messages. -func UnmarshalIPsecPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIPsecPolicyCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policies", &obj.IpsecPolicies, UnmarshalIPsecPolicy) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIPsecPolicyCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *IPsecPolicyCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// IPsecPolicyCollectionFirst : A link to the first page of resources. -type IPsecPolicyCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalIPsecPolicyCollectionFirst unmarshals an instance of IPsecPolicyCollectionFirst from the specified map of raw messages. -func UnmarshalIPsecPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IPsecPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type IPsecPolicyCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalIPsecPolicyCollectionNext unmarshals an instance of IPsecPolicyCollectionNext from the specified map of raw messages. -func UnmarshalIPsecPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IPsecPolicyPatch : IPsecPolicyPatch struct -type IPsecPolicyPatch struct { - // The authentication algorithm - // - // Must be `disabled` if and only if the `encryption_algorithm` is - // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. - AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` - - // The encryption algorithm - // - // The `authentication_algorithm` must be `disabled` if and only if - // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or - // `aes256gcm16`. - EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` - - // The key lifetime in seconds. - KeyLifetime *int64 `json:"key_lifetime,omitempty"` - - // The name for this IPsec policy. The name must not be used by another IPsec policy in the region. - Name *string `json:"name,omitempty"` - - // Perfect Forward Secrecy. - Pfs *string `json:"pfs,omitempty"` -} - -// Constants associated with the IPsecPolicyPatch.AuthenticationAlgorithm property. -// The authentication algorithm -// -// Must be `disabled` if and only if the `encryption_algorithm` is -// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. -const ( - IPsecPolicyPatchAuthenticationAlgorithmDisabledConst = "disabled" - IPsecPolicyPatchAuthenticationAlgorithmSha256Const = "sha256" - IPsecPolicyPatchAuthenticationAlgorithmSha384Const = "sha384" - IPsecPolicyPatchAuthenticationAlgorithmSha512Const = "sha512" -) - -// Constants associated with the IPsecPolicyPatch.EncryptionAlgorithm property. -// The encryption algorithm -// -// The `authentication_algorithm` must be `disabled` if and only if -// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or -// `aes256gcm16`. -const ( - IPsecPolicyPatchEncryptionAlgorithmAes128Const = "aes128" - IPsecPolicyPatchEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" - IPsecPolicyPatchEncryptionAlgorithmAes192Const = "aes192" - IPsecPolicyPatchEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" - IPsecPolicyPatchEncryptionAlgorithmAes256Const = "aes256" - IPsecPolicyPatchEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" -) - -// Constants associated with the IPsecPolicyPatch.Pfs property. -// Perfect Forward Secrecy. -const ( - IPsecPolicyPatchPfsDisabledConst = "disabled" - IPsecPolicyPatchPfsGroup14Const = "group_14" - IPsecPolicyPatchPfsGroup15Const = "group_15" - IPsecPolicyPatchPfsGroup16Const = "group_16" - IPsecPolicyPatchPfsGroup17Const = "group_17" - IPsecPolicyPatchPfsGroup18Const = "group_18" - IPsecPolicyPatchPfsGroup19Const = "group_19" - IPsecPolicyPatchPfsGroup20Const = "group_20" - IPsecPolicyPatchPfsGroup21Const = "group_21" - IPsecPolicyPatchPfsGroup22Const = "group_22" - IPsecPolicyPatchPfsGroup23Const = "group_23" - IPsecPolicyPatchPfsGroup24Const = "group_24" - IPsecPolicyPatchPfsGroup31Const = "group_31" -) - -// UnmarshalIPsecPolicyPatch unmarshals an instance of IPsecPolicyPatch from the specified map of raw messages. -func UnmarshalIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyPatch) - err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "pfs", &obj.Pfs) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the IPsecPolicyPatch -func (iPsecPolicyPatch *IPsecPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(iPsecPolicyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// IPsecPolicyReference : IPsecPolicyReference struct -type IPsecPolicyReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *IPsecPolicyReferenceDeleted `json:"deleted,omitempty"` - - // The IPsec policy's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this IPsec policy. - ID *string `json:"id" validate:"required"` - - // The name for this IPsec policy. The name is unique across all IPsec policies in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the IPsecPolicyReference.ResourceType property. -// The resource type. -const ( - IPsecPolicyReferenceResourceTypeIpsecPolicyConst = "ipsec_policy" -) - -// UnmarshalIPsecPolicyReference unmarshals an instance of IPsecPolicyReference from the specified map of raw messages. -func UnmarshalIPsecPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIPsecPolicyReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IPsecPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type IPsecPolicyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalIPsecPolicyReferenceDeleted unmarshals an instance of IPsecPolicyReferenceDeleted from the specified map of raw messages. -func UnmarshalIPsecPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IkePolicyCollectionFirst : A link to the first page of resources. -type IkePolicyCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalIkePolicyCollectionFirst unmarshals an instance of IkePolicyCollectionFirst from the specified map of raw messages. -func UnmarshalIkePolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IkePolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type IkePolicyCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalIkePolicyCollectionNext unmarshals an instance of IkePolicyCollectionNext from the specified map of raw messages. -func UnmarshalIkePolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IkePolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type IkePolicyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalIkePolicyReferenceDeleted unmarshals an instance of IkePolicyReferenceDeleted from the specified map of raw messages. -func UnmarshalIkePolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Image : Image struct -type Image struct { - CatalogOffering *ImageCatalogOffering `json:"catalog_offering" validate:"required"` - - // The date and time that the image was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this image. - CRN *string `json:"crn" validate:"required"` - - // The deprecation date and time (UTC) for this image. - // - // If absent, no deprecation date and time has been set. - DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` - - // The type of encryption used on the image. - Encryption *string `json:"encryption" validate:"required"` - - // The key that will be used to encrypt volumes created from this image (unless an - // alternate `encryption_key` is specified at volume creation). - // - // This property will be present for images with an `encryption` type of `user_managed`. - EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` - - // Details for the stored image file. - File *ImageFile `json:"file" validate:"required"` - - // The URL for this image. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this image. - ID *string `json:"id" validate:"required"` - - // The minimum size (in gigabytes) of a volume onto which this image may be provisioned. - // - // This property may be absent if the image has a `status` of `pending` or `failed`. - MinimumProvisionedSize *int64 `json:"minimum_provisioned_size,omitempty"` - - // The name for this image. The name is unique across all images in the region. - Name *string `json:"name" validate:"required"` - - // The obsolescence date and time (UTC) for this image. - // - // If absent, no obsolescence date and time has been set. - ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` - - // The operating system included in this image. - OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` - - // The resource group for this image. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The volume used to create this image (this may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - // If absent, this image was not created from a volume. - SourceVolume *VolumeReference `json:"source_volume,omitempty"` - - // The status of this image - // - available: image can be used (provisionable) - // - deleting: image is being deleted, and can no longer be used to provision new - // resources - // - deprecated: image is administratively slated to become `obsolete` - // - failed: image is corrupt or did not pass validation - // - obsolete: image administratively set to not be used for new resources - // - pending: image is being imported and is not yet `available` - // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the - // unexpected property value was encountered. - Status *string `json:"status" validate:"required"` - - // The reasons for the current status (if any): - // - `encrypted_data_key_invalid`: image cannot be decrypted with the specified - // `encryption_key` - // - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted - // - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled - // - `image_data_corrupted`: image data is corrupt, or is not in the specified format - // - `image_provisioned_size_unsupported`: image requires a boot volume size greater - // than the maximum supported value - // - `image_request_in_progress`: image operation is in progress (such as an import from - // Cloud Object Storage) - // - `image_request_queued`: image request has been accepted but the requested - // operation has not started - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []ImageStatusReason `json:"status_reasons" validate:"required"` - - // The visibility of this image. - // - `private`: Visible only to this account - // - `public`: Visible to all accounts. - Visibility *string `json:"visibility" validate:"required"` -} - -// Constants associated with the Image.Encryption property. -// The type of encryption used on the image. -const ( - ImageEncryptionNoneConst = "none" - ImageEncryptionUserManagedConst = "user_managed" -) - -// Constants associated with the Image.ResourceType property. -// The resource type. -const ( - ImageResourceTypeImageConst = "image" -) - -// Constants associated with the Image.Status property. -// The status of this image -// - available: image can be used (provisionable) -// - deleting: image is being deleted, and can no longer be used to provision new -// resources -// - deprecated: image is administratively slated to become `obsolete` -// - failed: image is corrupt or did not pass validation -// - obsolete: image administratively set to not be used for new resources -// - pending: image is being imported and is not yet `available` -// - unusable: image cannot be used (see `status_reasons[]` for possible remediation) -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the -// unexpected property value was encountered. -const ( - ImageStatusAvailableConst = "available" - ImageStatusDeletingConst = "deleting" - ImageStatusDeprecatedConst = "deprecated" - ImageStatusFailedConst = "failed" - ImageStatusObsoleteConst = "obsolete" - ImageStatusPendingConst = "pending" - ImageStatusUnusableConst = "unusable" -) - -// Constants associated with the Image.Visibility property. -// The visibility of this image. -// - `private`: Visible only to this account -// - `public`: Visible to all accounts. -const ( - ImageVisibilityPrivateConst = "private" - ImageVisibilityPublicConst = "public" -) - -// UnmarshalImage unmarshals an instance of Image from the specified map of raw messages. -func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Image) - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalImageCatalogOffering) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFile) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "minimum_provisioned_size", &obj.MinimumProvisionedSize) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalImageStatusReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "visibility", &obj.Visibility) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageCatalogOffering : ImageCatalogOffering struct -type ImageCatalogOffering struct { - // Indicates whether this image is managed as part of a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. If an image is managed, - // accounts in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise) with access to that catalog can - // specify the image's catalog offering version CRN to provision virtual server instances using the image. - Managed *bool `json:"managed" validate:"required"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering version associated with this image. - // - // If absent, this image is not associated with a cloud catalog offering. - Version *CatalogOfferingVersionReference `json:"version,omitempty"` -} - -// UnmarshalImageCatalogOffering unmarshals an instance of ImageCatalogOffering from the specified map of raw messages. -func UnmarshalImageCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageCatalogOffering) - err = core.UnmarshalPrimitive(m, "managed", &obj.Managed) - if err != nil { - return - } - err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageCollection : ImageCollection struct -type ImageCollection struct { - // A link to the first page of resources. - First *ImageCollectionFirst `json:"first" validate:"required"` - - // Collection of images. - Images []Image `json:"images" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *ImageCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalImageCollection unmarshals an instance of ImageCollection from the specified map of raw messages. -func UnmarshalImageCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalImageCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImage) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalImageCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *ImageCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// ImageCollectionFirst : A link to the first page of resources. -type ImageCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalImageCollectionFirst unmarshals an instance of ImageCollectionFirst from the specified map of raw messages. -func UnmarshalImageCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type ImageCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalImageCollectionNext unmarshals an instance of ImageCollectionNext from the specified map of raw messages. -func UnmarshalImageCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageExportJob : ImageExportJob struct -type ImageExportJob struct { - // The date and time that the image export job was completed. - // - // If absent, the export job has not yet completed. - CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` - - // The date and time that the image export job was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // A base64-encoded, encrypted representation of the key that was used to encrypt the data for the exported image. This - // key can be unwrapped with the image's `encryption_key` root key using either Key Protect or Hyper Protect Crypto - // Services. - // - // If absent, the export job is for an unencrypted image. - EncryptedDataKey *[]byte `json:"encrypted_data_key,omitempty"` - - // The format of the exported image. - Format *string `json:"format" validate:"required"` - - // The URL for this image export job. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this image export job. - ID *string `json:"id" validate:"required"` - - // The name for this image export job. The name must not be used by another export job for the image. Changing the name - // will not affect the exported image name, - // `storage_object.name`, or `storage_href` values. - Name *string `json:"name" validate:"required"` - - // The type of resource referenced. - ResourceType *string `json:"resource_type" validate:"required"` - - // The date and time that the image export job started running. - // - // If absent, the export job has not yet started. - StartedAt *strfmt.DateTime `json:"started_at,omitempty"` - - // The status of this image export job: - // - `deleting`: Export job is being deleted - // - `failed`: Export job could not be completed successfully - // - `queued`: Export job is queued - // - `running`: Export job is in progress - // - `succeeded`: Export job was completed successfully - // - // The exported image object is automatically deleted for `failed` jobs. - Status *string `json:"status" validate:"required"` - - // The reasons for the current status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []ImageExportJobStatusReason `json:"status_reasons" validate:"required"` - - // The Cloud Object Storage bucket of the exported image object. - StorageBucket *CloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` - - // The Cloud Object Storage location of the exported image object. The object at this location will not exist until the - // job completes successfully. The exported image object is not managed by the IBM VPC service, and may be removed or - // replaced with a different object by any user or service with IAM authorization to the storage bucket. - StorageHref *string `json:"storage_href" validate:"required"` - - // The Cloud Object Storage object for the exported image. This object will not exist until - // the job completes successfully. The exported image object is not managed by the IBM VPC - // service, and may be removed or replaced with a different object by any user or service - // with IAM authorization to the storage bucket. - StorageObject *CloudObjectStorageObjectReference `json:"storage_object" validate:"required"` -} - -// Constants associated with the ImageExportJob.Format property. -// The format of the exported image. -const ( - ImageExportJobFormatQcow2Const = "qcow2" - ImageExportJobFormatVhdConst = "vhd" -) - -// Constants associated with the ImageExportJob.ResourceType property. -// The type of resource referenced. -const ( - ImageExportJobResourceTypeImageExportJobConst = "image_export_job" -) - -// Constants associated with the ImageExportJob.Status property. -// The status of this image export job: -// - `deleting`: Export job is being deleted -// - `failed`: Export job could not be completed successfully -// - `queued`: Export job is queued -// - `running`: Export job is in progress -// - `succeeded`: Export job was completed successfully -// -// The exported image object is automatically deleted for `failed` jobs. -const ( - ImageExportJobStatusDeletingConst = "deleting" - ImageExportJobStatusFailedConst = "failed" - ImageExportJobStatusQueuedConst = "queued" - ImageExportJobStatusRunningConst = "running" - ImageExportJobStatusSucceededConst = "succeeded" -) - -// UnmarshalImageExportJob unmarshals an instance of ImageExportJob from the specified map of raw messages. -func UnmarshalImageExportJob(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageExportJob) - err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "format", &obj.Format) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalImageExportJobStatusReason) - if err != nil { - return - } - err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalCloudObjectStorageBucketReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "storage_href", &obj.StorageHref) - if err != nil { - return - } - err = core.UnmarshalModel(m, "storage_object", &obj.StorageObject, UnmarshalCloudObjectStorageObjectReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageExportJobPatch : ImageExportJobPatch struct -type ImageExportJobPatch struct { - // The name for this image export job. The name must not be used by another export job for the image. Changing the name - // will not affect the exported image name, - // `storage_object.name`, or `storage_href` values. - Name *string `json:"name,omitempty"` -} - -// UnmarshalImageExportJobPatch unmarshals an instance of ImageExportJobPatch from the specified map of raw messages. -func UnmarshalImageExportJobPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageExportJobPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the ImageExportJobPatch -func (imageExportJobPatch *ImageExportJobPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(imageExportJobPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// ImageExportJobStatusReason : ImageExportJobStatusReason struct -type ImageExportJobStatusReason struct { - // A snake case string succinctly identifying the status reason. - Code *string `json:"code" validate:"required"` - - // An explanation of the status reason. - Message *string `json:"message" validate:"required"` - - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the ImageExportJobStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -const ( - ImageExportJobStatusReasonCodeCannotAccessStorageBucketConst = "cannot_access_storage_bucket" - ImageExportJobStatusReasonCodeInternalErrorConst = "internal_error" -) - -// UnmarshalImageExportJobStatusReason unmarshals an instance of ImageExportJobStatusReason from the specified map of raw messages. -func UnmarshalImageExportJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageExportJobStatusReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageExportJobUnpaginatedCollection : ImageExportJobUnpaginatedCollection struct -type ImageExportJobUnpaginatedCollection struct { - // Collection of image export jobs. - ExportJobs []ImageExportJob `json:"export_jobs" validate:"required"` -} - -// UnmarshalImageExportJobUnpaginatedCollection unmarshals an instance of ImageExportJobUnpaginatedCollection from the specified map of raw messages. -func UnmarshalImageExportJobUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageExportJobUnpaginatedCollection) - err = core.UnmarshalModel(m, "export_jobs", &obj.ExportJobs, UnmarshalImageExportJob) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageFile : ImageFile struct -type ImageFile struct { - // Checksums for this image file. - // - // This property may be absent if the associated image has a `status` of `pending` or - // `failed`. - Checksums *ImageFileChecksums `json:"checksums,omitempty"` - - // The size of the stored image file rounded up to the next gigabyte. - // - // This property may be absent if the associated image has a `status` of `pending` or - // `failed`. - Size *int64 `json:"size,omitempty"` -} - -// UnmarshalImageFile unmarshals an instance of ImageFile from the specified map of raw messages. -func UnmarshalImageFile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageFile) - err = core.UnmarshalModel(m, "checksums", &obj.Checksums, UnmarshalImageFileChecksums) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageFileChecksums : ImageFileChecksums struct -type ImageFileChecksums struct { - // The SHA256 fingerprint of the image file. - Sha256 *string `json:"sha256,omitempty"` -} - -// UnmarshalImageFileChecksums unmarshals an instance of ImageFileChecksums from the specified map of raw messages. -func UnmarshalImageFileChecksums(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageFileChecksums) - err = core.UnmarshalPrimitive(m, "sha256", &obj.Sha256) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageFilePrototype : ImageFilePrototype struct -type ImageFilePrototype struct { - // The Cloud Object Storage location of the image file. - // - // The image file format is specified by the file's extension, which must be either - // `qcow2` or `vhd`. - Href *string `json:"href" validate:"required"` -} - -// NewImageFilePrototype : Instantiate ImageFilePrototype (Generic Model Constructor) -func (*VpcV1) NewImageFilePrototype(href string) (_model *ImageFilePrototype, err error) { - _model = &ImageFilePrototype{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalImageFilePrototype unmarshals an instance of ImageFilePrototype from the specified map of raw messages. -func UnmarshalImageFilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageFilePrototype) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageIdentity : Identifies an image by a unique property. -// Models which "extend" this model: -// - ImageIdentityByID -// - ImageIdentityByCRN -// - ImageIdentityByHref -type ImageIdentity struct { - // The unique identifier for this image. - ID *string `json:"id,omitempty"` - - // The CRN for this image. - CRN *string `json:"crn,omitempty"` - - // The URL for this image. - Href *string `json:"href,omitempty"` -} - -func (*ImageIdentity) isaImageIdentity() bool { - return true -} - -type ImageIdentityIntf interface { - isaImageIdentity() bool -} - -// UnmarshalImageIdentity unmarshals an instance of ImageIdentity from the specified map of raw messages. -func UnmarshalImageIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImagePatch : ImagePatch struct -type ImagePatch struct { - // The deprecation date and time to set for this image. - // - // This cannot be set if the image has a `status` of `failed` or `deleting`, or if - // `catalog_offering.managed` is `true`. - // - // The date and time must not be in the past, and must be earlier than `obsolescence_at` - // (if `obsolescence_at` is set). Additionally, if the image status is currently - // `deprecated`, the value cannot be changed (but may be removed). - // - // Specify `null` to remove an existing deprecation date and time. If the image status is currently `deprecated`, it - // will become `available`. - // - // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will - // transition to `deprecated` upon its successful creation (or - // `obsolete` if the obsolescence date and time was also reached). - DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` - - // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are - // reserved for system-provided images, and are not allowed. - Name *string `json:"name,omitempty"` - - // The obsolescence date and time to set for this image. - // - // This cannot be set if the image has a `status` of `failed` or `deleting`, or if - // `catalog_offering.managed` is `true`. - // - // The date and time must not be in the past, and must be later than `deprecation_at` (if - // `deprecation_at` is set). Additionally, if the image status is currently `obsolete`, the value cannot be changed - // (but may be removed). - // - // Specify `null` to remove an existing obsolescence date and time. If the image status is currently `obsolete`, it - // will become `deprecated` if `deprecation_at` is in the past. Otherwise, it will become `available`. - // - // If the obsolescence date and time is reached while the image has a status of `pending`, the image's status will - // transition to `obsolete` upon its successful creation. - ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` -} - -// UnmarshalImagePatch unmarshals an instance of ImagePatch from the specified map of raw messages. -func UnmarshalImagePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImagePatch) - err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the ImagePatch -func (imagePatch *ImagePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(imagePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// ImagePrototype : ImagePrototype struct -// Models which "extend" this model: -// - ImagePrototypeImageByFile -// - ImagePrototypeImageBySourceVolume -type ImagePrototype struct { - // The deprecation date and time to set for this image. - // - // The date and time must not be in the past, and must be earlier than `obsolescence_at` - // (if `obsolescence_at` is set). - // - // If unspecified, no deprecation date and time will be set. - // - // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will - // transition to `deprecated` upon its successful creation (or - // `obsolete` if the obsolescence date and time was also reached). - DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` - - // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are - // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of - // randomly-selected words. - Name *string `json:"name,omitempty"` - - // The obsolescence date and time to set for this image. - // - // The date and time must not be in the past, and must be later than `deprecation_at` (if - // `deprecation_at` is set). - // - // If unspecified, no obsolescence date and time will be set. - // - // If the obsolescence date and time is reached while the image has a status of - // `pending`, the image's status will transition to `obsolete` upon its successful creation. - ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. - // - // That representation is created by wrapping the key's value with the `encryption_key` root key (which must also be - // specified), using either [Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the - // [Hyper Protect Crypto Services](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). - // - // If unspecified, the imported image is treated as unencrypted. - EncryptedDataKey *string `json:"encrypted_data_key,omitempty"` - - // The root key that was used to wrap the data key (which is ultimately represented as - // `encrypted_data_key`). Additionally, the root key will be used to encrypt volumes - // created from this image (unless an alternate `encryption_key` is specified at volume - // creation). - // - // If unspecified, the imported image is treated as unencrypted. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The file from which to create the image. - File *ImageFilePrototype `json:"file,omitempty"` - - // The [supported operating - // system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included in this - // image. - OperatingSystem OperatingSystemIdentityIntf `json:"operating_system,omitempty"` - - // The volume from which to create the image. The specified volume must: - // - Have an `operating_system`, which will be used to populate this image's - // operating system information. - // - Not be `active` or `busy`. - // - // During image creation, the specified volume may briefly become `busy`. - SourceVolume VolumeIdentityIntf `json:"source_volume,omitempty"` -} - -func (*ImagePrototype) isaImagePrototype() bool { - return true -} - -type ImagePrototypeIntf interface { - isaImagePrototype() bool -} - -// UnmarshalImagePrototype unmarshals an instance of ImagePrototype from the specified map of raw messages. -func UnmarshalImagePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImagePrototype) - err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageReference : ImageReference struct -type ImageReference struct { - // The CRN for this image. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ImageReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this image. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this image. - ID *string `json:"id" validate:"required"` - - // The name for this image. The name is unique across all images in the region. - Name *string `json:"name" validate:"required"` - - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *ImageRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ImageReference.ResourceType property. -// The resource type. -const ( - ImageReferenceResourceTypeImageConst = "image" -) - -// UnmarshalImageReference unmarshals an instance of ImageReference from the specified map of raw messages. -func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalImageReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalImageRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ImageReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalImageReferenceDeleted unmarshals an instance of ImageReferenceDeleted from the specified map of raw messages. -func UnmarshalImageReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type ImageRemote struct { - // If present, this property indicates that the referenced resource is remote to this - // account, and identifies the owning account. - Account *AccountReference `json:"account,omitempty"` - - // If present, this property indicates that the referenced resource is remote to this - // region, and identifies the native region. - Region *RegionReference `json:"region,omitempty"` -} - -// UnmarshalImageRemote unmarshals an instance of ImageRemote from the specified map of raw messages. -func UnmarshalImageRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageRemote) - err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageStatusReason : ImageStatusReason struct -type ImageStatusReason struct { - // A snake case string succinctly identifying the status reason. - Code *string `json:"code" validate:"required"` - - // An explanation of the status reason. - Message *string `json:"message" validate:"required"` - - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the ImageStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -const ( - ImageStatusReasonCodeEncryptedDataKeyInvalidConst = "encrypted_data_key_invalid" - ImageStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" - ImageStatusReasonCodeEncryptionKeyDisabledConst = "encryption_key_disabled" - ImageStatusReasonCodeImageDataCorruptedConst = "image_data_corrupted" - ImageStatusReasonCodeImageProvisionedSizeUnsupportedConst = "image_provisioned_size_unsupported" - ImageStatusReasonCodeImageRequestInProgressConst = "image_request_in_progress" - ImageStatusReasonCodeImageRequestQueuedConst = "image_request_queued" -) - -// UnmarshalImageStatusReason unmarshals an instance of ImageStatusReason from the specified map of raw messages. -func UnmarshalImageStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageStatusReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Instance : Instance struct -type Instance struct { - // The availability policy for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicy `json:"availability_policy" validate:"required"` - - // The total bandwidth (in megabits per second) shared across the instance network attachments or instance network - // interfaces and storage volumes of the virtual server instance. - Bandwidth *int64 `json:"bandwidth" validate:"required"` - - // Boot volume attachment. - BootVolumeAttachment *VolumeAttachmentReferenceInstanceContext `json:"boot_volume_attachment" validate:"required"` - - // If present, this virtual server instance was provisioned from a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user). - CatalogOffering *InstanceCatalogOffering `json:"catalog_offering,omitempty"` - - // The date and time that the virtual server instance was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` - - // If present, the dedicated host this virtual server instance has been placed on. - DedicatedHost *DedicatedHostReference `json:"dedicated_host,omitempty"` - - // The instance disks for this virtual server instance. - Disks []InstanceDisk `json:"disks" validate:"required"` - - // The virtual server instance GPU configuration. - Gpu *InstanceGpu `json:"gpu,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` - - // The image the virtual server instance was provisioned from. - Image *ImageReference `json:"image,omitempty"` - - // The reasons for the current `lifecycle_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - LifecycleReasons []InstanceLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the virtual server instance. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The amount of memory, truncated to whole gibibytes. - Memory *int64 `json:"memory" validate:"required"` - - // The metadata service configuration. - MetadataService *InstanceMetadataService `json:"metadata_service" validate:"required"` - - // The name for this virtual server instance. The name is unique across all virtual server instances in the region. - Name *string `json:"name" validate:"required"` - - // The network attachments for this virtual server instance, including the primary network attachment. - NetworkAttachments []InstanceNetworkAttachmentReference `json:"network_attachments" validate:"required"` - - // The network interfaces for this instance, including the primary network interface. - 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. - 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 resource group for this instance. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // Indicates whether the state of the virtual server instance permits a start request. - Startable *bool `json:"startable" validate:"required"` - - // The status of the virtual server instance. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the instance on which the unexpected - // property value was encountered. - Status *string `json:"status" validate:"required"` - - // The reasons for the current status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []InstanceStatusReason `json:"status_reasons" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance network attachments or instance - // network interfaces. - TotalNetworkBandwidth *int64 `json:"total_network_bandwidth" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth" validate:"required"` - - // The virtual server instance VCPU configuration. - Vcpu *InstanceVcpu `json:"vcpu" validate:"required"` - - // The volume attachments for this virtual server instance, including the boot volume attachment. - VolumeAttachments []VolumeAttachmentReferenceInstanceContext `json:"volume_attachments" validate:"required"` - - // The VPC this virtual server instance resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // The zone this virtual server instance resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the Instance.LifecycleState property. -// The lifecycle state of the virtual server instance. -const ( - InstanceLifecycleStateDeletingConst = "deleting" - InstanceLifecycleStateFailedConst = "failed" - InstanceLifecycleStatePendingConst = "pending" - InstanceLifecycleStateStableConst = "stable" - InstanceLifecycleStateSuspendedConst = "suspended" - InstanceLifecycleStateUpdatingConst = "updating" - InstanceLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the Instance.ResourceType property. -// The resource type. -const ( - InstanceResourceTypeInstanceConst = "instance" -) - -// Constants associated with the Instance.Status property. -// The status of the virtual server instance. -// -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the instance on which the unexpected -// property value was encountered. -const ( - InstanceStatusDeletingConst = "deleting" - InstanceStatusFailedConst = "failed" - InstanceStatusPendingConst = "pending" - InstanceStatusRestartingConst = "restarting" - InstanceStatusRunningConst = "running" - InstanceStatusStartingConst = "starting" - InstanceStatusStoppedConst = "stopped" - InstanceStatusStoppingConst = "stopping" -) - -// UnmarshalInstance unmarshals an instance of Instance from the specified map of raw messages. -func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Instance) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicy) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentReferenceInstanceContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOffering) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dedicated_host", &obj.DedicatedHost, UnmarshalDedicatedHostReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) - if err != nil { - return - } - err = core.UnmarshalModel(m, "gpu", &obj.Gpu, UnmarshalInstanceGpu) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceLifecycleReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataService) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceInstanceContextReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "numa_count", &obj.NumaCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTarget) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceInstanceContextReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "startable", &obj.Startable) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalInstanceStatusReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_network_bandwidth", &obj.TotalNetworkBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalInstanceVcpu) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceInstanceContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceAction : InstanceAction struct -type InstanceAction struct { - // The date and time that the action was completed. - // Deprecated: this field is deprecated and may be removed in a future release. - CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` - - // The date and time that the action was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If set to true, the action will be forced immediately, and all queued actions deleted. Ignored for the start action. - Force *bool `json:"force,omitempty"` - - // The URL for this instance action. - // Deprecated: this field is deprecated and may be removed in a future release. - Href *string `json:"href" validate:"required"` - - // The identifier for this instance action. - // Deprecated: this field is deprecated and may be removed in a future release. - ID *string `json:"id" validate:"required"` - - // The date and time that the action was started. - // Deprecated: this field is deprecated and may be removed in a future release. - StartedAt *strfmt.DateTime `json:"started_at,omitempty"` - - // The current status of this action. - // Deprecated: this field is deprecated and may be removed in a future release. - Status *string `json:"status" validate:"required"` - - // The type of action. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceAction.Status property. -// The current status of this action. -const ( - InstanceActionStatusCompletedConst = "completed" - InstanceActionStatusFailedConst = "failed" - InstanceActionStatusPendingConst = "pending" - InstanceActionStatusRunningConst = "running" -) - -// Constants associated with the InstanceAction.Type property. -// The type of action. -const ( - InstanceActionTypeRebootConst = "reboot" - InstanceActionTypeStartConst = "start" - InstanceActionTypeStopConst = "stop" -) - -// UnmarshalInstanceAction unmarshals an instance of InstanceAction from the specified map of raw messages. -func UnmarshalInstanceAction(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceAction) - err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "force", &obj.Force) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceAvailabilityPolicy : InstanceAvailabilityPolicy struct -type InstanceAvailabilityPolicy struct { - // The action to perform if the compute host experiences a failure. - // - `restart`: Automatically restart the virtual server instance after host failure - // - `stop`: Leave the virtual server instance stopped after host failure - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the - // unexpected property value was encountered. - HostFailure *string `json:"host_failure" validate:"required"` -} - -// Constants associated with the InstanceAvailabilityPolicy.HostFailure property. -// The action to perform if the compute host experiences a failure. -// - `restart`: Automatically restart the virtual server instance after host failure -// - `stop`: Leave the virtual server instance stopped after host failure -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the -// unexpected property value was encountered. -const ( - InstanceAvailabilityPolicyHostFailureRestartConst = "restart" - InstanceAvailabilityPolicyHostFailureStopConst = "stop" -) - -// UnmarshalInstanceAvailabilityPolicy unmarshals an instance of InstanceAvailabilityPolicy from the specified map of raw messages. -func UnmarshalInstanceAvailabilityPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceAvailabilityPolicy) - err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceAvailabilityPolicyPatch : InstanceAvailabilityPolicyPatch struct -type InstanceAvailabilityPolicyPatch struct { - // The action to perform if the compute host experiences a failure. - // - `restart`: Automatically restart the virtual server instance after host failure - // - `stop`: Leave the virtual server instance stopped after host failure. - HostFailure *string `json:"host_failure,omitempty"` -} - -// Constants associated with the InstanceAvailabilityPolicyPatch.HostFailure property. -// The action to perform if the compute host experiences a failure. -// - `restart`: Automatically restart the virtual server instance after host failure -// - `stop`: Leave the virtual server instance stopped after host failure. -const ( - InstanceAvailabilityPolicyPatchHostFailureRestartConst = "restart" - InstanceAvailabilityPolicyPatchHostFailureStopConst = "stop" -) - -// UnmarshalInstanceAvailabilityPolicyPatch unmarshals an instance of InstanceAvailabilityPolicyPatch from the specified map of raw messages. -func UnmarshalInstanceAvailabilityPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceAvailabilityPolicyPatch) - err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceAvailabilityPolicyPrototype : InstanceAvailabilityPolicyPrototype struct -type InstanceAvailabilityPolicyPrototype struct { - // The action to perform if the compute host experiences a failure. - // - `restart`: Automatically restart the virtual server instance after host failure - // - `stop`: Leave the virtual server instance stopped after host failure. - HostFailure *string `json:"host_failure,omitempty"` -} - -// Constants associated with the InstanceAvailabilityPolicyPrototype.HostFailure property. -// The action to perform if the compute host experiences a failure. -// - `restart`: Automatically restart the virtual server instance after host failure -// - `stop`: Leave the virtual server instance stopped after host failure. -const ( - InstanceAvailabilityPolicyPrototypeHostFailureRestartConst = "restart" - InstanceAvailabilityPolicyPrototypeHostFailureStopConst = "stop" -) - -// UnmarshalInstanceAvailabilityPolicyPrototype unmarshals an instance of InstanceAvailabilityPolicyPrototype from the specified map of raw messages. -func UnmarshalInstanceAvailabilityPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceAvailabilityPolicyPrototype) - err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceCatalogOffering : InstanceCatalogOffering struct -type InstanceCatalogOffering struct { - // The catalog offering version this virtual server instance was provisioned from. - // - // The catalog offering version is not managed by the IBM VPC service, and may no longer - // exist, or may refer to a different image CRN than the `image.crn` for this virtual - // server instance. However, all images associated with a catalog offering version will - // have the same checksum, and therefore will have the same data. - Version *CatalogOfferingVersionReference `json:"version" validate:"required"` -} - -// UnmarshalInstanceCatalogOffering unmarshals an instance of InstanceCatalogOffering from the specified map of raw messages. -func UnmarshalInstanceCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCatalogOffering) - err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceCatalogOfferingPrototype : The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering or offering version to use -// when provisioning this virtual server instance. -// -// If an offering is specified, the latest version of that offering will be used. -// -// The specified offering or offering version may be in a different account in the same -// [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject to IAM policies. -// Models which "extend" this model: -// - InstanceCatalogOfferingPrototypeCatalogOfferingByOffering -// - InstanceCatalogOfferingPrototypeCatalogOfferingByVersion -type InstanceCatalogOfferingPrototype struct { - // Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering by a unique property. - Offering CatalogOfferingIdentityIntf `json:"offering,omitempty"` - - // Identifies a version of a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a - // unique property. - Version CatalogOfferingVersionIdentityIntf `json:"version,omitempty"` -} - -func (*InstanceCatalogOfferingPrototype) isaInstanceCatalogOfferingPrototype() bool { - return true -} - -type InstanceCatalogOfferingPrototypeIntf interface { - isaInstanceCatalogOfferingPrototype() bool -} - -// UnmarshalInstanceCatalogOfferingPrototype unmarshals an instance of InstanceCatalogOfferingPrototype from the specified map of raw messages. -func UnmarshalInstanceCatalogOfferingPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCatalogOfferingPrototype) - err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceCollection : InstanceCollection struct -type InstanceCollection struct { - // A link to the first page of resources. - First *InstanceCollectionFirst `json:"first" validate:"required"` - - // Collection of virtual server instances. - Instances []Instance `json:"instances" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *InstanceCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalInstanceCollection unmarshals an instance of InstanceCollection from the specified map of raw messages. -func UnmarshalInstanceCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstance) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *InstanceCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// InstanceCollectionFirst : A link to the first page of resources. -type InstanceCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceCollectionFirst unmarshals an instance of InstanceCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceCollectionNext unmarshals an instance of InstanceCollectionNext from the specified map of raw messages. -func UnmarshalInstanceCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceConsoleAccessToken : The instance console access token information. -type InstanceConsoleAccessToken struct { - // A URL safe single-use token used to access the console WebSocket. - AccessToken *string `json:"access_token" validate:"required"` - - // The instance console type for which this token may be used. - ConsoleType *string `json:"console_type" validate:"required"` - - // The date and time that the access token was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The date and time that the access token will expire. - ExpiresAt *strfmt.DateTime `json:"expires_at" validate:"required"` - - // Indicates whether to disconnect an existing serial console session as the serial console cannot be shared. This has - // no effect on VNC consoles. - Force *bool `json:"force" validate:"required"` - - // The URL to access this instance console. - Href *string `json:"href" validate:"required"` -} - -// Constants associated with the InstanceConsoleAccessToken.ConsoleType property. -// The instance console type for which this token may be used. -const ( - InstanceConsoleAccessTokenConsoleTypeSerialConst = "serial" - InstanceConsoleAccessTokenConsoleTypeVncConst = "vnc" -) - -// UnmarshalInstanceConsoleAccessToken unmarshals an instance of InstanceConsoleAccessToken from the specified map of raw messages. -func UnmarshalInstanceConsoleAccessToken(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceConsoleAccessToken) - err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "force", &obj.Force) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceDefaultTrustedProfilePrototype : InstanceDefaultTrustedProfilePrototype struct -type InstanceDefaultTrustedProfilePrototype struct { - // If set to `true`, the system will create a link to the specified `target` trusted profile during instance creation. - // Regardless of whether a link is created by the system or manually using the IAM Identity service, it will be - // automatically deleted when the instance is deleted. - AutoLink *bool `json:"auto_link,omitempty"` - - // The default IAM trusted profile to use for this virtual server instance. - Target TrustedProfileIdentityIntf `json:"target" validate:"required"` -} - -// NewInstanceDefaultTrustedProfilePrototype : Instantiate InstanceDefaultTrustedProfilePrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceDefaultTrustedProfilePrototype(target TrustedProfileIdentityIntf) (_model *InstanceDefaultTrustedProfilePrototype, err error) { - _model = &InstanceDefaultTrustedProfilePrototype{ - Target: target, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalInstanceDefaultTrustedProfilePrototype unmarshals an instance of InstanceDefaultTrustedProfilePrototype from the specified map of raw messages. -func UnmarshalInstanceDefaultTrustedProfilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceDefaultTrustedProfilePrototype) - err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceDisk : InstanceDisk struct -type InstanceDisk struct { - // The date and time that the disk was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance disk. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance disk. - ID *string `json:"id" validate:"required"` - - // The disk interface used for attaching the disk. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The name for this instance disk. The name is unique across all disks on the instance. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The size of the disk in GB (gigabytes). - Size *int64 `json:"size" validate:"required"` -} - -// Constants associated with the InstanceDisk.InterfaceType property. -// The disk interface used for attaching the disk. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - InstanceDiskInterfaceTypeNvmeConst = "nvme" - InstanceDiskInterfaceTypeVirtioBlkConst = "virtio_blk" -) - -// Constants associated with the InstanceDisk.ResourceType property. -// The resource type. -const ( - InstanceDiskResourceTypeInstanceDiskConst = "instance_disk" -) - -// UnmarshalInstanceDisk unmarshals an instance of InstanceDisk from the specified map of raw messages. -func UnmarshalInstanceDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceDisk) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceDiskCollection : InstanceDiskCollection struct -type InstanceDiskCollection struct { - // Collection of the instance's disks. - Disks []InstanceDisk `json:"disks" validate:"required"` -} - -// UnmarshalInstanceDiskCollection unmarshals an instance of InstanceDiskCollection from the specified map of raw messages. -func UnmarshalInstanceDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceDiskCollection) - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceDiskPatch : InstanceDiskPatch struct -type InstanceDiskPatch struct { - // The name for this instance disk. The name must not be used by another disk on the instance. - Name *string `json:"name,omitempty"` -} - -// UnmarshalInstanceDiskPatch unmarshals an instance of InstanceDiskPatch from the specified map of raw messages. -func UnmarshalInstanceDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceDiskPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the InstanceDiskPatch -func (instanceDiskPatch *InstanceDiskPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceDiskPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// InstanceDiskReference : InstanceDiskReference struct -type InstanceDiskReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceDiskReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance disk. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance disk. - ID *string `json:"id" validate:"required"` - - // The name for this instance disk. The name is unique across all disks on the instance. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the InstanceDiskReference.ResourceType property. -// The resource type. -const ( - InstanceDiskReferenceResourceTypeInstanceDiskConst = "instance_disk" -) - -// UnmarshalInstanceDiskReference unmarshals an instance of InstanceDiskReference from the specified map of raw messages. -func UnmarshalInstanceDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceDiskReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceDiskReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceDiskReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceDiskReferenceDeleted unmarshals an instance of InstanceDiskReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceDiskReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGpu : The virtual server instance GPU configuration. -type InstanceGpu struct { - // The number of GPUs assigned to the instance. - Count *int64 `json:"count" validate:"required"` - - // The GPU manufacturer. - Manufacturer *string `json:"manufacturer" validate:"required"` - - // The overall amount of GPU memory in GiB (gibibytes). - Memory *int64 `json:"memory" validate:"required"` - - // The GPU model. - Model *string `json:"model" validate:"required"` -} - -// UnmarshalInstanceGpu unmarshals an instance of InstanceGpu from the specified map of raw messages. -func UnmarshalInstanceGpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGpu) - err = core.UnmarshalPrimitive(m, "count", &obj.Count) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "model", &obj.Model) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroup : InstanceGroup struct -type InstanceGroup struct { - // The port used for new load balancer pool members created by this instance group. - // - // This property will be present if and only if `load_balancer_pool` is present. - ApplicationPort *int64 `json:"application_port,omitempty"` - - // The date and time that the instance group was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance group. - CRN *string `json:"crn" validate:"required"` - - // The URL for this instance group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group. - ID *string `json:"id" validate:"required"` - - // The template used to create new instances for this group. - InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` - - // If present, the load balancer pool this instance group manages. A pool member will - // be created for each instance created by this group. - LoadBalancerPool *LoadBalancerPoolReference `json:"load_balancer_pool,omitempty"` - - // The managers for the instance group. - Managers []InstanceGroupManagerReference `json:"managers" validate:"required"` - - // The number of instances in the instance group. - MembershipCount *int64 `json:"membership_count" validate:"required"` - - // The name for this instance group. The name is unique across all instance groups in the region. - Name *string `json:"name" validate:"required"` - - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The status of the instance group - // - `deleting`: Group is being deleted - // - `healthy`: Group has `membership_count` instances - // - `scaling`: Instances in the group are being created or deleted to reach - // `membership_count` - // - `unhealthy`: Group is unable to reach `membership_count` instances. - Status *string `json:"status" validate:"required"` - - // The subnets to use when creating new instances. - Subnets []SubnetReference `json:"subnets" validate:"required"` - - // The date and time that the instance group was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The VPC the instance group resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// Constants associated with the InstanceGroup.Status property. -// The status of the instance group -// - `deleting`: Group is being deleted -// - `healthy`: Group has `membership_count` instances -// - `scaling`: Instances in the group are being created or deleted to reach -// `membership_count` -// - `unhealthy`: Group is unable to reach `membership_count` instances. -const ( - InstanceGroupStatusDeletingConst = "deleting" - InstanceGroupStatusHealthyConst = "healthy" - InstanceGroupStatusScalingConst = "scaling" - InstanceGroupStatusUnhealthyConst = "unhealthy" -) - -// UnmarshalInstanceGroup unmarshals an instance of InstanceGroup from the specified map of raw messages. -func UnmarshalInstanceGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroup) - err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManagerReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupCollection : InstanceGroupCollection struct -type InstanceGroupCollection struct { - // A link to the first page of resources. - First *InstanceGroupCollectionFirst `json:"first" validate:"required"` - - // Collection of instance groups. - InstanceGroups []InstanceGroup `json:"instance_groups" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *InstanceGroupCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalInstanceGroupCollection unmarshals an instance of InstanceGroupCollection from the specified map of raw messages. -func UnmarshalInstanceGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "instance_groups", &obj.InstanceGroups, UnmarshalInstanceGroup) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *InstanceGroupCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// InstanceGroupCollectionFirst : A link to the first page of resources. -type InstanceGroupCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupCollectionFirst unmarshals an instance of InstanceGroupCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceGroupCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupCollectionNext unmarshals an instance of InstanceGroupCollectionNext from the specified map of raw messages. -func UnmarshalInstanceGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManager : InstanceGroupManager struct -// Models which "extend" this model: -// - InstanceGroupManagerAutoScale -// - InstanceGroupManagerScheduled -type InstanceGroupManager struct { - // The date and time that the instance group manager was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` - - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled" validate:"required"` - - // The name for this instance group manager. The name is unique across all managers for the instance group. - Name *string `json:"name" validate:"required"` - - // The date and time that the instance group manager was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The time window in seconds to aggregate metrics prior to evaluation. - AggregationWindow *int64 `json:"aggregation_window,omitempty"` - - // The duration of time in seconds to pause further scale actions after scaling has taken place. - Cooldown *int64 `json:"cooldown,omitempty"` - - // The type of instance group manager. - ManagerType *string `json:"manager_type,omitempty"` - - // The maximum number of members in a managed instance group. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The minimum number of members in a managed instance group. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The policies of the instance group manager. - Policies []InstanceGroupManagerPolicyReference `json:"policies,omitempty"` - - // The actions of the instance group manager. - Actions []InstanceGroupManagerActionReference `json:"actions,omitempty"` -} - -// Constants associated with the InstanceGroupManager.ManagerType property. -// The type of instance group manager. -const ( - InstanceGroupManagerManagerTypeAutoscaleConst = "autoscale" -) - -func (*InstanceGroupManager) isaInstanceGroupManager() bool { - return true -} - -type InstanceGroupManagerIntf interface { - isaInstanceGroupManager() bool -} - -// UnmarshalInstanceGroupManager unmarshals an instance of InstanceGroupManager from the specified map of raw messages. -func UnmarshalInstanceGroupManager(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManager) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerAction : InstanceGroupManagerAction struct -// Models which "extend" this model: -// - InstanceGroupManagerActionScheduledAction -type InstanceGroupManagerAction struct { - // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. At present, this is always - // `true`, but may be modifiable in the future. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. - AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` - - // The date and time that the instance group manager action was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager action. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager action. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager action. The name is unique across all actions for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the instance group action - // - `active`: Action is ready to be run - // - `completed`: Action was completed successfully - // - `failed`: Action could not be completed successfully - // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. - Status *string `json:"status" validate:"required"` - - // The date and time that the instance group manager action was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The type of action for the instance group. - ActionType *string `json:"action_type,omitempty"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - // The date and time the scheduled action was last applied. If absent, the action has never been applied. - LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` - - // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run - // time. - NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroup `json:"group,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager,omitempty"` -} - -// Constants associated with the InstanceGroupManagerAction.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) - -// Constants associated with the InstanceGroupManagerAction.Status property. -// The status of the instance group action -// - `active`: Action is ready to be run -// - `completed`: Action was completed successfully -// - `failed`: Action could not be completed successfully -// - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. -const ( - InstanceGroupManagerActionStatusActiveConst = "active" - InstanceGroupManagerActionStatusCompletedConst = "completed" - InstanceGroupManagerActionStatusFailedConst = "failed" - InstanceGroupManagerActionStatusIncompatibleConst = "incompatible" - InstanceGroupManagerActionStatusOmittedConst = "omitted" -) - -// Constants associated with the InstanceGroupManagerAction.ActionType property. -// The type of action for the instance group. -const ( - InstanceGroupManagerActionActionTypeScheduledConst = "scheduled" -) - -func (*InstanceGroupManagerAction) isaInstanceGroupManagerAction() bool { - return true -} - -type InstanceGroupManagerActionIntf interface { - isaInstanceGroupManagerAction() bool -} - -// UnmarshalInstanceGroupManagerAction unmarshals an instance of InstanceGroupManagerAction from the specified map of raw messages. -func UnmarshalInstanceGroupManagerAction(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerAction) - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) - if err != nil { - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionGroupPatch : InstanceGroupManagerActionGroupPatch struct -type InstanceGroupManagerActionGroupPatch struct { - // The desired number of instance group members at the scheduled time. - MembershipCount *int64 `json:"membership_count,omitempty"` -} - -// UnmarshalInstanceGroupManagerActionGroupPatch unmarshals an instance of InstanceGroupManagerActionGroupPatch from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionGroupPatch) - err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionManagerPatch : InstanceGroupManagerActionManagerPatch struct -type InstanceGroupManagerActionManagerPatch struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` -} - -// UnmarshalInstanceGroupManagerActionManagerPatch unmarshals an instance of InstanceGroupManagerActionManagerPatch from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionManagerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionManagerPatch) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPatch : InstanceGroupManagerActionPatch struct -type InstanceGroupManagerActionPatch struct { - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - Group *InstanceGroupManagerActionGroupPatch `json:"group,omitempty"` - - Manager *InstanceGroupManagerActionManagerPatch `json:"manager,omitempty"` - - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. - Name *string `json:"name,omitempty"` - - // The date and time the scheduled action will run. - RunAt *strfmt.DateTime `json:"run_at,omitempty"` -} - -// UnmarshalInstanceGroupManagerActionPatch unmarshals an instance of InstanceGroupManagerActionPatch from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPatch) - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerActionGroupPatch) - if err != nil { - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerActionManagerPatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the InstanceGroupManagerActionPatch -func (instanceGroupManagerActionPatch *InstanceGroupManagerActionPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceGroupManagerActionPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// InstanceGroupManagerActionPrototype : InstanceGroupManagerActionPrototype struct -// Models which "extend" this model: -// - InstanceGroupManagerActionPrototypeScheduledActionPrototype -type InstanceGroupManagerActionPrototype struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The date and time the scheduled action will run. - RunAt *strfmt.DateTime `json:"run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` -} - -func (*InstanceGroupManagerActionPrototype) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -type InstanceGroupManagerActionPrototypeIntf interface { - isaInstanceGroupManagerActionPrototype() bool -} - -// UnmarshalInstanceGroupManagerActionPrototype unmarshals an instance of InstanceGroupManagerActionPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionReference : InstanceGroupManagerActionReference struct -type InstanceGroupManagerActionReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceGroupManagerActionReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance group manager action. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager action. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager action. The name is unique across all actions for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerActionReference.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionReferenceResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) - -// UnmarshalInstanceGroupManagerActionReference unmarshals an instance of InstanceGroupManagerActionReference from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerActionReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceGroupManagerActionReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceGroupManagerActionReferenceDeleted unmarshals an instance of InstanceGroupManagerActionReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionsCollection : InstanceGroupManagerActionsCollection struct -type InstanceGroupManagerActionsCollection struct { - // Collection of instance group manager actions. - Actions []InstanceGroupManagerActionIntf `json:"actions" validate:"required"` - - // A link to the first page of resources. - First *InstanceGroupManagerActionsCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *InstanceGroupManagerActionsCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalInstanceGroupManagerActionsCollection unmarshals an instance of InstanceGroupManagerActionsCollection from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionsCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionsCollection) - err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerAction) - if err != nil { - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerActionsCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerActionsCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *InstanceGroupManagerActionsCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// InstanceGroupManagerActionsCollectionFirst : A link to the first page of resources. -type InstanceGroupManagerActionsCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupManagerActionsCollectionFirst unmarshals an instance of InstanceGroupManagerActionsCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionsCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionsCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionsCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceGroupManagerActionsCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupManagerActionsCollectionNext unmarshals an instance of InstanceGroupManagerActionsCollectionNext from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionsCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionsCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerCollection : InstanceGroupManagerCollection struct -type InstanceGroupManagerCollection struct { - // A link to the first page of resources. - First *InstanceGroupManagerCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of instance group managers. - Managers []InstanceGroupManagerIntf `json:"managers" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *InstanceGroupManagerCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalInstanceGroupManagerCollection unmarshals an instance of InstanceGroupManagerCollection from the specified map of raw messages. -func UnmarshalInstanceGroupManagerCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManager) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *InstanceGroupManagerCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// InstanceGroupManagerCollectionFirst : A link to the first page of resources. -type InstanceGroupManagerCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupManagerCollectionFirst unmarshals an instance of InstanceGroupManagerCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceGroupManagerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceGroupManagerCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupManagerCollectionNext unmarshals an instance of InstanceGroupManagerCollectionNext from the specified map of raw messages. -func UnmarshalInstanceGroupManagerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPatch : InstanceGroupManagerPatch struct -type InstanceGroupManagerPatch struct { - // The time window in seconds to aggregate metrics prior to evaluation. - AggregationWindow *int64 `json:"aggregation_window,omitempty"` - - // The duration of time in seconds to pause further scale actions after scaling has taken place. - Cooldown *int64 `json:"cooldown,omitempty"` - - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled,omitempty"` - - // The maximum number of members in a managed instance group. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The minimum number of members in a managed instance group. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The name for this instance group manager. The name must not be used by another manager for the instance group. - Name *string `json:"name,omitempty"` -} - -// UnmarshalInstanceGroupManagerPatch unmarshals an instance of InstanceGroupManagerPatch from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPatch) - err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the InstanceGroupManagerPatch -func (instanceGroupManagerPatch *InstanceGroupManagerPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceGroupManagerPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// InstanceGroupManagerPolicy : InstanceGroupManagerPolicy struct -// Models which "extend" this model: -// - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy -type InstanceGroupManagerPolicy struct { - // The date and time that the instance group manager policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager policy. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager policy. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager policy. The name is unique across all policies for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The date and time that the instance group manager policy was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The type of metric to be evaluated. - MetricType *string `json:"metric_type,omitempty"` - - // The metric value to be evaluated. - MetricValue *int64 `json:"metric_value,omitempty"` - - // The type of policy for the instance group. - PolicyType *string `json:"policy_type,omitempty"` -} - -// Constants associated with the InstanceGroupManagerPolicy.MetricType property. -// The type of metric to be evaluated. -const ( - InstanceGroupManagerPolicyMetricTypeCpuConst = "cpu" - InstanceGroupManagerPolicyMetricTypeMemoryConst = "memory" - InstanceGroupManagerPolicyMetricTypeNetworkInConst = "network_in" - InstanceGroupManagerPolicyMetricTypeNetworkOutConst = "network_out" -) - -// Constants associated with the InstanceGroupManagerPolicy.PolicyType property. -// The type of policy for the instance group. -const ( - InstanceGroupManagerPolicyPolicyTypeTargetConst = "target" -) - -func (*InstanceGroupManagerPolicy) isaInstanceGroupManagerPolicy() bool { - return true -} - -type InstanceGroupManagerPolicyIntf interface { - isaInstanceGroupManagerPolicy() bool -} - -// UnmarshalInstanceGroupManagerPolicy unmarshals an instance of InstanceGroupManagerPolicy from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicy) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPolicyCollection : InstanceGroupManagerPolicyCollection struct -type InstanceGroupManagerPolicyCollection struct { - // A link to the first page of resources. - First *InstanceGroupManagerPolicyCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *InstanceGroupManagerPolicyCollectionNext `json:"next,omitempty"` - - // Collection of instance group manager policies. - Policies []InstanceGroupManagerPolicyIntf `json:"policies" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalInstanceGroupManagerPolicyCollection unmarshals an instance of InstanceGroupManagerPolicyCollection from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerPolicyCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerPolicyCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicy) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *InstanceGroupManagerPolicyCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// InstanceGroupManagerPolicyCollectionFirst : A link to the first page of resources. -type InstanceGroupManagerPolicyCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupManagerPolicyCollectionFirst unmarshals an instance of InstanceGroupManagerPolicyCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceGroupManagerPolicyCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupManagerPolicyCollectionNext unmarshals an instance of InstanceGroupManagerPolicyCollectionNext from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPolicyPatch : InstanceGroupManagerPolicyPatch struct -type InstanceGroupManagerPolicyPatch struct { - // The type of metric to be evaluated. - MetricType *string `json:"metric_type,omitempty"` - - // The metric value to be evaluated. - MetricValue *int64 `json:"metric_value,omitempty"` - - // The name for this instance group manager policy. The name must not be used by another policy for the instance group - // manager. - Name *string `json:"name,omitempty"` -} - -// Constants associated with the InstanceGroupManagerPolicyPatch.MetricType property. -// The type of metric to be evaluated. -const ( - InstanceGroupManagerPolicyPatchMetricTypeCpuConst = "cpu" - InstanceGroupManagerPolicyPatchMetricTypeMemoryConst = "memory" - InstanceGroupManagerPolicyPatchMetricTypeNetworkInConst = "network_in" - InstanceGroupManagerPolicyPatchMetricTypeNetworkOutConst = "network_out" -) - -// UnmarshalInstanceGroupManagerPolicyPatch unmarshals an instance of InstanceGroupManagerPolicyPatch from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyPatch) - err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the InstanceGroupManagerPolicyPatch -func (instanceGroupManagerPolicyPatch *InstanceGroupManagerPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceGroupManagerPolicyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// InstanceGroupManagerPolicyPrototype : InstanceGroupManagerPolicyPrototype struct -// Models which "extend" this model: -// - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype -type InstanceGroupManagerPolicyPrototype struct { - // The name for this instance group manager policy. The name must not be used by another policy for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The type of metric to be evaluated. - MetricType *string `json:"metric_type,omitempty"` - - // The metric value to be evaluated. - MetricValue *int64 `json:"metric_value,omitempty"` - - // The type of policy for the instance group. - PolicyType *string `json:"policy_type,omitempty"` -} - -// Constants associated with the InstanceGroupManagerPolicyPrototype.MetricType property. -// The type of metric to be evaluated. -const ( - InstanceGroupManagerPolicyPrototypeMetricTypeCpuConst = "cpu" - InstanceGroupManagerPolicyPrototypeMetricTypeMemoryConst = "memory" - InstanceGroupManagerPolicyPrototypeMetricTypeNetworkInConst = "network_in" - InstanceGroupManagerPolicyPrototypeMetricTypeNetworkOutConst = "network_out" -) - -// Constants associated with the InstanceGroupManagerPolicyPrototype.PolicyType property. -// The type of policy for the instance group. -const ( - InstanceGroupManagerPolicyPrototypePolicyTypeTargetConst = "target" -) - -func (*InstanceGroupManagerPolicyPrototype) isaInstanceGroupManagerPolicyPrototype() bool { - return true -} - -type InstanceGroupManagerPolicyPrototypeIntf interface { - isaInstanceGroupManagerPolicyPrototype() bool -} - -// UnmarshalInstanceGroupManagerPolicyPrototype unmarshals an instance of InstanceGroupManagerPolicyPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPolicyReference : InstanceGroupManagerPolicyReference struct -type InstanceGroupManagerPolicyReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceGroupManagerPolicyReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance group manager policy. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager policy. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager policy. The name is unique across all policies for the instance group - // manager. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalInstanceGroupManagerPolicyReference unmarshals an instance of InstanceGroupManagerPolicyReference from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerPolicyReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceGroupManagerPolicyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceGroupManagerPolicyReferenceDeleted unmarshals an instance of InstanceGroupManagerPolicyReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPrototype : InstanceGroupManagerPrototype struct -// Models which "extend" this model: -// - InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype -// - InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype -type InstanceGroupManagerPrototype struct { - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled,omitempty"` - - // The name for this instance group manager. The name must not be used by another manager for the instance group. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The time window in seconds to aggregate metrics prior to evaluation. - AggregationWindow *int64 `json:"aggregation_window,omitempty"` - - // The duration of time in seconds to pause further scale actions after scaling has taken place. - Cooldown *int64 `json:"cooldown,omitempty"` - - // The type of instance group manager. - ManagerType *string `json:"manager_type,omitempty"` - - // The maximum number of members in a managed instance group. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The minimum number of members in a managed instance group. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` -} - -// Constants associated with the InstanceGroupManagerPrototype.ManagerType property. -// The type of instance group manager. -const ( - InstanceGroupManagerPrototypeManagerTypeAutoscaleConst = "autoscale" -) - -func (*InstanceGroupManagerPrototype) isaInstanceGroupManagerPrototype() bool { - return true -} - -type InstanceGroupManagerPrototypeIntf interface { - isaInstanceGroupManagerPrototype() bool -} - -// UnmarshalInstanceGroupManagerPrototype unmarshals an instance of InstanceGroupManagerPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPrototype) - err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerReference : InstanceGroupManagerReference struct -type InstanceGroupManagerReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager. The name is unique across all managers for the instance group. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalInstanceGroupManagerReference unmarshals an instance of InstanceGroupManagerReference from the specified map of raw messages. -func UnmarshalInstanceGroupManagerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceGroupManagerReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceGroupManagerReferenceDeleted unmarshals an instance of InstanceGroupManagerReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceGroupManagerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionGroup : InstanceGroupManagerScheduledActionGroup struct -type InstanceGroupManagerScheduledActionGroup struct { - // The desired number of instance group members at the scheduled time. - MembershipCount *int64 `json:"membership_count" validate:"required"` -} - -// UnmarshalInstanceGroupManagerScheduledActionGroup unmarshals an instance of InstanceGroupManagerScheduledActionGroup from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionGroup) - err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionGroupPrototype : InstanceGroupManagerScheduledActionGroupPrototype struct -type InstanceGroupManagerScheduledActionGroupPrototype struct { - // The desired number of instance group members at the scheduled time. - MembershipCount *int64 `json:"membership_count" validate:"required"` -} - -// NewInstanceGroupManagerScheduledActionGroupPrototype : Instantiate InstanceGroupManagerScheduledActionGroupPrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerScheduledActionGroupPrototype(membershipCount int64) (_model *InstanceGroupManagerScheduledActionGroupPrototype, err error) { - _model = &InstanceGroupManagerScheduledActionGroupPrototype{ - MembershipCount: core.Int64Ptr(membershipCount), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalInstanceGroupManagerScheduledActionGroupPrototype unmarshals an instance of InstanceGroupManagerScheduledActionGroupPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionGroupPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionGroupPrototype) - err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManager : InstanceGroupManagerScheduledActionManager struct -// Models which "extend" this model: -// - InstanceGroupManagerScheduledActionManagerAutoScale -type InstanceGroupManagerScheduledActionManager struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href,omitempty"` - - // The unique identifier for this instance group manager. - ID *string `json:"id,omitempty"` - - // The name for this instance group manager. The name is unique across all managers for the instance group. - Name *string `json:"name,omitempty"` - - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` -} - -func (*InstanceGroupManagerScheduledActionManager) isaInstanceGroupManagerScheduledActionManager() bool { - return true -} - -type InstanceGroupManagerScheduledActionManagerIntf interface { - isaInstanceGroupManagerScheduledActionManager() bool -} - -// UnmarshalInstanceGroupManagerScheduledActionManager unmarshals an instance of InstanceGroupManagerScheduledActionManager from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManager(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManager) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManagerPrototype : InstanceGroupManagerScheduledActionManagerPrototype struct -// Models which "extend" this model: -// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype -type InstanceGroupManagerScheduledActionManagerPrototype struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The unique identifier for this instance group manager. - ID *string `json:"id,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href,omitempty"` -} - -func (*InstanceGroupManagerScheduledActionManagerPrototype) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { - return true -} - -type InstanceGroupManagerScheduledActionManagerPrototypeIntf interface { - isaInstanceGroupManagerScheduledActionManagerPrototype() bool -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerPrototype unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerPrototype) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupMembership : InstanceGroupMembership struct -type InstanceGroupMembership struct { - // The date and time that the instance group manager policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If set to true, when deleting the membership the instance will also be deleted. - DeleteInstanceOnMembershipDelete *bool `json:"delete_instance_on_membership_delete" validate:"required"` - - // The URL for this instance group membership. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group membership. - ID *string `json:"id" validate:"required"` - - Instance *InstanceReference `json:"instance" validate:"required"` - - InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` - - // The name for this instance group membership. The name is unique across all memberships for the instance group. - Name *string `json:"name" validate:"required"` - - PoolMember *LoadBalancerPoolMemberReference `json:"pool_member,omitempty"` - - // The status of the instance group membership - // - `deleting`: Membership is deleting dependent resources - // - `failed`: Membership was unable to maintain dependent resources - // - `healthy`: Membership is active and serving in the group - // - `pending`: Membership is waiting for dependent resources - // - `unhealthy`: Membership has unhealthy dependent resources. - Status *string `json:"status" validate:"required"` - - // The date and time that the instance group membership was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` -} - -// Constants associated with the InstanceGroupMembership.Status property. -// The status of the instance group membership -// - `deleting`: Membership is deleting dependent resources -// - `failed`: Membership was unable to maintain dependent resources -// - `healthy`: Membership is active and serving in the group -// - `pending`: Membership is waiting for dependent resources -// - `unhealthy`: Membership has unhealthy dependent resources. -const ( - InstanceGroupMembershipStatusDeletingConst = "deleting" - InstanceGroupMembershipStatusFailedConst = "failed" - InstanceGroupMembershipStatusHealthyConst = "healthy" - InstanceGroupMembershipStatusPendingConst = "pending" - InstanceGroupMembershipStatusUnhealthyConst = "unhealthy" -) - -// UnmarshalInstanceGroupMembership unmarshals an instance of InstanceGroupMembership from the specified map of raw messages. -func UnmarshalInstanceGroupMembership(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupMembership) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "delete_instance_on_membership_delete", &obj.DeleteInstanceOnMembershipDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalInstanceReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "pool_member", &obj.PoolMember, UnmarshalLoadBalancerPoolMemberReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupMembershipCollection : InstanceGroupMembershipCollection struct -type InstanceGroupMembershipCollection struct { - // A link to the first page of resources. - First *InstanceGroupMembershipCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of instance group memberships. - Memberships []InstanceGroupMembership `json:"memberships" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *InstanceGroupMembershipCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalInstanceGroupMembershipCollection unmarshals an instance of InstanceGroupMembershipCollection from the specified map of raw messages. -func UnmarshalInstanceGroupMembershipCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupMembershipCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupMembershipCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "memberships", &obj.Memberships, UnmarshalInstanceGroupMembership) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupMembershipCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *InstanceGroupMembershipCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// InstanceGroupMembershipCollectionFirst : A link to the first page of resources. -type InstanceGroupMembershipCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupMembershipCollectionFirst unmarshals an instance of InstanceGroupMembershipCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceGroupMembershipCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupMembershipCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupMembershipCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceGroupMembershipCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupMembershipCollectionNext unmarshals an instance of InstanceGroupMembershipCollectionNext from the specified map of raw messages. -func UnmarshalInstanceGroupMembershipCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupMembershipCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupMembershipPatch : InstanceGroupMembershipPatch struct -type InstanceGroupMembershipPatch struct { - // The name for this instance group membership. The name must not be used by another membership for the instance group - // manager. - Name *string `json:"name,omitempty"` -} - -// UnmarshalInstanceGroupMembershipPatch unmarshals an instance of InstanceGroupMembershipPatch from the specified map of raw messages. -func UnmarshalInstanceGroupMembershipPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupMembershipPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the InstanceGroupMembershipPatch -func (instanceGroupMembershipPatch *InstanceGroupMembershipPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceGroupMembershipPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// InstanceGroupPatch : To add or update load balancer specification for an instance group the `membership_count` must first be set to 0. -type InstanceGroupPatch struct { - // The port to use for new load balancer pool members created by this instance group. - // - // This property must be set if and only if `load_balancer_pool` has been set. - ApplicationPort *int64 `json:"application_port,omitempty"` - - // Instance template to use when creating new instances. - // - // Instance groups are not compatible with instance templates that specify `true` for - // `default_trusted_profile.auto_link`. - InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template,omitempty"` - - // The load balancer associated with `load_balancer_pool`. - // The load balancer must have `instance_groups_supported` set to `true`. - // - // This property must be set if and only if `load_balancer_pool` has been set. - LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` - - // If specified, this instance group will manage the load balancer pool. A pool member - // will be created for each instance created by this group. The specified load - // balancer pool must not be used by another instance group in the VPC. - // - // If set, `load_balancer` and `application_port` must also be set. - LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` - - // The number of instances in the instance group. - MembershipCount *int64 `json:"membership_count,omitempty"` - - // The name for this instance group. The name must not be used by another instance group in the region. - Name *string `json:"name,omitempty"` - - // The subnets to use when creating new instances. - Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` -} - -// UnmarshalInstanceGroupPatch unmarshals an instance of InstanceGroupPatch from the specified map of raw messages. -func UnmarshalInstanceGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupPatch) - err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) - if err != nil { - return - } - err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "load_balancer", &obj.LoadBalancer, UnmarshalLoadBalancerIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the InstanceGroupPatch -func (instanceGroupPatch *InstanceGroupPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceGroupPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// InstanceGroupReference : InstanceGroupReference struct -type InstanceGroupReference struct { - // The CRN for this instance group. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceGroupReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group. - ID *string `json:"id" validate:"required"` - - // The name for this instance group. The name is unique across all instance groups in the region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalInstanceGroupReference unmarshals an instance of InstanceGroupReference from the specified map of raw messages. -func UnmarshalInstanceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceGroupReferenceDeleted unmarshals an instance of InstanceGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceInitialization : InstanceInitialization struct -type InstanceInitialization struct { - // The default trusted profile configuration specified at virtual server instance - // creation. If absent, no default trusted profile was specified. - DefaultTrustedProfile *InstanceInitializationDefaultTrustedProfile `json:"default_trusted_profile,omitempty"` - - // The public SSH keys used at instance initialization. - Keys []KeyReference `json:"keys" validate:"required"` - - Password *InstanceInitializationPassword `json:"password,omitempty"` -} - -// UnmarshalInstanceInitialization unmarshals an instance of InstanceInitialization from the specified map of raw messages. -func UnmarshalInstanceInitialization(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceInitialization) - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceInitializationDefaultTrustedProfile) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "password", &obj.Password, UnmarshalInstanceInitializationPassword) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceInitializationDefaultTrustedProfile : InstanceInitializationDefaultTrustedProfile struct -type InstanceInitializationDefaultTrustedProfile struct { - // If set to `true`, the system created a link to the specified `target` trusted profile during instance creation. - // Regardless of whether a link was created by the system or manually using the IAM Identity service, it will be - // automatically deleted when the instance is deleted. - AutoLink *bool `json:"auto_link" validate:"required"` - - // The default IAM trusted profile to use for this virtual server instance. - Target *TrustedProfileReference `json:"target" validate:"required"` -} - -// UnmarshalInstanceInitializationDefaultTrustedProfile unmarshals an instance of InstanceInitializationDefaultTrustedProfile from the specified map of raw messages. -func UnmarshalInstanceInitializationDefaultTrustedProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceInitializationDefaultTrustedProfile) - err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceInitializationPassword : InstanceInitializationPassword struct -type InstanceInitializationPassword struct { - // The administrator password at initialization, encrypted using `encryption_key`, and returned base64-encoded. - EncryptedPassword *[]byte `json:"encrypted_password" validate:"required"` - - // The public SSH key used to encrypt the administrator password. - EncryptionKey *KeyIdentityByFingerprint `json:"encryption_key" validate:"required"` -} - -// UnmarshalInstanceInitializationPassword unmarshals an instance of InstanceInitializationPassword from the specified map of raw messages. -func UnmarshalInstanceInitializationPassword(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceInitializationPassword) - err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyIdentityByFingerprint) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceLifecycleReason : InstanceLifecycleReason struct -type InstanceLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this lifecycle state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this lifecycle state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the InstanceLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. -const ( - InstanceLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalInstanceLifecycleReason unmarshals an instance of InstanceLifecycleReason from the specified map of raw messages. -func UnmarshalInstanceLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceLifecycleReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceMetadataService : The metadata service configuration. -type InstanceMetadataService struct { - // Indicates whether the metadata service endpoint is available to the virtual server instance. - Enabled *bool `json:"enabled" validate:"required"` - - // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is - // enabled. - // - `http`: HTTP protocol (unencrypted) - // - `https`: HTTP Secure protocol. - Protocol *string `json:"protocol" validate:"required"` - - // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata - // service is enabled. - ResponseHopLimit *int64 `json:"response_hop_limit" validate:"required"` -} - -// Constants associated with the InstanceMetadataService.Protocol property. -// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is -// enabled. -// - `http`: HTTP protocol (unencrypted) -// - `https`: HTTP Secure protocol. -const ( - InstanceMetadataServiceProtocolHTTPConst = "http" - InstanceMetadataServiceProtocolHTTPSConst = "https" -) - -// UnmarshalInstanceMetadataService unmarshals an instance of InstanceMetadataService from the specified map of raw messages. -func UnmarshalInstanceMetadataService(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceMetadataService) - err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceMetadataServicePatch : The metadata service configuration. -type InstanceMetadataServicePatch struct { - // Indicates whether the metadata service endpoint will be available to the virtual server instance. - Enabled *bool `json:"enabled,omitempty"` - - // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is - // enabled. - // - `http`: HTTP protocol (unencrypted) - // - `https`: HTTP Secure protocol. - Protocol *string `json:"protocol,omitempty"` - - // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata - // service is enabled. - ResponseHopLimit *int64 `json:"response_hop_limit,omitempty"` -} - -// Constants associated with the InstanceMetadataServicePatch.Protocol property. -// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is -// enabled. -// - `http`: HTTP protocol (unencrypted) -// - `https`: HTTP Secure protocol. -const ( - InstanceMetadataServicePatchProtocolHTTPConst = "http" - InstanceMetadataServicePatchProtocolHTTPSConst = "https" -) - -// UnmarshalInstanceMetadataServicePatch unmarshals an instance of InstanceMetadataServicePatch from the specified map of raw messages. -func UnmarshalInstanceMetadataServicePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceMetadataServicePatch) - err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceMetadataServicePrototype : The metadata service configuration. -type InstanceMetadataServicePrototype struct { - // Indicates whether the metadata service endpoint will be available to the virtual server instance. - Enabled *bool `json:"enabled,omitempty"` - - // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is - // enabled. - // - `http`: HTTP protocol (unencrypted) - // - `https`: HTTP Secure protocol. - Protocol *string `json:"protocol,omitempty"` - - // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata - // service is enabled. - ResponseHopLimit *int64 `json:"response_hop_limit,omitempty"` -} - -// Constants associated with the InstanceMetadataServicePrototype.Protocol property. -// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is -// enabled. -// - `http`: HTTP protocol (unencrypted) -// - `https`: HTTP Secure protocol. -const ( - InstanceMetadataServicePrototypeProtocolHTTPConst = "http" - InstanceMetadataServicePrototypeProtocolHTTPSConst = "https" -) - -// UnmarshalInstanceMetadataServicePrototype unmarshals an instance of InstanceMetadataServicePrototype from the specified map of raw messages. -func UnmarshalInstanceMetadataServicePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceMetadataServicePrototype) - err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachment : InstanceNetworkAttachment struct -type InstanceNetworkAttachment struct { - // The date and time that the instance network attachment was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network attachment. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the instance network attachment. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this instance network attachment. The name is unique across all network attachments for the instance. - Name *string `json:"name" validate:"required"` - - // The port speed for this instance network attachment in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - // The primary IP address of the virtual network interface for the instance network - // attachment. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The subnet of the virtual network interface for the instance network attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The instance network attachment type. - Type *string `json:"type" validate:"required"` - - // The virtual network interface for this instance network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` -} - -// Constants associated with the InstanceNetworkAttachment.LifecycleState property. -// The lifecycle state of the instance network attachment. -const ( - InstanceNetworkAttachmentLifecycleStateDeletingConst = "deleting" - InstanceNetworkAttachmentLifecycleStateFailedConst = "failed" - InstanceNetworkAttachmentLifecycleStatePendingConst = "pending" - InstanceNetworkAttachmentLifecycleStateStableConst = "stable" - InstanceNetworkAttachmentLifecycleStateSuspendedConst = "suspended" - InstanceNetworkAttachmentLifecycleStateUpdatingConst = "updating" - InstanceNetworkAttachmentLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the InstanceNetworkAttachment.ResourceType property. -// The resource type. -const ( - InstanceNetworkAttachmentResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" -) - -// Constants associated with the InstanceNetworkAttachment.Type property. -// The instance network attachment type. -const ( - InstanceNetworkAttachmentTypePrimaryConst = "primary" - InstanceNetworkAttachmentTypeSecondaryConst = "secondary" -) - -// UnmarshalInstanceNetworkAttachment unmarshals an instance of InstanceNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachment) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentCollection : InstanceNetworkAttachmentCollection struct -type InstanceNetworkAttachmentCollection struct { - // Collection of instance network attachments. - NetworkAttachments []InstanceNetworkAttachment `json:"network_attachments" validate:"required"` -} - -// UnmarshalInstanceNetworkAttachmentCollection unmarshals an instance of InstanceNetworkAttachmentCollection from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentCollection) - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachment) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentPatch : InstanceNetworkAttachmentPatch struct -type InstanceNetworkAttachmentPatch struct { - // The name for this network attachment. The name must not be used by another network attachment for the instance. - Name *string `json:"name,omitempty"` -} - -// UnmarshalInstanceNetworkAttachmentPatch unmarshals an instance of InstanceNetworkAttachmentPatch from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the InstanceNetworkAttachmentPatch -func (instanceNetworkAttachmentPatch *InstanceNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceNetworkAttachmentPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// InstanceNetworkAttachmentPrototype : InstanceNetworkAttachmentPrototype struct -type InstanceNetworkAttachmentPrototype struct { - // The name for this network attachment. Names must be unique within the instance the network attachment resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // A virtual network interface for the instance network attachment. This can be specified - // using an existing virtual network interface, or a prototype object for a new virtual - // network interface. - // - // If an existing virtual network interface is specified, `enable_infrastructure_nat` must be - // `false`. - VirtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` -} - -// NewInstanceNetworkAttachmentPrototype : Instantiate InstanceNetworkAttachmentPrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) (_model *InstanceNetworkAttachmentPrototype, err error) { - _model = &InstanceNetworkAttachmentPrototype{ - VirtualNetworkInterface: virtualNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalInstanceNetworkAttachmentPrototype unmarshals an instance of InstanceNetworkAttachmentPrototype from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentPrototypeVirtualNetworkInterface : A virtual network interface for the instance network attachment. This can be specified using an existing virtual -// network interface, or a prototype object for a new virtual network interface. -// -// If an existing virtual network interface is specified, `enable_infrastructure_nat` must be -// `false`. -// 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`. - // - If the virtual network interface is attached, the target `resource_type` must be - // `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 - // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // same subnet as the primary IP. - // - // If reserved IP identities are provided, the specified reserved IPs must be unbound. - // - // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network - // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet - // will be automatically selected and reserved. - Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are - // reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the virtual network interface. May be either a - // reserved IP identity, or a reserved IP prototype object which will be used to create a - // new reserved IP. - // - // If a reserved IP identity is provided, the specified reserved IP must be unbound. - // - // If a reserved IP prototype object with an address is provided, the address must be - // available on the virtual network interface's subnet. If no address is specified, - // an available address on the subnet will be automatically selected and reserved. - PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The resource group to use for this virtual network interface. If unspecified, the - // virtual server instance's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. Required if `primary_ip` does not specify a reserved IP. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { - isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool -} - -// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentReference : InstanceNetworkAttachmentReference struct -type InstanceNetworkAttachmentReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network attachment. - ID *string `json:"id" validate:"required"` - - // The name for this instance network attachment. The name is unique across all network attachments for the instance. - Name *string `json:"name" validate:"required"` - - // The primary IP address of the virtual network interface for the instance network - // attachment. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The subnet of the virtual network interface for the instance network attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the InstanceNetworkAttachmentReference.ResourceType property. -// The resource type. -const ( - InstanceNetworkAttachmentReferenceResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" -) - -// UnmarshalInstanceNetworkAttachmentReference unmarshals an instance of InstanceNetworkAttachmentReference from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceNetworkAttachmentReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceNetworkAttachmentReferenceDeleted unmarshals an instance of InstanceNetworkAttachmentReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePatch : InstancePatch struct -type InstancePatch struct { - // The availability policy for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPatch `json:"availability_policy,omitempty"` - - // The metadata service configuration. - MetadataService *InstanceMetadataServicePatch `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. Changing the name will not affect the system hostname. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. For the placement - // restrictions to be changed, the instance `status` must be `stopping` or `stopped`. - PlacementTarget InstancePlacementTargetPatchIntf `json:"placement_target,omitempty"` - - // The profile to use for this virtual server instance. For the profile to be changed, - // the instance `status` must be `stopping` or `stopped`. In addition, the requested - // profile must: - // - Have matching instance disk support. Any disks associated with the current profile - // will be deleted, and any disks associated with the requested profile will be - // created. - // - Be compatible with any `placement_target` constraints. For example, if the - // instance is placed on a dedicated host, the requested profile `family` must be - // the same as the dedicated host `family`. - // - Have the same `vcpu.architecture`. - // - Support the number of network attachments or network interfaces the instance - // currently has. - Profile InstancePatchProfileIntf `json:"profile,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` -} - -// UnmarshalInstancePatch unmarshals an instance of InstancePatch from the specified map of raw messages. -func UnmarshalInstancePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePatch) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPatch) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPatch) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstancePatchProfile) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the InstancePatch -func (instancePatch *InstancePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instancePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// InstancePatchProfile : The profile to use for this virtual server instance. For the profile to be changed, the instance `status` must be -// `stopping` or `stopped`. In addition, the requested profile must: -// - Have matching instance disk support. Any disks associated with the current profile -// will be deleted, and any disks associated with the requested profile will be -// created. -// - Be compatible with any `placement_target` constraints. For example, if the -// instance is placed on a dedicated host, the requested profile `family` must be -// the same as the dedicated host `family`. -// - Have the same `vcpu.architecture`. -// - Support the number of network attachments or network interfaces the instance -// currently has. -// -// Models which "extend" this model: -// - InstancePatchProfileInstanceProfileIdentityByName -// - InstancePatchProfileInstanceProfileIdentityByHref -type InstancePatchProfile struct { - // The globally unique name for this virtual server instance profile. - Name *string `json:"name,omitempty"` - - // The URL for this virtual server instance profile. - Href *string `json:"href,omitempty"` -} - -func (*InstancePatchProfile) isaInstancePatchProfile() bool { - return true -} - -type InstancePatchProfileIntf interface { - isaInstancePatchProfile() bool -} - -// UnmarshalInstancePatchProfile unmarshals an instance of InstancePatchProfile from the specified map of raw messages. -func UnmarshalInstancePatchProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePatchProfile) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTarget : InstancePlacementTarget struct -// Models which "extend" this model: -// - InstancePlacementTargetDedicatedHostGroupReference -// - InstancePlacementTargetDedicatedHostReference -// - InstancePlacementTargetPlacementGroupReference -type InstancePlacementTarget struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this dedicated host group. - Href *string `json:"href,omitempty"` - - // The unique identifier for this dedicated host group. - ID *string `json:"id,omitempty"` - - // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the InstancePlacementTarget.ResourceType property. -// The resource type. -const ( - InstancePlacementTargetResourceTypeDedicatedHostGroupConst = "dedicated_host_group" -) - -func (*InstancePlacementTarget) isaInstancePlacementTarget() bool { - return true -} - -type InstancePlacementTargetIntf interface { - isaInstancePlacementTarget() bool -} - -// UnmarshalInstancePlacementTarget unmarshals an instance of InstancePlacementTarget from the specified map of raw messages. -func UnmarshalInstancePlacementTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTarget) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatch : InstancePlacementTargetPatch struct -// Models which "extend" this model: -// - InstancePlacementTargetPatchDedicatedHostIdentity -// - InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatch struct { - // The unique identifier for this dedicated host. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPatch) isaInstancePlacementTargetPatch() bool { - return true -} - -type InstancePlacementTargetPatchIntf interface { - isaInstancePlacementTargetPatch() bool -} - -// UnmarshalInstancePlacementTargetPatch unmarshals an instance of InstancePlacementTargetPatch from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototype : InstancePlacementTargetPrototype struct -// Models which "extend" this model: -// - InstancePlacementTargetPrototypeDedicatedHostIdentity -// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -// - InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototype struct { - // The unique identifier for this dedicated host. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPrototype) isaInstancePlacementTargetPrototype() bool { - return true -} - -type InstancePlacementTargetPrototypeIntf interface { - isaInstancePlacementTargetPrototype() bool -} - -// UnmarshalInstancePlacementTargetPrototype unmarshals an instance of InstancePlacementTargetPrototype from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfile : InstanceProfile struct -type InstanceProfile struct { - Bandwidth InstanceProfileBandwidthIntf `json:"bandwidth" validate:"required"` - - // Collection of the instance profile's disks. - Disks []InstanceProfileDisk `json:"disks" validate:"required"` - - // The product family this virtual server instance profile belongs to. - Family *string `json:"family" validate:"required"` - - GpuCount InstanceProfileGpuIntf `json:"gpu_count,omitempty"` - - GpuManufacturer *InstanceProfileGpuManufacturer `json:"gpu_manufacturer,omitempty"` - - GpuMemory InstanceProfileGpuMemoryIntf `json:"gpu_memory,omitempty"` - - GpuModel *InstanceProfileGpuModel `json:"gpu_model,omitempty"` - - // The URL for this virtual server instance profile. - Href *string `json:"href" validate:"required"` - - Memory InstanceProfileMemoryIntf `json:"memory" validate:"required"` - - // The globally unique name for this virtual server instance profile. - Name *string `json:"name" validate:"required"` - - NetworkAttachmentCount InstanceProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"` - - NetworkInterfaceCount InstanceProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` - - NumaCount InstanceProfileNumaCountIntf `json:"numa_count,omitempty"` - - OsArchitecture *InstanceProfileOsArchitecture `json:"os_architecture" validate:"required"` - - PortSpeed InstanceProfilePortSpeedIntf `json:"port_speed" validate:"required"` - - // The status of the instance profile: - // - `previous`: This instance profile is an older revision, but remains provisionable and - // usable. - // - `current`: This profile is the latest revision. - // - // Note that revisions are indicated by the generation of an instance profile. Refer to the - // [profile naming conventions] - // (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how - // generations are defined within an instance profile. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the - // unexpected property value was encountered. - Status *string `json:"status" validate:"required"` - - TotalVolumeBandwidth InstanceProfileVolumeBandwidthIntf `json:"total_volume_bandwidth" validate:"required"` - - VcpuArchitecture *InstanceProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` - - VcpuCount InstanceProfileVcpuIntf `json:"vcpu_count" validate:"required"` - - VcpuManufacturer *InstanceProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"` -} - -// Constants associated with the InstanceProfile.Status property. -// The status of the instance profile: -// - `previous`: This instance profile is an older revision, but remains provisionable and -// usable. -// - `current`: This profile is the latest revision. -// -// Note that revisions are indicated by the generation of an instance profile. Refer to the -// [profile naming conventions] -// (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how -// generations are defined within an instance profile. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the -// unexpected property value was encountered. -const ( - InstanceProfileStatusCurrentConst = "current" - InstanceProfileStatusPreviousConst = "previous" -) - -// UnmarshalInstanceProfile unmarshals an instance of InstanceProfile from the specified map of raw messages. -func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfile) - err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalInstanceProfileBandwidth) - if err != nil { - return - } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceProfileDisk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - return - } - err = core.UnmarshalModel(m, "gpu_count", &obj.GpuCount, UnmarshalInstanceProfileGpu) - if err != nil { - return - } - err = core.UnmarshalModel(m, "gpu_manufacturer", &obj.GpuManufacturer, UnmarshalInstanceProfileGpuManufacturer) - if err != nil { - return - } - err = core.UnmarshalModel(m, "gpu_memory", &obj.GpuMemory, UnmarshalInstanceProfileGpuMemory) - if err != nil { - return - } - err = core.UnmarshalModel(m, "gpu_model", &obj.GpuModel, UnmarshalInstanceProfileGpuModel) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalInstanceProfileMemory) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalInstanceProfileNetworkAttachmentCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalInstanceProfileNetworkInterfaceCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "numa_count", &obj.NumaCount, UnmarshalInstanceProfileNumaCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalInstanceProfileOsArchitecture) - if err != nil { - return - } - err = core.UnmarshalModel(m, "port_speed", &obj.PortSpeed, UnmarshalInstanceProfilePortSpeed) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth, UnmarshalInstanceProfileVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalInstanceProfileVcpuArchitecture) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalInstanceProfileVcpu) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalInstanceProfileVcpuManufacturer) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileBandwidth : InstanceProfileBandwidth struct -// Models which "extend" this model: -// - InstanceProfileBandwidthFixed -// - InstanceProfileBandwidthRange -// - InstanceProfileBandwidthEnum -// - InstanceProfileBandwidthDependent -type InstanceProfileBandwidth struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the InstanceProfileBandwidth.Type property. -// The type for this profile field. -const ( - InstanceProfileBandwidthTypeFixedConst = "fixed" -) - -func (*InstanceProfileBandwidth) isaInstanceProfileBandwidth() bool { - return true -} - -type InstanceProfileBandwidthIntf interface { - isaInstanceProfileBandwidth() bool -} - -// UnmarshalInstanceProfileBandwidth unmarshals an instance of InstanceProfileBandwidth from the specified map of raw messages. -func UnmarshalInstanceProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileBandwidth) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileCollection : InstanceProfileCollection struct -type InstanceProfileCollection struct { - // Collection of virtual server instance profiles. - Profiles []InstanceProfile `json:"profiles" validate:"required"` -} - -// UnmarshalInstanceProfileCollection unmarshals an instance of InstanceProfileCollection from the specified map of raw messages. -func UnmarshalInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileCollection) - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalInstanceProfile) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDisk : Disks provided by this profile. -type InstanceProfileDisk struct { - Quantity InstanceProfileDiskQuantityIntf `json:"quantity" validate:"required"` - - Size InstanceProfileDiskSizeIntf `json:"size" validate:"required"` - - SupportedInterfaceTypes *InstanceProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` -} - -// UnmarshalInstanceProfileDisk unmarshals an instance of InstanceProfileDisk from the specified map of raw messages. -func UnmarshalInstanceProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDisk) - err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalInstanceProfileDiskQuantity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalInstanceProfileDiskSize) - if err != nil { - return - } - err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalInstanceProfileDiskSupportedInterfaces) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskQuantity : InstanceProfileDiskQuantity struct -// Models which "extend" this model: -// - InstanceProfileDiskQuantityFixed -// - InstanceProfileDiskQuantityRange -// - InstanceProfileDiskQuantityEnum -// - InstanceProfileDiskQuantityDependent -type InstanceProfileDiskQuantity struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the InstanceProfileDiskQuantity.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskQuantityTypeFixedConst = "fixed" -) - -func (*InstanceProfileDiskQuantity) isaInstanceProfileDiskQuantity() bool { - return true -} - -type InstanceProfileDiskQuantityIntf interface { - isaInstanceProfileDiskQuantity() bool -} - -// UnmarshalInstanceProfileDiskQuantity unmarshals an instance of InstanceProfileDiskQuantity from the specified map of raw messages. -func UnmarshalInstanceProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskQuantity) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskSize : InstanceProfileDiskSize struct -// Models which "extend" this model: -// - InstanceProfileDiskSizeFixed -// - InstanceProfileDiskSizeRange -// - InstanceProfileDiskSizeEnum -// - InstanceProfileDiskSizeDependent -type InstanceProfileDiskSize struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the InstanceProfileDiskSize.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskSizeTypeFixedConst = "fixed" -) - -func (*InstanceProfileDiskSize) isaInstanceProfileDiskSize() bool { - return true -} - -type InstanceProfileDiskSizeIntf interface { - isaInstanceProfileDiskSize() bool -} - -// UnmarshalInstanceProfileDiskSize unmarshals an instance of InstanceProfileDiskSize from the specified map of raw messages. -func UnmarshalInstanceProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskSize) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskSupportedInterfaces : InstanceProfileDiskSupportedInterfaces struct -type InstanceProfileDiskSupportedInterfaces struct { - // The disk interface used for attaching the disk. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - Default *string `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The supported disk interfaces used for attaching the disk. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskSupportedInterfaces.Default property. -// The disk interface used for attaching the disk. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - InstanceProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" - InstanceProfileDiskSupportedInterfacesDefaultVirtioBlkConst = "virtio_blk" -) - -// Constants associated with the InstanceProfileDiskSupportedInterfaces.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskSupportedInterfacesTypeEnumConst = "enum" -) - -// Constants associated with the InstanceProfileDiskSupportedInterfaces.Values property. -// The disk interface used for attaching the disk. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - InstanceProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" - InstanceProfileDiskSupportedInterfacesValuesVirtioBlkConst = "virtio_blk" -) - -// UnmarshalInstanceProfileDiskSupportedInterfaces unmarshals an instance of InstanceProfileDiskSupportedInterfaces from the specified map of raw messages. -func UnmarshalInstanceProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskSupportedInterfaces) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpu : InstanceProfileGpu struct -// Models which "extend" this model: -// - InstanceProfileGpuFixed -// - InstanceProfileGpuRange -// - InstanceProfileGpuEnum -// - InstanceProfileGpuDependent -type InstanceProfileGpu struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the InstanceProfileGpu.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuTypeFixedConst = "fixed" -) - -func (*InstanceProfileGpu) isaInstanceProfileGpu() bool { - return true -} - -type InstanceProfileGpuIntf interface { - isaInstanceProfileGpu() bool -} - -// UnmarshalInstanceProfileGpu unmarshals an instance of InstanceProfileGpu from the specified map of raw messages. -func UnmarshalInstanceProfileGpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpu) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuManufacturer : InstanceProfileGpuManufacturer struct -type InstanceProfileGpuManufacturer struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The possible GPU manufacturer(s) for an instance with this profile. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuManufacturer.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuManufacturerTypeEnumConst = "enum" -) - -// UnmarshalInstanceProfileGpuManufacturer unmarshals an instance of InstanceProfileGpuManufacturer from the specified map of raw messages. -func UnmarshalInstanceProfileGpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuManufacturer) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuMemory : InstanceProfileGpuMemory struct -// Models which "extend" this model: -// - InstanceProfileGpuMemoryFixed -// - InstanceProfileGpuMemoryRange -// - InstanceProfileGpuMemoryEnum -// - InstanceProfileGpuMemoryDependent -type InstanceProfileGpuMemory struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the InstanceProfileGpuMemory.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuMemoryTypeFixedConst = "fixed" -) - -func (*InstanceProfileGpuMemory) isaInstanceProfileGpuMemory() bool { - return true -} - -type InstanceProfileGpuMemoryIntf interface { - isaInstanceProfileGpuMemory() bool -} - -// UnmarshalInstanceProfileGpuMemory unmarshals an instance of InstanceProfileGpuMemory from the specified map of raw messages. -func UnmarshalInstanceProfileGpuMemory(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuMemory) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuModel : InstanceProfileGpuModel struct -type InstanceProfileGpuModel struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The possible GPU model(s) for an instance with this profile. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuModel.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuModelTypeEnumConst = "enum" -) - -// UnmarshalInstanceProfileGpuModel unmarshals an instance of InstanceProfileGpuModel from the specified map of raw messages. -func UnmarshalInstanceProfileGpuModel(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuModel) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileIdentity : Identifies an instance profile by a unique property. -// Models which "extend" this model: -// - InstanceProfileIdentityByName -// - InstanceProfileIdentityByHref -type InstanceProfileIdentity struct { - // The globally unique name for this virtual server instance profile. - Name *string `json:"name,omitempty"` - - // The URL for this virtual server instance profile. - Href *string `json:"href,omitempty"` -} - -func (*InstanceProfileIdentity) isaInstanceProfileIdentity() bool { - return true -} - -type InstanceProfileIdentityIntf interface { - isaInstanceProfileIdentity() bool -} - -// UnmarshalInstanceProfileIdentity unmarshals an instance of InstanceProfileIdentity from the specified map of raw messages. -func UnmarshalInstanceProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileMemory : InstanceProfileMemory struct -// Models which "extend" this model: -// - InstanceProfileMemoryFixed -// - InstanceProfileMemoryRange -// - InstanceProfileMemoryEnum -// - InstanceProfileMemoryDependent -type InstanceProfileMemory struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the InstanceProfileMemory.Type property. -// The type for this profile field. -const ( - InstanceProfileMemoryTypeFixedConst = "fixed" -) - -func (*InstanceProfileMemory) isaInstanceProfileMemory() bool { - return true -} - -type InstanceProfileMemoryIntf interface { - isaInstanceProfileMemory() bool -} - -// UnmarshalInstanceProfileMemory unmarshals an instance of InstanceProfileMemory from the specified map of raw messages. -func UnmarshalInstanceProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileMemory) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileNumaCount : InstanceProfileNumaCount struct -// Models which "extend" this model: -// - InstanceProfileNumaCountFixed -// - InstanceProfileNumaCountDependent -type InstanceProfileNumaCount struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` -} - -// Constants associated with the InstanceProfileNumaCount.Type property. -// The type for this profile field. -const ( - InstanceProfileNumaCountTypeFixedConst = "fixed" -) - -func (*InstanceProfileNumaCount) isaInstanceProfileNumaCount() bool { - return true -} - -type InstanceProfileNumaCountIntf interface { - isaInstanceProfileNumaCount() bool -} - -// UnmarshalInstanceProfileNumaCount unmarshals an instance of InstanceProfileNumaCount from the specified map of raw messages. -func UnmarshalInstanceProfileNumaCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNumaCount) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileNetworkAttachmentCount : InstanceProfileNetworkAttachmentCount struct -// Models which "extend" this model: -// - InstanceProfileNetworkAttachmentCountRange -// - InstanceProfileNetworkAttachmentCountDependent -type InstanceProfileNetworkAttachmentCount struct { - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The type for this profile field. - Type *string `json:"type,omitempty"` -} - -// Constants associated with the InstanceProfileNetworkAttachmentCount.Type property. -// The type for this profile field. -const ( - InstanceProfileNetworkAttachmentCountTypeRangeConst = "range" -) - -func (*InstanceProfileNetworkAttachmentCount) isaInstanceProfileNetworkAttachmentCount() bool { - return true -} - -type InstanceProfileNetworkAttachmentCountIntf interface { - isaInstanceProfileNetworkAttachmentCount() bool -} - -// UnmarshalInstanceProfileNetworkAttachmentCount unmarshals an instance of InstanceProfileNetworkAttachmentCount from the specified map of raw messages. -func UnmarshalInstanceProfileNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNetworkAttachmentCount) - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileNetworkInterfaceCount : InstanceProfileNetworkInterfaceCount struct -// Models which "extend" this model: -// - InstanceProfileNetworkInterfaceCountRange -// - InstanceProfileNetworkInterfaceCountDependent -type InstanceProfileNetworkInterfaceCount struct { - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The type for this profile field. - Type *string `json:"type,omitempty"` -} - -// Constants associated with the InstanceProfileNetworkInterfaceCount.Type property. -// The type for this profile field. -const ( - InstanceProfileNetworkInterfaceCountTypeRangeConst = "range" -) - -func (*InstanceProfileNetworkInterfaceCount) isaInstanceProfileNetworkInterfaceCount() bool { - return true -} - -type InstanceProfileNetworkInterfaceCountIntf interface { - isaInstanceProfileNetworkInterfaceCount() bool -} - -// UnmarshalInstanceProfileNetworkInterfaceCount unmarshals an instance of InstanceProfileNetworkInterfaceCount from the specified map of raw messages. -func UnmarshalInstanceProfileNetworkInterfaceCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNetworkInterfaceCount) - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileOsArchitecture : InstanceProfileOsArchitecture struct -type InstanceProfileOsArchitecture struct { - // The default OS architecture for an instance with this profile. - Default *string `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The supported OS architecture(s) for an instance with this profile. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileOsArchitecture.Type property. -// The type for this profile field. -const ( - InstanceProfileOsArchitectureTypeEnumConst = "enum" -) - -// UnmarshalInstanceProfileOsArchitecture unmarshals an instance of InstanceProfileOsArchitecture from the specified map of raw messages. -func UnmarshalInstanceProfileOsArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileOsArchitecture) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfilePortSpeed : InstanceProfilePortSpeed struct -// Models which "extend" this model: -// - InstanceProfilePortSpeedFixed -// - InstanceProfilePortSpeedDependent -type InstanceProfilePortSpeed struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` -} - -// Constants associated with the InstanceProfilePortSpeed.Type property. -// The type for this profile field. -const ( - InstanceProfilePortSpeedTypeFixedConst = "fixed" -) - -func (*InstanceProfilePortSpeed) isaInstanceProfilePortSpeed() bool { - return true -} - -type InstanceProfilePortSpeedIntf interface { - isaInstanceProfilePortSpeed() bool -} - -// UnmarshalInstanceProfilePortSpeed unmarshals an instance of InstanceProfilePortSpeed from the specified map of raw messages. -func UnmarshalInstanceProfilePortSpeed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfilePortSpeed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileReference : InstanceProfileReference struct -type InstanceProfileReference struct { - // The URL for this virtual server instance profile. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this virtual server instance profile. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalInstanceProfileReference unmarshals an instance of InstanceProfileReference from the specified map of raw messages. -func UnmarshalInstanceProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVcpu : InstanceProfileVcpu struct -// Models which "extend" this model: -// - InstanceProfileVcpuFixed -// - InstanceProfileVcpuRange -// - InstanceProfileVcpuEnum -// - InstanceProfileVcpuDependent -type InstanceProfileVcpu struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the InstanceProfileVcpu.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuTypeFixedConst = "fixed" -) - -func (*InstanceProfileVcpu) isaInstanceProfileVcpu() bool { - return true -} - -type InstanceProfileVcpuIntf interface { - isaInstanceProfileVcpu() bool -} - -// UnmarshalInstanceProfileVcpu unmarshals an instance of InstanceProfileVcpu from the specified map of raw messages. -func UnmarshalInstanceProfileVcpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpu) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVcpuArchitecture : InstanceProfileVcpuArchitecture struct -type InstanceProfileVcpuArchitecture struct { - // The default VCPU architecture for an instance with this profile. - Default *string `json:"default,omitempty"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The VCPU architecture for an instance with this profile. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileVcpuArchitecture.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuArchitectureTypeFixedConst = "fixed" -) - -// UnmarshalInstanceProfileVcpuArchitecture unmarshals an instance of InstanceProfileVcpuArchitecture from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuArchitecture) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVcpuManufacturer : InstanceProfileVcpuManufacturer struct -type InstanceProfileVcpuManufacturer struct { - // The default VCPU manufacturer for an instance with this profile. - Default *string `json:"default,omitempty"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The VCPU manufacturer for an instance with this profile. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileVcpuManufacturer.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuManufacturerTypeFixedConst = "fixed" -) - -// UnmarshalInstanceProfileVcpuManufacturer unmarshals an instance of InstanceProfileVcpuManufacturer from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuManufacturer) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVolumeBandwidth : InstanceProfileVolumeBandwidth struct -// Models which "extend" this model: -// - InstanceProfileVolumeBandwidthFixed -// - InstanceProfileVolumeBandwidthRange -// - InstanceProfileVolumeBandwidthEnum -// - InstanceProfileVolumeBandwidthDependent -type InstanceProfileVolumeBandwidth struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the InstanceProfileVolumeBandwidth.Type property. -// The type for this profile field. -const ( - InstanceProfileVolumeBandwidthTypeFixedConst = "fixed" -) - -func (*InstanceProfileVolumeBandwidth) isaInstanceProfileVolumeBandwidth() bool { - return true -} - -type InstanceProfileVolumeBandwidthIntf interface { - isaInstanceProfileVolumeBandwidth() bool -} - -// UnmarshalInstanceProfileVolumeBandwidth unmarshals an instance of InstanceProfileVolumeBandwidth from the specified map of raw messages. -func UnmarshalInstanceProfileVolumeBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVolumeBandwidth) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototype : InstancePrototype struct -// Models which "extend" this model: -// - InstancePrototypeInstanceByImage -// - InstancePrototypeInstanceByCatalogOffering -// - InstancePrototypeInstanceByVolume -// - InstancePrototypeInstanceBySourceSnapshot -// - InstancePrototypeInstanceBySourceTemplate -type InstancePrototype struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not - // subsequently managed. Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - // property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - // The metadata service configuration. - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this - // virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change - // in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network - // attachments or instance network interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` - - // The template to create this virtual server instance from. - SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` -} - -func (*InstancePrototype) isaInstancePrototype() bool { - return true -} - -type InstancePrototypeIntf interface { - isaInstancePrototype() bool -} - -// UnmarshalInstancePrototype unmarshals an instance of InstancePrototype from the specified map of raw messages. -func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototype) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceReference : InstanceReference struct -type InstanceReference struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` - - // The name for this virtual server instance. The name is unique across all virtual server instances in the region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalInstanceReference unmarshals an instance of InstanceReference from the specified map of raw messages. -func UnmarshalInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceReferenceDeleted unmarshals an instance of InstanceReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceStatusReason : InstanceStatusReason struct -type InstanceStatusReason struct { - // A snake case string succinctly identifying the status reason. - Code *string `json:"code" validate:"required"` - - // An explanation of the status reason. - Message *string `json:"message" validate:"required"` - - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the InstanceStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -const ( - InstanceStatusReasonCodeCannotStartConst = "cannot_start" - InstanceStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" - InstanceStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" - InstanceStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" - InstanceStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" - InstanceStatusReasonCodeCannotStartPlacementGroupConst = "cannot_start_placement_group" - InstanceStatusReasonCodeCannotStartStorageConst = "cannot_start_storage" - InstanceStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" - InstanceStatusReasonCodeStoppedByHostFailureConst = "stopped_by_host_failure" - InstanceStatusReasonCodeStoppedForImageCreationConst = "stopped_for_image_creation" -) - -// UnmarshalInstanceStatusReason unmarshals an instance of InstanceStatusReason from the specified map of raw messages. -func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceStatusReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplate : InstanceTemplate struct -// Models which "extend" this model: -// - InstanceTemplateInstanceByImageInstanceTemplateContext -// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext -// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext -type InstanceTemplate struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not - // subsequently managed. Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - // property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - // The metadata service configuration. - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this - // virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change - // in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network - // attachments or instance network interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` -} - -func (*InstanceTemplate) isaInstanceTemplate() bool { - return true -} - -type InstanceTemplateIntf interface { - isaInstanceTemplate() bool -} - -// UnmarshalInstanceTemplate unmarshals an instance of InstanceTemplate from the specified map of raw messages. -func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplate) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateCollection : InstanceTemplateCollection struct -type InstanceTemplateCollection struct { - // A link to the first page of resources. - First *InstanceTemplateCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *InstanceTemplateCollectionNext `json:"next,omitempty"` - - // Collection of instance templates. - Templates []InstanceTemplateIntf `json:"templates" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalInstanceTemplateCollection unmarshals an instance of InstanceTemplateCollection from the specified map of raw messages. -func UnmarshalInstanceTemplateCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceTemplateCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceTemplateCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "templates", &obj.Templates, UnmarshalInstanceTemplate) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateCollectionFirst : A link to the first page of resources. -type InstanceTemplateCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceTemplateCollectionFirst unmarshals an instance of InstanceTemplateCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceTemplateCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceTemplateCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceTemplateCollectionNext unmarshals an instance of InstanceTemplateCollectionNext from the specified map of raw messages. -func UnmarshalInstanceTemplateCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateIdentity : Identifies an instance template by a unique property. -// Models which "extend" this model: -// - InstanceTemplateIdentityByID -// - InstanceTemplateIdentityByHref -// - InstanceTemplateIdentityByCRN -type InstanceTemplateIdentity struct { - // The unique identifier for this instance template. - ID *string `json:"id,omitempty"` - - // The URL for this instance template. - Href *string `json:"href,omitempty"` - - // The CRN for this instance template. - CRN *string `json:"crn,omitempty"` -} - -func (*InstanceTemplateIdentity) isaInstanceTemplateIdentity() bool { - return true -} - -type InstanceTemplateIdentityIntf interface { - isaInstanceTemplateIdentity() bool -} - -// UnmarshalInstanceTemplateIdentity unmarshals an instance of InstanceTemplateIdentity from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePatch : InstanceTemplatePatch struct -type InstanceTemplatePatch struct { - // The name for this instance template. The name must not be used by another instance template in the region. - Name *string `json:"name,omitempty"` -} - -// UnmarshalInstanceTemplatePatch unmarshals an instance of InstanceTemplatePatch from the specified map of raw messages. -func UnmarshalInstanceTemplatePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the InstanceTemplatePatch -func (instanceTemplatePatch *InstanceTemplatePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceTemplatePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// InstanceTemplatePrototype : InstanceTemplatePrototype struct -// Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateByImage -// - InstanceTemplatePrototypeInstanceTemplateBySourceTemplate -// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot -// - InstanceTemplatePrototypeInstanceTemplateByCatalogOffering -type InstanceTemplatePrototype struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not - // subsequently managed. Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - // property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - // The metadata service configuration. - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this - // virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change - // in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network - // attachments or instance network interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering version to use when provisioning this virtual server instance. - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account, subject to - // IAM policies. - // - // If specified, `image` must not be specified, and `source_template` must not have - // `image` specified. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` - - // The template to create this virtual server instance from. - SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` -} - -func (*InstanceTemplatePrototype) isaInstanceTemplatePrototype() bool { - return true -} - -type InstanceTemplatePrototypeIntf interface { - isaInstanceTemplatePrototype() bool -} - -// UnmarshalInstanceTemplatePrototype unmarshals an instance of InstanceTemplatePrototype from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototype) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateReference : InstanceTemplateReference struct -type InstanceTemplateReference struct { - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceTemplateReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalInstanceTemplateReference unmarshals an instance of InstanceTemplateReference from the specified map of raw messages. -func UnmarshalInstanceTemplateReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceTemplateReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceTemplateReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceTemplateReferenceDeleted unmarshals an instance of InstanceTemplateReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceTemplateReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceVcpu : The virtual server instance VCPU configuration. -type InstanceVcpu struct { - // The VCPU architecture. - Architecture *string `json:"architecture" validate:"required"` - - // The number of VCPUs assigned. - Count *int64 `json:"count" validate:"required"` - - // The VCPU manufacturer. - Manufacturer *string `json:"manufacturer" validate:"required"` -} - -// UnmarshalInstanceVcpu unmarshals an instance of InstanceVcpu from the specified map of raw messages. -func UnmarshalInstanceVcpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceVcpu) - err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "count", &obj.Count) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Key : Key struct -type Key struct { - // The date and time that the key was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this key. - CRN *string `json:"crn" validate:"required"` - - // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always - // `SHA256`). - Fingerprint *string `json:"fingerprint" validate:"required"` - - // The URL for this key. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this key. - ID *string `json:"id" validate:"required"` - - // The length of this key (in bits). - Length *int64 `json:"length" validate:"required"` - - // The name for this key. The name must not be used by another key in the region. If unspecified, the name will be a - // hyphenated list of randomly-selected words. - Name *string `json:"name" validate:"required"` - - // The public SSH key, consisting of two space-separated fields: the algorithm name, and the base64-encoded key. - PublicKey *string `json:"public_key" validate:"required"` - - // The resource group for this key. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The crypto-system used by this key. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the Key.Type property. -// The crypto-system used by this key. -const ( - KeyTypeEd25519Const = "ed25519" - KeyTypeRsaConst = "rsa" -) - -// UnmarshalKey unmarshals an instance of Key from the specified map of raw messages. -func UnmarshalKey(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Key) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "length", &obj.Length) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "public_key", &obj.PublicKey) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyCollection : KeyCollection struct -type KeyCollection struct { - // A link to the first page of resources. - First *KeyCollectionFirst `json:"first" validate:"required"` - - // Collection of keys. - Keys []Key `json:"keys" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *KeyCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalKeyCollection unmarshals an instance of KeyCollection from the specified map of raw messages. -func UnmarshalKeyCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalKeyCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKey) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalKeyCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *KeyCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// KeyCollectionFirst : A link to the first page of resources. -type KeyCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalKeyCollectionFirst unmarshals an instance of KeyCollectionFirst from the specified map of raw messages. -func UnmarshalKeyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type KeyCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalKeyCollectionNext unmarshals an instance of KeyCollectionNext from the specified map of raw messages. -func UnmarshalKeyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyIdentity : Identifies a key by a unique property. -// Models which "extend" this model: -// - KeyIdentityByID -// - KeyIdentityByCRN -// - KeyIdentityByHref -// - KeyIdentityByFingerprint -type KeyIdentity struct { - // The unique identifier for this key. - ID *string `json:"id,omitempty"` - - // The CRN for this key. - CRN *string `json:"crn,omitempty"` - - // The URL for this key. - Href *string `json:"href,omitempty"` - - // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always - // `SHA256`). - Fingerprint *string `json:"fingerprint,omitempty"` -} - -func (*KeyIdentity) isaKeyIdentity() bool { - return true -} - -type KeyIdentityIntf interface { - isaKeyIdentity() bool -} - -// UnmarshalKeyIdentity unmarshals an instance of KeyIdentity from the specified map of raw messages. -func UnmarshalKeyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyPatch : KeyPatch struct -type KeyPatch struct { - // The name for this key. The name must not be used by another key in the region. - Name *string `json:"name,omitempty"` -} - -// UnmarshalKeyPatch unmarshals an instance of KeyPatch from the specified map of raw messages. -func UnmarshalKeyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the KeyPatch -func (keyPatch *KeyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(keyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// KeyReference : KeyReference struct -type KeyReference struct { - // The CRN for this key. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *KeyReferenceDeleted `json:"deleted,omitempty"` - - // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always - // `SHA256`). - Fingerprint *string `json:"fingerprint" validate:"required"` - - // The URL for this key. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this key. - ID *string `json:"id" validate:"required"` - - // The name for this key. The name is unique across all keys in the region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalKeyReference unmarshals an instance of KeyReference from the specified map of raw messages. -func UnmarshalKeyReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalKeyReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type KeyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalKeyReferenceDeleted unmarshals an instance of KeyReferenceDeleted from the specified map of raw messages. -func UnmarshalKeyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LegacyCloudObjectStorageBucketIdentity : Identifies a Cloud Object Storage bucket by a unique property. -// Models which "extend" this model: -// - LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName -type LegacyCloudObjectStorageBucketIdentity struct { - // The globally unique name of this Cloud Object Storage bucket. - Name *string `json:"name,omitempty"` -} - -func (*LegacyCloudObjectStorageBucketIdentity) isaLegacyCloudObjectStorageBucketIdentity() bool { - return true -} - -type LegacyCloudObjectStorageBucketIdentityIntf interface { - isaLegacyCloudObjectStorageBucketIdentity() bool -} - -// UnmarshalLegacyCloudObjectStorageBucketIdentity unmarshals an instance of LegacyCloudObjectStorageBucketIdentity from the specified map of raw messages. -func UnmarshalLegacyCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LegacyCloudObjectStorageBucketIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LegacyCloudObjectStorageBucketReference : LegacyCloudObjectStorageBucketReference struct -type LegacyCloudObjectStorageBucketReference struct { - // The globally unique name of this Cloud Object Storage bucket. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalLegacyCloudObjectStorageBucketReference unmarshals an instance of LegacyCloudObjectStorageBucketReference from the specified map of raw messages. -func UnmarshalLegacyCloudObjectStorageBucketReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LegacyCloudObjectStorageBucketReference) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ListBackupPoliciesOptions : The ListBackupPolicies options. -type ListBackupPoliciesOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // Filters the collection to resources with an item in the `tags` property matching the exact specified tag. - Tag *string `json:"tag,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListBackupPoliciesOptions : Instantiate ListBackupPoliciesOptions -func (*VpcV1) NewListBackupPoliciesOptions() *ListBackupPoliciesOptions { - return &ListBackupPoliciesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListBackupPoliciesOptions) SetStart(start string) *ListBackupPoliciesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListBackupPoliciesOptions) SetLimit(limit int64) *ListBackupPoliciesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListBackupPoliciesOptions) SetResourceGroupID(resourceGroupID string) *ListBackupPoliciesOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListBackupPoliciesOptions) SetName(name string) *ListBackupPoliciesOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetTag : Allow user to set Tag -func (_options *ListBackupPoliciesOptions) SetTag(tag string) *ListBackupPoliciesOptions { - _options.Tag = core.StringPtr(tag) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBackupPoliciesOptions) SetHeaders(param map[string]string) *ListBackupPoliciesOptions { - options.Headers = param - return options -} - -// ListBackupPolicyJobsOptions : The ListBackupPolicyJobs options. -type ListBackupPolicyJobsOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // Filters the collection to backup policy jobs with a `status` property matching the specified value. - Status *string `json:"status,omitempty"` - - // Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified - // identifier. - BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name - // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property - // in descending order, and the value `name` sorts it by the `name` property in ascending order. - Sort *string `json:"sort,omitempty"` - - // Filters the collection to backup policy jobs with a `source.id` property matching the specified identifier. - SourceID *string `json:"source.id,omitempty"` - - // Filters the collection to backup policy jobs with an item in the `target_snapshots` property with an `id` property - // matching the specified identifier. - TargetSnapshotsID *string `json:"target_snapshots[].id,omitempty"` - - // Filters the collection to backup policy jobs with an item in the `target_snapshots` property with a `crn` property - // matching the specified CRN. - TargetSnapshotsCRN *string `json:"target_snapshots[].crn,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListBackupPolicyJobsOptions.Status property. -// Filters the collection to backup policy jobs with a `status` property matching the specified value. -const ( - ListBackupPolicyJobsOptionsStatusFailedConst = "failed" - ListBackupPolicyJobsOptionsStatusRunningConst = "running" - ListBackupPolicyJobsOptionsStatusSucceededConst = "succeeded" -) - -// Constants associated with the ListBackupPolicyJobsOptions.Sort property. -// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name -// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property -// in descending order, and the value `name` sorts it by the `name` property in ascending order. -const ( - ListBackupPolicyJobsOptionsSortCreatedAtConst = "created_at" - ListBackupPolicyJobsOptionsSortNameConst = "name" -) - -// NewListBackupPolicyJobsOptions : Instantiate ListBackupPolicyJobsOptions -func (*VpcV1) NewListBackupPolicyJobsOptions(backupPolicyID string) *ListBackupPolicyJobsOptions { - return &ListBackupPolicyJobsOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *ListBackupPolicyJobsOptions) SetBackupPolicyID(backupPolicyID string) *ListBackupPolicyJobsOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetStatus : Allow user to set Status -func (_options *ListBackupPolicyJobsOptions) SetStatus(status string) *ListBackupPolicyJobsOptions { - _options.Status = core.StringPtr(status) - return _options -} - -// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID -func (_options *ListBackupPolicyJobsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListBackupPolicyJobsOptions { - _options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListBackupPolicyJobsOptions) SetStart(start string) *ListBackupPolicyJobsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListBackupPolicyJobsOptions) SetLimit(limit int64) *ListBackupPolicyJobsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListBackupPolicyJobsOptions) SetSort(sort string) *ListBackupPolicyJobsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetSourceID : Allow user to set SourceID -func (_options *ListBackupPolicyJobsOptions) SetSourceID(sourceID string) *ListBackupPolicyJobsOptions { - _options.SourceID = core.StringPtr(sourceID) - return _options -} - -// SetTargetSnapshotsID : Allow user to set TargetSnapshotsID -func (_options *ListBackupPolicyJobsOptions) SetTargetSnapshotsID(targetSnapshotsID string) *ListBackupPolicyJobsOptions { - _options.TargetSnapshotsID = core.StringPtr(targetSnapshotsID) - return _options -} - -// SetTargetSnapshotsCRN : Allow user to set TargetSnapshotsCRN -func (_options *ListBackupPolicyJobsOptions) SetTargetSnapshotsCRN(targetSnapshotsCRN string) *ListBackupPolicyJobsOptions { - _options.TargetSnapshotsCRN = core.StringPtr(targetSnapshotsCRN) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBackupPolicyJobsOptions) SetHeaders(param map[string]string) *ListBackupPolicyJobsOptions { - options.Headers = param - return options -} - -// ListBackupPolicyPlansOptions : The ListBackupPolicyPlans options. -type ListBackupPolicyPlansOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListBackupPolicyPlansOptions : Instantiate ListBackupPolicyPlansOptions -func (*VpcV1) NewListBackupPolicyPlansOptions(backupPolicyID string) *ListBackupPolicyPlansOptions { - return &ListBackupPolicyPlansOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *ListBackupPolicyPlansOptions) SetBackupPolicyID(backupPolicyID string) *ListBackupPolicyPlansOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListBackupPolicyPlansOptions) SetName(name string) *ListBackupPolicyPlansOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBackupPolicyPlansOptions) SetHeaders(param map[string]string) *ListBackupPolicyPlansOptions { - options.Headers = param - return options -} - -// ListBareMetalServerDisksOptions : The ListBareMetalServerDisks options. -type ListBareMetalServerDisksOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListBareMetalServerDisksOptions : Instantiate ListBareMetalServerDisksOptions -func (*VpcV1) NewListBareMetalServerDisksOptions(bareMetalServerID string) *ListBareMetalServerDisksOptions { - return &ListBareMetalServerDisksOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *ListBareMetalServerDisksOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerDisksOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServerDisksOptions) SetHeaders(param map[string]string) *ListBareMetalServerDisksOptions { - options.Headers = param - return options -} - -// ListBareMetalServerNetworkAttachmentsOptions : The ListBareMetalServerNetworkAttachments options. -type ListBareMetalServerNetworkAttachmentsOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListBareMetalServerNetworkAttachmentsOptions : Instantiate ListBareMetalServerNetworkAttachmentsOptions -func (*VpcV1) NewListBareMetalServerNetworkAttachmentsOptions(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions { - return &ListBareMetalServerNetworkAttachmentsOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetStart(start string) *ListBareMetalServerNetworkAttachmentsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetLimit(limit int64) *ListBareMetalServerNetworkAttachmentsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServerNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkAttachmentsOptions { - options.Headers = param - return options -} - -// ListBareMetalServerNetworkInterfaceFloatingIpsOptions : The ListBareMetalServerNetworkInterfaceFloatingIps options. -type ListBareMetalServerNetworkInterfaceFloatingIpsOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListBareMetalServerNetworkInterfaceFloatingIpsOptions : Instantiate ListBareMetalServerNetworkInterfaceFloatingIpsOptions -func (*VpcV1) NewListBareMetalServerNetworkInterfaceFloatingIpsOptions(bareMetalServerID string, networkInterfaceID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { - return &ListBareMetalServerNetworkInterfaceFloatingIpsOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { - options.Headers = param - return options -} - -// ListBareMetalServerNetworkInterfaceIpsOptions : The ListBareMetalServerNetworkInterfaceIps options. -type ListBareMetalServerNetworkInterfaceIpsOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListBareMetalServerNetworkInterfaceIpsOptions : Instantiate ListBareMetalServerNetworkInterfaceIpsOptions -func (*VpcV1) NewListBareMetalServerNetworkInterfaceIpsOptions(bareMetalServerID string, networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions { - return &ListBareMetalServerNetworkInterfaceIpsOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfaceIpsOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServerNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfaceIpsOptions { - options.Headers = param - return options -} - -// ListBareMetalServerNetworkInterfacesOptions : The ListBareMetalServerNetworkInterfaces options. -type ListBareMetalServerNetworkInterfacesOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListBareMetalServerNetworkInterfacesOptions : Instantiate ListBareMetalServerNetworkInterfacesOptions -func (*VpcV1) NewListBareMetalServerNetworkInterfacesOptions(bareMetalServerID string) *ListBareMetalServerNetworkInterfacesOptions { - return &ListBareMetalServerNetworkInterfacesOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *ListBareMetalServerNetworkInterfacesOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfacesOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListBareMetalServerNetworkInterfacesOptions) SetStart(start string) *ListBareMetalServerNetworkInterfacesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListBareMetalServerNetworkInterfacesOptions) SetLimit(limit int64) *ListBareMetalServerNetworkInterfacesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServerNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfacesOptions { - options.Headers = param - return options -} - -// ListBareMetalServerProfilesOptions : The ListBareMetalServerProfiles options. -type ListBareMetalServerProfilesOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListBareMetalServerProfilesOptions : Instantiate ListBareMetalServerProfilesOptions -func (*VpcV1) NewListBareMetalServerProfilesOptions() *ListBareMetalServerProfilesOptions { - return &ListBareMetalServerProfilesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListBareMetalServerProfilesOptions) SetStart(start string) *ListBareMetalServerProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListBareMetalServerProfilesOptions) SetLimit(limit int64) *ListBareMetalServerProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServerProfilesOptions) SetHeaders(param map[string]string) *ListBareMetalServerProfilesOptions { - options.Headers = param - return options -} - -// ListBareMetalServersOptions : The ListBareMetalServers options. -type ListBareMetalServersOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // Filters the collection to resources with a `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // Filters the collection to resources with a `vpc.name` property matching the exact specified name. - VPCName *string `json:"vpc.name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListBareMetalServersOptions : Instantiate ListBareMetalServersOptions -func (*VpcV1) NewListBareMetalServersOptions() *ListBareMetalServersOptions { - return &ListBareMetalServersOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListBareMetalServersOptions) SetStart(start string) *ListBareMetalServersOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListBareMetalServersOptions) SetLimit(limit int64) *ListBareMetalServersOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListBareMetalServersOptions) SetResourceGroupID(resourceGroupID string) *ListBareMetalServersOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListBareMetalServersOptions) SetName(name string) *ListBareMetalServersOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListBareMetalServersOptions) SetVPCID(vpcID string) *ListBareMetalServersOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListBareMetalServersOptions) SetVPCCRN(vpcCRN string) *ListBareMetalServersOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListBareMetalServersOptions) SetVPCName(vpcName string) *ListBareMetalServersOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServersOptions) SetHeaders(param map[string]string) *ListBareMetalServersOptions { - options.Headers = param - return options -} - -// ListDedicatedHostDisksOptions : The ListDedicatedHostDisks options. -type ListDedicatedHostDisksOptions struct { - // The dedicated host identifier. - DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListDedicatedHostDisksOptions : Instantiate ListDedicatedHostDisksOptions -func (*VpcV1) NewListDedicatedHostDisksOptions(dedicatedHostID string) *ListDedicatedHostDisksOptions { - return &ListDedicatedHostDisksOptions{ - DedicatedHostID: core.StringPtr(dedicatedHostID), - } -} - -// SetDedicatedHostID : Allow user to set DedicatedHostID -func (_options *ListDedicatedHostDisksOptions) SetDedicatedHostID(dedicatedHostID string) *ListDedicatedHostDisksOptions { - _options.DedicatedHostID = core.StringPtr(dedicatedHostID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListDedicatedHostDisksOptions) SetHeaders(param map[string]string) *ListDedicatedHostDisksOptions { - options.Headers = param - return options -} - -// ListDedicatedHostGroupsOptions : The ListDedicatedHostGroups options. -type ListDedicatedHostGroupsOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Filters the collection to resources with a `zone.name` property matching the exact specified name. - ZoneName *string `json:"zone.name,omitempty"` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListDedicatedHostGroupsOptions : Instantiate ListDedicatedHostGroupsOptions -func (*VpcV1) NewListDedicatedHostGroupsOptions() *ListDedicatedHostGroupsOptions { - return &ListDedicatedHostGroupsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListDedicatedHostGroupsOptions) SetStart(start string) *ListDedicatedHostGroupsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListDedicatedHostGroupsOptions) SetLimit(limit int64) *ListDedicatedHostGroupsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListDedicatedHostGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListDedicatedHostGroupsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *ListDedicatedHostGroupsOptions) SetZoneName(zoneName string) *ListDedicatedHostGroupsOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListDedicatedHostGroupsOptions) SetName(name string) *ListDedicatedHostGroupsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListDedicatedHostGroupsOptions) SetHeaders(param map[string]string) *ListDedicatedHostGroupsOptions { - options.Headers = param - return options -} - -// ListDedicatedHostProfilesOptions : The ListDedicatedHostProfiles options. -type ListDedicatedHostProfilesOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListDedicatedHostProfilesOptions : Instantiate ListDedicatedHostProfilesOptions -func (*VpcV1) NewListDedicatedHostProfilesOptions() *ListDedicatedHostProfilesOptions { - return &ListDedicatedHostProfilesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListDedicatedHostProfilesOptions) SetStart(start string) *ListDedicatedHostProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListDedicatedHostProfilesOptions) SetLimit(limit int64) *ListDedicatedHostProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListDedicatedHostProfilesOptions) SetHeaders(param map[string]string) *ListDedicatedHostProfilesOptions { - options.Headers = param - return options -} - -// ListDedicatedHostsOptions : The ListDedicatedHosts options. -type ListDedicatedHostsOptions struct { - // Filters the collection to dedicated hosts with a `group.id` property matching the specified identifier. - DedicatedHostGroupID *string `json:"dedicated_host_group.id,omitempty"` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Filters the collection to resources with a `zone.name` property matching the exact specified name. - ZoneName *string `json:"zone.name,omitempty"` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListDedicatedHostsOptions : Instantiate ListDedicatedHostsOptions -func (*VpcV1) NewListDedicatedHostsOptions() *ListDedicatedHostsOptions { - return &ListDedicatedHostsOptions{} -} - -// SetDedicatedHostGroupID : Allow user to set DedicatedHostGroupID -func (_options *ListDedicatedHostsOptions) SetDedicatedHostGroupID(dedicatedHostGroupID string) *ListDedicatedHostsOptions { - _options.DedicatedHostGroupID = core.StringPtr(dedicatedHostGroupID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListDedicatedHostsOptions) SetStart(start string) *ListDedicatedHostsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListDedicatedHostsOptions) SetLimit(limit int64) *ListDedicatedHostsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListDedicatedHostsOptions) SetResourceGroupID(resourceGroupID string) *ListDedicatedHostsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *ListDedicatedHostsOptions) SetZoneName(zoneName string) *ListDedicatedHostsOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListDedicatedHostsOptions) SetName(name string) *ListDedicatedHostsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListDedicatedHostsOptions) SetHeaders(param map[string]string) *ListDedicatedHostsOptions { - options.Headers = param - return options -} - -// ListEndpointGatewayIpsOptions : The ListEndpointGatewayIps options. -type ListEndpointGatewayIpsOptions struct { - // The endpoint gateway identifier. - EndpointGatewayID *string `json:"endpoint_gateway_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name - // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property - // in descending order, and the value `name` sorts it by the `name` property in ascending order. - Sort *string `json:"sort,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListEndpointGatewayIpsOptions.Sort property. -// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name -// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property -// in descending order, and the value `name` sorts it by the `name` property in ascending order. -const ( - ListEndpointGatewayIpsOptionsSortAddressConst = "address" - ListEndpointGatewayIpsOptionsSortCreatedAtConst = "created_at" - ListEndpointGatewayIpsOptionsSortNameConst = "name" -) - -// NewListEndpointGatewayIpsOptions : Instantiate ListEndpointGatewayIpsOptions -func (*VpcV1) NewListEndpointGatewayIpsOptions(endpointGatewayID string) *ListEndpointGatewayIpsOptions { - return &ListEndpointGatewayIpsOptions{ - EndpointGatewayID: core.StringPtr(endpointGatewayID), - } -} - -// SetEndpointGatewayID : Allow user to set EndpointGatewayID -func (_options *ListEndpointGatewayIpsOptions) SetEndpointGatewayID(endpointGatewayID string) *ListEndpointGatewayIpsOptions { - _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListEndpointGatewayIpsOptions) SetStart(start string) *ListEndpointGatewayIpsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListEndpointGatewayIpsOptions) SetLimit(limit int64) *ListEndpointGatewayIpsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListEndpointGatewayIpsOptions) SetSort(sort string) *ListEndpointGatewayIpsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListEndpointGatewayIpsOptions) SetHeaders(param map[string]string) *ListEndpointGatewayIpsOptions { - options.Headers = param - return options -} - -// ListEndpointGatewaysOptions : The ListEndpointGateways options. -type ListEndpointGatewaysOptions struct { - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Filters the collection to resources with a `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // Filters the collection to resources with a `vpc.name` property matching the exact specified name. - VPCName *string `json:"vpc.name,omitempty"` - - // Filters the collection to endpoint gateways with an `allow_dns_resolution_binding` property matching the specified - // value. - AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListEndpointGatewaysOptions : Instantiate ListEndpointGatewaysOptions -func (*VpcV1) NewListEndpointGatewaysOptions() *ListEndpointGatewaysOptions { - return &ListEndpointGatewaysOptions{} -} - -// SetName : Allow user to set Name -func (_options *ListEndpointGatewaysOptions) SetName(name string) *ListEndpointGatewaysOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListEndpointGatewaysOptions) SetStart(start string) *ListEndpointGatewaysOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListEndpointGatewaysOptions) SetLimit(limit int64) *ListEndpointGatewaysOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListEndpointGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListEndpointGatewaysOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListEndpointGatewaysOptions) SetVPCID(vpcID string) *ListEndpointGatewaysOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListEndpointGatewaysOptions) SetVPCCRN(vpcCRN string) *ListEndpointGatewaysOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListEndpointGatewaysOptions) SetVPCName(vpcName string) *ListEndpointGatewaysOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - -// SetAllowDnsResolutionBinding : Allow user to set AllowDnsResolutionBinding -func (_options *ListEndpointGatewaysOptions) SetAllowDnsResolutionBinding(allowDnsResolutionBinding bool) *ListEndpointGatewaysOptions { - _options.AllowDnsResolutionBinding = core.BoolPtr(allowDnsResolutionBinding) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListEndpointGatewaysOptions) SetHeaders(param map[string]string) *ListEndpointGatewaysOptions { - options.Headers = param - return options -} - -// ListFloatingIpsOptions : The ListFloatingIps options. -type ListFloatingIpsOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name - // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property - // in descending order, and the value `name` sorts it by the `name` property in ascending order. - Sort *string `json:"sort,omitempty"` - - // Filters the collection to resources with a `target.id` property matching the specified identifier. - TargetID *string `json:"target.id,omitempty"` - - // Filters the collection to resources with a `target.crn` property matching the specified CRN. - TargetCRN *string `json:"target.crn,omitempty"` - - // Filters the collection to resources with a `target.name` property matching the exact specified name. - TargetName *string `json:"target.name,omitempty"` - - // Filters the collection to resources with a `target.resource_type` property matching the specified value. - TargetResourceType *string `json:"target.resource_type,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListFloatingIpsOptions.Sort property. -// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name -// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property -// in descending order, and the value `name` sorts it by the `name` property in ascending order. -const ( - ListFloatingIpsOptionsSortCreatedAtConst = "created_at" - ListFloatingIpsOptionsSortNameConst = "name" -) - -// NewListFloatingIpsOptions : Instantiate ListFloatingIpsOptions -func (*VpcV1) NewListFloatingIpsOptions() *ListFloatingIpsOptions { - return &ListFloatingIpsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListFloatingIpsOptions) SetStart(start string) *ListFloatingIpsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListFloatingIpsOptions) SetLimit(limit int64) *ListFloatingIpsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListFloatingIpsOptions) SetResourceGroupID(resourceGroupID string) *ListFloatingIpsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListFloatingIpsOptions) SetSort(sort string) *ListFloatingIpsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetTargetID : Allow user to set TargetID -func (_options *ListFloatingIpsOptions) SetTargetID(targetID string) *ListFloatingIpsOptions { - _options.TargetID = core.StringPtr(targetID) - return _options -} - -// SetTargetCRN : Allow user to set TargetCRN -func (_options *ListFloatingIpsOptions) SetTargetCRN(targetCRN string) *ListFloatingIpsOptions { - _options.TargetCRN = core.StringPtr(targetCRN) - return _options -} - -// SetTargetName : Allow user to set TargetName -func (_options *ListFloatingIpsOptions) SetTargetName(targetName string) *ListFloatingIpsOptions { - _options.TargetName = core.StringPtr(targetName) - return _options -} - -// SetTargetResourceType : Allow user to set TargetResourceType -func (_options *ListFloatingIpsOptions) SetTargetResourceType(targetResourceType string) *ListFloatingIpsOptions { - _options.TargetResourceType = core.StringPtr(targetResourceType) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListFloatingIpsOptions) SetHeaders(param map[string]string) *ListFloatingIpsOptions { - options.Headers = param - return options -} - -// ListFlowLogCollectorsOptions : The ListFlowLogCollectors options. -type ListFlowLogCollectorsOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // Filters the collection to resources with a `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // Filters the collection to resources with a `vpc.name` property matching the exact specified name. - VPCName *string `json:"vpc.name,omitempty"` - - // Filters the collection to resources with a `target.id` property matching the specified identifier. - TargetID *string `json:"target.id,omitempty"` - - // Filters the collection to resources with a `target.resource_type` property matching the specified value. - TargetResourceType *string `json:"target.resource_type,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListFlowLogCollectorsOptions : Instantiate ListFlowLogCollectorsOptions -func (*VpcV1) NewListFlowLogCollectorsOptions() *ListFlowLogCollectorsOptions { - return &ListFlowLogCollectorsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListFlowLogCollectorsOptions) SetStart(start string) *ListFlowLogCollectorsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListFlowLogCollectorsOptions) SetLimit(limit int64) *ListFlowLogCollectorsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListFlowLogCollectorsOptions) SetResourceGroupID(resourceGroupID string) *ListFlowLogCollectorsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListFlowLogCollectorsOptions) SetName(name string) *ListFlowLogCollectorsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListFlowLogCollectorsOptions) SetVPCID(vpcID string) *ListFlowLogCollectorsOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListFlowLogCollectorsOptions) SetVPCCRN(vpcCRN string) *ListFlowLogCollectorsOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListFlowLogCollectorsOptions) SetVPCName(vpcName string) *ListFlowLogCollectorsOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - -// SetTargetID : Allow user to set TargetID -func (_options *ListFlowLogCollectorsOptions) SetTargetID(targetID string) *ListFlowLogCollectorsOptions { - _options.TargetID = core.StringPtr(targetID) - return _options -} - -// SetTargetResourceType : Allow user to set TargetResourceType -func (_options *ListFlowLogCollectorsOptions) SetTargetResourceType(targetResourceType string) *ListFlowLogCollectorsOptions { - _options.TargetResourceType = core.StringPtr(targetResourceType) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListFlowLogCollectorsOptions) SetHeaders(param map[string]string) *ListFlowLogCollectorsOptions { - options.Headers = param - return options -} - -// ListIkePoliciesOptions : The ListIkePolicies options. -type ListIkePoliciesOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListIkePoliciesOptions : Instantiate ListIkePoliciesOptions -func (*VpcV1) NewListIkePoliciesOptions() *ListIkePoliciesOptions { - return &ListIkePoliciesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListIkePoliciesOptions) SetStart(start string) *ListIkePoliciesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListIkePoliciesOptions) SetLimit(limit int64) *ListIkePoliciesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListIkePoliciesOptions) SetHeaders(param map[string]string) *ListIkePoliciesOptions { - options.Headers = param - return options -} - -// ListIkePolicyConnectionsOptions : The ListIkePolicyConnections options. -type ListIkePolicyConnectionsOptions struct { - // The IKE policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListIkePolicyConnectionsOptions : Instantiate ListIkePolicyConnectionsOptions -func (*VpcV1) NewListIkePolicyConnectionsOptions(id string) *ListIkePolicyConnectionsOptions { - return &ListIkePolicyConnectionsOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *ListIkePolicyConnectionsOptions) SetID(id string) *ListIkePolicyConnectionsOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListIkePolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIkePolicyConnectionsOptions { - options.Headers = param - return options -} - -// ListImageExportJobsOptions : The ListImageExportJobs options. -type ListImageExportJobsOptions struct { - // The image identifier. - ImageID *string `json:"image_id" validate:"required,ne="` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListImageExportJobsOptions : Instantiate ListImageExportJobsOptions -func (*VpcV1) NewListImageExportJobsOptions(imageID string) *ListImageExportJobsOptions { - return &ListImageExportJobsOptions{ - ImageID: core.StringPtr(imageID), - } -} - -// SetImageID : Allow user to set ImageID -func (_options *ListImageExportJobsOptions) SetImageID(imageID string) *ListImageExportJobsOptions { - _options.ImageID = core.StringPtr(imageID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListImageExportJobsOptions) SetName(name string) *ListImageExportJobsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListImageExportJobsOptions) SetHeaders(param map[string]string) *ListImageExportJobsOptions { - options.Headers = param - return options -} - -// ListImagesOptions : The ListImages options. -type ListImagesOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // Filters the collection to images with a `status` property matching one of the specified comma-separated values. - Status []string `json:"status,omitempty"` - - // Filters the collection to images with a `visibility` property matching the specified value. - Visibility *string `json:"visibility,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListImagesOptions.Status property. -const ( - ListImagesOptionsStatusAvailableConst = "available" - ListImagesOptionsStatusDeletingConst = "deleting" - ListImagesOptionsStatusDeprecatedConst = "deprecated" - ListImagesOptionsStatusFailedConst = "failed" - ListImagesOptionsStatusObsoleteConst = "obsolete" - ListImagesOptionsStatusPendingConst = "pending" - ListImagesOptionsStatusUnusableConst = "unusable" -) - -// Constants associated with the ListImagesOptions.Visibility property. -// Filters the collection to images with a `visibility` property matching the specified value. -const ( - ListImagesOptionsVisibilityPrivateConst = "private" - ListImagesOptionsVisibilityPublicConst = "public" -) - -// NewListImagesOptions : Instantiate ListImagesOptions -func (*VpcV1) NewListImagesOptions() *ListImagesOptions { - return &ListImagesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListImagesOptions) SetStart(start string) *ListImagesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListImagesOptions) SetLimit(limit int64) *ListImagesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListImagesOptions) SetResourceGroupID(resourceGroupID string) *ListImagesOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListImagesOptions) SetName(name string) *ListImagesOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetStatus : Allow user to set Status -func (_options *ListImagesOptions) SetStatus(status []string) *ListImagesOptions { - _options.Status = status - return _options -} - -// SetVisibility : Allow user to set Visibility -func (_options *ListImagesOptions) SetVisibility(visibility string) *ListImagesOptions { - _options.Visibility = core.StringPtr(visibility) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListImagesOptions) SetHeaders(param map[string]string) *ListImagesOptions { - options.Headers = param - return options -} - -// ListInstanceDisksOptions : The ListInstanceDisks options. -type ListInstanceDisksOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceDisksOptions : Instantiate ListInstanceDisksOptions -func (*VpcV1) NewListInstanceDisksOptions(instanceID string) *ListInstanceDisksOptions { - return &ListInstanceDisksOptions{ - InstanceID: core.StringPtr(instanceID), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *ListInstanceDisksOptions) SetInstanceID(instanceID string) *ListInstanceDisksOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceDisksOptions) SetHeaders(param map[string]string) *ListInstanceDisksOptions { - options.Headers = param - return options -} - -// ListInstanceGroupManagerActionsOptions : The ListInstanceGroupManagerActions options. -type ListInstanceGroupManagerActionsOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceGroupManagerActionsOptions : Instantiate ListInstanceGroupManagerActionsOptions -func (*VpcV1) NewListInstanceGroupManagerActionsOptions(instanceGroupID string, instanceGroupManagerID string) *ListInstanceGroupManagerActionsOptions { - return &ListInstanceGroupManagerActionsOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *ListInstanceGroupManagerActionsOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagerActionsOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *ListInstanceGroupManagerActionsOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *ListInstanceGroupManagerActionsOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListInstanceGroupManagerActionsOptions) SetStart(start string) *ListInstanceGroupManagerActionsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstanceGroupManagerActionsOptions) SetLimit(limit int64) *ListInstanceGroupManagerActionsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceGroupManagerActionsOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagerActionsOptions { - options.Headers = param - return options -} - -// ListInstanceGroupManagerPoliciesOptions : The ListInstanceGroupManagerPolicies options. -type ListInstanceGroupManagerPoliciesOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceGroupManagerPoliciesOptions : Instantiate ListInstanceGroupManagerPoliciesOptions -func (*VpcV1) NewListInstanceGroupManagerPoliciesOptions(instanceGroupID string, instanceGroupManagerID string) *ListInstanceGroupManagerPoliciesOptions { - return &ListInstanceGroupManagerPoliciesOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *ListInstanceGroupManagerPoliciesOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagerPoliciesOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *ListInstanceGroupManagerPoliciesOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *ListInstanceGroupManagerPoliciesOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListInstanceGroupManagerPoliciesOptions) SetStart(start string) *ListInstanceGroupManagerPoliciesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstanceGroupManagerPoliciesOptions) SetLimit(limit int64) *ListInstanceGroupManagerPoliciesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceGroupManagerPoliciesOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagerPoliciesOptions { - options.Headers = param - return options -} - -// ListInstanceGroupManagersOptions : The ListInstanceGroupManagers options. -type ListInstanceGroupManagersOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceGroupManagersOptions : Instantiate ListInstanceGroupManagersOptions -func (*VpcV1) NewListInstanceGroupManagersOptions(instanceGroupID string) *ListInstanceGroupManagersOptions { - return &ListInstanceGroupManagersOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *ListInstanceGroupManagersOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagersOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListInstanceGroupManagersOptions) SetStart(start string) *ListInstanceGroupManagersOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstanceGroupManagersOptions) SetLimit(limit int64) *ListInstanceGroupManagersOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceGroupManagersOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagersOptions { - options.Headers = param - return options -} - -// ListInstanceGroupMembershipsOptions : The ListInstanceGroupMemberships options. -type ListInstanceGroupMembershipsOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceGroupMembershipsOptions : Instantiate ListInstanceGroupMembershipsOptions -func (*VpcV1) NewListInstanceGroupMembershipsOptions(instanceGroupID string) *ListInstanceGroupMembershipsOptions { - return &ListInstanceGroupMembershipsOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *ListInstanceGroupMembershipsOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupMembershipsOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListInstanceGroupMembershipsOptions) SetStart(start string) *ListInstanceGroupMembershipsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstanceGroupMembershipsOptions) SetLimit(limit int64) *ListInstanceGroupMembershipsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceGroupMembershipsOptions) SetHeaders(param map[string]string) *ListInstanceGroupMembershipsOptions { - options.Headers = param - return options -} - -// ListInstanceGroupsOptions : The ListInstanceGroups options. -type ListInstanceGroupsOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceGroupsOptions : Instantiate ListInstanceGroupsOptions -func (*VpcV1) NewListInstanceGroupsOptions() *ListInstanceGroupsOptions { - return &ListInstanceGroupsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListInstanceGroupsOptions) SetStart(start string) *ListInstanceGroupsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstanceGroupsOptions) SetLimit(limit int64) *ListInstanceGroupsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceGroupsOptions) SetHeaders(param map[string]string) *ListInstanceGroupsOptions { - options.Headers = param - return options -} - -// ListInstanceNetworkAttachmentsOptions : The ListInstanceNetworkAttachments options. -type ListInstanceNetworkAttachmentsOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceNetworkAttachmentsOptions : Instantiate ListInstanceNetworkAttachmentsOptions -func (*VpcV1) NewListInstanceNetworkAttachmentsOptions(instanceID string) *ListInstanceNetworkAttachmentsOptions { - return &ListInstanceNetworkAttachmentsOptions{ - InstanceID: core.StringPtr(instanceID), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *ListInstanceNetworkAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkAttachmentsOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkAttachmentsOptions { - options.Headers = param - return options -} - -// ListInstanceNetworkInterfaceFloatingIpsOptions : The ListInstanceNetworkInterfaceFloatingIps options. -type ListInstanceNetworkInterfaceFloatingIpsOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceNetworkInterfaceFloatingIpsOptions : Instantiate ListInstanceNetworkInterfaceFloatingIpsOptions -func (*VpcV1) NewListInstanceNetworkInterfaceFloatingIpsOptions(instanceID string, networkInterfaceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { - return &ListInstanceNetworkInterfaceFloatingIpsOptions{ - InstanceID: core.StringPtr(instanceID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfaceFloatingIpsOptions { - options.Headers = param - return options -} - -// ListInstanceNetworkInterfaceIpsOptions : The ListInstanceNetworkInterfaceIps options. -type ListInstanceNetworkInterfaceIpsOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceNetworkInterfaceIpsOptions : Instantiate ListInstanceNetworkInterfaceIpsOptions -func (*VpcV1) NewListInstanceNetworkInterfaceIpsOptions(instanceID string, networkInterfaceID string) *ListInstanceNetworkInterfaceIpsOptions { - return &ListInstanceNetworkInterfaceIpsOptions{ - InstanceID: core.StringPtr(instanceID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *ListInstanceNetworkInterfaceIpsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfaceIpsOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *ListInstanceNetworkInterfaceIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListInstanceNetworkInterfaceIpsOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListInstanceNetworkInterfaceIpsOptions) SetStart(start string) *ListInstanceNetworkInterfaceIpsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstanceNetworkInterfaceIpsOptions) SetLimit(limit int64) *ListInstanceNetworkInterfaceIpsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfaceIpsOptions { - options.Headers = param - return options -} - -// ListInstanceNetworkInterfacesOptions : The ListInstanceNetworkInterfaces options. -type ListInstanceNetworkInterfacesOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceNetworkInterfacesOptions : Instantiate ListInstanceNetworkInterfacesOptions -func (*VpcV1) NewListInstanceNetworkInterfacesOptions(instanceID string) *ListInstanceNetworkInterfacesOptions { - return &ListInstanceNetworkInterfacesOptions{ - InstanceID: core.StringPtr(instanceID), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *ListInstanceNetworkInterfacesOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfacesOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfacesOptions { - options.Headers = param - return options -} - -// ListInstanceProfilesOptions : The ListInstanceProfiles options. -type ListInstanceProfilesOptions struct { - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceProfilesOptions : Instantiate ListInstanceProfilesOptions -func (*VpcV1) NewListInstanceProfilesOptions() *ListInstanceProfilesOptions { - return &ListInstanceProfilesOptions{} -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceProfilesOptions) SetHeaders(param map[string]string) *ListInstanceProfilesOptions { - options.Headers = param - return options -} - -// ListInstanceTemplatesOptions : The ListInstanceTemplates options. -type ListInstanceTemplatesOptions struct { - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceTemplatesOptions : Instantiate ListInstanceTemplatesOptions -func (*VpcV1) NewListInstanceTemplatesOptions() *ListInstanceTemplatesOptions { - return &ListInstanceTemplatesOptions{} -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceTemplatesOptions) SetHeaders(param map[string]string) *ListInstanceTemplatesOptions { - options.Headers = param - return options -} - -// ListInstanceVolumeAttachmentsOptions : The ListInstanceVolumeAttachments options. -type ListInstanceVolumeAttachmentsOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceVolumeAttachmentsOptions : Instantiate ListInstanceVolumeAttachmentsOptions -func (*VpcV1) NewListInstanceVolumeAttachmentsOptions(instanceID string) *ListInstanceVolumeAttachmentsOptions { - return &ListInstanceVolumeAttachmentsOptions{ - InstanceID: core.StringPtr(instanceID), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *ListInstanceVolumeAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceVolumeAttachmentsOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceVolumeAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceVolumeAttachmentsOptions { - options.Headers = param - return options -} - -// ListInstancesOptions : The ListInstances options. -type ListInstancesOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // Filters the collection to resources with a `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // Filters the collection to resources with a `vpc.name` property matching the exact specified name. - VPCName *string `json:"vpc.name,omitempty"` - - // Filters the collection to instances with a `dedicated_host.id` property matching the specified identifier. - DedicatedHostID *string `json:"dedicated_host.id,omitempty"` - - // Filters the collection to instances with a `dedicated_host.crn` property matching the specified CRN. - DedicatedHostCRN *string `json:"dedicated_host.crn,omitempty"` - - // Filters the collection to instances with a `dedicated_host.name` property matching the exact specified name. - DedicatedHostName *string `json:"dedicated_host.name,omitempty"` - - // Filters the collection to instances with a `placement_target.id` property matching the specified placement group - // identifier. - PlacementGroupID *string `json:"placement_group.id,omitempty"` - - // Filters the collection to instances with a `placement_target.crn` property matching the specified placement group - // CRN. - PlacementGroupCRN *string `json:"placement_group.crn,omitempty"` - - // Filters the collection to instances with a `placement_target.name` property matching the exact specified placement - // group name. - PlacementGroupName *string `json:"placement_group.name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstancesOptions : Instantiate ListInstancesOptions -func (*VpcV1) NewListInstancesOptions() *ListInstancesOptions { - return &ListInstancesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListInstancesOptions) SetStart(start string) *ListInstancesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstancesOptions) SetLimit(limit int64) *ListInstancesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListInstancesOptions) SetResourceGroupID(resourceGroupID string) *ListInstancesOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListInstancesOptions) SetName(name string) *ListInstancesOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListInstancesOptions) SetVPCID(vpcID string) *ListInstancesOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListInstancesOptions) SetVPCCRN(vpcCRN string) *ListInstancesOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListInstancesOptions) SetVPCName(vpcName string) *ListInstancesOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - -// SetDedicatedHostID : Allow user to set DedicatedHostID -func (_options *ListInstancesOptions) SetDedicatedHostID(dedicatedHostID string) *ListInstancesOptions { - _options.DedicatedHostID = core.StringPtr(dedicatedHostID) - return _options -} - -// SetDedicatedHostCRN : Allow user to set DedicatedHostCRN -func (_options *ListInstancesOptions) SetDedicatedHostCRN(dedicatedHostCRN string) *ListInstancesOptions { - _options.DedicatedHostCRN = core.StringPtr(dedicatedHostCRN) - return _options -} - -// SetDedicatedHostName : Allow user to set DedicatedHostName -func (_options *ListInstancesOptions) SetDedicatedHostName(dedicatedHostName string) *ListInstancesOptions { - _options.DedicatedHostName = core.StringPtr(dedicatedHostName) - return _options -} - -// SetPlacementGroupID : Allow user to set PlacementGroupID -func (_options *ListInstancesOptions) SetPlacementGroupID(placementGroupID string) *ListInstancesOptions { - _options.PlacementGroupID = core.StringPtr(placementGroupID) - return _options -} - -// SetPlacementGroupCRN : Allow user to set PlacementGroupCRN -func (_options *ListInstancesOptions) SetPlacementGroupCRN(placementGroupCRN string) *ListInstancesOptions { - _options.PlacementGroupCRN = core.StringPtr(placementGroupCRN) - return _options -} - -// SetPlacementGroupName : Allow user to set PlacementGroupName -func (_options *ListInstancesOptions) SetPlacementGroupName(placementGroupName string) *ListInstancesOptions { - _options.PlacementGroupName = core.StringPtr(placementGroupName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstancesOptions) SetHeaders(param map[string]string) *ListInstancesOptions { - options.Headers = param - return options -} - -// ListIpsecPoliciesOptions : The ListIpsecPolicies options. -type ListIpsecPoliciesOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListIpsecPoliciesOptions : Instantiate ListIpsecPoliciesOptions -func (*VpcV1) NewListIpsecPoliciesOptions() *ListIpsecPoliciesOptions { - return &ListIpsecPoliciesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListIpsecPoliciesOptions) SetStart(start string) *ListIpsecPoliciesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListIpsecPoliciesOptions) SetLimit(limit int64) *ListIpsecPoliciesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListIpsecPoliciesOptions) SetHeaders(param map[string]string) *ListIpsecPoliciesOptions { - options.Headers = param - return options -} - -// ListIpsecPolicyConnectionsOptions : The ListIpsecPolicyConnections options. -type ListIpsecPolicyConnectionsOptions struct { - // The IPsec policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListIpsecPolicyConnectionsOptions : Instantiate ListIpsecPolicyConnectionsOptions -func (*VpcV1) NewListIpsecPolicyConnectionsOptions(id string) *ListIpsecPolicyConnectionsOptions { - return &ListIpsecPolicyConnectionsOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *ListIpsecPolicyConnectionsOptions) SetID(id string) *ListIpsecPolicyConnectionsOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListIpsecPolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIpsecPolicyConnectionsOptions { - options.Headers = param - return options -} - -// ListKeysOptions : The ListKeys options. -type ListKeysOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListKeysOptions : Instantiate ListKeysOptions -func (*VpcV1) NewListKeysOptions() *ListKeysOptions { - return &ListKeysOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListKeysOptions) SetStart(start string) *ListKeysOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListKeysOptions) SetLimit(limit int64) *ListKeysOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListKeysOptions) SetHeaders(param map[string]string) *ListKeysOptions { - options.Headers = param - return options -} - -// ListLoadBalancerListenerPoliciesOptions : The ListLoadBalancerListenerPolicies options. -type ListLoadBalancerListenerPoliciesOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListLoadBalancerListenerPoliciesOptions : Instantiate ListLoadBalancerListenerPoliciesOptions -func (*VpcV1) NewListLoadBalancerListenerPoliciesOptions(loadBalancerID string, listenerID string) *ListLoadBalancerListenerPoliciesOptions { - return &ListLoadBalancerListenerPoliciesOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *ListLoadBalancerListenerPoliciesOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenerPoliciesOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *ListLoadBalancerListenerPoliciesOptions) SetListenerID(listenerID string) *ListLoadBalancerListenerPoliciesOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancerListenerPoliciesOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenerPoliciesOptions { - options.Headers = param - return options -} - -// ListLoadBalancerListenerPolicyRulesOptions : The ListLoadBalancerListenerPolicyRules options. -type ListLoadBalancerListenerPolicyRulesOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - PolicyID *string `json:"policy_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListLoadBalancerListenerPolicyRulesOptions : Instantiate ListLoadBalancerListenerPolicyRulesOptions -func (*VpcV1) NewListLoadBalancerListenerPolicyRulesOptions(loadBalancerID string, listenerID string, policyID string) *ListLoadBalancerListenerPolicyRulesOptions { - return &ListLoadBalancerListenerPolicyRulesOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - PolicyID: core.StringPtr(policyID), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenerPolicyRulesOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetListenerID(listenerID string) *ListLoadBalancerListenerPolicyRulesOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetPolicyID : Allow user to set PolicyID -func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetPolicyID(policyID string) *ListLoadBalancerListenerPolicyRulesOptions { - _options.PolicyID = core.StringPtr(policyID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancerListenerPolicyRulesOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenerPolicyRulesOptions { - options.Headers = param - return options -} - -// ListLoadBalancerListenersOptions : The ListLoadBalancerListeners options. -type ListLoadBalancerListenersOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListLoadBalancerListenersOptions : Instantiate ListLoadBalancerListenersOptions -func (*VpcV1) NewListLoadBalancerListenersOptions(loadBalancerID string) *ListLoadBalancerListenersOptions { - return &ListLoadBalancerListenersOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *ListLoadBalancerListenersOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenersOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancerListenersOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenersOptions { - options.Headers = param - return options -} - -// ListLoadBalancerPoolMembersOptions : The ListLoadBalancerPoolMembers options. -type ListLoadBalancerPoolMembersOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - PoolID *string `json:"pool_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListLoadBalancerPoolMembersOptions : Instantiate ListLoadBalancerPoolMembersOptions -func (*VpcV1) NewListLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string) *ListLoadBalancerPoolMembersOptions { - return &ListLoadBalancerPoolMembersOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - PoolID: core.StringPtr(poolID), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *ListLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerPoolMembersOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetPoolID : Allow user to set PoolID -func (_options *ListLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ListLoadBalancerPoolMembersOptions { - _options.PoolID = core.StringPtr(poolID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ListLoadBalancerPoolMembersOptions { - options.Headers = param - return options -} - -// ListLoadBalancerPoolsOptions : The ListLoadBalancerPools options. -type ListLoadBalancerPoolsOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListLoadBalancerPoolsOptions : Instantiate ListLoadBalancerPoolsOptions -func (*VpcV1) NewListLoadBalancerPoolsOptions(loadBalancerID string) *ListLoadBalancerPoolsOptions { - return &ListLoadBalancerPoolsOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *ListLoadBalancerPoolsOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerPoolsOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancerPoolsOptions) SetHeaders(param map[string]string) *ListLoadBalancerPoolsOptions { - options.Headers = param - return options -} - -// ListLoadBalancerProfilesOptions : The ListLoadBalancerProfiles options. -type ListLoadBalancerProfilesOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListLoadBalancerProfilesOptions : Instantiate ListLoadBalancerProfilesOptions -func (*VpcV1) NewListLoadBalancerProfilesOptions() *ListLoadBalancerProfilesOptions { - return &ListLoadBalancerProfilesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListLoadBalancerProfilesOptions) SetStart(start string) *ListLoadBalancerProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListLoadBalancerProfilesOptions) SetLimit(limit int64) *ListLoadBalancerProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancerProfilesOptions) SetHeaders(param map[string]string) *ListLoadBalancerProfilesOptions { - options.Headers = param - return options -} - -// ListLoadBalancersOptions : The ListLoadBalancers options. -type ListLoadBalancersOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListLoadBalancersOptions : Instantiate ListLoadBalancersOptions -func (*VpcV1) NewListLoadBalancersOptions() *ListLoadBalancersOptions { - return &ListLoadBalancersOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListLoadBalancersOptions) SetStart(start string) *ListLoadBalancersOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListLoadBalancersOptions) SetLimit(limit int64) *ListLoadBalancersOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancersOptions) SetHeaders(param map[string]string) *ListLoadBalancersOptions { - options.Headers = param - return options -} - -// ListNetworkACLRulesOptions : The ListNetworkACLRules options. -type ListNetworkACLRulesOptions struct { - // The network ACL identifier. - NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to rules with a `direction` property matching the specified value. - Direction *string `json:"direction,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListNetworkACLRulesOptions.Direction property. -// Filters the collection to rules with a `direction` property matching the specified value. -const ( - ListNetworkACLRulesOptionsDirectionInboundConst = "inbound" - ListNetworkACLRulesOptionsDirectionOutboundConst = "outbound" -) - -// NewListNetworkACLRulesOptions : Instantiate ListNetworkACLRulesOptions -func (*VpcV1) NewListNetworkACLRulesOptions(networkACLID string) *ListNetworkACLRulesOptions { - return &ListNetworkACLRulesOptions{ - NetworkACLID: core.StringPtr(networkACLID), - } -} - -// SetNetworkACLID : Allow user to set NetworkACLID -func (_options *ListNetworkACLRulesOptions) SetNetworkACLID(networkACLID string) *ListNetworkACLRulesOptions { - _options.NetworkACLID = core.StringPtr(networkACLID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListNetworkACLRulesOptions) SetStart(start string) *ListNetworkACLRulesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListNetworkACLRulesOptions) SetLimit(limit int64) *ListNetworkACLRulesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetDirection : Allow user to set Direction -func (_options *ListNetworkACLRulesOptions) SetDirection(direction string) *ListNetworkACLRulesOptions { - _options.Direction = core.StringPtr(direction) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListNetworkACLRulesOptions) SetHeaders(param map[string]string) *ListNetworkACLRulesOptions { - options.Headers = param - return options -} - -// ListNetworkAclsOptions : The ListNetworkAcls options. -type ListNetworkAclsOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListNetworkAclsOptions : Instantiate ListNetworkAclsOptions -func (*VpcV1) NewListNetworkAclsOptions() *ListNetworkAclsOptions { - return &ListNetworkAclsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListNetworkAclsOptions) SetStart(start string) *ListNetworkAclsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListNetworkAclsOptions) SetLimit(limit int64) *ListNetworkAclsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListNetworkAclsOptions) SetResourceGroupID(resourceGroupID string) *ListNetworkAclsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListNetworkAclsOptions) SetHeaders(param map[string]string) *ListNetworkAclsOptions { - options.Headers = param - return options -} - -// ListNetworkInterfaceFloatingIpsOptions : The ListNetworkInterfaceFloatingIps options. -type ListNetworkInterfaceFloatingIpsOptions struct { - // The virtual network interface identifier. - VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name - // to sort in descending order. For example, the value - // `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` - // property in ascending order. - Sort *string `json:"sort,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListNetworkInterfaceFloatingIpsOptions.Sort property. -// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name -// to sort in descending order. For example, the value -// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` -// property in ascending order. -const ( - ListNetworkInterfaceFloatingIpsOptionsSortAddressConst = "address" - ListNetworkInterfaceFloatingIpsOptionsSortNameConst = "name" -) - -// NewListNetworkInterfaceFloatingIpsOptions : Instantiate ListNetworkInterfaceFloatingIpsOptions -func (*VpcV1) NewListNetworkInterfaceFloatingIpsOptions(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions { - return &ListNetworkInterfaceFloatingIpsOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - } -} - -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *ListNetworkInterfaceFloatingIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListNetworkInterfaceFloatingIpsOptions) SetStart(start string) *ListNetworkInterfaceFloatingIpsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListNetworkInterfaceFloatingIpsOptions) SetLimit(limit int64) *ListNetworkInterfaceFloatingIpsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListNetworkInterfaceFloatingIpsOptions) SetSort(sort string) *ListNetworkInterfaceFloatingIpsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListNetworkInterfaceFloatingIpsOptions { - options.Headers = param - return options -} - -// ListOperatingSystemsOptions : The ListOperatingSystems options. -type ListOperatingSystemsOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListOperatingSystemsOptions : Instantiate ListOperatingSystemsOptions -func (*VpcV1) NewListOperatingSystemsOptions() *ListOperatingSystemsOptions { - return &ListOperatingSystemsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListOperatingSystemsOptions) SetStart(start string) *ListOperatingSystemsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListOperatingSystemsOptions) SetLimit(limit int64) *ListOperatingSystemsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListOperatingSystemsOptions) SetHeaders(param map[string]string) *ListOperatingSystemsOptions { - options.Headers = param - return options -} - -// ListPlacementGroupsOptions : The ListPlacementGroups options. -type ListPlacementGroupsOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListPlacementGroupsOptions : Instantiate ListPlacementGroupsOptions -func (*VpcV1) NewListPlacementGroupsOptions() *ListPlacementGroupsOptions { - return &ListPlacementGroupsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListPlacementGroupsOptions) SetStart(start string) *ListPlacementGroupsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListPlacementGroupsOptions) SetLimit(limit int64) *ListPlacementGroupsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListPlacementGroupsOptions) SetHeaders(param map[string]string) *ListPlacementGroupsOptions { - options.Headers = param - return options -} - -// ListPublicGatewaysOptions : The ListPublicGateways options. -type ListPublicGatewaysOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListPublicGatewaysOptions : Instantiate ListPublicGatewaysOptions -func (*VpcV1) NewListPublicGatewaysOptions() *ListPublicGatewaysOptions { - return &ListPublicGatewaysOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListPublicGatewaysOptions) SetStart(start string) *ListPublicGatewaysOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListPublicGatewaysOptions) SetLimit(limit int64) *ListPublicGatewaysOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListPublicGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListPublicGatewaysOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListPublicGatewaysOptions) SetHeaders(param map[string]string) *ListPublicGatewaysOptions { - options.Headers = param - return options -} - -// ListRegionZonesOptions : The ListRegionZones options. -type ListRegionZonesOptions struct { - // The region name. - RegionName *string `json:"region_name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListRegionZonesOptions : Instantiate ListRegionZonesOptions -func (*VpcV1) NewListRegionZonesOptions(regionName string) *ListRegionZonesOptions { - return &ListRegionZonesOptions{ - RegionName: core.StringPtr(regionName), - } -} - -// SetRegionName : Allow user to set RegionName -func (_options *ListRegionZonesOptions) SetRegionName(regionName string) *ListRegionZonesOptions { - _options.RegionName = core.StringPtr(regionName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListRegionZonesOptions) SetHeaders(param map[string]string) *ListRegionZonesOptions { - options.Headers = param - return options -} - -// ListRegionsOptions : The ListRegions options. -type ListRegionsOptions struct { - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListRegionsOptions : Instantiate ListRegionsOptions -func (*VpcV1) NewListRegionsOptions() *ListRegionsOptions { - return &ListRegionsOptions{} -} - -// SetHeaders : Allow user to set Headers -func (options *ListRegionsOptions) SetHeaders(param map[string]string) *ListRegionsOptions { - options.Headers = param - return options -} - -// ListSecurityGroupRulesOptions : The ListSecurityGroupRules options. -type ListSecurityGroupRulesOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListSecurityGroupRulesOptions : Instantiate ListSecurityGroupRulesOptions -func (*VpcV1) NewListSecurityGroupRulesOptions(securityGroupID string) *ListSecurityGroupRulesOptions { - return &ListSecurityGroupRulesOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *ListSecurityGroupRulesOptions) SetSecurityGroupID(securityGroupID string) *ListSecurityGroupRulesOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSecurityGroupRulesOptions) SetHeaders(param map[string]string) *ListSecurityGroupRulesOptions { - options.Headers = param - return options -} - -// ListSecurityGroupTargetsOptions : The ListSecurityGroupTargets options. -type ListSecurityGroupTargetsOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListSecurityGroupTargetsOptions : Instantiate ListSecurityGroupTargetsOptions -func (*VpcV1) NewListSecurityGroupTargetsOptions(securityGroupID string) *ListSecurityGroupTargetsOptions { - return &ListSecurityGroupTargetsOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *ListSecurityGroupTargetsOptions) SetSecurityGroupID(securityGroupID string) *ListSecurityGroupTargetsOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListSecurityGroupTargetsOptions) SetStart(start string) *ListSecurityGroupTargetsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListSecurityGroupTargetsOptions) SetLimit(limit int64) *ListSecurityGroupTargetsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSecurityGroupTargetsOptions) SetHeaders(param map[string]string) *ListSecurityGroupTargetsOptions { - options.Headers = param - return options -} - -// ListSecurityGroupsOptions : The ListSecurityGroups options. -type ListSecurityGroupsOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Filters the collection to resources with a `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // Filters the collection to resources with a `vpc.name` property matching the exact specified name. - VPCName *string `json:"vpc.name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListSecurityGroupsOptions : Instantiate ListSecurityGroupsOptions -func (*VpcV1) NewListSecurityGroupsOptions() *ListSecurityGroupsOptions { - return &ListSecurityGroupsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListSecurityGroupsOptions) SetStart(start string) *ListSecurityGroupsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListSecurityGroupsOptions) SetLimit(limit int64) *ListSecurityGroupsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListSecurityGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListSecurityGroupsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListSecurityGroupsOptions) SetVPCID(vpcID string) *ListSecurityGroupsOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListSecurityGroupsOptions) SetVPCCRN(vpcCRN string) *ListSecurityGroupsOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListSecurityGroupsOptions) SetVPCName(vpcName string) *ListSecurityGroupsOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSecurityGroupsOptions) SetHeaders(param map[string]string) *ListSecurityGroupsOptions { - options.Headers = param - return options -} - -// ListShareMountTargetsOptions : The ListShareMountTargets options. -type ListShareMountTargetsOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListShareMountTargetsOptions : Instantiate ListShareMountTargetsOptions -func (*VpcV1) NewListShareMountTargetsOptions(shareID string) *ListShareMountTargetsOptions { - return &ListShareMountTargetsOptions{ - ShareID: core.StringPtr(shareID), - } -} - -// SetShareID : Allow user to set ShareID -func (_options *ListShareMountTargetsOptions) SetShareID(shareID string) *ListShareMountTargetsOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListShareMountTargetsOptions) SetName(name string) *ListShareMountTargetsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListShareMountTargetsOptions) SetStart(start string) *ListShareMountTargetsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListShareMountTargetsOptions) SetLimit(limit int64) *ListShareMountTargetsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListShareMountTargetsOptions) SetHeaders(param map[string]string) *ListShareMountTargetsOptions { - options.Headers = param - return options -} - -// ListShareProfilesOptions : The ListShareProfiles options. -type ListShareProfilesOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name - // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property - // in descending order, and the value `name` sorts it by the `name` property in ascending order. - Sort *string `json:"sort,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListShareProfilesOptions.Sort property. -// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name -// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property -// in descending order, and the value `name` sorts it by the `name` property in ascending order. -const ( - ListShareProfilesOptionsSortCreatedAtConst = "created_at" - ListShareProfilesOptionsSortNameConst = "name" -) - -// NewListShareProfilesOptions : Instantiate ListShareProfilesOptions -func (*VpcV1) NewListShareProfilesOptions() *ListShareProfilesOptions { - return &ListShareProfilesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListShareProfilesOptions) SetStart(start string) *ListShareProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListShareProfilesOptions) SetLimit(limit int64) *ListShareProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListShareProfilesOptions) SetSort(sort string) *ListShareProfilesOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListShareProfilesOptions) SetHeaders(param map[string]string) *ListShareProfilesOptions { - options.Headers = param - return options -} - -// ListSharesOptions : The ListShares options. -type ListSharesOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name - // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property - // in descending order, and the value `name` sorts it by the `name` property in ascending order. - Sort *string `json:"sort,omitempty"` - - // Filters the collection to file shares with a `replication_role` property matching the specified value. - ReplicationRole *string `json:"replication_role,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListSharesOptions.Sort property. -// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name -// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property -// in descending order, and the value `name` sorts it by the `name` property in ascending order. -const ( - ListSharesOptionsSortCreatedAtConst = "created_at" - ListSharesOptionsSortNameConst = "name" -) - -// Constants associated with the ListSharesOptions.ReplicationRole property. -// Filters the collection to file shares with a `replication_role` property matching the specified value. -const ( - ListSharesOptionsReplicationRoleNoneConst = "none" - ListSharesOptionsReplicationRoleReplicaConst = "replica" - ListSharesOptionsReplicationRoleSourceConst = "source" -) - -// NewListSharesOptions : Instantiate ListSharesOptions -func (*VpcV1) NewListSharesOptions() *ListSharesOptions { - return &ListSharesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListSharesOptions) SetStart(start string) *ListSharesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListSharesOptions) SetLimit(limit int64) *ListSharesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListSharesOptions) SetResourceGroupID(resourceGroupID string) *ListSharesOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListSharesOptions) SetName(name string) *ListSharesOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListSharesOptions) SetSort(sort string) *ListSharesOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetReplicationRole : Allow user to set ReplicationRole -func (_options *ListSharesOptions) SetReplicationRole(replicationRole string) *ListSharesOptions { - _options.ReplicationRole = core.StringPtr(replicationRole) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSharesOptions) SetHeaders(param map[string]string) *ListSharesOptions { - options.Headers = param - return options -} - -// ListSnapshotClonesOptions : The ListSnapshotClones options. -type ListSnapshotClonesOptions struct { - // The snapshot identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListSnapshotClonesOptions : Instantiate ListSnapshotClonesOptions -func (*VpcV1) NewListSnapshotClonesOptions(id string) *ListSnapshotClonesOptions { - return &ListSnapshotClonesOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *ListSnapshotClonesOptions) SetID(id string) *ListSnapshotClonesOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSnapshotClonesOptions) SetHeaders(param map[string]string) *ListSnapshotClonesOptions { - options.Headers = param - return options -} - -// ListSnapshotsOptions : The ListSnapshots options. -type ListSnapshotsOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with an item in the `tags` property matching the exact specified tag. - Tag *string `json:"tag,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // Filters the collection to resources with a `source_volume.id` property matching the specified identifier. - SourceVolumeID *string `json:"source_volume.id,omitempty"` - - // Filters the collection to resources with a `source_volume.crn` property matching the specified CRN. - SourceVolumeCRN *string `json:"source_volume.crn,omitempty"` - - // Filters the collection to resources with a `source_image.id` property matching the specified identifier. - // - // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no - // source image or any existent source image, respectively. - SourceImageID *string `json:"source_image.id,omitempty"` - - // Filters the collection to resources with a `source_image.crn` property matching the specified CRN. - // - // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no - // source image or any existent source image, respectively. - SourceImageCRN *string `json:"source_image.crn,omitempty"` - - // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name - // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property - // in descending order, and the value `name` sorts it by the `name` property in ascending order. - Sort *string `json:"sort,omitempty"` - - // Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified - // identifier. - BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` - - // Filters the collection to snapshots with an item in the `copies` property with an `id` property matching the - // specified identifier. - CopiesID *string `json:"copies[].id,omitempty"` - - // Filters the collection to snapshots with an item in the `copies` property with a `name` property matching the exact - // specified name. - CopiesName *string `json:"copies[].name,omitempty"` - - // Filters the collection to snapshots with an item in the `copies` property with an `id` property matching the - // specified CRN. - CopiesCRN *string `json:"copies[].crn,omitempty"` - - // Filters the collection to snapshots with an item in the `copies` property with a - // `remote.region.name` property matching the exact specified name. - CopiesRemoteRegionName *string `json:"copies[].remote.region.name,omitempty"` - - // Filters the collection to resources with a `source_snapshot.id` property matching the specified identifier. - SourceSnapshotID *string `json:"source_snapshot.id,omitempty"` - - // Filters the collection to resources with a `source_snapshot.remote.region.name` property matching the exact - // specified name. - SourceSnapshotRemoteRegionName *string `json:"source_snapshot.remote.region.name,omitempty"` - - // Filters the collection to resources with a `source_volume.remote.region.name` property matching the exact specified - // name. - SourceVolumeRemoteRegionName *string `json:"source_volume.remote.region.name,omitempty"` - - // Filters the collection to resources with a `source_image.remote.region.name` property matching the exact specified - // name. - SourceImageRemoteRegionName *string `json:"source_image.remote.region.name,omitempty"` - - // Filters the collection to snapshots with an item in the `clones` property with a `zone.name` property matching the - // exact specified name. - ClonesZoneName *string `json:"clones[].zone.name,omitempty"` - - // 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 -} - -// SetHeaders : Allow user to set Headers -func (options *ListSnapshotsOptions) SetHeaders(param map[string]string) *ListSnapshotsOptions { - options.Headers = param - return options -} - -// ListSubnetReservedIpsOptions : The ListSubnetReservedIps options. -type ListSubnetReservedIpsOptions struct { - // The subnet identifier. - SubnetID *string `json:"subnet_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name - // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property - // in descending order, and the value `name` sorts it by the `name` property in ascending order. - Sort *string `json:"sort,omitempty"` - - // Filters the collection to resources with a `target.id` property matching the specified identifier. - TargetID *string `json:"target.id,omitempty"` - - // Filters the collection to resources with a `target.crn` property matching the specified CRN. - TargetCRN *string `json:"target.crn,omitempty"` - - // Filters the collection to resources with a `target.name` property matching the exact specified name. - TargetName *string `json:"target.name,omitempty"` - - // Filters the collection to resources with a `target.resource_type` property matching the specified value. - TargetResourceType *string `json:"target.resource_type,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListSubnetReservedIpsOptions.Sort property. -// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name -// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property -// in descending order, and the value `name` sorts it by the `name` property in ascending order. -const ( - ListSubnetReservedIpsOptionsSortAddressConst = "address" - ListSubnetReservedIpsOptionsSortCreatedAtConst = "created_at" - ListSubnetReservedIpsOptionsSortNameConst = "name" -) - -// NewListSubnetReservedIpsOptions : Instantiate ListSubnetReservedIpsOptions -func (*VpcV1) NewListSubnetReservedIpsOptions(subnetID string) *ListSubnetReservedIpsOptions { - return &ListSubnetReservedIpsOptions{ - SubnetID: core.StringPtr(subnetID), - } -} - -// SetSubnetID : Allow user to set SubnetID -func (_options *ListSubnetReservedIpsOptions) SetSubnetID(subnetID string) *ListSubnetReservedIpsOptions { - _options.SubnetID = core.StringPtr(subnetID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListSubnetReservedIpsOptions) SetStart(start string) *ListSubnetReservedIpsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListSubnetReservedIpsOptions) SetLimit(limit int64) *ListSubnetReservedIpsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListSubnetReservedIpsOptions) SetSort(sort string) *ListSubnetReservedIpsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetTargetID : Allow user to set TargetID -func (_options *ListSubnetReservedIpsOptions) SetTargetID(targetID string) *ListSubnetReservedIpsOptions { - _options.TargetID = core.StringPtr(targetID) - return _options -} - -// SetTargetCRN : Allow user to set TargetCRN -func (_options *ListSubnetReservedIpsOptions) SetTargetCRN(targetCRN string) *ListSubnetReservedIpsOptions { - _options.TargetCRN = core.StringPtr(targetCRN) - return _options -} - -// SetTargetName : Allow user to set TargetName -func (_options *ListSubnetReservedIpsOptions) SetTargetName(targetName string) *ListSubnetReservedIpsOptions { - _options.TargetName = core.StringPtr(targetName) - return _options -} - -// SetTargetResourceType : Allow user to set TargetResourceType -func (_options *ListSubnetReservedIpsOptions) SetTargetResourceType(targetResourceType string) *ListSubnetReservedIpsOptions { - _options.TargetResourceType = core.StringPtr(targetResourceType) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSubnetReservedIpsOptions) SetHeaders(param map[string]string) *ListSubnetReservedIpsOptions { - options.Headers = param - return options -} - -// ListSubnetsOptions : The ListSubnets options. -type ListSubnetsOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Filters the collection to resources with a `zone.name` property matching the exact specified name. - ZoneName *string `json:"zone.name,omitempty"` - - // Filters the collection to resources with a `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // Filters the collection to resources with a `vpc.name` property matching the exact specified name. - VPCName *string `json:"vpc.name,omitempty"` - - // Filters the collection to subnets with a `routing_table.id` property matching the specified identifier. - RoutingTableID *string `json:"routing_table.id,omitempty"` - - // Filters the collection to subnets with a `routing_table.name` property matching the exact specified name. - RoutingTableName *string `json:"routing_table.name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListSubnetsOptions : Instantiate ListSubnetsOptions -func (*VpcV1) NewListSubnetsOptions() *ListSubnetsOptions { - return &ListSubnetsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListSubnetsOptions) SetStart(start string) *ListSubnetsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListSubnetsOptions) SetLimit(limit int64) *ListSubnetsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListSubnetsOptions) SetResourceGroupID(resourceGroupID string) *ListSubnetsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *ListSubnetsOptions) SetZoneName(zoneName string) *ListSubnetsOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListSubnetsOptions) SetVPCID(vpcID string) *ListSubnetsOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListSubnetsOptions) SetVPCCRN(vpcCRN string) *ListSubnetsOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListSubnetsOptions) SetVPCName(vpcName string) *ListSubnetsOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - -// SetRoutingTableID : Allow user to set RoutingTableID -func (_options *ListSubnetsOptions) SetRoutingTableID(routingTableID string) *ListSubnetsOptions { - _options.RoutingTableID = core.StringPtr(routingTableID) - return _options -} - -// SetRoutingTableName : Allow user to set RoutingTableName -func (_options *ListSubnetsOptions) SetRoutingTableName(routingTableName string) *ListSubnetsOptions { - _options.RoutingTableName = core.StringPtr(routingTableName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSubnetsOptions) SetHeaders(param map[string]string) *ListSubnetsOptions { - options.Headers = param - return options -} - -// ListVirtualNetworkInterfaceIpsOptions : The ListVirtualNetworkInterfaceIps options. -type ListVirtualNetworkInterfaceIpsOptions struct { - // The virtual network interface identifier. - VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name - // to sort in descending order. For example, the value - // `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` - // property in ascending order. - Sort *string `json:"sort,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListVirtualNetworkInterfaceIpsOptions.Sort property. -// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name -// to sort in descending order. For example, the value -// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` -// property in ascending order. -const ( - ListVirtualNetworkInterfaceIpsOptionsSortAddressConst = "address" - ListVirtualNetworkInterfaceIpsOptionsSortNameConst = "name" -) - -// NewListVirtualNetworkInterfaceIpsOptions : Instantiate ListVirtualNetworkInterfaceIpsOptions -func (*VpcV1) NewListVirtualNetworkInterfaceIpsOptions(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions { - return &ListVirtualNetworkInterfaceIpsOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - } -} - -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *ListVirtualNetworkInterfaceIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVirtualNetworkInterfaceIpsOptions) SetStart(start string) *ListVirtualNetworkInterfaceIpsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVirtualNetworkInterfaceIpsOptions) SetLimit(limit int64) *ListVirtualNetworkInterfaceIpsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListVirtualNetworkInterfaceIpsOptions) SetSort(sort string) *ListVirtualNetworkInterfaceIpsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVirtualNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListVirtualNetworkInterfaceIpsOptions { - options.Headers = param - return options -} - -// ListVirtualNetworkInterfacesOptions : The ListVirtualNetworkInterfaces options. -type ListVirtualNetworkInterfacesOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListVirtualNetworkInterfacesOptions : Instantiate ListVirtualNetworkInterfacesOptions -func (*VpcV1) NewListVirtualNetworkInterfacesOptions() *ListVirtualNetworkInterfacesOptions { - return &ListVirtualNetworkInterfacesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListVirtualNetworkInterfacesOptions) SetStart(start string) *ListVirtualNetworkInterfacesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVirtualNetworkInterfacesOptions) SetLimit(limit int64) *ListVirtualNetworkInterfacesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListVirtualNetworkInterfacesOptions) SetResourceGroupID(resourceGroupID string) *ListVirtualNetworkInterfacesOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVirtualNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListVirtualNetworkInterfacesOptions { - options.Headers = param - return options -} - -// ListVolumeProfilesOptions : The ListVolumeProfiles options. -type ListVolumeProfilesOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListVolumeProfilesOptions : Instantiate ListVolumeProfilesOptions -func (*VpcV1) NewListVolumeProfilesOptions() *ListVolumeProfilesOptions { - return &ListVolumeProfilesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListVolumeProfilesOptions) SetStart(start string) *ListVolumeProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVolumeProfilesOptions) SetLimit(limit int64) *ListVolumeProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVolumeProfilesOptions) SetHeaders(param map[string]string) *ListVolumeProfilesOptions { - options.Headers = param - return options -} - -// ListVolumesOptions : The ListVolumes options. -type ListVolumesOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // Filters the collection to volumes with an `attachment_state` property matching the specified value. - AttachmentState *string `json:"attachment_state,omitempty"` - - // Filters the collection to resources with an `encryption` property matching the specified value. - Encryption *string `json:"encryption,omitempty"` - - // Filters the collection to resources with an `operating_system.family` property matching the specified operating - // system family. - // - // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no - // operating system or any operating system, respectively. - OperatingSystemFamily *string `json:"operating_system.family,omitempty"` - - // Filters the collection to resources with an `operating_system.architecture` property matching the specified - // operating system architecture. - // - // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no - // operating system or any operating system, respectively. - OperatingSystemArchitecture *string `json:"operating_system.architecture,omitempty"` - - // Filters the collection to resources with a `zone.name` property matching the exact specified name. - ZoneName *string `json:"zone.name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListVolumesOptions.AttachmentState property. -// Filters the collection to volumes with an `attachment_state` property matching the specified value. -const ( - ListVolumesOptionsAttachmentStateAttachedConst = "attached" - ListVolumesOptionsAttachmentStateUnattachedConst = "unattached" - ListVolumesOptionsAttachmentStateUnusableConst = "unusable" -) - -// Constants associated with the ListVolumesOptions.Encryption property. -// Filters the collection to resources with an `encryption` property matching the specified value. -const ( - ListVolumesOptionsEncryptionProviderManagedConst = "provider_managed" - ListVolumesOptionsEncryptionUserManagedConst = "user_managed" -) - -// NewListVolumesOptions : Instantiate ListVolumesOptions -func (*VpcV1) NewListVolumesOptions() *ListVolumesOptions { - return &ListVolumesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListVolumesOptions) SetStart(start string) *ListVolumesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVolumesOptions) SetLimit(limit int64) *ListVolumesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListVolumesOptions) SetName(name string) *ListVolumesOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetAttachmentState : Allow user to set AttachmentState -func (_options *ListVolumesOptions) SetAttachmentState(attachmentState string) *ListVolumesOptions { - _options.AttachmentState = core.StringPtr(attachmentState) - return _options -} - -// SetEncryption : Allow user to set Encryption -func (_options *ListVolumesOptions) SetEncryption(encryption string) *ListVolumesOptions { - _options.Encryption = core.StringPtr(encryption) - return _options -} - -// SetOperatingSystemFamily : Allow user to set OperatingSystemFamily -func (_options *ListVolumesOptions) SetOperatingSystemFamily(operatingSystemFamily string) *ListVolumesOptions { - _options.OperatingSystemFamily = core.StringPtr(operatingSystemFamily) - return _options -} - -// SetOperatingSystemArchitecture : Allow user to set OperatingSystemArchitecture -func (_options *ListVolumesOptions) SetOperatingSystemArchitecture(operatingSystemArchitecture string) *ListVolumesOptions { - _options.OperatingSystemArchitecture = core.StringPtr(operatingSystemArchitecture) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *ListVolumesOptions) SetZoneName(zoneName string) *ListVolumesOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// 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 -} - -// ListVPNGatewayConnectionLocalCIDRsOptions : The ListVPNGatewayConnectionLocalCIDRs options. -type ListVPNGatewayConnectionLocalCIDRsOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListVPNGatewayConnectionLocalCIDRsOptions : Instantiate ListVPNGatewayConnectionLocalCIDRsOptions -func (*VpcV1) NewListVPNGatewayConnectionLocalCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionLocalCIDRsOptions { - return &ListVPNGatewayConnectionLocalCIDRsOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *ListVPNGatewayConnectionLocalCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionLocalCIDRsOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *ListVPNGatewayConnectionLocalCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionLocalCIDRsOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNGatewayConnectionLocalCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionLocalCIDRsOptions { - options.Headers = param - return options -} - -// ListVPNGatewayConnectionPeerCIDRsOptions : The ListVPNGatewayConnectionPeerCIDRs options. -type ListVPNGatewayConnectionPeerCIDRsOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListVPNGatewayConnectionPeerCIDRsOptions : Instantiate ListVPNGatewayConnectionPeerCIDRsOptions -func (*VpcV1) NewListVPNGatewayConnectionPeerCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionPeerCIDRsOptions { - return &ListVPNGatewayConnectionPeerCIDRsOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *ListVPNGatewayConnectionPeerCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionPeerCIDRsOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *ListVPNGatewayConnectionPeerCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionPeerCIDRsOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNGatewayConnectionPeerCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionPeerCIDRsOptions { - options.Headers = param - return options -} - -// ListVPNGatewayConnectionsOptions : The ListVPNGatewayConnections options. -type ListVPNGatewayConnectionsOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // Filters the collection to VPN gateway connections with a `status` property matching the specified value. - Status *string `json:"status,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListVPNGatewayConnectionsOptions.Status property. -// Filters the collection to VPN gateway connections with a `status` property matching the specified value. -const ( - ListVPNGatewayConnectionsOptionsStatusDownConst = "down" - ListVPNGatewayConnectionsOptionsStatusUpConst = "up" -) - -// NewListVPNGatewayConnectionsOptions : Instantiate ListVPNGatewayConnectionsOptions -func (*VpcV1) NewListVPNGatewayConnectionsOptions(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { - return &ListVPNGatewayConnectionsOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *ListVPNGatewayConnectionsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetStatus : Allow user to set Status -func (_options *ListVPNGatewayConnectionsOptions) SetStatus(status string) *ListVPNGatewayConnectionsOptions { - _options.Status = core.StringPtr(status) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNGatewayConnectionsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsOptions { - options.Headers = param - return options -} - -// ListVPNGatewaysOptions : The ListVPNGateways options. -type ListVPNGatewaysOptions struct { - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name - // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property - // in descending order, and the value `name` sorts it by the `name` property in ascending order. - Sort *string `json:"sort,omitempty"` - - // Filters the collection to VPN gateways with a `mode` property matching the specified value. - Mode *string `json:"mode,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListVPNGatewaysOptions.Sort property. -// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name -// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property -// in descending order, and the value `name` sorts it by the `name` property in ascending order. -const ( - ListVPNGatewaysOptionsSortCreatedAtConst = "created_at" - ListVPNGatewaysOptionsSortNameConst = "name" -) - -// Constants associated with the ListVPNGatewaysOptions.Mode property. -// Filters the collection to VPN gateways with a `mode` property matching the specified value. -const ( - ListVPNGatewaysOptionsModePolicyConst = "policy" - ListVPNGatewaysOptionsModeRouteConst = "route" -) - -// NewListVPNGatewaysOptions : Instantiate ListVPNGatewaysOptions -func (*VpcV1) NewListVPNGatewaysOptions() *ListVPNGatewaysOptions { - return &ListVPNGatewaysOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListVPNGatewaysOptions) SetStart(start string) *ListVPNGatewaysOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVPNGatewaysOptions) SetLimit(limit int64) *ListVPNGatewaysOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListVPNGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListVPNGatewaysOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListVPNGatewaysOptions) SetSort(sort string) *ListVPNGatewaysOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetMode : Allow user to set Mode -func (_options *ListVPNGatewaysOptions) SetMode(mode string) *ListVPNGatewaysOptions { - _options.Mode = core.StringPtr(mode) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNGatewaysOptions) SetHeaders(param map[string]string) *ListVPNGatewaysOptions { - options.Headers = param - return options -} - -// ListVPNServerClientsOptions : The ListVPNServerClients options. -type ListVPNServerClientsOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name - // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property - // in descending order. - Sort *string `json:"sort,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListVPNServerClientsOptions.Sort property. -// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name -// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property -// in descending order. -const ( - ListVPNServerClientsOptionsSortCreatedAtConst = "created_at" -) - -// NewListVPNServerClientsOptions : Instantiate ListVPNServerClientsOptions -func (*VpcV1) NewListVPNServerClientsOptions(vpnServerID string) *ListVPNServerClientsOptions { - return &ListVPNServerClientsOptions{ - VPNServerID: core.StringPtr(vpnServerID), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *ListVPNServerClientsOptions) SetVPNServerID(vpnServerID string) *ListVPNServerClientsOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVPNServerClientsOptions) SetStart(start string) *ListVPNServerClientsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVPNServerClientsOptions) SetLimit(limit int64) *ListVPNServerClientsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListVPNServerClientsOptions) SetSort(sort string) *ListVPNServerClientsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNServerClientsOptions) SetHeaders(param map[string]string) *ListVPNServerClientsOptions { - options.Headers = param - return options -} - -// ListVPNServerRoutesOptions : The ListVPNServerRoutes options. -type ListVPNServerRoutesOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name - // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property - // in descending order, and the value `name` sorts it by the `name` property in ascending order. - Sort *string `json:"sort,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListVPNServerRoutesOptions.Sort property. -// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name -// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property -// in descending order, and the value `name` sorts it by the `name` property in ascending order. -const ( - ListVPNServerRoutesOptionsSortCreatedAtConst = "created_at" - ListVPNServerRoutesOptionsSortNameConst = "name" -) - -// NewListVPNServerRoutesOptions : Instantiate ListVPNServerRoutesOptions -func (*VpcV1) NewListVPNServerRoutesOptions(vpnServerID string) *ListVPNServerRoutesOptions { - return &ListVPNServerRoutesOptions{ - VPNServerID: core.StringPtr(vpnServerID), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *ListVPNServerRoutesOptions) SetVPNServerID(vpnServerID string) *ListVPNServerRoutesOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVPNServerRoutesOptions) SetStart(start string) *ListVPNServerRoutesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVPNServerRoutesOptions) SetLimit(limit int64) *ListVPNServerRoutesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListVPNServerRoutesOptions) SetSort(sort string) *ListVPNServerRoutesOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNServerRoutesOptions) SetHeaders(param map[string]string) *ListVPNServerRoutesOptions { - options.Headers = param - return options -} - -// ListVPNServersOptions : The ListVPNServers options. -type ListVPNServersOptions struct { - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // A server-provided token determining what resource to start the page on. - Start *string `json:"start,omitempty"` - - // The number of resources to return on a page. - Limit *int64 `json:"limit,omitempty"` - - // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. - ResourceGroupID *string `json:"resource_group.id,omitempty"` - - // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name - // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property - // in descending order, and the value `name` sorts it by the `name` property in ascending order. - Sort *string `json:"sort,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListVPNServersOptions.Sort property. -// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name -// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property -// in descending order, and the value `name` sorts it by the `name` property in ascending order. -const ( - ListVPNServersOptionsSortCreatedAtConst = "created_at" - ListVPNServersOptionsSortNameConst = "name" -) - -// NewListVPNServersOptions : Instantiate ListVPNServersOptions -func (*VpcV1) NewListVPNServersOptions() *ListVPNServersOptions { - return &ListVPNServersOptions{} -} - -// SetName : Allow user to set Name -func (_options *ListVPNServersOptions) SetName(name string) *ListVPNServersOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVPNServersOptions) SetStart(start string) *ListVPNServersOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVPNServersOptions) SetLimit(limit int64) *ListVPNServersOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListVPNServersOptions) SetResourceGroupID(resourceGroupID string) *ListVPNServersOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListVPNServersOptions) SetSort(sort string) *ListVPNServersOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNServersOptions) SetHeaders(param map[string]string) *ListVPNServersOptions { - options.Headers = param - return options -} - -// LoadBalancer : LoadBalancer struct -type LoadBalancer struct { - // The date and time that this load balancer was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The load balancer's CRN. - CRN *string `json:"crn" validate:"required"` - - // The DNS configuration for this load balancer. - // - // If absent, DNS `A` records for this load balancer's `hostname` property will be added to - // the public DNS zone `lb.appdomain.cloud`. - Dns *LoadBalancerDns `json:"dns,omitempty"` - - // Fully qualified domain name assigned to this load balancer. - Hostname *string `json:"hostname" validate:"required"` - - // The load balancer's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer. - ID *string `json:"id" validate:"required"` - - // Indicates whether this load balancer supports instance groups. - InstanceGroupsSupported *bool `json:"instance_groups_supported" validate:"required"` - - // The type of this load balancer, public or private. - IsPublic *bool `json:"is_public" validate:"required"` - - // The listeners of this load balancer. - Listeners []LoadBalancerListenerReference `json:"listeners" validate:"required"` - - // The logging configuration for this load balancer. - Logging *LoadBalancerLogging `json:"logging" validate:"required"` - - // The name for this load balancer. The name is unique across all load balancers in the VPC. - Name *string `json:"name" validate:"required"` - - // The operating status of this load balancer. - OperatingStatus *string `json:"operating_status" validate:"required"` - - // The pools of this load balancer. - Pools []LoadBalancerPoolReference `json:"pools" validate:"required"` - - // The private IP addresses assigned to this load balancer. - PrivateIps []LoadBalancerPrivateIpsItem `json:"private_ips" validate:"required"` - - // The profile for this load balancer. - Profile *LoadBalancerProfileReference `json:"profile" validate:"required"` - - // The provisioning status of this load balancer: - // - // - `active`: The load balancer is running. - // - `create_pending`: The load balancer is being created. - // - `delete_pending`: The load balancer is being deleted. - // - `maintenance_pending`: The load balancer is unavailable due to an internal - // error (contact IBM support). - // - `migrate_pending`: The load balancer is migrating to the requested configuration. - // Performance may be degraded. - // - `update_pending`: The load balancer is being updated - // to the requested configuration. - // - // The enumerated values for this property are expected to expand in the future. When - // processing this property, check for and log unknown values. Optionally halt - // processing and surface the error, or bypass the load balancer on which the - // unexpected property value was encountered. - ProvisioningStatus *string `json:"provisioning_status" validate:"required"` - - // The public IP addresses assigned to this load balancer. - // - // Applicable only for public load balancers. - PublicIps []IP `json:"public_ips" validate:"required"` - - // The resource group for this load balancer. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // Indicates whether route mode is enabled for this load balancer. - // - // At present, public load balancers are not supported with route mode enabled. - RouteMode *bool `json:"route_mode" validate:"required"` - - // The security groups targeting this load balancer. - // - // Applicable only for load balancers that support security groups. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // Indicates whether this load balancer supports security groups. - SecurityGroupsSupported *bool `json:"security_groups_supported" validate:"required"` - - // The subnets this load balancer is provisioned in. The load balancer's availability depends on the availability of - // the zones that the subnets reside in. - // - // All subnets will be in the same VPC. - Subnets []SubnetReference `json:"subnets" validate:"required"` - - // Indicates whether this load balancer supports UDP. - UDPSupported *bool `json:"udp_supported" validate:"required"` -} - -// Constants associated with the LoadBalancer.OperatingStatus property. -// The operating status of this load balancer. -const ( - LoadBalancerOperatingStatusOfflineConst = "offline" - LoadBalancerOperatingStatusOnlineConst = "online" -) - -// Constants associated with the LoadBalancer.ProvisioningStatus property. -// The provisioning status of this load balancer: -// -// - `active`: The load balancer is running. -// -// - `create_pending`: The load balancer is being created. -// -// - `delete_pending`: The load balancer is being deleted. -// -// - `maintenance_pending`: The load balancer is unavailable due to an internal -// error (contact IBM support). -// -// - `migrate_pending`: The load balancer is migrating to the requested configuration. -// Performance may be degraded. -// -// - `update_pending`: The load balancer is being updated -// to the requested configuration. -// -// The enumerated values for this property are expected to expand in the future. When -// processing this property, check for and log unknown values. Optionally halt -// processing and surface the error, or bypass the load balancer on which the -// unexpected property value was encountered. -const ( - LoadBalancerProvisioningStatusActiveConst = "active" - LoadBalancerProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerProvisioningStatusFailedConst = "failed" - LoadBalancerProvisioningStatusMaintenancePendingConst = "maintenance_pending" - LoadBalancerProvisioningStatusMigratePendingConst = "migrate_pending" - LoadBalancerProvisioningStatusUpdatePendingConst = "update_pending" -) - -// Constants associated with the LoadBalancer.ResourceType property. -// The resource type. -const ( - LoadBalancerResourceTypeLoadBalancerConst = "load_balancer" -) - -// UnmarshalLoadBalancer unmarshals an instance of LoadBalancer from the specified map of raw messages. -func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancer) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalLoadBalancerDns) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "instance_groups_supported", &obj.InstanceGroupsSupported) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "is_public", &obj.IsPublic) - if err != nil { - return - } - err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListenerReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLogging) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "operating_status", &obj.OperatingStatus) - if err != nil { - return - } - err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPoolReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalLoadBalancerPrivateIpsItem) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalLoadBalancerProfileReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) - if err != nil { - return - } - err = core.UnmarshalModel(m, "public_ips", &obj.PublicIps, UnmarshalIP) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_mode", &obj.RouteMode) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "security_groups_supported", &obj.SecurityGroupsSupported) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "udp_supported", &obj.UDPSupported) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerCollection : LoadBalancerCollection struct -type LoadBalancerCollection struct { - // A link to the first page of resources. - First *LoadBalancerCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of load balancers. - LoadBalancers []LoadBalancer `json:"load_balancers" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *LoadBalancerCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalLoadBalancerCollection unmarshals an instance of LoadBalancerCollection from the specified map of raw messages. -func UnmarshalLoadBalancerCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalLoadBalancerCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "load_balancers", &obj.LoadBalancers, UnmarshalLoadBalancer) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *LoadBalancerCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// LoadBalancerCollectionFirst : A link to the first page of resources. -type LoadBalancerCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalLoadBalancerCollectionFirst unmarshals an instance of LoadBalancerCollectionFirst from the specified map of raw messages. -func UnmarshalLoadBalancerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type LoadBalancerCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalLoadBalancerCollectionNext unmarshals an instance of LoadBalancerCollectionNext from the specified map of raw messages. -func UnmarshalLoadBalancerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerDns : The DNS configuration for this load balancer. -// -// If absent, DNS `A` records for this load balancer's `hostname` property will be added to the public DNS zone -// `lb.appdomain.cloud`. -type LoadBalancerDns struct { - // The DNS instance associated with this load balancer. - Instance *DnsInstanceReference `json:"instance" validate:"required"` - - // The DNS zone associated with this load balancer. - Zone *DnsZoneReference `json:"zone" validate:"required"` -} - -// UnmarshalLoadBalancerDns unmarshals an instance of LoadBalancerDns from the specified map of raw messages. -func UnmarshalLoadBalancerDns(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerDns) - err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerDnsPatch : The DNS configuration for this load balancer. -// -// Specify `null` to remove the existing DNS configuration, which will remove all DNS `A` records for this load balancer -// that had been added to `zone`, and add equivalent `A` records to the public DNS zone `lb.appdomain.cloud`. -type LoadBalancerDnsPatch struct { - // The DNS instance to associate with this load balancer. - // - // The specified instance may be in a different region or account, subject to IAM - // policies. - Instance DnsInstanceIdentityIntf `json:"instance,omitempty"` - - // The DNS zone to associate with this load balancer. - // - // The specified zone may be in a different region or account, subject to IAM policies. - Zone DnsZoneIdentityIntf `json:"zone,omitempty"` -} - -// UnmarshalLoadBalancerDnsPatch unmarshals an instance of LoadBalancerDnsPatch from the specified map of raw messages. -func UnmarshalLoadBalancerDnsPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerDnsPatch) - err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerDnsPrototype : The DNS configuration for this load balancer. -// -// If unspecified, DNS `A` records for this load balancer's `hostname` property will be added to the public DNS zone -// `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be added to the specified `zone`. -type LoadBalancerDnsPrototype struct { - // The DNS instance to associate with this load balancer. - // - // The specified instance may be in a different region or account, subject to IAM - // policies. - Instance DnsInstanceIdentityIntf `json:"instance" validate:"required"` - - // The DNS zone to associate with this load balancer. - // - // The specified zone may be in a different region or account, subject to IAM policies. - Zone DnsZoneIdentityIntf `json:"zone" validate:"required"` -} - -// NewLoadBalancerDnsPrototype : Instantiate LoadBalancerDnsPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerDnsPrototype(instance DnsInstanceIdentityIntf, zone DnsZoneIdentityIntf) (_model *LoadBalancerDnsPrototype, err error) { - _model = &LoadBalancerDnsPrototype{ - Instance: instance, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalLoadBalancerDnsPrototype unmarshals an instance of LoadBalancerDnsPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerDnsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerDnsPrototype) - err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerIdentity : Identifies a load balancer by a unique property. -// Models which "extend" this model: -// - LoadBalancerIdentityByID -// - LoadBalancerIdentityByCRN -// - LoadBalancerIdentityByHref -type LoadBalancerIdentity struct { - // The unique identifier for this load balancer. - ID *string `json:"id,omitempty"` - - // The load balancer's CRN. - CRN *string `json:"crn,omitempty"` - - // The load balancer's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerIdentity) isaLoadBalancerIdentity() bool { - return true -} - -type LoadBalancerIdentityIntf interface { - isaLoadBalancerIdentity() bool -} - -// UnmarshalLoadBalancerIdentity unmarshals an instance of LoadBalancerIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListener : LoadBalancerListener struct -type LoadBalancerListener struct { - // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in - // the `application` family (otherwise always `false`). Additional restrictions: - // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must - // match the `accept_proxy_protocol` value of the `https_redirect` listener. - // - If this listener is the target of another listener's `https_redirect`, its - // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. - AcceptProxyProtocol *bool `json:"accept_proxy_protocol" validate:"required"` - - // The certificate instance used for SSL termination. - // - // If absent, this listener is not using a certificate instance. - CertificateInstance *CertificateInstanceReference `json:"certificate_instance,omitempty"` - - // The connection limit of the listener. - ConnectionLimit *int64 `json:"connection_limit,omitempty"` - - // The date and time that this listener was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The default pool for this listener. If absent, this listener has no default pool. - DefaultPool *LoadBalancerPoolReference `json:"default_pool,omitempty"` - - // The listener's canonical URL. - Href *string `json:"href" validate:"required"` - - // If present, the target listener that requests are redirected to. - HTTPSRedirect *LoadBalancerListenerHTTPSRedirect `json:"https_redirect,omitempty"` - - // The unique identifier for this load balancer listener. - ID *string `json:"id" validate:"required"` - - // The idle connection timeout of the listener in seconds. This property will be present for load balancers in the - // `application` family. - IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` - - // The policies for this listener. - Policies []LoadBalancerListenerPolicyReference `json:"policies,omitempty"` - - // The listener port number, or the inclusive lower bound of the port range. - Port *int64 `json:"port" validate:"required"` - - // The inclusive upper bound of the range of ports used by this listener. - // - // At present, only load balancers in the `network` family support more than one port per listener. - PortMax *int64 `json:"port_max" validate:"required"` - - // The inclusive lower bound of the range of ports used by this listener. - // - // At present, only load balancers in the `network` family support more than one port per listener. - PortMin *int64 `json:"port_min" validate:"required"` - - // The listener protocol. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the - // unexpected property value was encountered. - Protocol *string `json:"protocol" validate:"required"` - - // The provisioning status of this listener - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the - // unexpected property value was encountered. - ProvisioningStatus *string `json:"provisioning_status" validate:"required"` -} - -// Constants associated with the LoadBalancerListener.Protocol property. -// The listener protocol. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the -// unexpected property value was encountered. -const ( - LoadBalancerListenerProtocolHTTPConst = "http" - LoadBalancerListenerProtocolHTTPSConst = "https" - LoadBalancerListenerProtocolTCPConst = "tcp" - LoadBalancerListenerProtocolUDPConst = "udp" -) - -// Constants associated with the LoadBalancerListener.ProvisioningStatus property. -// The provisioning status of this listener -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the -// unexpected property value was encountered. -const ( - LoadBalancerListenerProvisioningStatusActiveConst = "active" - LoadBalancerListenerProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerListenerProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerListenerProvisioningStatusFailedConst = "failed" - LoadBalancerListenerProvisioningStatusUpdatePendingConst = "update_pending" -) - -// UnmarshalLoadBalancerListener unmarshals an instance of LoadBalancerListener from the specified map of raw messages. -func UnmarshalLoadBalancerListener(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListener) - err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirect) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) - if err != nil { - return - } - err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicyReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerCollection : LoadBalancerListenerCollection struct -type LoadBalancerListenerCollection struct { - // Collection of listeners. - Listeners []LoadBalancerListener `json:"listeners" validate:"required"` -} - -// UnmarshalLoadBalancerListenerCollection unmarshals an instance of LoadBalancerListenerCollection from the specified map of raw messages. -func UnmarshalLoadBalancerListenerCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerCollection) - err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListener) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerHTTPSRedirect : LoadBalancerListenerHTTPSRedirect struct -type LoadBalancerListenerHTTPSRedirect struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - Listener *LoadBalancerListenerReference `json:"listener" validate:"required"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -// UnmarshalLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerHTTPSRedirect from the specified map of raw messages. -func UnmarshalLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerHTTPSRedirect) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerHTTPSRedirectPatch struct -type LoadBalancerListenerHTTPSRedirectPatch struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -// UnmarshalLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerHTTPSRedirectPatch) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerHTTPSRedirectPrototype struct -type LoadBalancerListenerHTTPSRedirectPrototype struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener" validate:"required"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -// NewLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerHTTPSRedirectPrototype, err error) { - _model = &LoadBalancerListenerHTTPSRedirectPrototype{ - HTTPStatusCode: core.Int64Ptr(httpStatusCode), - Listener: listener, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerHTTPSRedirectPrototype) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerIdentity : Identifies a load balancer listener by a unique property. -// Models which "extend" this model: -// - LoadBalancerListenerIdentityByID -// - LoadBalancerListenerIdentityByHref -type LoadBalancerListenerIdentity struct { - // The unique identifier for this load balancer listener. - ID *string `json:"id,omitempty"` - - // The listener's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerListenerIdentity) isaLoadBalancerListenerIdentity() bool { - return true -} - -type LoadBalancerListenerIdentityIntf interface { - isaLoadBalancerListenerIdentity() bool -} - -// UnmarshalLoadBalancerListenerIdentity unmarshals an instance of LoadBalancerListenerIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerListenerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPatch : LoadBalancerListenerPatch struct -type LoadBalancerListenerPatch struct { - // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in - // the `application` family (otherwise always `false`). Additional restrictions: - // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must - // match the `accept_proxy_protocol` value of the `https_redirect` listener. - // - If this listener is the target of another listener's `https_redirect`, its - // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. - AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` - - // The certificate instance to use for SSL termination. The listener must have a - // `protocol` of `https`. - CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` - - // The connection limit of the listener. - ConnectionLimit *int64 `json:"connection_limit,omitempty"` - - // The default pool for this listener. The specified pool must: - // - // - Belong to this load balancer - // - Have the same `protocol` as this listener, or have a compatible protocol. - // At present, the compatible protocols are `http` and `https`. - // - Not already be the `default_pool` for another listener - // - // Specify `null` to remove an existing default pool. - DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` - - // The target listener that requests will be redirected to. This listener must have a - // `protocol` of `http`, and the target listener must have a `protocol` of `https`. - // - // Specify `null` to remove any existing https redirect. - HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPatch `json:"https_redirect,omitempty"` - - // The idle connection timeout of the listener in seconds. Supported for load balancers in the `application` family. - IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` - - // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must - // have a unique `port` and `protocol` combination. - // - // Not supported for load balancers operating with route mode enabled. - Port *int64 `json:"port,omitempty"` - - // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. - // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `65535` must be specified. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. - // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `1` must be specified. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. - PortMin *int64 `json:"port_min,omitempty"` - - // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. - // - // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the - // `application` family support `tcp`, `http` and - // `https`. - // - // Additional restrictions: - // - If `default_pool` is set, the protocol cannot be changed. - // - If `https_redirect` is set, the protocol must be `http`. - // - If another listener's `https_redirect` targets this listener, the protocol must be - // `https`. - Protocol *string `json:"protocol,omitempty"` -} - -// Constants associated with the LoadBalancerListenerPatch.Protocol property. -// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. -// -// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the -// `application` family support `tcp`, `http` and -// `https`. -// -// Additional restrictions: -// - If `default_pool` is set, the protocol cannot be changed. -// - If `https_redirect` is set, the protocol must be `http`. -// - If another listener's `https_redirect` targets this listener, the protocol must be -// `https`. -const ( - LoadBalancerListenerPatchProtocolHTTPConst = "http" - LoadBalancerListenerPatchProtocolHTTPSConst = "https" - LoadBalancerListenerPatchProtocolTCPConst = "tcp" - LoadBalancerListenerPatchProtocolUDPConst = "udp" -) - -// UnmarshalLoadBalancerListenerPatch unmarshals an instance of LoadBalancerListenerPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPatch) - err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the LoadBalancerListenerPatch -func (loadBalancerListenerPatch *LoadBalancerListenerPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(loadBalancerListenerPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// LoadBalancerListenerPolicy : LoadBalancerListenerPolicy struct -type LoadBalancerListenerPolicy struct { - // The policy action. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the - // unexpected property value was encountered. - Action *string `json:"action" validate:"required"` - - // The date and time that this policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The listener policy's canonical URL. - Href *string `json:"href" validate:"required"` - - // The policy's unique identifier. - ID *string `json:"id" validate:"required"` - - // The name for this load balancer listener policy. The name is unique across all policies for the load balancer - // listener. - Name *string `json:"name" validate:"required"` - - // Priority of the policy. Lower value indicates higher priority. - Priority *int64 `json:"priority" validate:"required"` - - // The provisioning status of this policy - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the - // unexpected property value was encountered. - ProvisioningStatus *string `json:"provisioning_status" validate:"required"` - - // The rules for this policy. - Rules []LoadBalancerListenerPolicyRuleReference `json:"rules" validate:"required"` - - // - If `action` is `forward`, the response is a `LoadBalancerPoolReference` - // - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` - // - If `action` is `https_redirect`, the response is a `LoadBalancerListenerHTTPSRedirect`. - Target LoadBalancerListenerPolicyTargetIntf `json:"target,omitempty"` -} - -// Constants associated with the LoadBalancerListenerPolicy.Action property. -// The policy action. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the -// unexpected property value was encountered. -const ( - LoadBalancerListenerPolicyActionForwardConst = "forward" - LoadBalancerListenerPolicyActionHTTPSRedirectConst = "https_redirect" - LoadBalancerListenerPolicyActionRedirectConst = "redirect" - LoadBalancerListenerPolicyActionRejectConst = "reject" -) - -// Constants associated with the LoadBalancerListenerPolicy.ProvisioningStatus property. -// The provisioning status of this policy -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the -// unexpected property value was encountered. -const ( - LoadBalancerListenerPolicyProvisioningStatusActiveConst = "active" - LoadBalancerListenerPolicyProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerListenerPolicyProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerListenerPolicyProvisioningStatusFailedConst = "failed" - LoadBalancerListenerPolicyProvisioningStatusUpdatePendingConst = "update_pending" -) - -// UnmarshalLoadBalancerListenerPolicy unmarshals an instance of LoadBalancerListenerPolicy from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicy) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) - if err != nil { - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRuleReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTarget) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyCollection : LoadBalancerListenerPolicyCollection struct -type LoadBalancerListenerPolicyCollection struct { - // Collection of policies. - Policies []LoadBalancerListenerPolicy `json:"policies" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyCollection unmarshals an instance of LoadBalancerListenerPolicyCollection from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyCollection) - err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicy) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyPatch : LoadBalancerListenerPolicyPatch struct -type LoadBalancerListenerPolicyPatch struct { - // The name for this policy. The name must not be used by another policy for the load balancer listener. - Name *string `json:"name,omitempty"` - - // Priority of the policy. Lower value indicates higher priority. - Priority *int64 `json:"priority,omitempty"` - - // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. - // - If `action` is `https_redirect`, specify a - // `LoadBalancerListenerPolicyHTTPSRedirectPatch`. - Target LoadBalancerListenerPolicyTargetPatchIntf `json:"target,omitempty"` -} - -// UnmarshalLoadBalancerListenerPolicyPatch unmarshals an instance of LoadBalancerListenerPolicyPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPatch) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the LoadBalancerListenerPolicyPatch -func (loadBalancerListenerPolicyPatch *LoadBalancerListenerPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(loadBalancerListenerPolicyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// LoadBalancerListenerPolicyPrototype : LoadBalancerListenerPolicyPrototype struct -type LoadBalancerListenerPolicyPrototype struct { - // The policy action. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the - // unexpected property value was encountered. - Action *string `json:"action" validate:"required"` - - // The name for this policy. The name must not be used by another policy for the load balancer listener. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // Priority of the policy. Lower value indicates higher priority. - Priority *int64 `json:"priority" validate:"required"` - - // The rule prototype objects for this policy. - Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` - - // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. - // - If `action` is `https_redirect`, specify a - // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. - Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` -} - -// Constants associated with the LoadBalancerListenerPolicyPrototype.Action property. -// The policy action. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the -// unexpected property value was encountered. -const ( - LoadBalancerListenerPolicyPrototypeActionForwardConst = "forward" - LoadBalancerListenerPolicyPrototypeActionHTTPSRedirectConst = "https_redirect" - LoadBalancerListenerPolicyPrototypeActionRedirectConst = "redirect" - LoadBalancerListenerPolicyPrototypeActionRejectConst = "reject" -) - -// NewLoadBalancerListenerPolicyPrototype : Instantiate LoadBalancerListenerPolicyPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyPrototype(action string, priority int64) (_model *LoadBalancerListenerPolicyPrototype, err error) { - _model = &LoadBalancerListenerPolicyPrototype{ - Action: core.StringPtr(action), - Priority: core.Int64Ptr(priority), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalLoadBalancerListenerPolicyPrototype unmarshals an instance of LoadBalancerListenerPolicyPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) - if err != nil { - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRulePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyReference : LoadBalancerListenerPolicyReference struct -type LoadBalancerListenerPolicyReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerListenerPolicyReferenceDeleted `json:"deleted,omitempty"` - - // The listener policy's canonical URL. - Href *string `json:"href" validate:"required"` - - // The policy's unique identifier. - ID *string `json:"id" validate:"required"` - - Name interface{} `json:"name" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyReference unmarshals an instance of LoadBalancerListenerPolicyReference from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerListenerPolicyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyRule : LoadBalancerListenerPolicyRule struct -type LoadBalancerListenerPolicyRule struct { - // The condition of the rule. - Condition *string `json:"condition" validate:"required"` - - // The date and time that this rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The field. This is applicable to `header`, `query`, and `body` rule types. - // - // If the rule type is `header`, this property is required. - // - // If the rule type is `query`, this is optional. If specified and the rule condition is not - // `matches_regex`, the value must be percent-encoded. - // - // If the rule type is `body`, this is optional. - Field *string `json:"field,omitempty"` - - // The rule's canonical URL. - Href *string `json:"href" validate:"required"` - - // The rule's unique identifier. - ID *string `json:"id" validate:"required"` - - // The provisioning status of this rule - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the rule on which the - // unexpected property value was encountered. - ProvisioningStatus *string `json:"provisioning_status" validate:"required"` - - // The type of the rule. - // - // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. - Type *string `json:"type" validate:"required"` - - // Value to be matched for rule condition. - // - // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the LoadBalancerListenerPolicyRule.Condition property. -// The condition of the rule. -const ( - LoadBalancerListenerPolicyRuleConditionContainsConst = "contains" - LoadBalancerListenerPolicyRuleConditionEqualsConst = "equals" - LoadBalancerListenerPolicyRuleConditionMatchesRegexConst = "matches_regex" -) - -// Constants associated with the LoadBalancerListenerPolicyRule.ProvisioningStatus property. -// The provisioning status of this rule -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the rule on which the -// unexpected property value was encountered. -const ( - LoadBalancerListenerPolicyRuleProvisioningStatusActiveConst = "active" - LoadBalancerListenerPolicyRuleProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerListenerPolicyRuleProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerListenerPolicyRuleProvisioningStatusFailedConst = "failed" - LoadBalancerListenerPolicyRuleProvisioningStatusUpdatePendingConst = "update_pending" -) - -// Constants associated with the LoadBalancerListenerPolicyRule.Type property. -// The type of the rule. -// -// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. -const ( - LoadBalancerListenerPolicyRuleTypeBodyConst = "body" - LoadBalancerListenerPolicyRuleTypeHeaderConst = "header" - LoadBalancerListenerPolicyRuleTypeHostnameConst = "hostname" - LoadBalancerListenerPolicyRuleTypePathConst = "path" - LoadBalancerListenerPolicyRuleTypeQueryConst = "query" -) - -// UnmarshalLoadBalancerListenerPolicyRule unmarshals an instance of LoadBalancerListenerPolicyRule from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyRule(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyRule) - err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "field", &obj.Field) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyRuleCollection : LoadBalancerListenerPolicyRuleCollection struct -type LoadBalancerListenerPolicyRuleCollection struct { - // Collection of rules. - Rules []LoadBalancerListenerPolicyRule `json:"rules" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyRuleCollection unmarshals an instance of LoadBalancerListenerPolicyRuleCollection from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyRuleCollection) - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRule) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyRulePatch : LoadBalancerListenerPolicyRulePatch struct -type LoadBalancerListenerPolicyRulePatch struct { - // The condition of the rule. - Condition *string `json:"condition,omitempty"` - - // The field. This is applicable to `header`, `query`, and `body` rule types. - // - // If the rule type is `header`, this property is required. - // - // If the rule type is `query`, this is optional. If specified and the rule condition is not - // `matches_regex`, the value must be percent-encoded. - // - // If the rule type is `body`, this is optional. - Field *string `json:"field,omitempty"` - - // The type of the rule. - // - // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. - Type *string `json:"type,omitempty"` - - // Value to be matched for rule condition. - // - // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. - Value *string `json:"value,omitempty"` -} - -// Constants associated with the LoadBalancerListenerPolicyRulePatch.Condition property. -// The condition of the rule. -const ( - LoadBalancerListenerPolicyRulePatchConditionContainsConst = "contains" - LoadBalancerListenerPolicyRulePatchConditionEqualsConst = "equals" - LoadBalancerListenerPolicyRulePatchConditionMatchesRegexConst = "matches_regex" -) - -// Constants associated with the LoadBalancerListenerPolicyRulePatch.Type property. -// The type of the rule. -// -// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. -const ( - LoadBalancerListenerPolicyRulePatchTypeBodyConst = "body" - LoadBalancerListenerPolicyRulePatchTypeHeaderConst = "header" - LoadBalancerListenerPolicyRulePatchTypeHostnameConst = "hostname" - LoadBalancerListenerPolicyRulePatchTypePathConst = "path" - LoadBalancerListenerPolicyRulePatchTypeQueryConst = "query" -) - -// UnmarshalLoadBalancerListenerPolicyRulePatch unmarshals an instance of LoadBalancerListenerPolicyRulePatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyRulePatch) - err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "field", &obj.Field) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the LoadBalancerListenerPolicyRulePatch -func (loadBalancerListenerPolicyRulePatch *LoadBalancerListenerPolicyRulePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(loadBalancerListenerPolicyRulePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// LoadBalancerListenerPolicyRulePrototype : LoadBalancerListenerPolicyRulePrototype struct -type LoadBalancerListenerPolicyRulePrototype struct { - // The condition of the rule. - Condition *string `json:"condition" validate:"required"` - - // The field. This is applicable to `header`, `query`, and `body` rule types. - // - // If the rule type is `header`, this property is required. - // - // If the rule type is `query`, this is optional. If specified and the rule condition is not - // `matches_regex`, the value must be percent-encoded. - // - // If the rule type is `body`, this is optional. - Field *string `json:"field,omitempty"` - - // The type of the rule. - // - // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. - Type *string `json:"type" validate:"required"` - - // Value to be matched for rule condition. - // - // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Condition property. -// The condition of the rule. -const ( - LoadBalancerListenerPolicyRulePrototypeConditionContainsConst = "contains" - LoadBalancerListenerPolicyRulePrototypeConditionEqualsConst = "equals" - LoadBalancerListenerPolicyRulePrototypeConditionMatchesRegexConst = "matches_regex" -) - -// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Type property. -// The type of the rule. -// -// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. -const ( - LoadBalancerListenerPolicyRulePrototypeTypeBodyConst = "body" - LoadBalancerListenerPolicyRulePrototypeTypeHeaderConst = "header" - LoadBalancerListenerPolicyRulePrototypeTypeHostnameConst = "hostname" - LoadBalancerListenerPolicyRulePrototypeTypePathConst = "path" - LoadBalancerListenerPolicyRulePrototypeTypeQueryConst = "query" -) - -// NewLoadBalancerListenerPolicyRulePrototype : Instantiate LoadBalancerListenerPolicyRulePrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyRulePrototype(condition string, typeVar string, value string) (_model *LoadBalancerListenerPolicyRulePrototype, err error) { - _model = &LoadBalancerListenerPolicyRulePrototype{ - Condition: core.StringPtr(condition), - Type: core.StringPtr(typeVar), - Value: core.StringPtr(value), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalLoadBalancerListenerPolicyRulePrototype unmarshals an instance of LoadBalancerListenerPolicyRulePrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyRulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyRulePrototype) - err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "field", &obj.Field) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyRuleReference : LoadBalancerListenerPolicyRuleReference struct -type LoadBalancerListenerPolicyRuleReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerListenerPolicyRuleReferenceDeleted `json:"deleted,omitempty"` - - // The rule's canonical URL. - Href *string `json:"href" validate:"required"` - - // The rule's unique identifier. - ID *string `json:"id" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyRuleReference unmarshals an instance of LoadBalancerListenerPolicyRuleReference from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyRuleReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerListenerPolicyRuleReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyRuleReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyRuleReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTarget : - If `action` is `forward`, the response is a `LoadBalancerPoolReference` -// - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` -// - If `action` is `https_redirect`, the response is a `LoadBalancerListenerHTTPSRedirect`. -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetLoadBalancerPoolReference -// - LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL -// - LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect -type LoadBalancerListenerPolicyTarget struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` - - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The name for this load balancer pool. The name is unique across all pools for the load balancer. - Name *string `json:"name,omitempty"` - - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // The redirect target URL. - URL *string `json:"url,omitempty"` - - Listener *LoadBalancerListenerReference `json:"listener,omitempty"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -func (*LoadBalancerListenerPolicyTarget) isaLoadBalancerListenerPolicyTarget() bool { - return true -} - -type LoadBalancerListenerPolicyTargetIntf interface { - isaLoadBalancerListenerPolicyTarget() bool -} - -// UnmarshalLoadBalancerListenerPolicyTarget unmarshals an instance of LoadBalancerListenerPolicyTarget from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPatch : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. -// - If `action` is `https_redirect`, specify a -// `LoadBalancerListenerPolicyHTTPSRedirectPatch`. -// -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch -type LoadBalancerListenerPolicyTargetPatch struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` - - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // The redirect target URL. - URL *string `json:"url,omitempty"` - - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -type LoadBalancerListenerPolicyTargetPatchIntf interface { - isaLoadBalancerListenerPolicyTargetPatch() bool -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPrototype : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. -// - If `action` is `https_redirect`, specify a -// `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. -// -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype -type LoadBalancerListenerPolicyTargetPrototype struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` - - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // The redirect target URL. - URL *string `json:"url,omitempty"` - - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -type LoadBalancerListenerPolicyTargetPrototypeIntf interface { - isaLoadBalancerListenerPolicyTargetPrototype() bool -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPrototypeLoadBalancerContext : LoadBalancerListenerPrototypeLoadBalancerContext struct -type LoadBalancerListenerPrototypeLoadBalancerContext struct { - // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in - // the `application` family (otherwise always `false`). Additional restrictions: - // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must - // match the `accept_proxy_protocol` value of the `https_redirect` listener. - // - If this listener is the target of another listener's `https_redirect`, its - // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. - AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` - - // The certificate instance to use for SSL termination. The listener must have a - // `protocol` of `https`. - CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` - - // The connection limit of the listener. - ConnectionLimit *int64 `json:"connection_limit,omitempty"` - - // The default pool for this listener. If specified, the pool must: - // - Belong to this load balancer. - // - Have the same `protocol` as this listener, or have a compatible protocol. - // At present, the compatible protocols are `http` and `https`. - // - Not already be the `default_pool` for another listener. - // - // If unspecified, this listener will be created with no default pool, but one may be - // subsequently set. - DefaultPool *LoadBalancerPoolIdentityByName `json:"default_pool,omitempty"` - - // The target listener that requests will be redirected to. This listener must have a - // `protocol` of `http`, and the target listener must have a `protocol` of `https`. - HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPrototype `json:"https_redirect,omitempty"` - - // The idle connection timeout of the listener in seconds. Supported for load balancers in the `application` family. - IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` - - // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must - // have a unique `port` and `protocol` combination. - // - // Not supported for load balancers operating with route mode enabled. - Port *int64 `json:"port,omitempty"` - - // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. - // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `65535` must be specified. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. - // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `1` must be specified. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. - PortMin *int64 `json:"port_min,omitempty"` - - // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. - // - // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the - // `application` family support `tcp`, `http` and - // `https`. - // - // Additional restrictions: - // - If `default_pool` is set, the pool's protocol must match, or be compatible with - // the listener's protocol. At present, the compatible protocols are `http` and - // `https`. - // - If `https_redirect` is set, the protocol must be `http`. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the LoadBalancerListenerPrototypeLoadBalancerContext.Protocol property. -// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. -// -// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the -// `application` family support `tcp`, `http` and -// `https`. -// -// Additional restrictions: -// - If `default_pool` is set, the pool's protocol must match, or be compatible with -// the listener's protocol. At present, the compatible protocols are `http` and -// `https`. -// - If `https_redirect` is set, the protocol must be `http`. -const ( - LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPConst = "http" - LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPSConst = "https" - LoadBalancerListenerPrototypeLoadBalancerContextProtocolTCPConst = "tcp" - LoadBalancerListenerPrototypeLoadBalancerContextProtocolUDPConst = "udp" -) - -// NewLoadBalancerListenerPrototypeLoadBalancerContext : Instantiate LoadBalancerListenerPrototypeLoadBalancerContext (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPrototypeLoadBalancerContext(protocol string) (_model *LoadBalancerListenerPrototypeLoadBalancerContext, err error) { - _model = &LoadBalancerListenerPrototypeLoadBalancerContext{ - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext unmarshals an instance of LoadBalancerListenerPrototypeLoadBalancerContext from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPrototypeLoadBalancerContext) - err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentityByName) - if err != nil { - return - } - err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerReference : LoadBalancerListenerReference struct -type LoadBalancerListenerReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerListenerReferenceDeleted `json:"deleted,omitempty"` - - // The listener's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer listener. - ID *string `json:"id" validate:"required"` -} - -// UnmarshalLoadBalancerListenerReference unmarshals an instance of LoadBalancerListenerReference from the specified map of raw messages. -func UnmarshalLoadBalancerListenerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerListenerReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerListenerReferenceDeleted unmarshals an instance of LoadBalancerListenerReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerListenerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerLogging : LoadBalancerLogging struct -type LoadBalancerLogging struct { - // The datapath logging configuration for this load balancer. - Datapath *LoadBalancerLoggingDatapath `json:"datapath" validate:"required"` -} - -// UnmarshalLoadBalancerLogging unmarshals an instance of LoadBalancerLogging from the specified map of raw messages. -func UnmarshalLoadBalancerLogging(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerLogging) - err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapath) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerLoggingDatapath : The datapath logging configuration for this load balancer. -type LoadBalancerLoggingDatapath struct { - // Indicates whether datapath logging is active for this load balancer. - Active *bool `json:"active" validate:"required"` -} - -// UnmarshalLoadBalancerLoggingDatapath unmarshals an instance of LoadBalancerLoggingDatapath from the specified map of raw messages. -func UnmarshalLoadBalancerLoggingDatapath(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerLoggingDatapath) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerLoggingDatapathPatch : The datapath logging configuration for this load balancer. -type LoadBalancerLoggingDatapathPatch struct { - // Indicates whether datapath logging will be active for this load balancer. - Active *bool `json:"active,omitempty"` -} - -// UnmarshalLoadBalancerLoggingDatapathPatch unmarshals an instance of LoadBalancerLoggingDatapathPatch from the specified map of raw messages. -func UnmarshalLoadBalancerLoggingDatapathPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerLoggingDatapathPatch) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerLoggingDatapathPrototype : The datapath logging configuration for this load balancer. -type LoadBalancerLoggingDatapathPrototype struct { - // Indicates whether datapath logging will be active for this load balancer. - Active *bool `json:"active,omitempty"` -} - -// UnmarshalLoadBalancerLoggingDatapathPrototype unmarshals an instance of LoadBalancerLoggingDatapathPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerLoggingDatapathPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerLoggingDatapathPrototype) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerLoggingPatch : LoadBalancerLoggingPatch struct -type LoadBalancerLoggingPatch struct { - // The datapath logging configuration for this load balancer. - Datapath *LoadBalancerLoggingDatapathPatch `json:"datapath,omitempty"` -} - -// UnmarshalLoadBalancerLoggingPatch unmarshals an instance of LoadBalancerLoggingPatch from the specified map of raw messages. -func UnmarshalLoadBalancerLoggingPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerLoggingPatch) - err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPatch) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerLoggingPrototype : LoadBalancerLoggingPrototype struct -type LoadBalancerLoggingPrototype struct { - // The datapath logging configuration for this load balancer. - Datapath *LoadBalancerLoggingDatapathPrototype `json:"datapath,omitempty"` -} - -// UnmarshalLoadBalancerLoggingPrototype unmarshals an instance of LoadBalancerLoggingPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerLoggingPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerLoggingPrototype) - err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPatch : LoadBalancerPatch struct -type LoadBalancerPatch struct { - // The DNS configuration for this load balancer. - // - // Specify `null` to remove the existing DNS configuration, which will remove all DNS `A` - // records for this load balancer that had been added to `zone`, and add equivalent `A` - // records to the public DNS zone `lb.appdomain.cloud`. - Dns *LoadBalancerDnsPatch `json:"dns,omitempty"` - - // The logging configuration to use for this load balancer. - // - // To activate logging, the load balancer profile must support the specified logging type. - Logging *LoadBalancerLoggingPatch `json:"logging,omitempty"` - - // The name for this load balancer. The name must not be used by another load balancer in the VPC. - Name *string `json:"name,omitempty"` - - // The subnets to provision this load balancer in. The load balancer's availability will depend on the availability of - // the zones that the subnets reside in. - // - // The specified subnets must be in the same VPC as the existing subnets, and will completely replace the existing - // subnets. - // - // The load balancer must be in the `application` family. - Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` -} - -// UnmarshalLoadBalancerPatch unmarshals an instance of LoadBalancerPatch from the specified map of raw messages. -func UnmarshalLoadBalancerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPatch) - err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalLoadBalancerDnsPatch) - if err != nil { - return - } - err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLoggingPatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the LoadBalancerPatch -func (loadBalancerPatch *LoadBalancerPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(loadBalancerPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// LoadBalancerPool : LoadBalancerPool struct -type LoadBalancerPool struct { - // The load balancing algorithm. - Algorithm *string `json:"algorithm" validate:"required"` - - // The date and time that this pool was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The health monitor of this pool. - HealthMonitor *LoadBalancerPoolHealthMonitor `json:"health_monitor" validate:"required"` - - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` - - // The instance group that is managing this pool. - InstanceGroup *InstanceGroupReference `json:"instance_group,omitempty"` - - // The backend server members of the pool. - Members []LoadBalancerPoolMemberReference `json:"members,omitempty"` - - // The name for this load balancer pool. The name is unique across all pools for the load balancer. - Name *string `json:"name" validate:"required"` - - // The protocol for this load balancer pool. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the - // unexpected property value was encountered. - Protocol *string `json:"protocol" validate:"required"` - - // The provisioning status of this pool - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the - // unexpected property value was encountered. - ProvisioningStatus *string `json:"provisioning_status" validate:"required"` - - // The PROXY protocol setting for this pool: - // - `v1`: Enabled with version 1 (human-readable header format) - // - `v2`: Enabled with version 2 (binary header format) - // - `disabled`: Disabled - // - // Supported by load balancers in the `application` family (otherwise always `disabled`). - ProxyProtocol *string `json:"proxy_protocol" validate:"required"` - - // The session persistence of this pool. - // - // The enumerated values for this property are expected to expand in the future. When - // processing this property, check for and log unknown values. Optionally halt - // processing and surface the error, or bypass the pool on which the unexpected - // property value was encountered. - SessionPersistence *LoadBalancerPoolSessionPersistence `json:"session_persistence,omitempty"` -} - -// Constants associated with the LoadBalancerPool.Algorithm property. -// The load balancing algorithm. -const ( - LoadBalancerPoolAlgorithmLeastConnectionsConst = "least_connections" - LoadBalancerPoolAlgorithmRoundRobinConst = "round_robin" - LoadBalancerPoolAlgorithmWeightedRoundRobinConst = "weighted_round_robin" -) - -// Constants associated with the LoadBalancerPool.Protocol property. -// The protocol for this load balancer pool. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the -// unexpected property value was encountered. -const ( - LoadBalancerPoolProtocolHTTPConst = "http" - LoadBalancerPoolProtocolHTTPSConst = "https" - LoadBalancerPoolProtocolTCPConst = "tcp" - LoadBalancerPoolProtocolUDPConst = "udp" -) - -// Constants associated with the LoadBalancerPool.ProvisioningStatus property. -// The provisioning status of this pool -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the -// unexpected property value was encountered. -const ( - LoadBalancerPoolProvisioningStatusActiveConst = "active" - LoadBalancerPoolProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerPoolProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerPoolProvisioningStatusFailedConst = "failed" - LoadBalancerPoolProvisioningStatusUpdatePendingConst = "update_pending" -) - -// Constants associated with the LoadBalancerPool.ProxyProtocol property. -// The PROXY protocol setting for this pool: -// - `v1`: Enabled with version 1 (human-readable header format) -// - `v2`: Enabled with version 2 (binary header format) -// - `disabled`: Disabled -// -// Supported by load balancers in the `application` family (otherwise always `disabled`). -const ( - LoadBalancerPoolProxyProtocolDisabledConst = "disabled" - LoadBalancerPoolProxyProtocolV1Const = "v1" - LoadBalancerPoolProxyProtocolV2Const = "v2" -) - -// UnmarshalLoadBalancerPool unmarshals an instance of LoadBalancerPool from the specified map of raw messages. -func UnmarshalLoadBalancerPool(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPool) - err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitor) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "instance_group", &obj.InstanceGroup, UnmarshalInstanceGroupReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistence) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolCollection : LoadBalancerPoolCollection struct -type LoadBalancerPoolCollection struct { - // Collection of pools. - Pools []LoadBalancerPool `json:"pools" validate:"required"` -} - -// UnmarshalLoadBalancerPoolCollection unmarshals an instance of LoadBalancerPoolCollection from the specified map of raw messages. -func UnmarshalLoadBalancerPoolCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolCollection) - err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPool) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolHealthMonitor : LoadBalancerPoolHealthMonitor struct -type LoadBalancerPoolHealthMonitor struct { - // The seconds to wait between health checks. - Delay *int64 `json:"delay" validate:"required"` - - // The health check max retries. - MaxRetries *int64 `json:"max_retries" validate:"required"` - - // The health check port. - // - // If present, this overrides the pool member port values. - Port *int64 `json:"port,omitempty"` - - // The seconds to wait for a response to a health check. - Timeout *int64 `json:"timeout" validate:"required"` - - // The protocol type to use for health checks. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which - // the unexpected property value was encountered. - Type *string `json:"type" validate:"required"` - - // The health check URL path. Applicable when `type` is `http` or `https`. - // - // Must be in the format of an [origin-form request target](https://tools.ietf.org/html/rfc7230#section-5.3.1). - URLPath *string `json:"url_path,omitempty"` -} - -// Constants associated with the LoadBalancerPoolHealthMonitor.Type property. -// The protocol type to use for health checks. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which -// the unexpected property value was encountered. -const ( - LoadBalancerPoolHealthMonitorTypeHTTPConst = "http" - LoadBalancerPoolHealthMonitorTypeHTTPSConst = "https" - LoadBalancerPoolHealthMonitorTypeTCPConst = "tcp" -) - -// UnmarshalLoadBalancerPoolHealthMonitor unmarshals an instance of LoadBalancerPoolHealthMonitor from the specified map of raw messages. -func UnmarshalLoadBalancerPoolHealthMonitor(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolHealthMonitor) - err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolHealthMonitorPatch : LoadBalancerPoolHealthMonitorPatch struct -type LoadBalancerPoolHealthMonitorPatch struct { - // The seconds to wait between health checks. Must be greater than `timeout`. - Delay *int64 `json:"delay" validate:"required"` - - // The health check max retries. - MaxRetries *int64 `json:"max_retries" validate:"required"` - - // The health check port. - // - // If set, this overrides the pool member port values. - // - // Specify `null` to remove an existing health check port. - Port *int64 `json:"port,omitempty"` - - // The seconds to wait for a response to a health check. Must be less than `delay`. - Timeout *int64 `json:"timeout" validate:"required"` - - // The protocol type to use for health checks. - Type *string `json:"type" validate:"required"` - - // The health check URL path. Applicable when `type` is `http` or `https`. - // - // Must be in the format of an [origin-form request target](https://tools.ietf.org/html/rfc7230#section-5.3.1). - URLPath *string `json:"url_path,omitempty"` -} - -// Constants associated with the LoadBalancerPoolHealthMonitorPatch.Type property. -// The protocol type to use for health checks. -const ( - LoadBalancerPoolHealthMonitorPatchTypeHTTPConst = "http" - LoadBalancerPoolHealthMonitorPatchTypeHTTPSConst = "https" - LoadBalancerPoolHealthMonitorPatchTypeTCPConst = "tcp" -) - -// NewLoadBalancerPoolHealthMonitorPatch : Instantiate LoadBalancerPoolHealthMonitorPatch (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolHealthMonitorPatch(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPatch, err error) { - _model = &LoadBalancerPoolHealthMonitorPatch{ - Delay: core.Int64Ptr(delay), - MaxRetries: core.Int64Ptr(maxRetries), - Timeout: core.Int64Ptr(timeout), - Type: core.StringPtr(typeVar), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalLoadBalancerPoolHealthMonitorPatch unmarshals an instance of LoadBalancerPoolHealthMonitorPatch from the specified map of raw messages. -func UnmarshalLoadBalancerPoolHealthMonitorPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolHealthMonitorPatch) - err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolHealthMonitorPrototype : LoadBalancerPoolHealthMonitorPrototype struct -type LoadBalancerPoolHealthMonitorPrototype struct { - // The seconds to wait between health checks. Must be greater than `timeout`. - Delay *int64 `json:"delay" validate:"required"` - - // The health check max retries. - MaxRetries *int64 `json:"max_retries" validate:"required"` - - // The health check port. - // - // If specified, this overrides the pool member port values. - Port *int64 `json:"port,omitempty"` - - // The seconds to wait for a response to a health check. Must be less than `delay`. - Timeout *int64 `json:"timeout" validate:"required"` - - // The protocol type to use for health checks. - Type *string `json:"type" validate:"required"` - - // The health check URL path. Applicable when `type` is `http` or `https`. - // - // Must be in the format of an [origin-form request target](https://tools.ietf.org/html/rfc7230#section-5.3.1). - URLPath *string `json:"url_path,omitempty"` -} - -// Constants associated with the LoadBalancerPoolHealthMonitorPrototype.Type property. -// The protocol type to use for health checks. -const ( - LoadBalancerPoolHealthMonitorPrototypeTypeHTTPConst = "http" - LoadBalancerPoolHealthMonitorPrototypeTypeHTTPSConst = "https" - LoadBalancerPoolHealthMonitorPrototypeTypeTCPConst = "tcp" -) - -// NewLoadBalancerPoolHealthMonitorPrototype : Instantiate LoadBalancerPoolHealthMonitorPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolHealthMonitorPrototype(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPrototype, err error) { - _model = &LoadBalancerPoolHealthMonitorPrototype{ - Delay: core.Int64Ptr(delay), - MaxRetries: core.Int64Ptr(maxRetries), - Timeout: core.Int64Ptr(timeout), - Type: core.StringPtr(typeVar), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalLoadBalancerPoolHealthMonitorPrototype unmarshals an instance of LoadBalancerPoolHealthMonitorPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolHealthMonitorPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolHealthMonitorPrototype) - err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. -// Models which "extend" this model: -// - LoadBalancerPoolIdentityByID -// - LoadBalancerPoolIdentityByHref -type LoadBalancerPoolIdentity struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerPoolIdentity) isaLoadBalancerPoolIdentity() bool { - return true -} - -type LoadBalancerPoolIdentityIntf interface { - isaLoadBalancerPoolIdentity() bool -} - -// UnmarshalLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerPoolIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolIdentityByName : LoadBalancerPoolIdentityByName struct -type LoadBalancerPoolIdentityByName struct { - // The name for this load balancer pool. The name is unique across all pools for the load balancer. - Name *string `json:"name" validate:"required"` -} - -// NewLoadBalancerPoolIdentityByName : Instantiate LoadBalancerPoolIdentityByName (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolIdentityByName(name string) (_model *LoadBalancerPoolIdentityByName, err error) { - _model = &LoadBalancerPoolIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalLoadBalancerPoolIdentityByName unmarshals an instance of LoadBalancerPoolIdentityByName from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMember : LoadBalancerPoolMember struct -type LoadBalancerPoolMember struct { - // The date and time that this member was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // Health of the server member in the pool. - Health *string `json:"health" validate:"required"` - - // The member's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer pool member. - ID *string `json:"id" validate:"required"` - - // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a - // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive - // the traffic on the same port the listener received it on.) - // - // This port will also be used for health checks unless the `port` property of - // `health_monitor` property is specified. - Port *int64 `json:"port" validate:"required"` - - // The provisioning status of this member - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool member on which the - // unexpected property value was encountered. - ProvisioningStatus *string `json:"provisioning_status" validate:"required"` - - // The pool member target. Load balancers in the `network` family support virtual server - // instances. Load balancers in the `application` family support IP addresses. If the load - // balancer has route mode enabled, the member must be in a zone the load balancer has a - // subnet in. - Target LoadBalancerPoolMemberTargetIntf `json:"target" validate:"required"` - - // Weight of the server member. Applicable only if the pool algorithm is - // `weighted_round_robin`. - Weight *int64 `json:"weight,omitempty"` -} - -// Constants associated with the LoadBalancerPoolMember.Health property. -// Health of the server member in the pool. -const ( - LoadBalancerPoolMemberHealthFaultedConst = "faulted" - LoadBalancerPoolMemberHealthOkConst = "ok" - LoadBalancerPoolMemberHealthUnknownConst = "unknown" -) - -// Constants associated with the LoadBalancerPoolMember.ProvisioningStatus property. -// The provisioning status of this member -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool member on which the -// unexpected property value was encountered. -const ( - LoadBalancerPoolMemberProvisioningStatusActiveConst = "active" - LoadBalancerPoolMemberProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerPoolMemberProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerPoolMemberProvisioningStatusFailedConst = "failed" - LoadBalancerPoolMemberProvisioningStatusUpdatePendingConst = "update_pending" -) - -// UnmarshalLoadBalancerPoolMember unmarshals an instance of LoadBalancerPoolMember from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMember(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMember) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "health", &obj.Health) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTarget) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberCollection : LoadBalancerPoolMemberCollection struct -type LoadBalancerPoolMemberCollection struct { - // Collection of members. - Members []LoadBalancerPoolMember `json:"members" validate:"required"` -} - -// UnmarshalLoadBalancerPoolMemberCollection unmarshals an instance of LoadBalancerPoolMemberCollection from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberCollection) - err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMember) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberPatch : LoadBalancerPoolMemberPatch struct -type LoadBalancerPoolMemberPatch struct { - // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a - // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive - // the traffic on the same port the listener received it on.) - // - // This port will also be used for health checks unless the `port` property of - // `health_monitor` property is specified. - // - // The port must be unique across all members for all pools associated with this pool's listener. - Port *int64 `json:"port,omitempty"` - - // The pool member target. Load balancers in the `network` family support virtual server - // instances. Load balancers in the `application` family support IP addresses. If the load - // balancer has route mode enabled, the member must be in a zone the load balancer has a - // subnet in. - Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target,omitempty"` - - // Weight of the server member. Applicable only if the pool algorithm is - // `weighted_round_robin`. - Weight *int64 `json:"weight,omitempty"` -} - -// UnmarshalLoadBalancerPoolMemberPatch unmarshals an instance of LoadBalancerPoolMemberPatch from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberPatch) - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the LoadBalancerPoolMemberPatch -func (loadBalancerPoolMemberPatch *LoadBalancerPoolMemberPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(loadBalancerPoolMemberPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// LoadBalancerPoolMemberPrototype : LoadBalancerPoolMemberPrototype struct -type LoadBalancerPoolMemberPrototype struct { - // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a - // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive - // the traffic on the same port the listener received it on.) - // - // This port will also be used for health checks unless the `port` property of - // `health_monitor` property is specified. - // - // The port must be unique across all members for all pools associated with this pool's listener. - Port *int64 `json:"port" validate:"required"` - - // The pool member target. Load balancers in the `network` family support virtual server - // instances. Load balancers in the `application` family support IP addresses. If the load - // balancer has route mode enabled, the member must be in a zone the load balancer has a - // subnet in. - Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` - - // Weight of the server member. Applicable only if the pool algorithm is - // `weighted_round_robin`. - Weight *int64 `json:"weight,omitempty"` -} - -// NewLoadBalancerPoolMemberPrototype : Instantiate LoadBalancerPoolMemberPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberPrototype(port int64, target LoadBalancerPoolMemberTargetPrototypeIntf) (_model *LoadBalancerPoolMemberPrototype, err error) { - _model = &LoadBalancerPoolMemberPrototype{ - Port: core.Int64Ptr(port), - Target: target, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalLoadBalancerPoolMemberPrototype unmarshals an instance of LoadBalancerPoolMemberPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberPrototype) - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberReference : LoadBalancerPoolMemberReference struct -type LoadBalancerPoolMemberReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerPoolMemberReferenceDeleted `json:"deleted,omitempty"` - - // The member's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer pool member. - ID *string `json:"id" validate:"required"` -} - -// UnmarshalLoadBalancerPoolMemberReference unmarshals an instance of LoadBalancerPoolMemberReference from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolMemberReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerPoolMemberReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerPoolMemberReferenceDeleted unmarshals an instance of LoadBalancerPoolMemberReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTarget : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in -// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a -// zone the load balancer has a subnet in. -// Models which "extend" this model: -// - LoadBalancerPoolMemberTargetInstanceReference -// - LoadBalancerPoolMemberTargetIP -type LoadBalancerPoolMemberTarget struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href,omitempty"` - - // The unique identifier for this virtual server instance. - ID *string `json:"id,omitempty"` - - // The name for this virtual server instance. The name is unique across all virtual server instances in the region. - Name *string `json:"name,omitempty"` - - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` -} - -func (*LoadBalancerPoolMemberTarget) isaLoadBalancerPoolMemberTarget() bool { - return true -} - -type LoadBalancerPoolMemberTargetIntf interface { - isaLoadBalancerPoolMemberTarget() bool -} - -// UnmarshalLoadBalancerPoolMemberTarget unmarshals an instance of LoadBalancerPoolMemberTarget from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTarget) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTargetPrototype : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in -// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a -// zone the load balancer has a subnet in. -// Models which "extend" this model: -// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentity -// - LoadBalancerPoolMemberTargetPrototypeIP -type LoadBalancerPoolMemberTargetPrototype struct { - // The unique identifier for this virtual server instance. - ID *string `json:"id,omitempty"` - - // The CRN for this virtual server instance. - CRN *string `json:"crn,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href,omitempty"` - - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` -} - -func (*LoadBalancerPoolMemberTargetPrototype) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -type LoadBalancerPoolMemberTargetPrototypeIntf interface { - isaLoadBalancerPoolMemberTargetPrototype() bool -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototype unmarshals an instance of LoadBalancerPoolMemberTargetPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolPatch : LoadBalancerPoolPatch struct -type LoadBalancerPoolPatch struct { - // The load balancing algorithm. - Algorithm *string `json:"algorithm,omitempty"` - - // The health monitor of this pool. - HealthMonitor *LoadBalancerPoolHealthMonitorPatch `json:"health_monitor,omitempty"` - - // The name for this load balancer pool. The name must not be used by another pool for the load balancer. - Name *string `json:"name,omitempty"` - - // The protocol for this load balancer pool. - // - // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the - // `application` family support `tcp`, `http` and - // `https`. - // - // If this pool is associated with a load balancer listener, the specified protocol must match, or be compatible with - // the listener's protocol. At present, the compatible protocols are `http` and `https`. - Protocol *string `json:"protocol,omitempty"` - - // The PROXY protocol setting for this pool: - // - `v1`: Enabled with version 1 (human-readable header format) - // - `v2`: Enabled with version 2 (binary header format) - // - `disabled`: Disabled - // - // Supported by load balancers in the `application` family (otherwise always `disabled`). - ProxyProtocol *string `json:"proxy_protocol,omitempty"` - - // The session persistence of this pool. - SessionPersistence *LoadBalancerPoolSessionPersistencePatch `json:"session_persistence,omitempty"` -} - -// Constants associated with the LoadBalancerPoolPatch.Algorithm property. -// The load balancing algorithm. -const ( - LoadBalancerPoolPatchAlgorithmLeastConnectionsConst = "least_connections" - LoadBalancerPoolPatchAlgorithmRoundRobinConst = "round_robin" - LoadBalancerPoolPatchAlgorithmWeightedRoundRobinConst = "weighted_round_robin" -) - -// Constants associated with the LoadBalancerPoolPatch.Protocol property. -// The protocol for this load balancer pool. -// -// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the -// `application` family support `tcp`, `http` and -// `https`. -// -// If this pool is associated with a load balancer listener, the specified protocol must match, or be compatible with -// the listener's protocol. At present, the compatible protocols are `http` and `https`. -const ( - LoadBalancerPoolPatchProtocolHTTPConst = "http" - LoadBalancerPoolPatchProtocolHTTPSConst = "https" - LoadBalancerPoolPatchProtocolTCPConst = "tcp" - LoadBalancerPoolPatchProtocolUDPConst = "udp" -) - -// Constants associated with the LoadBalancerPoolPatch.ProxyProtocol property. -// The PROXY protocol setting for this pool: -// - `v1`: Enabled with version 1 (human-readable header format) -// - `v2`: Enabled with version 2 (binary header format) -// - `disabled`: Disabled -// -// Supported by load balancers in the `application` family (otherwise always `disabled`). -const ( - LoadBalancerPoolPatchProxyProtocolDisabledConst = "disabled" - LoadBalancerPoolPatchProxyProtocolV1Const = "v1" - LoadBalancerPoolPatchProxyProtocolV2Const = "v2" -) - -// UnmarshalLoadBalancerPoolPatch unmarshals an instance of LoadBalancerPoolPatch from the specified map of raw messages. -func UnmarshalLoadBalancerPoolPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolPatch) - err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) - if err != nil { - return - } - err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePatch) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the LoadBalancerPoolPatch -func (loadBalancerPoolPatch *LoadBalancerPoolPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(loadBalancerPoolPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// LoadBalancerPoolPrototype : LoadBalancerPoolPrototype struct -type LoadBalancerPoolPrototype struct { - // The load balancing algorithm. - Algorithm *string `json:"algorithm" validate:"required"` - - // The health monitor of this pool. - HealthMonitor *LoadBalancerPoolHealthMonitorPrototype `json:"health_monitor" validate:"required"` - - // The members for this load balancer pool. For load balancers in the `network` family, the same `port` and `target` - // tuple cannot be shared by a pool member of any other load balancer in the same VPC. - Members []LoadBalancerPoolMemberPrototype `json:"members,omitempty"` - - // The name for this load balancer pool. The name must not be used by another pool for the load balancer. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if - // `udp_supported` is `true`). Load balancers in the - // `application` family support `tcp`, `http`, and `https`. - Protocol *string `json:"protocol" validate:"required"` - - // The PROXY protocol setting for this pool: - // - `v1`: Enabled with version 1 (human-readable header format) - // - `v2`: Enabled with version 2 (binary header format) - // - `disabled`: Disabled - // - // Supported by load balancers in the `application` family (otherwise always `disabled`). - ProxyProtocol *string `json:"proxy_protocol,omitempty"` - - // The session persistence of this pool. - SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` -} - -// Constants associated with the LoadBalancerPoolPrototype.Algorithm property. -// The load balancing algorithm. -const ( - LoadBalancerPoolPrototypeAlgorithmLeastConnectionsConst = "least_connections" - LoadBalancerPoolPrototypeAlgorithmRoundRobinConst = "round_robin" - LoadBalancerPoolPrototypeAlgorithmWeightedRoundRobinConst = "weighted_round_robin" -) - -// Constants associated with the LoadBalancerPoolPrototype.Protocol property. -// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if -// `udp_supported` is `true`). Load balancers in the -// `application` family support `tcp`, `http`, and `https`. -const ( - LoadBalancerPoolPrototypeProtocolHTTPConst = "http" - LoadBalancerPoolPrototypeProtocolHTTPSConst = "https" - LoadBalancerPoolPrototypeProtocolTCPConst = "tcp" - LoadBalancerPoolPrototypeProtocolUDPConst = "udp" -) - -// Constants associated with the LoadBalancerPoolPrototype.ProxyProtocol property. -// The PROXY protocol setting for this pool: -// - `v1`: Enabled with version 1 (human-readable header format) -// - `v2`: Enabled with version 2 (binary header format) -// - `disabled`: Disabled -// -// Supported by load balancers in the `application` family (otherwise always `disabled`). -const ( - LoadBalancerPoolPrototypeProxyProtocolDisabledConst = "disabled" - LoadBalancerPoolPrototypeProxyProtocolV1Const = "v1" - LoadBalancerPoolPrototypeProxyProtocolV2Const = "v2" -) - -// NewLoadBalancerPoolPrototype : Instantiate LoadBalancerPoolPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolPrototype(algorithm string, healthMonitor *LoadBalancerPoolHealthMonitorPrototype, protocol string) (_model *LoadBalancerPoolPrototype, err error) { - _model = &LoadBalancerPoolPrototype{ - Algorithm: core.StringPtr(algorithm), - HealthMonitor: healthMonitor, - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalLoadBalancerPoolPrototype unmarshals an instance of LoadBalancerPoolPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolPrototype) - err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) - if err != nil { - return - } - err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolReference : LoadBalancerPoolReference struct -type LoadBalancerPoolReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` - - // The name for this load balancer pool. The name is unique across all pools for the load balancer. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalLoadBalancerPoolReference unmarshals an instance of LoadBalancerPoolReference from the specified map of raw messages. -func UnmarshalLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerPoolReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerPoolReferenceDeleted unmarshals an instance of LoadBalancerPoolReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerPoolReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolSessionPersistence : LoadBalancerPoolSessionPersistence struct -type LoadBalancerPoolSessionPersistence struct { - // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not - // allowed. - CookieName *string `json:"cookie_name,omitempty"` - - // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` - // protocols. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerPoolSessionPersistence.Type property. -// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` -// protocols. -const ( - LoadBalancerPoolSessionPersistenceTypeAppCookieConst = "app_cookie" - LoadBalancerPoolSessionPersistenceTypeHTTPCookieConst = "http_cookie" - LoadBalancerPoolSessionPersistenceTypeSourceIPConst = "source_ip" -) - -// UnmarshalLoadBalancerPoolSessionPersistence unmarshals an instance of LoadBalancerPoolSessionPersistence from the specified map of raw messages. -func UnmarshalLoadBalancerPoolSessionPersistence(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolSessionPersistence) - err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolSessionPersistencePatch : The session persistence configuration. Specify `null` to remove any existing session persistence configuration. -type LoadBalancerPoolSessionPersistencePatch struct { - // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not - // allowed. - CookieName *string `json:"cookie_name,omitempty"` - - // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` - // protocols. - Type *string `json:"type,omitempty"` -} - -// Constants associated with the LoadBalancerPoolSessionPersistencePatch.Type property. -// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` -// protocols. -const ( - LoadBalancerPoolSessionPersistencePatchTypeAppCookieConst = "app_cookie" - LoadBalancerPoolSessionPersistencePatchTypeHTTPCookieConst = "http_cookie" - LoadBalancerPoolSessionPersistencePatchTypeSourceIPConst = "source_ip" -) - -// UnmarshalLoadBalancerPoolSessionPersistencePatch unmarshals an instance of LoadBalancerPoolSessionPersistencePatch from the specified map of raw messages. -func UnmarshalLoadBalancerPoolSessionPersistencePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolSessionPersistencePatch) - err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolSessionPersistencePrototype : LoadBalancerPoolSessionPersistencePrototype struct -type LoadBalancerPoolSessionPersistencePrototype struct { - // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not - // allowed. - CookieName *string `json:"cookie_name,omitempty"` - - // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` - // protocols. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerPoolSessionPersistencePrototype.Type property. -// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` -// protocols. -const ( - LoadBalancerPoolSessionPersistencePrototypeTypeAppCookieConst = "app_cookie" - LoadBalancerPoolSessionPersistencePrototypeTypeHTTPCookieConst = "http_cookie" - LoadBalancerPoolSessionPersistencePrototypeTypeSourceIPConst = "source_ip" -) - -// NewLoadBalancerPoolSessionPersistencePrototype : Instantiate LoadBalancerPoolSessionPersistencePrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolSessionPersistencePrototype(typeVar string) (_model *LoadBalancerPoolSessionPersistencePrototype, err error) { - _model = &LoadBalancerPoolSessionPersistencePrototype{ - Type: core.StringPtr(typeVar), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalLoadBalancerPoolSessionPersistencePrototype unmarshals an instance of LoadBalancerPoolSessionPersistencePrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolSessionPersistencePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolSessionPersistencePrototype) - err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPrivateIpsItem : LoadBalancerPrivateIpsItem struct -type LoadBalancerPrivateIpsItem struct { - // The IP address. - // - // If the address has not yet been selected, the value will be `0.0.0.0`. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` - - // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the LoadBalancerPrivateIpsItem.ResourceType property. -// The resource type. -const ( - LoadBalancerPrivateIpsItemResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" -) - -// UnmarshalLoadBalancerPrivateIpsItem unmarshals an instance of LoadBalancerPrivateIpsItem from the specified map of raw messages. -func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPrivateIpsItem) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfile : LoadBalancerProfile struct -type LoadBalancerProfile struct { - // The product family this load balancer profile belongs to. - Family *string `json:"family" validate:"required"` - - // The URL for this load balancer profile. - Href *string `json:"href" validate:"required"` - - InstanceGroupsSupported LoadBalancerProfileInstanceGroupsSupportedIntf `json:"instance_groups_supported" validate:"required"` - - // Indicates which logging type(s) are supported for a load balancer with this profile. - LoggingSupported *LoadBalancerProfileLoggingSupported `json:"logging_supported" validate:"required"` - - // The globally unique name for this load balancer profile. - Name *string `json:"name" validate:"required"` - - RouteModeSupported LoadBalancerProfileRouteModeSupportedIntf `json:"route_mode_supported" validate:"required"` - - SecurityGroupsSupported LoadBalancerProfileSecurityGroupsSupportedIntf `json:"security_groups_supported" validate:"required"` - - UDPSupported LoadBalancerProfileUDPSupportedIntf `json:"udp_supported" validate:"required"` -} - -// UnmarshalLoadBalancerProfile unmarshals an instance of LoadBalancerProfile from the specified map of raw messages. -func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfile) - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalModel(m, "instance_groups_supported", &obj.InstanceGroupsSupported, UnmarshalLoadBalancerProfileInstanceGroupsSupported) - if err != nil { - return - } - err = core.UnmarshalModel(m, "logging_supported", &obj.LoggingSupported, UnmarshalLoadBalancerProfileLoggingSupported) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "route_mode_supported", &obj.RouteModeSupported, UnmarshalLoadBalancerProfileRouteModeSupported) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups_supported", &obj.SecurityGroupsSupported, UnmarshalLoadBalancerProfileSecurityGroupsSupported) - if err != nil { - return - } - err = core.UnmarshalModel(m, "udp_supported", &obj.UDPSupported, UnmarshalLoadBalancerProfileUDPSupported) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileCollection : LoadBalancerProfileCollection struct -type LoadBalancerProfileCollection struct { - // A link to the first page of resources. - First *LoadBalancerProfileCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *LoadBalancerProfileCollectionNext `json:"next,omitempty"` - - // Collection of load balancer profiles. - Profiles []LoadBalancerProfile `json:"profiles" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalLoadBalancerProfileCollection unmarshals an instance of LoadBalancerProfileCollection from the specified map of raw messages. -func UnmarshalLoadBalancerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalLoadBalancerProfileCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerProfileCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalLoadBalancerProfile) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *LoadBalancerProfileCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// LoadBalancerProfileCollectionFirst : A link to the first page of resources. -type LoadBalancerProfileCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalLoadBalancerProfileCollectionFirst unmarshals an instance of LoadBalancerProfileCollectionFirst from the specified map of raw messages. -func UnmarshalLoadBalancerProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type LoadBalancerProfileCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalLoadBalancerProfileCollectionNext unmarshals an instance of LoadBalancerProfileCollectionNext from the specified map of raw messages. -func UnmarshalLoadBalancerProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileIdentity : Identifies a load balancer profile by a unique property. -// Models which "extend" this model: -// - LoadBalancerProfileIdentityByName -// - LoadBalancerProfileIdentityByHref -type LoadBalancerProfileIdentity struct { - // The globally unique name for this load balancer profile. - Name *string `json:"name,omitempty"` - - // The URL for this load balancer profile. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerProfileIdentity) isaLoadBalancerProfileIdentity() bool { - return true -} - -type LoadBalancerProfileIdentityIntf interface { - isaLoadBalancerProfileIdentity() bool -} - -// UnmarshalLoadBalancerProfileIdentity unmarshals an instance of LoadBalancerProfileIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileInstanceGroupsSupported : LoadBalancerProfileInstanceGroupsSupported struct -// Models which "extend" this model: -// - LoadBalancerProfileInstanceGroupsSupportedFixed -// - LoadBalancerProfileInstanceGroupsSupportedDependent -type LoadBalancerProfileInstanceGroupsSupported struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *bool `json:"value,omitempty"` -} - -// Constants associated with the LoadBalancerProfileInstanceGroupsSupported.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileInstanceGroupsSupportedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileInstanceGroupsSupported) isaLoadBalancerProfileInstanceGroupsSupported() bool { - return true -} - -type LoadBalancerProfileInstanceGroupsSupportedIntf interface { - isaLoadBalancerProfileInstanceGroupsSupported() bool -} - -// UnmarshalLoadBalancerProfileInstanceGroupsSupported unmarshals an instance of LoadBalancerProfileInstanceGroupsSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileInstanceGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileInstanceGroupsSupported) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileLoggingSupported : Indicates which logging type(s) are supported for a load balancer with this profile. -type LoadBalancerProfileLoggingSupported struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The supported logging type(s) for a load balancer with this profile. - Value []string `json:"value" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileLoggingSupported.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileLoggingSupportedTypeFixedConst = "fixed" -) - -// UnmarshalLoadBalancerProfileLoggingSupported unmarshals an instance of LoadBalancerProfileLoggingSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileLoggingSupported) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileReference : LoadBalancerProfileReference struct -type LoadBalancerProfileReference struct { - // The product family this load balancer profile belongs to. - Family *string `json:"family" validate:"required"` - - // The URL for this load balancer profile. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this load balancer profile. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalLoadBalancerProfileReference unmarshals an instance of LoadBalancerProfileReference from the specified map of raw messages. -func UnmarshalLoadBalancerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileReference) - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileRouteModeSupported : LoadBalancerProfileRouteModeSupported struct -// Models which "extend" this model: -// - LoadBalancerProfileRouteModeSupportedFixed -// - LoadBalancerProfileRouteModeSupportedDependent -type LoadBalancerProfileRouteModeSupported struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *bool `json:"value,omitempty"` -} - -// Constants associated with the LoadBalancerProfileRouteModeSupported.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileRouteModeSupportedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileRouteModeSupported) isaLoadBalancerProfileRouteModeSupported() bool { - return true -} - -type LoadBalancerProfileRouteModeSupportedIntf interface { - isaLoadBalancerProfileRouteModeSupported() bool -} - -// UnmarshalLoadBalancerProfileRouteModeSupported unmarshals an instance of LoadBalancerProfileRouteModeSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileRouteModeSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileRouteModeSupported) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileSecurityGroupsSupported : LoadBalancerProfileSecurityGroupsSupported struct -// Models which "extend" this model: -// - LoadBalancerProfileSecurityGroupsSupportedFixed -// - LoadBalancerProfileSecurityGroupsSupportedDependent -type LoadBalancerProfileSecurityGroupsSupported struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *bool `json:"value,omitempty"` -} - -// Constants associated with the LoadBalancerProfileSecurityGroupsSupported.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileSecurityGroupsSupportedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileSecurityGroupsSupported) isaLoadBalancerProfileSecurityGroupsSupported() bool { - return true -} - -type LoadBalancerProfileSecurityGroupsSupportedIntf interface { - isaLoadBalancerProfileSecurityGroupsSupported() bool -} - -// UnmarshalLoadBalancerProfileSecurityGroupsSupported unmarshals an instance of LoadBalancerProfileSecurityGroupsSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileSecurityGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileSecurityGroupsSupported) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileUDPSupported : LoadBalancerProfileUDPSupported struct -// Models which "extend" this model: -// - LoadBalancerProfileUDPSupportedFixed -// - LoadBalancerProfileUDPSupportedDependent -type LoadBalancerProfileUDPSupported struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *bool `json:"value,omitempty"` -} - -// Constants associated with the LoadBalancerProfileUDPSupported.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileUDPSupportedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileUDPSupported) isaLoadBalancerProfileUDPSupported() bool { - return true -} - -type LoadBalancerProfileUDPSupportedIntf interface { - isaLoadBalancerProfileUDPSupported() bool -} - -// UnmarshalLoadBalancerProfileUDPSupported unmarshals an instance of LoadBalancerProfileUDPSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileUDPSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileUDPSupported) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerReferenceDeleted unmarshals an instance of LoadBalancerReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerStatistics : LoadBalancerStatistics struct -type LoadBalancerStatistics struct { - // Number of active connections of this load balancer. - ActiveConnections *int64 `json:"active_connections" validate:"required"` - - // Current connection rate (connections per second) of this load balancer. - ConnectionRate *float32 `json:"connection_rate" validate:"required"` - - // Total number of data processed (bytes) of this load balancer within current calendar month. - DataProcessedThisMonth *int64 `json:"data_processed_this_month" validate:"required"` - - // Current throughput (Mbps) of this load balancer. - Throughput *float32 `json:"throughput" validate:"required"` -} - -// UnmarshalLoadBalancerStatistics unmarshals an instance of LoadBalancerStatistics from the specified map of raw messages. -func UnmarshalLoadBalancerStatistics(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerStatistics) - err = core.UnmarshalPrimitive(m, "active_connections", &obj.ActiveConnections) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "connection_rate", &obj.ConnectionRate) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "data_processed_this_month", &obj.DataProcessedThisMonth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "throughput", &obj.Throughput) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACL : NetworkACL struct -type NetworkACL struct { - // The date and time that the network ACL was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this network ACL. - CRN *string `json:"crn" validate:"required"` - - // The URL for this network ACL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL. - ID *string `json:"id" validate:"required"` - - // The name for this network ACL. The name is unique across all network ACLs for the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this network ACL. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The ordered rules for this network ACL. If no rules exist, all traffic will be denied. - Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` - - // The subnets to which this network ACL is attached. - Subnets []SubnetReference `json:"subnets" validate:"required"` - - // The VPC this network ACL resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// UnmarshalNetworkACL unmarshals an instance of NetworkACL from the specified map of raw messages. -func UnmarshalNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACL) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLCollection : NetworkACLCollection struct -type NetworkACLCollection struct { - // A link to the first page of resources. - First *NetworkACLCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of network ACLs. - NetworkAcls []NetworkACL `json:"network_acls" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *NetworkACLCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalNetworkACLCollection unmarshals an instance of NetworkACLCollection from the specified map of raw messages. -func UnmarshalNetworkACLCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalNetworkACLCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_acls", &obj.NetworkAcls, UnmarshalNetworkACL) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *NetworkACLCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// NetworkACLCollectionFirst : A link to the first page of resources. -type NetworkACLCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalNetworkACLCollectionFirst unmarshals an instance of NetworkACLCollectionFirst from the specified map of raw messages. -func UnmarshalNetworkACLCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type NetworkACLCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalNetworkACLCollectionNext unmarshals an instance of NetworkACLCollectionNext from the specified map of raw messages. -func UnmarshalNetworkACLCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLIdentity : Identifies a network ACL by a unique property. -// Models which "extend" this model: -// - NetworkACLIdentityByID -// - NetworkACLIdentityByCRN -// - NetworkACLIdentityByHref -type NetworkACLIdentity struct { - // The unique identifier for this network ACL. - ID *string `json:"id,omitempty"` - - // The CRN for this network ACL. - CRN *string `json:"crn,omitempty"` - - // The URL for this network ACL. - Href *string `json:"href,omitempty"` -} - -func (*NetworkACLIdentity) isaNetworkACLIdentity() bool { - return true -} - -type NetworkACLIdentityIntf interface { - isaNetworkACLIdentity() bool -} - -// UnmarshalNetworkACLIdentity unmarshals an instance of NetworkACLIdentity from the specified map of raw messages. -func UnmarshalNetworkACLIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLPatch : NetworkACLPatch struct -type NetworkACLPatch struct { - // The name for this network ACL. The name must not be used by another network ACL for the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalNetworkACLPatch unmarshals an instance of NetworkACLPatch from the specified map of raw messages. -func UnmarshalNetworkACLPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the NetworkACLPatch -func (networkACLPatch *NetworkACLPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(networkACLPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// NetworkACLPrototype : NetworkACLPrototype struct -// Models which "extend" this model: -// - NetworkACLPrototypeNetworkACLByRules -// - NetworkACLPrototypeNetworkACLBySourceNetworkACL -type NetworkACLPrototype struct { - // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The VPC this network ACL will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, - // resulting in all traffic being denied. - Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` - - // Network ACL to copy rules from. - SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl,omitempty"` -} - -func (*NetworkACLPrototype) isaNetworkACLPrototype() bool { - return true -} - -type NetworkACLPrototypeIntf interface { - isaNetworkACLPrototype() bool -} - -// UnmarshalNetworkACLPrototype unmarshals an instance of NetworkACLPrototype from the specified map of raw messages. -func UnmarshalNetworkACLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLReference : NetworkACLReference struct -type NetworkACLReference struct { - // The CRN for this network ACL. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkACLReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this network ACL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL. - ID *string `json:"id" validate:"required"` - - // The name for this network ACL. The name is unique across all network ACLs for the VPC. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalNetworkACLReference unmarshals an instance of NetworkACLReference from the specified map of raw messages. -func UnmarshalNetworkACLReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkACLReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkACLReferenceDeleted unmarshals an instance of NetworkACLReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkACLReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRule : NetworkACLRule struct -// Models which "extend" this model: -// - NetworkACLRuleNetworkACLRuleProtocolTcpudp -// - NetworkACLRuleNetworkACLRuleProtocolIcmp -// - NetworkACLRuleNetworkACLRuleProtocolAll -type NetworkACLRule struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` - - // The ICMP traffic code to match. - // - // If absent, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to match. - // - // If absent, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRule.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleActionAllowConst = "allow" - NetworkACLRuleActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRule.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleDirectionInboundConst = "inbound" - NetworkACLRuleDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRule.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRule.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleProtocolAllConst = "all" - NetworkACLRuleProtocolIcmpConst = "icmp" - NetworkACLRuleProtocolTCPConst = "tcp" - NetworkACLRuleProtocolUDPConst = "udp" -) - -func (*NetworkACLRule) isaNetworkACLRule() bool { - return true -} - -type NetworkACLRuleIntf interface { - isaNetworkACLRule() bool -} - -// UnmarshalNetworkACLRule unmarshals an instance of NetworkACLRule from the specified map of raw messages. -func UnmarshalNetworkACLRule(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "protocol", &discValue) - if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) - return - } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") - return - } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll) - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp) - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) - } - return -} - -// NetworkACLRuleBeforePatch : The rule to move this rule immediately before. -// -// Specify `null` to move this rule after all existing rules. -// Models which "extend" this model: -// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID -// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref -type NetworkACLRuleBeforePatch struct { - // The unique identifier for this network ACL rule. - ID *string `json:"id,omitempty"` - - // The URL for this network ACL rule. - Href *string `json:"href,omitempty"` -} - -func (*NetworkACLRuleBeforePatch) isaNetworkACLRuleBeforePatch() bool { - return true -} - -type NetworkACLRuleBeforePatchIntf interface { - isaNetworkACLRuleBeforePatch() bool -} - -// UnmarshalNetworkACLRuleBeforePatch unmarshals an instance of NetworkACLRuleBeforePatch from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleBeforePrototype : The rule to insert this rule immediately before. -// -// If unspecified, this rule will be inserted after all existing rules. -// Models which "extend" this model: -// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID -// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref -type NetworkACLRuleBeforePrototype struct { - // The unique identifier for this network ACL rule. - ID *string `json:"id,omitempty"` - - // The URL for this network ACL rule. - Href *string `json:"href,omitempty"` -} - -func (*NetworkACLRuleBeforePrototype) isaNetworkACLRuleBeforePrototype() bool { - return true -} - -type NetworkACLRuleBeforePrototypeIntf interface { - isaNetworkACLRuleBeforePrototype() bool -} - -// UnmarshalNetworkACLRuleBeforePrototype unmarshals an instance of NetworkACLRuleBeforePrototype from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleCollection : NetworkACLRuleCollection struct -type NetworkACLRuleCollection struct { - // A link to the first page of resources. - First *NetworkACLRuleCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *NetworkACLRuleCollectionNext `json:"next,omitempty"` - - // Ordered collection of network ACL rules. - Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalNetworkACLRuleCollection unmarshals an instance of NetworkACLRuleCollection from the specified map of raw messages. -func UnmarshalNetworkACLRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalNetworkACLRuleCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLRuleCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *NetworkACLRuleCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// NetworkACLRuleCollectionFirst : A link to the first page of resources. -type NetworkACLRuleCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalNetworkACLRuleCollectionFirst unmarshals an instance of NetworkACLRuleCollectionFirst from the specified map of raw messages. -func UnmarshalNetworkACLRuleCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type NetworkACLRuleCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalNetworkACLRuleCollectionNext unmarshals an instance of NetworkACLRuleCollectionNext from the specified map of raw messages. -func UnmarshalNetworkACLRuleCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleItem : NetworkACLRuleItem struct -// Models which "extend" this model: -// - NetworkACLRuleItemNetworkACLRuleProtocolTcpudp -// - NetworkACLRuleItemNetworkACLRuleProtocolIcmp -// - NetworkACLRuleItemNetworkACLRuleProtocolAll -type NetworkACLRuleItem struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. In a rule collection, this always - // refers to the next item in the collection. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` - - // The ICMP traffic code to match. - // - // If absent, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to match. - // - // If absent, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRuleItem.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleItemActionAllowConst = "allow" - NetworkACLRuleItemActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleItem.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleItemDirectionInboundConst = "inbound" - NetworkACLRuleItemDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleItem.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleItemIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleItem.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleItemProtocolAllConst = "all" - NetworkACLRuleItemProtocolIcmpConst = "icmp" - NetworkACLRuleItemProtocolTCPConst = "tcp" - NetworkACLRuleItemProtocolUDPConst = "udp" -) - -func (*NetworkACLRuleItem) isaNetworkACLRuleItem() bool { - return true -} - -type NetworkACLRuleItemIntf interface { - isaNetworkACLRuleItem() bool -} - -// UnmarshalNetworkACLRuleItem unmarshals an instance of NetworkACLRuleItem from the specified map of raw messages. -func UnmarshalNetworkACLRuleItem(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "protocol", &discValue) - if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) - return - } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") - return - } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll) - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp) - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) - } - return -} - -// NetworkACLRulePatch : NetworkACLRulePatch struct -type NetworkACLRulePatch struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action,omitempty"` - - // The rule to move this rule immediately before. - // - // Specify `null` to move this rule after all existing rules. - Before NetworkACLRuleBeforePatchIntf `json:"before,omitempty"` - - // The ICMP traffic code to match. If set, `type` must also be set. - // - // Specify `null` to remove an existing ICMP traffic code. - Code *int64 `json:"code,omitempty"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination,omitempty"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The direction of traffic to match. - Direction *string `json:"direction,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. - Name *string `json:"name,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source,omitempty"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` - - // The ICMP traffic type to match. - // - // Specify `null` to remove an existing ICMP traffic type value. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRulePatch.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePatchActionAllowConst = "allow" - NetworkACLRulePatchActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePatch.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePatchDirectionInboundConst = "inbound" - NetworkACLRulePatchDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePatch.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePatchProtocolAllConst = "all" - NetworkACLRulePatchProtocolIcmpConst = "icmp" - NetworkACLRulePatchProtocolTCPConst = "tcp" - NetworkACLRulePatchProtocolUDPConst = "udp" -) - -// UnmarshalNetworkACLRulePatch unmarshals an instance of NetworkACLRulePatch from the specified map of raw messages. -func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePatch) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the NetworkACLRulePatch -func (networkACLRulePatch *NetworkACLRulePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(networkACLRulePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// NetworkACLRulePrototype : NetworkACLRulePrototype struct -// Models which "extend" this model: -// - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype -// - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype -// - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype -type NetworkACLRulePrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule to insert this rule immediately before. - // - // If unspecified, this rule will be inserted after all existing rules. - Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` - - // The ICMP traffic code to match. - // - // If specified, `type` must also be specified. If unspecified, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to match. - // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRulePrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeProtocolAllConst = "all" - NetworkACLRulePrototypeProtocolIcmpConst = "icmp" - NetworkACLRulePrototypeProtocolTCPConst = "tcp" - NetworkACLRulePrototypeProtocolUDPConst = "udp" -) - -func (*NetworkACLRulePrototype) isaNetworkACLRulePrototype() bool { - return true -} - -type NetworkACLRulePrototypeIntf interface { - isaNetworkACLRulePrototype() bool -} - -// UnmarshalNetworkACLRulePrototype unmarshals an instance of NetworkACLRulePrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "protocol", &discValue) - if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) - return - } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") - return - } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) - } - return -} - -// NetworkACLRulePrototypeNetworkACLContext : NetworkACLRulePrototypeNetworkACLContext struct -// Models which "extend" this model: -// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype -// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype -// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype -type NetworkACLRulePrototypeNetworkACLContext struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` - - // The ICMP traffic code to match. - // - // If specified, `type` must also be specified. If unspecified, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to match. - // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLContextActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLContextActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLContextDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLContextDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLContextIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLContextProtocolAllConst = "all" - NetworkACLRulePrototypeNetworkACLContextProtocolIcmpConst = "icmp" - NetworkACLRulePrototypeNetworkACLContextProtocolTCPConst = "tcp" - NetworkACLRulePrototypeNetworkACLContextProtocolUDPConst = "udp" -) - -func (*NetworkACLRulePrototypeNetworkACLContext) isaNetworkACLRulePrototypeNetworkACLContext() bool { - return true -} - -type NetworkACLRulePrototypeNetworkACLContextIntf interface { - isaNetworkACLRulePrototypeNetworkACLContext() bool -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLContext unmarshals an instance of NetworkACLRulePrototypeNetworkACLContext from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLContext(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "protocol", &discValue) - if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) - return - } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") - return - } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) - } - return -} - -// NetworkACLRuleReference : NetworkACLRuleReference struct -type NetworkACLRuleReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkACLRuleReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalNetworkACLRuleReference unmarshals an instance of NetworkACLRuleReference from the specified map of raw messages. -func UnmarshalNetworkACLRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLRuleReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkACLRuleReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkACLRuleReferenceDeleted unmarshals an instance of NetworkACLRuleReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterface : NetworkInterface struct -type NetworkInterface struct { - // Indicates whether source IP spoofing is allowed on this instance interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // The date and time that the instance network interface was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The floating IPs associated with this instance network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this instance network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network interface. - ID *string `json:"id" validate:"required"` - - // The name for this instance network interface. - Name *string `json:"name" validate:"required"` - - // The instance network interface port speed in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The security groups targeting this instance network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the instance network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The instance network interface type. - 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. -const ( - NetworkInterfaceStatusAvailableConst = "available" - NetworkInterfaceStatusDeletingConst = "deleting" - NetworkInterfaceStatusFailedConst = "failed" - NetworkInterfaceStatusPendingConst = "pending" -) - -// Constants associated with the NetworkInterface.Type property. -// The instance network interface type. -const ( - NetworkInterfaceTypePrimaryConst = "primary" - NetworkInterfaceTypeSecondaryConst = "secondary" -) - -// UnmarshalNetworkInterface unmarshals an instance of NetworkInterface from the specified map of raw messages. -func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterface) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceBareMetalServerContextReference : NetworkInterfaceBareMetalServerContextReference struct -type NetworkInterfaceBareMetalServerContextReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this bare metal server network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network interface. - ID *string `json:"id" validate:"required"` - - // The name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the NetworkInterfaceBareMetalServerContextReference.ResourceType property. -// The resource type. -const ( - NetworkInterfaceBareMetalServerContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" -) - -// UnmarshalNetworkInterfaceBareMetalServerContextReference unmarshals an instance of NetworkInterfaceBareMetalServerContextReference from the specified map of raw messages. -func UnmarshalNetworkInterfaceBareMetalServerContextReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceBareMetalServerContextReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceBareMetalServerContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceBareMetalServerContextReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted unmarshals an instance of NetworkInterfaceBareMetalServerContextReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceBareMetalServerContextReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceIPPrototype : NetworkInterfaceIPPrototype struct -// Models which "extend" this model: -// - NetworkInterfaceIPPrototypeReservedIPIdentity -// - NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext -type NetworkInterfaceIPPrototype struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` - - // The IP address to reserve, which must not already be reserved on the subnet. - // - // If unspecified, an available address on the subnet will automatically be selected. - Address *string `json:"address,omitempty"` - - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with - // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated - // list of randomly-selected words. - Name *string `json:"name,omitempty"` -} - -func (*NetworkInterfaceIPPrototype) isaNetworkInterfaceIPPrototype() bool { - return true -} - -type NetworkInterfaceIPPrototypeIntf interface { - isaNetworkInterfaceIPPrototype() bool -} - -// UnmarshalNetworkInterfaceIPPrototype unmarshals an instance of NetworkInterfaceIPPrototype from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceInstanceContextReference : NetworkInterfaceInstanceContextReference struct -type NetworkInterfaceInstanceContextReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceInstanceContextReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network interface. - ID *string `json:"id" validate:"required"` - - // The name for this instance network interface. - Name *string `json:"name" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the NetworkInterfaceInstanceContextReference.ResourceType property. -// The resource type. -const ( - NetworkInterfaceInstanceContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" -) - -// UnmarshalNetworkInterfaceInstanceContextReference unmarshals an instance of NetworkInterfaceInstanceContextReference from the specified map of raw messages. -func UnmarshalNetworkInterfaceInstanceContextReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceInstanceContextReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceInstanceContextReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceInstanceContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceInstanceContextReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkInterfaceInstanceContextReferenceDeleted unmarshals an instance of NetworkInterfaceInstanceContextReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceInstanceContextReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfacePatch : NetworkInterfacePatch struct -type NetworkInterfacePatch struct { - // Indicates whether source IP spoofing is allowed on this instance interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // The name for the instance network interface. The name must not be used by another network interface on the virtual - // server instance. - Name *string `json:"name,omitempty"` -} - -// UnmarshalNetworkInterfacePatch unmarshals an instance of NetworkInterfacePatch from the specified map of raw messages. -func UnmarshalNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfacePatch) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the NetworkInterfacePatch -func (networkInterfacePatch *NetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(networkInterfacePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// NetworkInterfacePrototype : NetworkInterfacePrototype struct -type NetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this instance interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // The name for the instance network interface. The name must not be used by another network interface on the virtual - // server instance. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the instance network interface. This can be - // specified using an existing reserved IP, or a prototype object for a new reserved IP. - // - // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the instance network interface's subnet. Otherwise, an - // available address on the subnet will be automatically selected and reserved. - PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The security groups to use for this instance network interface. If unspecified, the VPC's default security group is - // used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` -} - -// NewNetworkInterfacePrototype : Instantiate NetworkInterfacePrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *NetworkInterfacePrototype, err error) { - _model = &NetworkInterfacePrototype{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalNetworkInterfacePrototype unmarshals an instance of NetworkInterfacePrototype from the specified map of raw messages. -func UnmarshalNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfacePrototype) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkInterfaceReferenceDeleted unmarshals an instance of NetworkInterfaceReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceReferenceTargetContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of NetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceReferenceTargetContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct -type NetworkInterfaceUnpaginatedCollection struct { - // Collection of instance network interfaces. - NetworkInterfaces []NetworkInterface `json:"network_interfaces" validate:"required"` -} - -// UnmarshalNetworkInterfaceUnpaginatedCollection unmarshals an instance of NetworkInterfaceUnpaginatedCollection from the specified map of raw messages. -func UnmarshalNetworkInterfaceUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceUnpaginatedCollection) - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterface) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ObsoleteImageOptions : The ObsoleteImage options. -type ObsoleteImageOptions struct { - // The image identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewObsoleteImageOptions : Instantiate ObsoleteImageOptions -func (*VpcV1) NewObsoleteImageOptions(id string) *ObsoleteImageOptions { - return &ObsoleteImageOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *ObsoleteImageOptions) SetID(id string) *ObsoleteImageOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ObsoleteImageOptions) SetHeaders(param map[string]string) *ObsoleteImageOptions { - options.Headers = param - return options -} - -// OperatingSystem : OperatingSystem struct -type OperatingSystem struct { - // The operating system architecture. - Architecture *string `json:"architecture" validate:"required"` - - // Images with this operating system can only be used on dedicated hosts or dedicated host groups. - DedicatedHostOnly *bool `json:"dedicated_host_only" validate:"required"` - - // A unique, display-friendly name for the operating system. - DisplayName *string `json:"display_name" validate:"required"` - - // The software family for this operating system. - Family *string `json:"family" validate:"required"` - - // The URL for this operating system. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this operating system. - Name *string `json:"name" validate:"required"` - - // The vendor of the operating system. - Vendor *string `json:"vendor" validate:"required"` - - // The major release version of this operating system. - Version *string `json:"version" validate:"required"` -} - -// UnmarshalOperatingSystem unmarshals an instance of OperatingSystem from the specified map of raw messages. -func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystem) - err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "dedicated_host_only", &obj.DedicatedHostOnly) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "vendor", &obj.Vendor) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "version", &obj.Version) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// OperatingSystemCollection : OperatingSystemCollection struct -type OperatingSystemCollection struct { - // A link to the first page of resources. - First *OperatingSystemCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *OperatingSystemCollectionNext `json:"next,omitempty"` - - // Collection of operating systems. - OperatingSystems []OperatingSystem `json:"operating_systems" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalOperatingSystemCollection unmarshals an instance of OperatingSystemCollection from the specified map of raw messages. -func UnmarshalOperatingSystemCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalOperatingSystemCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalOperatingSystemCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "operating_systems", &obj.OperatingSystems, UnmarshalOperatingSystem) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *OperatingSystemCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// OperatingSystemCollectionFirst : A link to the first page of resources. -type OperatingSystemCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalOperatingSystemCollectionFirst unmarshals an instance of OperatingSystemCollectionFirst from the specified map of raw messages. -func UnmarshalOperatingSystemCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// OperatingSystemCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type OperatingSystemCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalOperatingSystemCollectionNext unmarshals an instance of OperatingSystemCollectionNext from the specified map of raw messages. -func UnmarshalOperatingSystemCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// OperatingSystemIdentity : Identifies an operating system by a unique property. -// Models which "extend" this model: -// - OperatingSystemIdentityByName -// - OperatingSystemIdentityByHref -type OperatingSystemIdentity struct { - // The globally unique name for this operating system. - Name *string `json:"name,omitempty"` - - // The URL for this operating system. - Href *string `json:"href,omitempty"` -} - -func (*OperatingSystemIdentity) isaOperatingSystemIdentity() bool { - return true -} - -type OperatingSystemIdentityIntf interface { - isaOperatingSystemIdentity() bool -} - -// UnmarshalOperatingSystemIdentity unmarshals an instance of OperatingSystemIdentity from the specified map of raw messages. -func UnmarshalOperatingSystemIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PlacementGroup : PlacementGroup struct -type PlacementGroup struct { - // The date and time that the placement group was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this placement group. - CRN *string `json:"crn" validate:"required"` - - // The URL for this placement group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this placement group. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the placement group. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this placement group. The name is unique across all placement groups in the region. - Name *string `json:"name" validate:"required"` - - // The resource group for this placement group. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The strategy for this placement group - // - `host_spread`: place on different compute hosts - // - `power_spread`: place on compute hosts that use different power sources - // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the - // unexpected strategy was encountered. - Strategy *string `json:"strategy" validate:"required"` -} - -// Constants associated with the PlacementGroup.LifecycleState property. -// The lifecycle state of the placement group. -const ( - PlacementGroupLifecycleStateDeletingConst = "deleting" - PlacementGroupLifecycleStateFailedConst = "failed" - PlacementGroupLifecycleStatePendingConst = "pending" - PlacementGroupLifecycleStateStableConst = "stable" - PlacementGroupLifecycleStateSuspendedConst = "suspended" - PlacementGroupLifecycleStateUpdatingConst = "updating" - PlacementGroupLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the PlacementGroup.ResourceType property. -// The resource type. -const ( - PlacementGroupResourceTypePlacementGroupConst = "placement_group" -) - -// Constants associated with the PlacementGroup.Strategy property. -// The strategy for this placement group -// - `host_spread`: place on different compute hosts -// - `power_spread`: place on compute hosts that use different power sources -// -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the -// unexpected strategy was encountered. -const ( - PlacementGroupStrategyHostSpreadConst = "host_spread" - PlacementGroupStrategyPowerSpreadConst = "power_spread" -) - -// UnmarshalPlacementGroup unmarshals an instance of PlacementGroup from the specified map of raw messages. -func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroup) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "strategy", &obj.Strategy) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PlacementGroupCollection : PlacementGroupCollection struct -type PlacementGroupCollection struct { - // A link to the first page of resources. - First *PlacementGroupCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *PlacementGroupCollectionNext `json:"next,omitempty"` - - // Collection of placement groups. - PlacementGroups []PlacementGroup `json:"placement_groups" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalPlacementGroupCollection unmarshals an instance of PlacementGroupCollection from the specified map of raw messages. -func UnmarshalPlacementGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroupCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPlacementGroupCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPlacementGroupCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_groups", &obj.PlacementGroups, UnmarshalPlacementGroup) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *PlacementGroupCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// PlacementGroupCollectionFirst : A link to the first page of resources. -type PlacementGroupCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPlacementGroupCollectionFirst unmarshals an instance of PlacementGroupCollectionFirst from the specified map of raw messages. -func UnmarshalPlacementGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroupCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PlacementGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type PlacementGroupCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPlacementGroupCollectionNext unmarshals an instance of PlacementGroupCollectionNext from the specified map of raw messages. -func UnmarshalPlacementGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroupCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PlacementGroupPatch : PlacementGroupPatch struct -type PlacementGroupPatch struct { - // The name for this placement group. The name must not be used by another placement group in the region. - Name *string `json:"name,omitempty"` -} - -// UnmarshalPlacementGroupPatch unmarshals an instance of PlacementGroupPatch from the specified map of raw messages. -func UnmarshalPlacementGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroupPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the PlacementGroupPatch -func (placementGroupPatch *PlacementGroupPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(placementGroupPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// PlacementGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type PlacementGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalPlacementGroupReferenceDeleted unmarshals an instance of PlacementGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalPlacementGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroupReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGateway : PublicGateway struct -type PublicGateway struct { - // The date and time that the public gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this public gateway. - CRN *string `json:"crn" validate:"required"` - - // The floating IP bound to this public gateway. - FloatingIP *PublicGatewayFloatingIP `json:"floating_ip" validate:"required"` - - // The URL for this public gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this public gateway. - ID *string `json:"id" validate:"required"` - - // The name for this public gateway. The name is unique across all public gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this public gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of this public gateway. - Status *string `json:"status" validate:"required"` - - // The VPC this public gateway resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // The zone this public gateway resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the PublicGateway.ResourceType property. -// The resource type. -const ( - PublicGatewayResourceTypePublicGatewayConst = "public_gateway" -) - -// Constants associated with the PublicGateway.Status property. -// The status of this public gateway. -const ( - PublicGatewayStatusAvailableConst = "available" - PublicGatewayStatusDeletingConst = "deleting" - PublicGatewayStatusFailedConst = "failed" - PublicGatewayStatusPendingConst = "pending" -) - -// UnmarshalPublicGateway unmarshals an instance of PublicGateway from the specified map of raw messages. -func UnmarshalPublicGateway(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGateway) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "floating_ip", &obj.FloatingIP, UnmarshalPublicGatewayFloatingIP) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayCollection : PublicGatewayCollection struct -type PublicGatewayCollection struct { - // A link to the first page of resources. - First *PublicGatewayCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *PublicGatewayCollectionNext `json:"next,omitempty"` - - // Collection of public gateways. - PublicGateways []PublicGateway `json:"public_gateways" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalPublicGatewayCollection unmarshals an instance of PublicGatewayCollection from the specified map of raw messages. -func UnmarshalPublicGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPublicGatewayCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPublicGatewayCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "public_gateways", &obj.PublicGateways, UnmarshalPublicGateway) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *PublicGatewayCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// PublicGatewayCollectionFirst : A link to the first page of resources. -type PublicGatewayCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPublicGatewayCollectionFirst unmarshals an instance of PublicGatewayCollectionFirst from the specified map of raw messages. -func UnmarshalPublicGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type PublicGatewayCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPublicGatewayCollectionNext unmarshals an instance of PublicGatewayCollectionNext from the specified map of raw messages. -func UnmarshalPublicGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayFloatingIP : The floating IP bound to this public gateway. -type PublicGatewayFloatingIP struct { - // The globally unique IP address. - Address *string `json:"address" validate:"required"` - - // The CRN for this floating IP. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this floating IP. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this floating IP. - ID *string `json:"id" validate:"required"` - - // The name for this floating IP. The name is unique across all floating IPs in the region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalPublicGatewayFloatingIP unmarshals an instance of PublicGatewayFloatingIP from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayFloatingIPPrototype : PublicGatewayFloatingIPPrototype struct -// Models which "extend" this model: -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentity -// - PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext -type PublicGatewayFloatingIPPrototype struct { - // The unique identifier for this floating IP. - ID *string `json:"id,omitempty"` - - // The CRN for this floating IP. - CRN *string `json:"crn,omitempty"` - - // The URL for this floating IP. - Href *string `json:"href,omitempty"` - - // The globally unique IP address. - Address *string `json:"address,omitempty"` - - // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` -} - -func (*PublicGatewayFloatingIPPrototype) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -type PublicGatewayFloatingIPPrototypeIntf interface { - isaPublicGatewayFloatingIPPrototype() bool -} - -// UnmarshalPublicGatewayFloatingIPPrototype unmarshals an instance of PublicGatewayFloatingIPPrototype from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayIdentity : Identifies a public gateway by a unique property. -// Models which "extend" this model: -// - PublicGatewayIdentityPublicGatewayIdentityByID -// - PublicGatewayIdentityPublicGatewayIdentityByCRN -// - PublicGatewayIdentityPublicGatewayIdentityByHref -type PublicGatewayIdentity struct { - // The unique identifier for this public gateway. - ID *string `json:"id,omitempty"` - - // The CRN for this public gateway. - CRN *string `json:"crn,omitempty"` - - // The URL for this public gateway. - Href *string `json:"href,omitempty"` -} - -func (*PublicGatewayIdentity) isaPublicGatewayIdentity() bool { - return true -} - -type PublicGatewayIdentityIntf interface { - isaPublicGatewayIdentity() bool -} - -// UnmarshalPublicGatewayIdentity unmarshals an instance of PublicGatewayIdentity from the specified map of raw messages. -func UnmarshalPublicGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayPatch : PublicGatewayPatch struct -type PublicGatewayPatch struct { - // The name for this public gateway. The name must not be used by another public gateway in the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalPublicGatewayPatch unmarshals an instance of PublicGatewayPatch from the specified map of raw messages. -func UnmarshalPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the PublicGatewayPatch -func (publicGatewayPatch *PublicGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(publicGatewayPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// PublicGatewayReference : PublicGatewayReference struct -type PublicGatewayReference struct { - // The CRN for this public gateway. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this public gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this public gateway. - ID *string `json:"id" validate:"required"` - - // The name for this public gateway. The name is unique across all public gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the PublicGatewayReference.ResourceType property. -// The resource type. -const ( - PublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" -) - -// UnmarshalPublicGatewayReference unmarshals an instance of PublicGatewayReference from the specified map of raw messages. -func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type PublicGatewayReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalPublicGatewayReferenceDeleted unmarshals an instance of PublicGatewayReferenceDeleted from the specified map of raw messages. -func UnmarshalPublicGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Region : Region struct -type Region struct { - // The API endpoint for this region. - Endpoint *string `json:"endpoint" validate:"required"` - - // The URL for this region. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this region. - Name *string `json:"name" validate:"required"` - - // The availability status of this region. - Status *string `json:"status" validate:"required"` -} - -// Constants associated with the Region.Status property. -// The availability status of this region. -const ( - RegionStatusAvailableConst = "available" - RegionStatusUnavailableConst = "unavailable" -) - -// UnmarshalRegion unmarshals an instance of Region from the specified map of raw messages. -func UnmarshalRegion(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Region) - err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RegionCollection : RegionCollection struct -type RegionCollection struct { - // Collection of regions. - Regions []Region `json:"regions" validate:"required"` -} - -// UnmarshalRegionCollection unmarshals an instance of RegionCollection from the specified map of raw messages. -func UnmarshalRegionCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionCollection) - err = core.UnmarshalModel(m, "regions", &obj.Regions, UnmarshalRegion) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RegionIdentity : Identifies a region by a unique property. -// Models which "extend" this model: -// - RegionIdentityByName -// - RegionIdentityByHref -type RegionIdentity struct { - // The globally unique name for this region. - Name *string `json:"name,omitempty"` - - // The URL for this region. - Href *string `json:"href,omitempty"` -} - -func (*RegionIdentity) isaRegionIdentity() bool { - return true -} - -type RegionIdentityIntf interface { - isaRegionIdentity() bool -} - -// UnmarshalRegionIdentity unmarshals an instance of RegionIdentity from the specified map of raw messages. -func UnmarshalRegionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RegionReference : RegionReference struct -type RegionReference struct { - // The URL for this region. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalRegionReference unmarshals an instance of RegionReference from the specified map of raw messages. -func UnmarshalRegionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RemoveBareMetalServerNetworkInterfaceFloatingIPOptions : The RemoveBareMetalServerNetworkInterfaceFloatingIP options. -type RemoveBareMetalServerNetworkInterfaceFloatingIPOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate RemoveBareMetalServerNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { - return &RemoveBareMetalServerNetworkInterfaceFloatingIPOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} - -// RemoveEndpointGatewayIPOptions : The RemoveEndpointGatewayIP options. -type RemoveEndpointGatewayIPOptions struct { - // The endpoint gateway identifier. - EndpointGatewayID *string `json:"endpoint_gateway_id" validate:"required,ne="` - - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewRemoveEndpointGatewayIPOptions : Instantiate RemoveEndpointGatewayIPOptions -func (*VpcV1) NewRemoveEndpointGatewayIPOptions(endpointGatewayID string, id string) *RemoveEndpointGatewayIPOptions { - return &RemoveEndpointGatewayIPOptions{ - EndpointGatewayID: core.StringPtr(endpointGatewayID), - ID: core.StringPtr(id), - } -} - -// SetEndpointGatewayID : Allow user to set EndpointGatewayID -func (_options *RemoveEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *RemoveEndpointGatewayIPOptions { - _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveEndpointGatewayIPOptions) SetID(id string) *RemoveEndpointGatewayIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveEndpointGatewayIPOptions) SetHeaders(param map[string]string) *RemoveEndpointGatewayIPOptions { - options.Headers = param - return options -} - -// RemoveInstanceNetworkInterfaceFloatingIPOptions : The RemoveInstanceNetworkInterfaceFloatingIP options. -type RemoveInstanceNetworkInterfaceFloatingIPOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewRemoveInstanceNetworkInterfaceFloatingIPOptions : Instantiate RemoveInstanceNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewRemoveInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - return &RemoveInstanceNetworkInterfaceFloatingIPOptions{ - InstanceID: core.StringPtr(instanceID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} - -// RemoveNetworkInterfaceFloatingIPOptions : The RemoveNetworkInterfaceFloatingIP options. -type RemoveNetworkInterfaceFloatingIPOptions struct { - // The virtual network interface identifier. - VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` - - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewRemoveNetworkInterfaceFloatingIPOptions : Instantiate RemoveNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewRemoveNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *RemoveNetworkInterfaceFloatingIPOptions { - return &RemoveNetworkInterfaceFloatingIPOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *RemoveNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *RemoveNetworkInterfaceFloatingIPOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} - -// RemoveVirtualNetworkInterfaceIPOptions : The RemoveVirtualNetworkInterfaceIP options. -type RemoveVirtualNetworkInterfaceIPOptions struct { - // The virtual network interface identifier. - VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` - - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewRemoveVirtualNetworkInterfaceIPOptions : Instantiate RemoveVirtualNetworkInterfaceIPOptions -func (*VpcV1) NewRemoveVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *RemoveVirtualNetworkInterfaceIPOptions { - return &RemoveVirtualNetworkInterfaceIPOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *RemoveVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *RemoveVirtualNetworkInterfaceIPOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveVirtualNetworkInterfaceIPOptions) SetID(id string) *RemoveVirtualNetworkInterfaceIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *RemoveVirtualNetworkInterfaceIPOptions { - options.Headers = param - return options -} - -// RemoveVPNGatewayConnectionLocalCIDROptions : The RemoveVPNGatewayConnectionLocalCIDR options. -type RemoveVPNGatewayConnectionLocalCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` - - // The address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewRemoveVPNGatewayConnectionLocalCIDROptions : Instantiate RemoveVPNGatewayConnectionLocalCIDROptions -func (*VpcV1) NewRemoveVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { - return &RemoveVPNGatewayConnectionLocalCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionLocalCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionLocalCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionLocalCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} - -// SetPrefixLength : Allow user to set PrefixLength -func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionLocalCIDROptions { - options.Headers = param - return options -} - -// RemoveVPNGatewayConnectionPeerCIDROptions : The RemoveVPNGatewayConnectionPeerCIDR options. -type RemoveVPNGatewayConnectionPeerCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` - - // The address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewRemoveVPNGatewayConnectionPeerCIDROptions : Instantiate RemoveVPNGatewayConnectionPeerCIDROptions -func (*VpcV1) NewRemoveVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { - return &RemoveVPNGatewayConnectionPeerCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionPeerCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionPeerCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionPeerCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} - -// SetPrefixLength : Allow user to set PrefixLength -func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionPeerCIDROptions { - options.Headers = param - return options -} - -// ReplaceLoadBalancerPoolMembersOptions : The ReplaceLoadBalancerPoolMembers options. -type ReplaceLoadBalancerPoolMembersOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - PoolID *string `json:"pool_id" validate:"required,ne="` - - // The member prototype objects for this pool. - Members []LoadBalancerPoolMemberPrototype `json:"members" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewReplaceLoadBalancerPoolMembersOptions : Instantiate ReplaceLoadBalancerPoolMembersOptions -func (*VpcV1) NewReplaceLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string, members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { - return &ReplaceLoadBalancerPoolMembersOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - PoolID: core.StringPtr(poolID), - Members: members, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *ReplaceLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ReplaceLoadBalancerPoolMembersOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetPoolID : Allow user to set PoolID -func (_options *ReplaceLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ReplaceLoadBalancerPoolMembersOptions { - _options.PoolID = core.StringPtr(poolID) - return _options -} - -// SetMembers : Allow user to set Members -func (_options *ReplaceLoadBalancerPoolMembersOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { - _options.Members = members - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ReplaceLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ReplaceLoadBalancerPoolMembersOptions { - options.Headers = param - return options -} - -// ReplaceSubnetNetworkACLOptions : The ReplaceSubnetNetworkACL options. -type ReplaceSubnetNetworkACLOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // The network ACL identity. - NetworkACLIdentity NetworkACLIdentityIntf `json:"NetworkACLIdentity" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewReplaceSubnetNetworkACLOptions : Instantiate ReplaceSubnetNetworkACLOptions -func (*VpcV1) NewReplaceSubnetNetworkACLOptions(id string, networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { - return &ReplaceSubnetNetworkACLOptions{ - ID: core.StringPtr(id), - NetworkACLIdentity: networkACLIdentity, - } -} - -// SetID : Allow user to set ID -func (_options *ReplaceSubnetNetworkACLOptions) SetID(id string) *ReplaceSubnetNetworkACLOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetNetworkACLIdentity : Allow user to set NetworkACLIdentity -func (_options *ReplaceSubnetNetworkACLOptions) SetNetworkACLIdentity(networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { - _options.NetworkACLIdentity = networkACLIdentity - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ReplaceSubnetNetworkACLOptions) SetHeaders(param map[string]string) *ReplaceSubnetNetworkACLOptions { - options.Headers = param - return options -} - -// ReplaceSubnetRoutingTableOptions : The ReplaceSubnetRoutingTable options. -type ReplaceSubnetRoutingTableOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // The routing table identity. - RoutingTableIdentity RoutingTableIdentityIntf `json:"RoutingTableIdentity" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewReplaceSubnetRoutingTableOptions : Instantiate ReplaceSubnetRoutingTableOptions -func (*VpcV1) NewReplaceSubnetRoutingTableOptions(id string, routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { - return &ReplaceSubnetRoutingTableOptions{ - ID: core.StringPtr(id), - RoutingTableIdentity: routingTableIdentity, - } -} - -// SetID : Allow user to set ID -func (_options *ReplaceSubnetRoutingTableOptions) SetID(id string) *ReplaceSubnetRoutingTableOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetRoutingTableIdentity : Allow user to set RoutingTableIdentity -func (_options *ReplaceSubnetRoutingTableOptions) SetRoutingTableIdentity(routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { - _options.RoutingTableIdentity = routingTableIdentity - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ReplaceSubnetRoutingTableOptions) SetHeaders(param map[string]string) *ReplaceSubnetRoutingTableOptions { - options.Headers = param - return options -} - -// ReservedIP : ReservedIP struct -type ReservedIP struct { - // The IP address. - // - // If the address has not yet been selected, the value will be `0.0.0.0`. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` - - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // The date and time that the reserved IP was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the reserved IP. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - Name *string `json:"name" validate:"required"` - - // The owner of the reserved IP. - Owner *string `json:"owner" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The target this reserved IP is bound to. - // - // If absent, this reserved IP is provider-owned or unbound. - Target ReservedIPTargetIntf `json:"target,omitempty"` -} - -// Constants associated with the ReservedIP.LifecycleState property. -// The lifecycle state of the reserved IP. -const ( - ReservedIPLifecycleStateDeletingConst = "deleting" - ReservedIPLifecycleStateFailedConst = "failed" - ReservedIPLifecycleStatePendingConst = "pending" - ReservedIPLifecycleStateStableConst = "stable" - ReservedIPLifecycleStateSuspendedConst = "suspended" - ReservedIPLifecycleStateUpdatingConst = "updating" - ReservedIPLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the ReservedIP.Owner property. -// The owner of the reserved IP. -const ( - ReservedIPOwnerProviderConst = "provider" - ReservedIPOwnerUserConst = "user" -) - -// Constants associated with the ReservedIP.ResourceType property. -// The resource type. -const ( - ReservedIPResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" -) - -// UnmarshalReservedIP unmarshals an instance of ReservedIP from the specified map of raw messages. -func UnmarshalReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "owner", &obj.Owner) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalReservedIPTarget) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollection : ReservedIPCollection struct -type ReservedIPCollection struct { - // A link to the first page of resources. - First *ReservedIPCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *ReservedIPCollectionNext `json:"next,omitempty"` - - // Collection of reserved IPs in this subnet. - ReservedIps []ReservedIP `json:"reserved_ips" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalReservedIPCollection unmarshals an instance of ReservedIPCollection from the specified map of raw messages. -func UnmarshalReservedIPCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalReservedIP) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *ReservedIPCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// ReservedIPCollectionBareMetalServerNetworkInterfaceContext : ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct -type ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct { - // A link to the first page of resources. - First *ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst `json:"first" validate:"required"` - - // Collection of reserved IPs bound to a bare metal server network interface. - Ips []ReservedIP `json:"ips" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionBareMetalServerNetworkInterfaceContext from the specified map of raw messages. -func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionBareMetalServerNetworkInterfaceContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst : A link to the first page of resources. -type ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst from the specified map of raw messages. -func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext from the specified map of raw messages. -func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionEndpointGatewayContext : ReservedIPCollectionEndpointGatewayContext struct -type ReservedIPCollectionEndpointGatewayContext struct { - // A link to the first page of resources. - First *ReservedIPCollectionEndpointGatewayContextFirst `json:"first" validate:"required"` - - // Collection of reserved IPs bound to an endpoint gateway. - Ips []ReservedIP `json:"ips" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *ReservedIPCollectionEndpointGatewayContextNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalReservedIPCollectionEndpointGatewayContext unmarshals an instance of ReservedIPCollectionEndpointGatewayContext from the specified map of raw messages. -func UnmarshalReservedIPCollectionEndpointGatewayContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionEndpointGatewayContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionEndpointGatewayContextFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionEndpointGatewayContextNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *ReservedIPCollectionEndpointGatewayContext) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// ReservedIPCollectionEndpointGatewayContextFirst : A link to the first page of resources. -type ReservedIPCollectionEndpointGatewayContextFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionEndpointGatewayContextFirst unmarshals an instance of ReservedIPCollectionEndpointGatewayContextFirst from the specified map of raw messages. -func UnmarshalReservedIPCollectionEndpointGatewayContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionEndpointGatewayContextFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionEndpointGatewayContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type ReservedIPCollectionEndpointGatewayContextNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionEndpointGatewayContextNext unmarshals an instance of ReservedIPCollectionEndpointGatewayContextNext from the specified map of raw messages. -func UnmarshalReservedIPCollectionEndpointGatewayContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionEndpointGatewayContextNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionFirst : A link to the first page of resources. -type ReservedIPCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionFirst unmarshals an instance of ReservedIPCollectionFirst from the specified map of raw messages. -func UnmarshalReservedIPCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionInstanceNetworkInterfaceContext : ReservedIPCollectionInstanceNetworkInterfaceContext struct -type ReservedIPCollectionInstanceNetworkInterfaceContext struct { - // A link to the first page of resources. - First *ReservedIPCollectionInstanceNetworkInterfaceContextFirst `json:"first" validate:"required"` - - // Collection of reserved IPs bound to an instance network interface. - Ips []ReservedIP `json:"ips" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *ReservedIPCollectionInstanceNetworkInterfaceContextNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionInstanceNetworkInterfaceContext from the specified map of raw messages. -func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionInstanceNetworkInterfaceContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *ReservedIPCollectionInstanceNetworkInterfaceContext) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// ReservedIPCollectionInstanceNetworkInterfaceContextFirst : A link to the first page of resources. -type ReservedIPCollectionInstanceNetworkInterfaceContextFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionInstanceNetworkInterfaceContextFirst from the specified map of raw messages. -func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionInstanceNetworkInterfaceContextFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionInstanceNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type ReservedIPCollectionInstanceNetworkInterfaceContextNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionInstanceNetworkInterfaceContextNext from the specified map of raw messages. -func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionInstanceNetworkInterfaceContextNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type ReservedIPCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionNext unmarshals an instance of ReservedIPCollectionNext from the specified map of raw messages. -func UnmarshalReservedIPCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionVirtualNetworkInterfaceContext : ReservedIPCollectionVirtualNetworkInterfaceContext struct -type ReservedIPCollectionVirtualNetworkInterfaceContext struct { - // A link to the first page of resources. - First *ReservedIPCollectionVirtualNetworkInterfaceContextFirst `json:"first" validate:"required"` - - // Collection of reserved IPs bound to the virtual network interface specified by the identifier in the URL. - Ips []ReservedIPReference `json:"ips" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *ReservedIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionVirtualNetworkInterfaceContext from the specified map of raw messages. -func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionVirtualNetworkInterfaceContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *ReservedIPCollectionVirtualNetworkInterfaceContext) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// ReservedIPCollectionVirtualNetworkInterfaceContextFirst : A link to the first page of resources. -type ReservedIPCollectionVirtualNetworkInterfaceContextFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionVirtualNetworkInterfaceContextFirst from the specified map of raw messages. -func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionVirtualNetworkInterfaceContextFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionVirtualNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type ReservedIPCollectionVirtualNetworkInterfaceContextNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionVirtualNetworkInterfaceContextNext from the specified map of raw messages. -func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionVirtualNetworkInterfaceContextNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPPatch : ReservedIPPatch struct -type ReservedIPPatch struct { - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with - // `ibm-` are reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` -} - -// UnmarshalReservedIPPatch unmarshals an instance of ReservedIPPatch from the specified map of raw messages. -func UnmarshalReservedIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPPatch) - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the ReservedIPPatch -func (reservedIPPatch *ReservedIPPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(reservedIPPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// ReservedIPReference : ReservedIPReference struct -type ReservedIPReference struct { - // The IP address. - // - // If the address has not yet been selected, the value will be `0.0.0.0`. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` - - // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPReference.ResourceType property. -// The resource type. -const ( - ReservedIPReferenceResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" -) - -// UnmarshalReservedIPReference unmarshals an instance of ReservedIPReference from the specified map of raw messages. -func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPReference) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ReservedIPReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalReservedIPReferenceDeleted unmarshals an instance of ReservedIPReferenceDeleted from the specified map of raw messages. -func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTarget : The target this reserved IP is bound to. -// -// If absent, this reserved IP is provider-owned or unbound. -// Models which "extend" this model: -// - ReservedIPTargetEndpointGatewayReference -// - ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext -// - ReservedIPTargetNetworkInterfaceReferenceTargetContext -// - ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext -// - ReservedIPTargetLoadBalancerReference -// - ReservedIPTargetVPNGatewayReference -// - ReservedIPTargetVPNServerReference -// - ReservedIPTargetGenericResourceReference -type ReservedIPTarget struct { - // The CRN for this endpoint gateway. - CRN *string `json:"crn,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this endpoint gateway. - Href *string `json:"href,omitempty"` - - // The unique identifier for this endpoint gateway. - ID *string `json:"id,omitempty"` - - // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the ReservedIPTarget.ResourceType property. -// The resource type. -const ( - ReservedIPTargetResourceTypeEndpointGatewayConst = "endpoint_gateway" -) - -func (*ReservedIPTarget) isaReservedIPTarget() bool { - return true -} - -type ReservedIPTargetIntf interface { - isaReservedIPTarget() bool -} - -// UnmarshalReservedIPTarget unmarshals an instance of ReservedIPTarget from the specified map of raw messages. -func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTarget) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetPrototype : The target to bind this reserved IP to. The target must be in the same VPC. -// -// The following targets are supported: -// - An endpoint gateway not already bound to a reserved IP in the subnet's zone. -// - A virtual network interface. -// -// If unspecified, the reserved IP will be created unbound. -// Models which "extend" this model: -// - ReservedIPTargetPrototypeEndpointGatewayIdentity -// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity -type ReservedIPTargetPrototype struct { - // The unique identifier for this endpoint gateway. - ID *string `json:"id,omitempty"` - - // The CRN for this endpoint gateway. - CRN *string `json:"crn,omitempty"` - - // The URL for this endpoint gateway. - Href *string `json:"href,omitempty"` -} - -func (*ReservedIPTargetPrototype) isaReservedIPTargetPrototype() bool { - return true -} - -type ReservedIPTargetPrototypeIntf interface { - isaReservedIPTargetPrototype() bool -} - -// UnmarshalReservedIPTargetPrototype unmarshals an instance of ReservedIPTargetPrototype from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ResourceFilter : Identifies one or more resources according to the specified filter property. -type ResourceFilter struct { - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// UnmarshalResourceFilter unmarshals an instance of ResourceFilter from the specified map of raw messages. -func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResourceFilter) - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ResourceGroupIdentity : The resource group to use. If unspecified, the account's [default resource -// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. -// Models which "extend" this model: -// - ResourceGroupIdentityByID -type ResourceGroupIdentity struct { - // The unique identifier for this resource group. - ID *string `json:"id,omitempty"` -} - -func (*ResourceGroupIdentity) isaResourceGroupIdentity() bool { - return true -} - -type ResourceGroupIdentityIntf interface { - isaResourceGroupIdentity() bool -} - -// UnmarshalResourceGroupIdentity unmarshals an instance of ResourceGroupIdentity from the specified map of raw messages. -func UnmarshalResourceGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResourceGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ResourceGroupReference : ResourceGroupReference struct -type ResourceGroupReference struct { - // The URL for this resource group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this resource group. - ID *string `json:"id" validate:"required"` - - // The name for this resource group. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalResourceGroupReference unmarshals an instance of ResourceGroupReference from the specified map of raw messages. -func UnmarshalResourceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResourceGroupReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RestartBareMetalServerOptions : The RestartBareMetalServer options. -type RestartBareMetalServerOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewRestartBareMetalServerOptions : Instantiate RestartBareMetalServerOptions -func (*VpcV1) NewRestartBareMetalServerOptions(id string) *RestartBareMetalServerOptions { - return &RestartBareMetalServerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *RestartBareMetalServerOptions) SetID(id string) *RestartBareMetalServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RestartBareMetalServerOptions) SetHeaders(param map[string]string) *RestartBareMetalServerOptions { - options.Headers = param - return options -} - -// Route : Route struct -type Route struct { - // The action to perform with a packet matching the route: - // - `delegate`: delegate to system-provided routes - // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes - // - `deliver`: deliver the packet to the specified `next_hop` - // - `drop`: drop the packet. - Action *string `json:"action" validate:"required"` - - // The date and time that the route was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If present, the resource that created the route. Routes with this property present cannot - // be directly deleted. All routes with an `origin` of `service` will have this property set, - // and future `origin` values may also have this property set. - Creator RouteCreatorIntf `json:"creator,omitempty"` - - // The destination CIDR of the route. - Destination *string `json:"destination" validate:"required"` - - // The URL for this route. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this route. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the route. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this route. The name is unique across all routes in the routing table. - Name *string `json:"name" validate:"required"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For - // other `action` values, its `address` will be `0.0.0.0`. - NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` - - // The origin of this route: - // - `service`: route was directly created by a service - // - `user`: route was directly created by a user - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. - Origin *string `json:"origin,omitempty"` - - // The priority of this route. Smaller values have higher priority. - // - // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest - // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is - // distributed between them. - Priority *int64 `json:"priority" validate:"required"` - - // The zone the route applies to. (Traffic from subnets in this zone will be - // subject to this route.). - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the Route.Action property. -// The action to perform with a packet matching the route: -// - `delegate`: delegate to system-provided routes -// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes -// - `deliver`: deliver the packet to the specified `next_hop` -// - `drop`: drop the packet. -const ( - RouteActionDelegateConst = "delegate" - RouteActionDelegateVPCConst = "delegate_vpc" - RouteActionDeliverConst = "deliver" - RouteActionDropConst = "drop" -) - -// Constants associated with the Route.LifecycleState property. -// The lifecycle state of the route. -const ( - RouteLifecycleStateDeletingConst = "deleting" - RouteLifecycleStateFailedConst = "failed" - RouteLifecycleStatePendingConst = "pending" - RouteLifecycleStateStableConst = "stable" - RouteLifecycleStateSuspendedConst = "suspended" - RouteLifecycleStateUpdatingConst = "updating" - RouteLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the Route.Origin property. -// The origin of this route: -// - `service`: route was directly created by a service -// - `user`: route was directly created by a user -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. -const ( - RouteOriginServiceConst = "service" - RouteOriginUserConst = "user" -) - -// UnmarshalRoute unmarshals an instance of Route from the specified map of raw messages. -func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Route) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteCollection : RouteCollection struct -type RouteCollection struct { - // A link to the first page of resources. - First *RouteCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *RouteCollectionNext `json:"next,omitempty"` - - // Collection of routes. - Routes []Route `json:"routes" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalRouteCollection unmarshals an instance of RouteCollection from the specified map of raw messages. -func UnmarshalRouteCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalRouteCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *RouteCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// RouteCollectionFirst : A link to the first page of resources. -type RouteCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalRouteCollectionFirst unmarshals an instance of RouteCollectionFirst from the specified map of raw messages. -func UnmarshalRouteCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type RouteCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalRouteCollectionNext unmarshals an instance of RouteCollectionNext from the specified map of raw messages. -func UnmarshalRouteCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteCollectionVPCContext : RouteCollectionVPCContext struct -type RouteCollectionVPCContext struct { - // A link to the first page of resources. - First *RouteCollectionVPCContextFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *RouteCollectionVPCContextNext `json:"next,omitempty"` - - // Collection of routes. - Routes []RouteCollectionVPCContextRoutesItem `json:"routes" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalRouteCollectionVPCContext unmarshals an instance of RouteCollectionVPCContext from the specified map of raw messages. -func UnmarshalRouteCollectionVPCContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollectionVPCContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalRouteCollectionVPCContextFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionVPCContextNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteCollectionVPCContextRoutesItem) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *RouteCollectionVPCContext) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// RouteCollectionVPCContextFirst : A link to the first page of resources. -type RouteCollectionVPCContextFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalRouteCollectionVPCContextFirst unmarshals an instance of RouteCollectionVPCContextFirst from the specified map of raw messages. -func UnmarshalRouteCollectionVPCContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollectionVPCContextFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteCollectionVPCContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type RouteCollectionVPCContextNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalRouteCollectionVPCContextNext unmarshals an instance of RouteCollectionVPCContextNext from the specified map of raw messages. -func UnmarshalRouteCollectionVPCContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollectionVPCContextNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteCollectionVPCContextRoutesItem : RouteCollectionVPCContextRoutesItem struct -type RouteCollectionVPCContextRoutesItem struct { - // The action to perform with a packet matching the route: - // - `delegate`: delegate to system-provided routes - // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes - // - `deliver`: deliver the packet to the specified `next_hop` - // - `drop`: drop the packet. - Action *string `json:"action" validate:"required"` - - // The date and time that the route was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If present, the resource that created the route. Routes with this property present cannot - // be directly deleted. All routes with an `origin` of `service` will have this property set, - // and future `origin` values may also have this property set. - Creator RouteCreatorIntf `json:"creator,omitempty"` - - // The destination CIDR of the route. - Destination *string `json:"destination" validate:"required"` - - // The URL for this route. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this route. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the route. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this route. The name is unique across all routes in the routing table. - Name *string `json:"name" validate:"required"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For - // other `action` values, its `address` will be `0.0.0.0`. - NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` - - // The origin of this route: - // - `service`: route was directly created by a service - // - `user`: route was directly created by a user - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. - Origin *string `json:"origin,omitempty"` - - // The priority of this route. Smaller values have higher priority. - // - // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest - // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is - // distributed between them. - Priority *int64 `json:"priority" validate:"required"` - - // The zone the route applies to. (Traffic from subnets in this zone will be - // subject to this route.). - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the RouteCollectionVPCContextRoutesItem.Action property. -// The action to perform with a packet matching the route: -// - `delegate`: delegate to system-provided routes -// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes -// - `deliver`: deliver the packet to the specified `next_hop` -// - `drop`: drop the packet. -const ( - RouteCollectionVPCContextRoutesItemActionDelegateConst = "delegate" - RouteCollectionVPCContextRoutesItemActionDelegateVPCConst = "delegate_vpc" - RouteCollectionVPCContextRoutesItemActionDeliverConst = "deliver" - RouteCollectionVPCContextRoutesItemActionDropConst = "drop" -) - -// Constants associated with the RouteCollectionVPCContextRoutesItem.LifecycleState property. -// The lifecycle state of the route. -const ( - RouteCollectionVPCContextRoutesItemLifecycleStateDeletingConst = "deleting" - RouteCollectionVPCContextRoutesItemLifecycleStateFailedConst = "failed" - RouteCollectionVPCContextRoutesItemLifecycleStatePendingConst = "pending" - RouteCollectionVPCContextRoutesItemLifecycleStateStableConst = "stable" - RouteCollectionVPCContextRoutesItemLifecycleStateSuspendedConst = "suspended" - RouteCollectionVPCContextRoutesItemLifecycleStateUpdatingConst = "updating" - RouteCollectionVPCContextRoutesItemLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the RouteCollectionVPCContextRoutesItem.Origin property. -// The origin of this route: -// - `service`: route was directly created by a service -// - `user`: route was directly created by a user -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. -const ( - RouteCollectionVPCContextRoutesItemOriginServiceConst = "service" - RouteCollectionVPCContextRoutesItemOriginUserConst = "user" -) - -// UnmarshalRouteCollectionVPCContextRoutesItem unmarshals an instance of RouteCollectionVPCContextRoutesItem from the specified map of raw messages. -func UnmarshalRouteCollectionVPCContextRoutesItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollectionVPCContextRoutesItem) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteCreator : If present, the resource that created the route. Routes with this property present cannot be directly deleted. All -// routes with an `origin` of `service` will have this property set, and future `origin` values may also have this -// property set. -// Models which "extend" this model: -// - RouteCreatorVPNGatewayReference -// - RouteCreatorVPNServerReference -type RouteCreator struct { - // The VPN gateway's CRN. - CRN *string `json:"crn,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The VPN gateway's canonical URL. - Href *string `json:"href,omitempty"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id,omitempty"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the RouteCreator.ResourceType property. -// The resource type. -const ( - RouteCreatorResourceTypeVPNGatewayConst = "vpn_gateway" -) - -func (*RouteCreator) isaRouteCreator() bool { - return true -} - -type RouteCreatorIntf interface { - isaRouteCreator() bool -} - -// UnmarshalRouteCreator unmarshals an instance of RouteCreator from the specified map of raw messages. -func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCreator) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHop : RouteNextHop struct -// Models which "extend" this model: -// - RouteNextHopIP -// - RouteNextHopVPNGatewayConnectionReference -type RouteNextHop struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the RouteNextHop.ResourceType property. -// The resource type. -const ( - RouteNextHopResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -func (*RouteNextHop) isaRouteNextHop() bool { - return true -} - -type RouteNextHopIntf interface { - isaRouteNextHop() bool -} - -// UnmarshalRouteNextHop unmarshals an instance of RouteNextHop from the specified map of raw messages. -func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHop) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPatch : If `action` is `deliver`, the next hop that packets will be delivered to. For other -// `action` values, specify `0.0.0.0` or remove it by specifying `null`. -// -// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has -// an `action` of `deliver` and `next_hop` is an IP address. -// Models which "extend" this model: -// - RouteNextHopPatchRouteNextHopIP -// - RouteNextHopPatchVPNGatewayConnectionIdentity -type RouteNextHopPatch struct { - // The sentinel IP address (`0.0.0.0`). - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*RouteNextHopPatch) isaRouteNextHopPatch() bool { - return true -} - -type RouteNextHopPatchIntf interface { - isaRouteNextHopPatch() bool -} - -// UnmarshalRouteNextHopPatch unmarshals an instance of RouteNextHopPatch from the specified map of raw messages. -func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatch) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePatch : RoutePatch struct -type RoutePatch struct { - // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` - // are reserved for system-provided routes, and are not allowed. - Name *string `json:"name,omitempty"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, specify `0.0.0.0` or remove it by specifying `null`. - // - // At most two routes per `zone` in a table can have the same `destination` and `priority`, - // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. - NextHop RouteNextHopPatchIntf `json:"next_hop,omitempty"` - - // The priority of this route. Smaller values have higher priority. - // - // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest - // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is - // distributed between them. - Priority *int64 `json:"priority,omitempty"` -} - -// UnmarshalRoutePatch unmarshals an instance of RoutePatch from the specified map of raw messages. -func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHopPatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the RoutePatch -func (routePatch *RoutePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(routePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// RoutePrototype : RoutePrototype struct -type RoutePrototype struct { - // The action to perform with a packet matching the route: - // - `delegate`: delegate to system-provided routes - // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes - // - `deliver`: deliver the packet to the specified `next_hop` - // - `drop`: drop the packet. - Action *string `json:"action,omitempty"` - - // The destination CIDR of the route. The host identifier in the CIDR must be zero. - // - // At most two routes per `zone` in a table can have the same `destination` and - // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. - Destination *string `json:"destination" validate:"required"` - - // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` - // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of - // randomly-selected words. - Name *string `json:"name,omitempty"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, it must be omitted or specified as `0.0.0.0`. - // - // At most two routes per `zone` in a table can have the same `destination` and `priority`, - // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. - NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` - - // The priority of this route. Smaller values have higher priority. - // - // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest - // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is - // distributed between them. - Priority *int64 `json:"priority,omitempty"` - - // The zone to apply the route to. (Traffic from subnets in this zone will be - // subject to this route.). - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -// Constants associated with the RoutePrototype.Action property. -// The action to perform with a packet matching the route: -// - `delegate`: delegate to system-provided routes -// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes -// - `deliver`: deliver the packet to the specified `next_hop` -// - `drop`: drop the packet. -const ( - RoutePrototypeActionDelegateConst = "delegate" - RoutePrototypeActionDelegateVPCConst = "delegate_vpc" - RoutePrototypeActionDeliverConst = "deliver" - RoutePrototypeActionDropConst = "drop" -) - -// NewRoutePrototype : Instantiate RoutePrototype (Generic Model Constructor) -func (*VpcV1) NewRoutePrototype(destination string, zone ZoneIdentityIntf) (_model *RoutePrototype, err error) { - _model = &RoutePrototype{ - Destination: core.StringPtr(destination), - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalRoutePrototype unmarshals an instance of RoutePrototype from the specified map of raw messages. -func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRoutePrototypeNextHop) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePrototypeNextHop : If `action` is `deliver`, the next hop that packets will be delivered to. For other -// `action` values, it must be omitted or specified as `0.0.0.0`. -// -// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has -// an `action` of `deliver` and `next_hop` is an IP address. -// Models which "extend" this model: -// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP -// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity -type RoutePrototypeNextHop struct { - // The sentinel IP address (`0.0.0.0`). - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*RoutePrototypeNextHop) isaRoutePrototypeNextHop() bool { - return true -} - -type RoutePrototypeNextHopIntf interface { - isaRoutePrototypeNextHop() bool -} - -// UnmarshalRoutePrototypeNextHop unmarshals an instance of RoutePrototypeNextHop from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHop(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHop) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteReference : RouteReference struct -type RouteReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *RouteReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this route. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this route. - ID *string `json:"id" validate:"required"` - - // The name for this route. The name is unique across all routes in the routing table. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalRouteReference unmarshals an instance of RouteReference from the specified map of raw messages. -func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRouteReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type RouteReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalRouteReferenceDeleted unmarshals an instance of RouteReferenceDeleted from the specified map of raw messages. -func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutingTable : RoutingTable struct -type RoutingTable struct { - // The filters specifying the resources that may create routes in this routing table. - // - // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter - // support is expected to expand in the future. - AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` - - // The date and time that this routing table was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this routing table. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this routing table. - ID *string `json:"id" validate:"required"` - - // Indicates whether this is the default routing table for this VPC. - IsDefault *bool `json:"is_default" validate:"required"` - - // The lifecycle state of the routing table. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this routing table. The name is unique across all routing tables for the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from - // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from the internet. - // - // Incoming traffic will be routed according to the routing table with two exceptions: - // - Traffic destined for IP addresses associated with public gateways will not be - // subject to routes in this routing table. - // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is - // an IP address in a subnet in the route's `zone` that is able to accept traffic. - // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from from [Transit - // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this - // VPC. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` - - // The routes for this routing table. - Routes []RouteReference `json:"routes" validate:"required"` - - // The subnets to which this routing table is attached. - Subnets []SubnetReference `json:"subnets" validate:"required"` -} - -// Constants associated with the RoutingTable.LifecycleState property. -// The lifecycle state of the routing table. -const ( - RoutingTableLifecycleStateDeletingConst = "deleting" - RoutingTableLifecycleStateFailedConst = "failed" - RoutingTableLifecycleStatePendingConst = "pending" - RoutingTableLifecycleStateStableConst = "stable" - RoutingTableLifecycleStateSuspendedConst = "suspended" - RoutingTableLifecycleStateUpdatingConst = "updating" - RoutingTableLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the RoutingTable.ResourceType property. -// The resource type. -const ( - RoutingTableResourceTypeRoutingTableConst = "routing_table" -) - -// UnmarshalRoutingTable unmarshals an instance of RoutingTable from the specified map of raw messages. -func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTable) - err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) - if err != nil { - return - } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutingTableCollection : RoutingTableCollection struct -type RoutingTableCollection struct { - // A link to the first page of resources. - First *RoutingTableCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *RoutingTableCollectionNext `json:"next,omitempty"` - - // Collection of routing tables. - RoutingTables []RoutingTable `json:"routing_tables" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalRoutingTableCollection unmarshals an instance of RoutingTableCollection from the specified map of raw messages. -func UnmarshalRoutingTableCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalRoutingTableCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRoutingTableCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "routing_tables", &obj.RoutingTables, UnmarshalRoutingTable) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *RoutingTableCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// RoutingTableCollectionFirst : A link to the first page of resources. -type RoutingTableCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalRoutingTableCollectionFirst unmarshals an instance of RoutingTableCollectionFirst from the specified map of raw messages. -func UnmarshalRoutingTableCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutingTableCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type RoutingTableCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalRoutingTableCollectionNext unmarshals an instance of RoutingTableCollectionNext from the specified map of raw messages. -func UnmarshalRoutingTableCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutingTableIdentity : Identifies a routing table by a unique property. -// Models which "extend" this model: -// - RoutingTableIdentityByID -// - RoutingTableIdentityByHref -type RoutingTableIdentity struct { - // The unique identifier for this routing table. - ID *string `json:"id,omitempty"` - - // The URL for this routing table. - Href *string `json:"href,omitempty"` -} - -func (*RoutingTableIdentity) isaRoutingTableIdentity() bool { - return true -} - -type RoutingTableIdentityIntf interface { - isaRoutingTableIdentity() bool -} - -// UnmarshalRoutingTableIdentity unmarshals an instance of RoutingTableIdentity from the specified map of raw messages. -func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutingTablePatch : RoutingTablePatch struct -type RoutingTablePatch struct { - // The filters specifying the resources that may create routes in this routing table - // (replacing any existing filters). All routes created by resources that match a given filter will be removed when an - // existing filter is removed. Therefore, if an empty array is specified, all filters will be removed, resulting in all - // routes not directly created by the user being removed. - // - // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter - // support is expected to expand in the future. - AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` - - // The 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. - // - // 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. - // - // 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"` -} - -// UnmarshalRoutingTablePatch unmarshals an instance of RoutingTablePatch from the specified map of raw messages. -func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTablePatch) - err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the RoutingTablePatch -func (routingTablePatch *RoutingTablePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(routingTablePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// RoutingTableReference : RoutingTableReference struct -type RoutingTableReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *RoutingTableReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this routing table. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this routing table. - ID *string `json:"id" validate:"required"` - - // The name for this routing table. The name is unique across all routing tables for the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the RoutingTableReference.ResourceType property. -// The resource type. -const ( - RoutingTableReferenceResourceTypeRoutingTableConst = "routing_table" -) - -// UnmarshalRoutingTableReference unmarshals an instance of RoutingTableReference from the specified map of raw messages. -func UnmarshalRoutingTableReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRoutingTableReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutingTableReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type RoutingTableReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalRoutingTableReferenceDeleted unmarshals an instance of RoutingTableReferenceDeleted from the specified map of raw messages. -func UnmarshalRoutingTableReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroup : SecurityGroup struct -type SecurityGroup struct { - // The date and time that this security group was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` - - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` - - // The name for this security group. The name is unique across all security groups for the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this security group. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The rules for this security group. If no rules exist, all traffic will be denied. - Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` - - // The targets for this security group. - Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` - - // The VPC this security group resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// UnmarshalSecurityGroup unmarshals an instance of SecurityGroup from the specified map of raw messages. -func UnmarshalSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroup) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) - if err != nil { - return - } - err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupCollection : SecurityGroupCollection struct -type SecurityGroupCollection struct { - // A link to the first page of resources. - First *SecurityGroupCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *SecurityGroupCollectionNext `json:"next,omitempty"` - - // Collection of security groups. - SecurityGroups []SecurityGroup `json:"security_groups" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalSecurityGroupCollection unmarshals an instance of SecurityGroupCollection from the specified map of raw messages. -func UnmarshalSecurityGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSecurityGroupCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroup) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *SecurityGroupCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// SecurityGroupCollectionFirst : A link to the first page of resources. -type SecurityGroupCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSecurityGroupCollectionFirst unmarshals an instance of SecurityGroupCollectionFirst from the specified map of raw messages. -func UnmarshalSecurityGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type SecurityGroupCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSecurityGroupCollectionNext unmarshals an instance of SecurityGroupCollectionNext from the specified map of raw messages. -func UnmarshalSecurityGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupIdentity : Identifies a security group by a unique property. -// Models which "extend" this model: -// - SecurityGroupIdentityByID -// - SecurityGroupIdentityByCRN -// - SecurityGroupIdentityByHref -type SecurityGroupIdentity struct { - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The security group's CRN. - CRN *string `json:"crn,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*SecurityGroupIdentity) isaSecurityGroupIdentity() bool { - return true -} - -type SecurityGroupIdentityIntf interface { - isaSecurityGroupIdentity() bool -} - -// UnmarshalSecurityGroupIdentity unmarshals an instance of SecurityGroupIdentity from the specified map of raw messages. -func UnmarshalSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupPatch : SecurityGroupPatch struct -type SecurityGroupPatch struct { - // The name for this security group. The name must not be used by another security group for the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalSecurityGroupPatch unmarshals an instance of SecurityGroupPatch from the specified map of raw messages. -func UnmarshalSecurityGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the SecurityGroupPatch -func (securityGroupPatch *SecurityGroupPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(securityGroupPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// SecurityGroupReference : SecurityGroupReference struct -type SecurityGroupReference struct { - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` - - // The name for this security group. The name is unique across all security groups for the VPC. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalSecurityGroupReference unmarshals an instance of SecurityGroupReference from the specified map of raw messages. -func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type SecurityGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalSecurityGroupReferenceDeleted unmarshals an instance of SecurityGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalSecurityGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRule : SecurityGroupRule struct -// Models which "extend" this model: -// - SecurityGroupRuleSecurityGroupRuleProtocolAll -// - SecurityGroupRuleSecurityGroupRuleProtocolIcmp -// - SecurityGroupRuleSecurityGroupRuleProtocolTcpudp -type SecurityGroupRule struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The URL for this security group rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group rule. - ID *string `json:"id" validate:"required"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The remote IP addresses or security groups from which this rule allows traffic (or to - // which, for outbound rules). A CIDR block of `0.0.0.0/0` allows traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` - - // The ICMP traffic code to allow. If absent, all codes are allowed. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to allow. If absent, all types are allowed. - Type *int64 `json:"type,omitempty"` - - // The inclusive upper bound of TCP/UDP destination port range. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - PortMin *int64 `json:"port_min,omitempty"` -} - -// Constants associated with the SecurityGroupRule.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRuleDirectionInboundConst = "inbound" - SecurityGroupRuleDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRule.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRuleIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRule.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRuleProtocolAllConst = "all" - SecurityGroupRuleProtocolIcmpConst = "icmp" - SecurityGroupRuleProtocolTCPConst = "tcp" - SecurityGroupRuleProtocolUDPConst = "udp" -) - -func (*SecurityGroupRule) isaSecurityGroupRule() bool { - return true -} - -type SecurityGroupRuleIntf interface { - isaSecurityGroupRule() bool -} - -// UnmarshalSecurityGroupRule unmarshals an instance of SecurityGroupRule from the specified map of raw messages. -func UnmarshalSecurityGroupRule(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "protocol", &discValue) - if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) - return - } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") - return - } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll) - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp) - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) - } - return -} - -// SecurityGroupRuleCollection : Collection of rules in a security group. -type SecurityGroupRuleCollection struct { - // Array of rules. - Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` -} - -// UnmarshalSecurityGroupRuleCollection unmarshals an instance of SecurityGroupRuleCollection from the specified map of raw messages. -func UnmarshalSecurityGroupRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleCollection) - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRulePatch : SecurityGroupRulePatch struct -type SecurityGroupRulePatch struct { - // The ICMP traffic code to allow. If set, `type` must also be set. - // - // Specify `null` to remove an existing ICMP traffic code. - Code *int64 `json:"code,omitempty"` - - // The direction of traffic to enforce. - Direction *string `json:"direction,omitempty"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` - - // The inclusive upper bound of the protocol destination port range. If set, `port_min` must also be set, and must not - // be larger. - // - // Specify `null` to remove an existing upper bound. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of the protocol destination port range. If set, `port_max` must also be set, and must not - // be smaller. - // - // Specify `null` to remove an existing lower bound. - PortMin *int64 `json:"port_min,omitempty"` - - // The remote IP addresses or security groups from which this rule will allow traffic (or to - // which, for outbound rules). Can be specified as an IP address, a CIDR block, or a - // security group. A CIDR block of `0.0.0.0/0` will allow traffic from any source (or to - // any destination, for outbound rules). - Remote SecurityGroupRuleRemotePatchIntf `json:"remote,omitempty"` - - // The ICMP traffic type to allow. - // - // Specify `null` to remove an existing ICMP traffic type value. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the SecurityGroupRulePatch.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePatchDirectionInboundConst = "inbound" - SecurityGroupRulePatchDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePatch.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRulePatchIPVersionIpv4Const = "ipv4" -) - -// UnmarshalSecurityGroupRulePatch unmarshals an instance of SecurityGroupRulePatch from the specified map of raw messages. -func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRulePatch) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the SecurityGroupRulePatch -func (securityGroupRulePatch *SecurityGroupRulePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(securityGroupRulePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// SecurityGroupRulePrototype : SecurityGroupRulePrototype struct -// Models which "extend" this model: -// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll -// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp -// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp -type SecurityGroupRulePrototype struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The remote IP addresses or security groups from which this rule will allow traffic (or to - // which, for outbound rules). Can be specified as an IP address, a CIDR block, or a - // security group within the VPC. - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` - - // The ICMP traffic code to allow. - // - // If specified, `type` must also be specified. If unspecified, all codes are allowed. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to allow. - // - // If unspecified, all types are allowed. - Type *int64 `json:"type,omitempty"` - - // The inclusive upper bound of TCP/UDP destination port range. - // - // If specified, `port_min` must also be specified, and must not be larger. If unspecified, - // `port_min` must also be unspecified, allowing traffic on all destination ports. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range - // - // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be - // unspecified, allowing traffic on all destination ports. - PortMin *int64 `json:"port_min,omitempty"` -} - -// Constants associated with the SecurityGroupRulePrototype.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePrototypeDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePrototype.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRulePrototype.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRulePrototypeProtocolAllConst = "all" - SecurityGroupRulePrototypeProtocolIcmpConst = "icmp" - SecurityGroupRulePrototypeProtocolTCPConst = "tcp" - SecurityGroupRulePrototypeProtocolUDPConst = "udp" -) - -func (*SecurityGroupRulePrototype) isaSecurityGroupRulePrototype() bool { - return true -} - -type SecurityGroupRulePrototypeIntf interface { - isaSecurityGroupRulePrototype() bool -} - -// UnmarshalSecurityGroupRulePrototype unmarshals an instance of SecurityGroupRulePrototype from the specified map of raw messages. -func UnmarshalSecurityGroupRulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "protocol", &discValue) - if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) - return - } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") - return - } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) - } - return -} - -// SecurityGroupRuleRemote : The remote IP addresses or security groups from which this rule allows traffic (or to which, for outbound rules). A -// CIDR block of `0.0.0.0/0` allows traffic from any source -// (or to any destination, for outbound rules). -// Models which "extend" this model: -// - SecurityGroupRuleRemoteIP -// - SecurityGroupRuleRemoteCIDR -// - SecurityGroupRuleRemoteSecurityGroupReference -type SecurityGroupRuleRemote struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` - - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. - CIDRBlock *string `json:"cidr_block,omitempty"` - - // The security group's CRN. - CRN *string `json:"crn,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href,omitempty"` - - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The name for this security group. The name is unique across all security groups for the VPC. - Name *string `json:"name,omitempty"` -} - -func (*SecurityGroupRuleRemote) isaSecurityGroupRuleRemote() bool { - return true -} - -type SecurityGroupRuleRemoteIntf interface { - isaSecurityGroupRuleRemote() bool -} - -// UnmarshalSecurityGroupRuleRemote unmarshals an instance of SecurityGroupRuleRemote from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemote) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePatch : The remote IP addresses or security groups from which this rule will allow traffic (or to which, for outbound rules). -// Can be specified as an IP address, a CIDR block, or a security group. A CIDR block of `0.0.0.0/0` will allow traffic -// from any source (or to any destination, for outbound rules). -// Models which "extend" this model: -// - SecurityGroupRuleRemotePatchIP -// - SecurityGroupRuleRemotePatchCIDR -// - SecurityGroupRuleRemotePatchSecurityGroupIdentity -type SecurityGroupRuleRemotePatch struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` - - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. - CIDRBlock *string `json:"cidr_block,omitempty"` - - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The security group's CRN. - CRN *string `json:"crn,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*SecurityGroupRuleRemotePatch) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -type SecurityGroupRuleRemotePatchIntf interface { - isaSecurityGroupRuleRemotePatch() bool -} - -// UnmarshalSecurityGroupRuleRemotePatch unmarshals an instance of SecurityGroupRuleRemotePatch from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatch) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePrototype : The remote IP addresses or security groups from which this rule will allow traffic (or to which, for outbound rules). -// Can be specified as an IP address, a CIDR block, or a security group within the VPC. -// -// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source -// (or to any destination, for outbound rules). -// Models which "extend" this model: -// - SecurityGroupRuleRemotePrototypeIP -// - SecurityGroupRuleRemotePrototypeCIDR -// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentity -type SecurityGroupRuleRemotePrototype struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` - - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. - CIDRBlock *string `json:"cidr_block,omitempty"` - - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The security group's CRN. - CRN *string `json:"crn,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*SecurityGroupRuleRemotePrototype) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -type SecurityGroupRuleRemotePrototypeIntf interface { - isaSecurityGroupRuleRemotePrototype() bool -} - -// UnmarshalSecurityGroupRuleRemotePrototype unmarshals an instance of SecurityGroupRuleRemotePrototype from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototype) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupTargetCollection : SecurityGroupTargetCollection struct -type SecurityGroupTargetCollection struct { - // A link to the first page of resources. - First *SecurityGroupTargetCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *SecurityGroupTargetCollectionNext `json:"next,omitempty"` - - // Collection of targets for this security group. - Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalSecurityGroupTargetCollection unmarshals an instance of SecurityGroupTargetCollection from the specified map of raw messages. -func UnmarshalSecurityGroupTargetCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSecurityGroupTargetCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupTargetCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *SecurityGroupTargetCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// SecurityGroupTargetCollectionFirst : A link to the first page of resources. -type SecurityGroupTargetCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSecurityGroupTargetCollectionFirst unmarshals an instance of SecurityGroupTargetCollectionFirst from the specified map of raw messages. -func UnmarshalSecurityGroupTargetCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupTargetCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type SecurityGroupTargetCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSecurityGroupTargetCollectionNext unmarshals an instance of SecurityGroupTargetCollectionNext from the specified map of raw messages. -func UnmarshalSecurityGroupTargetCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupTargetReference : The resource types that can be security group targets are expected to expand in the future. When iterating over -// security group targets, do not assume that every target resource will be from a known set of resource types. -// Optionally halt processing and surface an error, or bypass resources of unrecognized types. -// Models which "extend" this model: -// - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext -// - SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext -// - SecurityGroupTargetReferenceLoadBalancerReference -// - SecurityGroupTargetReferenceEndpointGatewayReference -// - SecurityGroupTargetReferenceVPNServerReference -// - SecurityGroupTargetReferenceVirtualNetworkInterfaceReference -type SecurityGroupTargetReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - Href *string `json:"href,omitempty"` - - // The unique identifier for this instance network interface. - ID *string `json:"id,omitempty"` - - // The name for this instance network interface. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` - - // The load balancer's CRN. - CRN *string `json:"crn,omitempty"` - - // The primary IP for this virtual network interface. - PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet,omitempty"` -} - -// Constants associated with the SecurityGroupTargetReference.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*SecurityGroupTargetReference) isaSecurityGroupTargetReference() bool { - return true -} - -type SecurityGroupTargetReferenceIntf interface { - isaSecurityGroupTargetReference() bool -} - -// UnmarshalSecurityGroupTargetReference unmarshals an instance of SecurityGroupTargetReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SetSubnetPublicGatewayOptions : The SetSubnetPublicGateway options. -type SetSubnetPublicGatewayOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // The public gateway identity. - PublicGatewayIdentity PublicGatewayIdentityIntf `json:"PublicGatewayIdentity" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewSetSubnetPublicGatewayOptions : Instantiate SetSubnetPublicGatewayOptions -func (*VpcV1) NewSetSubnetPublicGatewayOptions(id string, publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { - return &SetSubnetPublicGatewayOptions{ - ID: core.StringPtr(id), - PublicGatewayIdentity: publicGatewayIdentity, - } -} - -// SetID : Allow user to set ID -func (_options *SetSubnetPublicGatewayOptions) SetID(id string) *SetSubnetPublicGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetPublicGatewayIdentity : Allow user to set PublicGatewayIdentity -func (_options *SetSubnetPublicGatewayOptions) SetPublicGatewayIdentity(publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { - _options.PublicGatewayIdentity = publicGatewayIdentity - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *SetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *SetSubnetPublicGatewayOptions { - options.Headers = param - return options -} - -// Share : Share struct -type Share struct { - // The access control mode for the share: - // - // - `security_group`: The security groups on the virtual network interface for a mount - // target control access to the mount target. - // - `vpc`: All clients in the VPC for a mount target have access to the mount target. - // - // The enumerated access control mode values for this property may expand in the future. When processing this property, - // check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which - // the unexpected access control mode was encountered. - AccessControlMode *string `json:"access_control_mode" validate:"required"` - - // The date and time that the file share is created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this file share. - CRN *string `json:"crn" validate:"required"` - - // The type of encryption used for this file share. - Encryption *string `json:"encryption" validate:"required"` - - // The key used to encrypt this file share. - // - // This property will be present if `encryption_type` is `user_managed`. - EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` - - // The URL for this file share. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this file share. - ID *string `json:"id" validate:"required"` - - // The maximum input/output operations per second (IOPS) for the file share. In addition, each client accessing the - // share will be restricted to 48,000 IOPS. - // - // The maximum IOPS for a share may increase in the future. - Iops *int64 `json:"iops" validate:"required"` - - // The latest job associated with this file share. - // - // This property will be absent if no jobs have been created for this file share. - LatestJob *ShareJob `json:"latest_job,omitempty"` - - // The lifecycle state of the file share. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The mount targets for the file share. - MountTargets []ShareMountTargetReference `json:"mount_targets" validate:"required"` - - // The name for this share. The name is unique across all shares in the region. - Name *string `json:"name" validate:"required"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) for - // this file share. - Profile *ShareProfileReference `json:"profile" validate:"required"` - - // The replica file share for this source file share. - // - // This property will be present when the `replication_role` is `source`. - ReplicaShare *ShareReference `json:"replica_share,omitempty"` - - // The cron specification for the file share replication schedule. - // - // This property will be present when the `replication_role` is `replica`. - ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` - - // The replication role of the file share. - // - // * `none`: This share is not participating in replication. - // * `replica`: This share is a replication target. - // * `source`: This share is a replication source. - ReplicationRole *string `json:"replication_role" validate:"required"` - - // The replication status of the file share. - // - // * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the - // replication schedule. - // * `failover_pending`: This share is performing a replication failover. - // * `initializing`: This share is initializing replication. - // * `none`: This share is not participating in replication. - // * `split_pending`: This share is performing a replication split. - ReplicationStatus *string `json:"replication_status" validate:"required"` - - // The reasons for the current replication status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - ReplicationStatusReasons []ShareReplicationStatusReason `json:"replication_status_reasons" validate:"required"` - - // The resource group for this file share. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The size of the file share rounded up to the next gigabyte. - // - // The maximum size for a share may increase in the future. - Size *int64 `json:"size" validate:"required"` - - // The source file share for this replica file share. - // - // This property will be present when the `replication_role` is `replica`. - SourceShare *ShareReference `json:"source_share,omitempty"` - - // Tags for this resource. - UserTags []string `json:"user_tags" validate:"required"` - - // The zone this file share will reside in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the Share.AccessControlMode property. -// The access control mode for the share: -// -// - `security_group`: The security groups on the virtual network interface for a mount -// target control access to the mount target. -// - `vpc`: All clients in the VPC for a mount target have access to the mount target. -// -// The enumerated access control mode values for this property may expand in the future. When processing this property, -// check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which -// the unexpected access control mode was encountered. -const ( - ShareAccessControlModeSecurityGroupConst = "security_group" - ShareAccessControlModeVPCConst = "vpc" -) - -// Constants associated with the Share.Encryption property. -// The type of encryption used for this file share. -const ( - ShareEncryptionProviderManagedConst = "provider_managed" - ShareEncryptionUserManagedConst = "user_managed" -) - -// Constants associated with the Share.LifecycleState property. -// The lifecycle state of the file share. -const ( - ShareLifecycleStateDeletingConst = "deleting" - ShareLifecycleStateFailedConst = "failed" - ShareLifecycleStatePendingConst = "pending" - ShareLifecycleStateStableConst = "stable" - ShareLifecycleStateSuspendedConst = "suspended" - ShareLifecycleStateUpdatingConst = "updating" - ShareLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the Share.ReplicationRole property. -// The replication role of the file share. -// -// * `none`: This share is not participating in replication. -// * `replica`: This share is a replication target. -// * `source`: This share is a replication source. -const ( - ShareReplicationRoleNoneConst = "none" - ShareReplicationRoleReplicaConst = "replica" - ShareReplicationRoleSourceConst = "source" -) - -// Constants associated with the Share.ReplicationStatus property. -// The replication status of the file share. -// -// * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the -// replication schedule. -// * `failover_pending`: This share is performing a replication failover. -// * `initializing`: This share is initializing replication. -// * `none`: This share is not participating in replication. -// * `split_pending`: This share is performing a replication split. -const ( - ShareReplicationStatusActiveConst = "active" - ShareReplicationStatusFailoverPendingConst = "failover_pending" - ShareReplicationStatusInitializingConst = "initializing" - ShareReplicationStatusNoneConst = "none" - ShareReplicationStatusSplitPendingConst = "split_pending" -) - -// Constants associated with the Share.ResourceType property. -// The resource type. -const ( - ShareResourceTypeShareConst = "share" -) - -// UnmarshalShare unmarshals an instance of Share from the specified map of raw messages. -func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Share) - err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalModel(m, "latest_job", &obj.LatestJob, UnmarshalShareJob) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalShareReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "replication_role", &obj.ReplicationRole) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "replication_status", &obj.ReplicationStatus) - if err != nil { - return - } - err = core.UnmarshalModel(m, "replication_status_reasons", &obj.ReplicationStatusReasons, UnmarshalShareReplicationStatusReason) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareCollection : ShareCollection struct -type ShareCollection struct { - // A link to the first page of resources. - First *ShareCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *ShareCollectionNext `json:"next,omitempty"` - - // Collection of file shares. - Shares []Share `json:"shares" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalShareCollection unmarshals an instance of ShareCollection from the specified map of raw messages. -func UnmarshalShareCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "shares", &obj.Shares, UnmarshalShare) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *ShareCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// ShareCollectionFirst : A link to the first page of resources. -type ShareCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareCollectionFirst unmarshals an instance of ShareCollectionFirst from the specified map of raw messages. -func UnmarshalShareCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type ShareCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareCollectionNext unmarshals an instance of ShareCollectionNext from the specified map of raw messages. -func UnmarshalShareCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareIdentity : Identifies a file share by a unique property. -// Models which "extend" this model: -// - ShareIdentityByID -// - ShareIdentityByCRN -// - ShareIdentityByHref -type ShareIdentity struct { - // The unique identifier for this file share. - ID *string `json:"id,omitempty"` - - // The CRN for this file share. - CRN *string `json:"crn,omitempty"` - - // The URL for this file share. - Href *string `json:"href,omitempty"` -} - -func (*ShareIdentity) isaShareIdentity() bool { - return true -} - -type ShareIdentityIntf interface { - isaShareIdentity() bool -} - -// UnmarshalShareIdentity unmarshals an instance of ShareIdentity from the specified map of raw messages. -func UnmarshalShareIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareInitialOwner : ShareInitialOwner struct -type ShareInitialOwner struct { - // The initial group identifier for the file share. - Gid *int64 `json:"gid,omitempty"` - - // The initial user identifier for the file share. - Uid *int64 `json:"uid,omitempty"` -} - -// UnmarshalShareInitialOwner unmarshals an instance of ShareInitialOwner from the specified map of raw messages. -func UnmarshalShareInitialOwner(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareInitialOwner) - err = core.UnmarshalPrimitive(m, "gid", &obj.Gid) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "uid", &obj.Uid) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareJob : ShareJob struct -type ShareJob struct { - // The status of the file share job. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the - // unexpected property value was encountered. - // - // * `cancelled`: This job has been cancelled. - // * `failed`: This job has failed. - // * `queued`: This job is queued. - // * `running`: This job is running. - // * `succeeded`: This job completed successfully. - Status *string `json:"status" validate:"required"` - - // The reasons for the file share job status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []ShareJobStatusReason `json:"status_reasons" validate:"required"` - - // The type of the file share job. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the - // unexpected property value was encountered. - // - // * `replication_failover`: This is a share replication failover job. - // * `replication_init`: This is a share replication is initialization job. - // * `replication_split`: This is a share replication split job. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the ShareJob.Status property. -// The status of the file share job. -// -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the -// unexpected property value was encountered. -// -// * `cancelled`: This job has been cancelled. -// * `failed`: This job has failed. -// * `queued`: This job is queued. -// * `running`: This job is running. -// * `succeeded`: This job completed successfully. -const ( - ShareJobStatusCancelledConst = "cancelled" - ShareJobStatusFailedConst = "failed" - ShareJobStatusQueuedConst = "queued" - ShareJobStatusRunningConst = "running" - ShareJobStatusSucceededConst = "succeeded" -) - -// Constants associated with the ShareJob.Type property. -// The type of the file share job. -// -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the -// unexpected property value was encountered. -// -// * `replication_failover`: This is a share replication failover job. -// * `replication_init`: This is a share replication is initialization job. -// * `replication_split`: This is a share replication split job. -const ( - ShareJobTypeReplicationFailoverConst = "replication_failover" - ShareJobTypeReplicationInitConst = "replication_init" - ShareJobTypeReplicationSplitConst = "replication_split" -) - -// UnmarshalShareJob unmarshals an instance of ShareJob from the specified map of raw messages. -func UnmarshalShareJob(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareJob) - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalShareJobStatusReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareJobStatusReason : ShareJobStatusReason struct -type ShareJobStatusReason struct { - // A snake case string succinctly identifying the status reason. - Code *string `json:"code" validate:"required"` - - // An explanation of the status reason. - Message *string `json:"message" validate:"required"` - - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the ShareJobStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -const ( - ShareJobStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" - ShareJobStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" - ShareJobStatusReasonCodeCannotReachSourceShareConst = "cannot_reach_source_share" -) - -// UnmarshalShareJobStatusReason unmarshals an instance of ShareJobStatusReason from the specified map of raw messages. -func UnmarshalShareJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareJobStatusReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTarget : ShareMountTarget struct -type ShareMountTarget struct { - // The access control mode for the share: - // - // - `security_group`: The security groups on the virtual network interface for a mount - // target control access to the mount target. - // - `vpc`: All clients in the VPC for a mount target have access to the mount target. - // - // The enumerated access control mode values for this property may expand in the future. When processing this property, - // check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which - // the unexpected access control mode was encountered. - AccessControlMode *string `json:"access_control_mode" validate:"required"` - - // The date and time that the share mount target was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this share mount target. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this share mount target. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the mount target. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The mount path for the share. The server component of the mount path may be either an IP address or a fully - // qualified domain name. - // - // This property will be absent if the `lifecycle_state` of the mount target is - // 'pending', `failed`, or `deleting`. - // - // If the share's `access_control_mode` is: - // - // - `security_group`: The IP address used in the mount path is the `primary_ip` - // address of the virtual network interface for this share mount target. - // - `vpc`: The fully-qualified domain name used in the mount path is an address that - // resolves to the share mount target. - MountPath *string `json:"mount_path,omitempty"` - - // The name for this share mount target. The name is unique across all mount targets for the file share. - Name *string `json:"name" validate:"required"` - - // The primary IP address of the virtual network interface for the share mount target. - // - // Absent if `access_control_mode` is `vpc`. - PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The subnet of the virtual network interface for the share mount target. - // - // Absent if `access_control_mode` is `vpc`. - Subnet *SubnetReference `json:"subnet,omitempty"` - - // The transit encryption mode for this share mount target: - // - `none`: Not encrypted in transit - // - `user_managed`: Encrypted in transit using an instance identity certificate - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. - TransitEncryption *string `json:"transit_encryption" validate:"required"` - - // The virtual network interface for this file share mount target. - // - // This property will be present when the `access_control_mode` is `security_group`. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface,omitempty"` - - // If `access_control_mode` is: - // - // - `security_group`: The VPC for the virtual network interface for this share mount - // target - // - `vpc`: The VPC in which clients can mount the file share using this share - // mount target. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// Constants associated with the ShareMountTarget.AccessControlMode property. -// The access control mode for the share: -// -// - `security_group`: The security groups on the virtual network interface for a mount -// target control access to the mount target. -// - `vpc`: All clients in the VPC for a mount target have access to the mount target. -// -// The enumerated access control mode values for this property may expand in the future. When processing this property, -// check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which -// the unexpected access control mode was encountered. -const ( - ShareMountTargetAccessControlModeSecurityGroupConst = "security_group" - ShareMountTargetAccessControlModeVPCConst = "vpc" -) - -// Constants associated with the ShareMountTarget.LifecycleState property. -// The lifecycle state of the mount target. -const ( - ShareMountTargetLifecycleStateDeletingConst = "deleting" - ShareMountTargetLifecycleStateFailedConst = "failed" - ShareMountTargetLifecycleStatePendingConst = "pending" - ShareMountTargetLifecycleStateStableConst = "stable" - ShareMountTargetLifecycleStateSuspendedConst = "suspended" - ShareMountTargetLifecycleStateUpdatingConst = "updating" - ShareMountTargetLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the ShareMountTarget.ResourceType property. -// The resource type. -const ( - ShareMountTargetResourceTypeShareMountTargetConst = "share_mount_target" -) - -// Constants associated with the ShareMountTarget.TransitEncryption property. -// The transit encryption mode for this share mount target: -// - `none`: Not encrypted in transit -// - `user_managed`: Encrypted in transit using an instance identity certificate -// -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. -const ( - ShareMountTargetTransitEncryptionNoneConst = "none" - ShareMountTargetTransitEncryptionUserManagedConst = "user_managed" -) - -// UnmarshalShareMountTarget unmarshals an instance of ShareMountTarget from the specified map of raw messages. -func UnmarshalShareMountTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTarget) - err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mount_path", &obj.MountPath) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetCollection : ShareMountTargetCollection struct -type ShareMountTargetCollection struct { - // A link to the first page of resources. - First *ShareMountTargetCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of share mount targets. - MountTargets []ShareMountTarget `json:"mount_targets" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *ShareMountTargetCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalShareMountTargetCollection unmarshals an instance of ShareMountTargetCollection from the specified map of raw messages. -func UnmarshalShareMountTargetCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareMountTargetCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTarget) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareMountTargetCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *ShareMountTargetCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// ShareMountTargetCollectionFirst : A link to the first page of resources. -type ShareMountTargetCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareMountTargetCollectionFirst unmarshals an instance of ShareMountTargetCollectionFirst from the specified map of raw messages. -func UnmarshalShareMountTargetCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type ShareMountTargetCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareMountTargetCollectionNext unmarshals an instance of ShareMountTargetCollectionNext from the specified map of raw messages. -func UnmarshalShareMountTargetCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetPatch : ShareMountTargetPatch struct -type ShareMountTargetPatch struct { - // The name for this share mount target. The name must not be used by another mount target for the file share. - Name *string `json:"name,omitempty"` -} - -// UnmarshalShareMountTargetPatch unmarshals an instance of ShareMountTargetPatch from the specified map of raw messages. -func UnmarshalShareMountTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the ShareMountTargetPatch -func (shareMountTargetPatch *ShareMountTargetPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(shareMountTargetPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// ShareMountTargetPrototype : ShareMountTargetPrototype struct -// Models which "extend" this model: -// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup -// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC -type ShareMountTargetPrototype struct { - // The name for this share mount target. The name must not be used by another mount target for the file share. - Name *string `json:"name,omitempty"` - - // The transit encryption mode to use for this share mount target: - // - `none`: Not encrypted in transit. - // - `user_managed`: Encrypted in transit using an instance identity certificate. The - // `access_control_mode` for the share must be `security_group`. - TransitEncryption *string `json:"transit_encryption,omitempty"` - - VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface,omitempty"` - - // Identifies a VPC by a unique property. - VPC VPCIdentityIntf `json:"vpc,omitempty"` -} - -// Constants associated with the ShareMountTargetPrototype.TransitEncryption property. -// The transit encryption mode to use for this share mount target: -// - `none`: Not encrypted in transit. -// - `user_managed`: Encrypted in transit using an instance identity certificate. The -// `access_control_mode` for the share must be `security_group`. -const ( - ShareMountTargetPrototypeTransitEncryptionNoneConst = "none" - ShareMountTargetPrototypeTransitEncryptionUserManagedConst = "user_managed" -) - -func (*ShareMountTargetPrototype) isaShareMountTargetPrototype() bool { - return true -} - -type ShareMountTargetPrototypeIntf interface { - isaShareMountTargetPrototype() bool -} - -// UnmarshalShareMountTargetPrototype unmarshals an instance of ShareMountTargetPrototype from the specified map of raw messages. -func UnmarshalShareMountTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetReference : ShareMountTargetReference struct -type ShareMountTargetReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this share mount target. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this share mount target. - ID *string `json:"id" validate:"required"` - - // The name for this share mount target. The name is unique across all mount targets for the file share. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ShareMountTargetReference.ResourceType property. -// The resource type. -const ( - ShareMountTargetReferenceResourceTypeShareMountTargetConst = "share_mount_target" -) - -// UnmarshalShareMountTargetReference unmarshals an instance of ShareMountTargetReference from the specified map of raw messages. -func UnmarshalShareMountTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ShareMountTargetReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalShareMountTargetReferenceDeleted unmarshals an instance of ShareMountTargetReferenceDeleted from the specified map of raw messages. -func UnmarshalShareMountTargetReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetVirtualNetworkInterfacePrototype : ShareMountTargetVirtualNetworkInterfacePrototype struct -// Models which "extend" this model: -// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext -// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity -type ShareMountTargetVirtualNetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on - // this interface. If `true`, source IP spoofing is allowed on this interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the virtual network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - If the virtual network interface is attached, the target `resource_type` must be - // `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 - // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // same subnet as the primary IP. - // - // If reserved IP identities are provided, the specified reserved IPs must be unbound. - // - // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network - // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet - // will be automatically selected and reserved. - Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are - // reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the virtual network interface. May be either a - // reserved IP identity, or a reserved IP prototype object which will be used to create a - // new reserved IP. - // - // If a reserved IP identity is provided, the specified reserved IP must be unbound. - // - // If a reserved IP prototype object with an address is provided, the address must be - // available on the virtual network interface's subnet. If no address is specified, - // an available address on the subnet will be automatically selected and reserved. - PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The resource group to use for this virtual network interface. If unspecified, the - // share's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. Required if `primary_ip` does not specify a reserved IP. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototype) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { - return true -} - -type ShareMountTargetVirtualNetworkInterfacePrototypeIntf interface { - isaShareMountTargetVirtualNetworkInterfacePrototype() bool -} - -// UnmarshalShareMountTargetVirtualNetworkInterfacePrototype unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototype from the specified map of raw messages. -func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetVirtualNetworkInterfacePrototype) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SharePatch : SharePatch struct -type SharePatch struct { - // The access control mode for the share: - // - // - `security_group`: The security groups on the virtual network interface for a - // mount target control access to the mount target. - // - `vpc`: All clients in the VPC for a mount target have access to the mount target. - // - // For this property to be changed, the share must have no mount targets and - // `replication_role` must be `none`. - AccessControlMode *string `json:"access_control_mode,omitempty"` - - // The maximum input/output operations per second (IOPS) for the file share. The value must be in the range supported - // by the share's size. - // - // For this property to be changed, the share `lifecycle_state` must be `stable`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this share. The name must not be used by another share in the region. - Name *string `json:"name,omitempty"` - - // The profile to use for this file share. - // - // The requested profile must be in the same `family`. - Profile ShareProfileIdentityIntf `json:"profile,omitempty"` - - // The cron specification for the file share replication schedule. - // - // Replication of a share can be scheduled to occur at most once per hour. - // - // For this property to be changed, the share `replication_role` must be `replica`. - ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` - - // The size of the file share rounded up to the next gigabyte. The value must not be less than the share's current - // size, and must not exceed the maximum supported by the share's profile and IOPS. - // - // For this property to be changed, the share `lifecycle_state` must be `stable`. - Size *int64 `json:"size,omitempty"` - - // Tags for this resource. - UserTags []string `json:"user_tags,omitempty"` -} - -// Constants associated with the SharePatch.AccessControlMode property. -// The access control mode for the share: -// -// - `security_group`: The security groups on the virtual network interface for a -// mount target control access to the mount target. -// - `vpc`: All clients in the VPC for a mount target have access to the mount target. -// -// For this property to be changed, the share must have no mount targets and -// `replication_role` must be `none`. -const ( - SharePatchAccessControlModeSecurityGroupConst = "security_group" - SharePatchAccessControlModeVPCConst = "vpc" -) - -// UnmarshalSharePatch unmarshals an instance of SharePatch from the specified map of raw messages. -func UnmarshalSharePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SharePatch) - err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the SharePatch -func (sharePatch *SharePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(sharePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// ShareProfile : ShareProfile struct -type ShareProfile struct { - // The permitted capacity range (in gigabytes) for a share with this profile. - Capacity ShareProfileCapacityIntf `json:"capacity" validate:"required"` - - // The product family this share profile belongs to. - Family *string `json:"family" validate:"required"` - - // The URL for this share profile. - Href *string `json:"href" validate:"required"` - - // The permitted IOPS range for a share with this profile. - Iops ShareProfileIopsIntf `json:"iops" validate:"required"` - - // The globally unique name for this share profile. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ShareProfile.Family property. -// The product family this share profile belongs to. -const ( - ShareProfileFamilyDefinedPerformanceConst = "defined_performance" -) - -// Constants associated with the ShareProfile.ResourceType property. -// The resource type. -const ( - ShareProfileResourceTypeShareProfileConst = "share_profile" -) - -// UnmarshalShareProfile unmarshals an instance of ShareProfile from the specified map of raw messages. -func UnmarshalShareProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfile) - err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalShareProfileCapacity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalModel(m, "iops", &obj.Iops, UnmarshalShareProfileIops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileCapacity : ShareProfileCapacity struct -// Models which "extend" this model: -// - ShareProfileCapacityFixed -// - ShareProfileCapacityRange -// - ShareProfileCapacityEnum -// - ShareProfileCapacityDependentRange -type ShareProfileCapacity struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the ShareProfileCapacity.Type property. -// The type for this profile field. -const ( - ShareProfileCapacityTypeFixedConst = "fixed" -) - -func (*ShareProfileCapacity) isaShareProfileCapacity() bool { - return true -} - -type ShareProfileCapacityIntf interface { - isaShareProfileCapacity() bool -} - -// UnmarshalShareProfileCapacity unmarshals an instance of ShareProfileCapacity from the specified map of raw messages. -func UnmarshalShareProfileCapacity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCapacity) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileCollection : ShareProfileCollection struct -type ShareProfileCollection struct { - // A link to the first page of resources. - First *ShareProfileCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *ShareProfileCollectionNext `json:"next,omitempty"` - - // Collection of share profiles. - Profiles []ShareProfile `json:"profiles" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalShareProfileCollection unmarshals an instance of ShareProfileCollection from the specified map of raw messages. -func UnmarshalShareProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareProfileCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareProfileCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalShareProfile) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *ShareProfileCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// ShareProfileCollectionFirst : A link to the first page of resources. -type ShareProfileCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareProfileCollectionFirst unmarshals an instance of ShareProfileCollectionFirst from the specified map of raw messages. -func UnmarshalShareProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type ShareProfileCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareProfileCollectionNext unmarshals an instance of ShareProfileCollectionNext from the specified map of raw messages. -func UnmarshalShareProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileIops : ShareProfileIops struct -// Models which "extend" this model: -// - ShareProfileIopsFixed -// - ShareProfileIopsRange -// - ShareProfileIopsEnum -// - ShareProfileIopsDependentRange -type ShareProfileIops struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the ShareProfileIops.Type property. -// The type for this profile field. -const ( - ShareProfileIopsTypeFixedConst = "fixed" -) - -func (*ShareProfileIops) isaShareProfileIops() bool { - return true -} - -type ShareProfileIopsIntf interface { - isaShareProfileIops() bool -} - -// UnmarshalShareProfileIops unmarshals an instance of ShareProfileIops from the specified map of raw messages. -func UnmarshalShareProfileIops(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIops) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileIdentity : Identifies a share profile by a unique property. -// Models which "extend" this model: -// - ShareProfileIdentityByName -// - ShareProfileIdentityByHref -type ShareProfileIdentity struct { - // The globally unique name for this share profile. - Name *string `json:"name,omitempty"` - - // The URL for this share profile. - Href *string `json:"href,omitempty"` -} - -func (*ShareProfileIdentity) isaShareProfileIdentity() bool { - return true -} - -type ShareProfileIdentityIntf interface { - isaShareProfileIdentity() bool -} - -// UnmarshalShareProfileIdentity unmarshals an instance of ShareProfileIdentity from the specified map of raw messages. -func UnmarshalShareProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileReference : ShareProfileReference struct -type ShareProfileReference struct { - // The URL for this share profile. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this share profile. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ShareProfileReference.ResourceType property. -// The resource type. -const ( - ShareProfileReferenceResourceTypeShareProfileConst = "share_profile" -) - -// UnmarshalShareProfileReference unmarshals an instance of ShareProfileReference from the specified map of raw messages. -func UnmarshalShareProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SharePrototype : SharePrototype struct -// Models which "extend" this model: -// - SharePrototypeShareBySize -// - SharePrototypeShareBySourceShare -type SharePrototype struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the - // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. - // - // In addition, each client accessing the share will be restricted to 48,000 IOPS. - Iops *int64 `json:"iops,omitempty"` - - // The mount targets for the file share. Each mount target must be in a unique VPC. - MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` - - // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be - // a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use - // for this file share. The profile must support the share's specified IOPS and size. - Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - - // Configuration for a replica file share to create and associate with this file share. If - // unspecified, a replica may be subsequently added by creating a new file share with a - // `source_share` referencing this file share. - ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` - - // Tags for this resource. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this file share will reside in. - // For a replica share, this must be a different zone in the same region as the source share. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The access control mode for the share: - // - // - `security_group`: The security groups on the virtual network interface for a - // mount target control access to the mount target. Mount targets for this share - // require a virtual network interface. - // - `vpc`: All clients in the VPC for a mount target have access to the mount target. - // Mount targets for this share require a VPC. - AccessControlMode *string `json:"access_control_mode,omitempty"` - - // The root key to use to wrap the data encryption key for the share. - // - // If unspecified, the `encryption` type for the share will be `provider_managed`. - // - // The specified key may be in a different account, subject to IAM policies. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The owner assigned to the file share at creation. Subsequent changes to the owner - // must be performed by a client that has mounted the file share. - InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The size of the file share rounded up to the next gigabyte. - // - // The maximum size for a share may increase in the future. - Size *int64 `json:"size,omitempty"` - - // The cron specification for the file share replication schedule. - // - // Replication of a share can be scheduled to occur at most once per hour. - ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` - - // The source file share for this replica file share. The specified file share must not - // already have a replica, and must not be a replica. - SourceShare ShareIdentityIntf `json:"source_share,omitempty"` -} - -// Constants associated with the SharePrototype.AccessControlMode property. -// The access control mode for the share: -// -// - `security_group`: The security groups on the virtual network interface for a -// mount target control access to the mount target. Mount targets for this share -// require a virtual network interface. -// - `vpc`: All clients in the VPC for a mount target have access to the mount target. -// Mount targets for this share require a VPC. -const ( - SharePrototypeAccessControlModeSecurityGroupConst = "security_group" - SharePrototypeAccessControlModeVPCConst = "vpc" -) - -func (*SharePrototype) isaSharePrototype() bool { - return true -} - -type SharePrototypeIntf interface { - isaSharePrototype() bool -} - -// UnmarshalSharePrototype unmarshals an instance of SharePrototype from the specified map of raw messages. -func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SharePrototype) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SharePrototypeShareContext : Configuration for a replica file share to create and associate with this file share. If unspecified, a replica may be -// subsequently added by creating a new file share with a -// `source_share` referencing this file share. -type SharePrototypeShareContext struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the - // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. - // - // In addition, each client accessing the share will be restricted to 48,000 IOPS. - Iops *int64 `json:"iops,omitempty"` - - // The mount targets for this replica file share. Each mount target must be in a unique VPC. - // - // A replica's mount targets must be mounted read-only. - MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` - - // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be - // a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use - // for this file share. The profile must support the share's specified IOPS and size. - Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - - // The cron specification for the file share replication schedule. - // - // Replication of a share can be scheduled to occur at most once per hour. - ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"` - - // The resource group to use. If unspecified, the resource group from - // the source share will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // Tags for this resource. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this replica file share will reside in. - // - // Must be a different zone in the same region as the source share. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -// NewSharePrototypeShareContext : Instantiate SharePrototypeShareContext (Generic Model Constructor) -func (*VpcV1) NewSharePrototypeShareContext(profile ShareProfileIdentityIntf, replicationCronSpec string, zone ZoneIdentityIntf) (_model *SharePrototypeShareContext, err error) { - _model = &SharePrototypeShareContext{ - Profile: profile, - ReplicationCronSpec: core.StringPtr(replicationCronSpec), - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalSharePrototypeShareContext unmarshals an instance of SharePrototypeShareContext from the specified map of raw messages. -func UnmarshalSharePrototypeShareContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SharePrototypeShareContext) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareReference : ShareReference struct -type ShareReference struct { - // The CRN for this file share. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ShareReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this file share. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this file share. - ID *string `json:"id" validate:"required"` - - // The name for this share. The name is unique across all shares in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ShareReference.ResourceType property. -// The resource type. -const ( - ShareReferenceResourceTypeShareConst = "share" -) - -// UnmarshalShareReference unmarshals an instance of ShareReference from the specified map of raw messages. -func UnmarshalShareReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ShareReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalShareReferenceDeleted unmarshals an instance of ShareReferenceDeleted from the specified map of raw messages. -func UnmarshalShareReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareReplicationStatusReason : ShareReplicationStatusReason struct -type ShareReplicationStatusReason struct { - // A snake case string succinctly identifying the status reason. - Code *string `json:"code" validate:"required"` - - // An explanation of the status reason. - Message *string `json:"message" validate:"required"` - - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the ShareReplicationStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -const ( - ShareReplicationStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" - ShareReplicationStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" - ShareReplicationStatusReasonCodeCannotReachSourceShareConst = "cannot_reach_source_share" -) - -// UnmarshalShareReplicationStatusReason unmarshals an instance of ShareReplicationStatusReason from the specified map of raw messages. -func UnmarshalShareReplicationStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareReplicationStatusReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Snapshot : Snapshot struct -type Snapshot struct { - // If present, the backup policy plan which created this snapshot. - BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan,omitempty"` - - // Indicates if a boot volume attachment can be created with a volume created from this snapshot. - Bootable *bool `json:"bootable" validate:"required"` - - // The date and time the data capture for this snapshot was completed. - // - // If absent, this snapshot's data has not yet been captured. Additionally, this property may be absent for snapshots - // created before 1 January 2022. - CapturedAt *strfmt.DateTime `json:"captured_at,omitempty"` - - // Clones for this snapshot. - Clones []SnapshotClone `json:"clones" validate:"required"` - - // The copies of this snapshot. - Copies []SnapshotCopiesItem `json:"copies" validate:"required"` - - // The date and time that this snapshot was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN of this snapshot. - CRN *string `json:"crn" validate:"required"` - - // Indicates whether this snapshot can be deleted. This value will always be `true`. - // Deprecated: this field is deprecated and may be removed in a future release. - Deletable *bool `json:"deletable" validate:"required"` - - // The type of encryption used on the source volume. - Encryption *string `json:"encryption" validate:"required"` - - // The root key used to wrap the data encryption key for the source volume. - // - // This property will be present for volumes with an `encryption` type of - // `user_managed`. - EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` - - // The URL for this snapshot. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this snapshot. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of this snapshot. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The minimum capacity of a volume created from this snapshot. When a snapshot is created, this will be set to the - // capacity of the `source_volume`. - MinimumCapacity *int64 `json:"minimum_capacity" validate:"required"` - - // The name for this snapshot. The name is unique across all snapshots in the region. - Name *string `json:"name" validate:"required"` - - // The operating system included in this snapshot. - OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` - - // The resource group for this snapshot. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) prefixed with `is.snapshot:` associated with - // this snapshot. - ServiceTags []string `json:"service_tags" validate:"required"` - - // The size of this snapshot rounded up to the next gigabyte. - Size *int64 `json:"size" validate:"required"` - - // If present, the image from which the data on this snapshot was most directly - // provisioned. - SourceImage *ImageReference `json:"source_image,omitempty"` - - // If present, the source snapshot this snapshot was created from. - SourceSnapshot *SnapshotSourceSnapshot `json:"source_snapshot,omitempty"` - - // The source volume this snapshot was created from (may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - SourceVolume *VolumeReference `json:"source_volume" validate:"required"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags" validate:"required"` -} - -// Constants associated with the Snapshot.Encryption property. -// The type of encryption used on the source volume. -const ( - SnapshotEncryptionProviderManagedConst = "provider_managed" - SnapshotEncryptionUserManagedConst = "user_managed" -) - -// Constants associated with the Snapshot.LifecycleState property. -// The lifecycle state of this snapshot. -const ( - SnapshotLifecycleStateDeletingConst = "deleting" - SnapshotLifecycleStateFailedConst = "failed" - SnapshotLifecycleStatePendingConst = "pending" - SnapshotLifecycleStateStableConst = "stable" - SnapshotLifecycleStateSuspendedConst = "suspended" - SnapshotLifecycleStateUpdatingConst = "updating" - SnapshotLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the Snapshot.ResourceType property. -// The resource type. -const ( - SnapshotResourceTypeSnapshotConst = "snapshot" -) - -// UnmarshalSnapshot unmarshals an instance of Snapshot from the specified map of raw messages. -func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Snapshot) - err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "bootable", &obj.Bootable) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "captured_at", &obj.CapturedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) - if err != nil { - return - } - err = core.UnmarshalModel(m, "copies", &obj.Copies, UnmarshalSnapshotCopiesItem) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "deletable", &obj.Deletable) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "minimum_capacity", &obj.MinimumCapacity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotSourceSnapshot) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotClone : SnapshotClone struct -type SnapshotClone struct { - // Indicates whether this snapshot clone is available for use. - Available *bool `json:"available" validate:"required"` - - // The date and time that this snapshot clone was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The zone this snapshot clone resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// UnmarshalSnapshotClone unmarshals an instance of SnapshotClone from the specified map of raw messages. -func UnmarshalSnapshotClone(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotClone) - err = core.UnmarshalPrimitive(m, "available", &obj.Available) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotCloneCollection : SnapshotCloneCollection struct -type SnapshotCloneCollection struct { - // Collection of snapshot clones. - Clones []SnapshotClone `json:"clones" validate:"required"` -} - -// UnmarshalSnapshotCloneCollection unmarshals an instance of SnapshotCloneCollection from the specified map of raw messages. -func UnmarshalSnapshotCloneCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotCloneCollection) - err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotClonePrototype : SnapshotClonePrototype struct -type SnapshotClonePrototype struct { - // The zone this snapshot clone will reside in. Must be in the same region as the - // snapshot. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -// NewSnapshotClonePrototype : Instantiate SnapshotClonePrototype (Generic Model Constructor) -func (*VpcV1) NewSnapshotClonePrototype(zone ZoneIdentityIntf) (_model *SnapshotClonePrototype, err error) { - _model = &SnapshotClonePrototype{ - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalSnapshotClonePrototype unmarshals an instance of SnapshotClonePrototype from the specified map of raw messages. -func UnmarshalSnapshotClonePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotClonePrototype) - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotCollection : SnapshotCollection struct -type SnapshotCollection struct { - // A link to the first page of resources. - First *SnapshotCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *SnapshotCollectionNext `json:"next,omitempty"` - - // Collection of snapshots. - Snapshots []Snapshot `json:"snapshots" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalSnapshotCollection unmarshals an instance of SnapshotCollection from the specified map of raw messages. -func UnmarshalSnapshotCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSnapshotCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSnapshotCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshot) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *SnapshotCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// SnapshotCollectionFirst : A link to the first page of resources. -type SnapshotCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSnapshotCollectionFirst unmarshals an instance of SnapshotCollectionFirst from the specified map of raw messages. -func UnmarshalSnapshotCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type SnapshotCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSnapshotCollectionNext unmarshals an instance of SnapshotCollectionNext from the specified map of raw messages. -func UnmarshalSnapshotCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotCopiesItem : SnapshotCopiesItem struct -type SnapshotCopiesItem struct { - // The CRN for the copied snapshot. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` - - // The URL for the copied snapshot. - Href *string `json:"href" validate:"required"` - - // The unique identifier for the copied snapshot. - ID *string `json:"id" validate:"required"` - - // The name for the copied snapshot. - Name *string `json:"name" validate:"required"` - - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *SnapshotRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SnapshotCopiesItem.ResourceType property. -// The resource type. -const ( - SnapshotCopiesItemResourceTypeSnapshotConst = "snapshot" -) - -// UnmarshalSnapshotCopiesItem unmarshals an instance of SnapshotCopiesItem from the specified map of raw messages. -func UnmarshalSnapshotCopiesItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotCopiesItem) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotIdentity : Identifies a snapshot by a unique property. -// Models which "extend" this model: -// - SnapshotIdentityByID -// - SnapshotIdentityByCRN -// - SnapshotIdentityByHref -type SnapshotIdentity struct { - // The unique identifier for this snapshot. - ID *string `json:"id,omitempty"` - - // The CRN of this snapshot. - CRN *string `json:"crn,omitempty"` - - // The URL for this snapshot. - Href *string `json:"href,omitempty"` -} - -func (*SnapshotIdentity) isaSnapshotIdentity() bool { - return true -} - -type SnapshotIdentityIntf interface { - isaSnapshotIdentity() bool -} - -// UnmarshalSnapshotIdentity unmarshals an instance of SnapshotIdentity from the specified map of raw messages. -func UnmarshalSnapshotIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotPatch : SnapshotPatch struct -type SnapshotPatch struct { - // The name for this snapshot. The name must not be used by another snapshot in the region. - Name *string `json:"name,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags,omitempty"` -} - -// UnmarshalSnapshotPatch unmarshals an instance of SnapshotPatch from the specified map of raw messages. -func UnmarshalSnapshotPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the SnapshotPatch -func (snapshotPatch *SnapshotPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(snapshotPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// SnapshotPrototype : SnapshotPrototype struct -// Models which "extend" this model: -// - SnapshotPrototypeSnapshotBySourceVolume -// - SnapshotPrototypeSnapshotBySourceSnapshot -type SnapshotPrototype struct { - // Clones to create for this snapshot. - Clones []SnapshotClonePrototype `json:"clones,omitempty"` - - // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags,omitempty"` - - // The volume to create this snapshot from. - SourceVolume VolumeIdentityIntf `json:"source_volume,omitempty"` - - // The root key to use to wrap the data encryption key for this snapshot. - // - // A key must be specified if and only if the source snapshot has an `encryption` type of - // `user_managed`. To maximize snapshot availability and sharing of snapshot data, specify - // a key in the same region as the new snapshot, and use the same encryption key for all - // snapshots using the same source volume. - // - // The specified key may be in a different account, subject to IAM policies. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The source snapshot (in another region) to create this snapshot from. - // The specified snapshot must not already be the source of another snapshot in this - // region. - SourceSnapshot *SnapshotIdentityByCRN `json:"source_snapshot,omitempty"` -} - -func (*SnapshotPrototype) isaSnapshotPrototype() bool { - return true -} - -type SnapshotPrototypeIntf interface { - isaSnapshotPrototype() bool -} - -// UnmarshalSnapshotPrototype unmarshals an instance of SnapshotPrototype from the specified map of raw messages. -func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotPrototype) - err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotReference : SnapshotReference struct -type SnapshotReference struct { - // The CRN of this snapshot. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this snapshot. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this snapshot. - ID *string `json:"id" validate:"required"` - - // The name for this snapshot. The name is unique across all snapshots in the region. - Name *string `json:"name" validate:"required"` - - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *SnapshotRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SnapshotReference.ResourceType property. -// The resource type. -const ( - SnapshotReferenceResourceTypeSnapshotConst = "snapshot" -) - -// UnmarshalSnapshotReference unmarshals an instance of SnapshotReference from the specified map of raw messages. -func UnmarshalSnapshotReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type SnapshotReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalSnapshotReferenceDeleted unmarshals an instance of SnapshotReferenceDeleted from the specified map of raw messages. -func UnmarshalSnapshotReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type SnapshotRemote struct { - // If present, this property indicates that the referenced resource is remote to this - // region, and identifies the native region. - Region *RegionReference `json:"region,omitempty"` -} - -// UnmarshalSnapshotRemote unmarshals an instance of SnapshotRemote from the specified map of raw messages. -func UnmarshalSnapshotRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotRemote) - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotSourceSnapshot : If present, the source snapshot this snapshot was created from. -type SnapshotSourceSnapshot struct { - // The CRN of the source snapshot. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` - - // The URL for the source snapshot. - Href *string `json:"href" validate:"required"` - - // The unique identifier for the source snapshot. - ID *string `json:"id" validate:"required"` - - // The name for the source snapshot. The name is unique across all snapshots in the source snapshot's native region. - Name *string `json:"name" validate:"required"` - - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *SnapshotRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SnapshotSourceSnapshot.ResourceType property. -// The resource type. -const ( - SnapshotSourceSnapshotResourceTypeSnapshotConst = "snapshot" -) - -// UnmarshalSnapshotSourceSnapshot unmarshals an instance of SnapshotSourceSnapshot from the specified map of raw messages. -func UnmarshalSnapshotSourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotSourceSnapshot) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// StartBareMetalServerOptions : The StartBareMetalServer options. -type StartBareMetalServerOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewStartBareMetalServerOptions : Instantiate StartBareMetalServerOptions -func (*VpcV1) NewStartBareMetalServerOptions(id string) *StartBareMetalServerOptions { - return &StartBareMetalServerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *StartBareMetalServerOptions) SetID(id string) *StartBareMetalServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *StartBareMetalServerOptions) SetHeaders(param map[string]string) *StartBareMetalServerOptions { - options.Headers = param - return options -} - -// StopBareMetalServerOptions : The StopBareMetalServer options. -type StopBareMetalServerOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // The type of stop operation: - // - `soft`: signal running operating system to quiesce and shutdown cleanly - // - `hard`: immediately stop the server. - Type *string `json:"type" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the StopBareMetalServerOptions.Type property. -// The type of stop operation: -// - `soft`: signal running operating system to quiesce and shutdown cleanly -// - `hard`: immediately stop the server. -const ( - StopBareMetalServerOptionsTypeHardConst = "hard" - StopBareMetalServerOptionsTypeSoftConst = "soft" -) - -// NewStopBareMetalServerOptions : Instantiate StopBareMetalServerOptions -func (*VpcV1) NewStopBareMetalServerOptions(id string, typeVar string) *StopBareMetalServerOptions { - return &StopBareMetalServerOptions{ - ID: core.StringPtr(id), - Type: core.StringPtr(typeVar), - } -} - -// SetID : Allow user to set ID -func (_options *StopBareMetalServerOptions) SetID(id string) *StopBareMetalServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetType : Allow user to set Type -func (_options *StopBareMetalServerOptions) SetType(typeVar string) *StopBareMetalServerOptions { - _options.Type = core.StringPtr(typeVar) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *StopBareMetalServerOptions) SetHeaders(param map[string]string) *StopBareMetalServerOptions { - options.Headers = param - return options -} - -// Subnet : Subnet struct -type Subnet struct { - // The number of IPv4 addresses in this subnet that are not in-use, and have not been reserved by the user or the - // provider. - AvailableIpv4AddressCount *int64 `json:"available_ipv4_address_count" validate:"required"` - - // The date and time that the subnet was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this subnet. - CRN *string `json:"crn" validate:"required"` - - // The URL for this subnet. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this subnet. - ID *string `json:"id" validate:"required"` - - // The IP version(s) supported by this subnet. - IPVersion *string `json:"ip_version" validate:"required"` - - // The IPv4 range of the subnet, expressed in CIDR format. - Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` - - // The name for this subnet. The name is unique across all subnets in the VPC. - Name *string `json:"name" validate:"required"` - - // The network ACL for this subnet. - NetworkACL *NetworkACLReference `json:"network_acl" validate:"required"` - - // The public gateway to use for internet-bound traffic for this subnet. - PublicGateway *PublicGatewayReference `json:"public_gateway,omitempty"` - - // The resource group for this subnet. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The routing table for this subnet. - RoutingTable *RoutingTableReference `json:"routing_table" validate:"required"` - - // The status of the subnet. - Status *string `json:"status" validate:"required"` - - // The total number of IPv4 addresses in this subnet. - // - // Note: This is calculated as 2(32 - prefix length). For example, the prefix length `/24` gives:
- // 2(32 - 24) = 28 = 256 addresses. - TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` - - // The VPC this subnet resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // The zone this subnet resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the Subnet.IPVersion property. -// The IP version(s) supported by this subnet. -const ( - SubnetIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the Subnet.ResourceType property. -// The resource type. -const ( - SubnetResourceTypeSubnetConst = "subnet" -) - -// Constants associated with the Subnet.Status property. -// The status of the subnet. -const ( - SubnetStatusAvailableConst = "available" - SubnetStatusDeletingConst = "deleting" - SubnetStatusFailedConst = "failed" - SubnetStatusPendingConst = "pending" -) - -// UnmarshalSubnet unmarshals an instance of Subnet from the specified map of raw messages. -func UnmarshalSubnet(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Subnet) - err = core.UnmarshalPrimitive(m, "available_ipv4_address_count", &obj.AvailableIpv4AddressCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetCollection : SubnetCollection struct -type SubnetCollection struct { - // A link to the first page of resources. - First *SubnetCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *SubnetCollectionNext `json:"next,omitempty"` - - // Collection of subnets. - Subnets []Subnet `json:"subnets" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalSubnetCollection unmarshals an instance of SubnetCollection from the specified map of raw messages. -func UnmarshalSubnetCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSubnetCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSubnetCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnet) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *SubnetCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// SubnetCollectionFirst : A link to the first page of resources. -type SubnetCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSubnetCollectionFirst unmarshals an instance of SubnetCollectionFirst from the specified map of raw messages. -func UnmarshalSubnetCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type SubnetCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSubnetCollectionNext unmarshals an instance of SubnetCollectionNext from the specified map of raw messages. -func UnmarshalSubnetCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetIdentity : Identifies a subnet by a unique property. -// Models which "extend" this model: -// - SubnetIdentityByID -// - SubnetIdentityByCRN -// - SubnetIdentityByHref -type SubnetIdentity struct { - // The unique identifier for this subnet. - ID *string `json:"id,omitempty"` - - // The CRN for this subnet. - CRN *string `json:"crn,omitempty"` - - // The URL for this subnet. - Href *string `json:"href,omitempty"` -} - -func (*SubnetIdentity) isaSubnetIdentity() bool { - return true -} - -type SubnetIdentityIntf interface { - isaSubnetIdentity() bool -} - -// UnmarshalSubnetIdentity unmarshals an instance of SubnetIdentity from the specified map of raw messages. -func UnmarshalSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetPatch : SubnetPatch struct -type SubnetPatch struct { - // The name for this subnet. The name must not be used by another subnet in the VPC. - Name *string `json:"name,omitempty"` - - // The network ACL to use for this subnet. - NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` - - // The public gateway to use for internet-bound traffic for this subnet. - PublicGateway SubnetPublicGatewayPatchIntf `json:"public_gateway,omitempty"` - - // The routing table to use for this subnet. The routing table properties - // `route_direct_link_ingress`, `route_internet_ingress`, - // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. - RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` -} - -// UnmarshalSubnetPatch unmarshals an instance of SubnetPatch from the specified map of raw messages. -func UnmarshalSubnetPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalSubnetPublicGatewayPatch) - if err != nil { - return - } - err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the SubnetPatch -func (subnetPatch *SubnetPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(subnetPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// SubnetPrototype : SubnetPrototype struct -// Models which "extend" this model: -// - SubnetPrototypeSubnetByTotalCount -// - SubnetPrototypeSubnetByCIDR -type SubnetPrototype struct { - // The IP version(s) to support for this subnet. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a - // hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The network ACL to use for this subnet. - NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` - - // The public gateway to use for internet-bound traffic for this subnet. If - // unspecified, the subnet will not be attached to a public gateway. - PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The routing table to use for this subnet. If unspecified, the default routing table - // for the VPC is used. The routing table properties `route_direct_link_ingress`, - // `route_internet_ingress`, `route_transit_gateway_ingress`, and - // `route_vpc_zone_ingress` must be `false`. - RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` - - // The VPC the subnet will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the - // specified zone, and that prefix must have a free CIDR range with at least this number of addresses. - TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count,omitempty"` - - // The zone this subnet will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` - - // The IPv4 range of the subnet, expressed in CIDR format. The prefix length of the subnet's CIDR must be between `/9` - // (8,388,608 addresses) and `/29` (8 addresses). The IPv4 range of the subnet's CIDR must fall within an existing - // address prefix in the VPC and must not overlap with any existing subnet. The subnet will be created in the zone of - // the address prefix that contains the IPv4 CIDR. If zone is specified, it must match the zone of the address prefix - // that contains the subnet's IPv4 CIDR. - Ipv4CIDRBlock *string `json:"ipv4_cidr_block,omitempty"` -} - -// Constants associated with the SubnetPrototype.IPVersion property. -// The IP version(s) to support for this subnet. -const ( - SubnetPrototypeIPVersionIpv4Const = "ipv4" -) - -func (*SubnetPrototype) isaSubnetPrototype() bool { - return true -} - -type SubnetPrototypeIntf interface { - isaSubnetPrototype() bool -} - -// UnmarshalSubnetPrototype unmarshals an instance of SubnetPrototype from the specified map of raw messages. -func UnmarshalSubnetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPrototype) - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetPublicGatewayPatch : The public gateway to use for internet-bound traffic for this subnet. -// Models which "extend" this model: -// - SubnetPublicGatewayPatchPublicGatewayIdentityByID -// - SubnetPublicGatewayPatchPublicGatewayIdentityByCRN -// - SubnetPublicGatewayPatchPublicGatewayIdentityByHref -type SubnetPublicGatewayPatch struct { - // The unique identifier for this public gateway. - ID *string `json:"id,omitempty"` - - // The CRN for this public gateway. - CRN *string `json:"crn,omitempty"` - - // The URL for this public gateway. - Href *string `json:"href,omitempty"` -} - -func (*SubnetPublicGatewayPatch) isaSubnetPublicGatewayPatch() bool { - return true -} - -type SubnetPublicGatewayPatchIntf interface { - isaSubnetPublicGatewayPatch() bool -} - -// UnmarshalSubnetPublicGatewayPatch unmarshals an instance of SubnetPublicGatewayPatch from the specified map of raw messages. -func UnmarshalSubnetPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPublicGatewayPatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetReference : SubnetReference struct -type SubnetReference struct { - // The CRN for this subnet. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this subnet. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this subnet. - ID *string `json:"id" validate:"required"` - - // The name for this subnet. The name is unique across all subnets in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SubnetReference.ResourceType property. -// The resource type. -const ( - SubnetReferenceResourceTypeSubnetConst = "subnet" -) - -// UnmarshalSubnetReference unmarshals an instance of SubnetReference from the specified map of raw messages. -func UnmarshalSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSubnetReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type SubnetReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalSubnetReferenceDeleted unmarshals an instance of SubnetReferenceDeleted from the specified map of raw messages. -func UnmarshalSubnetReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// TrustedProfileIdentity : Identifies a trusted profile by a unique property. -// Models which "extend" this model: -// - TrustedProfileIdentityTrustedProfileByID -// - TrustedProfileIdentityTrustedProfileByCRN -type TrustedProfileIdentity struct { - // The unique identifier for this trusted profile. - ID *string `json:"id,omitempty"` - - // The CRN for this trusted profile. - CRN *string `json:"crn,omitempty"` -} - -func (*TrustedProfileIdentity) isaTrustedProfileIdentity() bool { - return true -} - -type TrustedProfileIdentityIntf interface { - isaTrustedProfileIdentity() bool -} - -// UnmarshalTrustedProfileIdentity unmarshals an instance of TrustedProfileIdentity from the specified map of raw messages. -func UnmarshalTrustedProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(TrustedProfileIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// TrustedProfileReference : TrustedProfileReference struct -type TrustedProfileReference struct { - // The CRN for this trusted profile. - CRN *string `json:"crn" validate:"required"` - - // The unique identifier for this trusted profile. - ID *string `json:"id" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the TrustedProfileReference.ResourceType property. -// The resource type. -const ( - TrustedProfileReferenceResourceTypeTrustedProfileConst = "trusted_profile" -) - -// UnmarshalTrustedProfileReference unmarshals an instance of TrustedProfileReference from the specified map of raw messages. -func UnmarshalTrustedProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(TrustedProfileReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// UnsetSubnetPublicGatewayOptions : The UnsetSubnetPublicGateway options. -type UnsetSubnetPublicGatewayOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUnsetSubnetPublicGatewayOptions : Instantiate UnsetSubnetPublicGatewayOptions -func (*VpcV1) NewUnsetSubnetPublicGatewayOptions(id string) *UnsetSubnetPublicGatewayOptions { - return &UnsetSubnetPublicGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *UnsetSubnetPublicGatewayOptions) SetID(id string) *UnsetSubnetPublicGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UnsetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *UnsetSubnetPublicGatewayOptions { - options.Headers = param - return options -} - -// UpdateBackupPolicyOptions : The UpdateBackupPolicy options. -type UpdateBackupPolicyOptions struct { - // The backup policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // The backup policy patch. - BackupPolicyPatch map[string]interface{} `json:"BackupPolicy_patch" validate:"required"` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - // Required if the request body includes an array. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateBackupPolicyOptions : Instantiate UpdateBackupPolicyOptions -func (*VpcV1) NewUpdateBackupPolicyOptions(id string, backupPolicyPatch map[string]interface{}) *UpdateBackupPolicyOptions { - return &UpdateBackupPolicyOptions{ - ID: core.StringPtr(id), - BackupPolicyPatch: backupPolicyPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateBackupPolicyOptions) SetID(id string) *UpdateBackupPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetBackupPolicyPatch : Allow user to set BackupPolicyPatch -func (_options *UpdateBackupPolicyOptions) SetBackupPolicyPatch(backupPolicyPatch map[string]interface{}) *UpdateBackupPolicyOptions { - _options.BackupPolicyPatch = backupPolicyPatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateBackupPolicyOptions) SetIfMatch(ifMatch string) *UpdateBackupPolicyOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateBackupPolicyOptions) SetHeaders(param map[string]string) *UpdateBackupPolicyOptions { - options.Headers = param - return options -} - -// UpdateBackupPolicyPlanOptions : The UpdateBackupPolicyPlan options. -type UpdateBackupPolicyPlanOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // The backup policy plan identifier. - ID *string `json:"id" validate:"required,ne="` - - // The backup policy plan patch. - BackupPolicyPlanPatch map[string]interface{} `json:"BackupPolicyPlan_patch" validate:"required"` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - // Required if the request body includes an array. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateBackupPolicyPlanOptions : Instantiate UpdateBackupPolicyPlanOptions -func (*VpcV1) NewUpdateBackupPolicyPlanOptions(backupPolicyID string, id string, backupPolicyPlanPatch map[string]interface{}) *UpdateBackupPolicyPlanOptions { - return &UpdateBackupPolicyPlanOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - ID: core.StringPtr(id), - BackupPolicyPlanPatch: backupPolicyPlanPatch, - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *UpdateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *UpdateBackupPolicyPlanOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateBackupPolicyPlanOptions) SetID(id string) *UpdateBackupPolicyPlanOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetBackupPolicyPlanPatch : Allow user to set BackupPolicyPlanPatch -func (_options *UpdateBackupPolicyPlanOptions) SetBackupPolicyPlanPatch(backupPolicyPlanPatch map[string]interface{}) *UpdateBackupPolicyPlanOptions { - _options.BackupPolicyPlanPatch = backupPolicyPlanPatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateBackupPolicyPlanOptions) SetIfMatch(ifMatch string) *UpdateBackupPolicyPlanOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *UpdateBackupPolicyPlanOptions { - options.Headers = param - return options -} - -// UpdateBareMetalServerDiskOptions : The UpdateBareMetalServerDisk options. -type UpdateBareMetalServerDiskOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server disk identifier. - ID *string `json:"id" validate:"required,ne="` - - // The bare metal server disk patch. - BareMetalServerDiskPatch map[string]interface{} `json:"BareMetalServerDisk_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateBareMetalServerDiskOptions : Instantiate UpdateBareMetalServerDiskOptions -func (*VpcV1) NewUpdateBareMetalServerDiskOptions(bareMetalServerID string, id string, bareMetalServerDiskPatch map[string]interface{}) *UpdateBareMetalServerDiskOptions { - return &UpdateBareMetalServerDiskOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - BareMetalServerDiskPatch: bareMetalServerDiskPatch, - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *UpdateBareMetalServerDiskOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerDiskOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateBareMetalServerDiskOptions) SetID(id string) *UpdateBareMetalServerDiskOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetBareMetalServerDiskPatch : Allow user to set BareMetalServerDiskPatch -func (_options *UpdateBareMetalServerDiskOptions) SetBareMetalServerDiskPatch(bareMetalServerDiskPatch map[string]interface{}) *UpdateBareMetalServerDiskOptions { - _options.BareMetalServerDiskPatch = bareMetalServerDiskPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateBareMetalServerDiskOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerDiskOptions { - options.Headers = param - return options -} - -// UpdateBareMetalServerNetworkAttachmentOptions : The UpdateBareMetalServerNetworkAttachment options. -type UpdateBareMetalServerNetworkAttachmentOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // The bare metal server network attachment patch. - BareMetalServerNetworkAttachmentPatch map[string]interface{} `json:"BareMetalServerNetworkAttachment_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateBareMetalServerNetworkAttachmentOptions : Instantiate UpdateBareMetalServerNetworkAttachmentOptions -func (*VpcV1) NewUpdateBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string, bareMetalServerNetworkAttachmentPatch map[string]interface{}) *UpdateBareMetalServerNetworkAttachmentOptions { - return &UpdateBareMetalServerNetworkAttachmentOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - BareMetalServerNetworkAttachmentPatch: bareMetalServerNetworkAttachmentPatch, - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerNetworkAttachmentOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetID(id string) *UpdateBareMetalServerNetworkAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetBareMetalServerNetworkAttachmentPatch : Allow user to set BareMetalServerNetworkAttachmentPatch -func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerNetworkAttachmentPatch(bareMetalServerNetworkAttachmentPatch map[string]interface{}) *UpdateBareMetalServerNetworkAttachmentOptions { - _options.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerNetworkAttachmentOptions { - options.Headers = param - return options -} - -// UpdateBareMetalServerNetworkInterfaceOptions : The UpdateBareMetalServerNetworkInterface options. -type UpdateBareMetalServerNetworkInterfaceOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // The bare metal server network interface patch. - BareMetalServerNetworkInterfacePatch map[string]interface{} `json:"BareMetalServerNetworkInterface_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateBareMetalServerNetworkInterfaceOptions : Instantiate UpdateBareMetalServerNetworkInterfaceOptions -func (*VpcV1) NewUpdateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string, bareMetalServerNetworkInterfacePatch map[string]interface{}) *UpdateBareMetalServerNetworkInterfaceOptions { - return &UpdateBareMetalServerNetworkInterfaceOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - BareMetalServerNetworkInterfacePatch: bareMetalServerNetworkInterfacePatch, - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetID(id string) *UpdateBareMetalServerNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetBareMetalServerNetworkInterfacePatch : Allow user to set BareMetalServerNetworkInterfacePatch -func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePatch(bareMetalServerNetworkInterfacePatch map[string]interface{}) *UpdateBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerNetworkInterfaceOptions { - options.Headers = param - return options -} - -// UpdateBareMetalServerOptions : The UpdateBareMetalServer options. -type UpdateBareMetalServerOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // The bare metal server patch. - BareMetalServerPatch map[string]interface{} `json:"BareMetalServer_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateBareMetalServerOptions : Instantiate UpdateBareMetalServerOptions -func (*VpcV1) NewUpdateBareMetalServerOptions(id string, bareMetalServerPatch map[string]interface{}) *UpdateBareMetalServerOptions { - return &UpdateBareMetalServerOptions{ - ID: core.StringPtr(id), - BareMetalServerPatch: bareMetalServerPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateBareMetalServerOptions) SetID(id string) *UpdateBareMetalServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetBareMetalServerPatch : Allow user to set BareMetalServerPatch -func (_options *UpdateBareMetalServerOptions) SetBareMetalServerPatch(bareMetalServerPatch map[string]interface{}) *UpdateBareMetalServerOptions { - _options.BareMetalServerPatch = bareMetalServerPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateBareMetalServerOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerOptions { - options.Headers = param - return options -} - -// UpdateDedicatedHostDiskOptions : The UpdateDedicatedHostDisk options. -type UpdateDedicatedHostDiskOptions struct { - // The dedicated host identifier. - DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="` - - // The dedicated host disk identifier. - ID *string `json:"id" validate:"required,ne="` - - // The dedicated host disk patch. - DedicatedHostDiskPatch map[string]interface{} `json:"DedicatedHostDisk_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateDedicatedHostDiskOptions : Instantiate UpdateDedicatedHostDiskOptions -func (*VpcV1) NewUpdateDedicatedHostDiskOptions(dedicatedHostID string, id string, dedicatedHostDiskPatch map[string]interface{}) *UpdateDedicatedHostDiskOptions { - return &UpdateDedicatedHostDiskOptions{ - DedicatedHostID: core.StringPtr(dedicatedHostID), - ID: core.StringPtr(id), - DedicatedHostDiskPatch: dedicatedHostDiskPatch, - } -} - -// SetDedicatedHostID : Allow user to set DedicatedHostID -func (_options *UpdateDedicatedHostDiskOptions) SetDedicatedHostID(dedicatedHostID string) *UpdateDedicatedHostDiskOptions { - _options.DedicatedHostID = core.StringPtr(dedicatedHostID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateDedicatedHostDiskOptions) SetID(id string) *UpdateDedicatedHostDiskOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetDedicatedHostDiskPatch : Allow user to set DedicatedHostDiskPatch -func (_options *UpdateDedicatedHostDiskOptions) SetDedicatedHostDiskPatch(dedicatedHostDiskPatch map[string]interface{}) *UpdateDedicatedHostDiskOptions { - _options.DedicatedHostDiskPatch = dedicatedHostDiskPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateDedicatedHostDiskOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostDiskOptions { - options.Headers = param - return options -} - -// UpdateDedicatedHostGroupOptions : The UpdateDedicatedHostGroup options. -type UpdateDedicatedHostGroupOptions struct { - // The dedicated host group identifier. - ID *string `json:"id" validate:"required,ne="` - - // The dedicated host group patch. - DedicatedHostGroupPatch map[string]interface{} `json:"DedicatedHostGroup_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateDedicatedHostGroupOptions : Instantiate UpdateDedicatedHostGroupOptions -func (*VpcV1) NewUpdateDedicatedHostGroupOptions(id string, dedicatedHostGroupPatch map[string]interface{}) *UpdateDedicatedHostGroupOptions { - return &UpdateDedicatedHostGroupOptions{ - ID: core.StringPtr(id), - DedicatedHostGroupPatch: dedicatedHostGroupPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateDedicatedHostGroupOptions) SetID(id string) *UpdateDedicatedHostGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetDedicatedHostGroupPatch : Allow user to set DedicatedHostGroupPatch -func (_options *UpdateDedicatedHostGroupOptions) SetDedicatedHostGroupPatch(dedicatedHostGroupPatch map[string]interface{}) *UpdateDedicatedHostGroupOptions { - _options.DedicatedHostGroupPatch = dedicatedHostGroupPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateDedicatedHostGroupOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostGroupOptions { - options.Headers = param - return options -} - -// UpdateDedicatedHostOptions : The UpdateDedicatedHost options. -type UpdateDedicatedHostOptions struct { - // The dedicated host identifier. - ID *string `json:"id" validate:"required,ne="` - - // The dedicated host patch. - DedicatedHostPatch map[string]interface{} `json:"DedicatedHost_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateDedicatedHostOptions : Instantiate UpdateDedicatedHostOptions -func (*VpcV1) NewUpdateDedicatedHostOptions(id string, dedicatedHostPatch map[string]interface{}) *UpdateDedicatedHostOptions { - return &UpdateDedicatedHostOptions{ - ID: core.StringPtr(id), - DedicatedHostPatch: dedicatedHostPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateDedicatedHostOptions) SetID(id string) *UpdateDedicatedHostOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetDedicatedHostPatch : Allow user to set DedicatedHostPatch -func (_options *UpdateDedicatedHostOptions) SetDedicatedHostPatch(dedicatedHostPatch map[string]interface{}) *UpdateDedicatedHostOptions { - _options.DedicatedHostPatch = dedicatedHostPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateDedicatedHostOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostOptions { - options.Headers = param - return options -} - -// UpdateEndpointGatewayOptions : The UpdateEndpointGateway options. -type UpdateEndpointGatewayOptions struct { - // The endpoint gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // The endpoint gateway patch. - EndpointGatewayPatch map[string]interface{} `json:"EndpointGateway_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateEndpointGatewayOptions : Instantiate UpdateEndpointGatewayOptions -func (*VpcV1) NewUpdateEndpointGatewayOptions(id string, endpointGatewayPatch map[string]interface{}) *UpdateEndpointGatewayOptions { - return &UpdateEndpointGatewayOptions{ - ID: core.StringPtr(id), - EndpointGatewayPatch: endpointGatewayPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateEndpointGatewayOptions) SetID(id string) *UpdateEndpointGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetEndpointGatewayPatch : Allow user to set EndpointGatewayPatch -func (_options *UpdateEndpointGatewayOptions) SetEndpointGatewayPatch(endpointGatewayPatch map[string]interface{}) *UpdateEndpointGatewayOptions { - _options.EndpointGatewayPatch = endpointGatewayPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateEndpointGatewayOptions) SetHeaders(param map[string]string) *UpdateEndpointGatewayOptions { - options.Headers = param - return options -} - -// UpdateFloatingIPOptions : The UpdateFloatingIP options. -type UpdateFloatingIPOptions struct { - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // The floating IP patch. - FloatingIPPatch map[string]interface{} `json:"FloatingIP_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateFloatingIPOptions : Instantiate UpdateFloatingIPOptions -func (*VpcV1) NewUpdateFloatingIPOptions(id string, floatingIPPatch map[string]interface{}) *UpdateFloatingIPOptions { - return &UpdateFloatingIPOptions{ - ID: core.StringPtr(id), - FloatingIPPatch: floatingIPPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateFloatingIPOptions) SetID(id string) *UpdateFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetFloatingIPPatch : Allow user to set FloatingIPPatch -func (_options *UpdateFloatingIPOptions) SetFloatingIPPatch(floatingIPPatch map[string]interface{}) *UpdateFloatingIPOptions { - _options.FloatingIPPatch = floatingIPPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateFloatingIPOptions) SetHeaders(param map[string]string) *UpdateFloatingIPOptions { - options.Headers = param - return options -} - -// UpdateFlowLogCollectorOptions : The UpdateFlowLogCollector options. -type UpdateFlowLogCollectorOptions struct { - // The flow log collector identifier. - ID *string `json:"id" validate:"required,ne="` - - // The flow log collector patch. - FlowLogCollectorPatch map[string]interface{} `json:"FlowLogCollector_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateFlowLogCollectorOptions : Instantiate UpdateFlowLogCollectorOptions -func (*VpcV1) NewUpdateFlowLogCollectorOptions(id string, flowLogCollectorPatch map[string]interface{}) *UpdateFlowLogCollectorOptions { - return &UpdateFlowLogCollectorOptions{ - ID: core.StringPtr(id), - FlowLogCollectorPatch: flowLogCollectorPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateFlowLogCollectorOptions) SetID(id string) *UpdateFlowLogCollectorOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetFlowLogCollectorPatch : Allow user to set FlowLogCollectorPatch -func (_options *UpdateFlowLogCollectorOptions) SetFlowLogCollectorPatch(flowLogCollectorPatch map[string]interface{}) *UpdateFlowLogCollectorOptions { - _options.FlowLogCollectorPatch = flowLogCollectorPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateFlowLogCollectorOptions) SetHeaders(param map[string]string) *UpdateFlowLogCollectorOptions { - options.Headers = param - return options -} - -// UpdateIkePolicyOptions : The UpdateIkePolicy options. -type UpdateIkePolicyOptions struct { - // The IKE policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // The IKE policy patch. - IkePolicyPatch map[string]interface{} `json:"IkePolicy_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateIkePolicyOptions : Instantiate UpdateIkePolicyOptions -func (*VpcV1) NewUpdateIkePolicyOptions(id string, ikePolicyPatch map[string]interface{}) *UpdateIkePolicyOptions { - return &UpdateIkePolicyOptions{ - ID: core.StringPtr(id), - IkePolicyPatch: ikePolicyPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateIkePolicyOptions) SetID(id string) *UpdateIkePolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIkePolicyPatch : Allow user to set IkePolicyPatch -func (_options *UpdateIkePolicyOptions) SetIkePolicyPatch(ikePolicyPatch map[string]interface{}) *UpdateIkePolicyOptions { - _options.IkePolicyPatch = ikePolicyPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateIkePolicyOptions) SetHeaders(param map[string]string) *UpdateIkePolicyOptions { - options.Headers = param - return options -} - -// UpdateImageExportJobOptions : The UpdateImageExportJob options. -type UpdateImageExportJobOptions struct { - // The image identifier. - ImageID *string `json:"image_id" validate:"required,ne="` - - // The image export job identifier. - ID *string `json:"id" validate:"required,ne="` - - // The image export job patch. - ImageExportJobPatch map[string]interface{} `json:"ImageExportJob_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateImageExportJobOptions : Instantiate UpdateImageExportJobOptions -func (*VpcV1) NewUpdateImageExportJobOptions(imageID string, id string, imageExportJobPatch map[string]interface{}) *UpdateImageExportJobOptions { - return &UpdateImageExportJobOptions{ - ImageID: core.StringPtr(imageID), - ID: core.StringPtr(id), - ImageExportJobPatch: imageExportJobPatch, - } -} - -// SetImageID : Allow user to set ImageID -func (_options *UpdateImageExportJobOptions) SetImageID(imageID string) *UpdateImageExportJobOptions { - _options.ImageID = core.StringPtr(imageID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateImageExportJobOptions) SetID(id string) *UpdateImageExportJobOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetImageExportJobPatch : Allow user to set ImageExportJobPatch -func (_options *UpdateImageExportJobOptions) SetImageExportJobPatch(imageExportJobPatch map[string]interface{}) *UpdateImageExportJobOptions { - _options.ImageExportJobPatch = imageExportJobPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateImageExportJobOptions) SetHeaders(param map[string]string) *UpdateImageExportJobOptions { - options.Headers = param - return options -} - -// UpdateImageOptions : The UpdateImage options. -type UpdateImageOptions struct { - // The image identifier. - ID *string `json:"id" validate:"required,ne="` - - // The image patch. - ImagePatch map[string]interface{} `json:"Image_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateImageOptions : Instantiate UpdateImageOptions -func (*VpcV1) NewUpdateImageOptions(id string, imagePatch map[string]interface{}) *UpdateImageOptions { - return &UpdateImageOptions{ - ID: core.StringPtr(id), - ImagePatch: imagePatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateImageOptions) SetID(id string) *UpdateImageOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetImagePatch : Allow user to set ImagePatch -func (_options *UpdateImageOptions) SetImagePatch(imagePatch map[string]interface{}) *UpdateImageOptions { - _options.ImagePatch = imagePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateImageOptions) SetHeaders(param map[string]string) *UpdateImageOptions { - options.Headers = param - return options -} - -// UpdateInstanceDiskOptions : The UpdateInstanceDisk options. -type UpdateInstanceDiskOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance disk identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance disk patch. - InstanceDiskPatch map[string]interface{} `json:"InstanceDisk_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceDiskOptions : Instantiate UpdateInstanceDiskOptions -func (*VpcV1) NewUpdateInstanceDiskOptions(instanceID string, id string, instanceDiskPatch map[string]interface{}) *UpdateInstanceDiskOptions { - return &UpdateInstanceDiskOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - InstanceDiskPatch: instanceDiskPatch, - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *UpdateInstanceDiskOptions) SetInstanceID(instanceID string) *UpdateInstanceDiskOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceDiskOptions) SetID(id string) *UpdateInstanceDiskOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceDiskPatch : Allow user to set InstanceDiskPatch -func (_options *UpdateInstanceDiskOptions) SetInstanceDiskPatch(instanceDiskPatch map[string]interface{}) *UpdateInstanceDiskOptions { - _options.InstanceDiskPatch = instanceDiskPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceDiskOptions) SetHeaders(param map[string]string) *UpdateInstanceDiskOptions { - options.Headers = param - return options -} - -// UpdateInstanceGroupManagerActionOptions : The UpdateInstanceGroupManagerAction options. -type UpdateInstanceGroupManagerActionOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager action identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance group manager action patch. - InstanceGroupManagerActionPatch map[string]interface{} `json:"InstanceGroupManagerAction_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceGroupManagerActionOptions : Instantiate UpdateInstanceGroupManagerActionOptions -func (*VpcV1) NewUpdateInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string, instanceGroupManagerActionPatch map[string]interface{}) *UpdateInstanceGroupManagerActionOptions { - return &UpdateInstanceGroupManagerActionOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - ID: core.StringPtr(id), - InstanceGroupManagerActionPatch: instanceGroupManagerActionPatch, - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerActionOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *UpdateInstanceGroupManagerActionOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceGroupManagerActionOptions) SetID(id string) *UpdateInstanceGroupManagerActionOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceGroupManagerActionPatch : Allow user to set InstanceGroupManagerActionPatch -func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupManagerActionPatch(instanceGroupManagerActionPatch map[string]interface{}) *UpdateInstanceGroupManagerActionOptions { - _options.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerActionOptions { - options.Headers = param - return options -} - -// UpdateInstanceGroupManagerOptions : The UpdateInstanceGroupManager options. -type UpdateInstanceGroupManagerOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance group manager patch. - InstanceGroupManagerPatch map[string]interface{} `json:"InstanceGroupManager_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceGroupManagerOptions : Instantiate UpdateInstanceGroupManagerOptions -func (*VpcV1) NewUpdateInstanceGroupManagerOptions(instanceGroupID string, id string, instanceGroupManagerPatch map[string]interface{}) *UpdateInstanceGroupManagerOptions { - return &UpdateInstanceGroupManagerOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - ID: core.StringPtr(id), - InstanceGroupManagerPatch: instanceGroupManagerPatch, - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *UpdateInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceGroupManagerOptions) SetID(id string) *UpdateInstanceGroupManagerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceGroupManagerPatch : Allow user to set InstanceGroupManagerPatch -func (_options *UpdateInstanceGroupManagerOptions) SetInstanceGroupManagerPatch(instanceGroupManagerPatch map[string]interface{}) *UpdateInstanceGroupManagerOptions { - _options.InstanceGroupManagerPatch = instanceGroupManagerPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceGroupManagerOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerOptions { - options.Headers = param - return options -} - -// UpdateInstanceGroupManagerPolicyOptions : The UpdateInstanceGroupManagerPolicy options. -type UpdateInstanceGroupManagerPolicyOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance group manager policy patch. - InstanceGroupManagerPolicyPatch map[string]interface{} `json:"InstanceGroupManagerPolicy_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceGroupManagerPolicyOptions : Instantiate UpdateInstanceGroupManagerPolicyOptions -func (*VpcV1) NewUpdateInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string, instanceGroupManagerPolicyPatch map[string]interface{}) *UpdateInstanceGroupManagerPolicyOptions { - return &UpdateInstanceGroupManagerPolicyOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - ID: core.StringPtr(id), - InstanceGroupManagerPolicyPatch: instanceGroupManagerPolicyPatch, - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerPolicyOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *UpdateInstanceGroupManagerPolicyOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceGroupManagerPolicyOptions) SetID(id string) *UpdateInstanceGroupManagerPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceGroupManagerPolicyPatch : Allow user to set InstanceGroupManagerPolicyPatch -func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerPolicyPatch(instanceGroupManagerPolicyPatch map[string]interface{}) *UpdateInstanceGroupManagerPolicyOptions { - _options.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerPolicyOptions { - options.Headers = param - return options -} - -// UpdateInstanceGroupMembershipOptions : The UpdateInstanceGroupMembership options. -type UpdateInstanceGroupMembershipOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group membership identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance group membership patch. - InstanceGroupMembershipPatch map[string]interface{} `json:"InstanceGroupMembership_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceGroupMembershipOptions : Instantiate UpdateInstanceGroupMembershipOptions -func (*VpcV1) NewUpdateInstanceGroupMembershipOptions(instanceGroupID string, id string, instanceGroupMembershipPatch map[string]interface{}) *UpdateInstanceGroupMembershipOptions { - return &UpdateInstanceGroupMembershipOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - ID: core.StringPtr(id), - InstanceGroupMembershipPatch: instanceGroupMembershipPatch, - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *UpdateInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupMembershipOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceGroupMembershipOptions) SetID(id string) *UpdateInstanceGroupMembershipOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceGroupMembershipPatch : Allow user to set InstanceGroupMembershipPatch -func (_options *UpdateInstanceGroupMembershipOptions) SetInstanceGroupMembershipPatch(instanceGroupMembershipPatch map[string]interface{}) *UpdateInstanceGroupMembershipOptions { - _options.InstanceGroupMembershipPatch = instanceGroupMembershipPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupMembershipOptions { - options.Headers = param - return options -} - -// UpdateInstanceGroupOptions : The UpdateInstanceGroup options. -type UpdateInstanceGroupOptions struct { - // The instance group identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance group patch. - InstanceGroupPatch map[string]interface{} `json:"InstanceGroup_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceGroupOptions : Instantiate UpdateInstanceGroupOptions -func (*VpcV1) NewUpdateInstanceGroupOptions(id string, instanceGroupPatch map[string]interface{}) *UpdateInstanceGroupOptions { - return &UpdateInstanceGroupOptions{ - ID: core.StringPtr(id), - InstanceGroupPatch: instanceGroupPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceGroupOptions) SetID(id string) *UpdateInstanceGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceGroupPatch : Allow user to set InstanceGroupPatch -func (_options *UpdateInstanceGroupOptions) SetInstanceGroupPatch(instanceGroupPatch map[string]interface{}) *UpdateInstanceGroupOptions { - _options.InstanceGroupPatch = instanceGroupPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceGroupOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupOptions { - options.Headers = param - return options -} - -// UpdateInstanceNetworkAttachmentOptions : The UpdateInstanceNetworkAttachment options. -type UpdateInstanceNetworkAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance network attachment patch. - InstanceNetworkAttachmentPatch map[string]interface{} `json:"InstanceNetworkAttachment_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceNetworkAttachmentOptions : Instantiate UpdateInstanceNetworkAttachmentOptions -func (*VpcV1) NewUpdateInstanceNetworkAttachmentOptions(instanceID string, id string, instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions { - return &UpdateInstanceNetworkAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - InstanceNetworkAttachmentPatch: instanceNetworkAttachmentPatch, - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceNetworkAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceNetworkAttachmentOptions) SetID(id string) *UpdateInstanceNetworkAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceNetworkAttachmentPatch : Allow user to set InstanceNetworkAttachmentPatch -func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceNetworkAttachmentPatch(instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions { - _options.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceNetworkAttachmentOptions { - options.Headers = param - return options -} - -// UpdateInstanceNetworkInterfaceOptions : The UpdateInstanceNetworkInterface options. -type UpdateInstanceNetworkInterfaceOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance network interface patch. - NetworkInterfacePatch map[string]interface{} `json:"NetworkInterface_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceNetworkInterfaceOptions : Instantiate UpdateInstanceNetworkInterfaceOptions -func (*VpcV1) NewUpdateInstanceNetworkInterfaceOptions(instanceID string, id string, networkInterfacePatch map[string]interface{}) *UpdateInstanceNetworkInterfaceOptions { - return &UpdateInstanceNetworkInterfaceOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - NetworkInterfacePatch: networkInterfacePatch, - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *UpdateInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *UpdateInstanceNetworkInterfaceOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceNetworkInterfaceOptions) SetID(id string) *UpdateInstanceNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetNetworkInterfacePatch : Allow user to set NetworkInterfacePatch -func (_options *UpdateInstanceNetworkInterfaceOptions) SetNetworkInterfacePatch(networkInterfacePatch map[string]interface{}) *UpdateInstanceNetworkInterfaceOptions { - _options.NetworkInterfacePatch = networkInterfacePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateInstanceNetworkInterfaceOptions { - options.Headers = param - return options -} - -// UpdateInstanceOptions : The UpdateInstance options. -type UpdateInstanceOptions struct { - // The virtual server instance identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance patch. - InstancePatch map[string]interface{} `json:"Instance_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceOptions : Instantiate UpdateInstanceOptions -func (*VpcV1) NewUpdateInstanceOptions(id string, instancePatch map[string]interface{}) *UpdateInstanceOptions { - return &UpdateInstanceOptions{ - ID: core.StringPtr(id), - InstancePatch: instancePatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceOptions) SetID(id string) *UpdateInstanceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstancePatch : Allow user to set InstancePatch -func (_options *UpdateInstanceOptions) SetInstancePatch(instancePatch map[string]interface{}) *UpdateInstanceOptions { - _options.InstancePatch = instancePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceOptions) SetHeaders(param map[string]string) *UpdateInstanceOptions { - options.Headers = param - return options -} - -// UpdateInstanceTemplateOptions : The UpdateInstanceTemplate options. -type UpdateInstanceTemplateOptions struct { - // The instance template identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance template patch. - InstanceTemplatePatch map[string]interface{} `json:"InstanceTemplate_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceTemplateOptions : Instantiate UpdateInstanceTemplateOptions -func (*VpcV1) NewUpdateInstanceTemplateOptions(id string, instanceTemplatePatch map[string]interface{}) *UpdateInstanceTemplateOptions { - return &UpdateInstanceTemplateOptions{ - ID: core.StringPtr(id), - InstanceTemplatePatch: instanceTemplatePatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceTemplateOptions) SetID(id string) *UpdateInstanceTemplateOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceTemplatePatch : Allow user to set InstanceTemplatePatch -func (_options *UpdateInstanceTemplateOptions) SetInstanceTemplatePatch(instanceTemplatePatch map[string]interface{}) *UpdateInstanceTemplateOptions { - _options.InstanceTemplatePatch = instanceTemplatePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceTemplateOptions) SetHeaders(param map[string]string) *UpdateInstanceTemplateOptions { - options.Headers = param - return options -} - -// UpdateInstanceVolumeAttachmentOptions : The UpdateInstanceVolumeAttachment options. -type UpdateInstanceVolumeAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The volume attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // The volume attachment patch. - VolumeAttachmentPatch map[string]interface{} `json:"VolumeAttachment_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceVolumeAttachmentOptions : Instantiate UpdateInstanceVolumeAttachmentOptions -func (*VpcV1) NewUpdateInstanceVolumeAttachmentOptions(instanceID string, id string, volumeAttachmentPatch map[string]interface{}) *UpdateInstanceVolumeAttachmentOptions { - return &UpdateInstanceVolumeAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - VolumeAttachmentPatch: volumeAttachmentPatch, - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *UpdateInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceVolumeAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceVolumeAttachmentOptions) SetID(id string) *UpdateInstanceVolumeAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVolumeAttachmentPatch : Allow user to set VolumeAttachmentPatch -func (_options *UpdateInstanceVolumeAttachmentOptions) SetVolumeAttachmentPatch(volumeAttachmentPatch map[string]interface{}) *UpdateInstanceVolumeAttachmentOptions { - _options.VolumeAttachmentPatch = volumeAttachmentPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceVolumeAttachmentOptions { - options.Headers = param - return options -} - -// UpdateIpsecPolicyOptions : The UpdateIpsecPolicy options. -type UpdateIpsecPolicyOptions struct { - // The IPsec policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // The IPsec policy patch. - IPsecPolicyPatch map[string]interface{} `json:"IPsecPolicy_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateIpsecPolicyOptions : Instantiate UpdateIpsecPolicyOptions -func (*VpcV1) NewUpdateIpsecPolicyOptions(id string, iPsecPolicyPatch map[string]interface{}) *UpdateIpsecPolicyOptions { - return &UpdateIpsecPolicyOptions{ - ID: core.StringPtr(id), - IPsecPolicyPatch: iPsecPolicyPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateIpsecPolicyOptions) SetID(id string) *UpdateIpsecPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIPsecPolicyPatch : Allow user to set IPsecPolicyPatch -func (_options *UpdateIpsecPolicyOptions) SetIPsecPolicyPatch(iPsecPolicyPatch map[string]interface{}) *UpdateIpsecPolicyOptions { - _options.IPsecPolicyPatch = iPsecPolicyPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateIpsecPolicyOptions) SetHeaders(param map[string]string) *UpdateIpsecPolicyOptions { - options.Headers = param - return options -} - -// UpdateKeyOptions : The UpdateKey options. -type UpdateKeyOptions struct { - // The key identifier. - ID *string `json:"id" validate:"required,ne="` - - // The key patch. - KeyPatch map[string]interface{} `json:"Key_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateKeyOptions : Instantiate UpdateKeyOptions -func (*VpcV1) NewUpdateKeyOptions(id string, keyPatch map[string]interface{}) *UpdateKeyOptions { - return &UpdateKeyOptions{ - ID: core.StringPtr(id), - KeyPatch: keyPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateKeyOptions) SetID(id string) *UpdateKeyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetKeyPatch : Allow user to set KeyPatch -func (_options *UpdateKeyOptions) SetKeyPatch(keyPatch map[string]interface{}) *UpdateKeyOptions { - _options.KeyPatch = keyPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateKeyOptions) SetHeaders(param map[string]string) *UpdateKeyOptions { - options.Headers = param - return options -} - -// UpdateLoadBalancerListenerOptions : The UpdateLoadBalancerListener options. -type UpdateLoadBalancerListenerOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ID *string `json:"id" validate:"required,ne="` - - // The load balancer listener patch. - LoadBalancerListenerPatch map[string]interface{} `json:"LoadBalancerListener_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateLoadBalancerListenerOptions : Instantiate UpdateLoadBalancerListenerOptions -func (*VpcV1) NewUpdateLoadBalancerListenerOptions(loadBalancerID string, id string, loadBalancerListenerPatch map[string]interface{}) *UpdateLoadBalancerListenerOptions { - return &UpdateLoadBalancerListenerOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ID: core.StringPtr(id), - LoadBalancerListenerPatch: loadBalancerListenerPatch, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *UpdateLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateLoadBalancerListenerOptions) SetID(id string) *UpdateLoadBalancerListenerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetLoadBalancerListenerPatch : Allow user to set LoadBalancerListenerPatch -func (_options *UpdateLoadBalancerListenerOptions) SetLoadBalancerListenerPatch(loadBalancerListenerPatch map[string]interface{}) *UpdateLoadBalancerListenerOptions { - _options.LoadBalancerListenerPatch = loadBalancerListenerPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateLoadBalancerListenerOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerOptions { - options.Headers = param - return options -} - -// UpdateLoadBalancerListenerPolicyOptions : The UpdateLoadBalancerListenerPolicy options. -type UpdateLoadBalancerListenerPolicyOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // The listener policy patch. - LoadBalancerListenerPolicyPatch map[string]interface{} `json:"LoadBalancerListenerPolicy_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateLoadBalancerListenerPolicyOptions : Instantiate UpdateLoadBalancerListenerPolicyOptions -func (*VpcV1) NewUpdateLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string, loadBalancerListenerPolicyPatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyOptions { - return &UpdateLoadBalancerListenerPolicyOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - ID: core.StringPtr(id), - LoadBalancerListenerPolicyPatch: loadBalancerListenerPolicyPatch, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *UpdateLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerPolicyOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *UpdateLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *UpdateLoadBalancerListenerPolicyOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateLoadBalancerListenerPolicyOptions) SetID(id string) *UpdateLoadBalancerListenerPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetLoadBalancerListenerPolicyPatch : Allow user to set LoadBalancerListenerPolicyPatch -func (_options *UpdateLoadBalancerListenerPolicyOptions) SetLoadBalancerListenerPolicyPatch(loadBalancerListenerPolicyPatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyOptions { - _options.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerPolicyOptions { - options.Headers = param - return options -} - -// UpdateLoadBalancerListenerPolicyRuleOptions : The UpdateLoadBalancerListenerPolicyRule options. -type UpdateLoadBalancerListenerPolicyRuleOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - PolicyID *string `json:"policy_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // The listener policy rule patch. - LoadBalancerListenerPolicyRulePatch map[string]interface{} `json:"LoadBalancerListenerPolicyRule_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateLoadBalancerListenerPolicyRuleOptions : Instantiate UpdateLoadBalancerListenerPolicyRuleOptions -func (*VpcV1) NewUpdateLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string, loadBalancerListenerPolicyRulePatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyRuleOptions { - return &UpdateLoadBalancerListenerPolicyRuleOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - PolicyID: core.StringPtr(policyID), - ID: core.StringPtr(id), - LoadBalancerListenerPolicyRulePatch: loadBalancerListenerPolicyRulePatch, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerPolicyRuleOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *UpdateLoadBalancerListenerPolicyRuleOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetPolicyID : Allow user to set PolicyID -func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *UpdateLoadBalancerListenerPolicyRuleOptions { - _options.PolicyID = core.StringPtr(policyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetID(id string) *UpdateLoadBalancerListenerPolicyRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetLoadBalancerListenerPolicyRulePatch : Allow user to set LoadBalancerListenerPolicyRulePatch -func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerListenerPolicyRulePatch(loadBalancerListenerPolicyRulePatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyRuleOptions { - _options.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerPolicyRuleOptions { - options.Headers = param - return options -} - -// UpdateLoadBalancerOptions : The UpdateLoadBalancer options. -type UpdateLoadBalancerOptions struct { - // The load balancer identifier. - ID *string `json:"id" validate:"required,ne="` - - // The load balancer patch. - LoadBalancerPatch map[string]interface{} `json:"LoadBalancer_patch" validate:"required"` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - // Required if the request body includes an array. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateLoadBalancerOptions : Instantiate UpdateLoadBalancerOptions -func (*VpcV1) NewUpdateLoadBalancerOptions(id string, loadBalancerPatch map[string]interface{}) *UpdateLoadBalancerOptions { - return &UpdateLoadBalancerOptions{ - ID: core.StringPtr(id), - LoadBalancerPatch: loadBalancerPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateLoadBalancerOptions) SetID(id string) *UpdateLoadBalancerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetLoadBalancerPatch : Allow user to set LoadBalancerPatch -func (_options *UpdateLoadBalancerOptions) SetLoadBalancerPatch(loadBalancerPatch map[string]interface{}) *UpdateLoadBalancerOptions { - _options.LoadBalancerPatch = loadBalancerPatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateLoadBalancerOptions) SetIfMatch(ifMatch string) *UpdateLoadBalancerOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateLoadBalancerOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerOptions { - options.Headers = param - return options -} - -// UpdateLoadBalancerPoolMemberOptions : The UpdateLoadBalancerPoolMember options. -type UpdateLoadBalancerPoolMemberOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - PoolID *string `json:"pool_id" validate:"required,ne="` - - // The member identifier. - ID *string `json:"id" validate:"required,ne="` - - // The load balancer pool member patch. - LoadBalancerPoolMemberPatch map[string]interface{} `json:"LoadBalancerPoolMember_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateLoadBalancerPoolMemberOptions : Instantiate UpdateLoadBalancerPoolMemberOptions -func (*VpcV1) NewUpdateLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string, loadBalancerPoolMemberPatch map[string]interface{}) *UpdateLoadBalancerPoolMemberOptions { - return &UpdateLoadBalancerPoolMemberOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - PoolID: core.StringPtr(poolID), - ID: core.StringPtr(id), - LoadBalancerPoolMemberPatch: loadBalancerPoolMemberPatch, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *UpdateLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerPoolMemberOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetPoolID : Allow user to set PoolID -func (_options *UpdateLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *UpdateLoadBalancerPoolMemberOptions { - _options.PoolID = core.StringPtr(poolID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateLoadBalancerPoolMemberOptions) SetID(id string) *UpdateLoadBalancerPoolMemberOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetLoadBalancerPoolMemberPatch : Allow user to set LoadBalancerPoolMemberPatch -func (_options *UpdateLoadBalancerPoolMemberOptions) SetLoadBalancerPoolMemberPatch(loadBalancerPoolMemberPatch map[string]interface{}) *UpdateLoadBalancerPoolMemberOptions { - _options.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerPoolMemberOptions { - options.Headers = param - return options -} - -// UpdateLoadBalancerPoolOptions : The UpdateLoadBalancerPool options. -type UpdateLoadBalancerPoolOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - ID *string `json:"id" validate:"required,ne="` - - // The load balancer pool patch. - LoadBalancerPoolPatch map[string]interface{} `json:"LoadBalancerPool_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateLoadBalancerPoolOptions : Instantiate UpdateLoadBalancerPoolOptions -func (*VpcV1) NewUpdateLoadBalancerPoolOptions(loadBalancerID string, id string, loadBalancerPoolPatch map[string]interface{}) *UpdateLoadBalancerPoolOptions { - return &UpdateLoadBalancerPoolOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ID: core.StringPtr(id), - LoadBalancerPoolPatch: loadBalancerPoolPatch, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *UpdateLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerPoolOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateLoadBalancerPoolOptions) SetID(id string) *UpdateLoadBalancerPoolOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetLoadBalancerPoolPatch : Allow user to set LoadBalancerPoolPatch -func (_options *UpdateLoadBalancerPoolOptions) SetLoadBalancerPoolPatch(loadBalancerPoolPatch map[string]interface{}) *UpdateLoadBalancerPoolOptions { - _options.LoadBalancerPoolPatch = loadBalancerPoolPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateLoadBalancerPoolOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerPoolOptions { - options.Headers = param - return options -} - -// UpdateNetworkACLOptions : The UpdateNetworkACL options. -type UpdateNetworkACLOptions struct { - // The network ACL identifier. - ID *string `json:"id" validate:"required,ne="` - - // The network ACL patch. - NetworkACLPatch map[string]interface{} `json:"NetworkACL_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateNetworkACLOptions : Instantiate UpdateNetworkACLOptions -func (*VpcV1) NewUpdateNetworkACLOptions(id string, networkACLPatch map[string]interface{}) *UpdateNetworkACLOptions { - return &UpdateNetworkACLOptions{ - ID: core.StringPtr(id), - NetworkACLPatch: networkACLPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateNetworkACLOptions) SetID(id string) *UpdateNetworkACLOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetNetworkACLPatch : Allow user to set NetworkACLPatch -func (_options *UpdateNetworkACLOptions) SetNetworkACLPatch(networkACLPatch map[string]interface{}) *UpdateNetworkACLOptions { - _options.NetworkACLPatch = networkACLPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateNetworkACLOptions) SetHeaders(param map[string]string) *UpdateNetworkACLOptions { - options.Headers = param - return options -} - -// UpdateNetworkACLRuleOptions : The UpdateNetworkACLRule options. -type UpdateNetworkACLRuleOptions struct { - // The network ACL identifier. - NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // The network ACL rule patch. - NetworkACLRulePatch map[string]interface{} `json:"NetworkACLRule_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateNetworkACLRuleOptions : Instantiate UpdateNetworkACLRuleOptions -func (*VpcV1) NewUpdateNetworkACLRuleOptions(networkACLID string, id string, networkACLRulePatch map[string]interface{}) *UpdateNetworkACLRuleOptions { - return &UpdateNetworkACLRuleOptions{ - NetworkACLID: core.StringPtr(networkACLID), - ID: core.StringPtr(id), - NetworkACLRulePatch: networkACLRulePatch, - } -} - -// SetNetworkACLID : Allow user to set NetworkACLID -func (_options *UpdateNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *UpdateNetworkACLRuleOptions { - _options.NetworkACLID = core.StringPtr(networkACLID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateNetworkACLRuleOptions) SetID(id string) *UpdateNetworkACLRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetNetworkACLRulePatch : Allow user to set NetworkACLRulePatch -func (_options *UpdateNetworkACLRuleOptions) SetNetworkACLRulePatch(networkACLRulePatch map[string]interface{}) *UpdateNetworkACLRuleOptions { - _options.NetworkACLRulePatch = networkACLRulePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateNetworkACLRuleOptions) SetHeaders(param map[string]string) *UpdateNetworkACLRuleOptions { - options.Headers = param - return options -} - -// UpdatePlacementGroupOptions : The UpdatePlacementGroup options. -type UpdatePlacementGroupOptions struct { - // The placement group identifier. - ID *string `json:"id" validate:"required,ne="` - - // The placement group patch. - PlacementGroupPatch map[string]interface{} `json:"PlacementGroup_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdatePlacementGroupOptions : Instantiate UpdatePlacementGroupOptions -func (*VpcV1) NewUpdatePlacementGroupOptions(id string, placementGroupPatch map[string]interface{}) *UpdatePlacementGroupOptions { - return &UpdatePlacementGroupOptions{ - ID: core.StringPtr(id), - PlacementGroupPatch: placementGroupPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdatePlacementGroupOptions) SetID(id string) *UpdatePlacementGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetPlacementGroupPatch : Allow user to set PlacementGroupPatch -func (_options *UpdatePlacementGroupOptions) SetPlacementGroupPatch(placementGroupPatch map[string]interface{}) *UpdatePlacementGroupOptions { - _options.PlacementGroupPatch = placementGroupPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdatePlacementGroupOptions) SetHeaders(param map[string]string) *UpdatePlacementGroupOptions { - options.Headers = param - return options -} - -// UpdatePublicGatewayOptions : The UpdatePublicGateway options. -type UpdatePublicGatewayOptions struct { - // The public gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // The public gateway patch. - PublicGatewayPatch map[string]interface{} `json:"PublicGateway_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdatePublicGatewayOptions : Instantiate UpdatePublicGatewayOptions -func (*VpcV1) NewUpdatePublicGatewayOptions(id string, publicGatewayPatch map[string]interface{}) *UpdatePublicGatewayOptions { - return &UpdatePublicGatewayOptions{ - ID: core.StringPtr(id), - PublicGatewayPatch: publicGatewayPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdatePublicGatewayOptions) SetID(id string) *UpdatePublicGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetPublicGatewayPatch : Allow user to set PublicGatewayPatch -func (_options *UpdatePublicGatewayOptions) SetPublicGatewayPatch(publicGatewayPatch map[string]interface{}) *UpdatePublicGatewayOptions { - _options.PublicGatewayPatch = publicGatewayPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdatePublicGatewayOptions) SetHeaders(param map[string]string) *UpdatePublicGatewayOptions { - options.Headers = param - return options -} - -// UpdateSecurityGroupOptions : The UpdateSecurityGroup options. -type UpdateSecurityGroupOptions struct { - // The security group identifier. - ID *string `json:"id" validate:"required,ne="` - - // The security group patch. - SecurityGroupPatch map[string]interface{} `json:"SecurityGroup_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateSecurityGroupOptions : Instantiate UpdateSecurityGroupOptions -func (*VpcV1) NewUpdateSecurityGroupOptions(id string, securityGroupPatch map[string]interface{}) *UpdateSecurityGroupOptions { - return &UpdateSecurityGroupOptions{ - ID: core.StringPtr(id), - SecurityGroupPatch: securityGroupPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateSecurityGroupOptions) SetID(id string) *UpdateSecurityGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetSecurityGroupPatch : Allow user to set SecurityGroupPatch -func (_options *UpdateSecurityGroupOptions) SetSecurityGroupPatch(securityGroupPatch map[string]interface{}) *UpdateSecurityGroupOptions { - _options.SecurityGroupPatch = securityGroupPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateSecurityGroupOptions) SetHeaders(param map[string]string) *UpdateSecurityGroupOptions { - options.Headers = param - return options -} - -// UpdateSecurityGroupRuleOptions : The UpdateSecurityGroupRule options. -type UpdateSecurityGroupRuleOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // The security group rule patch. - SecurityGroupRulePatch map[string]interface{} `json:"SecurityGroupRule_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateSecurityGroupRuleOptions : Instantiate UpdateSecurityGroupRuleOptions -func (*VpcV1) NewUpdateSecurityGroupRuleOptions(securityGroupID string, id string, securityGroupRulePatch map[string]interface{}) *UpdateSecurityGroupRuleOptions { - return &UpdateSecurityGroupRuleOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - ID: core.StringPtr(id), - SecurityGroupRulePatch: securityGroupRulePatch, - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *UpdateSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *UpdateSecurityGroupRuleOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateSecurityGroupRuleOptions) SetID(id string) *UpdateSecurityGroupRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetSecurityGroupRulePatch : Allow user to set SecurityGroupRulePatch -func (_options *UpdateSecurityGroupRuleOptions) SetSecurityGroupRulePatch(securityGroupRulePatch map[string]interface{}) *UpdateSecurityGroupRuleOptions { - _options.SecurityGroupRulePatch = securityGroupRulePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateSecurityGroupRuleOptions) SetHeaders(param map[string]string) *UpdateSecurityGroupRuleOptions { - options.Headers = param - return options -} - -// UpdateShareMountTargetOptions : The UpdateShareMountTarget options. -type UpdateShareMountTargetOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // The share mount target identifier. - ID *string `json:"id" validate:"required,ne="` - - // The share mount target patch. - ShareMountTargetPatch map[string]interface{} `json:"ShareMountTarget_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateShareMountTargetOptions : Instantiate UpdateShareMountTargetOptions -func (*VpcV1) NewUpdateShareMountTargetOptions(shareID string, id string, shareMountTargetPatch map[string]interface{}) *UpdateShareMountTargetOptions { - return &UpdateShareMountTargetOptions{ - ShareID: core.StringPtr(shareID), - ID: core.StringPtr(id), - ShareMountTargetPatch: shareMountTargetPatch, - } -} - -// SetShareID : Allow user to set ShareID -func (_options *UpdateShareMountTargetOptions) SetShareID(shareID string) *UpdateShareMountTargetOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateShareMountTargetOptions) SetID(id string) *UpdateShareMountTargetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetShareMountTargetPatch : Allow user to set ShareMountTargetPatch -func (_options *UpdateShareMountTargetOptions) SetShareMountTargetPatch(shareMountTargetPatch map[string]interface{}) *UpdateShareMountTargetOptions { - _options.ShareMountTargetPatch = shareMountTargetPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateShareMountTargetOptions) SetHeaders(param map[string]string) *UpdateShareMountTargetOptions { - options.Headers = param - return options -} - -// UpdateShareOptions : The UpdateShare options. -type UpdateShareOptions struct { - // The file share identifier. - ID *string `json:"id" validate:"required,ne="` - - // The file share patch. - SharePatch map[string]interface{} `json:"Share_patch" validate:"required"` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - // Required if the request body includes an array. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateShareOptions : Instantiate UpdateShareOptions -func (*VpcV1) NewUpdateShareOptions(id string, sharePatch map[string]interface{}) *UpdateShareOptions { - return &UpdateShareOptions{ - ID: core.StringPtr(id), - SharePatch: sharePatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateShareOptions) SetID(id string) *UpdateShareOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetSharePatch : Allow user to set SharePatch -func (_options *UpdateShareOptions) SetSharePatch(sharePatch map[string]interface{}) *UpdateShareOptions { - _options.SharePatch = sharePatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateShareOptions) SetIfMatch(ifMatch string) *UpdateShareOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateShareOptions) SetHeaders(param map[string]string) *UpdateShareOptions { - options.Headers = param - return options -} - -// UpdateSnapshotOptions : The UpdateSnapshot options. -type UpdateSnapshotOptions struct { - // The snapshot identifier. - ID *string `json:"id" validate:"required,ne="` - - // The snapshot patch. - SnapshotPatch map[string]interface{} `json:"Snapshot_patch" validate:"required"` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - // Required if the request body includes an array. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateSnapshotOptions : Instantiate UpdateSnapshotOptions -func (*VpcV1) NewUpdateSnapshotOptions(id string, snapshotPatch map[string]interface{}) *UpdateSnapshotOptions { - return &UpdateSnapshotOptions{ - ID: core.StringPtr(id), - SnapshotPatch: snapshotPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateSnapshotOptions) SetID(id string) *UpdateSnapshotOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetSnapshotPatch : Allow user to set SnapshotPatch -func (_options *UpdateSnapshotOptions) SetSnapshotPatch(snapshotPatch map[string]interface{}) *UpdateSnapshotOptions { - _options.SnapshotPatch = snapshotPatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateSnapshotOptions) SetIfMatch(ifMatch string) *UpdateSnapshotOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateSnapshotOptions) SetHeaders(param map[string]string) *UpdateSnapshotOptions { - options.Headers = param - return options -} - -// UpdateSubnetOptions : The UpdateSubnet options. -type UpdateSubnetOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // The subnet patch. - SubnetPatch map[string]interface{} `json:"Subnet_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateSubnetOptions : Instantiate UpdateSubnetOptions -func (*VpcV1) NewUpdateSubnetOptions(id string, subnetPatch map[string]interface{}) *UpdateSubnetOptions { - return &UpdateSubnetOptions{ - ID: core.StringPtr(id), - SubnetPatch: subnetPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateSubnetOptions) SetID(id string) *UpdateSubnetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetSubnetPatch : Allow user to set SubnetPatch -func (_options *UpdateSubnetOptions) SetSubnetPatch(subnetPatch map[string]interface{}) *UpdateSubnetOptions { - _options.SubnetPatch = subnetPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateSubnetOptions) SetHeaders(param map[string]string) *UpdateSubnetOptions { - options.Headers = param - return options -} - -// UpdateSubnetReservedIPOptions : The UpdateSubnetReservedIP options. -type UpdateSubnetReservedIPOptions struct { - // The subnet identifier. - SubnetID *string `json:"subnet_id" validate:"required,ne="` - - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // The reserved IP patch. - ReservedIPPatch map[string]interface{} `json:"ReservedIP_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateSubnetReservedIPOptions : Instantiate UpdateSubnetReservedIPOptions -func (*VpcV1) NewUpdateSubnetReservedIPOptions(subnetID string, id string, reservedIPPatch map[string]interface{}) *UpdateSubnetReservedIPOptions { - return &UpdateSubnetReservedIPOptions{ - SubnetID: core.StringPtr(subnetID), - ID: core.StringPtr(id), - ReservedIPPatch: reservedIPPatch, - } -} - -// SetSubnetID : Allow user to set SubnetID -func (_options *UpdateSubnetReservedIPOptions) SetSubnetID(subnetID string) *UpdateSubnetReservedIPOptions { - _options.SubnetID = core.StringPtr(subnetID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateSubnetReservedIPOptions) SetID(id string) *UpdateSubnetReservedIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetReservedIPPatch : Allow user to set ReservedIPPatch -func (_options *UpdateSubnetReservedIPOptions) SetReservedIPPatch(reservedIPPatch map[string]interface{}) *UpdateSubnetReservedIPOptions { - _options.ReservedIPPatch = reservedIPPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateSubnetReservedIPOptions) SetHeaders(param map[string]string) *UpdateSubnetReservedIPOptions { - options.Headers = param - return options -} - -// UpdateVirtualNetworkInterfaceOptions : The UpdateVirtualNetworkInterface options. -type UpdateVirtualNetworkInterfaceOptions struct { - // The virtual network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // The virtual network interface patch. - VirtualNetworkInterfacePatch map[string]interface{} `json:"VirtualNetworkInterface_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVirtualNetworkInterfaceOptions : Instantiate UpdateVirtualNetworkInterfaceOptions -func (*VpcV1) NewUpdateVirtualNetworkInterfaceOptions(id string, virtualNetworkInterfacePatch map[string]interface{}) *UpdateVirtualNetworkInterfaceOptions { - return &UpdateVirtualNetworkInterfaceOptions{ - ID: core.StringPtr(id), - VirtualNetworkInterfacePatch: virtualNetworkInterfacePatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateVirtualNetworkInterfaceOptions) SetID(id string) *UpdateVirtualNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVirtualNetworkInterfacePatch : Allow user to set VirtualNetworkInterfacePatch -func (_options *UpdateVirtualNetworkInterfaceOptions) SetVirtualNetworkInterfacePatch(virtualNetworkInterfacePatch map[string]interface{}) *UpdateVirtualNetworkInterfaceOptions { - _options.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateVirtualNetworkInterfaceOptions { - options.Headers = param - return options -} - -// UpdateVolumeOptions : The UpdateVolume options. -type UpdateVolumeOptions struct { - // The volume identifier. - ID *string `json:"id" validate:"required,ne="` - - // The volume patch. - VolumePatch map[string]interface{} `json:"Volume_patch" validate:"required"` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - // Required if the request body includes an array. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVolumeOptions : Instantiate UpdateVolumeOptions -func (*VpcV1) NewUpdateVolumeOptions(id string, volumePatch map[string]interface{}) *UpdateVolumeOptions { - return &UpdateVolumeOptions{ - ID: core.StringPtr(id), - VolumePatch: volumePatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateVolumeOptions) SetID(id string) *UpdateVolumeOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVolumePatch : Allow user to set VolumePatch -func (_options *UpdateVolumeOptions) SetVolumePatch(volumePatch map[string]interface{}) *UpdateVolumeOptions { - _options.VolumePatch = volumePatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateVolumeOptions) SetIfMatch(ifMatch string) *UpdateVolumeOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVolumeOptions) SetHeaders(param map[string]string) *UpdateVolumeOptions { - options.Headers = param - return options -} - -// UpdateVPCAddressPrefixOptions : The UpdateVPCAddressPrefix options. -type UpdateVPCAddressPrefixOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The prefix identifier. - ID *string `json:"id" validate:"required,ne="` - - // The prefix patch. - AddressPrefixPatch map[string]interface{} `json:"AddressPrefix_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPCAddressPrefixOptions : Instantiate UpdateVPCAddressPrefixOptions -func (*VpcV1) NewUpdateVPCAddressPrefixOptions(vpcID string, id string, addressPrefixPatch map[string]interface{}) *UpdateVPCAddressPrefixOptions { - return &UpdateVPCAddressPrefixOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - AddressPrefixPatch: addressPrefixPatch, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *UpdateVPCAddressPrefixOptions) SetVPCID(vpcID string) *UpdateVPCAddressPrefixOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPCAddressPrefixOptions) SetID(id string) *UpdateVPCAddressPrefixOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetAddressPrefixPatch : Allow user to set AddressPrefixPatch -func (_options *UpdateVPCAddressPrefixOptions) SetAddressPrefixPatch(addressPrefixPatch map[string]interface{}) *UpdateVPCAddressPrefixOptions { - _options.AddressPrefixPatch = addressPrefixPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPCAddressPrefixOptions) SetHeaders(param map[string]string) *UpdateVPCAddressPrefixOptions { - options.Headers = param - return options -} - -// UpdateVPCDnsResolutionBindingOptions : The UpdateVPCDnsResolutionBinding options. -type UpdateVPCDnsResolutionBindingOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The DNS resolution binding identifier. - ID *string `json:"id" validate:"required,ne="` - - // The DNS resolution binding patch. - VpcdnsResolutionBindingPatch map[string]interface{} `json:"VpcdnsResolutionBinding_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPCDnsResolutionBindingOptions : Instantiate UpdateVPCDnsResolutionBindingOptions -func (*VpcV1) NewUpdateVPCDnsResolutionBindingOptions(vpcID string, id string, vpcdnsResolutionBindingPatch map[string]interface{}) *UpdateVPCDnsResolutionBindingOptions { - return &UpdateVPCDnsResolutionBindingOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - VpcdnsResolutionBindingPatch: vpcdnsResolutionBindingPatch, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *UpdateVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *UpdateVPCDnsResolutionBindingOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPCDnsResolutionBindingOptions) SetID(id string) *UpdateVPCDnsResolutionBindingOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVpcdnsResolutionBindingPatch : Allow user to set VpcdnsResolutionBindingPatch -func (_options *UpdateVPCDnsResolutionBindingOptions) SetVpcdnsResolutionBindingPatch(vpcdnsResolutionBindingPatch map[string]interface{}) *UpdateVPCDnsResolutionBindingOptions { - _options.VpcdnsResolutionBindingPatch = vpcdnsResolutionBindingPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *UpdateVPCDnsResolutionBindingOptions { - options.Headers = param - return options -} - -// UpdateVPCOptions : The UpdateVPC options. -type UpdateVPCOptions struct { - // The VPC identifier. - ID *string `json:"id" validate:"required,ne="` - - // The VPC patch. - VPCPatch map[string]interface{} `json:"VPC_patch" validate:"required"` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPCOptions : Instantiate UpdateVPCOptions -func (*VpcV1) NewUpdateVPCOptions(id string, vpcPatch map[string]interface{}) *UpdateVPCOptions { - return &UpdateVPCOptions{ - ID: core.StringPtr(id), - VPCPatch: vpcPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateVPCOptions) SetID(id string) *UpdateVPCOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVPCPatch : Allow user to set VPCPatch -func (_options *UpdateVPCOptions) SetVPCPatch(vpcPatch map[string]interface{}) *UpdateVPCOptions { - _options.VPCPatch = vpcPatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateVPCOptions) SetIfMatch(ifMatch string) *UpdateVPCOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPCOptions) SetHeaders(param map[string]string) *UpdateVPCOptions { - options.Headers = param - return options -} - -// UpdateVPCRouteOptions : The UpdateVPCRoute options. -type UpdateVPCRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The route identifier. - ID *string `json:"id" validate:"required,ne="` - - // The route patch. - RoutePatch map[string]interface{} `json:"Route_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPCRouteOptions : Instantiate UpdateVPCRouteOptions -func (*VpcV1) NewUpdateVPCRouteOptions(vpcID string, id string, routePatch map[string]interface{}) *UpdateVPCRouteOptions { - return &UpdateVPCRouteOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - RoutePatch: routePatch, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *UpdateVPCRouteOptions) SetVPCID(vpcID string) *UpdateVPCRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPCRouteOptions) SetID(id string) *UpdateVPCRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetRoutePatch : Allow user to set RoutePatch -func (_options *UpdateVPCRouteOptions) SetRoutePatch(routePatch map[string]interface{}) *UpdateVPCRouteOptions { - _options.RoutePatch = routePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPCRouteOptions) SetHeaders(param map[string]string) *UpdateVPCRouteOptions { - options.Headers = param - return options -} - -// UpdateVPCRoutingTableOptions : The UpdateVPCRoutingTable options. -type UpdateVPCRoutingTableOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table identifier. - ID *string `json:"id" validate:"required,ne="` - - // The routing table patch. - RoutingTablePatch map[string]interface{} `json:"RoutingTable_patch" validate:"required"` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - // Required if the request body includes an array. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPCRoutingTableOptions : Instantiate UpdateVPCRoutingTableOptions -func (*VpcV1) NewUpdateVPCRoutingTableOptions(vpcID string, id string, routingTablePatch map[string]interface{}) *UpdateVPCRoutingTableOptions { - return &UpdateVPCRoutingTableOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - RoutingTablePatch: routingTablePatch, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *UpdateVPCRoutingTableOptions) SetVPCID(vpcID string) *UpdateVPCRoutingTableOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPCRoutingTableOptions) SetID(id string) *UpdateVPCRoutingTableOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetRoutingTablePatch : Allow user to set RoutingTablePatch -func (_options *UpdateVPCRoutingTableOptions) SetRoutingTablePatch(routingTablePatch map[string]interface{}) *UpdateVPCRoutingTableOptions { - _options.RoutingTablePatch = routingTablePatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateVPCRoutingTableOptions) SetIfMatch(ifMatch string) *UpdateVPCRoutingTableOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPCRoutingTableOptions) SetHeaders(param map[string]string) *UpdateVPCRoutingTableOptions { - options.Headers = param - return options -} - -// UpdateVPCRoutingTableRouteOptions : The UpdateVPCRoutingTableRoute options. -type UpdateVPCRoutingTableRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table identifier. - RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` - - // The VPC routing table route identifier. - ID *string `json:"id" validate:"required,ne="` - - // The VPC route patch. - RoutePatch map[string]interface{} `json:"Route_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPCRoutingTableRouteOptions : Instantiate UpdateVPCRoutingTableRouteOptions -func (*VpcV1) NewUpdateVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string, routePatch map[string]interface{}) *UpdateVPCRoutingTableRouteOptions { - return &UpdateVPCRoutingTableRouteOptions{ - VPCID: core.StringPtr(vpcID), - RoutingTableID: core.StringPtr(routingTableID), - ID: core.StringPtr(id), - RoutePatch: routePatch, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *UpdateVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *UpdateVPCRoutingTableRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetRoutingTableID : Allow user to set RoutingTableID -func (_options *UpdateVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *UpdateVPCRoutingTableRouteOptions { - _options.RoutingTableID = core.StringPtr(routingTableID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPCRoutingTableRouteOptions) SetID(id string) *UpdateVPCRoutingTableRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetRoutePatch : Allow user to set RoutePatch -func (_options *UpdateVPCRoutingTableRouteOptions) SetRoutePatch(routePatch map[string]interface{}) *UpdateVPCRoutingTableRouteOptions { - _options.RoutePatch = routePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *UpdateVPCRoutingTableRouteOptions { - options.Headers = param - return options -} - -// UpdateVPNGatewayConnectionOptions : The UpdateVPNGatewayConnection options. -type UpdateVPNGatewayConnectionOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` - - // The VPN gateway connection patch. - VPNGatewayConnectionPatch map[string]interface{} `json:"VPNGatewayConnection_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPNGatewayConnectionOptions : Instantiate UpdateVPNGatewayConnectionOptions -func (*VpcV1) NewUpdateVPNGatewayConnectionOptions(vpnGatewayID string, id string, vpnGatewayConnectionPatch map[string]interface{}) *UpdateVPNGatewayConnectionOptions { - return &UpdateVPNGatewayConnectionOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - VPNGatewayConnectionPatch: vpnGatewayConnectionPatch, - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *UpdateVPNGatewayConnectionOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPNGatewayConnectionOptions) SetID(id string) *UpdateVPNGatewayConnectionOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVPNGatewayConnectionPatch : Allow user to set VPNGatewayConnectionPatch -func (_options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPatch(vpnGatewayConnectionPatch map[string]interface{}) *UpdateVPNGatewayConnectionOptions { - _options.VPNGatewayConnectionPatch = vpnGatewayConnectionPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayConnectionOptions { - options.Headers = param - return options -} - -// UpdateVPNGatewayOptions : The UpdateVPNGateway options. -type UpdateVPNGatewayOptions struct { - // The VPN gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // The VPN gateway patch. - VPNGatewayPatch map[string]interface{} `json:"VPNGateway_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPNGatewayOptions : Instantiate UpdateVPNGatewayOptions -func (*VpcV1) NewUpdateVPNGatewayOptions(id string, vpnGatewayPatch map[string]interface{}) *UpdateVPNGatewayOptions { - return &UpdateVPNGatewayOptions{ - ID: core.StringPtr(id), - VPNGatewayPatch: vpnGatewayPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateVPNGatewayOptions) SetID(id string) *UpdateVPNGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVPNGatewayPatch : Allow user to set VPNGatewayPatch -func (_options *UpdateVPNGatewayOptions) SetVPNGatewayPatch(vpnGatewayPatch map[string]interface{}) *UpdateVPNGatewayOptions { - _options.VPNGatewayPatch = vpnGatewayPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPNGatewayOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayOptions { - options.Headers = param - return options -} - -// UpdateVPNServerOptions : The UpdateVPNServer options. -type UpdateVPNServerOptions struct { - // The VPN server identifier. - ID *string `json:"id" validate:"required,ne="` - - // The VPN server patch. - VPNServerPatch map[string]interface{} `json:"VPNServer_patch" validate:"required"` - - // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. - // Required if the request body includes an array. - IfMatch *string `json:"If-Match,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPNServerOptions : Instantiate UpdateVPNServerOptions -func (*VpcV1) NewUpdateVPNServerOptions(id string, vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions { - return &UpdateVPNServerOptions{ - ID: core.StringPtr(id), - VPNServerPatch: vpnServerPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateVPNServerOptions) SetID(id string) *UpdateVPNServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVPNServerPatch : Allow user to set VPNServerPatch -func (_options *UpdateVPNServerOptions) SetVPNServerPatch(vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions { - _options.VPNServerPatch = vpnServerPatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateVPNServerOptions) SetIfMatch(ifMatch string) *UpdateVPNServerOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPNServerOptions) SetHeaders(param map[string]string) *UpdateVPNServerOptions { - options.Headers = param - return options -} - -// UpdateVPNServerRouteOptions : The UpdateVPNServerRoute options. -type UpdateVPNServerRouteOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The VPN route identifier. - ID *string `json:"id" validate:"required,ne="` - - // The VPN route patch. - VPNServerRoutePatch map[string]interface{} `json:"VPNServerRoute_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPNServerRouteOptions : Instantiate UpdateVPNServerRouteOptions -func (*VpcV1) NewUpdateVPNServerRouteOptions(vpnServerID string, id string, vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions { - return &UpdateVPNServerRouteOptions{ - VPNServerID: core.StringPtr(vpnServerID), - ID: core.StringPtr(id), - VPNServerRoutePatch: vpnServerRoutePatch, - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *UpdateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *UpdateVPNServerRouteOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPNServerRouteOptions) SetID(id string) *UpdateVPNServerRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVPNServerRoutePatch : Allow user to set VPNServerRoutePatch -func (_options *UpdateVPNServerRouteOptions) SetVPNServerRoutePatch(vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions { - _options.VPNServerRoutePatch = vpnServerRoutePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPNServerRouteOptions) SetHeaders(param map[string]string) *UpdateVPNServerRouteOptions { - options.Headers = param - return options -} - -// Vcpu : The VCPU configuration. -type Vcpu struct { - // The VCPU architecture. - Architecture *string `json:"architecture" validate:"required"` - - // The number of VCPUs assigned. - Count *int64 `json:"count" validate:"required"` - - // The VCPU manufacturer. - Manufacturer *string `json:"manufacturer" validate:"required"` -} - -// UnmarshalVcpu unmarshals an instance of Vcpu from the specified map of raw messages. -func UnmarshalVcpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Vcpu) - err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "count", &obj.Count) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPC : VPC struct -type VPC struct { - // Indicates whether this VPC is connected to Classic Infrastructure. If true, this VPC's resources have private - // network connectivity to the account's Classic Infrastructure resources. Only one VPC, per region, may be connected - // in this way. This value is set at creation and subsequently immutable. - ClassicAccess *bool `json:"classic_access" validate:"required"` - - // The date and time that the VPC was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` - - // The CSE ([Cloud Service Endpoint](https://cloud.ibm.com/docs/resources?topic=resources-service-endpoints)) source IP - // addresses for the VPC. The VPC will have one CSE source IP address per zone. - CseSourceIps []VpccseSourceIP `json:"cse_source_ips,omitempty"` - - // The default network ACL to use for subnets created in this VPC. - DefaultNetworkACL *NetworkACLReference `json:"default_network_acl" validate:"required"` - - // The default routing table to use for subnets created in this VPC. - DefaultRoutingTable *RoutingTableReference `json:"default_routing_table" validate:"required"` - - // The default security group for this VPC. Resources created in this VPC that allow - // a security group to be optionally specified will use this security group by - // default. - DefaultSecurityGroup *SecurityGroupReference `json:"default_security_group" validate:"required"` - - // The DNS configuration for this VPC. - Dns *Vpcdns `json:"dns" validate:"required"` - - // The reasons for the current `health_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - HealthReasons []VPCHealthReason `json:"health_reasons" validate:"required"` - - // The health of this resource. - // - `ok`: No abnormal behavior detected - // - `degraded`: Experiencing compromised performance, capacity, or connectivity - // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated - // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a - // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also - // have this state. - HealthState *string `json:"health_state" validate:"required"` - - // The URL for this VPC. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` - - // The name for this VPC. The name is unique across all VPCs in the region. - Name *string `json:"name" validate:"required"` - - // The resource group for this VPC. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of this VPC. - Status *string `json:"status" validate:"required"` -} - -// Constants associated with the VPC.HealthState property. -// The health of this resource. -// - `ok`: No abnormal behavior detected -// - `degraded`: Experiencing compromised performance, capacity, or connectivity -// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated -// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle -// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this -// state. -const ( - VPCHealthStateDegradedConst = "degraded" - VPCHealthStateFaultedConst = "faulted" - VPCHealthStateInapplicableConst = "inapplicable" - VPCHealthStateOkConst = "ok" -) - -// Constants associated with the VPC.ResourceType property. -// The resource type. -const ( - VPCResourceTypeVPCConst = "vpc" -) - -// Constants associated with the VPC.Status property. -// The status of this VPC. -const ( - VPCStatusAvailableConst = "available" - VPCStatusDeletingConst = "deleting" - VPCStatusFailedConst = "failed" - VPCStatusPendingConst = "pending" -) - -// UnmarshalVPC unmarshals an instance of VPC from the specified map of raw messages. -func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPC) - err = core.UnmarshalPrimitive(m, "classic_access", &obj.ClassicAccess) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "cse_source_ips", &obj.CseSourceIps, UnmarshalVpccseSourceIP) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_network_acl", &obj.DefaultNetworkACL, UnmarshalNetworkACLReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_routing_table", &obj.DefaultRoutingTable, UnmarshalRoutingTableReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_security_group", &obj.DefaultSecurityGroup, UnmarshalSecurityGroupReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdns) - if err != nil { - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPCHealthReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpccseSourceIP : VpccseSourceIP struct -type VpccseSourceIP struct { - // The cloud service endpoint source IP address for this zone. - IP *IP `json:"ip" validate:"required"` - - // The zone this cloud service endpoint source IP resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// UnmarshalVpccseSourceIP unmarshals an instance of VpccseSourceIP from the specified map of raw messages. -func UnmarshalVpccseSourceIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpccseSourceIP) - err = core.UnmarshalModel(m, "ip", &obj.IP, UnmarshalIP) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCCollection : VPCCollection struct -type VPCCollection struct { - // A link to the first page of resources. - First *VPCCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *VPCCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` - - // Collection of VPCs. - Vpcs []VPC `json:"vpcs" validate:"required"` -} - -// UnmarshalVPCCollection unmarshals an instance of VPCCollection from the specified map of raw messages. -func UnmarshalVPCCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPCCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPCCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpcs", &obj.Vpcs, UnmarshalVPC) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *VPCCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// VPCCollectionFirst : A link to the first page of resources. -type VPCCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPCCollectionFirst unmarshals an instance of VPCCollectionFirst from the specified map of raw messages. -func UnmarshalVPCCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPCCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPCCollectionNext unmarshals an instance of VPCCollectionNext from the specified map of raw messages. -func UnmarshalVPCCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Vpcdns : The DNS configuration for this VPC. -type Vpcdns struct { - // Indicates whether this VPC is enabled as a DNS name resolution hub. - EnableHub *bool `json:"enable_hub" validate:"required"` - - // The number of DNS resolution bindings for this VPC. - ResolutionBindingCount *int64 `json:"resolution_binding_count" validate:"required"` - - // The DNS resolver configuration for the VPC. - Resolver VpcdnsResolverIntf `json:"resolver" validate:"required"` -} - -// UnmarshalVpcdns unmarshals an instance of Vpcdns from the specified map of raw messages. -func UnmarshalVpcdns(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Vpcdns) - err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resolution_binding_count", &obj.ResolutionBindingCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolver) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsPatch : The DNS configuration for this VPC. -type VpcdnsPatch struct { - // Indicates whether this VPC is enabled as a DNS name resolution hub. - // - // Updating the value to `true` requires `allow_dns_resolution_binding` to be `true` for all endpoint gateways residing - // in this VPC. - // - // Changing the value requires `dns.resolution_binding_count` to be zero. - EnableHub *bool `json:"enable_hub,omitempty"` - - Resolver *VpcdnsResolverPatch `json:"resolver,omitempty"` -} - -// UnmarshalVpcdnsPatch unmarshals an instance of VpcdnsPatch from the specified map of raw messages. -func UnmarshalVpcdnsPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsPatch) - err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPatch) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsPrototype : The DNS configuration for this VPC. -// -// If unspecified, the system will assign DNS servers capable of resolving hosts and endpoint gateways within this VPC, -// and hosts on the internet. -type VpcdnsPrototype struct { - // Indicates whether this VPC is enabled as a DNS name resolution hub. - EnableHub *bool `json:"enable_hub,omitempty"` - - Resolver VpcdnsResolverPrototypeIntf `json:"resolver,omitempty"` -} - -// UnmarshalVpcdnsPrototype unmarshals an instance of VpcdnsPrototype from the specified map of raw messages. -func UnmarshalVpcdnsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsPrototype) - err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolutionBinding : VpcdnsResolutionBinding struct -type VpcdnsResolutionBinding struct { - // The date and time that the DNS resolution binding was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The endpoint gateways that have `allow_dns_resolution_binding` set to `true` and reside in the VPC that has - // `dns.enable_hub` set to `false`. - // - // The endpoint gateways may be remote and therefore may not be directly retrievable. - EndpointGateways []EndpointGatewayReferenceRemote `json:"endpoint_gateways" validate:"required"` - - // The URL for this DNS resolution binding. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this DNS resolution binding. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the DNS resolution binding. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this DNS resolution binding. The name is unique across all DNS resolution bindings for the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The VPC bound to for DNS resolution. - // - // The VPC may be remote and therefore may not be directly retrievable. - VPC *VPCReferenceRemote `json:"vpc" validate:"required"` -} - -// Constants associated with the VpcdnsResolutionBinding.LifecycleState property. -// The lifecycle state of the DNS resolution binding. -const ( - VpcdnsResolutionBindingLifecycleStateDeletingConst = "deleting" - VpcdnsResolutionBindingLifecycleStateFailedConst = "failed" - VpcdnsResolutionBindingLifecycleStatePendingConst = "pending" - VpcdnsResolutionBindingLifecycleStateStableConst = "stable" - VpcdnsResolutionBindingLifecycleStateSuspendedConst = "suspended" - VpcdnsResolutionBindingLifecycleStateUpdatingConst = "updating" - VpcdnsResolutionBindingLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VpcdnsResolutionBinding.ResourceType property. -// The resource type. -const ( - VpcdnsResolutionBindingResourceTypeVPCDnsResolutionBindingConst = "vpc_dns_resolution_binding" -) - -// UnmarshalVpcdnsResolutionBinding unmarshals an instance of VpcdnsResolutionBinding from the specified map of raw messages. -func UnmarshalVpcdnsResolutionBinding(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolutionBinding) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGatewayReferenceRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceRemote) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolutionBindingCollection : VpcdnsResolutionBindingCollection struct -type VpcdnsResolutionBindingCollection struct { - // Collection of DNS resolution bindings for this VPC. - DnsResolutionBindings []VpcdnsResolutionBinding `json:"dns_resolution_bindings" validate:"required"` - - // A link to the first page of resources. - First *VpcdnsResolutionBindingCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *VpcdnsResolutionBindingCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalVpcdnsResolutionBindingCollection unmarshals an instance of VpcdnsResolutionBindingCollection from the specified map of raw messages. -func UnmarshalVpcdnsResolutionBindingCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolutionBindingCollection) - err = core.UnmarshalModel(m, "dns_resolution_bindings", &obj.DnsResolutionBindings, UnmarshalVpcdnsResolutionBinding) - if err != nil { - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVpcdnsResolutionBindingCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVpcdnsResolutionBindingCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *VpcdnsResolutionBindingCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// VpcdnsResolutionBindingPatch : VpcdnsResolutionBindingPatch struct -type VpcdnsResolutionBindingPatch struct { - // The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVpcdnsResolutionBindingPatch unmarshals an instance of VpcdnsResolutionBindingPatch from the specified map of raw messages. -func UnmarshalVpcdnsResolutionBindingPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolutionBindingPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the VpcdnsResolutionBindingPatch -func (vpcdnsResolutionBindingPatch *VpcdnsResolutionBindingPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpcdnsResolutionBindingPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// VpcdnsResolver : VpcdnsResolver struct -// Models which "extend" this model: -// - VpcdnsResolverTypeDelegated -// - VpcdnsResolverTypeManual -// - VpcdnsResolverTypeSystem -type VpcdnsResolver struct { - // The DNS servers for this VPC. The servers are populated: - // - // - by the system when `dns.resolver.type` is `system` - // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` - // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. - Servers []DnsServer `json:"servers" validate:"required"` - - // The type of the DNS resolver used for the VPC. - // - // - `delegated`: DNS server addresses are provided by the DNS resolver of the VPC - // specified in `dns.resolver.vpc`. - // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. - // - `system`: DNS server addresses are provided by the system. - Type *string `json:"type" validate:"required"` - - // The VPC whose DNS resolver provides the DNS server addresses for this VPC. - // - // The VPC may be remote and therefore may not be directly retrievable. - VPC *VPCReferenceDnsResolverContext `json:"vpc,omitempty"` - - // The manually specified DNS servers for this VPC. - ManualServers []DnsServer `json:"manual_servers,omitempty"` - - // The configuration of the system DNS resolver for this VPC. - // - // - `custom_resolver`: A custom DNS resolver is configured for this VPC. - // - // - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when - // the VPC has either or both of the following: - // - // - at least one endpoint gateway residing in it - // - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it - // - // - `default`: The provider default DNS resolvers are configured for this VPC. - // - // This system DNS resolver configuration is used when the VPC has: - // - // - no custom DNS resolver configured for it, and - // - no endpoint gateways residing in it, and - // - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. - Configuration *string `json:"configuration,omitempty"` -} - -// Constants associated with the VpcdnsResolver.Type property. -// The type of the DNS resolver used for the VPC. -// -// - `delegated`: DNS server addresses are provided by the DNS resolver of the VPC -// specified in `dns.resolver.vpc`. -// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. -// - `system`: DNS server addresses are provided by the system. -const ( - VpcdnsResolverTypeDelegatedConst = "delegated" - VpcdnsResolverTypeManualConst = "manual" - VpcdnsResolverTypeSystemConst = "system" -) - -// Constants associated with the VpcdnsResolver.Configuration property. -// The configuration of the system DNS resolver for this VPC. -// -// - `custom_resolver`: A custom DNS resolver is configured for this VPC. -// -// - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when -// the VPC has either or both of the following: -// -// - at least one endpoint gateway residing in it -// -// - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it -// -// - `default`: The provider default DNS resolvers are configured for this VPC. -// -// This system DNS resolver configuration is used when the VPC has: -// -// - no custom DNS resolver configured for it, and -// - no endpoint gateways residing in it, and -// - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. -const ( - VpcdnsResolverConfigurationCustomResolverConst = "custom_resolver" - VpcdnsResolverConfigurationDefaultConst = "default" - VpcdnsResolverConfigurationPrivateResolverConst = "private_resolver" -) - -func (*VpcdnsResolver) isaVpcdnsResolver() bool { - return true -} - -type VpcdnsResolverIntf interface { - isaVpcdnsResolver() bool -} - -// UnmarshalVpcdnsResolver unmarshals an instance of VpcdnsResolver from the specified map of raw messages. -func UnmarshalVpcdnsResolver(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolver) - err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverPatch : VpcdnsResolverPatch struct -type VpcdnsResolverPatch struct { - // The DNS servers to use for this VPC, replacing any existing servers. All the DNS servers must either: - // - // - have a unique `zone_affinity`, or - // - not have a `zone_affinity`. - // - // `dns.resolver.manual_servers` must be set if and only if `dns.resolver.type` is `manual`. - ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"` - - // The type of the DNS resolver to use. - // - // - `delegated`: DNS server addresses will be provided by the resolver for the VPC - // specified in `dns.resolver.vpc`. Requires `dns.enable_hub` to be - // `false`. - // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. - // - `system`: DNS server addresses will be provided by the system and depend on the - // configuration. - // - // Updating from `manual` requires `dns.resolver.manual_servers` to be specified as - // `null`. - // - // Updating to `manual` requires `dns.resolver.manual_servers` to be specified and not empty. - // - // Updating from `delegated` requires `dns.resolver.vpc` to be specified as `null`. - Type *string `json:"type,omitempty"` - - // The VPC to provide DNS server addresses for this VPC. The specified VPC must be configured - // with a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) custom resolver and must be in - // one of this VPC's DNS resolution bindings. - // - // Specify `null` to remove an existing VPC. - // - // This property must be set if and only if `dns.resolver.type` is `delegated`. - VPC VpcdnsResolverVPCPatchIntf `json:"vpc,omitempty"` -} - -// Constants associated with the VpcdnsResolverPatch.Type property. -// The type of the DNS resolver to use. -// -// - `delegated`: DNS server addresses will be provided by the resolver for the VPC -// specified in `dns.resolver.vpc`. Requires `dns.enable_hub` to be -// `false`. -// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. -// - `system`: DNS server addresses will be provided by the system and depend on the -// configuration. -// -// Updating from `manual` requires `dns.resolver.manual_servers` to be specified as -// `null`. -// -// Updating to `manual` requires `dns.resolver.manual_servers` to be specified and not empty. -// -// Updating from `delegated` requires `dns.resolver.vpc` to be specified as `null`. -const ( - VpcdnsResolverPatchTypeDelegatedConst = "delegated" - VpcdnsResolverPatchTypeManualConst = "manual" - VpcdnsResolverPatchTypeSystemConst = "system" -) - -// UnmarshalVpcdnsResolverPatch unmarshals an instance of VpcdnsResolverPatch from the specified map of raw messages. -func UnmarshalVpcdnsResolverPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverPatch) - err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVpcdnsResolverVPCPatch) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverPrototype : VpcdnsResolverPrototype struct -// Models which "extend" this model: -// - VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype -// - VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype -type VpcdnsResolverPrototype struct { - // The type of the DNS resolver to use. - // - // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. - // - `system`: DNS server addresses will be provided by the system and depend on the - // configuration. - Type *string `json:"type,omitempty"` - - // The DNS servers to use for this VPC. All the DNS servers must either: - // - // - have a unique `zone_affinity`, or - // - not have a `zone_affinity`. - ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"` -} - -// Constants associated with the VpcdnsResolverPrototype.Type property. -// The type of the DNS resolver to use. -// -// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. -// - `system`: DNS server addresses will be provided by the system and depend on the -// configuration. -const ( - VpcdnsResolverPrototypeTypeManualConst = "manual" - VpcdnsResolverPrototypeTypeSystemConst = "system" -) - -func (*VpcdnsResolverPrototype) isaVpcdnsResolverPrototype() bool { - return true -} - -type VpcdnsResolverPrototypeIntf interface { - isaVpcdnsResolverPrototype() bool -} - -// UnmarshalVpcdnsResolverPrototype unmarshals an instance of VpcdnsResolverPrototype from the specified map of raw messages. -func UnmarshalVpcdnsResolverPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverPrototype) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverVPCPatch : The VPC to provide DNS server addresses for this VPC. The specified VPC must be configured with a [DNS -// Services](https://cloud.ibm.com/docs/dns-svcs) custom resolver and must be in one of this VPC's DNS resolution -// bindings. -// -// Specify `null` to remove an existing VPC. -// -// This property must be set if and only if `dns.resolver.type` is `delegated`. -// Models which "extend" this model: -// - VpcdnsResolverVPCPatchVPCIdentityByID -// - VpcdnsResolverVPCPatchVPCIdentityByCRN -// - VpcdnsResolverVPCPatchVPCIdentityByHref -type VpcdnsResolverVPCPatch struct { - // The unique identifier for this VPC. - ID *string `json:"id,omitempty"` - - // The CRN for this VPC. - CRN *string `json:"crn,omitempty"` - - // The URL for this VPC. - Href *string `json:"href,omitempty"` -} - -func (*VpcdnsResolverVPCPatch) isaVpcdnsResolverVPCPatch() bool { - return true -} - -type VpcdnsResolverVPCPatchIntf interface { - isaVpcdnsResolverVPCPatch() bool -} - -// UnmarshalVpcdnsResolverVPCPatch unmarshals an instance of VpcdnsResolverVPCPatch from the specified map of raw messages. -func UnmarshalVpcdnsResolverVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverVPCPatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCHealthReason : VPCHealthReason struct -type VPCHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this health state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPCHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. -const ( - VPCHealthReasonCodeInternalErrorConst = "internal_error" -) - -// UnmarshalVPCHealthReason unmarshals an instance of VPCHealthReason from the specified map of raw messages. -func UnmarshalVPCHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCHealthReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCIdentity : Identifies a VPC by a unique property. -// Models which "extend" this model: -// - VPCIdentityByID -// - VPCIdentityByCRN -// - VPCIdentityByHref -type VPCIdentity struct { - // The unique identifier for this VPC. - ID *string `json:"id,omitempty"` - - // The CRN for this VPC. - CRN *string `json:"crn,omitempty"` - - // The URL for this VPC. - Href *string `json:"href,omitempty"` -} - -func (*VPCIdentity) isaVPCIdentity() bool { - return true -} - -type VPCIdentityIntf interface { - isaVPCIdentity() bool -} - -// UnmarshalVPCIdentity unmarshals an instance of VPCIdentity from the specified map of raw messages. -func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCPatch : VPCPatch struct -type VPCPatch struct { - // The DNS configuration for this VPC. - Dns *VpcdnsPatch `json:"dns,omitempty"` - - // The name for this VPC. The name must not be used by another VPC in the region. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVPCPatch unmarshals an instance of VPCPatch from the specified map of raw messages. -func UnmarshalVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCPatch) - err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdnsPatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the VPCPatch -func (vpcPatch *VPCPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpcPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// VPCReference : VPCReference struct -type VPCReference struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this VPC. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` - - // The name for this VPC. The name is unique across all VPCs in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VPCReference.ResourceType property. -// The resource type. -const ( - VPCReferenceResourceTypeVPCConst = "vpc" -) - -// UnmarshalVPCReference unmarshals an instance of VPCReference from the specified map of raw messages. -func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCReferenceDnsResolverContext : A VPC whose DNS resolver is delegated to provide DNS servers for this VPC. -// -// The VPC may be remote and therefore may not be directly retrievable. -type VPCReferenceDnsResolverContext struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPCReferenceDnsResolverContextDeleted `json:"deleted,omitempty"` - - // The URL for this VPC. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` - - // The name for this VPC. The name is unique across all VPCs in the region. - Name *string `json:"name" validate:"required"` - - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *VPCRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VPCReferenceDnsResolverContext.ResourceType property. -// The resource type. -const ( - VPCReferenceDnsResolverContextResourceTypeVPCConst = "vpc" -) - -// UnmarshalVPCReferenceDnsResolverContext unmarshals an instance of VPCReferenceDnsResolverContext from the specified map of raw messages. -func UnmarshalVPCReferenceDnsResolverContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReferenceDnsResolverContext) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDnsResolverContextDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVPCRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPCReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPCReferenceDeleted unmarshals an instance of VPCReferenceDeleted from the specified map of raw messages. -func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCReferenceDnsResolverContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPCReferenceDnsResolverContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPCReferenceDnsResolverContextDeleted unmarshals an instance of VPCReferenceDnsResolverContextDeleted from the specified map of raw messages. -func UnmarshalVPCReferenceDnsResolverContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReferenceDnsResolverContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCReferenceRemote : VPCReferenceRemote struct -type VPCReferenceRemote struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` - - // The URL for this VPC. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` - - // The name for this VPC. The name is unique across all VPCs in the region. - Name *string `json:"name" validate:"required"` - - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *VPCRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VPCReferenceRemote.ResourceType property. -// The resource type. -const ( - VPCReferenceRemoteResourceTypeVPCConst = "vpc" -) - -// UnmarshalVPCReferenceRemote unmarshals an instance of VPCReferenceRemote from the specified map of raw messages. -func UnmarshalVPCReferenceRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReferenceRemote) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVPCRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type VPCRemote struct { - // If present, this property indicates that the referenced resource is remote to this - // account, and identifies the owning account. - Account *AccountReference `json:"account,omitempty"` - - // If present, this property indicates that the referenced resource is remote to this - // region, and identifies the native region. - Region *RegionReference `json:"region,omitempty"` -} - -// UnmarshalVPCRemote unmarshals an instance of VPCRemote from the specified map of raw messages. -func UnmarshalVPCRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCRemote) - err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGateway : VPNGateway struct -// Models which "extend" this model: -// - VPNGatewayRouteMode -// - VPNGatewayPolicyMode -type VPNGateway struct { - // Connections for this VPN gateway. - Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` - - // The date and time that this VPN gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` - - // The reasons for the current VPN gateway health_state (if any): - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - HealthReasons []VPNGatewayHealthReason `json:"health_reasons" validate:"required"` - - // The health of this resource. - // - `ok`: No abnormal behavior detected - // - `degraded`: Experiencing compromised performance, capacity, or connectivity - // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated - // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a - // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also - // have this state. - HealthState *string `json:"health_state" validate:"required"` - - // The VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` - - // The reasons for the current VPN gateway lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN gateway. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // Collection of VPN gateway members. - Members []VPNGatewayMember `json:"members" validate:"required"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this VPN gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The VPC this VPN gateway resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // Route mode VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGateway.HealthState property. -// The health of this resource. -// - `ok`: No abnormal behavior detected -// - `degraded`: Experiencing compromised performance, capacity, or connectivity -// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated -// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle -// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this -// state. -const ( - VPNGatewayHealthStateDegradedConst = "degraded" - VPNGatewayHealthStateFaultedConst = "faulted" - VPNGatewayHealthStateInapplicableConst = "inapplicable" - VPNGatewayHealthStateOkConst = "ok" -) - -// Constants associated with the VPNGateway.LifecycleState property. -// The lifecycle state of the VPN gateway. -const ( - VPNGatewayLifecycleStateDeletingConst = "deleting" - VPNGatewayLifecycleStateFailedConst = "failed" - VPNGatewayLifecycleStatePendingConst = "pending" - VPNGatewayLifecycleStateStableConst = "stable" - VPNGatewayLifecycleStateSuspendedConst = "suspended" - VPNGatewayLifecycleStateUpdatingConst = "updating" - VPNGatewayLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNGateway.ResourceType property. -// The resource type. -const ( - VPNGatewayResourceTypeVPNGatewayConst = "vpn_gateway" -) - -// Constants associated with the VPNGateway.Mode property. -// Route mode VPN gateway. -const ( - VPNGatewayModeRouteConst = "route" -) - -func (*VPNGateway) isaVPNGateway() bool { - return true -} - -type VPNGatewayIntf interface { - isaVPNGateway() bool -} - -// UnmarshalVPNGateway unmarshals an instance of VPNGateway from the specified map of raw messages. -func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGateway) - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayCollection : VPNGatewayCollection struct -type VPNGatewayCollection struct { - // A link to the first page of resources. - First *VPNGatewayCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *VPNGatewayCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` - - // Collection of VPN gateways. - VPNGateways []VPNGatewayIntf `json:"vpn_gateways" validate:"required"` -} - -// UnmarshalVPNGatewayCollection unmarshals an instance of VPNGatewayCollection from the specified map of raw messages. -func UnmarshalVPNGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNGatewayCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNGatewayCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpn_gateways", &obj.VPNGateways, UnmarshalVPNGateway) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *VPNGatewayCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// VPNGatewayCollectionFirst : A link to the first page of resources. -type VPNGatewayCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNGatewayCollectionFirst unmarshals an instance of VPNGatewayCollectionFirst from the specified map of raw messages. -func UnmarshalVPNGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPNGatewayCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNGatewayCollectionNext unmarshals an instance of VPNGatewayCollectionNext from the specified map of raw messages. -func UnmarshalVPNGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnection : VPNGatewayConnection struct -// Models which "extend" this model: -// - VPNGatewayConnectionStaticRouteMode -// - VPNGatewayConnectionPolicyMode -type VPNGatewayConnection struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up" validate:"required"` - - // The authentication mode. Only `psk` is currently supported. - AuthenticationMode *string `json:"authentication_mode" validate:"required"` - - // The date and time that this VPN gateway connection was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The Dead Peer Detection settings. - DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The IKE policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` - - // The IPsec policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` - - // The mode of the VPN gateway. - Mode *string `json:"mode" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` - - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of a VPN gateway connection. - Status *string `json:"status" validate:"required"` - - // The reasons for the current VPN gateway connection status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` - - // The VPN tunnel configuration for this VPN gateway connection (in static route mode). - Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels,omitempty"` - - // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs,omitempty"` - - // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs,omitempty"` -} - -// Constants associated with the VPNGatewayConnection.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. -const ( - VPNGatewayConnectionAuthenticationModePskConst = "psk" -) - -// Constants associated with the VPNGatewayConnection.Mode property. -// The mode of the VPN gateway. -const ( - VPNGatewayConnectionModePolicyConst = "policy" - VPNGatewayConnectionModeRouteConst = "route" -) - -// Constants associated with the VPNGatewayConnection.ResourceType property. -// The resource type. -const ( - VPNGatewayConnectionResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -// Constants associated with the VPNGatewayConnection.Status property. -// The status of a VPN gateway connection. -const ( - VPNGatewayConnectionStatusDownConst = "down" - VPNGatewayConnectionStatusUpConst = "up" -) - -// Constants associated with the VPNGatewayConnection.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionRoutingProtocolNoneConst = "none" -) - -func (*VPNGatewayConnection) isaVPNGatewayConnection() bool { - return true -} - -type VPNGatewayConnectionIntf interface { - isaVPNGatewayConnection() bool -} - -// UnmarshalVPNGatewayConnection unmarshals an instance of VPNGatewayConnection from the specified map of raw messages. -func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnection) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionCollection : Collection of VPN gateway connections in a VPN gateway. -type VPNGatewayConnectionCollection struct { - // Array of VPN gateway connections. - Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionCollection unmarshals an instance of VPNGatewayConnectionCollection from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionCollection) - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionDpd : The Dead Peer Detection settings. -type VPNGatewayConnectionDpd struct { - // Dead Peer Detection actions. - Action *string `json:"action" validate:"required"` - - // Dead Peer Detection interval in seconds. - Interval *int64 `json:"interval" validate:"required"` - - // Dead Peer Detection timeout in seconds. Must be at least the interval. - Timeout *int64 `json:"timeout" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionDpd.Action property. -// Dead Peer Detection actions. -const ( - VPNGatewayConnectionDpdActionClearConst = "clear" - VPNGatewayConnectionDpdActionHoldConst = "hold" - VPNGatewayConnectionDpdActionNoneConst = "none" - VPNGatewayConnectionDpdActionRestartConst = "restart" -) - -// UnmarshalVPNGatewayConnectionDpd unmarshals an instance of VPNGatewayConnectionDpd from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDpd(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDpd) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionDpdPatch : The Dead Peer Detection settings. -type VPNGatewayConnectionDpdPatch struct { - // Dead Peer Detection actions. - Action *string `json:"action,omitempty"` - - // Dead Peer Detection interval in seconds. - Interval *int64 `json:"interval,omitempty"` - - // Dead Peer Detection timeout in seconds. Must be at least the interval. - Timeout *int64 `json:"timeout,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionDpdPatch.Action property. -// Dead Peer Detection actions. -const ( - VPNGatewayConnectionDpdPatchActionClearConst = "clear" - VPNGatewayConnectionDpdPatchActionHoldConst = "hold" - VPNGatewayConnectionDpdPatchActionNoneConst = "none" - VPNGatewayConnectionDpdPatchActionRestartConst = "restart" -) - -// UnmarshalVPNGatewayConnectionDpdPatch unmarshals an instance of VPNGatewayConnectionDpdPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDpdPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDpdPatch) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionDpdPrototype : The Dead Peer Detection settings. -type VPNGatewayConnectionDpdPrototype struct { - // Dead Peer Detection actions. - Action *string `json:"action,omitempty"` - - // Dead Peer Detection interval in seconds. - Interval *int64 `json:"interval,omitempty"` - - // Dead Peer Detection timeout in seconds. Must be at least the interval. - Timeout *int64 `json:"timeout,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionDpdPrototype.Action property. -// Dead Peer Detection actions. -const ( - VPNGatewayConnectionDpdPrototypeActionClearConst = "clear" - VPNGatewayConnectionDpdPrototypeActionHoldConst = "hold" - VPNGatewayConnectionDpdPrototypeActionNoneConst = "none" - VPNGatewayConnectionDpdPrototypeActionRestartConst = "restart" -) - -// UnmarshalVPNGatewayConnectionDpdPrototype unmarshals an instance of VPNGatewayConnectionDpdPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDpdPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionIkePolicyPatch : The IKE policy to use. Specify `null` to remove any existing policy, [resulting in -// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). -// Models which "extend" this model: -// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID -// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref -type VPNGatewayConnectionIkePolicyPatch struct { - // The unique identifier for this IKE policy. - ID *string `json:"id,omitempty"` - - // The IKE policy's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*VPNGatewayConnectionIkePolicyPatch) isaVPNGatewayConnectionIkePolicyPatch() bool { - return true -} - -type VPNGatewayConnectionIkePolicyPatchIntf interface { - isaVPNGatewayConnectionIkePolicyPatch() bool -} - -// UnmarshalVPNGatewayConnectionIkePolicyPatch unmarshals an instance of VPNGatewayConnectionIkePolicyPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionIkePolicyPrototype : The IKE policy to use. If unspecified, [auto-negotiation will be -// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). -// Models which "extend" this model: -// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID -// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref -type VPNGatewayConnectionIkePolicyPrototype struct { - // The unique identifier for this IKE policy. - ID *string `json:"id,omitempty"` - - // The IKE policy's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*VPNGatewayConnectionIkePolicyPrototype) isaVPNGatewayConnectionIkePolicyPrototype() bool { - return true -} - -type VPNGatewayConnectionIkePolicyPrototypeIntf interface { - isaVPNGatewayConnectionIkePolicyPrototype() bool -} - -// UnmarshalVPNGatewayConnectionIkePolicyPrototype unmarshals an instance of VPNGatewayConnectionIkePolicyPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionIPsecPolicyPatch : The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in -// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). -// Models which "extend" this model: -// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID -// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref -type VPNGatewayConnectionIPsecPolicyPatch struct { - // The unique identifier for this IPsec policy. - ID *string `json:"id,omitempty"` - - // The IPsec policy's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*VPNGatewayConnectionIPsecPolicyPatch) isaVPNGatewayConnectionIPsecPolicyPatch() bool { - return true -} - -type VPNGatewayConnectionIPsecPolicyPatchIntf interface { - isaVPNGatewayConnectionIPsecPolicyPatch() bool -} - -// UnmarshalVPNGatewayConnectionIPsecPolicyPatch unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionIPsecPolicyPrototype : The IPsec policy to use. If unspecified, [auto-negotiation will be -// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). -// Models which "extend" this model: -// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID -// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref -type VPNGatewayConnectionIPsecPolicyPrototype struct { - // The unique identifier for this IPsec policy. - ID *string `json:"id,omitempty"` - - // The IPsec policy's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*VPNGatewayConnectionIPsecPolicyPrototype) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { - return true -} - -type VPNGatewayConnectionIPsecPolicyPrototypeIntf interface { - isaVPNGatewayConnectionIPsecPolicyPrototype() bool -} - -// UnmarshalVPNGatewayConnectionIPsecPolicyPrototype unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionLocalCIDRs : VPNGatewayConnectionLocalCIDRs struct -type VPNGatewayConnectionLocalCIDRs struct { - // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs,omitempty"` -} - -// UnmarshalVPNGatewayConnectionLocalCIDRs unmarshals an instance of VPNGatewayConnectionLocalCIDRs from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionLocalCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionLocalCIDRs) - err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPatch : VPNGatewayConnectionPatch struct -// Models which "extend" this model: -// - VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch -type VPNGatewayConnectionPatch struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up,omitempty"` - - // The Dead Peer Detection settings. - DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"` - - // The IKE policy to use. Specify `null` to remove any existing policy, [resulting in - // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy VPNGatewayConnectionIkePolicyPatchIntf `json:"ike_policy,omitempty"` - - // The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in - // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"` - - // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. - Name *string `json:"name,omitempty"` - - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address,omitempty"` - - // The pre-shared key. - Psk *string `json:"psk,omitempty"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionPatch.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionPatchRoutingProtocolNoneConst = "none" -) - -func (*VPNGatewayConnectionPatch) isaVPNGatewayConnectionPatch() bool { - return true -} - -type VPNGatewayConnectionPatchIntf interface { - isaVPNGatewayConnectionPatch() bool -} - -// UnmarshalVPNGatewayConnectionPatch unmarshals an instance of VPNGatewayConnectionPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPatch) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the VPNGatewayConnectionPatch -func (vpnGatewayConnectionPatch *VPNGatewayConnectionPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpnGatewayConnectionPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// VPNGatewayConnectionPeerCIDRs : VPNGatewayConnectionPeerCIDRs struct -type VPNGatewayConnectionPeerCIDRs struct { - // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs,omitempty"` -} - -// UnmarshalVPNGatewayConnectionPeerCIDRs unmarshals an instance of VPNGatewayConnectionPeerCIDRs from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPeerCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPeerCIDRs) - err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPrototype : VPNGatewayConnectionPrototype struct -// Models which "extend" this model: -// - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype -// - VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype -type VPNGatewayConnectionPrototype struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up,omitempty"` - - // The Dead Peer Detection settings. - DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` - - // The IKE policy to use. If unspecified, [auto-negotiation will be - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` - - // The IPsec policy to use. If unspecified, [auto-negotiation will be - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` - - // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` - - // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs,omitempty"` - - // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionPrototype.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionPrototypeRoutingProtocolNoneConst = "none" -) - -func (*VPNGatewayConnectionPrototype) isaVPNGatewayConnectionPrototype() bool { - return true -} - -type VPNGatewayConnectionPrototypeIntf interface { - isaVPNGatewayConnectionPrototype() bool -} - -// UnmarshalVPNGatewayConnectionPrototype unmarshals an instance of VPNGatewayConnectionPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPrototype) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionReference : VPNGatewayConnectionReference struct -type VPNGatewayConnectionReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionReference.ResourceType property. -// The resource type. -const ( - VPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -// UnmarshalVPNGatewayConnectionReference unmarshals an instance of VPNGatewayConnectionReference from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPNGatewayConnectionReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionReferenceDeleted unmarshals an instance of VPNGatewayConnectionReferenceDeleted from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionStaticRouteModeTunnel : VPNGatewayConnectionStaticRouteModeTunnel struct -type VPNGatewayConnectionStaticRouteModeTunnel struct { - // The IP address of the VPN gateway member in which the tunnel resides. - PublicIP *IP `json:"public_ip" validate:"required"` - - // The status of the VPN Tunnel. - Status *string `json:"status" validate:"required"` - - // The reasons for the current VPN gateway connection tunnels status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []VPNGatewayConnectionTunnelStatusReason `json:"status_reasons" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionStaticRouteModeTunnel.Status property. -// The status of the VPN Tunnel. -const ( - VPNGatewayConnectionStaticRouteModeTunnelStatusDownConst = "down" - VPNGatewayConnectionStaticRouteModeTunnelStatusUpConst = "up" -) - -// UnmarshalVPNGatewayConnectionStaticRouteModeTunnel unmarshals an instance of VPNGatewayConnectionStaticRouteModeTunnel from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteModeTunnel) - err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionTunnelStatusReason) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionStatusReason : VPNGatewayConnectionStatusReason struct -type VPNGatewayConnectionStatusReason struct { - // A snake case string succinctly identifying the status reason. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this VPN gateway connection's status. - Message *string `json:"message" validate:"required"` - - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -const ( - VPNGatewayConnectionStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection" - VPNGatewayConnectionStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch" - VPNGatewayConnectionStatusReasonCodeIkeV1IDLocalRemoteCIDRMismatchConst = "ike_v1_id_local_remote_cidr_mismatch" - VPNGatewayConnectionStatusReasonCodeIkeV2LocalRemoteCIDRMismatchConst = "ike_v2_local_remote_cidr_mismatch" - VPNGatewayConnectionStatusReasonCodeInternalErrorConst = "internal_error" - VPNGatewayConnectionStatusReasonCodeIpsecPolicyMismatchConst = "ipsec_policy_mismatch" - VPNGatewayConnectionStatusReasonCodePeerNotRespondingConst = "peer_not_responding" -) - -// UnmarshalVPNGatewayConnectionStatusReason unmarshals an instance of VPNGatewayConnectionStatusReason from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStatusReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionTunnelStatusReason : VPNGatewayConnectionTunnelStatusReason struct -type VPNGatewayConnectionTunnelStatusReason struct { - // A snake case string succinctly identifying the status reason. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this VPN gateway connection tunnel's status. - Message *string `json:"message" validate:"required"` - - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionTunnelStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -const ( - VPNGatewayConnectionTunnelStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection" - VPNGatewayConnectionTunnelStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch" - VPNGatewayConnectionTunnelStatusReasonCodeIkeV1IDLocalRemoteCIDRMismatchConst = "ike_v1_id_local_remote_cidr_mismatch" - VPNGatewayConnectionTunnelStatusReasonCodeIkeV2LocalRemoteCIDRMismatchConst = "ike_v2_local_remote_cidr_mismatch" - VPNGatewayConnectionTunnelStatusReasonCodeInternalErrorConst = "internal_error" - VPNGatewayConnectionTunnelStatusReasonCodeIpsecPolicyMismatchConst = "ipsec_policy_mismatch" - VPNGatewayConnectionTunnelStatusReasonCodePeerNotRespondingConst = "peer_not_responding" -) - -// UnmarshalVPNGatewayConnectionTunnelStatusReason unmarshals an instance of VPNGatewayConnectionTunnelStatusReason from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionTunnelStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionTunnelStatusReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayHealthReason : VPNGatewayHealthReason struct -type VPNGatewayHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this health state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNGatewayHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. -const ( - VPNGatewayHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" - VPNGatewayHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" - VPNGatewayHealthReasonCodeInternalErrorConst = "internal_error" -) - -// UnmarshalVPNGatewayHealthReason unmarshals an instance of VPNGatewayHealthReason from the specified map of raw messages. -func UnmarshalVPNGatewayHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayHealthReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayLifecycleReason : VPNGatewayLifecycleReason struct -type VPNGatewayLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this lifecycle state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this lifecycle state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNGatewayLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. -const ( - VPNGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalVPNGatewayLifecycleReason unmarshals an instance of VPNGatewayLifecycleReason from the specified map of raw messages. -func UnmarshalVPNGatewayLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayLifecycleReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayMember : VPNGatewayMember struct -type VPNGatewayMember struct { - // The reasons for the current VPN gateway member health_state (if any): - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - HealthReasons []VPNGatewayMemberHealthReason `json:"health_reasons" validate:"required"` - - // The health of this resource. - // - `ok`: No abnormal behavior detected - // - `degraded`: Experiencing compromised performance, capacity, or connectivity - // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated - // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a - // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also - // have this state. - HealthState *string `json:"health_state" validate:"required"` - - // The reasons for the current VPN gateway member lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - LifecycleReasons []VPNGatewayMemberLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN gateway member. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The reserved IP address assigned to the VPN gateway member. - // - // This property will be present only when the VPN gateway status is `available`. - PrivateIP *ReservedIPReference `json:"private_ip" validate:"required"` - - // The public IP address assigned to the VPN gateway member. - PublicIP *IP `json:"public_ip" validate:"required"` - - // The high availability role assigned to the VPN gateway member. - Role *string `json:"role" validate:"required"` -} - -// Constants associated with the VPNGatewayMember.HealthState property. -// The health of this resource. -// - `ok`: No abnormal behavior detected -// - `degraded`: Experiencing compromised performance, capacity, or connectivity -// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated -// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle -// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this -// state. -const ( - VPNGatewayMemberHealthStateDegradedConst = "degraded" - VPNGatewayMemberHealthStateFaultedConst = "faulted" - VPNGatewayMemberHealthStateInapplicableConst = "inapplicable" - VPNGatewayMemberHealthStateOkConst = "ok" -) - -// Constants associated with the VPNGatewayMember.LifecycleState property. -// The lifecycle state of the VPN gateway member. -const ( - VPNGatewayMemberLifecycleStateDeletingConst = "deleting" - VPNGatewayMemberLifecycleStateFailedConst = "failed" - VPNGatewayMemberLifecycleStatePendingConst = "pending" - VPNGatewayMemberLifecycleStateStableConst = "stable" - VPNGatewayMemberLifecycleStateSuspendedConst = "suspended" - VPNGatewayMemberLifecycleStateUpdatingConst = "updating" - VPNGatewayMemberLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNGatewayMember.Role property. -// The high availability role assigned to the VPN gateway member. -const ( - VPNGatewayMemberRoleActiveConst = "active" - VPNGatewayMemberRoleStandbyConst = "standby" -) - -// UnmarshalVPNGatewayMember unmarshals an instance of VPNGatewayMember from the specified map of raw messages. -func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayMember) - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayMemberHealthReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) - if err != nil { - return - } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayMemberLifecycleReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "role", &obj.Role) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayMemberHealthReason : VPNGatewayMemberHealthReason struct -type VPNGatewayMemberHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this health state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNGatewayMemberHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. -const ( - VPNGatewayMemberHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" - VPNGatewayMemberHealthReasonCodeInternalErrorConst = "internal_error" -) - -// UnmarshalVPNGatewayMemberHealthReason unmarshals an instance of VPNGatewayMemberHealthReason from the specified map of raw messages. -func UnmarshalVPNGatewayMemberHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayMemberHealthReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayMemberLifecycleReason : VPNGatewayMemberLifecycleReason struct -type VPNGatewayMemberLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this lifecycle state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this lifecycle state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNGatewayMemberLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. -const ( - VPNGatewayMemberLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalVPNGatewayMemberLifecycleReason unmarshals an instance of VPNGatewayMemberLifecycleReason from the specified map of raw messages. -func UnmarshalVPNGatewayMemberLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayMemberLifecycleReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayPatch : VPNGatewayPatch struct -type VPNGatewayPatch struct { - // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVPNGatewayPatch unmarshals an instance of VPNGatewayPatch from the specified map of raw messages. -func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the VPNGatewayPatch -func (vpnGatewayPatch *VPNGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpnGatewayPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// VPNGatewayPrototype : VPNGatewayPrototype struct -// Models which "extend" this model: -// - VPNGatewayPrototypeVPNGatewayRouteModePrototype -// - VPNGatewayPrototypeVPNGatewayPolicyModePrototype -type VPNGatewayPrototype struct { - // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // Identifies a subnet by a unique property. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // Route mode VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGatewayPrototype.Mode property. -// Route mode VPN gateway. -const ( - VPNGatewayPrototypeModeRouteConst = "route" -) - -func (*VPNGatewayPrototype) isaVPNGatewayPrototype() bool { - return true -} - -type VPNGatewayPrototypeIntf interface { - isaVPNGatewayPrototype() bool -} - -// UnmarshalVPNGatewayPrototype unmarshals an instance of VPNGatewayPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPNGatewayReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPNGatewayReferenceDeleted unmarshals an instance of VPNGatewayReferenceDeleted from the specified map of raw messages. -func UnmarshalVPNGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServer : VPNServer struct -type VPNServer struct { - // The certificate instance for this VPN server. - Certificate *CertificateInstanceReference `json:"certificate" validate:"required"` - - // The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all specified - // methods. - ClientAuthentication []VPNServerAuthenticationIntf `json:"client_authentication" validate:"required"` - - // Indicates whether disconnected VPN clients will be automatically deleted after - // `client_auto_delete_timeout` hours have passed. At present, this is always `true`, but may be modifiable in the - // future. - ClientAutoDelete *bool `json:"client_auto_delete" validate:"required"` - - // If `client_auto_delete` is `true`, the hours after which disconnected VPN clients will be automatically deleted. If - // the value is `0`, disconnected VPN clients will be deleted immediately. This value may be modifiable in the future. - ClientAutoDeleteTimeout *int64 `json:"client_auto_delete_timeout" validate:"required"` - - // The DNS server addresses that will be provided to VPN clients that are connected to this VPN server. - ClientDnsServerIps []IP `json:"client_dns_server_ips" validate:"required"` - - // The seconds a VPN client can be idle before this VPN server will disconnect it. If `0`, the server will not - // disconnect idle clients. - ClientIdleTimeout *int64 `json:"client_idle_timeout" validate:"required"` - - // The VPN client IPv4 address pool, expressed in CIDR format. - ClientIPPool *string `json:"client_ip_pool" validate:"required"` - - // The date and time that the VPN server was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this VPN server. - CRN *string `json:"crn" validate:"required"` - - // Indicates whether the split tunneling is enabled on this VPN server. - EnableSplitTunneling *bool `json:"enable_split_tunneling" validate:"required"` - - // The reasons for the current VPN server health_state (if any): - // - `cannot_access_client_certificate`: VPN server's client certificate is inaccessible - // (verify certificate exists and that IAM policies grant `VPN server for VPC` access to - // `Secrets Manager`) - // - `cannot_access_server_certificate`: VPN server's server certificate is inaccessible - // (verify certificate exists and that IAM policies grant `VPN server for VPC` access to - // `Secrets Manager`) - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - HealthReasons []VPNServerHealthReason `json:"health_reasons" validate:"required"` - - // The health of this resource. - // - `ok`: No abnormal behavior detected - // - `degraded`: Experiencing compromised performance, capacity, or connectivity - // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated - // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a - // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also - // have this state. - HealthState *string `json:"health_state" validate:"required"` - - // Fully qualified domain name assigned to this VPN server. - Hostname *string `json:"hostname" validate:"required"` - - // The URL for this VPN server. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN server. - ID *string `json:"id" validate:"required"` - - // The reasons for the current VPN server lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - LifecycleReasons []VPNServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN server. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this VPN server. The name is unique across all VPN servers in the VPC. - Name *string `json:"name" validate:"required"` - - // The port number used by this VPN server. - Port *int64 `json:"port" validate:"required"` - - // The reserved IPs bound to this VPN server. - PrivateIps []ReservedIPReference `json:"private_ips" validate:"required"` - - // The transport protocol used by this VPN server. - Protocol *string `json:"protocol" validate:"required"` - - // The resource group for this VPN server. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The security groups targeting this VPN server. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The subnets this VPN server is provisioned in. - Subnets []SubnetReference `json:"subnets" validate:"required"` - - // The VPC this VPN server resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// Constants associated with the VPNServer.HealthState property. -// The health of this resource. -// - `ok`: No abnormal behavior detected -// - `degraded`: Experiencing compromised performance, capacity, or connectivity -// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated -// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle -// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this -// state. -const ( - VPNServerHealthStateDegradedConst = "degraded" - VPNServerHealthStateFaultedConst = "faulted" - VPNServerHealthStateInapplicableConst = "inapplicable" - VPNServerHealthStateOkConst = "ok" -) - -// Constants associated with the VPNServer.LifecycleState property. -// The lifecycle state of the VPN server. -const ( - VPNServerLifecycleStateDeletingConst = "deleting" - VPNServerLifecycleStateFailedConst = "failed" - VPNServerLifecycleStatePendingConst = "pending" - VPNServerLifecycleStateStableConst = "stable" - VPNServerLifecycleStateSuspendedConst = "suspended" - VPNServerLifecycleStateUpdatingConst = "updating" - VPNServerLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNServer.Protocol property. -// The transport protocol used by this VPN server. -const ( - VPNServerProtocolTCPConst = "tcp" - VPNServerProtocolUDPConst = "udp" -) - -// Constants associated with the VPNServer.ResourceType property. -// The resource type. -const ( - VPNServerResourceTypeVPNServerConst = "vpn_server" -) - -// UnmarshalVPNServer unmarshals an instance of VPNServer from the specified map of raw messages. -func UnmarshalVPNServer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServer) - err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthentication) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "client_auto_delete", &obj.ClientAutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "client_auto_delete_timeout", &obj.ClientAutoDeleteTimeout) - if err != nil { - return - } - err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) - if err != nil { - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNServerHealthReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNServerLifecycleReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - return - } - err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthentication : An authentication method for this VPN server. -// Models which "extend" this model: -// - VPNServerAuthenticationByUsername -// - VPNServerAuthenticationByCertificate -type VPNServerAuthentication struct { - // The type of authentication. - Method *string `json:"method" validate:"required"` - - // The type of identity provider to be used by VPN client. - IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider,omitempty"` - - // The certificate instance used for the VPN client certificate authority (CA). - ClientCa *CertificateInstanceReference `json:"client_ca,omitempty"` - - // The certificate revocation list contents, encoded in PEM format. - Crl *string `json:"crl,omitempty"` -} - -// Constants associated with the VPNServerAuthentication.Method property. -// The type of authentication. -const ( - VPNServerAuthenticationMethodCertificateConst = "certificate" - VPNServerAuthenticationMethodUsernameConst = "username" -) - -func (*VPNServerAuthentication) isaVPNServerAuthentication() bool { - return true -} - -type VPNServerAuthenticationIntf interface { - isaVPNServerAuthentication() bool -} - -// UnmarshalVPNServerAuthentication unmarshals an instance of VPNServerAuthentication from the specified map of raw messages. -func UnmarshalVPNServerAuthentication(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthentication) - err = core.UnmarshalPrimitive(m, "method", &obj.Method) - if err != nil { - return - } - err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) - if err != nil { - return - } - err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationByUsernameIDProvider : The type of identity provider to be used by VPN client. -// Models which "extend" this model: -// - VPNServerAuthenticationByUsernameIDProviderByIam -type VPNServerAuthenticationByUsernameIDProvider struct { - // The type of identity provider to be used by the VPN client. - // - `iam`: IBM identity and access management - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. - ProviderType *string `json:"provider_type,omitempty"` -} - -// Constants associated with the VPNServerAuthenticationByUsernameIDProvider.ProviderType property. -// The type of identity provider to be used by the VPN client. -// - `iam`: IBM identity and access management -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. -const ( - VPNServerAuthenticationByUsernameIDProviderProviderTypeIamConst = "iam" -) - -func (*VPNServerAuthenticationByUsernameIDProvider) isaVPNServerAuthenticationByUsernameIDProvider() bool { - return true -} - -type VPNServerAuthenticationByUsernameIDProviderIntf interface { - isaVPNServerAuthenticationByUsernameIDProvider() bool -} - -// UnmarshalVPNServerAuthenticationByUsernameIDProvider unmarshals an instance of VPNServerAuthenticationByUsernameIDProvider from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationByUsernameIDProvider(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthenticationByUsernameIDProvider) - err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationPrototype : An authentication method for this VPN server. -// Models which "extend" this model: -// - VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype -// - VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype -type VPNServerAuthenticationPrototype struct { - // The type of authentication. - Method *string `json:"method" validate:"required"` - - // The type of identity provider to be used by VPN client. - IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider,omitempty"` - - // The certificate instance to use for the VPN client certificate authority (CA). - ClientCa CertificateInstanceIdentityIntf `json:"client_ca,omitempty"` - - // The certificate revocation list contents, encoded in PEM format. - Crl *string `json:"crl,omitempty"` -} - -// Constants associated with the VPNServerAuthenticationPrototype.Method property. -// The type of authentication. -const ( - VPNServerAuthenticationPrototypeMethodCertificateConst = "certificate" - VPNServerAuthenticationPrototypeMethodUsernameConst = "username" -) - -func (*VPNServerAuthenticationPrototype) isaVPNServerAuthenticationPrototype() bool { - return true -} - -type VPNServerAuthenticationPrototypeIntf interface { - isaVPNServerAuthenticationPrototype() bool -} - -// UnmarshalVPNServerAuthenticationPrototype unmarshals an instance of VPNServerAuthenticationPrototype from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "method", &discValue) - if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'method': %s", err.Error()) - return - } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'method' not found in JSON object") - return - } - if discValue == "certificate" { - err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) - } else if discValue == "username" { - err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'method': %s", discValue) - } - return -} - -// VPNServerClient : VPNServerClient struct -type VPNServerClient struct { - // The IP address assigned to this VPN client from `client_ip_pool`. - ClientIP *IP `json:"client_ip" validate:"required"` - - // The common name of client certificate that the VPN client provided when connecting to the server. - // - // This property will be present only when the `certificate` client authentication method is enabled on the VPN server. - CommonName *string `json:"common_name,omitempty"` - - // The date and time that the VPN client was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The date and time that the VPN client was disconnected. - // - // This property will be present only when the client `status` is `disconnected`. - DisconnectedAt *strfmt.DateTime `json:"disconnected_at,omitempty"` - - // The URL for this VPN client. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN client. - ID *string `json:"id" validate:"required"` - - // The remote IP address of this VPN client. - RemoteIP *IP `json:"remote_ip" validate:"required"` - - // The remote port of this VPN client. - RemotePort *int64 `json:"remote_port" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the VPN client: - // - `connected`: the VPN client is `connected` to this VPN server. - // - `disconnected`: the VPN client is `disconnected` from this VPN server. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the - // unexpected property value was encountered. - Status *string `json:"status" validate:"required"` - - // The username that this VPN client provided when connecting to the VPN server. - // - // This property will be present only when the `username` client authentication method is enabled on the VPN server. - Username *string `json:"username,omitempty"` -} - -// Constants associated with the VPNServerClient.ResourceType property. -// The resource type. -const ( - VPNServerClientResourceTypeVPNServerClientConst = "vpn_server_client" -) - -// Constants associated with the VPNServerClient.Status property. -// The status of the VPN client: -// - `connected`: the VPN client is `connected` to this VPN server. -// - `disconnected`: the VPN client is `disconnected` from this VPN server. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the -// unexpected property value was encountered. -const ( - VPNServerClientStatusConnectedConst = "connected" - VPNServerClientStatusDisconnectedConst = "disconnected" -) - -// UnmarshalVPNServerClient unmarshals an instance of VPNServerClient from the specified map of raw messages. -func UnmarshalVPNServerClient(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerClient) - err = core.UnmarshalModel(m, "client_ip", &obj.ClientIP, UnmarshalIP) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "common_name", &obj.CommonName) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "disconnected_at", &obj.DisconnectedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote_ip", &obj.RemoteIP, UnmarshalIP) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "remote_port", &obj.RemotePort) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "username", &obj.Username) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerClientCollection : VPNServerClientCollection struct -type VPNServerClientCollection struct { - // Collection of VPN clients. - Clients []VPNServerClient `json:"clients" validate:"required"` - - // A link to the first page of resources. - First *VPNServerClientCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *VPNServerClientCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalVPNServerClientCollection unmarshals an instance of VPNServerClientCollection from the specified map of raw messages. -func UnmarshalVPNServerClientCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerClientCollection) - err = core.UnmarshalModel(m, "clients", &obj.Clients, UnmarshalVPNServerClient) - if err != nil { - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerClientCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerClientCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *VPNServerClientCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// VPNServerClientCollectionFirst : A link to the first page of resources. -type VPNServerClientCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNServerClientCollectionFirst unmarshals an instance of VPNServerClientCollectionFirst from the specified map of raw messages. -func UnmarshalVPNServerClientCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerClientCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerClientCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPNServerClientCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNServerClientCollectionNext unmarshals an instance of VPNServerClientCollectionNext from the specified map of raw messages. -func UnmarshalVPNServerClientCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerClientCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerCollection : VPNServerCollection struct -type VPNServerCollection struct { - // A link to the first page of resources. - First *VPNServerCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *VPNServerCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` - - // Collection of VPN servers. - VPNServers []VPNServer `json:"vpn_servers" validate:"required"` -} - -// UnmarshalVPNServerCollection unmarshals an instance of VPNServerCollection from the specified map of raw messages. -func UnmarshalVPNServerCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpn_servers", &obj.VPNServers, UnmarshalVPNServer) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *VPNServerCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// VPNServerCollectionFirst : A link to the first page of resources. -type VPNServerCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNServerCollectionFirst unmarshals an instance of VPNServerCollectionFirst from the specified map of raw messages. -func UnmarshalVPNServerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPNServerCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNServerCollectionNext unmarshals an instance of VPNServerCollectionNext from the specified map of raw messages. -func UnmarshalVPNServerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerHealthReason : VPNServerHealthReason struct -type VPNServerHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this health state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNServerHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. -const ( - VPNServerHealthReasonCodeCannotAccessClientCertificateConst = "cannot_access_client_certificate" - VPNServerHealthReasonCodeCannotAccessServerCertificateConst = "cannot_access_server_certificate" - VPNServerHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" - VPNServerHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" - VPNServerHealthReasonCodeInternalErrorConst = "internal_error" -) - -// UnmarshalVPNServerHealthReason unmarshals an instance of VPNServerHealthReason from the specified map of raw messages. -func UnmarshalVPNServerHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerHealthReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerLifecycleReason : VPNServerLifecycleReason struct -type VPNServerLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this lifecycle state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this lifecycle state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNServerLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. -const ( - VPNServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalVPNServerLifecycleReason unmarshals an instance of VPNServerLifecycleReason from the specified map of raw messages. -func UnmarshalVPNServerLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerLifecycleReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerPatch : VPNServerPatch struct -type VPNServerPatch struct { - // The certificate instance for this VPN server. - Certificate CertificateInstanceIdentityIntf `json:"certificate,omitempty"` - - // The authentication methods to use to authenticate VPN client on this VPN server - // (replacing any existing methods). - ClientAuthentication []VPNServerAuthenticationPrototypeIntf `json:"client_authentication,omitempty"` - - // The DNS server addresses that will be provided to VPN clients connected to this VPN server (replacing any existing - // addresses). - ClientDnsServerIps []IP `json:"client_dns_server_ips,omitempty"` - - // The seconds a VPN client can be idle before this VPN server will disconnect it. If `0`, the server will not - // disconnect idle clients. - ClientIdleTimeout *int64 `json:"client_idle_timeout,omitempty"` - - // The VPN client IPv4 address pool, expressed in CIDR format. The request must not overlap with any existing address - // prefixes in the VPC or any of the following reserved address ranges: - // - `127.0.0.0/8` (IPv4 loopback addresses) - // - `161.26.0.0/16` (IBM services) - // - `166.8.0.0/14` (Cloud Service Endpoints) - // - `169.254.0.0/16` (IPv4 link-local addresses) - // - `224.0.0.0/4` (IPv4 multicast addresses) - // - // The prefix length of the client IP address pool's CIDR must be between - // `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that contains twice the number of IP addresses - // that are required to enable the maximum number of concurrent connections is recommended. - ClientIPPool *string `json:"client_ip_pool,omitempty"` - - // Indicates whether the split tunneling is enabled on this VPN server. - EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` - - // The name for this VPN server. The name must not be used by another VPN server in the VPC. - Name *string `json:"name,omitempty"` - - // The port number used by this VPN server. - Port *int64 `json:"port,omitempty"` - - // The transport protocol used by this VPN server. - Protocol *string `json:"protocol,omitempty"` - - // The subnets to provision this VPN server in (replacing the existing subnets). - Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` -} - -// Constants associated with the VPNServerPatch.Protocol property. -// The transport protocol used by this VPN server. -const ( - VPNServerPatchProtocolTCPConst = "tcp" - VPNServerPatchProtocolUDPConst = "udp" -) - -// UnmarshalVPNServerPatch unmarshals an instance of VPNServerPatch from the specified map of raw messages. -func UnmarshalVPNServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerPatch) - err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthenticationPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the VPNServerPatch -func (vpnServerPatch *VPNServerPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpnServerPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// VPNServerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPNServerReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPNServerReferenceDeleted unmarshals an instance of VPNServerReferenceDeleted from the specified map of raw messages. -func UnmarshalVPNServerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerRoute : VPNServerRoute struct -type VPNServerRoute struct { - // The action to perform with a packet matching the VPN route: - // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. - // - `deliver`: deliver the packet into the VPC. - // - `drop`: drop the packet - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the - // unexpected property value was encountered. - Action *string `json:"action" validate:"required"` - - // The date and time that the VPN route was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination for this VPN route in the VPN server. If an incoming packet does not match any destination, it will - // be dropped. - Destination *string `json:"destination" validate:"required"` - - // The reasons for the current VPN server route health_state (if any): - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - HealthReasons []VPNServerRouteHealthReason `json:"health_reasons" validate:"required"` - - // The health of this resource. - // - `ok`: No abnormal behavior detected - // - `degraded`: Experiencing compromised performance, capacity, or connectivity - // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated - // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a - // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also - // have this state. - HealthState *string `json:"health_state" validate:"required"` - - // The URL for this VPN route. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN route. - ID *string `json:"id" validate:"required"` - - // The reasons for the current VPN server route lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - LifecycleReasons []VPNServerRouteLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN route. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this VPN route. The name is unique across all routes for a VPN server. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VPNServerRoute.Action property. -// The action to perform with a packet matching the VPN route: -// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. -// - `deliver`: deliver the packet into the VPC. -// - `drop`: drop the packet -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the -// unexpected property value was encountered. -const ( - VPNServerRouteActionDeliverConst = "deliver" - VPNServerRouteActionDropConst = "drop" - VPNServerRouteActionTranslateConst = "translate" -) - -// Constants associated with the VPNServerRoute.HealthState property. -// The health of this resource. -// - `ok`: No abnormal behavior detected -// - `degraded`: Experiencing compromised performance, capacity, or connectivity -// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated -// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle -// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this -// state. -const ( - VPNServerRouteHealthStateDegradedConst = "degraded" - VPNServerRouteHealthStateFaultedConst = "faulted" - VPNServerRouteHealthStateInapplicableConst = "inapplicable" - VPNServerRouteHealthStateOkConst = "ok" -) - -// Constants associated with the VPNServerRoute.LifecycleState property. -// The lifecycle state of the VPN route. -const ( - VPNServerRouteLifecycleStateDeletingConst = "deleting" - VPNServerRouteLifecycleStateFailedConst = "failed" - VPNServerRouteLifecycleStatePendingConst = "pending" - VPNServerRouteLifecycleStateStableConst = "stable" - VPNServerRouteLifecycleStateSuspendedConst = "suspended" - VPNServerRouteLifecycleStateUpdatingConst = "updating" - VPNServerRouteLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNServerRoute.ResourceType property. -// The resource type. -const ( - VPNServerRouteResourceTypeVPNServerRouteConst = "vpn_server_route" -) - -// UnmarshalVPNServerRoute unmarshals an instance of VPNServerRoute from the specified map of raw messages. -func UnmarshalVPNServerRoute(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerRoute) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNServerRouteHealthReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNServerRouteLifecycleReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerRouteCollection : VPNServerRouteCollection struct -type VPNServerRouteCollection struct { - // A link to the first page of resources. - First *VPNServerRouteCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *VPNServerRouteCollectionNext `json:"next,omitempty"` - - // Collection of VPN routes. - Routes []VPNServerRoute `json:"routes" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalVPNServerRouteCollection unmarshals an instance of VPNServerRouteCollection from the specified map of raw messages. -func UnmarshalVPNServerRouteCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerRouteCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerRouteCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerRouteCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalVPNServerRoute) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *VPNServerRouteCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// VPNServerRouteCollectionFirst : A link to the first page of resources. -type VPNServerRouteCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNServerRouteCollectionFirst unmarshals an instance of VPNServerRouteCollectionFirst from the specified map of raw messages. -func UnmarshalVPNServerRouteCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerRouteCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerRouteCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPNServerRouteCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNServerRouteCollectionNext unmarshals an instance of VPNServerRouteCollectionNext from the specified map of raw messages. -func UnmarshalVPNServerRouteCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerRouteCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerRouteHealthReason : VPNServerRouteHealthReason struct -type VPNServerRouteHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this health state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNServerRouteHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. -const ( - VPNServerRouteHealthReasonCodeInternalErrorConst = "internal_error" -) - -// UnmarshalVPNServerRouteHealthReason unmarshals an instance of VPNServerRouteHealthReason from the specified map of raw messages. -func UnmarshalVPNServerRouteHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerRouteHealthReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerRouteLifecycleReason : VPNServerRouteLifecycleReason struct -type VPNServerRouteLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this lifecycle state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this lifecycle state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNServerRouteLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. -const ( - VPNServerRouteLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalVPNServerRouteLifecycleReason unmarshals an instance of VPNServerRouteLifecycleReason from the specified map of raw messages. -func UnmarshalVPNServerRouteLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerRouteLifecycleReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerRoutePatch : VPNServerRoutePatch struct -type VPNServerRoutePatch struct { - // The name for this VPN server route. The name must not be used by another route for the VPN server. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVPNServerRoutePatch unmarshals an instance of VPNServerRoutePatch from the specified map of raw messages. -func UnmarshalVPNServerRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerRoutePatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the VPNServerRoutePatch -func (vpnServerRoutePatch *VPNServerRoutePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpnServerRoutePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// VirtualNetworkInterface : VirtualNetworkInterface struct -type VirtualNetworkInterface struct { - // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on - // this interface. If `true`, source IP spoofing is allowed on this interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // The date and time that the virtual network interface was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the virtual network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - If the virtual network interface is attached, the target `resource_type` must be - // `bare_metal_server_network_attachment`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` - - // The reserved IPs bound to this virtual network interface. - // - // May be empty when `lifecycle_state` is `pending`. - Ips []ReservedIPReference `json:"ips" validate:"required"` - - // The lifecycle state of the virtual network interface. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The MAC address of the virtual network interface. May be absent if `lifecycle_state` is `pending`. - MacAddress *string `json:"mac_address,omitempty"` - - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - Name *string `json:"name" validate:"required"` - - // The reserved IP for this virtual network interface. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource group for this virtual network interface. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The security groups for this virtual network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The target of this virtual network interface. - // - // If absent, this virtual network interface is not attached to a target. - Target VirtualNetworkInterfaceTargetIntf `json:"target,omitempty"` - - // The VPC this virtual network interface resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // The zone this virtual network interface resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the VirtualNetworkInterface.LifecycleState property. -// The lifecycle state of the virtual network interface. -const ( - VirtualNetworkInterfaceLifecycleStateDeletingConst = "deleting" - VirtualNetworkInterfaceLifecycleStateFailedConst = "failed" - VirtualNetworkInterfaceLifecycleStatePendingConst = "pending" - VirtualNetworkInterfaceLifecycleStateStableConst = "stable" - VirtualNetworkInterfaceLifecycleStateSuspendedConst = "suspended" - VirtualNetworkInterfaceLifecycleStateUpdatingConst = "updating" - VirtualNetworkInterfaceLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VirtualNetworkInterface.ResourceType property. -// The resource type. -const ( - VirtualNetworkInterfaceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" -) - -// UnmarshalVirtualNetworkInterface unmarshals an instance of VirtualNetworkInterface from the specified map of raw messages. -func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterface) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalVirtualNetworkInterfaceTarget) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceCollection : VirtualNetworkInterfaceCollection struct -type VirtualNetworkInterfaceCollection struct { - // A link to the first page of resources. - First *VirtualNetworkInterfaceCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *VirtualNetworkInterfaceCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` - - // Collection of virtual network interfaces. - VirtualNetworkInterfaces []VirtualNetworkInterface `json:"virtual_network_interfaces" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceCollection unmarshals an instance of VirtualNetworkInterfaceCollection from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVirtualNetworkInterfaceCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVirtualNetworkInterfaceCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interfaces", &obj.VirtualNetworkInterfaces, UnmarshalVirtualNetworkInterface) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *VirtualNetworkInterfaceCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// VirtualNetworkInterfaceCollectionFirst : A link to the first page of resources. -type VirtualNetworkInterfaceCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceCollectionFirst unmarshals an instance of VirtualNetworkInterfaceCollectionFirst from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VirtualNetworkInterfaceCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceCollectionNext unmarshals an instance of VirtualNetworkInterfaceCollectionNext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceIPPrototype : VirtualNetworkInterfaceIPPrototype struct -// Models which "extend" this model: -// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext -// - VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext -type VirtualNetworkInterfaceIPPrototype struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` - - // The IP address to reserve, which must not already be reserved on the subnet. - // - // If unspecified, an available address on the subnet will automatically be selected. - Address *string `json:"address,omitempty"` - - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with - // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated - // list of randomly-selected words. - Name *string `json:"name,omitempty"` -} - -func (*VirtualNetworkInterfaceIPPrototype) isaVirtualNetworkInterfaceIPPrototype() bool { - return true -} - -type VirtualNetworkInterfaceIPPrototypeIntf interface { - isaVirtualNetworkInterfaceIPPrototype() bool -} - -// UnmarshalVirtualNetworkInterfaceIPPrototype unmarshals an instance of VirtualNetworkInterfaceIPPrototype from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePatch : VirtualNetworkInterfacePatch struct -type VirtualNetworkInterfacePatch struct { - // Indicates whether source IP spoofing is allowed on this interface. - // - // Must be `false` if `target` is a file share mount target. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. Must be `false` if the virtual network interface is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the virtual network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - If the virtual network interface is attached, the target `resource_type` must be - // `bare_metal_server_network_attachment`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // region. Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVirtualNetworkInterfacePatch unmarshals an instance of VirtualNetworkInterfacePatch from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePatch) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the VirtualNetworkInterfacePatch -func (virtualNetworkInterfacePatch *VirtualNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(virtualNetworkInterfacePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// VirtualNetworkInterfacePrimaryIPPrototype : VirtualNetworkInterfacePrimaryIPPrototype struct -// Models which "extend" this model: -// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext -// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext -type VirtualNetworkInterfacePrimaryIPPrototype struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` - - // The IP address to reserve, which must not already be reserved on the subnet. - // - // If unspecified, an available address on the subnet will automatically be selected. - Address *string `json:"address,omitempty"` - - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with - // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated - // list of randomly-selected words. - Name *string `json:"name,omitempty"` -} - -func (*VirtualNetworkInterfacePrimaryIPPrototype) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { - return true -} - -type VirtualNetworkInterfacePrimaryIPPrototypeIntf interface { - isaVirtualNetworkInterfacePrimaryIPPrototype() bool -} - -// UnmarshalVirtualNetworkInterfacePrimaryIPPrototype unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototype from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceReferenceAttachmentContext : VirtualNetworkInterfaceReferenceAttachmentContext struct -type VirtualNetworkInterfaceReferenceAttachmentContext struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` - - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` - - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VirtualNetworkInterfaceReferenceAttachmentContext.ResourceType property. -// The resource type. -const ( - VirtualNetworkInterfaceReferenceAttachmentContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" -) - -// UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext unmarshals an instance of VirtualNetworkInterfaceReferenceAttachmentContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceReferenceAttachmentContext) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VirtualNetworkInterfaceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceReferenceDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceDeleted from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceTarget : A virtual network interface target. -// -// The resource types that can be virtual network interface targets are expected to expand in the future. When iterating -// over virtual network interface targets, do not assume that every target resource will be from a known set of resource -// types. Optionally halt processing and surface an error, or bypass resources of unrecognized types. -// Models which "extend" this model: -// - VirtualNetworkInterfaceTargetShareMountTargetReference -// - VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext -// - VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext -type VirtualNetworkInterfaceTarget struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this share mount target. - Href *string `json:"href,omitempty"` - - // The unique identifier for this share mount target. - ID *string `json:"id,omitempty"` - - // The name for this share mount target. The name is unique across all mount targets for the file share. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the VirtualNetworkInterfaceTarget.ResourceType property. -// The resource type. -const ( - VirtualNetworkInterfaceTargetResourceTypeShareMountTargetConst = "share_mount_target" -) - -func (*VirtualNetworkInterfaceTarget) isaVirtualNetworkInterfaceTarget() bool { - return true -} - -type VirtualNetworkInterfaceTargetIntf interface { - isaVirtualNetworkInterfaceTarget() bool -} - -// UnmarshalVirtualNetworkInterfaceTarget unmarshals an instance of VirtualNetworkInterfaceTarget from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Volume : Volume struct -type Volume struct { - // Indicates whether a running virtual server instance has an attachment to this volume. - Active *bool `json:"active" validate:"required"` - - // The attachment state of the volume - // - `unattached`: Not attached to any virtual server instances - // - `attached`: Attached to a virtual server instance (even if the instance is stopped) - // - `unusable`: Not able to be attached to any virtual server instances. - AttachmentState *string `json:"attachment_state" validate:"required"` - - // The maximum bandwidth (in megabits per second) for the volume. - Bandwidth *int64 `json:"bandwidth" validate:"required"` - - // Indicates whether this volume is performing an operation that must be serialized. This must be `false` to perform an - // operation that is specified to require serialization. - Busy *bool `json:"busy" validate:"required"` - - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. - Capacity *int64 `json:"capacity" validate:"required"` - - // The date and time that the volume was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this volume. - CRN *string `json:"crn" validate:"required"` - - // The type of encryption used on the volume. - Encryption *string `json:"encryption" validate:"required"` - - // The root key used to wrap the data encryption key for the volume. - // - // This property will be present for volumes with an `encryption` type of - // `user_managed`. - EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` - - // The reasons for the current `health_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - HealthReasons []VolumeHealthReason `json:"health_reasons" validate:"required"` - - // The health of this resource. - // - `ok`: No abnormal behavior detected - // - `degraded`: Experiencing compromised performance, capacity, or connectivity - // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated - // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a - // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also - // have this state. - HealthState *string `json:"health_state" validate:"required"` - - // The URL for this volume. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume. - ID *string `json:"id" validate:"required"` - - // The maximum I/O operations per second (IOPS) for this volume. - Iops *int64 `json:"iops" validate:"required"` - - // The name for this volume. The name is unique across all volumes in the region. - Name *string `json:"name" validate:"required"` - - // The operating system associated with this volume. If absent, this volume was not - // created from an image, or the image did not include an operating system. - OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) for - // this volume. - Profile *VolumeProfileReference `json:"profile" validate:"required"` - - // The resource group for this volume. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The image from which this volume was created (this may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - // If absent, this volume was not created from an image. - SourceImage *ImageReference `json:"source_image,omitempty"` - - // The snapshot from which this volume was cloned. - SourceSnapshot *SnapshotReference `json:"source_snapshot,omitempty"` - - // The status of the volume. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected - // property value was encountered. - Status *string `json:"status" validate:"required"` - - // The reasons for the current status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []VolumeStatusReason `json:"status_reasons" validate:"required"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags" validate:"required"` - - // The volume attachments for this volume. - VolumeAttachments []VolumeAttachmentReferenceVolumeContext `json:"volume_attachments" validate:"required"` - - // The zone this volume resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the Volume.AttachmentState property. -// The attachment state of the volume -// - `unattached`: Not attached to any virtual server instances -// - `attached`: Attached to a virtual server instance (even if the instance is stopped) -// - `unusable`: Not able to be attached to any virtual server instances. -const ( - VolumeAttachmentStateAttachedConst = "attached" - VolumeAttachmentStateUnattachedConst = "unattached" - VolumeAttachmentStateUnusableConst = "unusable" -) - -// Constants associated with the Volume.Encryption property. -// The type of encryption used on the volume. -const ( - VolumeEncryptionProviderManagedConst = "provider_managed" - VolumeEncryptionUserManagedConst = "user_managed" -) - -// Constants associated with the Volume.HealthState property. -// The health of this resource. -// - `ok`: No abnormal behavior detected -// - `degraded`: Experiencing compromised performance, capacity, or connectivity -// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated -// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle -// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this -// state. -const ( - VolumeHealthStateDegradedConst = "degraded" - VolumeHealthStateFaultedConst = "faulted" - VolumeHealthStateInapplicableConst = "inapplicable" - VolumeHealthStateOkConst = "ok" -) - -// Constants associated with the Volume.ResourceType property. -// The resource type. -const ( - VolumeResourceTypeVolumeConst = "volume" -) - -// Constants associated with the Volume.Status property. -// The status of the volume. -// -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected -// property value was encountered. -const ( - VolumeStatusAvailableConst = "available" - VolumeStatusFailedConst = "failed" - VolumeStatusPendingConst = "pending" - VolumeStatusPendingDeletionConst = "pending_deletion" - VolumeStatusUnusableConst = "unusable" - VolumeStatusUpdatingConst = "updating" -) - -// UnmarshalVolume unmarshals an instance of Volume from the specified map of raw messages. -func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Volume) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "attachment_state", &obj.AttachmentState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "busy", &obj.Busy) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVolumeHealthReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVolumeStatusReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceVolumeContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachment : VolumeAttachment struct -type VolumeAttachment struct { - // The maximum bandwidth (in megabits per second) for the volume when attached to this instance. This may be lower than - // the volume bandwidth depending on the configuration of the instance. - Bandwidth *int64 `json:"bandwidth" validate:"required"` - - // The date and time that the volume was attached. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete" validate:"required"` - - // Information about how the volume is exposed to the instance operating system. - // - // This property may be absent if the volume attachment's `status` is not `attached`. - Device *VolumeAttachmentDevice `json:"device,omitempty"` - - // The URL for this volume attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume attachment. - ID *string `json:"id" validate:"required"` - - // The name for this volume attachment. The name is unique across all volume attachments on the instance. - Name *string `json:"name" validate:"required"` - - // The status of this volume attachment. - Status *string `json:"status" validate:"required"` - - // The type of volume attachment. - Type *string `json:"type" validate:"required"` - - // The attached volume. - // - // This property will be absent if the volume has not yet been provisioned. - Volume *VolumeReferenceVolumeAttachmentContext `json:"volume,omitempty"` -} - -// Constants associated with the VolumeAttachment.Status property. -// The status of this volume attachment. -const ( - VolumeAttachmentStatusAttachedConst = "attached" - VolumeAttachmentStatusAttachingConst = "attaching" - VolumeAttachmentStatusDeletingConst = "deleting" - VolumeAttachmentStatusDetachingConst = "detaching" -) - -// Constants associated with the VolumeAttachment.Type property. -// The type of volume attachment. -const ( - VolumeAttachmentTypeBootConst = "boot" - VolumeAttachmentTypeDataConst = "data" -) - -// UnmarshalVolumeAttachment unmarshals an instance of VolumeAttachment from the specified map of raw messages. -func UnmarshalVolumeAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachment) - err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - return - } - err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentCollection : VolumeAttachmentCollection struct -type VolumeAttachmentCollection struct { - // Collection of volume attachments. - VolumeAttachments []VolumeAttachment `json:"volume_attachments" validate:"required"` -} - -// UnmarshalVolumeAttachmentCollection unmarshals an instance of VolumeAttachmentCollection from the specified map of raw messages. -func UnmarshalVolumeAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentCollection) - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachment) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentDevice : VolumeAttachmentDevice struct -type VolumeAttachmentDevice struct { - // A unique identifier for the device which is exposed to the instance operating system. - ID *string `json:"id,omitempty"` -} - -// UnmarshalVolumeAttachmentDevice unmarshals an instance of VolumeAttachmentDevice from the specified map of raw messages. -func UnmarshalVolumeAttachmentDevice(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentDevice) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPatch : VolumeAttachmentPatch struct -type VolumeAttachmentPatch struct { - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - - // The name for this volume attachment. The name must not be used by another volume attachment on the instance. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVolumeAttachmentPatch unmarshals an instance of VolumeAttachmentPatch from the specified map of raw messages. -func UnmarshalVolumeAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPatch) - err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the VolumeAttachmentPatch -func (volumeAttachmentPatch *VolumeAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(volumeAttachmentPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// VolumeAttachmentPrototype : VolumeAttachmentPrototype struct -type VolumeAttachmentPrototype struct { - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - - // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // An existing volume to attach to the instance, or a prototype object for a new volume. - Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"` -} - -// NewVolumeAttachmentPrototype : Instantiate VolumeAttachmentPrototype (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototype(volume VolumeAttachmentPrototypeVolumeIntf) (_model *VolumeAttachmentPrototype, err error) { - _model = &VolumeAttachmentPrototype{ - Volume: volume, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalVolumeAttachmentPrototype unmarshals an instance of VolumeAttachmentPrototype from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototype) - err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeAttachmentPrototypeVolume) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeInstanceByImageContext : VolumeAttachmentPrototypeInstanceByImageContext struct -type VolumeAttachmentPrototypeInstanceByImageContext struct { - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - - // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // A prototype object for a new volume. - Volume *VolumePrototypeInstanceByImageContext `json:"volume" validate:"required"` -} - -// NewVolumeAttachmentPrototypeInstanceByImageContext : Instantiate VolumeAttachmentPrototypeInstanceByImageContext (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByImageContext(volume *VolumePrototypeInstanceByImageContext) (_model *VolumeAttachmentPrototypeInstanceByImageContext, err error) { - _model = &VolumeAttachmentPrototypeInstanceByImageContext{ - Volume: volume, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalVolumeAttachmentPrototypeInstanceByImageContext unmarshals an instance of VolumeAttachmentPrototypeInstanceByImageContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeInstanceByImageContext) - err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceByImageContext) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeInstanceBySourceSnapshotContext : VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct -type VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct { - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - - // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // A prototype object for a new volume from a snapshot. - Volume *VolumePrototypeInstanceBySourceSnapshotContext `json:"volume" validate:"required"` -} - -// NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext : Instantiate VolumeAttachmentPrototypeInstanceBySourceSnapshotContext (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(volume *VolumePrototypeInstanceBySourceSnapshotContext) (_model *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, err error) { - _model = &VolumeAttachmentPrototypeInstanceBySourceSnapshotContext{ - Volume: volume, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext unmarshals an instance of VolumeAttachmentPrototypeInstanceBySourceSnapshotContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceBySourceSnapshotContext) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeInstanceByVolumeContext : VolumeAttachmentPrototypeInstanceByVolumeContext struct -type VolumeAttachmentPrototypeInstanceByVolumeContext struct { - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - - // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // An existing volume to attach. - Volume VolumeIdentityIntf `json:"volume" validate:"required"` -} - -// NewVolumeAttachmentPrototypeInstanceByVolumeContext : Instantiate VolumeAttachmentPrototypeInstanceByVolumeContext (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByVolumeContext(volume VolumeIdentityIntf) (_model *VolumeAttachmentPrototypeInstanceByVolumeContext, err error) { - _model = &VolumeAttachmentPrototypeInstanceByVolumeContext{ - Volume: volume, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext unmarshals an instance of VolumeAttachmentPrototypeInstanceByVolumeContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeInstanceByVolumeContext) - err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeVolume : An existing volume to attach to the instance, or a prototype object for a new volume. -// Models which "extend" this model: -// - VolumeAttachmentPrototypeVolumeVolumeIdentity -// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext -type VolumeAttachmentPrototypeVolume struct { - // The unique identifier for this volume. - ID *string `json:"id,omitempty"` - - // The CRN for this volume. - CRN *string `json:"crn,omitempty"` - - // The URL for this volume. - Href *string `json:"href,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to - // use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group to use for this volume. If unspecified, the instance's resource - // group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` -} - -func (*VolumeAttachmentPrototypeVolume) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -type VolumeAttachmentPrototypeVolumeIntf interface { - isaVolumeAttachmentPrototypeVolume() bool -} - -// UnmarshalVolumeAttachmentPrototypeVolume unmarshals an instance of VolumeAttachmentPrototypeVolume from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolume(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolume) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentReferenceInstanceContext : VolumeAttachmentReferenceInstanceContext struct -type VolumeAttachmentReferenceInstanceContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VolumeAttachmentReferenceInstanceContextDeleted `json:"deleted,omitempty"` - - // Information about how the volume is exposed to the instance operating system. - // - // This property may be absent if the volume attachment's `status` is not `attached`. - Device *VolumeAttachmentDevice `json:"device,omitempty"` - - // The URL for this volume attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume attachment. - ID *string `json:"id" validate:"required"` - - // The name for this volume attachment. The name is unique across all volume attachments on the instance. - Name *string `json:"name" validate:"required"` - - // The attached volume. - // - // This property will be absent if the volume has not yet been provisioned. - Volume *VolumeReferenceVolumeAttachmentContext `json:"volume,omitempty"` -} - -// UnmarshalVolumeAttachmentReferenceInstanceContext unmarshals an instance of VolumeAttachmentReferenceInstanceContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentReferenceInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentReferenceInstanceContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceInstanceContextDeleted) - if err != nil { - return - } - err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentReferenceInstanceContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VolumeAttachmentReferenceInstanceContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVolumeAttachmentReferenceInstanceContextDeleted unmarshals an instance of VolumeAttachmentReferenceInstanceContextDeleted from the specified map of raw messages. -func UnmarshalVolumeAttachmentReferenceInstanceContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentReferenceInstanceContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentReferenceVolumeContext : VolumeAttachmentReferenceVolumeContext struct -type VolumeAttachmentReferenceVolumeContext struct { - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VolumeAttachmentReferenceVolumeContextDeleted `json:"deleted,omitempty"` - - // Information about how the volume is exposed to the instance operating system. - // - // This property may be absent if the volume attachment's `status` is not `attached`. - Device *VolumeAttachmentDevice `json:"device,omitempty"` - - // The URL for this volume attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume attachment. - ID *string `json:"id" validate:"required"` - - // The attached instance. - Instance *InstanceReference `json:"instance" validate:"required"` - - // The name for this volume attachment. The name is unique across all volume attachments on the instance. - Name *string `json:"name" validate:"required"` - - // The type of volume attachment. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the VolumeAttachmentReferenceVolumeContext.Type property. -// The type of volume attachment. -const ( - VolumeAttachmentReferenceVolumeContextTypeBootConst = "boot" - VolumeAttachmentReferenceVolumeContextTypeDataConst = "data" -) - -// UnmarshalVolumeAttachmentReferenceVolumeContext unmarshals an instance of VolumeAttachmentReferenceVolumeContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentReferenceVolumeContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentReferenceVolumeContext) - err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceVolumeContextDeleted) - if err != nil { - return - } - err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalInstanceReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentReferenceVolumeContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VolumeAttachmentReferenceVolumeContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVolumeAttachmentReferenceVolumeContextDeleted unmarshals an instance of VolumeAttachmentReferenceVolumeContextDeleted from the specified map of raw messages. -func UnmarshalVolumeAttachmentReferenceVolumeContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentReferenceVolumeContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeCollection : VolumeCollection struct -type VolumeCollection struct { - // A link to the first page of resources. - First *VolumeCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *VolumeCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` - - // Collection of volumes. - Volumes []Volume `json:"volumes" validate:"required"` -} - -// UnmarshalVolumeCollection unmarshals an instance of VolumeCollection from the specified map of raw messages. -func UnmarshalVolumeCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVolumeCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVolumeCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volumes", &obj.Volumes, UnmarshalVolume) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *VolumeCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// VolumeCollectionFirst : A link to the first page of resources. -type VolumeCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVolumeCollectionFirst unmarshals an instance of VolumeCollectionFirst from the specified map of raw messages. -func UnmarshalVolumeCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VolumeCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVolumeCollectionNext unmarshals an instance of VolumeCollectionNext from the specified map of raw messages. -func UnmarshalVolumeCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeHealthReason : VolumeHealthReason struct -type VolumeHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this health state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VolumeHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. -const ( - VolumeHealthReasonCodeInitializingFromSnapshotConst = "initializing_from_snapshot" -) - -// UnmarshalVolumeHealthReason unmarshals an instance of VolumeHealthReason from the specified map of raw messages. -func UnmarshalVolumeHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeHealthReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeIdentity : Identifies a volume by a unique property. -// Models which "extend" this model: -// - VolumeIdentityByID -// - VolumeIdentityByCRN -// - VolumeIdentityByHref -type VolumeIdentity struct { - // The unique identifier for this volume. - ID *string `json:"id,omitempty"` - - // The CRN for this volume. - CRN *string `json:"crn,omitempty"` - - // The URL for this volume. - Href *string `json:"href,omitempty"` -} - -func (*VolumeIdentity) isaVolumeIdentity() bool { - return true -} - -type VolumeIdentityIntf interface { - isaVolumeIdentity() bool -} - -// UnmarshalVolumeIdentity unmarshals an instance of VolumeIdentity from the specified map of raw messages. -func UnmarshalVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumePatch : VolumePatch struct -type VolumePatch struct { - // The capacity to use for the volume (in gigabytes). The volume must be attached to a running virtual server instance, - // and the specified value must not be less than the current capacity. Additionally, if the volume is attached as a - // boot volume, the maximum value is 250 gigabytes. - // - // The minimum and maximum capacity limits for creating or updating volumes may expand in the future. - Capacity *int64 `json:"capacity,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. The volume must be attached as a data volume to a running virtual server instance. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. - Name *string `json:"name,omitempty"` - - // The profile to use for this volume. The requested profile must be in the same - // `family` as the current profile. The volume must be attached as a data volume to - // a running virtual server instance, and must have a `capacity` within the range - // supported by the specified profile. - Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` -} - -// UnmarshalVolumePatch unmarshals an instance of VolumePatch from the specified map of raw messages. -func UnmarshalVolumePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumePatch) - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the VolumePatch -func (volumePatch *VolumePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(volumePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// VolumeProfile : VolumeProfile struct -type VolumeProfile struct { - // The product family this volume profile belongs to. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the volume profile on which the - // unexpected property value was encountered. - Family *string `json:"family" validate:"required"` - - // The URL for this volume profile. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this volume profile. - Name *string `json:"name" validate:"required"` -} - -// Constants associated with the VolumeProfile.Family property. -// The product family this volume profile belongs to. -// -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the volume profile on which the -// unexpected property value was encountered. -const ( - VolumeProfileFamilyCustomConst = "custom" - VolumeProfileFamilyTieredConst = "tiered" -) - -// UnmarshalVolumeProfile unmarshals an instance of VolumeProfile from the specified map of raw messages. -func UnmarshalVolumeProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfile) - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeProfileCollection : VolumeProfileCollection struct -type VolumeProfileCollection struct { - // A link to the first page of resources. - First *VolumeProfileCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *VolumeProfileCollectionNext `json:"next,omitempty"` - - // Collection of volume profiles. - Profiles []VolumeProfile `json:"profiles" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalVolumeProfileCollection unmarshals an instance of VolumeProfileCollection from the specified map of raw messages. -func UnmarshalVolumeProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVolumeProfileCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVolumeProfileCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalVolumeProfile) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *VolumeProfileCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// VolumeProfileCollectionFirst : A link to the first page of resources. -type VolumeProfileCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVolumeProfileCollectionFirst unmarshals an instance of VolumeProfileCollectionFirst from the specified map of raw messages. -func UnmarshalVolumeProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VolumeProfileCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVolumeProfileCollectionNext unmarshals an instance of VolumeProfileCollectionNext from the specified map of raw messages. -func UnmarshalVolumeProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeProfileIdentity : Identifies a volume profile by a unique property. -// Models which "extend" this model: -// - VolumeProfileIdentityByName -// - VolumeProfileIdentityByHref -type VolumeProfileIdentity struct { - // The globally unique name for this volume profile. - Name *string `json:"name,omitempty"` - - // The URL for this volume profile. - Href *string `json:"href,omitempty"` -} - -func (*VolumeProfileIdentity) isaVolumeProfileIdentity() bool { - return true -} - -type VolumeProfileIdentityIntf interface { - isaVolumeProfileIdentity() bool -} - -// UnmarshalVolumeProfileIdentity unmarshals an instance of VolumeProfileIdentity from the specified map of raw messages. -func UnmarshalVolumeProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeProfileReference : VolumeProfileReference struct -type VolumeProfileReference struct { - // The URL for this volume profile. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this volume profile. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalVolumeProfileReference unmarshals an instance of VolumeProfileReference from the specified map of raw messages. -func UnmarshalVolumeProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumePrototype : VolumePrototype struct -// Models which "extend" this model: -// - VolumePrototypeVolumeByCapacity -// - VolumePrototypeVolumeBySourceSnapshot -type VolumePrototype struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to - // use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this volume will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` -} - -func (*VolumePrototype) isaVolumePrototype() bool { - return true -} - -type VolumePrototypeIntf interface { - isaVolumePrototype() bool -} - -// UnmarshalVolumePrototype unmarshals an instance of VolumePrototype from the specified map of raw messages. -func UnmarshalVolumePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumePrototype) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumePrototypeInstanceByImageContext : VolumePrototypeInstanceByImageContext struct -type VolumePrototypeInstanceByImageContext struct { - // The capacity to use for the volume (in gigabytes). Must be at least the image's - // `minimum_provisioned_size`. The maximum value may increase in the future. - // - // If unspecified, the capacity will be the image's `minimum_provisioned_size`. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to - // use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use for this volume. If unspecified, the instance's resource - // group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` -} - -// NewVolumePrototypeInstanceByImageContext : Instantiate VolumePrototypeInstanceByImageContext (Generic Model Constructor) -func (*VpcV1) NewVolumePrototypeInstanceByImageContext(profile VolumeProfileIdentityIntf) (_model *VolumePrototypeInstanceByImageContext, err error) { - _model = &VolumePrototypeInstanceByImageContext{ - Profile: profile, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalVolumePrototypeInstanceByImageContext unmarshals an instance of VolumePrototypeInstanceByImageContext from the specified map of raw messages. -func UnmarshalVolumePrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumePrototypeInstanceByImageContext) - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumePrototypeInstanceBySourceSnapshotContext : VolumePrototypeInstanceBySourceSnapshotContext struct -type VolumePrototypeInstanceBySourceSnapshotContext struct { - // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's - // `minimum_capacity`. The maximum value may increase in the future. - // - // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to - // use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use for this volume. If unspecified, the instance's resource - // group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` -} - -// NewVolumePrototypeInstanceBySourceSnapshotContext : Instantiate VolumePrototypeInstanceBySourceSnapshotContext (Generic Model Constructor) -func (*VpcV1) NewVolumePrototypeInstanceBySourceSnapshotContext(profile VolumeProfileIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumePrototypeInstanceBySourceSnapshotContext, err error) { - _model = &VolumePrototypeInstanceBySourceSnapshotContext{ - Profile: profile, - SourceSnapshot: sourceSnapshot, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalVolumePrototypeInstanceBySourceSnapshotContext unmarshals an instance of VolumePrototypeInstanceBySourceSnapshotContext from the specified map of raw messages. -func UnmarshalVolumePrototypeInstanceBySourceSnapshotContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumePrototypeInstanceBySourceSnapshotContext) - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeReference : VolumeReference struct -type VolumeReference struct { - // The CRN for this volume. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this volume. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume. - ID *string `json:"id" validate:"required"` - - // The name for this volume. The name is unique across all volumes in the region. - Name *string `json:"name" validate:"required"` - - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *VolumeRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VolumeReference.ResourceType property. -// The resource type. -const ( - VolumeReferenceResourceTypeVolumeConst = "volume" -) - -// UnmarshalVolumeReference unmarshals an instance of VolumeReference from the specified map of raw messages. -func UnmarshalVolumeReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VolumeReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVolumeReferenceDeleted unmarshals an instance of VolumeReferenceDeleted from the specified map of raw messages. -func UnmarshalVolumeReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeReferenceVolumeAttachmentContext : VolumeReferenceVolumeAttachmentContext struct -type VolumeReferenceVolumeAttachmentContext struct { - // The CRN for this volume. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VolumeReferenceVolumeAttachmentContextDeleted `json:"deleted,omitempty"` - - // The URL for this volume. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume. - ID *string `json:"id" validate:"required"` - - // The name for this volume. The name is unique across all volumes in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VolumeReferenceVolumeAttachmentContext.ResourceType property. -// The resource type. -const ( - VolumeReferenceVolumeAttachmentContextResourceTypeVolumeConst = "volume" -) - -// UnmarshalVolumeReferenceVolumeAttachmentContext unmarshals an instance of VolumeReferenceVolumeAttachmentContext from the specified map of raw messages. -func UnmarshalVolumeReferenceVolumeAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeReferenceVolumeAttachmentContext) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceVolumeAttachmentContextDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeReferenceVolumeAttachmentContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VolumeReferenceVolumeAttachmentContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVolumeReferenceVolumeAttachmentContextDeleted unmarshals an instance of VolumeReferenceVolumeAttachmentContextDeleted from the specified map of raw messages. -func UnmarshalVolumeReferenceVolumeAttachmentContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeReferenceVolumeAttachmentContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type VolumeRemote struct { - // If present, this property indicates that the referenced resource is remote to this - // region, and identifies the native region. - Region *RegionReference `json:"region,omitempty"` -} - -// UnmarshalVolumeRemote unmarshals an instance of VolumeRemote from the specified map of raw messages. -func UnmarshalVolumeRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeRemote) - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeStatusReason : VolumeStatusReason struct -type VolumeStatusReason struct { - // A snake case string succinctly identifying the status reason. - Code *string `json:"code" validate:"required"` - - // An explanation of the status reason. - Message *string `json:"message" validate:"required"` - - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VolumeStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -const ( - VolumeStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" -) - -// UnmarshalVolumeStatusReason unmarshals an instance of VolumeStatusReason from the specified map of raw messages. -func UnmarshalVolumeStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeStatusReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolutionBindingCollectionFirst : A link to the first page of resources. -type VpcdnsResolutionBindingCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVpcdnsResolutionBindingCollectionFirst unmarshals an instance of VpcdnsResolutionBindingCollectionFirst from the specified map of raw messages. -func UnmarshalVpcdnsResolutionBindingCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolutionBindingCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolutionBindingCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VpcdnsResolutionBindingCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVpcdnsResolutionBindingCollectionNext unmarshals an instance of VpcdnsResolutionBindingCollectionNext from the specified map of raw messages. -func UnmarshalVpcdnsResolutionBindingCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolutionBindingCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Zone : Zone struct -type Zone struct { - // The URL for this zone. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this zone. - Name *string `json:"name" validate:"required"` - - // The region this zone resides in. - Region *RegionReference `json:"region" validate:"required"` - - // The availability status of this zone. - Status *string `json:"status" validate:"required"` -} - -// Constants associated with the Zone.Status property. -// The availability status of this zone. -const ( - ZoneStatusAvailableConst = "available" - ZoneStatusImpairedConst = "impaired" - ZoneStatusUnavailableConst = "unavailable" -) - -// UnmarshalZone unmarshals an instance of Zone from the specified map of raw messages. -func UnmarshalZone(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Zone) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ZoneCollection : ZoneCollection struct -type ZoneCollection struct { - // Collection of zones. - Zones []Zone `json:"zones" validate:"required"` -} - -// UnmarshalZoneCollection unmarshals an instance of ZoneCollection from the specified map of raw messages. -func UnmarshalZoneCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ZoneCollection) - err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZone) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ZoneIdentity : Identifies a zone by a unique property. -// Models which "extend" this model: -// - ZoneIdentityByName -// - ZoneIdentityByHref -type ZoneIdentity struct { - // The globally unique name for this zone. - Name *string `json:"name,omitempty"` - - // The URL for this zone. - Href *string `json:"href,omitempty"` -} - -func (*ZoneIdentity) isaZoneIdentity() bool { - return true -} - -type ZoneIdentityIntf interface { - isaZoneIdentity() bool -} - -// UnmarshalZoneIdentity unmarshals an instance of ZoneIdentity from the specified map of raw messages. -func UnmarshalZoneIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ZoneIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ZoneReference : ZoneReference struct -type ZoneReference struct { - // The URL for this zone. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this zone. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalZoneReference unmarshals an instance of ZoneReference from the specified map of raw messages. -func UnmarshalZoneReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ZoneReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyJobSourceVolumeReference : BackupPolicyJobSourceVolumeReference struct -// This model "extends" BackupPolicyJobSource -type BackupPolicyJobSourceVolumeReference struct { - // The CRN for this volume. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this volume. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume. - ID *string `json:"id" validate:"required"` - - // The name for this volume. The name is unique across all volumes in the region. - Name *string `json:"name" validate:"required"` - - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *VolumeRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the BackupPolicyJobSourceVolumeReference.ResourceType property. -// The resource type. -const ( - BackupPolicyJobSourceVolumeReferenceResourceTypeVolumeConst = "volume" -) - -func (*BackupPolicyJobSourceVolumeReference) isaBackupPolicyJobSource() bool { - return true -} - -// UnmarshalBackupPolicyJobSourceVolumeReference unmarshals an instance of BackupPolicyJobSourceVolumeReference from the specified map of raw messages. -func UnmarshalBackupPolicyJobSourceVolumeReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobSourceVolumeReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyScopePrototypeEnterpriseIdentity : Identifies an enterprise by a unique property. -// Models which "extend" this model: -// - BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN -// This model "extends" BackupPolicyScopePrototype -type BackupPolicyScopePrototypeEnterpriseIdentity struct { - // The CRN for this enterprise. - CRN *string `json:"crn,omitempty"` -} - -func (*BackupPolicyScopePrototypeEnterpriseIdentity) isaBackupPolicyScopePrototypeEnterpriseIdentity() bool { - return true -} - -type BackupPolicyScopePrototypeEnterpriseIdentityIntf interface { - BackupPolicyScopePrototypeIntf - isaBackupPolicyScopePrototypeEnterpriseIdentity() bool -} - -func (*BackupPolicyScopePrototypeEnterpriseIdentity) isaBackupPolicyScopePrototype() bool { - return true -} - -// UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity unmarshals an instance of BackupPolicyScopePrototypeEnterpriseIdentity from the specified map of raw messages. -func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyScopePrototypeEnterpriseIdentity) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyScopeAccountReference : BackupPolicyScopeAccountReference struct -// This model "extends" BackupPolicyScope -type BackupPolicyScopeAccountReference struct { - // The unique identifier for this account. - ID *string `json:"id" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the BackupPolicyScopeAccountReference.ResourceType property. -// The resource type. -const ( - BackupPolicyScopeAccountReferenceResourceTypeAccountConst = "account" -) - -func (*BackupPolicyScopeAccountReference) isaBackupPolicyScope() bool { - return true -} - -// UnmarshalBackupPolicyScopeAccountReference unmarshals an instance of BackupPolicyScopeAccountReference from the specified map of raw messages. -func UnmarshalBackupPolicyScopeAccountReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyScopeAccountReference) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyScopeEnterpriseReference : BackupPolicyScopeEnterpriseReference struct -// This model "extends" BackupPolicyScope -type BackupPolicyScopeEnterpriseReference struct { - // The CRN for this enterprise. - CRN *string `json:"crn" validate:"required"` - - // The unique identifier for this enterprise. - ID *string `json:"id" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the BackupPolicyScopeEnterpriseReference.ResourceType property. -// The resource type. -const ( - BackupPolicyScopeEnterpriseReferenceResourceTypeEnterpriseConst = "enterprise" -) - -func (*BackupPolicyScopeEnterpriseReference) isaBackupPolicyScope() bool { - return true -} - -// UnmarshalBackupPolicyScopeEnterpriseReference unmarshals an instance of BackupPolicyScopeEnterpriseReference from the specified map of raw messages. -func UnmarshalBackupPolicyScopeEnterpriseReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyScopeEnterpriseReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerBootTargetBareMetalServerDiskReference : BareMetalServerBootTargetBareMetalServerDiskReference struct -// This model "extends" BareMetalServerBootTarget -type BareMetalServerBootTargetBareMetalServerDiskReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this bare metal server disk. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server disk. - ID *string `json:"id" validate:"required"` - - // The name for this bare metal server disk. The name is unique across all disks on the bare metal server. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the BareMetalServerBootTargetBareMetalServerDiskReference.ResourceType property. -// The resource type. -const ( - BareMetalServerBootTargetBareMetalServerDiskReferenceResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" -) - -func (*BareMetalServerBootTargetBareMetalServerDiskReference) isaBareMetalServerBootTarget() bool { - return true -} - -// UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference unmarshals an instance of BareMetalServerBootTargetBareMetalServerDiskReference from the specified map of raw messages. -func UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerBootTargetBareMetalServerDiskReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount : BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct -// This model "extends" BareMetalServerInitializationUserAccount -type BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct { - // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. - EncryptedPassword *[]byte `json:"encrypted_password" validate:"required"` - - // The public SSH key used to encrypt the password. - EncryptionKey *KeyReference `json:"encryption_key" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The username for the account created at initialization. - Username *string `json:"username" validate:"required"` -} - -// Constants associated with the BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount.ResourceType property. -// The resource type. -const ( - BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccountResourceTypeHostUserAccountConst = "host_user_account" -) - -func (*BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) isaBareMetalServerInitializationUserAccount() bool { - return true -} - -// UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount unmarshals an instance of BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount from the specified map of raw messages. -func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) - err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "username", &obj.Username) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentByPci : BareMetalServerNetworkAttachmentByPci struct -// This model "extends" BareMetalServerNetworkAttachment -type BareMetalServerNetworkAttachmentByPci struct { - // The date and time that the bare metal server network attachment was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this bare metal server network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network attachment. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the bare metal server network attachment. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this bare metal server network attachment. The name is unique across all network attachments for the - // bare metal server. - Name *string `json:"name" validate:"required"` - - // The port speed for this bare metal server network attachment in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - // The primary IP address of the virtual network interface for the bare metal server network attachment. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The subnet of the virtual network interface for the bare metal server network attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The bare metal server network attachment type. - Type *string `json:"type" validate:"required"` - - // The virtual network interface for this bare metal server network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` - - 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 VLAN tag. - InterfaceType *string `json:"interface_type" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkAttachmentByPci.LifecycleState property. -// The lifecycle state of the bare metal server network attachment. -const ( - BareMetalServerNetworkAttachmentByPciLifecycleStateDeletingConst = "deleting" - BareMetalServerNetworkAttachmentByPciLifecycleStateFailedConst = "failed" - BareMetalServerNetworkAttachmentByPciLifecycleStatePendingConst = "pending" - BareMetalServerNetworkAttachmentByPciLifecycleStateStableConst = "stable" - BareMetalServerNetworkAttachmentByPciLifecycleStateSuspendedConst = "suspended" - BareMetalServerNetworkAttachmentByPciLifecycleStateUpdatingConst = "updating" - BareMetalServerNetworkAttachmentByPciLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByPci.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkAttachmentByPciResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByPci.Type property. -// The bare metal server network attachment type. -const ( - BareMetalServerNetworkAttachmentByPciTypePrimaryConst = "primary" - BareMetalServerNetworkAttachmentByPciTypeSecondaryConst = "secondary" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByPci.InterfaceType property. -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped -// - Has an `allowed_vlans` property which controls the VLANs that will be permitted -// to use the PCI attachment -// - Cannot directly use an IEEE 802.1q VLAN tag. -const ( - BareMetalServerNetworkAttachmentByPciInterfaceTypePciConst = "pci" -) - -func (*BareMetalServerNetworkAttachmentByPci) isaBareMetalServerNetworkAttachment() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentByPci unmarshals an instance of BareMetalServerNetworkAttachmentByPci from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentByPci(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentByPci) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentByVlan : BareMetalServerNetworkAttachmentByVlan struct -// This model "extends" BareMetalServerNetworkAttachment -type BareMetalServerNetworkAttachmentByVlan struct { - // The date and time that the bare metal server network attachment was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this bare metal server network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network attachment. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the bare metal server network attachment. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this bare metal server network attachment. The name is unique across all network attachments for the - // bare metal server. - Name *string `json:"name" validate:"required"` - - // The port speed for this bare metal server network attachment in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - // The primary IP address of the virtual network interface for the bare metal server network attachment. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The subnet of the virtual network interface for the bare metal server network attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The bare metal server network attachment type. - Type *string `json:"type" validate:"required"` - - // The virtual network interface for this bare metal server network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` - - // Indicates if the bare metal server network attachment can automatically float to any other server within the same - // `resource_group`. The bare metal server network attachment will float automatically if the network detects a GARP or - // RARP on another bare metal server in the resource group. Applies only to bare metal server network attachments with - // `vlan` interface type. - 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"` - - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this attachment. - Vlan *int64 `json:"vlan" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkAttachmentByVlan.LifecycleState property. -// The lifecycle state of the bare metal server network attachment. -const ( - BareMetalServerNetworkAttachmentByVlanLifecycleStateDeletingConst = "deleting" - BareMetalServerNetworkAttachmentByVlanLifecycleStateFailedConst = "failed" - BareMetalServerNetworkAttachmentByVlanLifecycleStatePendingConst = "pending" - BareMetalServerNetworkAttachmentByVlanLifecycleStateStableConst = "stable" - BareMetalServerNetworkAttachmentByVlanLifecycleStateSuspendedConst = "suspended" - BareMetalServerNetworkAttachmentByVlanLifecycleStateUpdatingConst = "updating" - BareMetalServerNetworkAttachmentByVlanLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByVlan.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkAttachmentByVlanResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByVlan.Type property. -// The bare metal server network attachment type. -const ( - BareMetalServerNetworkAttachmentByVlanTypePrimaryConst = "primary" - BareMetalServerNetworkAttachmentByVlanTypeSecondaryConst = "secondary" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByVlan.InterfaceType property. -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array -// of `allowed_vlans`. -// - Must use an IEEE 802.1q tag. -const ( - BareMetalServerNetworkAttachmentByVlanInterfaceTypeVlanConst = "vlan" -) - -func (*BareMetalServerNetworkAttachmentByVlan) isaBareMetalServerNetworkAttachment() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentByVlan unmarshals an instance of BareMetalServerNetworkAttachmentByVlan from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentByVlan(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentByVlan) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityIntf interface { - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf - isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext : The virtual network interface for this target. -// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext struct { - // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on - // this interface. If `true`, source IP spoofing is allowed on this interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the virtual network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - If the virtual network interface is attached, the target `resource_type` must be - // `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 - // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // same subnet as the primary IP. - // - // If reserved IP identities are provided, the specified reserved IPs must be unbound. - // - // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network - // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet - // will be automatically selected and reserved. - Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are - // reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the virtual network interface. May be either a - // reserved IP identity, or a reserved IP prototype object which will be used to create a - // new reserved IP. - // - // If a reserved IP identity is provided, the specified reserved IP must be unbound. - // - // If a reserved IP prototype object with an address is provided, the address must be - // available on the virtual network interface's subnet. If no address is specified, - // an available address on the subnet will be automatically selected and reserved. - PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The resource group to use for this virtual network interface. If unspecified, the - // bare metal server's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. Required if `primary_ip` does not specify a reserved IP. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct -// This model "extends" BareMetalServerNetworkAttachmentPrototype -type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct { - // The name for this bare metal server network attachment. Names must be unique within the bare metal server the - // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` - - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) 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 VLAN tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type" validate:"required"` -} - -// Constants associated with the 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 VLAN tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. -const ( - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototypeInterfaceTypePciConst = "pci" -) - -// NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype, err error) { - _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype{ - VirtualNetworkInterface: virtualNetworkInterface, - InterfaceType: core.StringPtr(interfaceType), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct -// This model "extends" BareMetalServerNetworkAttachmentPrototype -type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct { - // The name for this bare metal server network attachment. Names must be unique within the bare metal server the - // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` - - // Indicates if the bare metal server network attachment can automatically float to any other server within the same - // `resource_group`. The bare metal server network attachment will float automatically if the network detects a GARP or - // RARP on another bare metal server in the resource group. Applies only to bare metal server network attachments with - // `vlan` interface type. - 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"` - - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this attachment. - Vlan *int64 `json:"vlan" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype.InterfaceType property. -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array -// of `allowed_vlans`. -// - Must use an IEEE 802.1q tag. -const ( - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototypeInterfaceTypeVlanConst = "vlan" -) - -// NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype, err error) { - _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype{ - VirtualNetworkInterface: virtualNetworkInterface, - InterfaceType: core.StringPtr(interfaceType), - Vlan: core.Int64Ptr(vlan), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfaceByHiperSocket : BareMetalServerNetworkInterfaceByHiperSocket struct -// This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByHiperSocket struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // The date and time that the bare metal server network interface was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The floating IPs associated with this bare metal server network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network interface. - ID *string `json:"id" validate:"required"` - - // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value - // will be an empty string. - MacAddress *string `json:"mac_address" validate:"required"` - - // The name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - // The bare metal server network interface port speed in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The security groups targeting this bare metal server network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the bare metal server network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The bare metal server network interface type. - Type *string `json:"type" validate:"required"` - - // - `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. -const ( - BareMetalServerNetworkInterfaceByHiperSocketStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByHiperSocketStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByHiperSocketStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByHiperSocketStatusPendingConst = "pending" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Type property. -// The bare metal server network interface type. -const ( - BareMetalServerNetworkInterfaceByHiperSocketTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByHiperSocketTypeSecondaryConst = "secondary" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.InterfaceType property. -// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity -// within a `s390x` based system. -const ( - BareMetalServerNetworkInterfaceByHiperSocketInterfaceTypeHipersocketConst = "hipersocket" -) - -func (*BareMetalServerNetworkInterfaceByHiperSocket) isaBareMetalServerNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkInterfaceByHiperSocket unmarshals an instance of BareMetalServerNetworkInterfaceByHiperSocket from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByHiperSocket) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfaceByPci : BareMetalServerNetworkInterfaceByPci struct -// This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByPci struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // The date and time that the bare metal server network interface was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The floating IPs associated with this bare metal server network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network interface. - ID *string `json:"id" validate:"required"` - - // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value - // will be an empty string. - MacAddress *string `json:"mac_address" validate:"required"` - - // The name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - // The bare metal server network interface port speed in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The security groups targeting this bare metal server network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the bare metal server network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The bare metal server network interface type. - Type *string `json:"type" validate:"required"` - - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. - AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` - - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI interface - // - Cannot directly use an IEEE 802.1q VLAN tag. - 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. -const ( - BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByPciStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByPciStatusPendingConst = "pending" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByPci.Type property. -// The bare metal server network interface type. -const ( - BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByPci.InterfaceType property. -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped -// - Has an `allowed_vlans` property which controls the VLANs that will be permitted -// to use the PCI interface -// - Cannot directly use an IEEE 802.1q VLAN tag. -const ( - BareMetalServerNetworkInterfaceByPciInterfaceTypePciConst = "pci" -) - -func (*BareMetalServerNetworkInterfaceByPci) isaBareMetalServerNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkInterfaceByPci unmarshals an instance of BareMetalServerNetworkInterfaceByPci from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByPci) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfaceByVlan : BareMetalServerNetworkInterfaceByVlan struct -// This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByVlan struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // The date and time that the bare metal server network interface was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The floating IPs associated with this bare metal server network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network interface. - ID *string `json:"id" validate:"required"` - - // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value - // will be an empty string. - MacAddress *string `json:"mac_address" validate:"required"` - - // The name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - // The bare metal server network interface port speed in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The security groups targeting this bare metal server network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the bare metal server network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The bare metal server network interface type. - Type *string `json:"type" validate:"required"` - - // Indicates if the interface can float to any other server within the same - // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal - // server in the resource group. Applies only to `vlan` type interfaces. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float" validate:"required"` - - // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array - // of `allowed_vlans`. - // - Must use an IEEE 802.1q tag. - // - Has its own security groups and does not inherit those of the PCI device through - // which traffic flows. - InterfaceType *string `json:"interface_type" validate:"required"` - - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. - Vlan *int64 `json:"vlan" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkInterfaceByVlanResourceTypeNetworkInterfaceConst = "network_interface" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Status property. -// The status of the bare metal server network interface. -const ( - BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByVlanStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByVlanStatusPendingConst = "pending" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Type property. -// The bare metal server network interface type. -const ( - BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.InterfaceType property. -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array -// of `allowed_vlans`. -// - Must use an IEEE 802.1q tag. -// - Has its own security groups and does not inherit those of the PCI device through -// which traffic flows. -const ( - BareMetalServerNetworkInterfaceByVlanInterfaceTypeVlanConst = "vlan" -) - -func (*BareMetalServerNetworkInterfaceByVlan) isaBareMetalServerNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkInterfaceByVlan unmarshals an instance of BareMetalServerNetworkInterfaceByVlan from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByVlan) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct -// This model "extends" BareMetalServerNetworkInterfacePrototype -type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - - // The name for this bare metal server network interface. The name must not be used by another network interface on the - // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the bare metal server network interface. This can be specified using an existing - // reserved IP, or a prototype object for a new reserved IP. - // - // If an existing reserved IP or a prototype object with an address is specified, it must be available on the bare - // metal server network interface's subnet. Otherwise, an available address on the subnet will be automatically - // selected and reserved. - PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security - // group is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity - // within a `s390x` based system. - // - Not supported on bare metal servers with a `cpu.architecture` of `amd64`. - InterfaceType *string `json:"interface_type" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype.InterfaceType property. -// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity -// within a `s390x` based system. -// - Not supported on bare metal servers with a `cpu.architecture` of `amd64`. -const ( - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototypeInterfaceTypeHipersocketConst = "hipersocket" -) - -// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype, err error) { - _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype{ - Subnet: subnet, - InterfaceType: core.StringPtr(interfaceType), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct -// This model "extends" BareMetalServerNetworkInterfacePrototype -type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - - // The 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 what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI interface - // - Cannot directly use an IEEE 802.1q VLAN tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype.InterfaceType property. -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped -// - Has an `allowed_vlans` property which controls the VLANs that will be permitted -// to use the PCI interface -// - Cannot directly use an IEEE 802.1q VLAN tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. -const ( - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototypeInterfaceTypePciConst = "pci" -) - -// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype, err error) { - _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype{ - Subnet: subnet, - InterfaceType: core.StringPtr(interfaceType), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct -// This model "extends" BareMetalServerNetworkInterfacePrototype -type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - - // The 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 interface can float to any other server within the same - // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal - // server in the resource group. Applies only to `vlan` type interfaces. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` - - // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array - // of `allowed_vlans`. - // - Must use an IEEE 802.1q tag. - // - Has its own security groups and does not inherit those of the PCI device through - // which traffic flows. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type" validate:"required"` - - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. - Vlan *int64 `json:"vlan" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype.InterfaceType property. -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array -// of `allowed_vlans`. -// - Must use an IEEE 802.1q tag. -// - Has its own security groups and does not inherit those of the PCI device through -// which traffic flows. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. -const ( - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototypeInterfaceTypeVlanConst = "vlan" -) - -// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(subnet SubnetIdentityIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype, err error) { - _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype{ - Subnet: subnet, - InterfaceType: core.StringPtr(interfaceType), - Vlan: core.Int64Ptr(vlan), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype : BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype struct -// This model "extends" BareMetalServerPrimaryNetworkAttachmentPrototype -type BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype struct { - // The name for this bare metal server network attachment. Names must be unique within the bare metal server the - // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` - - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) 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 VLAN 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 VLAN tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. -const ( - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototypeInterfaceTypePciConst = "pci" -) - -// NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype : Instantiate BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) (_model *BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype, err error) { - _model = &BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype{ - VirtualNetworkInterface: virtualNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { - return true -} - -// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the bare metal server network attachments or bare metal server network interfaces -// of a bare metal server with this profile depends on its configuration. -// This model "extends" BareMetalServerProfileBandwidth -type BareMetalServerProfileBandwidthDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileBandwidthDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileBandwidthDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileBandwidthDependent) isaBareMetalServerProfileBandwidth() bool { - return true -} - -// UnmarshalBareMetalServerProfileBandwidthDependent unmarshals an instance of BareMetalServerProfileBandwidthDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileBandwidthDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the bare metal server network attachments -// or bare metal server network interfaces of a bare metal server with this profile. -// This model "extends" BareMetalServerProfileBandwidth -type BareMetalServerProfileBandwidthEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileBandwidthEnum.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileBandwidthEnumTypeEnumConst = "enum" -) - -func (*BareMetalServerProfileBandwidthEnum) isaBareMetalServerProfileBandwidth() bool { - return true -} - -// UnmarshalBareMetalServerProfileBandwidthEnum unmarshals an instance of BareMetalServerProfileBandwidthEnum from the specified map of raw messages. -func UnmarshalBareMetalServerProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileBandwidthEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the bare metal server network attachments or bare metal -// server network interfaces of a bare metal server with this profile. -// This model "extends" BareMetalServerProfileBandwidth -type BareMetalServerProfileBandwidthFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileBandwidthFixed.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileBandwidthFixedTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileBandwidthFixed) isaBareMetalServerProfileBandwidth() bool { - return true -} - -// UnmarshalBareMetalServerProfileBandwidthFixed unmarshals an instance of BareMetalServerProfileBandwidthFixed from the specified map of raw messages. -func UnmarshalBareMetalServerProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileBandwidthFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network attachments or network -// interfaces of a bare metal server with this profile. -// This model "extends" BareMetalServerProfileBandwidth -type BareMetalServerProfileBandwidthRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileBandwidthRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileBandwidthRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileBandwidthRange) isaBareMetalServerProfileBandwidth() bool { - return true -} - -// UnmarshalBareMetalServerProfileBandwidthRange unmarshals an instance of BareMetalServerProfileBandwidthRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileBandwidthRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCpuCoreCountDependent : The CPU core count for a bare metal server with this profile depends on its configuration. -// This model "extends" BareMetalServerProfileCpuCoreCount -type BareMetalServerProfileCpuCoreCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuCoreCountDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuCoreCountDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileCpuCoreCountDependent) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuCoreCountDependent unmarshals an instance of BareMetalServerProfileCpuCoreCountDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuCoreCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuCoreCountDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCpuCoreCountEnum : The permitted values for CPU cores for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileCpuCoreCount -type BareMetalServerProfileCpuCoreCountEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuCoreCountEnum.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuCoreCountEnumTypeEnumConst = "enum" -) - -func (*BareMetalServerProfileCpuCoreCountEnum) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuCoreCountEnum unmarshals an instance of BareMetalServerProfileCpuCoreCountEnum from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuCoreCountEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuCoreCountEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCpuCoreCountFixed : The CPU core count for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileCpuCoreCount -type BareMetalServerProfileCpuCoreCountFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuCoreCountFixed.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuCoreCountFixedTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileCpuCoreCountFixed) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuCoreCountFixed unmarshals an instance of BareMetalServerProfileCpuCoreCountFixed from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuCoreCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuCoreCountFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCpuCoreCountRange : The permitted range for the number of CPU cores for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileCpuCoreCount -type BareMetalServerProfileCpuCoreCountRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuCoreCountRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuCoreCountRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileCpuCoreCountRange) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuCoreCountRange unmarshals an instance of BareMetalServerProfileCpuCoreCountRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuCoreCountRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuCoreCountRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCpuSocketCountDependent : The CPU socket count for a bare metal server with this profile depends on its configuration. -// This model "extends" BareMetalServerProfileCpuSocketCount -type BareMetalServerProfileCpuSocketCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuSocketCountDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuSocketCountDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileCpuSocketCountDependent) isaBareMetalServerProfileCpuSocketCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuSocketCountDependent unmarshals an instance of BareMetalServerProfileCpuSocketCountDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuSocketCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuSocketCountDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCpuSocketCountEnum : The permitted values for CPU sockets for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileCpuSocketCount -type BareMetalServerProfileCpuSocketCountEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuSocketCountEnum.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuSocketCountEnumTypeEnumConst = "enum" -) - -func (*BareMetalServerProfileCpuSocketCountEnum) isaBareMetalServerProfileCpuSocketCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuSocketCountEnum unmarshals an instance of BareMetalServerProfileCpuSocketCountEnum from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuSocketCountEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuSocketCountEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCpuSocketCountFixed : The number of CPU sockets for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileCpuSocketCount -type BareMetalServerProfileCpuSocketCountFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuSocketCountFixed.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuSocketCountFixedTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileCpuSocketCountFixed) isaBareMetalServerProfileCpuSocketCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuSocketCountFixed unmarshals an instance of BareMetalServerProfileCpuSocketCountFixed from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuSocketCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuSocketCountFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCpuSocketCountRange : The permitted range for the number of CPU sockets for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileCpuSocketCount -type BareMetalServerProfileCpuSocketCountRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuSocketCountRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuSocketCountRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileCpuSocketCountRange) isaBareMetalServerProfileCpuSocketCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuSocketCountRange unmarshals an instance of BareMetalServerProfileCpuSocketCountRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuSocketCountRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuSocketCountRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskQuantityDependent : The number of disks of this configuration for a bare metal server with this profile depends on its bare metal server -// configuration. -// This model "extends" BareMetalServerProfileDiskQuantity -type BareMetalServerProfileDiskQuantityDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskQuantityDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskQuantityDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileDiskQuantityDependent) isaBareMetalServerProfileDiskQuantity() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskQuantityDependent unmarshals an instance of BareMetalServerProfileDiskQuantityDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskQuantityDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskQuantityDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskQuantityEnum : The permitted the number of disks of this configuration for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileDiskQuantity -type BareMetalServerProfileDiskQuantityEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskQuantityEnum.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskQuantityEnumTypeEnumConst = "enum" -) - -func (*BareMetalServerProfileDiskQuantityEnum) isaBareMetalServerProfileDiskQuantity() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskQuantityEnum unmarshals an instance of BareMetalServerProfileDiskQuantityEnum from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskQuantityEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskQuantityEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskQuantityFixed : The number of disks of this configuration for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileDiskQuantity -type BareMetalServerProfileDiskQuantityFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskQuantityFixed.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskQuantityFixedTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileDiskQuantityFixed) isaBareMetalServerProfileDiskQuantity() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskQuantityFixed unmarshals an instance of BareMetalServerProfileDiskQuantityFixed from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskQuantityFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskQuantityFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskQuantityRange : The permitted range for the number of disks of this configuration for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileDiskQuantity -type BareMetalServerProfileDiskQuantityRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskQuantityRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskQuantityRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileDiskQuantityRange) isaBareMetalServerProfileDiskQuantity() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskQuantityRange unmarshals an instance of BareMetalServerProfileDiskQuantityRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskQuantityRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskQuantityRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskSizeDependent : The disk size in GB (gigabytes) of this configuration for a bare metal server with this profile depends on its bare -// metal server configuration. -// This model "extends" BareMetalServerProfileDiskSize -type BareMetalServerProfileDiskSizeDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskSizeDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSizeDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileDiskSizeDependent) isaBareMetalServerProfileDiskSize() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskSizeDependent unmarshals an instance of BareMetalServerProfileDiskSizeDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSizeDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSizeDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskSizeEnum : The permitted disk size in GB (gigabytes) of this configuration for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileDiskSize -type BareMetalServerProfileDiskSizeEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskSizeEnum.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSizeEnumTypeEnumConst = "enum" -) - -func (*BareMetalServerProfileDiskSizeEnum) isaBareMetalServerProfileDiskSize() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskSizeEnum unmarshals an instance of BareMetalServerProfileDiskSizeEnum from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSizeEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSizeEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskSizeFixed : The size of the disk in GB (gigabytes). -// This model "extends" BareMetalServerProfileDiskSize -type BareMetalServerProfileDiskSizeFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskSizeFixed.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSizeFixedTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileDiskSizeFixed) isaBareMetalServerProfileDiskSize() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskSizeFixed unmarshals an instance of BareMetalServerProfileDiskSizeFixed from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSizeFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSizeFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskSizeRange : The permitted range for the disk size of this configuration in GB (gigabytes) for a bare metal server with this -// profile. -// This model "extends" BareMetalServerProfileDiskSize -type BareMetalServerProfileDiskSizeRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskSizeRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSizeRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileDiskSizeRange) isaBareMetalServerProfileDiskSize() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskSizeRange unmarshals an instance of BareMetalServerProfileDiskSizeRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSizeRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSizeRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileIdentityByHref : BareMetalServerProfileIdentityByHref struct -// This model "extends" BareMetalServerProfileIdentity -type BareMetalServerProfileIdentityByHref struct { - // The URL for this bare metal server profile. - Href *string `json:"href" validate:"required"` -} - -// NewBareMetalServerProfileIdentityByHref : Instantiate BareMetalServerProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerProfileIdentityByHref(href string) (_model *BareMetalServerProfileIdentityByHref, err error) { - _model = &BareMetalServerProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerProfileIdentityByHref) isaBareMetalServerProfileIdentity() bool { - return true -} - -// UnmarshalBareMetalServerProfileIdentityByHref unmarshals an instance of BareMetalServerProfileIdentityByHref from the specified map of raw messages. -func UnmarshalBareMetalServerProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileIdentityByName : BareMetalServerProfileIdentityByName struct -// This model "extends" BareMetalServerProfileIdentity -type BareMetalServerProfileIdentityByName struct { - // The name for this bare metal server profile. - Name *string `json:"name" validate:"required"` -} - -// NewBareMetalServerProfileIdentityByName : Instantiate BareMetalServerProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerProfileIdentityByName(name string) (_model *BareMetalServerProfileIdentityByName, err error) { - _model = &BareMetalServerProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerProfileIdentityByName) isaBareMetalServerProfileIdentity() bool { - return true -} - -// UnmarshalBareMetalServerProfileIdentityByName unmarshals an instance of BareMetalServerProfileIdentityByName from the specified map of raw messages. -func UnmarshalBareMetalServerProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileMemoryDependent : The memory value for a bare metal server with this profile depends on its configuration. -// This model "extends" BareMetalServerProfileMemory -type BareMetalServerProfileMemoryDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileMemoryDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileMemoryDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileMemoryDependent) isaBareMetalServerProfileMemory() bool { - return true -} - -// UnmarshalBareMetalServerProfileMemoryDependent unmarshals an instance of BareMetalServerProfileMemoryDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileMemoryDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileMemoryEnum : The permitted memory values (in gibibytes) for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileMemory -type BareMetalServerProfileMemoryEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileMemoryEnum.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileMemoryEnumTypeEnumConst = "enum" -) - -func (*BareMetalServerProfileMemoryEnum) isaBareMetalServerProfileMemory() bool { - return true -} - -// UnmarshalBareMetalServerProfileMemoryEnum unmarshals an instance of BareMetalServerProfileMemoryEnum from the specified map of raw messages. -func UnmarshalBareMetalServerProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileMemoryEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileMemoryFixed : The memory (in gibibytes) for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileMemory -type BareMetalServerProfileMemoryFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileMemoryFixed.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileMemoryFixedTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileMemoryFixed) isaBareMetalServerProfileMemory() bool { - return true -} - -// UnmarshalBareMetalServerProfileMemoryFixed unmarshals an instance of BareMetalServerProfileMemoryFixed from the specified map of raw messages. -func UnmarshalBareMetalServerProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileMemoryFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileMemoryRange : The permitted memory range (in gibibytes) for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileMemory -type BareMetalServerProfileMemoryRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileMemoryRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileMemoryRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileMemoryRange) isaBareMetalServerProfileMemory() bool { - return true -} - -// UnmarshalBareMetalServerProfileMemoryRange unmarshals an instance of BareMetalServerProfileMemoryRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileMemoryRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileNetworkAttachmentCountDependent : The number of network attachments supported on a bare metal server with this profile is dependent on its -// configuration. -// This model "extends" BareMetalServerProfileNetworkAttachmentCount -type BareMetalServerProfileNetworkAttachmentCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileNetworkAttachmentCountDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkAttachmentCountDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileNetworkAttachmentCountDependent) isaBareMetalServerProfileNetworkAttachmentCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent unmarshals an instance of BareMetalServerProfileNetworkAttachmentCountDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileNetworkAttachmentCountDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileNetworkAttachmentCountRange : The number of network attachments supported on a bare metal server with this profile. -// This model "extends" BareMetalServerProfileNetworkAttachmentCount -type BareMetalServerProfileNetworkAttachmentCountRange struct { - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileNetworkAttachmentCountRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkAttachmentCountRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileNetworkAttachmentCountRange) isaBareMetalServerProfileNetworkAttachmentCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileNetworkAttachmentCountRange unmarshals an instance of BareMetalServerProfileNetworkAttachmentCountRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileNetworkAttachmentCountRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileNetworkAttachmentCountRange) - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileNetworkInterfaceCountDependent : The number of bare metal server network interfaces supported on a bare metal server with this profile is dependent on -// its configuration. -// This model "extends" BareMetalServerProfileNetworkInterfaceCount -type BareMetalServerProfileNetworkInterfaceCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileNetworkInterfaceCountDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkInterfaceCountDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileNetworkInterfaceCountDependent) isaBareMetalServerProfileNetworkInterfaceCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent unmarshals an instance of BareMetalServerProfileNetworkInterfaceCountDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileNetworkInterfaceCountDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileNetworkInterfaceCountRange : The number of bare metal server network interfaces supported on a bare metal server with this profile. -// This model "extends" BareMetalServerProfileNetworkInterfaceCount -type BareMetalServerProfileNetworkInterfaceCountRange struct { - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileNetworkInterfaceCountRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkInterfaceCountRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileNetworkInterfaceCountRange) isaBareMetalServerProfileNetworkInterfaceCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileNetworkInterfaceCountRange unmarshals an instance of BareMetalServerProfileNetworkInterfaceCountRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileNetworkInterfaceCountRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileNetworkInterfaceCountRange) - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPrototypeBareMetalServerByNetworkAttachment : BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct -// This model "extends" BareMetalServerPrototype -type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { - // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to - // boot. - EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` - - Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` - - // The name for this bare metal server. The name must not be used by another bare metal server in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) to use for this bare metal - // server. - Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` - - // The VPC this bare metal server will reside in. - // - // If specified, it must match the VPC for the subnets that the network attachments or network interfaces of the bare - // metal server are attached to. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The zone this bare metal server will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the bare metal server. - NetworkAttachments []BareMetalServerNetworkAttachmentPrototypeIntf `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the bare metal server. - PrimaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf `json:"primary_network_attachment" validate:"required"` -} - -// NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment : Instantiate BareMetalServerPrototypeBareMetalServerByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf) (_model *BareMetalServerPrototypeBareMetalServerByNetworkAttachment, err error) { - _model = &BareMetalServerPrototypeBareMetalServerByNetworkAttachment{ - Initialization: initialization, - Profile: profile, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerPrototypeBareMetalServerByNetworkAttachment) isaBareMetalServerPrototype() bool { - return true -} - -// UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkAttachment from the specified map of raw messages. -func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototypeBareMetalServerByNetworkAttachment) - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) - if err != nil { - return - } - err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPrototypeBareMetalServerByNetworkInterface : BareMetalServerPrototypeBareMetalServerByNetworkInterface struct -// This model "extends" BareMetalServerPrototype -type BareMetalServerPrototypeBareMetalServerByNetworkInterface struct { - // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to - // boot. - EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` - - Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` - - // The name for this bare metal server. The name must not be used by another bare metal server in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) to use for this bare metal - // server. - Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` - - // The VPC this bare metal server will reside in. - // - // If specified, it must match the VPC for the subnets that the network attachments or network interfaces of the bare - // metal server are attached to. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The zone this bare metal server will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional bare metal server network interfaces to create. - NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` - - // The primary bare metal server network interface to create. - PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewBareMetalServerPrototypeBareMetalServerByNetworkInterface : Instantiate BareMetalServerPrototypeBareMetalServerByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkInterface(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype) (_model *BareMetalServerPrototypeBareMetalServerByNetworkInterface, err error) { - _model = &BareMetalServerPrototypeBareMetalServerByNetworkInterface{ - Initialization: initialization, - Profile: profile, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerPrototypeBareMetalServerByNetworkInterface) isaBareMetalServerPrototype() bool { - return true -} - -// UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkInterface from the specified map of raw messages. -func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototypeBareMetalServerByNetworkInterface) - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) - if err != nil { - return - } - err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CatalogOfferingIdentityCatalogOfferingByCRN : CatalogOfferingIdentityCatalogOfferingByCRN struct -// This model "extends" CatalogOfferingIdentity -type CatalogOfferingIdentityCatalogOfferingByCRN struct { - // The CRN for this - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. - CRN *string `json:"crn" validate:"required"` -} - -// NewCatalogOfferingIdentityCatalogOfferingByCRN : Instantiate CatalogOfferingIdentityCatalogOfferingByCRN (Generic Model Constructor) -func (*VpcV1) NewCatalogOfferingIdentityCatalogOfferingByCRN(crn string) (_model *CatalogOfferingIdentityCatalogOfferingByCRN, err error) { - _model = &CatalogOfferingIdentityCatalogOfferingByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*CatalogOfferingIdentityCatalogOfferingByCRN) isaCatalogOfferingIdentity() bool { - return true -} - -// UnmarshalCatalogOfferingIdentityCatalogOfferingByCRN unmarshals an instance of CatalogOfferingIdentityCatalogOfferingByCRN from the specified map of raw messages. -func UnmarshalCatalogOfferingIdentityCatalogOfferingByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingIdentityCatalogOfferingByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN : CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN struct -// This model "extends" CatalogOfferingVersionIdentity -type CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN struct { - // The CRN for this version of a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. - CRN *string `json:"crn" validate:"required"` -} - -// NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN : Instantiate CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN (Generic Model Constructor) -func (*VpcV1) NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(crn string) (_model *CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN, err error) { - _model = &CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN) isaCatalogOfferingVersionIdentity() bool { - return true -} - -// UnmarshalCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN unmarshals an instance of CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN from the specified map of raw messages. -func UnmarshalCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CertificateInstanceIdentityByCRN : CertificateInstanceIdentityByCRN struct -// This model "extends" CertificateInstanceIdentity -type CertificateInstanceIdentityByCRN struct { - // The CRN for this certificate instance. - CRN *string `json:"crn" validate:"required"` -} - -// NewCertificateInstanceIdentityByCRN : Instantiate CertificateInstanceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewCertificateInstanceIdentityByCRN(crn string) (_model *CertificateInstanceIdentityByCRN, err error) { - _model = &CertificateInstanceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*CertificateInstanceIdentityByCRN) isaCertificateInstanceIdentity() bool { - return true -} - -// UnmarshalCertificateInstanceIdentityByCRN unmarshals an instance of CertificateInstanceIdentityByCRN from the specified map of raw messages. -func UnmarshalCertificateInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CertificateInstanceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CloudObjectStorageBucketIdentityByCRN : CloudObjectStorageBucketIdentityByCRN struct -// This model "extends" CloudObjectStorageBucketIdentity -type CloudObjectStorageBucketIdentityByCRN struct { - // The CRN of this Cloud Object Storage bucket. - CRN *string `json:"crn" validate:"required"` -} - -// NewCloudObjectStorageBucketIdentityByCRN : Instantiate CloudObjectStorageBucketIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewCloudObjectStorageBucketIdentityByCRN(crn string) (_model *CloudObjectStorageBucketIdentityByCRN, err error) { - _model = &CloudObjectStorageBucketIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*CloudObjectStorageBucketIdentityByCRN) isaCloudObjectStorageBucketIdentity() bool { - return true -} - -// UnmarshalCloudObjectStorageBucketIdentityByCRN unmarshals an instance of CloudObjectStorageBucketIdentityByCRN from the specified map of raw messages. -func UnmarshalCloudObjectStorageBucketIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CloudObjectStorageBucketIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct -// This model "extends" CloudObjectStorageBucketIdentity -type CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct { - // The globally unique name of this Cloud Object Storage bucket. - Name *string `json:"name" validate:"required"` -} - -// NewCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : Instantiate CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName (Generic Model Constructor) -func (*VpcV1) NewCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name string) (_model *CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName, err error) { - _model = &CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) isaCloudObjectStorageBucketIdentity() bool { - return true -} - -// UnmarshalCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName unmarshals an instance of CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName from the specified map of raw messages. -func UnmarshalCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DnsInstanceIdentityByCRN : DnsInstanceIdentityByCRN struct -// This model "extends" DnsInstanceIdentity -type DnsInstanceIdentityByCRN struct { - // The CRN for this DNS instance. - CRN *string `json:"crn" validate:"required"` -} - -// NewDnsInstanceIdentityByCRN : Instantiate DnsInstanceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewDnsInstanceIdentityByCRN(crn string) (_model *DnsInstanceIdentityByCRN, err error) { - _model = &DnsInstanceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*DnsInstanceIdentityByCRN) isaDnsInstanceIdentity() bool { - return true -} - -// UnmarshalDnsInstanceIdentityByCRN unmarshals an instance of DnsInstanceIdentityByCRN from the specified map of raw messages. -func UnmarshalDnsInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsInstanceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DnsZoneIdentityByID : DnsZoneIdentityByID struct -// This model "extends" DnsZoneIdentity -type DnsZoneIdentityByID struct { - ID *string `json:"id" validate:"required"` -} - -// NewDnsZoneIdentityByID : Instantiate DnsZoneIdentityByID (Generic Model Constructor) -func (*VpcV1) NewDnsZoneIdentityByID(id string) (_model *DnsZoneIdentityByID, err error) { - _model = &DnsZoneIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*DnsZoneIdentityByID) isaDnsZoneIdentity() bool { - return true -} - -// UnmarshalDnsZoneIdentityByID unmarshals an instance of DnsZoneIdentityByID from the specified map of raw messages. -func UnmarshalDnsZoneIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsZoneIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostGroupIdentityByCRN : DedicatedHostGroupIdentityByCRN struct -// This model "extends" DedicatedHostGroupIdentity -type DedicatedHostGroupIdentityByCRN struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` -} - -// NewDedicatedHostGroupIdentityByCRN : Instantiate DedicatedHostGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostGroupIdentityByCRN(crn string) (_model *DedicatedHostGroupIdentityByCRN, err error) { - _model = &DedicatedHostGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*DedicatedHostGroupIdentityByCRN) isaDedicatedHostGroupIdentity() bool { - return true -} - -// UnmarshalDedicatedHostGroupIdentityByCRN unmarshals an instance of DedicatedHostGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostGroupIdentityByHref : DedicatedHostGroupIdentityByHref struct -// This model "extends" DedicatedHostGroupIdentity -type DedicatedHostGroupIdentityByHref struct { - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` -} - -// NewDedicatedHostGroupIdentityByHref : Instantiate DedicatedHostGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostGroupIdentityByHref(href string) (_model *DedicatedHostGroupIdentityByHref, err error) { - _model = &DedicatedHostGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*DedicatedHostGroupIdentityByHref) isaDedicatedHostGroupIdentity() bool { - return true -} - -// UnmarshalDedicatedHostGroupIdentityByHref unmarshals an instance of DedicatedHostGroupIdentityByHref from the specified map of raw messages. -func UnmarshalDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostGroupIdentityByID : DedicatedHostGroupIdentityByID struct -// This model "extends" DedicatedHostGroupIdentity -type DedicatedHostGroupIdentityByID struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` -} - -// NewDedicatedHostGroupIdentityByID : Instantiate DedicatedHostGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostGroupIdentityByID(id string) (_model *DedicatedHostGroupIdentityByID, err error) { - _model = &DedicatedHostGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*DedicatedHostGroupIdentityByID) isaDedicatedHostGroupIdentity() bool { - return true -} - -// UnmarshalDedicatedHostGroupIdentityByID unmarshals an instance of DedicatedHostGroupIdentityByID from the specified map of raw messages. -func UnmarshalDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileIdentityByHref : DedicatedHostProfileIdentityByHref struct -// This model "extends" DedicatedHostProfileIdentity -type DedicatedHostProfileIdentityByHref struct { - // The URL for this dedicated host profile. - Href *string `json:"href" validate:"required"` -} - -// NewDedicatedHostProfileIdentityByHref : Instantiate DedicatedHostProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostProfileIdentityByHref(href string) (_model *DedicatedHostProfileIdentityByHref, err error) { - _model = &DedicatedHostProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*DedicatedHostProfileIdentityByHref) isaDedicatedHostProfileIdentity() bool { - return true -} - -// UnmarshalDedicatedHostProfileIdentityByHref unmarshals an instance of DedicatedHostProfileIdentityByHref from the specified map of raw messages. -func UnmarshalDedicatedHostProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileIdentityByName : DedicatedHostProfileIdentityByName struct -// This model "extends" DedicatedHostProfileIdentity -type DedicatedHostProfileIdentityByName struct { - // The globally unique name for this dedicated host profile. - Name *string `json:"name" validate:"required"` -} - -// NewDedicatedHostProfileIdentityByName : Instantiate DedicatedHostProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostProfileIdentityByName(name string) (_model *DedicatedHostProfileIdentityByName, err error) { - _model = &DedicatedHostProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*DedicatedHostProfileIdentityByName) isaDedicatedHostProfileIdentity() bool { - return true -} - -// UnmarshalDedicatedHostProfileIdentityByName unmarshals an instance of DedicatedHostProfileIdentityByName from the specified map of raw messages. -func UnmarshalDedicatedHostProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileMemoryDependent : The memory value for a dedicated host with this profile depends on its configuration. -// This model "extends" DedicatedHostProfileMemory -type DedicatedHostProfileMemoryDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileMemoryDependent.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileMemoryDependentTypeDependentConst = "dependent" -) - -func (*DedicatedHostProfileMemoryDependent) isaDedicatedHostProfileMemory() bool { - return true -} - -// UnmarshalDedicatedHostProfileMemoryDependent unmarshals an instance of DedicatedHostProfileMemoryDependent from the specified map of raw messages. -func UnmarshalDedicatedHostProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileMemoryDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileMemoryEnum : The permitted memory values (in gibibytes) for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileMemory -type DedicatedHostProfileMemoryEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileMemoryEnum.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileMemoryEnumTypeEnumConst = "enum" -) - -func (*DedicatedHostProfileMemoryEnum) isaDedicatedHostProfileMemory() bool { - return true -} - -// UnmarshalDedicatedHostProfileMemoryEnum unmarshals an instance of DedicatedHostProfileMemoryEnum from the specified map of raw messages. -func UnmarshalDedicatedHostProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileMemoryEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileMemoryFixed : The memory (in gibibytes) for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileMemory -type DedicatedHostProfileMemoryFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileMemoryFixed.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileMemoryFixedTypeFixedConst = "fixed" -) - -func (*DedicatedHostProfileMemoryFixed) isaDedicatedHostProfileMemory() bool { - return true -} - -// UnmarshalDedicatedHostProfileMemoryFixed unmarshals an instance of DedicatedHostProfileMemoryFixed from the specified map of raw messages. -func UnmarshalDedicatedHostProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileMemoryFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileMemoryRange : The permitted memory range (in gibibytes) for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileMemory -type DedicatedHostProfileMemoryRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileMemoryRange.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileMemoryRangeTypeRangeConst = "range" -) - -func (*DedicatedHostProfileMemoryRange) isaDedicatedHostProfileMemory() bool { - return true -} - -// UnmarshalDedicatedHostProfileMemoryRange unmarshals an instance of DedicatedHostProfileMemoryRange from the specified map of raw messages. -func UnmarshalDedicatedHostProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileMemoryRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileSocketDependent : The CPU socket count for a dedicated host with this profile depends on its configuration. -// This model "extends" DedicatedHostProfileSocket -type DedicatedHostProfileSocketDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileSocketDependent.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileSocketDependentTypeDependentConst = "dependent" -) - -func (*DedicatedHostProfileSocketDependent) isaDedicatedHostProfileSocket() bool { - return true -} - -// UnmarshalDedicatedHostProfileSocketDependent unmarshals an instance of DedicatedHostProfileSocketDependent from the specified map of raw messages. -func UnmarshalDedicatedHostProfileSocketDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileSocketDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileSocketEnum : The permitted values for CPU socket count for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileSocket -type DedicatedHostProfileSocketEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileSocketEnum.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileSocketEnumTypeEnumConst = "enum" -) - -func (*DedicatedHostProfileSocketEnum) isaDedicatedHostProfileSocket() bool { - return true -} - -// UnmarshalDedicatedHostProfileSocketEnum unmarshals an instance of DedicatedHostProfileSocketEnum from the specified map of raw messages. -func UnmarshalDedicatedHostProfileSocketEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileSocketEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileSocketFixed : The CPU socket count for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileSocket -type DedicatedHostProfileSocketFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileSocketFixed.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileSocketFixedTypeFixedConst = "fixed" -) - -func (*DedicatedHostProfileSocketFixed) isaDedicatedHostProfileSocket() bool { - return true -} - -// UnmarshalDedicatedHostProfileSocketFixed unmarshals an instance of DedicatedHostProfileSocketFixed from the specified map of raw messages. -func UnmarshalDedicatedHostProfileSocketFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileSocketFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileSocketRange : The permitted range for CPU socket count for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileSocket -type DedicatedHostProfileSocketRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileSocketRange.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileSocketRangeTypeRangeConst = "range" -) - -func (*DedicatedHostProfileSocketRange) isaDedicatedHostProfileSocket() bool { - return true -} - -// UnmarshalDedicatedHostProfileSocketRange unmarshals an instance of DedicatedHostProfileSocketRange from the specified map of raw messages. -func UnmarshalDedicatedHostProfileSocketRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileSocketRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileVcpuDependent : The VCPU count for a dedicated host with this profile depends on its configuration. -// This model "extends" DedicatedHostProfileVcpu -type DedicatedHostProfileVcpuDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileVcpuDependent.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuDependentTypeDependentConst = "dependent" -) - -func (*DedicatedHostProfileVcpuDependent) isaDedicatedHostProfileVcpu() bool { - return true -} - -// UnmarshalDedicatedHostProfileVcpuDependent unmarshals an instance of DedicatedHostProfileVcpuDependent from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpuDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileVcpuEnum : The permitted values for VCPU count for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileVcpu -type DedicatedHostProfileVcpuEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileVcpuEnum.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuEnumTypeEnumConst = "enum" -) - -func (*DedicatedHostProfileVcpuEnum) isaDedicatedHostProfileVcpu() bool { - return true -} - -// UnmarshalDedicatedHostProfileVcpuEnum unmarshals an instance of DedicatedHostProfileVcpuEnum from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpuEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileVcpuFixed : The VCPU count for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileVcpu -type DedicatedHostProfileVcpuFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileVcpuFixed.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuFixedTypeFixedConst = "fixed" -) - -func (*DedicatedHostProfileVcpuFixed) isaDedicatedHostProfileVcpu() bool { - return true -} - -// UnmarshalDedicatedHostProfileVcpuFixed unmarshals an instance of DedicatedHostProfileVcpuFixed from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpuFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileVcpuRange : The permitted range for VCPU count for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileVcpu -type DedicatedHostProfileVcpuRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileVcpuRange.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuRangeTypeRangeConst = "range" -) - -func (*DedicatedHostProfileVcpuRange) isaDedicatedHostProfileVcpu() bool { - return true -} - -// UnmarshalDedicatedHostProfileVcpuRange unmarshals an instance of DedicatedHostProfileVcpuRange from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpuRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpuRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostPrototypeDedicatedHostByGroup : DedicatedHostPrototypeDedicatedHostByGroup struct -// This model "extends" DedicatedHostPrototype -type DedicatedHostPrototypeDedicatedHostByGroup struct { - // If set to true, instances can be placed on this dedicated host. - InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` - - // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this dedicated host. - Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The dedicated host group for this dedicated host. - Group DedicatedHostGroupIdentityIntf `json:"group" validate:"required"` -} - -// NewDedicatedHostPrototypeDedicatedHostByGroup : Instantiate DedicatedHostPrototypeDedicatedHostByGroup (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByGroup(profile DedicatedHostProfileIdentityIntf, group DedicatedHostGroupIdentityIntf) (_model *DedicatedHostPrototypeDedicatedHostByGroup, err error) { - _model = &DedicatedHostPrototypeDedicatedHostByGroup{ - Profile: profile, - Group: group, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*DedicatedHostPrototypeDedicatedHostByGroup) isaDedicatedHostPrototype() bool { - return true -} - -// UnmarshalDedicatedHostPrototypeDedicatedHostByGroup unmarshals an instance of DedicatedHostPrototypeDedicatedHostByGroup from the specified map of raw messages. -func UnmarshalDedicatedHostPrototypeDedicatedHostByGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostPrototypeDedicatedHostByGroup) - err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostPrototypeDedicatedHostByZone : DedicatedHostPrototypeDedicatedHostByZone struct -// This model "extends" DedicatedHostPrototype -type DedicatedHostPrototypeDedicatedHostByZone struct { - // If set to true, instances can be placed on this dedicated host. - InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` - - // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this dedicated host. - Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - Group *DedicatedHostGroupPrototypeDedicatedHostByZoneContext `json:"group,omitempty"` - - // The zone this dedicated host will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -// NewDedicatedHostPrototypeDedicatedHostByZone : Instantiate DedicatedHostPrototypeDedicatedHostByZone (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByZone(profile DedicatedHostProfileIdentityIntf, zone ZoneIdentityIntf) (_model *DedicatedHostPrototypeDedicatedHostByZone, err error) { - _model = &DedicatedHostPrototypeDedicatedHostByZone{ - Profile: profile, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*DedicatedHostPrototypeDedicatedHostByZone) isaDedicatedHostPrototype() bool { - return true -} - -// UnmarshalDedicatedHostPrototypeDedicatedHostByZone unmarshals an instance of DedicatedHostPrototypeDedicatedHostByZone from the specified map of raw messages. -func UnmarshalDedicatedHostPrototypeDedicatedHostByZone(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostPrototypeDedicatedHostByZone) - err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EncryptionKeyIdentityByCRN : EncryptionKeyIdentityByCRN struct -// This model "extends" EncryptionKeyIdentity -type EncryptionKeyIdentityByCRN struct { - // The CRN of the [Key Protect Root - // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto - // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. - CRN *string `json:"crn" validate:"required"` -} - -// NewEncryptionKeyIdentityByCRN : Instantiate EncryptionKeyIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewEncryptionKeyIdentityByCRN(crn string) (_model *EncryptionKeyIdentityByCRN, err error) { - _model = &EncryptionKeyIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*EncryptionKeyIdentityByCRN) isaEncryptionKeyIdentity() bool { - return true -} - -// UnmarshalEncryptionKeyIdentityByCRN unmarshals an instance of EncryptionKeyIdentityByCRN from the specified map of raw messages. -func UnmarshalEncryptionKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EncryptionKeyIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayReservedIPReservedIPIdentity : Identifies a reserved IP by a unique property. -// Models which "extend" this model: -// - EndpointGatewayReservedIPReservedIPIdentityByID -// - EndpointGatewayReservedIPReservedIPIdentityByHref -// This model "extends" EndpointGatewayReservedIP -type EndpointGatewayReservedIPReservedIPIdentity struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` -} - -func (*EndpointGatewayReservedIPReservedIPIdentity) isaEndpointGatewayReservedIPReservedIPIdentity() bool { - return true -} - -type EndpointGatewayReservedIPReservedIPIdentityIntf interface { - EndpointGatewayReservedIPIntf - isaEndpointGatewayReservedIPReservedIPIdentity() bool -} - -func (*EndpointGatewayReservedIPReservedIPIdentity) isaEndpointGatewayReservedIP() bool { - return true -} - -// UnmarshalEndpointGatewayReservedIPReservedIPIdentity unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentity from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIPReservedIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIPReservedIPIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayReservedIPReservedIPPrototypeTargetContext : EndpointGatewayReservedIPReservedIPPrototypeTargetContext struct -// This model "extends" EndpointGatewayReservedIP -type EndpointGatewayReservedIPReservedIPPrototypeTargetContext struct { - // The IP address to reserve, which must not already be reserved on the subnet. - // - // If unspecified, an available address on the subnet will automatically be selected. - Address *string `json:"address,omitempty"` - - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with - // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated - // list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The subnet in which to create this reserved IP. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` -} - -// NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext : Instantiate EndpointGatewayReservedIPReservedIPPrototypeTargetContext (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext(subnet SubnetIdentityIntf) (_model *EndpointGatewayReservedIPReservedIPPrototypeTargetContext, err error) { - _model = &EndpointGatewayReservedIPReservedIPPrototypeTargetContext{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*EndpointGatewayReservedIPReservedIPPrototypeTargetContext) isaEndpointGatewayReservedIP() bool { - return true -} - -// UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext unmarshals an instance of EndpointGatewayReservedIPReservedIPPrototypeTargetContext from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIPReservedIPPrototypeTargetContext) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayTargetPrototypeProviderCloudServiceIdentity : EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct -// Models which "extend" this model: -// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN -// This model "extends" EndpointGatewayTargetPrototype -type EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. - CRN *string `json:"crn,omitempty"` -} - -// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentity.ResourceType property. -// The type of target for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { - return true -} - -type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityIntf interface { - EndpointGatewayTargetPrototypeIntf - isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool -} - -func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototype() bool { - return true -} - -// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentity from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity : EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct -// Models which "extend" this model: -// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName -// This model "extends" EndpointGatewayTargetPrototype -type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - - // The name of a provider infrastructure service. Must be: - // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. - Name *string `json:"name,omitempty"` -} - -// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity.ResourceType property. -// The type of target for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { - return true -} - -type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityIntf interface { - EndpointGatewayTargetPrototypeIntf - isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool -} - -func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototype() bool { - return true -} - -// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayTargetProviderCloudServiceReference : EndpointGatewayTargetProviderCloudServiceReference struct -// This model "extends" EndpointGatewayTarget -type EndpointGatewayTargetProviderCloudServiceReference struct { - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. - CRN *string `json:"crn" validate:"required"` - - // The type of target. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the EndpointGatewayTargetProviderCloudServiceReference.ResourceType property. -// The type of target. -const ( - EndpointGatewayTargetProviderCloudServiceReferenceResourceTypeProviderCloudServiceConst = "provider_cloud_service" -) - -func (*EndpointGatewayTargetProviderCloudServiceReference) isaEndpointGatewayTarget() bool { - return true -} - -// UnmarshalEndpointGatewayTargetProviderCloudServiceReference unmarshals an instance of EndpointGatewayTargetProviderCloudServiceReference from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetProviderCloudServiceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetProviderCloudServiceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayTargetProviderInfrastructureServiceReference : The name of this provider infrastructure service. -// This model "extends" EndpointGatewayTarget -type EndpointGatewayTargetProviderInfrastructureServiceReference struct { - // The name of a provider infrastructure service. Must be: - // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. - Name *string `json:"name" validate:"required"` - - // The type of target. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the EndpointGatewayTargetProviderInfrastructureServiceReference.ResourceType property. -// The type of target. -const ( - EndpointGatewayTargetProviderInfrastructureServiceReferenceResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -func (*EndpointGatewayTargetProviderInfrastructureServiceReference) isaEndpointGatewayTarget() bool { - return true -} - -// UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference unmarshals an instance of EndpointGatewayTargetProviderInfrastructureServiceReference from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetProviderInfrastructureServiceReference) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPPrototypeFloatingIPByTarget : FloatingIPPrototypeFloatingIPByTarget struct -// This model "extends" FloatingIPPrototype -type FloatingIPPrototypeFloatingIPByTarget struct { - // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The target resource to bind this floating IP to. - // - // The target resource must not already have a floating IP bound to it if the target - // resource is: - // - // - an instance network interface - // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` - // - a virtual network interface with `enable_infrastructure_nat` set to `true`. - Target FloatingIPTargetPrototypeIntf `json:"target" validate:"required"` -} - -// NewFloatingIPPrototypeFloatingIPByTarget : Instantiate FloatingIPPrototypeFloatingIPByTarget (Generic Model Constructor) -func (*VpcV1) NewFloatingIPPrototypeFloatingIPByTarget(target FloatingIPTargetPrototypeIntf) (_model *FloatingIPPrototypeFloatingIPByTarget, err error) { - _model = &FloatingIPPrototypeFloatingIPByTarget{ - Target: target, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPPrototypeFloatingIPByTarget) isaFloatingIPPrototype() bool { - return true -} - -// UnmarshalFloatingIPPrototypeFloatingIPByTarget unmarshals an instance of FloatingIPPrototypeFloatingIPByTarget from the specified map of raw messages. -func UnmarshalFloatingIPPrototypeFloatingIPByTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPPrototypeFloatingIPByTarget) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPPrototypeFloatingIPByZone : FloatingIPPrototypeFloatingIPByZone struct -// This model "extends" FloatingIPPrototype -type FloatingIPPrototypeFloatingIPByZone struct { - // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The zone this floating IP will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -// NewFloatingIPPrototypeFloatingIPByZone : Instantiate FloatingIPPrototypeFloatingIPByZone (Generic Model Constructor) -func (*VpcV1) NewFloatingIPPrototypeFloatingIPByZone(zone ZoneIdentityIntf) (_model *FloatingIPPrototypeFloatingIPByZone, err error) { - _model = &FloatingIPPrototypeFloatingIPByZone{ - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPPrototypeFloatingIPByZone) isaFloatingIPPrototype() bool { - return true -} - -// UnmarshalFloatingIPPrototypeFloatingIPByZone unmarshals an instance of FloatingIPPrototypeFloatingIPByZone from the specified map of raw messages. -func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPPrototypeFloatingIPByZone) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity : Identifies a bare metal server network interface by a unique property. -// Models which "extend" this model: -// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID -// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref -// This model "extends" FloatingIPTargetPatch -type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity struct { - // The unique identifier for this bare metal server network interface. - ID *string `json:"id,omitempty"` - - // The URL for this bare metal server network interface. - Href *string `json:"href,omitempty"` -} - -func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { - return true -} - -type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityIntf interface { - FloatingIPTargetPatchIntf - isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool -} - -func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatchNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. -// Models which "extend" this model: -// - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID -// - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref -// This model "extends" FloatingIPTargetPatch -type FloatingIPTargetPatchNetworkInterfaceIdentity struct { - // The unique identifier for this instance network interface. - ID *string `json:"id,omitempty"` - - // The URL for this instance network interface. - Href *string `json:"href,omitempty"` -} - -func (*FloatingIPTargetPatchNetworkInterfaceIdentity) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { - return true -} - -type FloatingIPTargetPatchNetworkInterfaceIdentityIntf interface { - FloatingIPTargetPatchIntf - isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool -} - -func (*FloatingIPTargetPatchNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatchVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" FloatingIPTargetPatch -type FloatingIPTargetPatchVirtualNetworkInterfaceIdentity struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { - return true -} - -type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityIntf interface { - FloatingIPTargetPatchIntf - isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity : Identifies a bare metal server network interface by a unique property. -// Models which "extend" this model: -// - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID -// - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref -// This model "extends" FloatingIPTargetPrototype -type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity struct { - // The unique identifier for this bare metal server network interface. - ID *string `json:"id,omitempty"` - - // The URL for this bare metal server network interface. - Href *string `json:"href,omitempty"` -} - -func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { - return true -} - -type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityIntf interface { - FloatingIPTargetPrototypeIntf - isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool -} - -func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPrototypeNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. -// Models which "extend" this model: -// - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID -// - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref -// This model "extends" FloatingIPTargetPrototype -type FloatingIPTargetPrototypeNetworkInterfaceIdentity struct { - // The unique identifier for this instance network interface. - ID *string `json:"id,omitempty"` - - // The URL for this instance network interface. - Href *string `json:"href,omitempty"` -} - -func (*FloatingIPTargetPrototypeNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { - return true -} - -type FloatingIPTargetPrototypeNetworkInterfaceIdentityIntf interface { - FloatingIPTargetPrototypeIntf - isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool -} - -func (*FloatingIPTargetPrototypeNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" FloatingIPTargetPrototype -type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { - FloatingIPTargetPrototypeIntf - isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetBareMetalServerNetworkInterfaceReference : FloatingIPTargetBareMetalServerNetworkInterfaceReference struct -// This model "extends" FloatingIPTarget -type FloatingIPTargetBareMetalServerNetworkInterfaceReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BareMetalServerNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this bare metal server network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network interface. - ID *string `json:"id" validate:"required"` - - // The name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FloatingIPTargetBareMetalServerNetworkInterfaceReference.ResourceType property. -// The resource type. -const ( - FloatingIPTargetBareMetalServerNetworkInterfaceReferenceResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*FloatingIPTargetBareMetalServerNetworkInterfaceReference) isaFloatingIPTarget() bool { - return true -} - -// UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference unmarshals an instance of FloatingIPTargetBareMetalServerNetworkInterfaceReference from the specified map of raw messages. -func UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetBareMetalServerNetworkInterfaceReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetNetworkInterfaceReference : FloatingIPTargetNetworkInterfaceReference struct -// This model "extends" FloatingIPTarget -type FloatingIPTargetNetworkInterfaceReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network interface. - ID *string `json:"id" validate:"required"` - - // The name for this instance network interface. - Name *string `json:"name" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FloatingIPTargetNetworkInterfaceReference.ResourceType property. -// The resource type. -const ( - FloatingIPTargetNetworkInterfaceReferenceResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*FloatingIPTargetNetworkInterfaceReference) isaFloatingIPTarget() bool { - return true -} - -// UnmarshalFloatingIPTargetNetworkInterfaceReference unmarshals an instance of FloatingIPTargetNetworkInterfaceReference from the specified map of raw messages. -func UnmarshalFloatingIPTargetNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetNetworkInterfaceReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPublicGatewayReference : FloatingIPTargetPublicGatewayReference struct -// This model "extends" FloatingIPTarget -type FloatingIPTargetPublicGatewayReference struct { - // The CRN for this public gateway. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this public gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this public gateway. - ID *string `json:"id" validate:"required"` - - // The name for this public gateway. The name is unique across all public gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FloatingIPTargetPublicGatewayReference.ResourceType property. -// The resource type. -const ( - FloatingIPTargetPublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" -) - -func (*FloatingIPTargetPublicGatewayReference) isaFloatingIPTarget() bool { - return true -} - -// UnmarshalFloatingIPTargetPublicGatewayReference unmarshals an instance of FloatingIPTargetPublicGatewayReference from the specified map of raw messages. -func UnmarshalFloatingIPTargetPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPublicGatewayReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetVirtualNetworkInterfaceReference : FloatingIPTargetVirtualNetworkInterfaceReference struct -// This model "extends" FloatingIPTarget -type FloatingIPTargetVirtualNetworkInterfaceReference struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VirtualNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` - - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - Name *string `json:"name" validate:"required"` - - // The primary IP for this virtual network interface. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the FloatingIPTargetVirtualNetworkInterfaceReference.ResourceType property. -// The resource type. -const ( - FloatingIPTargetVirtualNetworkInterfaceReferenceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" -) - -func (*FloatingIPTargetVirtualNetworkInterfaceReference) isaFloatingIPTarget() bool { - return true -} - -// UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference unmarshals an instance of FloatingIPTargetVirtualNetworkInterfaceReference from the specified map of raw messages. -func UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetVirtualNetworkInterfaceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID -// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN -// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref -// This model "extends" FlowLogCollectorTargetPrototype -type FlowLogCollectorTargetPrototypeInstanceIdentity struct { - // The unique identifier for this virtual server instance. - ID *string `json:"id,omitempty"` - - // The CRN for this virtual server instance. - CRN *string `json:"crn,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href,omitempty"` -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentity) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { - return true -} - -type FlowLogCollectorTargetPrototypeInstanceIdentityIntf interface { - FlowLogCollectorTargetPrototypeIntf - isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentity) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentity from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity : Identifies an instance network attachment by a unique property. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID -// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref -// This model "extends" FlowLogCollectorTargetPrototype -type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity struct { - // The unique identifier for this instance network attachment. - ID *string `json:"id,omitempty"` - - // The URL for this instance network attachment. - Href *string `json:"href,omitempty"` -} - -func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { - return true -} - -type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityIntf interface { - FlowLogCollectorTargetPrototypeIntf - isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool -} - -func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID -// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref -// This model "extends" FlowLogCollectorTargetPrototype -type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity struct { - // The unique identifier for this instance network interface. - ID *string `json:"id,omitempty"` - - // The URL for this instance network interface. - Href *string `json:"href,omitempty"` -} - -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { - return true -} - -type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityIntf interface { - FlowLogCollectorTargetPrototypeIntf - isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool -} - -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeSubnetIdentity : Identifies a subnet by a unique property. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID -// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN -// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref -// This model "extends" FlowLogCollectorTargetPrototype -type FlowLogCollectorTargetPrototypeSubnetIdentity struct { - // The unique identifier for this subnet. - ID *string `json:"id,omitempty"` - - // The CRN for this subnet. - CRN *string `json:"crn,omitempty"` - - // The URL for this subnet. - Href *string `json:"href,omitempty"` -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentity) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { - return true -} - -type FlowLogCollectorTargetPrototypeSubnetIdentityIntf interface { - FlowLogCollectorTargetPrototypeIntf - isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentity) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentity from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeSubnetIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeVPCIdentity : Identifies a VPC by a unique property. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID -// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN -// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref -// This model "extends" FlowLogCollectorTargetPrototype -type FlowLogCollectorTargetPrototypeVPCIdentity struct { - // The unique identifier for this VPC. - ID *string `json:"id,omitempty"` - - // The CRN for this VPC. - CRN *string `json:"crn,omitempty"` - - // The URL for this VPC. - Href *string `json:"href,omitempty"` -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentity) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { - return true -} - -type FlowLogCollectorTargetPrototypeVPCIdentityIntf interface { - FlowLogCollectorTargetPrototypeIntf - isaFlowLogCollectorTargetPrototypeVPCIdentity() bool -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentity) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentity from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVPCIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" FlowLogCollectorTargetPrototype -type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { - FlowLogCollectorTargetPrototypeIntf - isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetInstanceNetworkAttachmentReference : FlowLogCollectorTargetInstanceNetworkAttachmentReference struct -// This model "extends" FlowLogCollectorTarget -type FlowLogCollectorTargetInstanceNetworkAttachmentReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network attachment. - ID *string `json:"id" validate:"required"` - - // The name for this instance network attachment. The name is unique across all network attachments for the instance. - Name *string `json:"name" validate:"required"` - - // The primary IP address of the virtual network interface for the instance network - // attachment. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The subnet of the virtual network interface for the instance network attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the FlowLogCollectorTargetInstanceNetworkAttachmentReference.ResourceType property. -// The resource type. -const ( - FlowLogCollectorTargetInstanceNetworkAttachmentReferenceResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" -) - -func (*FlowLogCollectorTargetInstanceNetworkAttachmentReference) isaFlowLogCollectorTarget() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference unmarshals an instance of FlowLogCollectorTargetInstanceNetworkAttachmentReference from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetInstanceNetworkAttachmentReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetInstanceReference : FlowLogCollectorTargetInstanceReference struct -// This model "extends" FlowLogCollectorTarget -type FlowLogCollectorTargetInstanceReference struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` - - // The name for this virtual server instance. The name is unique across all virtual server instances in the region. - Name *string `json:"name" validate:"required"` -} - -func (*FlowLogCollectorTargetInstanceReference) isaFlowLogCollectorTarget() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetInstanceReference unmarshals an instance of FlowLogCollectorTargetInstanceReference from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetInstanceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext : FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct -// This model "extends" FlowLogCollectorTarget -type FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network interface. - ID *string `json:"id" validate:"required"` - - // The name for this instance network interface. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext.ResourceType property. -// The resource type. -const ( - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) isaFlowLogCollectorTarget() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetSubnetReference : FlowLogCollectorTargetSubnetReference struct -// This model "extends" FlowLogCollectorTarget -type FlowLogCollectorTargetSubnetReference struct { - // The CRN for this subnet. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this subnet. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this subnet. - ID *string `json:"id" validate:"required"` - - // The name for this subnet. The name is unique across all subnets in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FlowLogCollectorTargetSubnetReference.ResourceType property. -// The resource type. -const ( - FlowLogCollectorTargetSubnetReferenceResourceTypeSubnetConst = "subnet" -) - -func (*FlowLogCollectorTargetSubnetReference) isaFlowLogCollectorTarget() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetSubnetReference unmarshals an instance of FlowLogCollectorTargetSubnetReference from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetSubnetReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSubnetReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetVPCReference : FlowLogCollectorTargetVPCReference struct -// This model "extends" FlowLogCollectorTarget -type FlowLogCollectorTargetVPCReference struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this VPC. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` - - // The name for this VPC. The name is unique across all VPCs in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FlowLogCollectorTargetVPCReference.ResourceType property. -// The resource type. -const ( - FlowLogCollectorTargetVPCReferenceResourceTypeVPCConst = "vpc" -) - -func (*FlowLogCollectorTargetVPCReference) isaFlowLogCollectorTarget() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetVPCReference unmarshals an instance of FlowLogCollectorTargetVPCReference from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetVPCReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext : FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext struct -// This model "extends" FlowLogCollectorTarget -type FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` - - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` - - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext.ResourceType property. -// The resource type. -const ( - FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" -) - -func (*FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) isaFlowLogCollectorTarget() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext unmarshals an instance of FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageIdentityByCRN : ImageIdentityByCRN struct -// This model "extends" ImageIdentity -type ImageIdentityByCRN struct { - // The CRN for this image. - CRN *string `json:"crn" validate:"required"` -} - -// NewImageIdentityByCRN : Instantiate ImageIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewImageIdentityByCRN(crn string) (_model *ImageIdentityByCRN, err error) { - _model = &ImageIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ImageIdentityByCRN) isaImageIdentity() bool { - return true -} - -// UnmarshalImageIdentityByCRN unmarshals an instance of ImageIdentityByCRN from the specified map of raw messages. -func UnmarshalImageIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageIdentityByHref : ImageIdentityByHref struct -// This model "extends" ImageIdentity -type ImageIdentityByHref struct { - // The URL for this image. - Href *string `json:"href" validate:"required"` -} - -// NewImageIdentityByHref : Instantiate ImageIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewImageIdentityByHref(href string) (_model *ImageIdentityByHref, err error) { - _model = &ImageIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ImageIdentityByHref) isaImageIdentity() bool { - return true -} - -// UnmarshalImageIdentityByHref unmarshals an instance of ImageIdentityByHref from the specified map of raw messages. -func UnmarshalImageIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageIdentityByID : ImageIdentityByID struct -// This model "extends" ImageIdentity -type ImageIdentityByID struct { - // The unique identifier for this image. - ID *string `json:"id" validate:"required"` -} - -// NewImageIdentityByID : Instantiate ImageIdentityByID (Generic Model Constructor) -func (*VpcV1) NewImageIdentityByID(id string) (_model *ImageIdentityByID, err error) { - _model = &ImageIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ImageIdentityByID) isaImageIdentity() bool { - return true -} - -// UnmarshalImageIdentityByID unmarshals an instance of ImageIdentityByID from the specified map of raw messages. -func UnmarshalImageIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImagePrototypeImageByFile : ImagePrototypeImageByFile struct -// This model "extends" ImagePrototype -type ImagePrototypeImageByFile struct { - // The deprecation date and time to set for this image. - // - // The date and time must not be in the past, and must be earlier than `obsolescence_at` - // (if `obsolescence_at` is set). - // - // If unspecified, no deprecation date and time will be set. - // - // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will - // transition to `deprecated` upon its successful creation (or - // `obsolete` if the obsolescence date and time was also reached). - DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` - - // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are - // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of - // randomly-selected words. - Name *string `json:"name,omitempty"` - - // The obsolescence date and time to set for this image. - // - // The date and time must not be in the past, and must be later than `deprecation_at` (if - // `deprecation_at` is set). - // - // If unspecified, no obsolescence date and time will be set. - // - // If the obsolescence date and time is reached while the image has a status of - // `pending`, the image's status will transition to `obsolete` upon its successful creation. - ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. - // - // That representation is created by wrapping the key's value with the `encryption_key` root key (which must also be - // specified), using either [Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the - // [Hyper Protect Crypto Services](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). - // - // If unspecified, the imported image is treated as unencrypted. - EncryptedDataKey *string `json:"encrypted_data_key,omitempty"` - - // The root key that was used to wrap the data key (which is ultimately represented as - // `encrypted_data_key`). Additionally, the root key will be used to encrypt volumes - // created from this image (unless an alternate `encryption_key` is specified at volume - // creation). - // - // If unspecified, the imported image is treated as unencrypted. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The file from which to create the image. - File *ImageFilePrototype `json:"file" validate:"required"` - - // The [supported operating - // system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included in this - // image. - OperatingSystem OperatingSystemIdentityIntf `json:"operating_system" validate:"required"` -} - -// NewImagePrototypeImageByFile : Instantiate ImagePrototypeImageByFile (Generic Model Constructor) -func (*VpcV1) NewImagePrototypeImageByFile(file *ImageFilePrototype, operatingSystem OperatingSystemIdentityIntf) (_model *ImagePrototypeImageByFile, err error) { - _model = &ImagePrototypeImageByFile{ - File: file, - OperatingSystem: operatingSystem, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ImagePrototypeImageByFile) isaImagePrototype() bool { - return true -} - -// UnmarshalImagePrototypeImageByFile unmarshals an instance of ImagePrototypeImageByFile from the specified map of raw messages. -func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImagePrototypeImageByFile) - err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImagePrototypeImageBySourceVolume : ImagePrototypeImageBySourceVolume struct -// This model "extends" ImagePrototype -type ImagePrototypeImageBySourceVolume struct { - // The deprecation date and time to set for this image. - // - // The date and time must not be in the past, and must be earlier than `obsolescence_at` - // (if `obsolescence_at` is set). - // - // If unspecified, no deprecation date and time will be set. - // - // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will - // transition to `deprecated` upon its successful creation (or - // `obsolete` if the obsolescence date and time was also reached). - DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` - - // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are - // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of - // randomly-selected words. - Name *string `json:"name,omitempty"` - - // The obsolescence date and time to set for this image. - // - // The date and time must not be in the past, and must be later than `deprecation_at` (if - // `deprecation_at` is set). - // - // If unspecified, no obsolescence date and time will be set. - // - // If the obsolescence date and time is reached while the image has a status of - // `pending`, the image's status will transition to `obsolete` upon its successful creation. - ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The root key used to wrap the system-generated data encryption key for the image. - // - // If unspecified, the root key from `source_volume` will be used. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The volume from which to create the image. The specified volume must: - // - Have an `operating_system`, which will be used to populate this image's - // operating system information. - // - Not be `active` or `busy`. - // - // During image creation, the specified volume may briefly become `busy`. - SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` -} - -// NewImagePrototypeImageBySourceVolume : Instantiate ImagePrototypeImageBySourceVolume (Generic Model Constructor) -func (*VpcV1) NewImagePrototypeImageBySourceVolume(sourceVolume VolumeIdentityIntf) (_model *ImagePrototypeImageBySourceVolume, err error) { - _model = &ImagePrototypeImageBySourceVolume{ - SourceVolume: sourceVolume, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ImagePrototypeImageBySourceVolume) isaImagePrototype() bool { - return true -} - -// UnmarshalImagePrototypeImageBySourceVolume unmarshals an instance of ImagePrototypeImageBySourceVolume from the specified map of raw messages. -func UnmarshalImagePrototypeImageBySourceVolume(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImagePrototypeImageBySourceVolume) - err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceCatalogOfferingPrototypeCatalogOfferingByOffering : InstanceCatalogOfferingPrototypeCatalogOfferingByOffering struct -// This model "extends" InstanceCatalogOfferingPrototype -type InstanceCatalogOfferingPrototypeCatalogOfferingByOffering struct { - // Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering by a unique property. - Offering CatalogOfferingIdentityIntf `json:"offering" validate:"required"` -} - -// NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering : Instantiate InstanceCatalogOfferingPrototypeCatalogOfferingByOffering (Generic Model Constructor) -func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(offering CatalogOfferingIdentityIntf) (_model *InstanceCatalogOfferingPrototypeCatalogOfferingByOffering, err error) { - _model = &InstanceCatalogOfferingPrototypeCatalogOfferingByOffering{ - Offering: offering, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) isaInstanceCatalogOfferingPrototype() bool { - return true -} - -// UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering unmarshals an instance of InstanceCatalogOfferingPrototypeCatalogOfferingByOffering from the specified map of raw messages. -func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) - err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceCatalogOfferingPrototypeCatalogOfferingByVersion : InstanceCatalogOfferingPrototypeCatalogOfferingByVersion struct -// This model "extends" InstanceCatalogOfferingPrototype -type InstanceCatalogOfferingPrototypeCatalogOfferingByVersion struct { - // Identifies a version of a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a - // unique property. - Version CatalogOfferingVersionIdentityIntf `json:"version" validate:"required"` -} - -// NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion : Instantiate InstanceCatalogOfferingPrototypeCatalogOfferingByVersion (Generic Model Constructor) -func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(version CatalogOfferingVersionIdentityIntf) (_model *InstanceCatalogOfferingPrototypeCatalogOfferingByVersion, err error) { - _model = &InstanceCatalogOfferingPrototypeCatalogOfferingByVersion{ - Version: version, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) isaInstanceCatalogOfferingPrototype() bool { - return true -} - -// UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion unmarshals an instance of InstanceCatalogOfferingPrototypeCatalogOfferingByVersion from the specified map of raw messages. -func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) - err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPrototypeScheduledActionPrototype : InstanceGroupManagerActionPrototypeScheduledActionPrototype struct -// Models which "extend" this model: -// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt -// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec -// This model "extends" InstanceGroupManagerActionPrototype -type InstanceGroupManagerActionPrototypeScheduledActionPrototype struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The date and time the scheduled action will run. - RunAt *strfmt.DateTime `json:"run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototype) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf interface { - InstanceGroupManagerActionPrototypeIntf - isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototype) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionScheduledAction : InstanceGroupManagerActionScheduledAction struct -// Models which "extend" this model: -// - InstanceGroupManagerActionScheduledActionGroupTarget -// - InstanceGroupManagerActionScheduledActionManagerTarget -// This model "extends" InstanceGroupManagerAction -type InstanceGroupManagerActionScheduledAction struct { - // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. At present, this is always - // `true`, but may be modifiable in the future. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. - AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` - - // The date and time that the instance group manager action was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager action. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager action. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager action. The name is unique across all actions for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the instance group action - // - `active`: Action is ready to be run - // - `completed`: Action was completed successfully - // - `failed`: Action could not be completed successfully - // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. - Status *string `json:"status" validate:"required"` - - // The date and time that the instance group manager action was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The type of action for the instance group. - ActionType *string `json:"action_type" validate:"required"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - // The date and time the scheduled action was last applied. If absent, the action has never been applied. - LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` - - // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run - // time. - NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroup `json:"group,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager,omitempty"` -} - -// Constants associated with the InstanceGroupManagerActionScheduledAction.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionScheduledActionResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) - -// Constants associated with the InstanceGroupManagerActionScheduledAction.Status property. -// The status of the instance group action -// - `active`: Action is ready to be run -// - `completed`: Action was completed successfully -// - `failed`: Action could not be completed successfully -// - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. -const ( - InstanceGroupManagerActionScheduledActionStatusActiveConst = "active" - InstanceGroupManagerActionScheduledActionStatusCompletedConst = "completed" - InstanceGroupManagerActionScheduledActionStatusFailedConst = "failed" - InstanceGroupManagerActionScheduledActionStatusIncompatibleConst = "incompatible" - InstanceGroupManagerActionScheduledActionStatusOmittedConst = "omitted" -) - -// Constants associated with the InstanceGroupManagerActionScheduledAction.ActionType property. -// The type of action for the instance group. -const ( - InstanceGroupManagerActionScheduledActionActionTypeScheduledConst = "scheduled" -) - -func (*InstanceGroupManagerActionScheduledAction) isaInstanceGroupManagerActionScheduledAction() bool { - return true -} - -type InstanceGroupManagerActionScheduledActionIntf interface { - InstanceGroupManagerActionIntf - isaInstanceGroupManagerActionScheduledAction() bool -} - -func (*InstanceGroupManagerActionScheduledAction) isaInstanceGroupManagerAction() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionScheduledAction unmarshals an instance of InstanceGroupManagerActionScheduledAction from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionScheduledAction(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionScheduledAction) - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) - if err != nil { - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerAutoScale : InstanceGroupManagerAutoScale struct -// This model "extends" InstanceGroupManager -type InstanceGroupManagerAutoScale struct { - // The date and time that the instance group manager was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` - - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled" validate:"required"` - - // The name for this instance group manager. The name is unique across all managers for the instance group. - Name *string `json:"name" validate:"required"` - - // The date and time that the instance group manager was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The time window in seconds to aggregate metrics prior to evaluation. - AggregationWindow *int64 `json:"aggregation_window" validate:"required"` - - // The duration of time in seconds to pause further scale actions after scaling has taken place. - Cooldown *int64 `json:"cooldown" validate:"required"` - - // The type of instance group manager. - ManagerType *string `json:"manager_type" validate:"required"` - - // The maximum number of members in a managed instance group. - MaxMembershipCount *int64 `json:"max_membership_count" validate:"required"` - - // The minimum number of members in a managed instance group. - MinMembershipCount *int64 `json:"min_membership_count" validate:"required"` - - // The policies of the instance group manager. - Policies []InstanceGroupManagerPolicyReference `json:"policies" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerAutoScale.ManagerType property. -// The type of instance group manager. -const ( - InstanceGroupManagerAutoScaleManagerTypeAutoscaleConst = "autoscale" -) - -func (*InstanceGroupManagerAutoScale) isaInstanceGroupManager() bool { - return true -} - -// UnmarshalInstanceGroupManagerAutoScale unmarshals an instance of InstanceGroupManagerAutoScale from the specified map of raw messages. -func UnmarshalInstanceGroupManagerAutoScale(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerAutoScale) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype : InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct -// This model "extends" InstanceGroupManagerPolicyPrototype -type InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct { - // The name for this instance group manager policy. The name must not be used by another policy for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The type of metric to be evaluated. - MetricType *string `json:"metric_type" validate:"required"` - - // The metric value to be evaluated. - MetricValue *int64 `json:"metric_value" validate:"required"` - - // The type of policy for the instance group. - PolicyType *string `json:"policy_type" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype.MetricType property. -// The type of metric to be evaluated. -const ( - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeCpuConst = "cpu" - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeMemoryConst = "memory" - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeNetworkInConst = "network_in" - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeNetworkOutConst = "network_out" -) - -// Constants associated with the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype.PolicyType property. -// The type of policy for the instance group. -const ( - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypePolicyTypeTargetConst = "target" -) - -// NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype : Instantiate InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(metricType string, metricValue int64, policyType string) (_model *InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype, err error) { - _model = &InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype{ - MetricType: core.StringPtr(metricType), - MetricValue: core.Int64Ptr(metricValue), - PolicyType: core.StringPtr(policyType), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) isaInstanceGroupManagerPolicyPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype unmarshals an instance of InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy : InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct -// This model "extends" InstanceGroupManagerPolicy -type InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct { - // The date and time that the instance group manager policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager policy. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager policy. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager policy. The name is unique across all policies for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The date and time that the instance group manager policy was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The type of metric to be evaluated. - MetricType *string `json:"metric_type" validate:"required"` - - // The metric value to be evaluated. - MetricValue *int64 `json:"metric_value" validate:"required"` - - // The type of policy for the instance group. - PolicyType *string `json:"policy_type" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.MetricType property. -// The type of metric to be evaluated. -const ( - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeCpuConst = "cpu" - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeMemoryConst = "memory" - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeNetworkInConst = "network_in" - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeNetworkOutConst = "network_out" -) - -// Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.PolicyType property. -// The type of policy for the instance group. -const ( - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyPolicyTypeTargetConst = "target" -) - -func (*InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) isaInstanceGroupManagerPolicy() bool { - return true -} - -// UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy unmarshals an instance of InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype : InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype struct -// This model "extends" InstanceGroupManagerPrototype -type InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype struct { - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled,omitempty"` - - // The name for this instance group manager. The name must not be used by another manager for the instance group. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The time window in seconds to aggregate metrics prior to evaluation. - AggregationWindow *int64 `json:"aggregation_window,omitempty"` - - // The duration of time in seconds to pause further scale actions after scaling has taken place. - Cooldown *int64 `json:"cooldown,omitempty"` - - // The type of instance group manager. - ManagerType *string `json:"manager_type" validate:"required"` - - // The maximum number of members in a managed instance group. - MaxMembershipCount *int64 `json:"max_membership_count" validate:"required"` - - // The minimum number of members in a managed instance group. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` -} - -// Constants associated with the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype.ManagerType property. -// The type of instance group manager. -const ( - InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototypeManagerTypeAutoscaleConst = "autoscale" -) - -// NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype : Instantiate InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(managerType string, maxMembershipCount int64) (_model *InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype, err error) { - _model = &InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype{ - ManagerType: core.StringPtr(managerType), - MaxMembershipCount: core.Int64Ptr(maxMembershipCount), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) isaInstanceGroupManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype unmarshals an instance of InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) - err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype : InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype struct -// This model "extends" InstanceGroupManagerPrototype -type InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype struct { - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled,omitempty"` - - // The name for this instance group manager. The name must not be used by another manager for the instance group. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The type of instance group manager. - ManagerType *string `json:"manager_type" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype.ManagerType property. -// The type of instance group manager. -const ( - InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototypeManagerTypeScheduledConst = "scheduled" -) - -// NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype : Instantiate InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype(managerType string) (_model *InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype, err error) { - _model = &InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype{ - ManagerType: core.StringPtr(managerType), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype) isaInstanceGroupManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype unmarshals an instance of InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype) - err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduled : InstanceGroupManagerScheduled struct -// This model "extends" InstanceGroupManager -type InstanceGroupManagerScheduled struct { - // The date and time that the instance group manager was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` - - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled" validate:"required"` - - // The name for this instance group manager. The name is unique across all managers for the instance group. - Name *string `json:"name" validate:"required"` - - // The date and time that the instance group manager was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The actions of the instance group manager. - Actions []InstanceGroupManagerActionReference `json:"actions" validate:"required"` - - // The type of instance group manager. - ManagerType *string `json:"manager_type" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerScheduled.ManagerType property. -// The type of instance group manager. -const ( - InstanceGroupManagerScheduledManagerTypeScheduledConst = "scheduled" -) - -func (*InstanceGroupManagerScheduled) isaInstanceGroupManager() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduled unmarshals an instance of InstanceGroupManagerScheduled from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduled(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduled) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManagerAutoScale : InstanceGroupManagerScheduledActionManagerAutoScale struct -// This model "extends" InstanceGroupManagerScheduledActionManager -type InstanceGroupManagerScheduledActionManagerAutoScale struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager. The name is unique across all managers for the instance group. - Name *string `json:"name" validate:"required"` - - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` -} - -func (*InstanceGroupManagerScheduledActionManagerAutoScale) isaInstanceGroupManagerScheduledActionManager() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale unmarshals an instance of InstanceGroupManagerScheduledActionManagerAutoScale from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerAutoScale) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype : The auto scale manager to update, and one or more properties to be updated. Either `id` or `href` must be specified, -// in addition to at least one of `min_membership_count` and -// `max_membership_count`. -// Models which "extend" this model: -// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID -// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref -// This model "extends" InstanceGroupManagerScheduledActionManagerPrototype -type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The unique identifier for this instance group manager. - ID *string `json:"id,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href,omitempty"` -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { - return true -} - -type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeIntf interface { - InstanceGroupManagerScheduledActionManagerPrototypeIntf - isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterface -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityIntf interface { - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf - isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext : The virtual network interface for this target. -// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterface -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext struct { - // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on - // this interface. If `true`, source IP spoofing is allowed on this interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the virtual network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - If the virtual network interface is attached, the target `resource_type` must be - // `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 - // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // same subnet as the primary IP. - // - // If reserved IP identities are provided, the specified reserved IPs must be unbound. - // - // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network - // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet - // will be automatically selected and reserved. - Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are - // reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the virtual network interface. May be either a - // reserved IP identity, or a reserved IP prototype object which will be used to create a - // new reserved IP. - // - // If a reserved IP identity is provided, the specified reserved IP must be unbound. - // - // If a reserved IP prototype object with an address is provided, the address must be - // available on the virtual network interface's subnet. If no address is specified, - // an available address on the subnet will be automatically selected and reserved. - PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The resource group to use for this virtual network interface. If unspecified, the - // virtual server instance's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. Required if `primary_ip` does not specify a reserved IP. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePatchProfileInstanceProfileIdentityByHref : InstancePatchProfileInstanceProfileIdentityByHref struct -// This model "extends" InstancePatchProfile -type InstancePatchProfileInstanceProfileIdentityByHref struct { - // The URL for this virtual server instance profile. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePatchProfileInstanceProfileIdentityByHref : Instantiate InstancePatchProfileInstanceProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByHref(href string) (_model *InstancePatchProfileInstanceProfileIdentityByHref, err error) { - _model = &InstancePatchProfileInstanceProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePatchProfileInstanceProfileIdentityByHref) isaInstancePatchProfile() bool { - return true -} - -// UnmarshalInstancePatchProfileInstanceProfileIdentityByHref unmarshals an instance of InstancePatchProfileInstanceProfileIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePatchProfileInstanceProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePatchProfileInstanceProfileIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePatchProfileInstanceProfileIdentityByName : InstancePatchProfileInstanceProfileIdentityByName struct -// This model "extends" InstancePatchProfile -type InstancePatchProfileInstanceProfileIdentityByName struct { - // The globally unique name for this virtual server instance profile. - Name *string `json:"name" validate:"required"` -} - -// NewInstancePatchProfileInstanceProfileIdentityByName : Instantiate InstancePatchProfileInstanceProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByName(name string) (_model *InstancePatchProfileInstanceProfileIdentityByName, err error) { - _model = &InstancePatchProfileInstanceProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePatchProfileInstanceProfileIdentityByName) isaInstancePatchProfile() bool { - return true -} - -// UnmarshalInstancePatchProfileInstanceProfileIdentityByName unmarshals an instance of InstancePatchProfileInstanceProfileIdentityByName from the specified map of raw messages. -func UnmarshalInstancePatchProfileInstanceProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePatchProfileInstanceProfileIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. -// Models which "extend" this model: -// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID -// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN -// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref -// This model "extends" InstancePlacementTargetPatch -type InstancePlacementTargetPatchDedicatedHostGroupIdentity struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host group. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host group. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentity) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -type InstancePlacementTargetPatchDedicatedHostGroupIdentityIntf interface { - InstancePlacementTargetPatchIntf - isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentity) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentity from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostIdentity : Identifies a dedicated host by a unique property. -// Models which "extend" this model: -// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID -// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN -// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref -// This model "extends" InstancePlacementTargetPatch -type InstancePlacementTargetPatchDedicatedHostIdentity struct { - // The unique identifier for this dedicated host. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentity) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} - -type InstancePlacementTargetPatchDedicatedHostIdentityIntf interface { - InstancePlacementTargetPatchIntf - isaInstancePlacementTargetPatchDedicatedHostIdentity() bool -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentity) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentity unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentity from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. -// Models which "extend" this model: -// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID -// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN -// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref -// This model "extends" InstancePlacementTargetPrototype -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentity struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host group. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host group. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { - return true -} - -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityIntf interface { - InstancePlacementTargetPrototypeIntf - isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentity unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentity from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentity : Identifies a dedicated host by a unique property. -// Models which "extend" this model: -// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID -// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN -// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref -// This model "extends" InstancePlacementTargetPrototype -type InstancePlacementTargetPrototypeDedicatedHostIdentity struct { - // The unique identifier for this dedicated host. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentity) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -type InstancePlacementTargetPrototypeDedicatedHostIdentityIntf interface { - InstancePlacementTargetPrototypeIntf - isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentity) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentity unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentity from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypePlacementGroupIdentity : Identifies a placement group by a unique property. -// Models which "extend" this model: -// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID -// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN -// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref -// This model "extends" InstancePlacementTargetPrototype -type InstancePlacementTargetPrototypePlacementGroupIdentity struct { - // The unique identifier for this placement group. - ID *string `json:"id,omitempty"` - - // The CRN for this placement group. - CRN *string `json:"crn,omitempty"` - - // The URL for this placement group. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentity) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -type InstancePlacementTargetPrototypePlacementGroupIdentityIntf interface { - InstancePlacementTargetPrototypeIntf - isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentity) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentity unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentity from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetDedicatedHostGroupReference : InstancePlacementTargetDedicatedHostGroupReference struct -// This model "extends" InstancePlacementTarget -type InstancePlacementTargetDedicatedHostGroupReference struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` - - // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the InstancePlacementTargetDedicatedHostGroupReference.ResourceType property. -// The resource type. -const ( - InstancePlacementTargetDedicatedHostGroupReferenceResourceTypeDedicatedHostGroupConst = "dedicated_host_group" -) - -func (*InstancePlacementTargetDedicatedHostGroupReference) isaInstancePlacementTarget() bool { - return true -} - -// UnmarshalInstancePlacementTargetDedicatedHostGroupReference unmarshals an instance of InstancePlacementTargetDedicatedHostGroupReference from the specified map of raw messages. -func UnmarshalInstancePlacementTargetDedicatedHostGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetDedicatedHostGroupReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetDedicatedHostReference : InstancePlacementTargetDedicatedHostReference struct -// This model "extends" InstancePlacementTarget -type InstancePlacementTargetDedicatedHostReference struct { - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *DedicatedHostReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this dedicated host. - ID *string `json:"id" validate:"required"` - - // The name for this dedicated host. The name is unique across all dedicated hosts in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the InstancePlacementTargetDedicatedHostReference.ResourceType property. -// The resource type. -const ( - InstancePlacementTargetDedicatedHostReferenceResourceTypeDedicatedHostConst = "dedicated_host" -) - -func (*InstancePlacementTargetDedicatedHostReference) isaInstancePlacementTarget() bool { - return true -} - -// UnmarshalInstancePlacementTargetDedicatedHostReference unmarshals an instance of InstancePlacementTargetDedicatedHostReference from the specified map of raw messages. -func UnmarshalInstancePlacementTargetDedicatedHostReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetDedicatedHostReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPlacementGroupReference : InstancePlacementTargetPlacementGroupReference struct -// This model "extends" InstancePlacementTarget -type InstancePlacementTargetPlacementGroupReference struct { - // The CRN for this placement group. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *PlacementGroupReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this placement group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this placement group. - ID *string `json:"id" validate:"required"` - - // The name for this placement group. The name is unique across all placement groups in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the InstancePlacementTargetPlacementGroupReference.ResourceType property. -// The resource type. -const ( - InstancePlacementTargetPlacementGroupReferenceResourceTypePlacementGroupConst = "placement_group" -) - -func (*InstancePlacementTargetPlacementGroupReference) isaInstancePlacementTarget() bool { - return true -} - -// UnmarshalInstancePlacementTargetPlacementGroupReference unmarshals an instance of InstancePlacementTargetPlacementGroupReference from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPlacementGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPlacementGroupReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPlacementGroupReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileBandwidthDependent : The total bandwidth shared across the network attachments or network interfaces and storage volumes of an instance -// with this profile depends on its configuration. -// This model "extends" InstanceProfileBandwidth -type InstanceProfileBandwidthDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileBandwidthDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileBandwidthDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileBandwidthDependent) isaInstanceProfileBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileBandwidthDependent unmarshals an instance of InstanceProfileBandwidthDependent from the specified map of raw messages. -func UnmarshalInstanceProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileBandwidthDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network attachments or network -// interfaces and storage volumes of an instance with this profile. -// This model "extends" InstanceProfileBandwidth -type InstanceProfileBandwidthEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileBandwidthEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileBandwidthEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileBandwidthEnum) isaInstanceProfileBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileBandwidthEnum unmarshals an instance of InstanceProfileBandwidthEnum from the specified map of raw messages. -func UnmarshalInstanceProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileBandwidthEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network attachments or network interfaces and storage -// volumes of an instance with this profile. -// This model "extends" InstanceProfileBandwidth -type InstanceProfileBandwidthFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileBandwidthFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileBandwidthFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileBandwidthFixed) isaInstanceProfileBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileBandwidthFixed unmarshals an instance of InstanceProfileBandwidthFixed from the specified map of raw messages. -func UnmarshalInstanceProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileBandwidthFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network attachments or network -// interfaces and storage volumes of an instance with this profile. -// This model "extends" InstanceProfileBandwidth -type InstanceProfileBandwidthRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileBandwidthRange.Type property. -// The type for this profile field. -const ( - InstanceProfileBandwidthRangeTypeRangeConst = "range" -) - -func (*InstanceProfileBandwidthRange) isaInstanceProfileBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileBandwidthRange unmarshals an instance of InstanceProfileBandwidthRange from the specified map of raw messages. -func UnmarshalInstanceProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileBandwidthRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskQuantityDependent : The number of disks of this configuration for an instance with this profile depends on its instance configuration. -// This model "extends" InstanceProfileDiskQuantity -type InstanceProfileDiskQuantityDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskQuantityDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskQuantityDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileDiskQuantityDependent) isaInstanceProfileDiskQuantity() bool { - return true -} - -// UnmarshalInstanceProfileDiskQuantityDependent unmarshals an instance of InstanceProfileDiskQuantityDependent from the specified map of raw messages. -func UnmarshalInstanceProfileDiskQuantityDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskQuantityDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskQuantityEnum : The permitted the number of disks of this configuration for an instance with this profile. -// This model "extends" InstanceProfileDiskQuantity -type InstanceProfileDiskQuantityEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskQuantityEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskQuantityEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileDiskQuantityEnum) isaInstanceProfileDiskQuantity() bool { - return true -} - -// UnmarshalInstanceProfileDiskQuantityEnum unmarshals an instance of InstanceProfileDiskQuantityEnum from the specified map of raw messages. -func UnmarshalInstanceProfileDiskQuantityEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskQuantityEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskQuantityFixed : The number of disks of this configuration for an instance with this profile. -// This model "extends" InstanceProfileDiskQuantity -type InstanceProfileDiskQuantityFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskQuantityFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskQuantityFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileDiskQuantityFixed) isaInstanceProfileDiskQuantity() bool { - return true -} - -// UnmarshalInstanceProfileDiskQuantityFixed unmarshals an instance of InstanceProfileDiskQuantityFixed from the specified map of raw messages. -func UnmarshalInstanceProfileDiskQuantityFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskQuantityFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskQuantityRange : The permitted range for the number of disks of this configuration for an instance with this profile. -// This model "extends" InstanceProfileDiskQuantity -type InstanceProfileDiskQuantityRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskQuantityRange.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskQuantityRangeTypeRangeConst = "range" -) - -func (*InstanceProfileDiskQuantityRange) isaInstanceProfileDiskQuantity() bool { - return true -} - -// UnmarshalInstanceProfileDiskQuantityRange unmarshals an instance of InstanceProfileDiskQuantityRange from the specified map of raw messages. -func UnmarshalInstanceProfileDiskQuantityRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskQuantityRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskSizeDependent : The disk size in GB (gigabytes) of this configuration for an instance with this profile depends on its instance -// configuration. -// This model "extends" InstanceProfileDiskSize -type InstanceProfileDiskSizeDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskSizeDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskSizeDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileDiskSizeDependent) isaInstanceProfileDiskSize() bool { - return true -} - -// UnmarshalInstanceProfileDiskSizeDependent unmarshals an instance of InstanceProfileDiskSizeDependent from the specified map of raw messages. -func UnmarshalInstanceProfileDiskSizeDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskSizeDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskSizeEnum : The permitted disk size in GB (gigabytes) of this configuration for an instance with this profile. -// This model "extends" InstanceProfileDiskSize -type InstanceProfileDiskSizeEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskSizeEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskSizeEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileDiskSizeEnum) isaInstanceProfileDiskSize() bool { - return true -} - -// UnmarshalInstanceProfileDiskSizeEnum unmarshals an instance of InstanceProfileDiskSizeEnum from the specified map of raw messages. -func UnmarshalInstanceProfileDiskSizeEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskSizeEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskSizeFixed : The size of the disk in GB (gigabytes). -// This model "extends" InstanceProfileDiskSize -type InstanceProfileDiskSizeFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskSizeFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskSizeFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileDiskSizeFixed) isaInstanceProfileDiskSize() bool { - return true -} - -// UnmarshalInstanceProfileDiskSizeFixed unmarshals an instance of InstanceProfileDiskSizeFixed from the specified map of raw messages. -func UnmarshalInstanceProfileDiskSizeFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskSizeFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskSizeRange : The permitted range for the disk size of this configuration in GB (gigabytes) for an instance with this profile. -// This model "extends" InstanceProfileDiskSize -type InstanceProfileDiskSizeRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskSizeRange.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskSizeRangeTypeRangeConst = "range" -) - -func (*InstanceProfileDiskSizeRange) isaInstanceProfileDiskSize() bool { - return true -} - -// UnmarshalInstanceProfileDiskSizeRange unmarshals an instance of InstanceProfileDiskSizeRange from the specified map of raw messages. -func UnmarshalInstanceProfileDiskSizeRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskSizeRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuDependent : The GPU count for an instance with this profile depends on its configuration. -// This model "extends" InstanceProfileGpu -type InstanceProfileGpuDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileGpuDependent) isaInstanceProfileGpu() bool { - return true -} - -// UnmarshalInstanceProfileGpuDependent unmarshals an instance of InstanceProfileGpuDependent from the specified map of raw messages. -func UnmarshalInstanceProfileGpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuEnum : The permitted GPU count values for an instance with this profile. -// This model "extends" InstanceProfileGpu -type InstanceProfileGpuEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileGpuEnum) isaInstanceProfileGpu() bool { - return true -} - -// UnmarshalInstanceProfileGpuEnum unmarshals an instance of InstanceProfileGpuEnum from the specified map of raw messages. -func UnmarshalInstanceProfileGpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuFixed : The GPU count for an instance with this profile. -// This model "extends" InstanceProfileGpu -type InstanceProfileGpuFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileGpuFixed) isaInstanceProfileGpu() bool { - return true -} - -// UnmarshalInstanceProfileGpuFixed unmarshals an instance of InstanceProfileGpuFixed from the specified map of raw messages. -func UnmarshalInstanceProfileGpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuMemoryDependent : The overall GPU memory value for an instance with this profile depends on its configuration. -// This model "extends" InstanceProfileGpuMemory -type InstanceProfileGpuMemoryDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuMemoryDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuMemoryDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileGpuMemoryDependent) isaInstanceProfileGpuMemory() bool { - return true -} - -// UnmarshalInstanceProfileGpuMemoryDependent unmarshals an instance of InstanceProfileGpuMemoryDependent from the specified map of raw messages. -func UnmarshalInstanceProfileGpuMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuMemoryDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuMemoryEnum : The permitted overall GPU memory values in GiB (gibibytes) for an instance with this profile. -// This model "extends" InstanceProfileGpuMemory -type InstanceProfileGpuMemoryEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuMemoryEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuMemoryEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileGpuMemoryEnum) isaInstanceProfileGpuMemory() bool { - return true -} - -// UnmarshalInstanceProfileGpuMemoryEnum unmarshals an instance of InstanceProfileGpuMemoryEnum from the specified map of raw messages. -func UnmarshalInstanceProfileGpuMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuMemoryEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuMemoryFixed : The overall GPU memory in GiB (gibibytes) for an instance with this profile. -// This model "extends" InstanceProfileGpuMemory -type InstanceProfileGpuMemoryFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuMemoryFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuMemoryFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileGpuMemoryFixed) isaInstanceProfileGpuMemory() bool { - return true -} - -// UnmarshalInstanceProfileGpuMemoryFixed unmarshals an instance of InstanceProfileGpuMemoryFixed from the specified map of raw messages. -func UnmarshalInstanceProfileGpuMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuMemoryFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuMemoryRange : The permitted overall GPU memory range in GiB (gibibytes) for an instance with this profile. -// This model "extends" InstanceProfileGpuMemory -type InstanceProfileGpuMemoryRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuMemoryRange.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuMemoryRangeTypeRangeConst = "range" -) - -func (*InstanceProfileGpuMemoryRange) isaInstanceProfileGpuMemory() bool { - return true -} - -// UnmarshalInstanceProfileGpuMemoryRange unmarshals an instance of InstanceProfileGpuMemoryRange from the specified map of raw messages. -func UnmarshalInstanceProfileGpuMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuMemoryRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuRange : The permitted GPU count range for an instance with this profile. -// This model "extends" InstanceProfileGpu -type InstanceProfileGpuRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuRange.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuRangeTypeRangeConst = "range" -) - -func (*InstanceProfileGpuRange) isaInstanceProfileGpu() bool { - return true -} - -// UnmarshalInstanceProfileGpuRange unmarshals an instance of InstanceProfileGpuRange from the specified map of raw messages. -func UnmarshalInstanceProfileGpuRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileIdentityByHref : InstanceProfileIdentityByHref struct -// This model "extends" InstanceProfileIdentity -type InstanceProfileIdentityByHref struct { - // The URL for this virtual server instance profile. - Href *string `json:"href" validate:"required"` -} - -// NewInstanceProfileIdentityByHref : Instantiate InstanceProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstanceProfileIdentityByHref(href string) (_model *InstanceProfileIdentityByHref, err error) { - _model = &InstanceProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceProfileIdentityByHref) isaInstanceProfileIdentity() bool { - return true -} - -// UnmarshalInstanceProfileIdentityByHref unmarshals an instance of InstanceProfileIdentityByHref from the specified map of raw messages. -func UnmarshalInstanceProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileIdentityByName : InstanceProfileIdentityByName struct -// This model "extends" InstanceProfileIdentity -type InstanceProfileIdentityByName struct { - // The globally unique name for this virtual server instance profile. - Name *string `json:"name" validate:"required"` -} - -// NewInstanceProfileIdentityByName : Instantiate InstanceProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewInstanceProfileIdentityByName(name string) (_model *InstanceProfileIdentityByName, err error) { - _model = &InstanceProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceProfileIdentityByName) isaInstanceProfileIdentity() bool { - return true -} - -// UnmarshalInstanceProfileIdentityByName unmarshals an instance of InstanceProfileIdentityByName from the specified map of raw messages. -func UnmarshalInstanceProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileMemoryDependent : The memory value for an instance with this profile depends on its configuration. -// This model "extends" InstanceProfileMemory -type InstanceProfileMemoryDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileMemoryDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileMemoryDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileMemoryDependent) isaInstanceProfileMemory() bool { - return true -} - -// UnmarshalInstanceProfileMemoryDependent unmarshals an instance of InstanceProfileMemoryDependent from the specified map of raw messages. -func UnmarshalInstanceProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileMemoryDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileMemoryEnum : The permitted memory values (in gibibytes) for an instance with this profile. -// This model "extends" InstanceProfileMemory -type InstanceProfileMemoryEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileMemoryEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileMemoryEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileMemoryEnum) isaInstanceProfileMemory() bool { - return true -} - -// UnmarshalInstanceProfileMemoryEnum unmarshals an instance of InstanceProfileMemoryEnum from the specified map of raw messages. -func UnmarshalInstanceProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileMemoryEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileMemoryFixed : The memory (in gibibytes) for an instance with this profile. -// This model "extends" InstanceProfileMemory -type InstanceProfileMemoryFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileMemoryFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileMemoryFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileMemoryFixed) isaInstanceProfileMemory() bool { - return true -} - -// UnmarshalInstanceProfileMemoryFixed unmarshals an instance of InstanceProfileMemoryFixed from the specified map of raw messages. -func UnmarshalInstanceProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileMemoryFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileMemoryRange : The permitted memory range (in gibibytes) for an instance with this profile. -// This model "extends" InstanceProfileMemory -type InstanceProfileMemoryRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileMemoryRange.Type property. -// The type for this profile field. -const ( - InstanceProfileMemoryRangeTypeRangeConst = "range" -) - -func (*InstanceProfileMemoryRange) isaInstanceProfileMemory() bool { - return true -} - -// UnmarshalInstanceProfileMemoryRange unmarshals an instance of InstanceProfileMemoryRange from the specified map of raw messages. -func UnmarshalInstanceProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileMemoryRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileNumaCountDependent : The total number of NUMA nodes for an instance with this profile depends on its configuration and the capacity -// constraints within the zone. -// This model "extends" InstanceProfileNumaCount -type InstanceProfileNumaCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileNumaCountDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileNumaCountDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileNumaCountDependent) isaInstanceProfileNumaCount() bool { - return true -} - -// UnmarshalInstanceProfileNumaCountDependent unmarshals an instance of InstanceProfileNumaCountDependent from the specified map of raw messages. -func UnmarshalInstanceProfileNumaCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNumaCountDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileNumaCountFixed : The total number of NUMA nodes for an instance with this profile. -// This model "extends" InstanceProfileNumaCount -type InstanceProfileNumaCountFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileNumaCountFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileNumaCountFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileNumaCountFixed) isaInstanceProfileNumaCount() bool { - return true -} - -// UnmarshalInstanceProfileNumaCountFixed unmarshals an instance of InstanceProfileNumaCountFixed from the specified map of raw messages. -func UnmarshalInstanceProfileNumaCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNumaCountFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileNetworkAttachmentCountDependent : The number of network attachments supported on an instance with this profile is dependent on its configuration. -// This model "extends" InstanceProfileNetworkAttachmentCount -type InstanceProfileNetworkAttachmentCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileNetworkAttachmentCountDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileNetworkAttachmentCountDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileNetworkAttachmentCountDependent) isaInstanceProfileNetworkAttachmentCount() bool { - return true -} - -// UnmarshalInstanceProfileNetworkAttachmentCountDependent unmarshals an instance of InstanceProfileNetworkAttachmentCountDependent from the specified map of raw messages. -func UnmarshalInstanceProfileNetworkAttachmentCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNetworkAttachmentCountDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileNetworkAttachmentCountRange : The number of network attachments supported on an instance with this profile. -// This model "extends" InstanceProfileNetworkAttachmentCount -type InstanceProfileNetworkAttachmentCountRange struct { - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileNetworkAttachmentCountRange.Type property. -// The type for this profile field. -const ( - InstanceProfileNetworkAttachmentCountRangeTypeRangeConst = "range" -) - -func (*InstanceProfileNetworkAttachmentCountRange) isaInstanceProfileNetworkAttachmentCount() bool { - return true -} - -// UnmarshalInstanceProfileNetworkAttachmentCountRange unmarshals an instance of InstanceProfileNetworkAttachmentCountRange from the specified map of raw messages. -func UnmarshalInstanceProfileNetworkAttachmentCountRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNetworkAttachmentCountRange) - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileNetworkInterfaceCountDependent : The number of network interfaces supported on an instance with this profile is dependent on its configuration. -// This model "extends" InstanceProfileNetworkInterfaceCount -type InstanceProfileNetworkInterfaceCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileNetworkInterfaceCountDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileNetworkInterfaceCountDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileNetworkInterfaceCountDependent) isaInstanceProfileNetworkInterfaceCount() bool { - return true -} - -// UnmarshalInstanceProfileNetworkInterfaceCountDependent unmarshals an instance of InstanceProfileNetworkInterfaceCountDependent from the specified map of raw messages. -func UnmarshalInstanceProfileNetworkInterfaceCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNetworkInterfaceCountDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileNetworkInterfaceCountRange : The number of network interfaces supported on an instance with this profile. -// This model "extends" InstanceProfileNetworkInterfaceCount -type InstanceProfileNetworkInterfaceCountRange struct { - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileNetworkInterfaceCountRange.Type property. -// The type for this profile field. -const ( - InstanceProfileNetworkInterfaceCountRangeTypeRangeConst = "range" -) - -func (*InstanceProfileNetworkInterfaceCountRange) isaInstanceProfileNetworkInterfaceCount() bool { - return true -} - -// UnmarshalInstanceProfileNetworkInterfaceCountRange unmarshals an instance of InstanceProfileNetworkInterfaceCountRange from the specified map of raw messages. -func UnmarshalInstanceProfileNetworkInterfaceCountRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNetworkInterfaceCountRange) - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfilePortSpeedDependent : The port speed of each network interface of an instance with this profile depends on its configuration. -// This model "extends" InstanceProfilePortSpeed -type InstanceProfilePortSpeedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfilePortSpeedDependent.Type property. -// The type for this profile field. -const ( - InstanceProfilePortSpeedDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfilePortSpeedDependent) isaInstanceProfilePortSpeed() bool { - return true -} - -// UnmarshalInstanceProfilePortSpeedDependent unmarshals an instance of InstanceProfilePortSpeedDependent from the specified map of raw messages. -func UnmarshalInstanceProfilePortSpeedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfilePortSpeedDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfilePortSpeedFixed : The maximum speed (in megabits per second) of each network interface of an instance with this profile. -// This model "extends" InstanceProfilePortSpeed -type InstanceProfilePortSpeedFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfilePortSpeedFixed.Type property. -// The type for this profile field. -const ( - InstanceProfilePortSpeedFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfilePortSpeedFixed) isaInstanceProfilePortSpeed() bool { - return true -} - -// UnmarshalInstanceProfilePortSpeedFixed unmarshals an instance of InstanceProfilePortSpeedFixed from the specified map of raw messages. -func UnmarshalInstanceProfilePortSpeedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfilePortSpeedFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVcpuDependent : The VCPU count for an instance with this profile depends on its configuration. -// This model "extends" InstanceProfileVcpu -type InstanceProfileVcpuDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileVcpuDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileVcpuDependent) isaInstanceProfileVcpu() bool { - return true -} - -// UnmarshalInstanceProfileVcpuDependent unmarshals an instance of InstanceProfileVcpuDependent from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVcpuEnum : The permitted values for VCPU count for an instance with this profile. -// This model "extends" InstanceProfileVcpu -type InstanceProfileVcpuEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileVcpuEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileVcpuEnum) isaInstanceProfileVcpu() bool { - return true -} - -// UnmarshalInstanceProfileVcpuEnum unmarshals an instance of InstanceProfileVcpuEnum from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVcpuFixed : The VCPU count for an instance with this profile. -// This model "extends" InstanceProfileVcpu -type InstanceProfileVcpuFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileVcpuFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileVcpuFixed) isaInstanceProfileVcpu() bool { - return true -} - -// UnmarshalInstanceProfileVcpuFixed unmarshals an instance of InstanceProfileVcpuFixed from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVcpuRange : The permitted range for VCPU count for an instance with this profile. -// This model "extends" InstanceProfileVcpu -type InstanceProfileVcpuRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileVcpuRange.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuRangeTypeRangeConst = "range" -) - -func (*InstanceProfileVcpuRange) isaInstanceProfileVcpu() bool { - return true -} - -// UnmarshalInstanceProfileVcpuRange unmarshals an instance of InstanceProfileVcpuRange from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVolumeBandwidthDependent : The storage bandwidth shared across the storage volumes of an instance with this profile depends on its -// configuration. -// This model "extends" InstanceProfileVolumeBandwidth -type InstanceProfileVolumeBandwidthDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileVolumeBandwidthDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileVolumeBandwidthDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileVolumeBandwidthDependent) isaInstanceProfileVolumeBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileVolumeBandwidthDependent unmarshals an instance of InstanceProfileVolumeBandwidthDependent from the specified map of raw messages. -func UnmarshalInstanceProfileVolumeBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVolumeBandwidthDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVolumeBandwidthEnum : The permitted storage bandwidth values (in megabits per second) shared across the storage volumes of an instance with -// this profile. -// This model "extends" InstanceProfileVolumeBandwidth -type InstanceProfileVolumeBandwidthEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileVolumeBandwidthEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileVolumeBandwidthEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileVolumeBandwidthEnum) isaInstanceProfileVolumeBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileVolumeBandwidthEnum unmarshals an instance of InstanceProfileVolumeBandwidthEnum from the specified map of raw messages. -func UnmarshalInstanceProfileVolumeBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVolumeBandwidthEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVolumeBandwidthFixed : The storage bandwidth (in megabits per second) shared across the storage volumes of an instance with this profile. -// This model "extends" InstanceProfileVolumeBandwidth -type InstanceProfileVolumeBandwidthFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileVolumeBandwidthFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileVolumeBandwidthFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileVolumeBandwidthFixed) isaInstanceProfileVolumeBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileVolumeBandwidthFixed unmarshals an instance of InstanceProfileVolumeBandwidthFixed from the specified map of raw messages. -func UnmarshalInstanceProfileVolumeBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVolumeBandwidthFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVolumeBandwidthRange : The permitted storage bandwidth range (in megabits per second) shared across the storage volumes of an instance with -// this profile. -// This model "extends" InstanceProfileVolumeBandwidth -type InstanceProfileVolumeBandwidthRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileVolumeBandwidthRange.Type property. -// The type for this profile field. -const ( - InstanceProfileVolumeBandwidthRangeTypeRangeConst = "range" -) - -func (*InstanceProfileVolumeBandwidthRange) isaInstanceProfileVolumeBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileVolumeBandwidthRange unmarshals an instance of InstanceProfileVolumeBandwidthRange from the specified map of raw messages. -func UnmarshalInstanceProfileVolumeBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVolumeBandwidthRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByCatalogOffering : Create an instance by using a catalog offering. -// Models which "extend" this model: -// - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment -// - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface -// This model "extends" InstancePrototype -type InstancePrototypeInstanceByCatalogOffering struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototypeInstanceByCatalogOffering() bool { - return true -} - -type InstancePrototypeInstanceByCatalogOfferingIntf interface { - InstancePrototypeIntf - isaInstancePrototypeInstanceByCatalogOffering() bool -} - -func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByCatalogOffering unmarshals an instance of InstancePrototypeInstanceByCatalogOffering from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByCatalogOffering) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByImage : Create an instance by using an image. -// Models which "extend" this model: -// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment -// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface -// This model "extends" InstancePrototype -type InstancePrototypeInstanceByImage struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstancePrototypeInstanceByImage) isaInstancePrototypeInstanceByImage() bool { - return true -} - -type InstancePrototypeInstanceByImageIntf interface { - InstancePrototypeIntf - isaInstancePrototypeInstanceByImage() bool -} - -func (*InstancePrototypeInstanceByImage) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByImage unmarshals an instance of InstancePrototypeInstanceByImage from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByImage) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceBySourceSnapshot : Create an instance by using a snapshot. -// Models which "extend" this model: -// - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment -// - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface -// This model "extends" InstancePrototype -type InstancePrototypeInstanceBySourceSnapshot struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototypeInstanceBySourceSnapshot() bool { - return true -} - -type InstancePrototypeInstanceBySourceSnapshotIntf interface { - InstancePrototypeIntf - isaInstancePrototypeInstanceBySourceSnapshot() bool -} - -func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceBySourceSnapshot unmarshals an instance of InstancePrototypeInstanceBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceBySourceSnapshot) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceBySourceTemplate : Create an instance by using an instance template. -// -// The `primary_network_attachment` and `network_attachments` properties may only be specified if -// `primary_network_attachment` is specified in the source template. -// -// The `primary_network_interface` and `network_interfaces` properties may only be specified if -// `primary_network_interface` is specified in the source template. -// This model "extends" InstancePrototype -type InstancePrototypeInstanceBySourceTemplate struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering version to use when provisioning this virtual server instance. - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account, subject to - // IAM policies. - // - // If specified, `image` must not be specified, and `source_template` must not have - // `image` specified. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The template to create this virtual server instance from. - SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` -} - -// NewInstancePrototypeInstanceBySourceTemplate : Instantiate InstancePrototypeInstanceBySourceTemplate (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstancePrototypeInstanceBySourceTemplate, err error) { - _model = &InstancePrototypeInstanceBySourceTemplate{ - SourceTemplate: sourceTemplate, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePrototypeInstanceBySourceTemplate) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceBySourceTemplate unmarshals an instance of InstancePrototypeInstanceBySourceTemplate from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceBySourceTemplate) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByVolume : Create an instance by using a boot volume. -// Models which "extend" this model: -// - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment -// - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface -// This model "extends" InstancePrototype -type InstancePrototypeInstanceByVolume struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstancePrototypeInstanceByVolume) isaInstancePrototypeInstanceByVolume() bool { - return true -} - -type InstancePrototypeInstanceByVolumeIntf interface { - InstancePrototypeIntf - isaInstancePrototypeInstanceByVolume() bool -} - -func (*InstancePrototypeInstanceByVolume) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByVolume unmarshals an instance of InstancePrototypeInstanceByVolume from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByVolume) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateIdentityByCRN : InstanceTemplateIdentityByCRN struct -// This model "extends" InstanceTemplateIdentity -type InstanceTemplateIdentityByCRN struct { - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstanceTemplateIdentityByCRN : Instantiate InstanceTemplateIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplateIdentityByCRN(crn string) (_model *InstanceTemplateIdentityByCRN, err error) { - _model = &InstanceTemplateIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplateIdentityByCRN) isaInstanceTemplateIdentity() bool { - return true -} - -// UnmarshalInstanceTemplateIdentityByCRN unmarshals an instance of InstanceTemplateIdentityByCRN from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateIdentityByHref : InstanceTemplateIdentityByHref struct -// This model "extends" InstanceTemplateIdentity -type InstanceTemplateIdentityByHref struct { - // The URL for this instance template. - Href *string `json:"href" validate:"required"` -} - -// NewInstanceTemplateIdentityByHref : Instantiate InstanceTemplateIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplateIdentityByHref(href string) (_model *InstanceTemplateIdentityByHref, err error) { - _model = &InstanceTemplateIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplateIdentityByHref) isaInstanceTemplateIdentity() bool { - return true -} - -// UnmarshalInstanceTemplateIdentityByHref unmarshals an instance of InstanceTemplateIdentityByHref from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateIdentityByID : InstanceTemplateIdentityByID struct -// This model "extends" InstanceTemplateIdentity -type InstanceTemplateIdentityByID struct { - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` -} - -// NewInstanceTemplateIdentityByID : Instantiate InstanceTemplateIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplateIdentityByID(id string) (_model *InstanceTemplateIdentityByID, err error) { - _model = &InstanceTemplateIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplateIdentityByID) isaInstanceTemplateIdentity() bool { - return true -} - -// UnmarshalInstanceTemplateIdentityByID unmarshals an instance of InstanceTemplateIdentityByID from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Create an instance template that creates instances by using a catalog offering. -// Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment -// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { - return true -} - -type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingIntf interface { - InstanceTemplatePrototypeIntf - isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOffering from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. -// Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment -// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateByImage struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { - return true -} - -type InstanceTemplatePrototypeInstanceTemplateByImageIntf interface { - InstanceTemplatePrototypeIntf - isaInstanceTemplatePrototypeInstanceTemplateByImage() bool -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImage from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByImage) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Create an instance template that creates instances by using a snapshot. -// Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment -// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { - return true -} - -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotIntf interface { - InstanceTemplatePrototypeIntf - isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Create an instance template from an existing instance template. -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering version to use when provisioning this virtual server instance. - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account, subject to - // IAM policies. - // - // If specified, `image` must not be specified, and `source_template` must not have - // `image` specified. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The template to create this virtual server instance from. - SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceTemplate (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceTemplate, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceTemplate{ - SourceTemplate: sourceTemplate, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceTemplate from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext : Create an instance by using a catalog offering. -// Models which "extend" this model: -// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment -// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { - return true -} - -type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIntf interface { - InstanceTemplateIntf - isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByImageInstanceTemplateContext : Create an instance by using an image. -// Models which "extend" this model: -// - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment -// - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceByImageInstanceTemplateContext struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { - return true -} - -type InstanceTemplateInstanceByImageInstanceTemplateContextIntf interface { - InstanceTemplateIntf - isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool -} - -func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImageInstanceTemplateContext) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext : Create an instance by using a snapshot. -// Models which "extend" this model: -// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment -// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { - return true -} - -type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIntf interface { - InstanceTemplateIntf - isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool -} - -func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyIdentityByCRN : KeyIdentityByCRN struct -// This model "extends" KeyIdentity -type KeyIdentityByCRN struct { - // The CRN for this key. - CRN *string `json:"crn" validate:"required"` -} - -// NewKeyIdentityByCRN : Instantiate KeyIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewKeyIdentityByCRN(crn string) (_model *KeyIdentityByCRN, err error) { - _model = &KeyIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*KeyIdentityByCRN) isaKeyIdentity() bool { - return true -} - -// UnmarshalKeyIdentityByCRN unmarshals an instance of KeyIdentityByCRN from the specified map of raw messages. -func UnmarshalKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyIdentityByFingerprint : KeyIdentityByFingerprint struct -// This model "extends" KeyIdentity -type KeyIdentityByFingerprint struct { - // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always - // `SHA256`). - Fingerprint *string `json:"fingerprint" validate:"required"` -} - -// NewKeyIdentityByFingerprint : Instantiate KeyIdentityByFingerprint (Generic Model Constructor) -func (*VpcV1) NewKeyIdentityByFingerprint(fingerprint string) (_model *KeyIdentityByFingerprint, err error) { - _model = &KeyIdentityByFingerprint{ - Fingerprint: core.StringPtr(fingerprint), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*KeyIdentityByFingerprint) isaKeyIdentity() bool { - return true -} - -// UnmarshalKeyIdentityByFingerprint unmarshals an instance of KeyIdentityByFingerprint from the specified map of raw messages. -func UnmarshalKeyIdentityByFingerprint(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentityByFingerprint) - err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyIdentityByHref : KeyIdentityByHref struct -// This model "extends" KeyIdentity -type KeyIdentityByHref struct { - // The URL for this key. - Href *string `json:"href" validate:"required"` -} - -// NewKeyIdentityByHref : Instantiate KeyIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewKeyIdentityByHref(href string) (_model *KeyIdentityByHref, err error) { - _model = &KeyIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*KeyIdentityByHref) isaKeyIdentity() bool { - return true -} - -// UnmarshalKeyIdentityByHref unmarshals an instance of KeyIdentityByHref from the specified map of raw messages. -func UnmarshalKeyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyIdentityByID : KeyIdentityByID struct -// This model "extends" KeyIdentity -type KeyIdentityByID struct { - // The unique identifier for this key. - ID *string `json:"id" validate:"required"` -} - -// NewKeyIdentityByID : Instantiate KeyIdentityByID (Generic Model Constructor) -func (*VpcV1) NewKeyIdentityByID(id string) (_model *KeyIdentityByID, err error) { - _model = &KeyIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*KeyIdentityByID) isaKeyIdentity() bool { - return true -} - -// UnmarshalKeyIdentityByID unmarshals an instance of KeyIdentityByID from the specified map of raw messages. -func UnmarshalKeyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct -// This model "extends" LegacyCloudObjectStorageBucketIdentity -type LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct { - // The globally unique name of this Cloud Object Storage bucket. - Name *string `json:"name" validate:"required"` -} - -// NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : Instantiate LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName (Generic Model Constructor) -func (*VpcV1) NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name string) (_model *LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName, err error) { - _model = &LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) isaLegacyCloudObjectStorageBucketIdentity() bool { - return true -} - -// UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName unmarshals an instance of LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName from the specified map of raw messages. -func UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerIdentityByCRN : LoadBalancerIdentityByCRN struct -// This model "extends" LoadBalancerIdentity -type LoadBalancerIdentityByCRN struct { - // The load balancer's CRN. - CRN *string `json:"crn" validate:"required"` -} - -// NewLoadBalancerIdentityByCRN : Instantiate LoadBalancerIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerIdentityByCRN(crn string) (_model *LoadBalancerIdentityByCRN, err error) { - _model = &LoadBalancerIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerIdentityByCRN) isaLoadBalancerIdentity() bool { - return true -} - -// UnmarshalLoadBalancerIdentityByCRN unmarshals an instance of LoadBalancerIdentityByCRN from the specified map of raw messages. -func UnmarshalLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerIdentityByHref : LoadBalancerIdentityByHref struct -// This model "extends" LoadBalancerIdentity -type LoadBalancerIdentityByHref struct { - // The load balancer's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerIdentityByHref : Instantiate LoadBalancerIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerIdentityByHref(href string) (_model *LoadBalancerIdentityByHref, err error) { - _model = &LoadBalancerIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerIdentityByHref) isaLoadBalancerIdentity() bool { - return true -} - -// UnmarshalLoadBalancerIdentityByHref unmarshals an instance of LoadBalancerIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerIdentityByID : LoadBalancerIdentityByID struct -// This model "extends" LoadBalancerIdentity -type LoadBalancerIdentityByID struct { - // The unique identifier for this load balancer. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerIdentityByID : Instantiate LoadBalancerIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerIdentityByID(id string) (_model *LoadBalancerIdentityByID, err error) { - _model = &LoadBalancerIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerIdentityByID) isaLoadBalancerIdentity() bool { - return true -} - -// UnmarshalLoadBalancerIdentityByID unmarshals an instance of LoadBalancerIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerIdentityByHref : LoadBalancerListenerIdentityByHref struct -// This model "extends" LoadBalancerListenerIdentity -type LoadBalancerListenerIdentityByHref struct { - // The listener's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerListenerIdentityByHref : Instantiate LoadBalancerListenerIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerIdentityByHref(href string) (_model *LoadBalancerListenerIdentityByHref, err error) { - _model = &LoadBalancerListenerIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerListenerIdentityByHref) isaLoadBalancerListenerIdentity() bool { - return true -} - -// UnmarshalLoadBalancerListenerIdentityByHref unmarshals an instance of LoadBalancerListenerIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerIdentityByID : LoadBalancerListenerIdentityByID struct -// This model "extends" LoadBalancerListenerIdentity -type LoadBalancerListenerIdentityByID struct { - // The unique identifier for this load balancer listener. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerListenerIdentityByID : Instantiate LoadBalancerListenerIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerIdentityByID(id string) (_model *LoadBalancerListenerIdentityByID, err error) { - _model = &LoadBalancerListenerIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerListenerIdentityByID) isaLoadBalancerListenerIdentity() bool { - return true -} - -// UnmarshalLoadBalancerListenerIdentityByID unmarshals an instance of LoadBalancerListenerIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct -// This model "extends" LoadBalancerListenerPolicyTargetPatch -type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct -// This model "extends" LoadBalancerListenerPolicyTargetPatch -type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // The redirect target URL. - URL *string `json:"url,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref -// This model "extends" LoadBalancerListenerPolicyTargetPatch -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { - return true -} - -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityIntf interface { - LoadBalancerListenerPolicyTargetPatchIntf - isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct -// This model "extends" LoadBalancerListenerPolicyTargetPrototype -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener" validate:"required"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype{ - HTTPStatusCode: core.Int64Ptr(httpStatusCode), - Listener: listener, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct -// This model "extends" LoadBalancerListenerPolicyTargetPrototype -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - // The redirect target URL. - URL *string `json:"url" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(httpStatusCode int64, url string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype{ - HTTPStatusCode: core.Int64Ptr(httpStatusCode), - URL: core.StringPtr(url), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref -// This model "extends" LoadBalancerListenerPolicyTargetPrototype -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { - return true -} - -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityIntf interface { - LoadBalancerListenerPolicyTargetPrototypeIntf - isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect : LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct -// This model "extends" LoadBalancerListenerPolicyTarget -type LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - Listener *LoadBalancerListenerReference `json:"listener" validate:"required"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) isaLoadBalancerListenerPolicyTarget() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL : LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct -// This model "extends" LoadBalancerListenerPolicyTarget -type LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - // The redirect target URL. - URL *string `json:"url" validate:"required"` -} - -func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) isaLoadBalancerListenerPolicyTarget() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetLoadBalancerPoolReference : LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct -// This model "extends" LoadBalancerListenerPolicyTarget -type LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` - - // The name for this load balancer pool. The name is unique across all pools for the load balancer. - Name *string `json:"name" validate:"required"` -} - -func (*LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) isaLoadBalancerListenerPolicyTarget() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerPoolReference from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityByHref struct -// This model "extends" LoadBalancerPoolIdentity -type LoadBalancerPoolIdentityByHref struct { - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerPoolIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerPoolIdentityByHref) isaLoadBalancerPoolIdentity() bool { - return true -} - -// UnmarshalLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolIdentityByID : LoadBalancerPoolIdentityByID struct -// This model "extends" LoadBalancerPoolIdentity -type LoadBalancerPoolIdentityByID struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerPoolIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerPoolIdentityByID) isaLoadBalancerPoolIdentity() bool { - return true -} - -// UnmarshalLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTargetPrototypeIP : LoadBalancerPoolMemberTargetPrototypeIP struct -// This model "extends" LoadBalancerPoolMemberTargetPrototype -type LoadBalancerPoolMemberTargetPrototypeIP struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} - -// NewLoadBalancerPoolMemberTargetPrototypeIP : Instantiate LoadBalancerPoolMemberTargetPrototypeIP (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeIP(address string) (_model *LoadBalancerPoolMemberTargetPrototypeIP, err error) { - _model = &LoadBalancerPoolMemberTargetPrototypeIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerPoolMemberTargetPrototypeIP) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeIP unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeIP from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. -// Models which "extend" this model: -// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID -// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN -// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref -// This model "extends" LoadBalancerPoolMemberTargetPrototype -type LoadBalancerPoolMemberTargetPrototypeInstanceIdentity struct { - // The unique identifier for this virtual server instance. - ID *string `json:"id,omitempty"` - - // The CRN for this virtual server instance. - CRN *string `json:"crn,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { - return true -} - -type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityIntf interface { - LoadBalancerPoolMemberTargetPrototypeIntf - isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTargetIP : LoadBalancerPoolMemberTargetIP struct -// This model "extends" LoadBalancerPoolMemberTarget -type LoadBalancerPoolMemberTargetIP struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} - -func (*LoadBalancerPoolMemberTargetIP) isaLoadBalancerPoolMemberTarget() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetIP unmarshals an instance of LoadBalancerPoolMemberTargetIP from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTargetInstanceReference : LoadBalancerPoolMemberTargetInstanceReference struct -// This model "extends" LoadBalancerPoolMemberTarget -type LoadBalancerPoolMemberTargetInstanceReference struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` - - // The name for this virtual server instance. The name is unique across all virtual server instances in the region. - Name *string `json:"name" validate:"required"` -} - -func (*LoadBalancerPoolMemberTargetInstanceReference) isaLoadBalancerPoolMemberTarget() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetInstanceReference unmarshals an instance of LoadBalancerPoolMemberTargetInstanceReference from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetInstanceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileIdentityByHref : LoadBalancerProfileIdentityByHref struct -// This model "extends" LoadBalancerProfileIdentity -type LoadBalancerProfileIdentityByHref struct { - // The URL for this load balancer profile. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerProfileIdentityByHref : Instantiate LoadBalancerProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerProfileIdentityByHref(href string) (_model *LoadBalancerProfileIdentityByHref, err error) { - _model = &LoadBalancerProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerProfileIdentityByHref) isaLoadBalancerProfileIdentity() bool { - return true -} - -// UnmarshalLoadBalancerProfileIdentityByHref unmarshals an instance of LoadBalancerProfileIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileIdentityByName : LoadBalancerProfileIdentityByName struct -// This model "extends" LoadBalancerProfileIdentity -type LoadBalancerProfileIdentityByName struct { - // The globally unique name for this load balancer profile. - Name *string `json:"name" validate:"required"` -} - -// NewLoadBalancerProfileIdentityByName : Instantiate LoadBalancerProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerProfileIdentityByName(name string) (_model *LoadBalancerProfileIdentityByName, err error) { - _model = &LoadBalancerProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerProfileIdentityByName) isaLoadBalancerProfileIdentity() bool { - return true -} - -// UnmarshalLoadBalancerProfileIdentityByName unmarshals an instance of LoadBalancerProfileIdentityByName from the specified map of raw messages. -func UnmarshalLoadBalancerProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileInstanceGroupsSupportedDependent : The instance groups support for a load balancer with this profile depends on its configuration. -// This model "extends" LoadBalancerProfileInstanceGroupsSupported -type LoadBalancerProfileInstanceGroupsSupportedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileInstanceGroupsSupportedDependent.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileInstanceGroupsSupportedDependentTypeDependentConst = "dependent" -) - -func (*LoadBalancerProfileInstanceGroupsSupportedDependent) isaLoadBalancerProfileInstanceGroupsSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedDependent from the specified map of raw messages. -func UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileInstanceGroupsSupportedDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileInstanceGroupsSupportedFixed : The instance groups support for a load balancer with this profile. -// This model "extends" LoadBalancerProfileInstanceGroupsSupported -type LoadBalancerProfileInstanceGroupsSupportedFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *bool `json:"value" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileInstanceGroupsSupportedFixed.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileInstanceGroupsSupportedFixedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileInstanceGroupsSupportedFixed) isaLoadBalancerProfileInstanceGroupsSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedFixed from the specified map of raw messages. -func UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileInstanceGroupsSupportedFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileRouteModeSupportedDependent : The route mode support for a load balancer with this profile depends on its configuration. -// This model "extends" LoadBalancerProfileRouteModeSupported -type LoadBalancerProfileRouteModeSupportedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileRouteModeSupportedDependent.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileRouteModeSupportedDependentTypeDependentConst = "dependent" -) - -func (*LoadBalancerProfileRouteModeSupportedDependent) isaLoadBalancerProfileRouteModeSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileRouteModeSupportedDependent unmarshals an instance of LoadBalancerProfileRouteModeSupportedDependent from the specified map of raw messages. -func UnmarshalLoadBalancerProfileRouteModeSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileRouteModeSupportedDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileRouteModeSupportedFixed : The route mode support for a load balancer with this profile. -// This model "extends" LoadBalancerProfileRouteModeSupported -type LoadBalancerProfileRouteModeSupportedFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *bool `json:"value" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileRouteModeSupportedFixed.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileRouteModeSupportedFixedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileRouteModeSupportedFixed) isaLoadBalancerProfileRouteModeSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileRouteModeSupportedFixed unmarshals an instance of LoadBalancerProfileRouteModeSupportedFixed from the specified map of raw messages. -func UnmarshalLoadBalancerProfileRouteModeSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileRouteModeSupportedFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileSecurityGroupsSupportedDependent : The security group support for a load balancer with this profile depends on its configuration. -// This model "extends" LoadBalancerProfileSecurityGroupsSupported -type LoadBalancerProfileSecurityGroupsSupportedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileSecurityGroupsSupportedDependent.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileSecurityGroupsSupportedDependentTypeDependentConst = "dependent" -) - -func (*LoadBalancerProfileSecurityGroupsSupportedDependent) isaLoadBalancerProfileSecurityGroupsSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedDependent from the specified map of raw messages. -func UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileSecurityGroupsSupportedDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileSecurityGroupsSupportedFixed : The security group support for a load balancer with this profile. -// This model "extends" LoadBalancerProfileSecurityGroupsSupported -type LoadBalancerProfileSecurityGroupsSupportedFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *bool `json:"value" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileSecurityGroupsSupportedFixed.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileSecurityGroupsSupportedFixedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileSecurityGroupsSupportedFixed) isaLoadBalancerProfileSecurityGroupsSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedFixed from the specified map of raw messages. -func UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileSecurityGroupsSupportedFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileUDPSupportedDependent : The UDP support for a load balancer with this profile depends on its configuration. -// This model "extends" LoadBalancerProfileUDPSupported -type LoadBalancerProfileUDPSupportedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileUDPSupportedDependent.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileUDPSupportedDependentTypeDependentConst = "dependent" -) - -func (*LoadBalancerProfileUDPSupportedDependent) isaLoadBalancerProfileUDPSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileUDPSupportedDependent unmarshals an instance of LoadBalancerProfileUDPSupportedDependent from the specified map of raw messages. -func UnmarshalLoadBalancerProfileUDPSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileUDPSupportedDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileUDPSupportedFixed : The UDP support for a load balancer with this profile. -// This model "extends" LoadBalancerProfileUDPSupported -type LoadBalancerProfileUDPSupportedFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *bool `json:"value" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileUDPSupportedFixed.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileUDPSupportedFixedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileUDPSupportedFixed) isaLoadBalancerProfileUDPSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileUDPSupportedFixed unmarshals an instance of LoadBalancerProfileUDPSupportedFixed from the specified map of raw messages. -func UnmarshalLoadBalancerProfileUDPSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileUDPSupportedFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLIdentityByCRN : NetworkACLIdentityByCRN struct -// This model "extends" NetworkACLIdentity -type NetworkACLIdentityByCRN struct { - // The CRN for this network ACL. - CRN *string `json:"crn" validate:"required"` -} - -// NewNetworkACLIdentityByCRN : Instantiate NetworkACLIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewNetworkACLIdentityByCRN(crn string) (_model *NetworkACLIdentityByCRN, err error) { - _model = &NetworkACLIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLIdentityByCRN) isaNetworkACLIdentity() bool { - return true -} - -// UnmarshalNetworkACLIdentityByCRN unmarshals an instance of NetworkACLIdentityByCRN from the specified map of raw messages. -func UnmarshalNetworkACLIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLIdentityByHref : NetworkACLIdentityByHref struct -// This model "extends" NetworkACLIdentity -type NetworkACLIdentityByHref struct { - // The URL for this network ACL. - Href *string `json:"href" validate:"required"` -} - -// NewNetworkACLIdentityByHref : Instantiate NetworkACLIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewNetworkACLIdentityByHref(href string) (_model *NetworkACLIdentityByHref, err error) { - _model = &NetworkACLIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLIdentityByHref) isaNetworkACLIdentity() bool { - return true -} - -// UnmarshalNetworkACLIdentityByHref unmarshals an instance of NetworkACLIdentityByHref from the specified map of raw messages. -func UnmarshalNetworkACLIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLIdentityByID : NetworkACLIdentityByID struct -// This model "extends" NetworkACLIdentity -type NetworkACLIdentityByID struct { - // The unique identifier for this network ACL. - ID *string `json:"id" validate:"required"` -} - -// NewNetworkACLIdentityByID : Instantiate NetworkACLIdentityByID (Generic Model Constructor) -func (*VpcV1) NewNetworkACLIdentityByID(id string) (_model *NetworkACLIdentityByID, err error) { - _model = &NetworkACLIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLIdentityByID) isaNetworkACLIdentity() bool { - return true -} - -// UnmarshalNetworkACLIdentityByID unmarshals an instance of NetworkACLIdentityByID from the specified map of raw messages. -func UnmarshalNetworkACLIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLPrototypeNetworkACLByRules : NetworkACLPrototypeNetworkACLByRules struct -// This model "extends" NetworkACLPrototype -type NetworkACLPrototypeNetworkACLByRules struct { - // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The VPC this network ACL will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, - // resulting in all traffic being denied. - Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` -} - -// NewNetworkACLPrototypeNetworkACLByRules : Instantiate NetworkACLPrototypeNetworkACLByRules (Generic Model Constructor) -func (*VpcV1) NewNetworkACLPrototypeNetworkACLByRules(vpc VPCIdentityIntf) (_model *NetworkACLPrototypeNetworkACLByRules, err error) { - _model = &NetworkACLPrototypeNetworkACLByRules{ - VPC: vpc, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLPrototypeNetworkACLByRules) isaNetworkACLPrototype() bool { - return true -} - -// UnmarshalNetworkACLPrototypeNetworkACLByRules unmarshals an instance of NetworkACLPrototypeNetworkACLByRules from the specified map of raw messages. -func UnmarshalNetworkACLPrototypeNetworkACLByRules(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLPrototypeNetworkACLByRules) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLPrototypeNetworkACLBySourceNetworkACL : NetworkACLPrototypeNetworkACLBySourceNetworkACL struct -// This model "extends" NetworkACLPrototype -type NetworkACLPrototypeNetworkACLBySourceNetworkACL struct { - // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The VPC this network ACL will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // Network ACL to copy rules from. - SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl" validate:"required"` -} - -// NewNetworkACLPrototypeNetworkACLBySourceNetworkACL : Instantiate NetworkACLPrototypeNetworkACLBySourceNetworkACL (Generic Model Constructor) -func (*VpcV1) NewNetworkACLPrototypeNetworkACLBySourceNetworkACL(vpc VPCIdentityIntf, sourceNetworkACL NetworkACLIdentityIntf) (_model *NetworkACLPrototypeNetworkACLBySourceNetworkACL, err error) { - _model = &NetworkACLPrototypeNetworkACLBySourceNetworkACL{ - VPC: vpc, - SourceNetworkACL: sourceNetworkACL, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLPrototypeNetworkACLBySourceNetworkACL) isaNetworkACLPrototype() bool { - return true -} - -// UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL unmarshals an instance of NetworkACLPrototypeNetworkACLBySourceNetworkACL from the specified map of raw messages. -func UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLPrototypeNetworkACLBySourceNetworkACL) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct -// This model "extends" NetworkACLRuleBeforePatch -type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct { - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` -} - -// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref, err error) { - _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePatch() bool { - return true -} - -// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct -// This model "extends" NetworkACLRuleBeforePatch -type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct { - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` -} - -// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID, err error) { - _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePatch() bool { - return true -} - -// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct -// This model "extends" NetworkACLRuleBeforePrototype -type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct { - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` -} - -// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref, err error) { - _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePrototype() bool { - return true -} - -// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct -// This model "extends" NetworkACLRuleBeforePrototype -type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct { - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` -} - -// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID, err error) { - _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePrototype() bool { - return true -} - -// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleItemNetworkACLRuleProtocolAll : NetworkACLRuleItemNetworkACLRuleProtocolAll struct -// This model "extends" NetworkACLRuleItem -type NetworkACLRuleItemNetworkACLRuleProtocolAll struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the - // collection. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolAllActionAllowConst = "allow" - NetworkACLRuleItemNetworkACLRuleProtocolAllActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" - NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolAllProtocolAllConst = "all" -) - -func (*NetworkACLRuleItemNetworkACLRuleProtocolAll) isaNetworkACLRuleItem() bool { - return true -} - -// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolAll from the specified map of raw messages. -func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleItemNetworkACLRuleProtocolAll) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleItemNetworkACLRuleProtocolIcmp : NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct -// This model "extends" NetworkACLRuleItem -type NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the - // collection. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The ICMP traffic code to match. - // - // If absent, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The ICMP traffic type to match. - // - // If absent, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionAllowConst = "allow" - NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" - NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" -) - -func (*NetworkACLRuleItemNetworkACLRuleProtocolIcmp) isaNetworkACLRuleItem() bool { - return true -} - -// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolIcmp from the specified map of raw messages. -func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleItemNetworkACLRuleProtocolIcmp) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleItemNetworkACLRuleProtocolTcpudp : NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct -// This model "extends" NetworkACLRuleItem -type NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the - // collection. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max" validate:"required"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min" validate:"required"` -} - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" -) - -func (*NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) isaNetworkACLRuleItem() bool { - return true -} - -// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolTcpudp from the specified map of raw messages. -func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct -// This model "extends" NetworkACLRulePrototypeNetworkACLContext -type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" -) - -// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { - return true -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct -// This model "extends" NetworkACLRulePrototypeNetworkACLContext -type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The ICMP traffic code to match. - // - // If specified, `type` must also be specified. If unspecified, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The ICMP traffic type to match. - // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" -) - -// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { - return true -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct -// This model "extends" NetworkACLRulePrototypeNetworkACLContext -type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" -) - -// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { - return true -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct -// This model "extends" NetworkACLRulePrototype -type NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" -) - -// NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototype() bool { - return true -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct -// This model "extends" NetworkACLRulePrototype -type NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The ICMP traffic code to match. - // - // If specified, `type` must also be specified. If unspecified, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The ICMP traffic type to match. - // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" -) - -// NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototype() bool { - return true -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct -// This model "extends" NetworkACLRulePrototype -type NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" -) - -// NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototype() bool { - return true -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleNetworkACLRuleProtocolAll : NetworkACLRuleNetworkACLRuleProtocolAll struct -// This model "extends" NetworkACLRule -type NetworkACLRuleNetworkACLRuleProtocolAll struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolAllActionAllowConst = "allow" - NetworkACLRuleNetworkACLRuleProtocolAllActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" - NetworkACLRuleNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleNetworkACLRuleProtocolAllProtocolAllConst = "all" -) - -func (*NetworkACLRuleNetworkACLRuleProtocolAll) isaNetworkACLRule() bool { - return true -} - -// UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolAll from the specified map of raw messages. -func UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleNetworkACLRuleProtocolAll) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleNetworkACLRuleProtocolIcmp : NetworkACLRuleNetworkACLRuleProtocolIcmp struct -// This model "extends" NetworkACLRule -type NetworkACLRuleNetworkACLRuleProtocolIcmp struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The ICMP traffic code to match. - // - // If absent, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The ICMP traffic type to match. - // - // If absent, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolIcmpActionAllowConst = "allow" - NetworkACLRuleNetworkACLRuleProtocolIcmpActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" - NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" -) - -func (*NetworkACLRuleNetworkACLRuleProtocolIcmp) isaNetworkACLRule() bool { - return true -} - -// UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolIcmp from the specified map of raw messages. -func UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleNetworkACLRuleProtocolIcmp) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleNetworkACLRuleProtocolTcpudp : NetworkACLRuleNetworkACLRuleProtocolTcpudp struct -// This model "extends" NetworkACLRule -type NetworkACLRuleNetworkACLRuleProtocolTcpudp struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max" validate:"required"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min" validate:"required"` -} - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" - NetworkACLRuleNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" - NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" - NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" -) - -func (*NetworkACLRuleNetworkACLRuleProtocolTcpudp) isaNetworkACLRule() bool { - return true -} - -// UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolTcpudp from the specified map of raw messages. -func UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleNetworkACLRuleProtocolTcpudp) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceIPPrototypeReservedIPIdentity : Identifies a reserved IP by a unique property. -// Models which "extend" this model: -// - NetworkInterfaceIPPrototypeReservedIPIdentityByID -// - NetworkInterfaceIPPrototypeReservedIPIdentityByHref -// This model "extends" NetworkInterfaceIPPrototype -type NetworkInterfaceIPPrototypeReservedIPIdentity struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` -} - -func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { - return true -} - -type NetworkInterfaceIPPrototypeReservedIPIdentityIntf interface { - NetworkInterfaceIPPrototypeIntf - isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool -} - -func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentity from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext : NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext struct -// This model "extends" NetworkInterfaceIPPrototype -type NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext struct { - // The IP address to reserve, which must not already be reserved on the subnet. - // - // If unspecified, an available address on the subnet will automatically be selected. - Address *string `json:"address,omitempty"` - - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with - // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated - // list of randomly-selected words. - Name *string `json:"name,omitempty"` -} - -func (*NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) isaNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// OperatingSystemIdentityByHref : OperatingSystemIdentityByHref struct -// This model "extends" OperatingSystemIdentity -type OperatingSystemIdentityByHref struct { - // The URL for this operating system. - Href *string `json:"href" validate:"required"` -} - -// NewOperatingSystemIdentityByHref : Instantiate OperatingSystemIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewOperatingSystemIdentityByHref(href string) (_model *OperatingSystemIdentityByHref, err error) { - _model = &OperatingSystemIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*OperatingSystemIdentityByHref) isaOperatingSystemIdentity() bool { - return true -} - -// UnmarshalOperatingSystemIdentityByHref unmarshals an instance of OperatingSystemIdentityByHref from the specified map of raw messages. -func UnmarshalOperatingSystemIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// OperatingSystemIdentityByName : OperatingSystemIdentityByName struct -// This model "extends" OperatingSystemIdentity -type OperatingSystemIdentityByName struct { - // The globally unique name for this operating system. - Name *string `json:"name" validate:"required"` -} - -// NewOperatingSystemIdentityByName : Instantiate OperatingSystemIdentityByName (Generic Model Constructor) -func (*VpcV1) NewOperatingSystemIdentityByName(name string) (_model *OperatingSystemIdentityByName, err error) { - _model = &OperatingSystemIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*OperatingSystemIdentityByName) isaOperatingSystemIdentity() bool { - return true -} - -// UnmarshalOperatingSystemIdentityByName unmarshals an instance of OperatingSystemIdentityByName from the specified map of raw messages. -func UnmarshalOperatingSystemIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayFloatingIPPrototypeFloatingIPIdentity : Identifies a floating IP by a unique property. -// Models which "extend" this model: -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress -// This model "extends" PublicGatewayFloatingIPPrototype -type PublicGatewayFloatingIPPrototypeFloatingIPIdentity struct { - // The unique identifier for this floating IP. - ID *string `json:"id,omitempty"` - - // The CRN for this floating IP. - CRN *string `json:"crn,omitempty"` - - // The URL for this floating IP. - Href *string `json:"href,omitempty"` - - // The globally unique IP address. - Address *string `json:"address,omitempty"` -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { - return true -} - -type PublicGatewayFloatingIPPrototypeFloatingIPIdentityIntf interface { - PublicGatewayFloatingIPPrototypeIntf - isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentity from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext : PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct -// This model "extends" PublicGatewayFloatingIPPrototype -type PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct { - // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayIdentityPublicGatewayIdentityByCRN : PublicGatewayIdentityPublicGatewayIdentityByCRN struct -// This model "extends" PublicGatewayIdentity -type PublicGatewayIdentityPublicGatewayIdentityByCRN struct { - // The CRN for this public gateway. - CRN *string `json:"crn" validate:"required"` -} - -// NewPublicGatewayIdentityPublicGatewayIdentityByCRN : Instantiate PublicGatewayIdentityPublicGatewayIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByCRN(crn string) (_model *PublicGatewayIdentityPublicGatewayIdentityByCRN, err error) { - _model = &PublicGatewayIdentityPublicGatewayIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*PublicGatewayIdentityPublicGatewayIdentityByCRN) isaPublicGatewayIdentity() bool { - return true -} - -// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByCRN from the specified map of raw messages. -func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayIdentityPublicGatewayIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayIdentityPublicGatewayIdentityByHref : PublicGatewayIdentityPublicGatewayIdentityByHref struct -// This model "extends" PublicGatewayIdentity -type PublicGatewayIdentityPublicGatewayIdentityByHref struct { - // The URL for this public gateway. - Href *string `json:"href" validate:"required"` -} - -// NewPublicGatewayIdentityPublicGatewayIdentityByHref : Instantiate PublicGatewayIdentityPublicGatewayIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByHref(href string) (_model *PublicGatewayIdentityPublicGatewayIdentityByHref, err error) { - _model = &PublicGatewayIdentityPublicGatewayIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*PublicGatewayIdentityPublicGatewayIdentityByHref) isaPublicGatewayIdentity() bool { - return true -} - -// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByHref from the specified map of raw messages. -func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayIdentityPublicGatewayIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayIdentityPublicGatewayIdentityByID : PublicGatewayIdentityPublicGatewayIdentityByID struct -// This model "extends" PublicGatewayIdentity -type PublicGatewayIdentityPublicGatewayIdentityByID struct { - // The unique identifier for this public gateway. - ID *string `json:"id" validate:"required"` -} - -// NewPublicGatewayIdentityPublicGatewayIdentityByID : Instantiate PublicGatewayIdentityPublicGatewayIdentityByID (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByID(id string) (_model *PublicGatewayIdentityPublicGatewayIdentityByID, err error) { - _model = &PublicGatewayIdentityPublicGatewayIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*PublicGatewayIdentityPublicGatewayIdentityByID) isaPublicGatewayIdentity() bool { - return true -} - -// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByID from the specified map of raw messages. -func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayIdentityPublicGatewayIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RegionIdentityByHref : RegionIdentityByHref struct -// This model "extends" RegionIdentity -type RegionIdentityByHref struct { - // The URL for this region. - Href *string `json:"href" validate:"required"` -} - -// NewRegionIdentityByHref : Instantiate RegionIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewRegionIdentityByHref(href string) (_model *RegionIdentityByHref, err error) { - _model = &RegionIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*RegionIdentityByHref) isaRegionIdentity() bool { - return true -} - -// UnmarshalRegionIdentityByHref unmarshals an instance of RegionIdentityByHref from the specified map of raw messages. -func UnmarshalRegionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RegionIdentityByName : RegionIdentityByName struct -// This model "extends" RegionIdentity -type RegionIdentityByName struct { - // The globally unique name for this region. - Name *string `json:"name" validate:"required"` -} - -// NewRegionIdentityByName : Instantiate RegionIdentityByName (Generic Model Constructor) -func (*VpcV1) NewRegionIdentityByName(name string) (_model *RegionIdentityByName, err error) { - _model = &RegionIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*RegionIdentityByName) isaRegionIdentity() bool { - return true -} - -// UnmarshalRegionIdentityByName unmarshals an instance of RegionIdentityByName from the specified map of raw messages. -func UnmarshalRegionIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetPrototypeEndpointGatewayIdentity : ReservedIPTargetPrototypeEndpointGatewayIdentity struct -// Models which "extend" this model: -// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID -// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN -// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref -// This model "extends" ReservedIPTargetPrototype -type ReservedIPTargetPrototypeEndpointGatewayIdentity struct { - // The unique identifier for this endpoint gateway. - ID *string `json:"id,omitempty"` - - // The CRN for this endpoint gateway. - CRN *string `json:"crn,omitempty"` - - // The URL for this endpoint gateway. - Href *string `json:"href,omitempty"` -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { - return true -} - -type ReservedIPTargetPrototypeEndpointGatewayIdentityIntf interface { - ReservedIPTargetPrototypeIntf - isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentity from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" ReservedIPTargetPrototype -type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { - ReservedIPTargetPrototypeIntf - isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext : ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // The URL for this bare metal server network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network interface. - ID *string `json:"id" validate:"required"` - - // The name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext.ResourceType property. -// The resource type. -const ( - ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetEndpointGatewayReference : ReservedIPTargetEndpointGatewayReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetEndpointGatewayReference struct { - // The CRN for this endpoint gateway. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this endpoint gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this endpoint gateway. - ID *string `json:"id" validate:"required"` - - // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetEndpointGatewayReference.ResourceType property. -// The resource type. -const ( - ReservedIPTargetEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" -) - -func (*ReservedIPTargetEndpointGatewayReference) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetEndpointGatewayReference unmarshals an instance of ReservedIPTargetEndpointGatewayReference from the specified map of raw messages. -func UnmarshalReservedIPTargetEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetEndpointGatewayReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetGenericResourceReference : Identifying information for a resource that is not native to the VPC API. -// This model "extends" ReservedIPTarget -type ReservedIPTargetGenericResourceReference struct { - // The CRN for the resource. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *GenericResourceReferenceDeleted `json:"deleted,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetGenericResourceReference.ResourceType property. -// The resource type. -const ( - ReservedIPTargetGenericResourceReferenceResourceTypeCloudResourceConst = "cloud_resource" -) - -func (*ReservedIPTargetGenericResourceReference) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetGenericResourceReference unmarshals an instance of ReservedIPTargetGenericResourceReference from the specified map of raw messages. -func UnmarshalReservedIPTargetGenericResourceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetGenericResourceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalGenericResourceReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetLoadBalancerReference : ReservedIPTargetLoadBalancerReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetLoadBalancerReference struct { - // The load balancer's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` - - // The load balancer's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer. - ID *string `json:"id" validate:"required"` - - // The name for this load balancer. The name is unique across all load balancers in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetLoadBalancerReference.ResourceType property. -// The resource type. -const ( - ReservedIPTargetLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" -) - -func (*ReservedIPTargetLoadBalancerReference) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetLoadBalancerReference unmarshals an instance of ReservedIPTargetLoadBalancerReference from the specified map of raw messages. -func UnmarshalReservedIPTargetLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetLoadBalancerReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetNetworkInterfaceReferenceTargetContext : ReservedIPTargetNetworkInterfaceReferenceTargetContext struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network interface. - ID *string `json:"id" validate:"required"` - - // The name for this instance network interface. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetNetworkInterfaceReferenceTargetContext.ResourceType property. -// The resource type. -const ( - ReservedIPTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*ReservedIPTargetNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetVPNGatewayReference : ReservedIPTargetVPNGatewayReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetVPNGatewayReference struct { - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetVPNGatewayReference.ResourceType property. -// The resource type. -const ( - ReservedIPTargetVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" -) - -func (*ReservedIPTargetVPNGatewayReference) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetVPNGatewayReference unmarshals an instance of ReservedIPTargetVPNGatewayReference from the specified map of raw messages. -func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetVPNGatewayReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetVPNServerReference : ReservedIPTargetVPNServerReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetVPNServerReference struct { - // The CRN for this VPN server. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this VPN server. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN server. - ID *string `json:"id" validate:"required"` - - // The name for this VPN server. The name is unique across all VPN servers in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetVPNServerReference.ResourceType property. -// The resource type. -const ( - ReservedIPTargetVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" -) - -func (*ReservedIPTargetVPNServerReference) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetVPNServerReference unmarshals an instance of ReservedIPTargetVPNServerReference from the specified map of raw messages. -func UnmarshalReservedIPTargetVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetVPNServerReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext : ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` - - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` - - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext.ResourceType property. -// The resource type. -const ( - ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" -) - -func (*ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext unmarshals an instance of ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext from the specified map of raw messages. -func UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ResourceGroupIdentityByID : ResourceGroupIdentityByID struct -// This model "extends" ResourceGroupIdentity -type ResourceGroupIdentityByID struct { - // The unique identifier for this resource group. - ID *string `json:"id" validate:"required"` -} - -// NewResourceGroupIdentityByID : Instantiate ResourceGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewResourceGroupIdentityByID(id string) (_model *ResourceGroupIdentityByID, err error) { - _model = &ResourceGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ResourceGroupIdentityByID) isaResourceGroupIdentity() bool { - return true -} - -// UnmarshalResourceGroupIdentityByID unmarshals an instance of ResourceGroupIdentityByID from the specified map of raw messages. -func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResourceGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteCreatorVPNGatewayReference : RouteCreatorVPNGatewayReference struct -// This model "extends" RouteCreator -type RouteCreatorVPNGatewayReference struct { - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the RouteCreatorVPNGatewayReference.ResourceType property. -// The resource type. -const ( - RouteCreatorVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" -) - -func (*RouteCreatorVPNGatewayReference) isaRouteCreator() bool { - return true -} - -// UnmarshalRouteCreatorVPNGatewayReference unmarshals an instance of RouteCreatorVPNGatewayReference from the specified map of raw messages. -func UnmarshalRouteCreatorVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCreatorVPNGatewayReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteCreatorVPNServerReference : RouteCreatorVPNServerReference struct -// This model "extends" RouteCreator -type RouteCreatorVPNServerReference struct { - // The CRN for this VPN server. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this VPN server. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN server. - ID *string `json:"id" validate:"required"` - - // The name for this VPN server. The name is unique across all VPN servers in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the RouteCreatorVPNServerReference.ResourceType property. -// The resource type. -const ( - RouteCreatorVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" -) - -func (*RouteCreatorVPNServerReference) isaRouteCreator() bool { - return true -} - -// UnmarshalRouteCreatorVPNServerReference unmarshals an instance of RouteCreatorVPNServerReference from the specified map of raw messages. -func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCreatorVPNServerReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopIP : RouteNextHopIP struct -// This model "extends" RouteNextHop -type RouteNextHopIP struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} - -func (*RouteNextHopIP) isaRouteNextHop() bool { - return true -} - -// UnmarshalRouteNextHopIP unmarshals an instance of RouteNextHopIP from the specified map of raw messages. -func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPatchRouteNextHopIP : RouteNextHopPatchRouteNextHopIP struct -// Models which "extend" this model: -// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP -// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP -// This model "extends" RouteNextHopPatch -type RouteNextHopPatchRouteNextHopIP struct { - // The sentinel IP address (`0.0.0.0`). - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` -} - -func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatchRouteNextHopIP() bool { - return true -} - -type RouteNextHopPatchRouteNextHopIPIntf interface { - RouteNextHopPatchIntf - isaRouteNextHopPatchRouteNextHopIP() bool -} - -func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatch() bool { - return true -} - -// UnmarshalRouteNextHopPatchRouteNextHopIP unmarshals an instance of RouteNextHopPatchRouteNextHopIP from the specified map of raw messages. -func UnmarshalRouteNextHopPatchRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchRouteNextHopIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPatchVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. -// Models which "extend" this model: -// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID -// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref -// This model "extends" RouteNextHopPatch -type RouteNextHopPatchVPNGatewayConnectionIdentity struct { - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { - return true -} - -type RouteNextHopPatchVPNGatewayConnectionIdentityIntf interface { - RouteNextHopPatchIntf - isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool -} - -func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatch() bool { - return true -} - -// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentity from the specified map of raw messages. -func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchVPNGatewayConnectionIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopVPNGatewayConnectionReference : RouteNextHopVPNGatewayConnectionReference struct -// This model "extends" RouteNextHop -type RouteNextHopVPNGatewayConnectionReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the RouteNextHopVPNGatewayConnectionReference.ResourceType property. -// The resource type. -const ( - RouteNextHopVPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -func (*RouteNextHopVPNGatewayConnectionReference) isaRouteNextHop() bool { - return true -} - -// UnmarshalRouteNextHopVPNGatewayConnectionReference unmarshals an instance of RouteNextHopVPNGatewayConnectionReference from the specified map of raw messages. -func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopVPNGatewayConnectionReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct -// Models which "extend" this model: -// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP -// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP -// This model "extends" RoutePrototypeNextHop -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct { - // The sentinel IP address (`0.0.0.0`). - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { - return true -} - -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPIntf interface { - RoutePrototypeNextHopIntf - isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. -// Models which "extend" this model: -// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID -// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref -// This model "extends" RoutePrototypeNextHop -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity struct { - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { - return true -} - -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityIntf interface { - RoutePrototypeNextHopIntf - isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutingTableIdentityByHref : RoutingTableIdentityByHref struct -// This model "extends" RoutingTableIdentity -type RoutingTableIdentityByHref struct { - // The URL for this routing table. - Href *string `json:"href" validate:"required"` -} - -// NewRoutingTableIdentityByHref : Instantiate RoutingTableIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewRoutingTableIdentityByHref(href string) (_model *RoutingTableIdentityByHref, err error) { - _model = &RoutingTableIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*RoutingTableIdentityByHref) isaRoutingTableIdentity() bool { - return true -} - -// UnmarshalRoutingTableIdentityByHref unmarshals an instance of RoutingTableIdentityByHref from the specified map of raw messages. -func UnmarshalRoutingTableIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutingTableIdentityByID : RoutingTableIdentityByID struct -// This model "extends" RoutingTableIdentity -type RoutingTableIdentityByID struct { - // The unique identifier for this routing table. - ID *string `json:"id" validate:"required"` -} - -// NewRoutingTableIdentityByID : Instantiate RoutingTableIdentityByID (Generic Model Constructor) -func (*VpcV1) NewRoutingTableIdentityByID(id string) (_model *RoutingTableIdentityByID, err error) { - _model = &RoutingTableIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*RoutingTableIdentityByID) isaRoutingTableIdentity() bool { - return true -} - -// UnmarshalRoutingTableIdentityByID unmarshals an instance of RoutingTableIdentityByID from the specified map of raw messages. -func UnmarshalRoutingTableIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupIdentityByCRN : SecurityGroupIdentityByCRN struct -// This model "extends" SecurityGroupIdentity -type SecurityGroupIdentityByCRN struct { - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` -} - -// NewSecurityGroupIdentityByCRN : Instantiate SecurityGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupIdentityByCRN, err error) { - _model = &SecurityGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupIdentityByCRN) isaSecurityGroupIdentity() bool { - return true -} - -// UnmarshalSecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalSecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupIdentityByHref : SecurityGroupIdentityByHref struct -// This model "extends" SecurityGroupIdentity -type SecurityGroupIdentityByHref struct { - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewSecurityGroupIdentityByHref : Instantiate SecurityGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupIdentityByHref(href string) (_model *SecurityGroupIdentityByHref, err error) { - _model = &SecurityGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupIdentityByHref) isaSecurityGroupIdentity() bool { - return true -} - -// UnmarshalSecurityGroupIdentityByHref unmarshals an instance of SecurityGroupIdentityByHref from the specified map of raw messages. -func UnmarshalSecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupIdentityByID : SecurityGroupIdentityByID struct -// This model "extends" SecurityGroupIdentity -type SecurityGroupIdentityByID struct { - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` -} - -// NewSecurityGroupIdentityByID : Instantiate SecurityGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupIdentityByID(id string) (_model *SecurityGroupIdentityByID, err error) { - _model = &SecurityGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupIdentityByID) isaSecurityGroupIdentity() bool { - return true -} - -// UnmarshalSecurityGroupIdentityByID unmarshals an instance of SecurityGroupIdentityByID from the specified map of raw messages. -func UnmarshalSecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. -// This model "extends" SecurityGroupRulePrototype -type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The remote IP addresses or security groups from which this rule will allow traffic (or to - // which, for outbound rules). Can be specified as an IP address, a CIDR block, or a - // security group within the VPC. - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` -} - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllProtocolAllConst = "all" -) - -// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll, err error) { - _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll{ - Direction: core.StringPtr(direction), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) isaSecurityGroupRulePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll from the specified map of raw messages. -func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. -// This model "extends" SecurityGroupRulePrototype -type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { - // The ICMP traffic code to allow. - // - // If specified, `type` must also be specified. If unspecified, all codes are allowed. - Code *int64 `json:"code,omitempty"` - - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The remote IP addresses or security groups from which this rule will allow traffic (or to - // which, for outbound rules). Can be specified as an IP address, a CIDR block, or a - // security group within the VPC. - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` - - // The ICMP traffic type to allow. - // - // If unspecified, all types are allowed. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" -) - -// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp, err error) { - _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp{ - Direction: core.StringPtr(direction), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) isaSecurityGroupRulePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp from the specified map of raw messages. -func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. -// -// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are -// allowed for the protocol. When both have the same value, that single destination port is allowed. -// This model "extends" SecurityGroupRulePrototype -type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` - - // The inclusive upper bound of TCP/UDP destination port range. - // - // If specified, `port_min` must also be specified, and must not be larger. If unspecified, - // `port_min` must also be unspecified, allowing traffic on all destination ports. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range - // - // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be - // unspecified, allowing traffic on all destination ports. - PortMin *int64 `json:"port_min,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The remote IP addresses or security groups from which this rule will allow traffic (or to - // which, for outbound rules). Can be specified as an IP address, a CIDR block, or a - // security group within the VPC. - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` -} - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" -) - -// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp, err error) { - _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp{ - Direction: core.StringPtr(direction), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRulePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. -func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePatchCIDR : SecurityGroupRuleRemotePatchCIDR struct -// This model "extends" SecurityGroupRuleRemotePatch -type SecurityGroupRuleRemotePatchCIDR struct { - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. - CIDRBlock *string `json:"cidr_block" validate:"required"` -} - -// NewSecurityGroupRuleRemotePatchCIDR : Instantiate SecurityGroupRuleRemotePatchCIDR (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePatchCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePatchCIDR, err error) { - _model = &SecurityGroupRuleRemotePatchCIDR{ - CIDRBlock: core.StringPtr(cidrBlock), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRuleRemotePatchCIDR) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePatchCIDR unmarshals an instance of SecurityGroupRuleRemotePatchCIDR from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchCIDR) - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePatchIP : SecurityGroupRuleRemotePatchIP struct -// This model "extends" SecurityGroupRuleRemotePatch -type SecurityGroupRuleRemotePatchIP struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} - -// NewSecurityGroupRuleRemotePatchIP : Instantiate SecurityGroupRuleRemotePatchIP (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePatchIP(address string) (_model *SecurityGroupRuleRemotePatchIP, err error) { - _model = &SecurityGroupRuleRemotePatchIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRuleRemotePatchIP) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePatchIP unmarshals an instance of SecurityGroupRuleRemotePatchIP from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePatchSecurityGroupIdentity : Identifies a security group by a unique property. -// Models which "extend" this model: -// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID -// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN -// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref -// This model "extends" SecurityGroupRuleRemotePatch -type SecurityGroupRuleRemotePatchSecurityGroupIdentity struct { - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The security group's CRN. - CRN *string `json:"crn,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { - return true -} - -type SecurityGroupRuleRemotePatchSecurityGroupIdentityIntf interface { - SecurityGroupRuleRemotePatchIntf - isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentity from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePrototypeCIDR : SecurityGroupRuleRemotePrototypeCIDR struct -// This model "extends" SecurityGroupRuleRemotePrototype -type SecurityGroupRuleRemotePrototypeCIDR struct { - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. - CIDRBlock *string `json:"cidr_block" validate:"required"` -} - -// NewSecurityGroupRuleRemotePrototypeCIDR : Instantiate SecurityGroupRuleRemotePrototypeCIDR (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePrototypeCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePrototypeCIDR, err error) { - _model = &SecurityGroupRuleRemotePrototypeCIDR{ - CIDRBlock: core.StringPtr(cidrBlock), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRuleRemotePrototypeCIDR) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePrototypeCIDR unmarshals an instance of SecurityGroupRuleRemotePrototypeCIDR from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeCIDR) - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePrototypeIP : SecurityGroupRuleRemotePrototypeIP struct -// This model "extends" SecurityGroupRuleRemotePrototype -type SecurityGroupRuleRemotePrototypeIP struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} - -// NewSecurityGroupRuleRemotePrototypeIP : Instantiate SecurityGroupRuleRemotePrototypeIP (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePrototypeIP(address string) (_model *SecurityGroupRuleRemotePrototypeIP, err error) { - _model = &SecurityGroupRuleRemotePrototypeIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRuleRemotePrototypeIP) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePrototypeIP unmarshals an instance of SecurityGroupRuleRemotePrototypeIP from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePrototypeSecurityGroupIdentity : Identifies a security group by a unique property. -// Models which "extend" this model: -// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID -// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN -// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref -// This model "extends" SecurityGroupRuleRemotePrototype -type SecurityGroupRuleRemotePrototypeSecurityGroupIdentity struct { - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The security group's CRN. - CRN *string `json:"crn,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { - return true -} - -type SecurityGroupRuleRemotePrototypeSecurityGroupIdentityIntf interface { - SecurityGroupRuleRemotePrototypeIntf - isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentity from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemoteCIDR : SecurityGroupRuleRemoteCIDR struct -// This model "extends" SecurityGroupRuleRemote -type SecurityGroupRuleRemoteCIDR struct { - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. - CIDRBlock *string `json:"cidr_block" validate:"required"` -} - -func (*SecurityGroupRuleRemoteCIDR) isaSecurityGroupRuleRemote() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemoteCIDR unmarshals an instance of SecurityGroupRuleRemoteCIDR from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemoteCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemoteCIDR) - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemoteIP : SecurityGroupRuleRemoteIP struct -// This model "extends" SecurityGroupRuleRemote -type SecurityGroupRuleRemoteIP struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} - -func (*SecurityGroupRuleRemoteIP) isaSecurityGroupRuleRemote() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemoteIP unmarshals an instance of SecurityGroupRuleRemoteIP from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemoteIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemoteIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemoteSecurityGroupReference : SecurityGroupRuleRemoteSecurityGroupReference struct -// This model "extends" SecurityGroupRuleRemote -type SecurityGroupRuleRemoteSecurityGroupReference struct { - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` - - // The name for this security group. The name is unique across all security groups for the VPC. - Name *string `json:"name" validate:"required"` -} - -func (*SecurityGroupRuleRemoteSecurityGroupReference) isaSecurityGroupRuleRemote() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemoteSecurityGroupReference unmarshals an instance of SecurityGroupRuleRemoteSecurityGroupReference from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemoteSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemoteSecurityGroupReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. -// This model "extends" SecurityGroupRule -type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The URL for this security group rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group rule. - ID *string `json:"id" validate:"required"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version" validate:"required"` - - Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" - SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolAllProtocolAllConst = "all" -) - -func (*SecurityGroupRuleSecurityGroupRuleProtocolAll) isaSecurityGroupRule() bool { - return true -} - -// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolAll from the specified map of raw messages. -func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleSecurityGroupRuleProtocolAll) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. -// This model "extends" SecurityGroupRule -type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The URL for this security group rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group rule. - ID *string `json:"id" validate:"required"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version" validate:"required"` - - Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` - - // The ICMP traffic code to allow. If absent, all codes are allowed. - Code *int64 `json:"code,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The ICMP traffic type to allow. If absent, all types are allowed. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" - SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" -) - -func (*SecurityGroupRuleSecurityGroupRuleProtocolIcmp) isaSecurityGroupRule() bool { - return true -} - -// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolIcmp from the specified map of raw messages. -func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleSecurityGroupRuleProtocolIcmp) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. -// -// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are -// allowed for the protocol. When both have the same value, that single destination port is allowed. -// This model "extends" SecurityGroupRule -type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The URL for this security group rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group rule. - ID *string `json:"id" validate:"required"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version" validate:"required"` - - Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - PortMin *int64 `json:"port_min,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" -) - -func (*SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRule() bool { - return true -} - -// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. -func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // The URL for this bare metal server network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network interface. - ID *string `json:"id" validate:"required"` - - // The name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupTargetReferenceEndpointGatewayReference : SecurityGroupTargetReferenceEndpointGatewayReference struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceEndpointGatewayReference struct { - // The CRN for this endpoint gateway. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this endpoint gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this endpoint gateway. - ID *string `json:"id" validate:"required"` - - // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceEndpointGatewayReference.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" -) - -func (*SecurityGroupTargetReferenceEndpointGatewayReference) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference unmarshals an instance of SecurityGroupTargetReferenceEndpointGatewayReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceEndpointGatewayReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupTargetReferenceLoadBalancerReference : SecurityGroupTargetReferenceLoadBalancerReference struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceLoadBalancerReference struct { - // The load balancer's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` - - // The load balancer's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer. - ID *string `json:"id" validate:"required"` - - // The name for this load balancer. The name is unique across all load balancers in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceLoadBalancerReference.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" -) - -func (*SecurityGroupTargetReferenceLoadBalancerReference) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceLoadBalancerReference unmarshals an instance of SecurityGroupTargetReferenceLoadBalancerReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceLoadBalancerReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network interface. - ID *string `json:"id" validate:"required"` - - // The name for this instance network interface. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupTargetReferenceVPNServerReference : SecurityGroupTargetReferenceVPNServerReference struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceVPNServerReference struct { - // The CRN for this VPN server. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this VPN server. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN server. - ID *string `json:"id" validate:"required"` - - // The name for this VPN server. The name is unique across all VPN servers in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceVPNServerReference.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" -) - -func (*SecurityGroupTargetReferenceVPNServerReference) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceVPNServerReference unmarshals an instance of SecurityGroupTargetReferenceVPNServerReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceVPNServerReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupTargetReferenceVirtualNetworkInterfaceReference : SecurityGroupTargetReferenceVirtualNetworkInterfaceReference struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceVirtualNetworkInterfaceReference struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VirtualNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` - - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - Name *string `json:"name" validate:"required"` - - // The primary IP for this virtual network interface. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceVirtualNetworkInterfaceReference.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceVirtualNetworkInterfaceReferenceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" -) - -func (*SecurityGroupTargetReferenceVirtualNetworkInterfaceReference) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference unmarshals an instance of SecurityGroupTargetReferenceVirtualNetworkInterfaceReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceVirtualNetworkInterfaceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareIdentityByCRN : ShareIdentityByCRN struct -// This model "extends" ShareIdentity -type ShareIdentityByCRN struct { - // The CRN for this file share. - CRN *string `json:"crn" validate:"required"` -} - -// NewShareIdentityByCRN : Instantiate ShareIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewShareIdentityByCRN(crn string) (_model *ShareIdentityByCRN, err error) { - _model = &ShareIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ShareIdentityByCRN) isaShareIdentity() bool { - return true -} - -// UnmarshalShareIdentityByCRN unmarshals an instance of ShareIdentityByCRN from the specified map of raw messages. -func UnmarshalShareIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareIdentityByHref : ShareIdentityByHref struct -// This model "extends" ShareIdentity -type ShareIdentityByHref struct { - // The URL for this file share. - Href *string `json:"href" validate:"required"` -} - -// NewShareIdentityByHref : Instantiate ShareIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewShareIdentityByHref(href string) (_model *ShareIdentityByHref, err error) { - _model = &ShareIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ShareIdentityByHref) isaShareIdentity() bool { - return true -} - -// UnmarshalShareIdentityByHref unmarshals an instance of ShareIdentityByHref from the specified map of raw messages. -func UnmarshalShareIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareIdentityByID : ShareIdentityByID struct -// This model "extends" ShareIdentity -type ShareIdentityByID struct { - // The unique identifier for this file share. - ID *string `json:"id" validate:"required"` -} - -// NewShareIdentityByID : Instantiate ShareIdentityByID (Generic Model Constructor) -func (*VpcV1) NewShareIdentityByID(id string) (_model *ShareIdentityByID, err error) { - _model = &ShareIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ShareIdentityByID) isaShareIdentity() bool { - return true -} - -// UnmarshalShareIdentityByID unmarshals an instance of ShareIdentityByID from the specified map of raw messages. -func UnmarshalShareIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : The virtual network interface for this share mount target. The virtual network interface must: -// -// - have `allow_ip_spoofing` set to `false` -// - have `enable_infrastructure_nat` set to `true` -// - not be in the same VPC as an existing mount target for this share -// - not have `ips` other than the `primary_ip` address -// -// If an existing virtual network interface is specified, it must not have a floating IP bound to it, and it must not be -// the target of a flow log collector. -// -// Required if the share's `access_control_mode` is `security_group`. -// This model "extends" ShareMountTargetPrototype -type ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup struct { - // The name for this share mount target. The name must not be used by another mount target for the file share. - Name *string `json:"name,omitempty"` - - // The transit encryption mode to use for this share mount target: - // - `none`: Not encrypted in transit. - // - `user_managed`: Encrypted in transit using an instance identity certificate. The - // `access_control_mode` for the share must be `security_group`. - TransitEncryption *string `json:"transit_encryption,omitempty"` - - VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface" validate:"required"` -} - -// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.TransitEncryption property. -// The transit encryption mode to use for this share mount target: -// - `none`: Not encrypted in transit. -// - `user_managed`: Encrypted in transit using an instance identity certificate. The -// `access_control_mode` for the share must be `security_group`. -const ( - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionNoneConst = "none" - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionUserManagedConst = "user_managed" -) - -// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup (Generic Model Constructor) -func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(virtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup, err error) { - _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup{ - VirtualNetworkInterface: virtualNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) isaShareMountTargetPrototype() bool { - return true -} - -// UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup unmarshals an instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup from the specified map of raw messages. -func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) - if err != nil { - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC : The VPC in which clients can mount the file share using this mount target. The VPC must not be used by another mount -// target for this share. -// -// Required if the share's `access_control_mode` is `vpc`. -// This model "extends" ShareMountTargetPrototype -type ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC struct { - // The name for this share mount target. The name must not be used by another mount target for the file share. - Name *string `json:"name,omitempty"` - - // The transit encryption mode to use for this share mount target: - // - `none`: Not encrypted in transit. - // - `user_managed`: Encrypted in transit using an instance identity certificate. The - // `access_control_mode` for the share must be `security_group`. - TransitEncryption *string `json:"transit_encryption,omitempty"` - - // Identifies a VPC by a unique property. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` -} - -// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC.TransitEncryption property. -// The transit encryption mode to use for this share mount target: -// - `none`: Not encrypted in transit. -// - `user_managed`: Encrypted in transit using an instance identity certificate. The -// `access_control_mode` for the share must be `security_group`. -const ( - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionNoneConst = "none" - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionUserManagedConst = "user_managed" -) - -// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC (Generic Model Constructor) -func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(vpc VPCIdentityIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC, err error) { - _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC{ - VPC: vpc, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC) isaShareMountTargetPrototype() bool { - return true -} - -// UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC unmarshals an instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC from the specified map of raw messages. -func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototype -type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityIntf interface { - ShareMountTargetVirtualNetworkInterfacePrototypeIntf - isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext : The virtual network interface for this target. -// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototype -type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext struct { - // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on - // this interface. If `true`, source IP spoofing is allowed on this interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the virtual network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - If the virtual network interface is attached, the target `resource_type` must be - // `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 - // as a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // same subnet as the primary IP. - // - // If reserved IP identities are provided, the specified reserved IPs must be unbound. - // - // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network - // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet - // will be automatically selected and reserved. - Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are - // reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the virtual network interface. May be either a - // reserved IP identity, or a reserved IP prototype object which will be used to create a - // new reserved IP. - // - // If a reserved IP identity is provided, the specified reserved IP must be unbound. - // - // If a reserved IP prototype object with an address is provided, the address must be - // available on the virtual network interface's subnet. If no address is specified, - // an available address on the subnet will be automatically selected and reserved. - PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The resource group to use for this virtual network interface. If unspecified, the - // share's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. Required if `primary_ip` does not specify a reserved IP. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext from the specified map of raw messages. -func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileCapacityDependentRange : The permitted total capacity (in gigabytes) of a share with this profile depends on its configuration. -// This model "extends" ShareProfileCapacity -type ShareProfileCapacityDependentRange struct { - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the ShareProfileCapacityDependentRange.Type property. -// The type for this profile field. -const ( - ShareProfileCapacityDependentRangeTypeDependentConst = "dependent" - ShareProfileCapacityDependentRangeTypeDependentRangeConst = "dependent_range" -) - -func (*ShareProfileCapacityDependentRange) isaShareProfileCapacity() bool { - return true -} - -// UnmarshalShareProfileCapacityDependentRange unmarshals an instance of ShareProfileCapacityDependentRange from the specified map of raw messages. -func UnmarshalShareProfileCapacityDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCapacityDependentRange) - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileCapacityEnum : The permitted total capacities (in gigabytes) of a share with this profile. -// This model "extends" ShareProfileCapacity -type ShareProfileCapacityEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the ShareProfileCapacityEnum.Type property. -// The type for this profile field. -const ( - ShareProfileCapacityEnumTypeEnumConst = "enum" -) - -func (*ShareProfileCapacityEnum) isaShareProfileCapacity() bool { - return true -} - -// UnmarshalShareProfileCapacityEnum unmarshals an instance of ShareProfileCapacityEnum from the specified map of raw messages. -func UnmarshalShareProfileCapacityEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCapacityEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileCapacityFixed : The permitted total capacity (in gigabytes) of a share with this profile is fixed. -// This model "extends" ShareProfileCapacity -type ShareProfileCapacityFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the ShareProfileCapacityFixed.Type property. -// The type for this profile field. -const ( - ShareProfileCapacityFixedTypeFixedConst = "fixed" -) - -func (*ShareProfileCapacityFixed) isaShareProfileCapacity() bool { - return true -} - -// UnmarshalShareProfileCapacityFixed unmarshals an instance of ShareProfileCapacityFixed from the specified map of raw messages. -func UnmarshalShareProfileCapacityFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCapacityFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileCapacityRange : The permitted total capacity range (in gigabytes) of a share with this profile. -// This model "extends" ShareProfileCapacity -type ShareProfileCapacityRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the ShareProfileCapacityRange.Type property. -// The type for this profile field. -const ( - ShareProfileCapacityRangeTypeRangeConst = "range" -) - -func (*ShareProfileCapacityRange) isaShareProfileCapacity() bool { - return true -} - -// UnmarshalShareProfileCapacityRange unmarshals an instance of ShareProfileCapacityRange from the specified map of raw messages. -func UnmarshalShareProfileCapacityRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCapacityRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileIopsDependentRange : The permitted IOPS range of a share with this profile depends on its configuration. -// This model "extends" ShareProfileIops -type ShareProfileIopsDependentRange struct { - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the ShareProfileIopsDependentRange.Type property. -// The type for this profile field. -const ( - ShareProfileIopsDependentRangeTypeDependentConst = "dependent" - ShareProfileIopsDependentRangeTypeDependentRangeConst = "dependent_range" -) - -func (*ShareProfileIopsDependentRange) isaShareProfileIops() bool { - return true -} - -// UnmarshalShareProfileIopsDependentRange unmarshals an instance of ShareProfileIopsDependentRange from the specified map of raw messages. -func UnmarshalShareProfileIopsDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIopsDependentRange) - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileIopsEnum : The permitted IOPS values of a share with this profile. -// This model "extends" ShareProfileIops -type ShareProfileIopsEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The permitted values for this profile field. - Values []int64 `json:"values" validate:"required"` -} - -// Constants associated with the ShareProfileIopsEnum.Type property. -// The type for this profile field. -const ( - ShareProfileIopsEnumTypeEnumConst = "enum" -) - -func (*ShareProfileIopsEnum) isaShareProfileIops() bool { - return true -} - -// UnmarshalShareProfileIopsEnum unmarshals an instance of ShareProfileIopsEnum from the specified map of raw messages. -func UnmarshalShareProfileIopsEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIopsEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileIopsFixed : The permitted IOPS of a share with this profile is fixed. -// This model "extends" ShareProfileIops -type ShareProfileIopsFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the ShareProfileIopsFixed.Type property. -// The type for this profile field. -const ( - ShareProfileIopsFixedTypeFixedConst = "fixed" -) - -func (*ShareProfileIopsFixed) isaShareProfileIops() bool { - return true -} - -// UnmarshalShareProfileIopsFixed unmarshals an instance of ShareProfileIopsFixed from the specified map of raw messages. -func UnmarshalShareProfileIopsFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIopsFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileIopsRange : The permitted IOPS range of a share with this profile. -// This model "extends" ShareProfileIops -type ShareProfileIopsRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the ShareProfileIopsRange.Type property. -// The type for this profile field. -const ( - ShareProfileIopsRangeTypeRangeConst = "range" -) - -func (*ShareProfileIopsRange) isaShareProfileIops() bool { - return true -} - -// UnmarshalShareProfileIopsRange unmarshals an instance of ShareProfileIopsRange from the specified map of raw messages. -func UnmarshalShareProfileIopsRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIopsRange) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileIdentityByHref : ShareProfileIdentityByHref struct -// This model "extends" ShareProfileIdentity -type ShareProfileIdentityByHref struct { - // The URL for this share profile. - Href *string `json:"href" validate:"required"` -} - -// NewShareProfileIdentityByHref : Instantiate ShareProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewShareProfileIdentityByHref(href string) (_model *ShareProfileIdentityByHref, err error) { - _model = &ShareProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ShareProfileIdentityByHref) isaShareProfileIdentity() bool { - return true -} - -// UnmarshalShareProfileIdentityByHref unmarshals an instance of ShareProfileIdentityByHref from the specified map of raw messages. -func UnmarshalShareProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileIdentityByName : ShareProfileIdentityByName struct -// This model "extends" ShareProfileIdentity -type ShareProfileIdentityByName struct { - // The globally unique name for this share profile. - Name *string `json:"name" validate:"required"` -} - -// NewShareProfileIdentityByName : Instantiate ShareProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewShareProfileIdentityByName(name string) (_model *ShareProfileIdentityByName, err error) { - _model = &ShareProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ShareProfileIdentityByName) isaShareProfileIdentity() bool { - return true -} - -// UnmarshalShareProfileIdentityByName unmarshals an instance of ShareProfileIdentityByName from the specified map of raw messages. -func UnmarshalShareProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SharePrototypeShareBySize : Create a file share by size. -// This model "extends" SharePrototype -type SharePrototypeShareBySize struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the - // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. - // - // In addition, each client accessing the share will be restricted to 48,000 IOPS. - Iops *int64 `json:"iops,omitempty"` - - // The mount targets for the file share. Each mount target must be in a unique VPC. - MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` - - // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be - // a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use for this file share. The - // profile must support the share's specified IOPS and size. - Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - - ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` - - // Tags for this resource. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this file share will reside in. For a replica share, this must be a different zone in the same region as - // the source share. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The access control mode for the share: - // - // - `security_group`: The security groups on the virtual network interface for a - // mount target control access to the mount target. Mount targets for this share - // require a virtual network interface. - // - `vpc`: All clients in the VPC for a mount target have access to the mount target. - // Mount targets for this share require a VPC. - AccessControlMode *string `json:"access_control_mode,omitempty"` - - // The root key to use to wrap the data encryption key for the share. - // - // If unspecified, the `encryption` type for the share will be `provider_managed`. - // - // The specified key may be in a different account, subject to IAM policies. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The owner assigned to the file share at creation. Subsequent changes to the owner - // must be performed by a client that has mounted the file share. - InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The size of the file share rounded up to the next gigabyte. - // - // The maximum size for a share may increase in the future. - Size *int64 `json:"size" validate:"required"` -} - -// Constants associated with the SharePrototypeShareBySize.AccessControlMode property. -// The access control mode for the share: -// -// - `security_group`: The security groups on the virtual network interface for a -// mount target control access to the mount target. Mount targets for this share -// require a virtual network interface. -// - `vpc`: All clients in the VPC for a mount target have access to the mount target. -// Mount targets for this share require a VPC. -const ( - SharePrototypeShareBySizeAccessControlModeSecurityGroupConst = "security_group" - SharePrototypeShareBySizeAccessControlModeVPCConst = "vpc" -) - -// NewSharePrototypeShareBySize : Instantiate SharePrototypeShareBySize (Generic Model Constructor) -func (*VpcV1) NewSharePrototypeShareBySize(profile ShareProfileIdentityIntf, zone ZoneIdentityIntf, size int64) (_model *SharePrototypeShareBySize, err error) { - _model = &SharePrototypeShareBySize{ - Profile: profile, - Zone: zone, - Size: core.Int64Ptr(size), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SharePrototypeShareBySize) isaSharePrototype() bool { - return true -} - -// UnmarshalSharePrototypeShareBySize unmarshals an instance of SharePrototypeShareBySize from the specified map of raw messages. -func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SharePrototypeShareBySize) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SharePrototypeShareBySourceShare : Create a replica file share for an existing file share. The values for `access_control_mode`, -// `encryption_key`, `initial_owner`, and `size` will be inherited from `source_share`. -// This model "extends" SharePrototype -type SharePrototypeShareBySourceShare struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the - // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. - // - // In addition, each client accessing the share will be restricted to 48,000 IOPS. - Iops *int64 `json:"iops,omitempty"` - - // The mount targets for the file share. Each mount target must be in a unique VPC. - MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` - - // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be - // a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use for this file share. The - // profile must support the share's specified IOPS and size. - Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - - ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` - - // Tags for this resource. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this file share will reside in. For a replica share, this must be a different zone in the same region as - // the source share. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The cron specification for the file share replication schedule. - // - // Replication of a share can be scheduled to occur at most once per hour. - ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"` - - // The resource group to use. If unspecified, the resource group from - // the source share will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The source file share for this replica file share. The specified file share must not - // already have a replica, and must not be a replica. - SourceShare ShareIdentityIntf `json:"source_share" validate:"required"` -} - -// NewSharePrototypeShareBySourceShare : Instantiate SharePrototypeShareBySourceShare (Generic Model Constructor) -func (*VpcV1) NewSharePrototypeShareBySourceShare(profile ShareProfileIdentityIntf, zone ZoneIdentityIntf, replicationCronSpec string, sourceShare ShareIdentityIntf) (_model *SharePrototypeShareBySourceShare, err error) { - _model = &SharePrototypeShareBySourceShare{ - Profile: profile, - Zone: zone, - ReplicationCronSpec: core.StringPtr(replicationCronSpec), - SourceShare: sourceShare, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SharePrototypeShareBySourceShare) isaSharePrototype() bool { - return true -} - -// UnmarshalSharePrototypeShareBySourceShare unmarshals an instance of SharePrototypeShareBySourceShare from the specified map of raw messages. -func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SharePrototypeShareBySourceShare) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotIdentityByCRN : SnapshotIdentityByCRN struct -// This model "extends" SnapshotIdentity -type SnapshotIdentityByCRN struct { - // The CRN of this snapshot. - CRN *string `json:"crn" validate:"required"` -} - -// NewSnapshotIdentityByCRN : Instantiate SnapshotIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewSnapshotIdentityByCRN(crn string) (_model *SnapshotIdentityByCRN, err error) { - _model = &SnapshotIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SnapshotIdentityByCRN) isaSnapshotIdentity() bool { - return true -} - -// UnmarshalSnapshotIdentityByCRN unmarshals an instance of SnapshotIdentityByCRN from the specified map of raw messages. -func UnmarshalSnapshotIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotIdentityByHref : SnapshotIdentityByHref struct -// This model "extends" SnapshotIdentity -type SnapshotIdentityByHref struct { - // The URL for this snapshot. - Href *string `json:"href" validate:"required"` -} - -// NewSnapshotIdentityByHref : Instantiate SnapshotIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewSnapshotIdentityByHref(href string) (_model *SnapshotIdentityByHref, err error) { - _model = &SnapshotIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SnapshotIdentityByHref) isaSnapshotIdentity() bool { - return true -} - -// UnmarshalSnapshotIdentityByHref unmarshals an instance of SnapshotIdentityByHref from the specified map of raw messages. -func UnmarshalSnapshotIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotIdentityByID : SnapshotIdentityByID struct -// This model "extends" SnapshotIdentity -type SnapshotIdentityByID struct { - // The unique identifier for this snapshot. - ID *string `json:"id" validate:"required"` -} - -// NewSnapshotIdentityByID : Instantiate SnapshotIdentityByID (Generic Model Constructor) -func (*VpcV1) NewSnapshotIdentityByID(id string) (_model *SnapshotIdentityByID, err error) { - _model = &SnapshotIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SnapshotIdentityByID) isaSnapshotIdentity() bool { - return true -} - -// UnmarshalSnapshotIdentityByID unmarshals an instance of SnapshotIdentityByID from the specified map of raw messages. -func UnmarshalSnapshotIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotPrototypeSnapshotBySourceSnapshot : SnapshotPrototypeSnapshotBySourceSnapshot struct -// This model "extends" SnapshotPrototype -type SnapshotPrototypeSnapshotBySourceSnapshot struct { - // Clones to create for this snapshot. - Clones []SnapshotClonePrototype `json:"clones,omitempty"` - - // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags,omitempty"` - - // The root key to use to wrap the data encryption key for this snapshot. - // - // A key must be specified if and only if the source snapshot has an `encryption` type of - // `user_managed`. To maximize snapshot availability and sharing of snapshot data, specify - // a key in the same region as the new snapshot, and use the same encryption key for all - // snapshots using the same source volume. - // - // The specified key may be in a different account, subject to IAM policies. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The source snapshot (in another region) to create this snapshot from. - // The specified snapshot must not already be the source of another snapshot in this - // region. - SourceSnapshot *SnapshotIdentityByCRN `json:"source_snapshot" validate:"required"` -} - -// NewSnapshotPrototypeSnapshotBySourceSnapshot : Instantiate SnapshotPrototypeSnapshotBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceSnapshot(sourceSnapshot *SnapshotIdentityByCRN) (_model *SnapshotPrototypeSnapshotBySourceSnapshot, err error) { - _model = &SnapshotPrototypeSnapshotBySourceSnapshot{ - SourceSnapshot: sourceSnapshot, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SnapshotPrototypeSnapshotBySourceSnapshot) isaSnapshotPrototype() bool { - return true -} - -// UnmarshalSnapshotPrototypeSnapshotBySourceSnapshot unmarshals an instance of SnapshotPrototypeSnapshotBySourceSnapshot from the specified map of raw messages. -func UnmarshalSnapshotPrototypeSnapshotBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotPrototypeSnapshotBySourceSnapshot) - err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotPrototypeSnapshotBySourceVolume : SnapshotPrototypeSnapshotBySourceVolume struct -// This model "extends" SnapshotPrototype -type SnapshotPrototypeSnapshotBySourceVolume struct { - // Clones to create for this snapshot. - Clones []SnapshotClonePrototype `json:"clones,omitempty"` - - // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags,omitempty"` - - // The volume to create this snapshot from. - SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` -} - -// NewSnapshotPrototypeSnapshotBySourceVolume : Instantiate SnapshotPrototypeSnapshotBySourceVolume (Generic Model Constructor) -func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceVolume(sourceVolume VolumeIdentityIntf) (_model *SnapshotPrototypeSnapshotBySourceVolume, err error) { - _model = &SnapshotPrototypeSnapshotBySourceVolume{ - SourceVolume: sourceVolume, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SnapshotPrototypeSnapshotBySourceVolume) isaSnapshotPrototype() bool { - return true -} - -// UnmarshalSnapshotPrototypeSnapshotBySourceVolume unmarshals an instance of SnapshotPrototypeSnapshotBySourceVolume from the specified map of raw messages. -func UnmarshalSnapshotPrototypeSnapshotBySourceVolume(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotPrototypeSnapshotBySourceVolume) - err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetIdentityByCRN : SubnetIdentityByCRN struct -// This model "extends" SubnetIdentity -type SubnetIdentityByCRN struct { - // The CRN for this subnet. - CRN *string `json:"crn" validate:"required"` -} - -// NewSubnetIdentityByCRN : Instantiate SubnetIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewSubnetIdentityByCRN(crn string) (_model *SubnetIdentityByCRN, err error) { - _model = &SubnetIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SubnetIdentityByCRN) isaSubnetIdentity() bool { - return true -} - -// UnmarshalSubnetIdentityByCRN unmarshals an instance of SubnetIdentityByCRN from the specified map of raw messages. -func UnmarshalSubnetIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetIdentityByHref : SubnetIdentityByHref struct -// This model "extends" SubnetIdentity -type SubnetIdentityByHref struct { - // The URL for this subnet. - Href *string `json:"href" validate:"required"` -} - -// NewSubnetIdentityByHref : Instantiate SubnetIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewSubnetIdentityByHref(href string) (_model *SubnetIdentityByHref, err error) { - _model = &SubnetIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SubnetIdentityByHref) isaSubnetIdentity() bool { - return true -} - -// UnmarshalSubnetIdentityByHref unmarshals an instance of SubnetIdentityByHref from the specified map of raw messages. -func UnmarshalSubnetIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetIdentityByID : SubnetIdentityByID struct -// This model "extends" SubnetIdentity -type SubnetIdentityByID struct { - // The unique identifier for this subnet. - ID *string `json:"id" validate:"required"` -} - -// NewSubnetIdentityByID : Instantiate SubnetIdentityByID (Generic Model Constructor) -func (*VpcV1) NewSubnetIdentityByID(id string) (_model *SubnetIdentityByID, err error) { - _model = &SubnetIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SubnetIdentityByID) isaSubnetIdentity() bool { - return true -} - -// UnmarshalSubnetIdentityByID unmarshals an instance of SubnetIdentityByID from the specified map of raw messages. -func UnmarshalSubnetIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetPrototypeSubnetByCIDR : SubnetPrototypeSubnetByCIDR struct -// This model "extends" SubnetPrototype -type SubnetPrototypeSubnetByCIDR struct { - // The IP version(s) to support for this subnet. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a - // hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The network ACL to use for this subnet. - NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` - - // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be - // attached to a public gateway. - PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing - // table properties `route_direct_link_ingress`, - // `route_internet_ingress`, `route_transit_gateway_ingress`, and - // `route_vpc_zone_ingress` must be `false`. - RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` - - // The VPC the subnet will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The IPv4 range of the subnet, expressed in CIDR format. The prefix length of the subnet's CIDR must be between `/9` - // (8,388,608 addresses) and `/29` (8 addresses). The IPv4 range of the subnet's CIDR must fall within an existing - // address prefix in the VPC and must not overlap with any existing subnet. The subnet will be created in the zone of - // the address prefix that contains the IPv4 CIDR. If zone is specified, it must match the zone of the address prefix - // that contains the subnet's IPv4 CIDR. - Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` - - // The zone this subnet will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` -} - -// Constants associated with the SubnetPrototypeSubnetByCIDR.IPVersion property. -// The IP version(s) to support for this subnet. -const ( - SubnetPrototypeSubnetByCIDRIPVersionIpv4Const = "ipv4" -) - -// NewSubnetPrototypeSubnetByCIDR : Instantiate SubnetPrototypeSubnetByCIDR (Generic Model Constructor) -func (*VpcV1) NewSubnetPrototypeSubnetByCIDR(vpc VPCIdentityIntf, ipv4CIDRBlock string) (_model *SubnetPrototypeSubnetByCIDR, err error) { - _model = &SubnetPrototypeSubnetByCIDR{ - VPC: vpc, - Ipv4CIDRBlock: core.StringPtr(ipv4CIDRBlock), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SubnetPrototypeSubnetByCIDR) isaSubnetPrototype() bool { - return true -} - -// UnmarshalSubnetPrototypeSubnetByCIDR unmarshals an instance of SubnetPrototypeSubnetByCIDR from the specified map of raw messages. -func UnmarshalSubnetPrototypeSubnetByCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPrototypeSubnetByCIDR) - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetPrototypeSubnetByTotalCount : SubnetPrototypeSubnetByTotalCount struct -// This model "extends" SubnetPrototype -type SubnetPrototypeSubnetByTotalCount struct { - // The IP version(s) to support for this subnet. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a - // hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The network ACL to use for this subnet. - NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` - - // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be - // attached to a public gateway. - PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing - // table properties `route_direct_link_ingress`, - // `route_internet_ingress`, `route_transit_gateway_ingress`, and - // `route_vpc_zone_ingress` must be `false`. - RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` - - // The VPC the subnet will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the - // specified zone, and that prefix must have a free CIDR range with at least this number of addresses. - TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` - - // The zone this subnet will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -// Constants associated with the SubnetPrototypeSubnetByTotalCount.IPVersion property. -// The IP version(s) to support for this subnet. -const ( - SubnetPrototypeSubnetByTotalCountIPVersionIpv4Const = "ipv4" -) - -// NewSubnetPrototypeSubnetByTotalCount : Instantiate SubnetPrototypeSubnetByTotalCount (Generic Model Constructor) -func (*VpcV1) NewSubnetPrototypeSubnetByTotalCount(vpc VPCIdentityIntf, totalIpv4AddressCount int64, zone ZoneIdentityIntf) (_model *SubnetPrototypeSubnetByTotalCount, err error) { - _model = &SubnetPrototypeSubnetByTotalCount{ - VPC: vpc, - TotalIpv4AddressCount: core.Int64Ptr(totalIpv4AddressCount), - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SubnetPrototypeSubnetByTotalCount) isaSubnetPrototype() bool { - return true -} - -// UnmarshalSubnetPrototypeSubnetByTotalCount unmarshals an instance of SubnetPrototypeSubnetByTotalCount from the specified map of raw messages. -func UnmarshalSubnetPrototypeSubnetByTotalCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPrototypeSubnetByTotalCount) - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetPublicGatewayPatchPublicGatewayIdentityByCRN : SubnetPublicGatewayPatchPublicGatewayIdentityByCRN struct -// This model "extends" SubnetPublicGatewayPatch -type SubnetPublicGatewayPatchPublicGatewayIdentityByCRN struct { - // The CRN for this public gateway. - CRN *string `json:"crn" validate:"required"` -} - -// NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(crn string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByCRN, err error) { - _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SubnetPublicGatewayPatchPublicGatewayIdentityByCRN) isaSubnetPublicGatewayPatch() bool { - return true -} - -// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByCRN unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByCRN from the specified map of raw messages. -func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetPublicGatewayPatchPublicGatewayIdentityByHref : SubnetPublicGatewayPatchPublicGatewayIdentityByHref struct -// This model "extends" SubnetPublicGatewayPatch -type SubnetPublicGatewayPatchPublicGatewayIdentityByHref struct { - // The URL for this public gateway. - Href *string `json:"href" validate:"required"` -} - -// NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref(href string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByHref, err error) { - _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SubnetPublicGatewayPatchPublicGatewayIdentityByHref) isaSubnetPublicGatewayPatch() bool { - return true -} - -// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByHref unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByHref from the specified map of raw messages. -func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetPublicGatewayPatchPublicGatewayIdentityByID : SubnetPublicGatewayPatchPublicGatewayIdentityByID struct -// This model "extends" SubnetPublicGatewayPatch -type SubnetPublicGatewayPatchPublicGatewayIdentityByID struct { - // The unique identifier for this public gateway. - ID *string `json:"id" validate:"required"` -} - -// NewSubnetPublicGatewayPatchPublicGatewayIdentityByID : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByID (Generic Model Constructor) -func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByID(id string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByID, err error) { - _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SubnetPublicGatewayPatchPublicGatewayIdentityByID) isaSubnetPublicGatewayPatch() bool { - return true -} - -// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByID unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByID from the specified map of raw messages. -func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// TrustedProfileIdentityTrustedProfileByCRN : TrustedProfileIdentityTrustedProfileByCRN struct -// This model "extends" TrustedProfileIdentity -type TrustedProfileIdentityTrustedProfileByCRN struct { - // The CRN for this trusted profile. - CRN *string `json:"crn" validate:"required"` -} - -// NewTrustedProfileIdentityTrustedProfileByCRN : Instantiate TrustedProfileIdentityTrustedProfileByCRN (Generic Model Constructor) -func (*VpcV1) NewTrustedProfileIdentityTrustedProfileByCRN(crn string) (_model *TrustedProfileIdentityTrustedProfileByCRN, err error) { - _model = &TrustedProfileIdentityTrustedProfileByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*TrustedProfileIdentityTrustedProfileByCRN) isaTrustedProfileIdentity() bool { - return true -} - -// UnmarshalTrustedProfileIdentityTrustedProfileByCRN unmarshals an instance of TrustedProfileIdentityTrustedProfileByCRN from the specified map of raw messages. -func UnmarshalTrustedProfileIdentityTrustedProfileByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(TrustedProfileIdentityTrustedProfileByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// TrustedProfileIdentityTrustedProfileByID : TrustedProfileIdentityTrustedProfileByID struct -// This model "extends" TrustedProfileIdentity -type TrustedProfileIdentityTrustedProfileByID struct { - // The unique identifier for this trusted profile. - ID *string `json:"id" validate:"required"` -} - -// NewTrustedProfileIdentityTrustedProfileByID : Instantiate TrustedProfileIdentityTrustedProfileByID (Generic Model Constructor) -func (*VpcV1) NewTrustedProfileIdentityTrustedProfileByID(id string) (_model *TrustedProfileIdentityTrustedProfileByID, err error) { - _model = &TrustedProfileIdentityTrustedProfileByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*TrustedProfileIdentityTrustedProfileByID) isaTrustedProfileIdentity() bool { - return true -} - -// UnmarshalTrustedProfileIdentityTrustedProfileByID unmarshals an instance of TrustedProfileIdentityTrustedProfileByID from the specified map of raw messages. -func UnmarshalTrustedProfileIdentityTrustedProfileByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(TrustedProfileIdentityTrustedProfileByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype : Manually specify the DNS server addresses for this VPC. -// This model "extends" VpcdnsResolverPrototype -type VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype struct { - // The DNS servers to use for this VPC. All the DNS servers must either: - // - // - have a unique `zone_affinity`, or - // - not have a `zone_affinity`. - ManualServers []DnsServerPrototype `json:"manual_servers" validate:"required"` - - // The type of the DNS resolver to use. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype.Type property. -// The type of the DNS resolver to use. -const ( - VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototypeTypeManualConst = "manual" -) - -// NewVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype : Instantiate VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype (Generic Model Constructor) -func (*VpcV1) NewVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(manualServers []DnsServerPrototype, typeVar string) (_model *VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype, err error) { - _model = &VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype{ - ManualServers: manualServers, - Type: core.StringPtr(typeVar), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype) isaVpcdnsResolverPrototype() bool { - return true -} - -// UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype unmarshals an instance of VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype from the specified map of raw messages. -func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype) - err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype : The system will provide DNS server addresses for this VPC. The system-provided DNS server addresses depend on whether -// any endpoint gateways reside in the VPC, and whether a -// [DNS Services](https://cloud.ibm.com/docs/dns-svcs) instance is configured for the VPC. -// This model "extends" VpcdnsResolverPrototype -type VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype struct { - // The type of the DNS resolver to use. - Type *string `json:"type,omitempty"` -} - -// Constants associated with the VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype.Type property. -// The type of the DNS resolver to use. -const ( - VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototypeTypeSystemConst = "system" -) - -func (*VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype) isaVpcdnsResolverPrototype() bool { - return true -} - -// UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype unmarshals an instance of VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype from the specified map of raw messages. -func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverTypeDelegated : The DNS server addresses are delegated to the DNS resolver of another VPC. -// This model "extends" VpcdnsResolver -type VpcdnsResolverTypeDelegated struct { - // The DNS servers for this VPC. The servers are populated: - // - // - by the system when `dns.resolver.type` is `system` - // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` - // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. - Servers []DnsServer `json:"servers" validate:"required"` - - // The type of the DNS resolver used for the VPC. - Type *string `json:"type" validate:"required"` - - // The VPC whose DNS resolver provides the DNS server addresses for this VPC. - // - // The VPC may be remote and therefore may not be directly retrievable. - VPC *VPCReferenceDnsResolverContext `json:"vpc" validate:"required"` -} - -// Constants associated with the VpcdnsResolverTypeDelegated.Type property. -// The type of the DNS resolver used for the VPC. -const ( - VpcdnsResolverTypeDelegatedTypeDelegatedConst = "delegated" -) - -func (*VpcdnsResolverTypeDelegated) isaVpcdnsResolver() bool { - return true -} - -// UnmarshalVpcdnsResolverTypeDelegated unmarshals an instance of VpcdnsResolverTypeDelegated from the specified map of raw messages. -func UnmarshalVpcdnsResolverTypeDelegated(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverTypeDelegated) - err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverTypeManual : The DNS server addresses are manually specified. -// This model "extends" VpcdnsResolver -type VpcdnsResolverTypeManual struct { - // The DNS servers for this VPC. The servers are populated: - // - // - by the system when `dns.resolver.type` is `system` - // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` - // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. - Servers []DnsServer `json:"servers" validate:"required"` - - // The manually specified DNS servers for this VPC. - ManualServers []DnsServer `json:"manual_servers" validate:"required"` - - // The type of the DNS resolver used for the VPC. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the VpcdnsResolverTypeManual.Type property. -// The type of the DNS resolver used for the VPC. -const ( - VpcdnsResolverTypeManualTypeManualConst = "manual" -) - -func (*VpcdnsResolverTypeManual) isaVpcdnsResolver() bool { - return true -} - -// UnmarshalVpcdnsResolverTypeManual unmarshals an instance of VpcdnsResolverTypeManual from the specified map of raw messages. -func UnmarshalVpcdnsResolverTypeManual(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverTypeManual) - err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) - if err != nil { - return - } - err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverTypeSystem : The DNS server addresses are provided by the system and depend on the configuration. -// This model "extends" VpcdnsResolver -type VpcdnsResolverTypeSystem struct { - // The DNS servers for this VPC. The servers are populated: - // - // - by the system when `dns.resolver.type` is `system` - // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` - // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. - Servers []DnsServer `json:"servers" validate:"required"` - - // The configuration of the system DNS resolver for this VPC. - // - // - `custom_resolver`: A custom DNS resolver is configured for this VPC. - // - // - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when - // the VPC has either or both of the following: - // - // - at least one endpoint gateway residing in it - // - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it - // - // - `default`: The provider default DNS resolvers are configured for this VPC. - // - // This system DNS resolver configuration is used when the VPC has: - // - // - no custom DNS resolver configured for it, and - // - no endpoint gateways residing in it, and - // - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. - Configuration *string `json:"configuration" validate:"required"` - - // The type of the DNS resolver used for the VPC. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the VpcdnsResolverTypeSystem.Configuration property. -// The configuration of the system DNS resolver for this VPC. -// -// - `custom_resolver`: A custom DNS resolver is configured for this VPC. -// -// - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when -// the VPC has either or both of the following: -// -// - at least one endpoint gateway residing in it -// -// - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it -// -// - `default`: The provider default DNS resolvers are configured for this VPC. -// -// This system DNS resolver configuration is used when the VPC has: -// -// - no custom DNS resolver configured for it, and -// - no endpoint gateways residing in it, and -// - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. -const ( - VpcdnsResolverTypeSystemConfigurationCustomResolverConst = "custom_resolver" - VpcdnsResolverTypeSystemConfigurationDefaultConst = "default" - VpcdnsResolverTypeSystemConfigurationPrivateResolverConst = "private_resolver" -) - -// Constants associated with the VpcdnsResolverTypeSystem.Type property. -// The type of the DNS resolver used for the VPC. -const ( - VpcdnsResolverTypeSystemTypeSystemConst = "system" -) - -func (*VpcdnsResolverTypeSystem) isaVpcdnsResolver() bool { - return true -} - -// UnmarshalVpcdnsResolverTypeSystem unmarshals an instance of VpcdnsResolverTypeSystem from the specified map of raw messages. -func UnmarshalVpcdnsResolverTypeSystem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverTypeSystem) - err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverVPCPatchVPCIdentityByCRN : VpcdnsResolverVPCPatchVPCIdentityByCRN struct -// This model "extends" VpcdnsResolverVPCPatch -type VpcdnsResolverVPCPatchVPCIdentityByCRN struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` -} - -// NewVpcdnsResolverVPCPatchVPCIdentityByCRN : Instantiate VpcdnsResolverVPCPatchVPCIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByCRN(crn string) (_model *VpcdnsResolverVPCPatchVPCIdentityByCRN, err error) { - _model = &VpcdnsResolverVPCPatchVPCIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VpcdnsResolverVPCPatchVPCIdentityByCRN) isaVpcdnsResolverVPCPatch() bool { - return true -} - -// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByCRN unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByCRN from the specified map of raw messages. -func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverVPCPatchVPCIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverVPCPatchVPCIdentityByHref : VpcdnsResolverVPCPatchVPCIdentityByHref struct -// This model "extends" VpcdnsResolverVPCPatch -type VpcdnsResolverVPCPatchVPCIdentityByHref struct { - // The URL for this VPC. - Href *string `json:"href" validate:"required"` -} - -// NewVpcdnsResolverVPCPatchVPCIdentityByHref : Instantiate VpcdnsResolverVPCPatchVPCIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByHref(href string) (_model *VpcdnsResolverVPCPatchVPCIdentityByHref, err error) { - _model = &VpcdnsResolverVPCPatchVPCIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VpcdnsResolverVPCPatchVPCIdentityByHref) isaVpcdnsResolverVPCPatch() bool { - return true -} - -// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByHref unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByHref from the specified map of raw messages. -func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverVPCPatchVPCIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverVPCPatchVPCIdentityByID : VpcdnsResolverVPCPatchVPCIdentityByID struct -// This model "extends" VpcdnsResolverVPCPatch -type VpcdnsResolverVPCPatchVPCIdentityByID struct { - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` -} - -// NewVpcdnsResolverVPCPatchVPCIdentityByID : Instantiate VpcdnsResolverVPCPatchVPCIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByID(id string) (_model *VpcdnsResolverVPCPatchVPCIdentityByID, err error) { - _model = &VpcdnsResolverVPCPatchVPCIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VpcdnsResolverVPCPatchVPCIdentityByID) isaVpcdnsResolverVPCPatch() bool { - return true -} - -// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByID unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByID from the specified map of raw messages. -func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverVPCPatchVPCIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCIdentityByCRN : VPCIdentityByCRN struct -// This model "extends" VPCIdentity -type VPCIdentityByCRN struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` -} - -// NewVPCIdentityByCRN : Instantiate VPCIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVPCIdentityByCRN(crn string) (_model *VPCIdentityByCRN, err error) { - _model = &VPCIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPCIdentityByCRN) isaVPCIdentity() bool { - return true -} - -// UnmarshalVPCIdentityByCRN unmarshals an instance of VPCIdentityByCRN from the specified map of raw messages. -func UnmarshalVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCIdentityByHref : VPCIdentityByHref struct -// This model "extends" VPCIdentity -type VPCIdentityByHref struct { - // The URL for this VPC. - Href *string `json:"href" validate:"required"` -} - -// NewVPCIdentityByHref : Instantiate VPCIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVPCIdentityByHref(href string) (_model *VPCIdentityByHref, err error) { - _model = &VPCIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPCIdentityByHref) isaVPCIdentity() bool { - return true -} - -// UnmarshalVPCIdentityByHref unmarshals an instance of VPCIdentityByHref from the specified map of raw messages. -func UnmarshalVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCIdentityByID : VPCIdentityByID struct -// This model "extends" VPCIdentity -type VPCIdentityByID struct { - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` -} - -// NewVPCIdentityByID : Instantiate VPCIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVPCIdentityByID(id string) (_model *VPCIdentityByID, err error) { - _model = &VPCIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPCIdentityByID) isaVPCIdentity() bool { - return true -} - -// UnmarshalVPCIdentityByID unmarshals an instance of VPCIdentityByID from the specified map of raw messages. -func UnmarshalVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct -// This model "extends" VPNGatewayConnectionIkePolicyPatch -type VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct { - // The IKE policy's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref : Instantiate VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref, err error) { - _model = &VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref) isaVPNGatewayConnectionIkePolicyPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID : VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID struct -// This model "extends" VPNGatewayConnectionIkePolicyPatch -type VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID struct { - // The unique identifier for this IKE policy. - ID *string `json:"id" validate:"required"` -} - -// NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID : Instantiate VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(id string) (_model *VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID, err error) { - _model = &VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) isaVPNGatewayConnectionIkePolicyPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct -// This model "extends" VPNGatewayConnectionIkePolicyPrototype -type VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct { - // The IKE policy's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref : Instantiate VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref, err error) { - _model = &VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref) isaVPNGatewayConnectionIkePolicyPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID : VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID struct -// This model "extends" VPNGatewayConnectionIkePolicyPrototype -type VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID struct { - // The unique identifier for this IKE policy. - ID *string `json:"id" validate:"required"` -} - -// NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID : Instantiate VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(id string) (_model *VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID, err error) { - _model = &VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) isaVPNGatewayConnectionIkePolicyPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref : VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref struct -// This model "extends" VPNGatewayConnectionIPsecPolicyPatch -type VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref struct { - // The IPsec policy's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref : Instantiate VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref, err error) { - _model = &VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref) isaVPNGatewayConnectionIPsecPolicyPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID : VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID struct -// This model "extends" VPNGatewayConnectionIPsecPolicyPatch -type VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID struct { - // The unique identifier for this IPsec policy. - ID *string `json:"id" validate:"required"` -} - -// NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID : Instantiate VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(id string) (_model *VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID, err error) { - _model = &VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) isaVPNGatewayConnectionIPsecPolicyPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref : VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct -// This model "extends" VPNGatewayConnectionIPsecPolicyPrototype -type VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct { - // The IPsec policy's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref : Instantiate VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref, err error) { - _model = &VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID : VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID struct -// This model "extends" VPNGatewayConnectionIPsecPolicyPrototype -type VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID struct { - // The unique identifier for this IPsec policy. - ID *string `json:"id" validate:"required"` -} - -// NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID : Instantiate VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(id string) (_model *VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID, err error) { - _model = &VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch : VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch struct -// This model "extends" VPNGatewayConnectionPatch -type VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up,omitempty"` - - DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"` - - IkePolicy VPNGatewayConnectionIkePolicyPatchIntf `json:"ike_policy,omitempty"` - - IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"` - - // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. - Name *string `json:"name,omitempty"` - - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address,omitempty"` - - // The pre-shared key. - Psk *string `json:"psk,omitempty"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatchRoutingProtocolNoneConst = "none" -) - -func (*VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) isaVPNGatewayConnectionPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch unmarshals an instance of VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch -func (vpnGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch *VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpnGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// VPNGatewayConnectionPolicyMode : VPNGatewayConnectionPolicyMode struct -// This model "extends" VPNGatewayConnection -type VPNGatewayConnectionPolicyMode struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up" validate:"required"` - - // The authentication mode. Only `psk` is currently supported. - AuthenticationMode *string `json:"authentication_mode" validate:"required"` - - // The date and time that this VPN gateway connection was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The IKE policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` - - // The IPsec policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` - - // The mode of the VPN gateway. - Mode *string `json:"mode" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` - - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of a VPN gateway connection. - Status *string `json:"status" validate:"required"` - - // The reasons for the current VPN gateway connection status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` - - // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs" validate:"required"` - - // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionPolicyMode.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. -const ( - VPNGatewayConnectionPolicyModeAuthenticationModePskConst = "psk" -) - -// Constants associated with the VPNGatewayConnectionPolicyMode.Mode property. -// The mode of the VPN gateway. -const ( - VPNGatewayConnectionPolicyModeModePolicyConst = "policy" - VPNGatewayConnectionPolicyModeModeRouteConst = "route" -) - -// Constants associated with the VPNGatewayConnectionPolicyMode.ResourceType property. -// The resource type. -const ( - VPNGatewayConnectionPolicyModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -// Constants associated with the VPNGatewayConnectionPolicyMode.Status property. -// The status of a VPN gateway connection. -const ( - VPNGatewayConnectionPolicyModeStatusDownConst = "down" - VPNGatewayConnectionPolicyModeStatusUpConst = "up" -) - -func (*VPNGatewayConnectionPolicyMode) isaVPNGatewayConnection() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPolicyMode unmarshals an instance of VPNGatewayConnectionPolicyMode from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPolicyMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPolicyMode) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct -// This model "extends" VPNGatewayConnectionPrototype -type VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up,omitempty"` - - DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` - - IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` - - IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` - - // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs" validate:"required"` - - // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs" validate:"required"` -} - -// NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(peerAddress string, psk string, localCIDRs []string, peerCIDRs []string) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype, err error) { - _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype{ - PeerAddress: core.StringPtr(peerAddress), - Psk: core.StringPtr(psk), - LocalCIDRs: localCIDRs, - PeerCIDRs: peerCIDRs, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) isaVPNGatewayConnectionPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype struct -// This model "extends" VPNGatewayConnectionPrototype -type VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up,omitempty"` - - DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` - - IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` - - IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` - - // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototypeRoutingProtocolNoneConst = "none" -) - -// NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(peerAddress string, psk string) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype, err error) { - _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype{ - PeerAddress: core.StringPtr(peerAddress), - Psk: core.StringPtr(psk), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) isaVPNGatewayConnectionPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionStaticRouteMode struct -// This model "extends" VPNGatewayConnection -type VPNGatewayConnectionStaticRouteMode struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up" validate:"required"` - - // The authentication mode. Only `psk` is currently supported. - AuthenticationMode *string `json:"authentication_mode" validate:"required"` - - // The date and time that this VPN gateway connection was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The IKE policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` - - // The IPsec policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` - - // The mode of the VPN gateway. - Mode *string `json:"mode" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` - - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of a VPN gateway connection. - Status *string `json:"status" validate:"required"` - - // The reasons for the current VPN gateway connection status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol" validate:"required"` - - // The VPN tunnel configuration for this VPN gateway connection (in static route mode). - Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionStaticRouteMode.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. -const ( - VPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" -) - -// Constants associated with the VPNGatewayConnectionStaticRouteMode.Mode property. -// The mode of the VPN gateway. -const ( - VPNGatewayConnectionStaticRouteModeModePolicyConst = "policy" - VPNGatewayConnectionStaticRouteModeModeRouteConst = "route" -) - -// Constants associated with the VPNGatewayConnectionStaticRouteMode.ResourceType property. -// The resource type. -const ( - VPNGatewayConnectionStaticRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -// Constants associated with the VPNGatewayConnectionStaticRouteMode.Status property. -// The status of a VPN gateway connection. -const ( - VPNGatewayConnectionStaticRouteModeStatusDownConst = "down" - VPNGatewayConnectionStaticRouteModeStatusUpConst = "up" -) - -// Constants associated with the VPNGatewayConnectionStaticRouteMode.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionStaticRouteModeRoutingProtocolNoneConst = "none" -) - -func (*VPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnection() bool { - return true -} - -// UnmarshalVPNGatewayConnectionStaticRouteMode unmarshals an instance of VPNGatewayConnectionStaticRouteMode from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteMode) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayPolicyMode : VPNGatewayPolicyMode struct -// This model "extends" VPNGateway -type VPNGatewayPolicyMode struct { - // Connections for this VPN gateway. - Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` - - // The date and time that this VPN gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` - - // The reasons for the current VPN gateway health_state (if any): - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - HealthReasons []VPNGatewayHealthReason `json:"health_reasons" validate:"required"` - - // The health of this resource. - // - `ok`: No abnormal behavior detected - // - `degraded`: Experiencing compromised performance, capacity, or connectivity - // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated - // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a - // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also - // have this state. - HealthState *string `json:"health_state" validate:"required"` - - // The VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` - - // The reasons for the current VPN gateway lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN gateway. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // Collection of VPN gateway members. - Members []VPNGatewayMember `json:"members" validate:"required"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this VPN gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The VPC this VPN gateway resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // Policy mode VPN gateway. - Mode *string `json:"mode" validate:"required"` -} - -// Constants associated with the VPNGatewayPolicyMode.HealthState property. -// The health of this resource. -// - `ok`: No abnormal behavior detected -// - `degraded`: Experiencing compromised performance, capacity, or connectivity -// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated -// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle -// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this -// state. -const ( - VPNGatewayPolicyModeHealthStateDegradedConst = "degraded" - VPNGatewayPolicyModeHealthStateFaultedConst = "faulted" - VPNGatewayPolicyModeHealthStateInapplicableConst = "inapplicable" - VPNGatewayPolicyModeHealthStateOkConst = "ok" -) - -// Constants associated with the VPNGatewayPolicyMode.LifecycleState property. -// The lifecycle state of the VPN gateway. -const ( - VPNGatewayPolicyModeLifecycleStateDeletingConst = "deleting" - VPNGatewayPolicyModeLifecycleStateFailedConst = "failed" - VPNGatewayPolicyModeLifecycleStatePendingConst = "pending" - VPNGatewayPolicyModeLifecycleStateStableConst = "stable" - VPNGatewayPolicyModeLifecycleStateSuspendedConst = "suspended" - VPNGatewayPolicyModeLifecycleStateUpdatingConst = "updating" - VPNGatewayPolicyModeLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNGatewayPolicyMode.ResourceType property. -// The resource type. -const ( - VPNGatewayPolicyModeResourceTypeVPNGatewayConst = "vpn_gateway" -) - -// Constants associated with the VPNGatewayPolicyMode.Mode property. -// Policy mode VPN gateway. -const ( - VPNGatewayPolicyModeModePolicyConst = "policy" -) - -func (*VPNGatewayPolicyMode) isaVPNGateway() bool { - return true -} - -// UnmarshalVPNGatewayPolicyMode unmarshals an instance of VPNGatewayPolicyMode from the specified map of raw messages. -func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPolicyMode) - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayPrototypeVPNGatewayPolicyModePrototype : VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct -// This model "extends" VPNGatewayPrototype -type VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct { - // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // Policy mode VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGatewayPrototypeVPNGatewayPolicyModePrototype.Mode property. -// Policy mode VPN gateway. -const ( - VPNGatewayPrototypeVPNGatewayPolicyModePrototypeModePolicyConst = "policy" -) - -// NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayPolicyModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayPolicyModePrototype, err error) { - _model = &VPNGatewayPrototypeVPNGatewayPolicyModePrototype{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNGatewayPrototypeVPNGatewayPolicyModePrototype) isaVPNGatewayPrototype() bool { - return true -} - -// UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayPolicyModePrototype from the specified map of raw messages. -func UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPrototypeVPNGatewayPolicyModePrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayPrototypeVPNGatewayRouteModePrototype : VPNGatewayPrototypeVPNGatewayRouteModePrototype struct -// This model "extends" VPNGatewayPrototype -type VPNGatewayPrototypeVPNGatewayRouteModePrototype struct { - // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // Route mode VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGatewayPrototypeVPNGatewayRouteModePrototype.Mode property. -// Route mode VPN gateway. -const ( - VPNGatewayPrototypeVPNGatewayRouteModePrototypeModeRouteConst = "route" -) - -// NewVPNGatewayPrototypeVPNGatewayRouteModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayRouteModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayRouteModePrototype, err error) { - _model = &VPNGatewayPrototypeVPNGatewayRouteModePrototype{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNGatewayPrototypeVPNGatewayRouteModePrototype) isaVPNGatewayPrototype() bool { - return true -} - -// UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayRouteModePrototype from the specified map of raw messages. -func UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPrototypeVPNGatewayRouteModePrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayRouteMode : VPNGatewayRouteMode struct -// This model "extends" VPNGateway -type VPNGatewayRouteMode struct { - // Connections for this VPN gateway. - Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` - - // The date and time that this VPN gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` - - // The reasons for the current VPN gateway health_state (if any): - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - HealthReasons []VPNGatewayHealthReason `json:"health_reasons" validate:"required"` - - // The health of this resource. - // - `ok`: No abnormal behavior detected - // - `degraded`: Experiencing compromised performance, capacity, or connectivity - // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated - // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a - // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also - // have this state. - HealthState *string `json:"health_state" validate:"required"` - - // The VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` - - // The reasons for the current VPN gateway lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN gateway. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // Collection of VPN gateway members. - Members []VPNGatewayMember `json:"members" validate:"required"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this VPN gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The VPC this VPN gateway resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // Route mode VPN gateway. - Mode *string `json:"mode" validate:"required"` -} - -// Constants associated with the VPNGatewayRouteMode.HealthState property. -// The health of this resource. -// - `ok`: No abnormal behavior detected -// - `degraded`: Experiencing compromised performance, capacity, or connectivity -// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated -// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle -// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this -// state. -const ( - VPNGatewayRouteModeHealthStateDegradedConst = "degraded" - VPNGatewayRouteModeHealthStateFaultedConst = "faulted" - VPNGatewayRouteModeHealthStateInapplicableConst = "inapplicable" - VPNGatewayRouteModeHealthStateOkConst = "ok" -) - -// Constants associated with the VPNGatewayRouteMode.LifecycleState property. -// The lifecycle state of the VPN gateway. -const ( - VPNGatewayRouteModeLifecycleStateDeletingConst = "deleting" - VPNGatewayRouteModeLifecycleStateFailedConst = "failed" - VPNGatewayRouteModeLifecycleStatePendingConst = "pending" - VPNGatewayRouteModeLifecycleStateStableConst = "stable" - VPNGatewayRouteModeLifecycleStateSuspendedConst = "suspended" - VPNGatewayRouteModeLifecycleStateUpdatingConst = "updating" - VPNGatewayRouteModeLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNGatewayRouteMode.ResourceType property. -// The resource type. -const ( - VPNGatewayRouteModeResourceTypeVPNGatewayConst = "vpn_gateway" -) - -// Constants associated with the VPNGatewayRouteMode.Mode property. -// Route mode VPN gateway. -const ( - VPNGatewayRouteModeModeRouteConst = "route" -) - -func (*VPNGatewayRouteMode) isaVPNGateway() bool { - return true -} - -// UnmarshalVPNGatewayRouteMode unmarshals an instance of VPNGatewayRouteMode from the specified map of raw messages. -func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayRouteMode) - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationByCertificate : VPNServerAuthenticationByCertificate struct -// This model "extends" VPNServerAuthentication -type VPNServerAuthenticationByCertificate struct { - // The type of authentication. - Method *string `json:"method" validate:"required"` - - // The certificate instance used for the VPN client certificate authority (CA). - ClientCa *CertificateInstanceReference `json:"client_ca" validate:"required"` - - // The certificate revocation list contents, encoded in PEM format. - Crl *string `json:"crl,omitempty"` -} - -// Constants associated with the VPNServerAuthenticationByCertificate.Method property. -// The type of authentication. -const ( - VPNServerAuthenticationByCertificateMethodCertificateConst = "certificate" - VPNServerAuthenticationByCertificateMethodUsernameConst = "username" -) - -func (*VPNServerAuthenticationByCertificate) isaVPNServerAuthentication() bool { - return true -} - -// UnmarshalVPNServerAuthenticationByCertificate unmarshals an instance of VPNServerAuthenticationByCertificate from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationByCertificate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthenticationByCertificate) - err = core.UnmarshalPrimitive(m, "method", &obj.Method) - if err != nil { - return - } - err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationByUsername : VPNServerAuthenticationByUsername struct -// This model "extends" VPNServerAuthentication -type VPNServerAuthenticationByUsername struct { - // The type of authentication. - Method *string `json:"method" validate:"required"` - - // The type of identity provider to be used by VPN client. - IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` -} - -// Constants associated with the VPNServerAuthenticationByUsername.Method property. -// The type of authentication. -const ( - VPNServerAuthenticationByUsernameMethodCertificateConst = "certificate" - VPNServerAuthenticationByUsernameMethodUsernameConst = "username" -) - -func (*VPNServerAuthenticationByUsername) isaVPNServerAuthentication() bool { - return true -} - -// UnmarshalVPNServerAuthenticationByUsername unmarshals an instance of VPNServerAuthenticationByUsername from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationByUsername(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthenticationByUsername) - err = core.UnmarshalPrimitive(m, "method", &obj.Method) - if err != nil { - return - } - err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationByUsernameIDProviderByIam : VPNServerAuthenticationByUsernameIDProviderByIam struct -// This model "extends" VPNServerAuthenticationByUsernameIDProvider -type VPNServerAuthenticationByUsernameIDProviderByIam struct { - // The type of identity provider to be used by the VPN client. - // - `iam`: IBM identity and access management - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. - ProviderType *string `json:"provider_type" validate:"required"` -} - -// Constants associated with the VPNServerAuthenticationByUsernameIDProviderByIam.ProviderType property. -// The type of identity provider to be used by the VPN client. -// - `iam`: IBM identity and access management -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. -const ( - VPNServerAuthenticationByUsernameIDProviderByIamProviderTypeIamConst = "iam" -) - -// NewVPNServerAuthenticationByUsernameIDProviderByIam : Instantiate VPNServerAuthenticationByUsernameIDProviderByIam (Generic Model Constructor) -func (*VpcV1) NewVPNServerAuthenticationByUsernameIDProviderByIam(providerType string) (_model *VPNServerAuthenticationByUsernameIDProviderByIam, err error) { - _model = &VPNServerAuthenticationByUsernameIDProviderByIam{ - ProviderType: core.StringPtr(providerType), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNServerAuthenticationByUsernameIDProviderByIam) isaVPNServerAuthenticationByUsernameIDProvider() bool { - return true -} - -// UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam unmarshals an instance of VPNServerAuthenticationByUsernameIDProviderByIam from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthenticationByUsernameIDProviderByIam) - err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct -// This model "extends" VPNServerAuthenticationPrototype -type VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct { - // The type of authentication. - Method *string `json:"method" validate:"required"` - - // The certificate instance to use for the VPN client certificate authority (CA). - ClientCa CertificateInstanceIdentityIntf `json:"client_ca" validate:"required"` - - // The certificate revocation list contents, encoded in PEM format. - Crl *string `json:"crl,omitempty"` -} - -// Constants associated with the VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.Method property. -// The type of authentication. -const ( - VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototypeMethodCertificateConst = "certificate" - VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototypeMethodUsernameConst = "username" -) - -// NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype : Instantiate VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(method string, clientCa CertificateInstanceIdentityIntf) (_model *VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype, err error) { - _model = &VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype{ - Method: core.StringPtr(method), - ClientCa: clientCa, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) isaVPNServerAuthenticationPrototype() bool { - return true -} - -// UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype unmarshals an instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) - err = core.UnmarshalPrimitive(m, "method", &obj.Method) - if err != nil { - return - } - err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct -// This model "extends" VPNServerAuthenticationPrototype -type VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct { - // The type of authentication. - Method *string `json:"method" validate:"required"` - - // The type of identity provider to be used by VPN client. - IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` -} - -// Constants associated with the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype.Method property. -// The type of authentication. -const ( - VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototypeMethodCertificateConst = "certificate" - VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototypeMethodUsernameConst = "username" -) - -// NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype : Instantiate VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(method string, identityProvider VPNServerAuthenticationByUsernameIDProviderIntf) (_model *VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype, err error) { - _model = &VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype{ - Method: core.StringPtr(method), - IdentityProvider: identityProvider, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) isaVPNServerAuthenticationPrototype() bool { - return true -} - -// UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype unmarshals an instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - err = core.UnmarshalPrimitive(m, "method", &obj.Method) - if err != nil { - return - } - err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext : Identifies a reserved IP by a unique property. The reserved IP must be currently unbound and in the same subnet as -// the primary IP. -// Models which "extend" this model: -// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID -// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref -// This model "extends" VirtualNetworkInterfaceIPPrototype -type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` -} - -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { - return true -} - -type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextIntf interface { - VirtualNetworkInterfaceIPPrototypeIntf - isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool -} - -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext : The prototype for a new reserved IP. Must be in the same subnet as the primary IP. -// This model "extends" VirtualNetworkInterfaceIPPrototype -type VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext struct { - // The IP address to reserve, which must not already be reserved on the subnet. - // - // If unspecified, an available address on the subnet will automatically be selected. - Address *string `json:"address,omitempty"` - - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with - // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated - // list of randomly-selected words. - Name *string `json:"name,omitempty"` -} - -func (*VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext : Identifies a reserved IP by a unique property. Required if `subnet` is not specified. The reserved IP must be -// currently unbound. -// Models which "extend" this model: -// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID -// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref -// This model "extends" VirtualNetworkInterfacePrimaryIPPrototype -type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` -} - -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { - return true -} - -type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextIntf interface { - VirtualNetworkInterfacePrimaryIPPrototypeIntf - isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool -} - -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext : The prototype for a new reserved IP. Requires `subnet` to be specified. -// This model "extends" VirtualNetworkInterfacePrimaryIPPrototype -type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext struct { - // The IP address to reserve, which must not already be reserved on the subnet. - // - // If unspecified, an available address on the subnet will automatically be selected. - Address *string `json:"address,omitempty"` - - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with - // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated - // list of randomly-selected words. - Name *string `json:"name,omitempty"` -} - -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct -// This model "extends" VirtualNetworkInterfaceTarget -type VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { - // The URL for this bare metal server network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network attachment. - ID *string `json:"id" validate:"required"` - - // The name for this bare metal server network attachment. The name is unique across all network attachments for the - // bare metal server. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext.ResourceType property. -// The resource type. -const ( - VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" -) - -func (*VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) isaVirtualNetworkInterfaceTarget() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext unmarshals an instance of VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct -// This model "extends" VirtualNetworkInterfaceTarget -type VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { - // The URL for this instance network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network attachment. - ID *string `json:"id" validate:"required"` - - // The name for this instance network attachment. The name is unique across all network attachments for the instance. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext.ResourceType property. -// The resource type. -const ( - VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" -) - -func (*VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) isaVirtualNetworkInterfaceTarget() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext unmarshals an instance of VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceTargetShareMountTargetReference : VirtualNetworkInterfaceTargetShareMountTargetReference struct -// This model "extends" VirtualNetworkInterfaceTarget -type VirtualNetworkInterfaceTargetShareMountTargetReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this share mount target. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this share mount target. - ID *string `json:"id" validate:"required"` - - // The name for this share mount target. The name is unique across all mount targets for the file share. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VirtualNetworkInterfaceTargetShareMountTargetReference.ResourceType property. -// The resource type. -const ( - VirtualNetworkInterfaceTargetShareMountTargetReferenceResourceTypeShareMountTargetConst = "share_mount_target" -) - -func (*VirtualNetworkInterfaceTargetShareMountTargetReference) isaVirtualNetworkInterfaceTarget() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference unmarshals an instance of VirtualNetworkInterfaceTargetShareMountTargetReference from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceTargetShareMountTargetReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeVolumeVolumeIdentity : Identifies a volume by a unique property. -// Models which "extend" this model: -// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID -// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN -// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref -// This model "extends" VolumeAttachmentPrototypeVolume -type VolumeAttachmentPrototypeVolumeVolumeIdentity struct { - // The unique identifier for this volume. - ID *string `json:"id,omitempty"` - - // The CRN for this volume. - CRN *string `json:"crn,omitempty"` - - // The URL for this volume. - Href *string `json:"href,omitempty"` -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentity) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { - return true -} - -type VolumeAttachmentPrototypeVolumeVolumeIdentityIntf interface { - VolumeAttachmentPrototypeVolumeIntf - isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentity) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentity from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct -// Models which "extend" this model: -// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity -// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot -// This model "extends" VolumeAttachmentPrototypeVolume -type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to - // use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use for this volume. If unspecified, the instance's resource - // group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` -} - -func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { - return true -} - -type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextIntf interface { - VolumeAttachmentPrototypeVolumeIntf - isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool -} - -func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeIdentityByCRN : VolumeIdentityByCRN struct -// This model "extends" VolumeIdentity -type VolumeIdentityByCRN struct { - // The CRN for this volume. - CRN *string `json:"crn" validate:"required"` -} - -// NewVolumeIdentityByCRN : Instantiate VolumeIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVolumeIdentityByCRN(crn string) (_model *VolumeIdentityByCRN, err error) { - _model = &VolumeIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeIdentityByCRN) isaVolumeIdentity() bool { - return true -} - -// UnmarshalVolumeIdentityByCRN unmarshals an instance of VolumeIdentityByCRN from the specified map of raw messages. -func UnmarshalVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeIdentityByHref : VolumeIdentityByHref struct -// This model "extends" VolumeIdentity -type VolumeIdentityByHref struct { - // The URL for this volume. - Href *string `json:"href" validate:"required"` -} - -// NewVolumeIdentityByHref : Instantiate VolumeIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVolumeIdentityByHref(href string) (_model *VolumeIdentityByHref, err error) { - _model = &VolumeIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeIdentityByHref) isaVolumeIdentity() bool { - return true -} - -// UnmarshalVolumeIdentityByHref unmarshals an instance of VolumeIdentityByHref from the specified map of raw messages. -func UnmarshalVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeIdentityByID : VolumeIdentityByID struct -// This model "extends" VolumeIdentity -type VolumeIdentityByID struct { - // The unique identifier for this volume. - ID *string `json:"id" validate:"required"` -} - -// NewVolumeIdentityByID : Instantiate VolumeIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVolumeIdentityByID(id string) (_model *VolumeIdentityByID, err error) { - _model = &VolumeIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeIdentityByID) isaVolumeIdentity() bool { - return true -} - -// UnmarshalVolumeIdentityByID unmarshals an instance of VolumeIdentityByID from the specified map of raw messages. -func UnmarshalVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeProfileIdentityByHref : VolumeProfileIdentityByHref struct -// This model "extends" VolumeProfileIdentity -type VolumeProfileIdentityByHref struct { - // The URL for this volume profile. - Href *string `json:"href" validate:"required"` -} - -// NewVolumeProfileIdentityByHref : Instantiate VolumeProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVolumeProfileIdentityByHref(href string) (_model *VolumeProfileIdentityByHref, err error) { - _model = &VolumeProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeProfileIdentityByHref) isaVolumeProfileIdentity() bool { - return true -} - -// UnmarshalVolumeProfileIdentityByHref unmarshals an instance of VolumeProfileIdentityByHref from the specified map of raw messages. -func UnmarshalVolumeProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeProfileIdentityByName : VolumeProfileIdentityByName struct -// This model "extends" VolumeProfileIdentity -type VolumeProfileIdentityByName struct { - // The globally unique name for this volume profile. - Name *string `json:"name" validate:"required"` -} - -// NewVolumeProfileIdentityByName : Instantiate VolumeProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewVolumeProfileIdentityByName(name string) (_model *VolumeProfileIdentityByName, err error) { - _model = &VolumeProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeProfileIdentityByName) isaVolumeProfileIdentity() bool { - return true -} - -// UnmarshalVolumeProfileIdentityByName unmarshals an instance of VolumeProfileIdentityByName from the specified map of raw messages. -func UnmarshalVolumeProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumePrototypeVolumeByCapacity : VolumePrototypeVolumeByCapacity struct -// This model "extends" VolumePrototype -type VolumePrototypeVolumeByCapacity struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this volume will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. - Capacity *int64 `json:"capacity" validate:"required"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` -} - -// NewVolumePrototypeVolumeByCapacity : Instantiate VolumePrototypeVolumeByCapacity (Generic Model Constructor) -func (*VpcV1) NewVolumePrototypeVolumeByCapacity(profile VolumeProfileIdentityIntf, zone ZoneIdentityIntf, capacity int64) (_model *VolumePrototypeVolumeByCapacity, err error) { - _model = &VolumePrototypeVolumeByCapacity{ - Profile: profile, - Zone: zone, - Capacity: core.Int64Ptr(capacity), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumePrototypeVolumeByCapacity) isaVolumePrototype() bool { - return true -} - -// UnmarshalVolumePrototypeVolumeByCapacity unmarshals an instance of VolumePrototypeVolumeByCapacity from the specified map of raw messages. -func UnmarshalVolumePrototypeVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumePrototypeVolumeByCapacity) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumePrototypeVolumeBySourceSnapshot : VolumePrototypeVolumeBySourceSnapshot struct -// This model "extends" VolumePrototype -type VolumePrototypeVolumeBySourceSnapshot struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this volume will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's - // `minimum_capacity`. The maximum value may increase in the future. - // - // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` -} - -// NewVolumePrototypeVolumeBySourceSnapshot : Instantiate VolumePrototypeVolumeBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewVolumePrototypeVolumeBySourceSnapshot(profile VolumeProfileIdentityIntf, zone ZoneIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumePrototypeVolumeBySourceSnapshot, err error) { - _model = &VolumePrototypeVolumeBySourceSnapshot{ - Profile: profile, - Zone: zone, - SourceSnapshot: sourceSnapshot, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumePrototypeVolumeBySourceSnapshot) isaVolumePrototype() bool { - return true -} - -// UnmarshalVolumePrototypeVolumeBySourceSnapshot unmarshals an instance of VolumePrototypeVolumeBySourceSnapshot from the specified map of raw messages. -func UnmarshalVolumePrototypeVolumeBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumePrototypeVolumeBySourceSnapshot) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ZoneIdentityByHref : ZoneIdentityByHref struct -// This model "extends" ZoneIdentity -type ZoneIdentityByHref struct { - // The URL for this zone. - Href *string `json:"href" validate:"required"` -} - -// NewZoneIdentityByHref : Instantiate ZoneIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewZoneIdentityByHref(href string) (_model *ZoneIdentityByHref, err error) { - _model = &ZoneIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ZoneIdentityByHref) isaZoneIdentity() bool { - return true -} - -// UnmarshalZoneIdentityByHref unmarshals an instance of ZoneIdentityByHref from the specified map of raw messages. -func UnmarshalZoneIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ZoneIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ZoneIdentityByName : ZoneIdentityByName struct -// This model "extends" ZoneIdentity -type ZoneIdentityByName struct { - // The globally unique name for this zone. - Name *string `json:"name" validate:"required"` -} - -// NewZoneIdentityByName : Instantiate ZoneIdentityByName (Generic Model Constructor) -func (*VpcV1) NewZoneIdentityByName(name string) (_model *ZoneIdentityByName, err error) { - _model = &ZoneIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ZoneIdentityByName) isaZoneIdentity() bool { - return true -} - -// UnmarshalZoneIdentityByName unmarshals an instance of ZoneIdentityByName from the specified map of raw messages. -func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ZoneIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN : BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct -// This model "extends" BackupPolicyScopePrototypeEnterpriseIdentity -type BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct { - // The CRN for this enterprise. - CRN *string `json:"crn" validate:"required"` -} - -// NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN : Instantiate BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN(crn string) (_model *BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN, err error) { - _model = &BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) isaBackupPolicyScopePrototypeEnterpriseIdentity() bool { - return true -} - -func (*BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) isaBackupPolicyScopePrototype() bool { - return true -} - -// UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN unmarshals an instance of BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN from the specified map of raw messages. -func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayReservedIPReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityByHref struct -// This model "extends" EndpointGatewayReservedIPReservedIPIdentity -type EndpointGatewayReservedIPReservedIPIdentityByHref struct { - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` -} - -// NewEndpointGatewayReservedIPReservedIPIdentityByHref : Instantiate EndpointGatewayReservedIPReservedIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByHref(href string) (_model *EndpointGatewayReservedIPReservedIPIdentityByHref, err error) { - _model = &EndpointGatewayReservedIPReservedIPIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*EndpointGatewayReservedIPReservedIPIdentityByHref) isaEndpointGatewayReservedIPReservedIPIdentity() bool { - return true -} - -func (*EndpointGatewayReservedIPReservedIPIdentityByHref) isaEndpointGatewayReservedIP() bool { - return true -} - -// UnmarshalEndpointGatewayReservedIPReservedIPIdentityByHref unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityByHref from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIPReservedIPIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayReservedIPReservedIPIdentityByID : EndpointGatewayReservedIPReservedIPIdentityByID struct -// This model "extends" EndpointGatewayReservedIPReservedIPIdentity -type EndpointGatewayReservedIPReservedIPIdentityByID struct { - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` -} - -// NewEndpointGatewayReservedIPReservedIPIdentityByID : Instantiate EndpointGatewayReservedIPReservedIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByID(id string) (_model *EndpointGatewayReservedIPReservedIPIdentityByID, err error) { - _model = &EndpointGatewayReservedIPReservedIPIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*EndpointGatewayReservedIPReservedIPIdentityByID) isaEndpointGatewayReservedIPReservedIPIdentity() bool { - return true -} - -func (*EndpointGatewayReservedIPReservedIPIdentityByID) isaEndpointGatewayReservedIP() bool { - return true -} - -// UnmarshalEndpointGatewayReservedIPReservedIPIdentityByID unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityByID from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIPReservedIPIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct -// This model "extends" EndpointGatewayTargetPrototypeProviderCloudServiceIdentity -type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. - CRN *string `json:"crn" validate:"required"` -} - -// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN.ResourceType property. -// The type of target for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -// NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : Instantiate EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(resourceType string, crn string) (_model *EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN, err error) { - _model = &EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN{ - ResourceType: core.StringPtr(resourceType), - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { - return true -} - -func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototype() bool { - return true -} - -// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : The name of this provider infrastructure service. -// This model "extends" EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity -type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - - // The name of a provider infrastructure service. Must be: - // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. - Name *string `json:"name" validate:"required"` -} - -// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName.ResourceType property. -// The type of target for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -// NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : Instantiate EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(resourceType string, name string) (_model *EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName, err error) { - _model = &EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName{ - ResourceType: core.StringPtr(resourceType), - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { - return true -} - -func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototype() bool { - return true -} - -// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct -// This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity -type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { - // The URL for this bare metal server network interface. - Href *string `json:"href" validate:"required"` -} - -// NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity -type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { - // The unique identifier for this bare metal server network interface. - ID *string `json:"id" validate:"required"` -} - -// NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct -// This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity -type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { - // The URL for this instance network interface. - Href *string `json:"href" validate:"required"` -} - -// NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity -type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { - // The unique identifier for this instance network interface. - ID *string `json:"id" validate:"required"` -} - -// NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity -type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity -type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity -type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct -// This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity -type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { - // The URL for this bare metal server network interface. - Href *string `json:"href" validate:"required"` -} - -// NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity -type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { - // The unique identifier for this bare metal server network interface. - ID *string `json:"id" validate:"required"` -} - -// NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct -// This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity -type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { - // The URL for this instance network interface. - Href *string `json:"href" validate:"required"` -} - -// NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity -type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { - // The unique identifier for this instance network interface. - ID *string `json:"id" validate:"required"` -} - -// NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity -type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity -type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity -type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct -// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity -type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN, err error) { - _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref struct -// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity -type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref struct { - // The URL for this virtual server instance. - Href *string `json:"href" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref, err error) { - _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID struct -// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity -type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID struct { - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID, err error) { - _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref : FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref struct -// This model "extends" FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity -type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref struct { - // The URL for this instance network attachment. - Href *string `json:"href" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref, err error) { - _model = &FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID : FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID struct -// This model "extends" FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity -type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID struct { - // The unique identifier for this instance network attachment. - ID *string `json:"id" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID : Instantiate FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID, err error) { - _model = &FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct -// This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity -type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { - // The URL for this instance network interface. - Href *string `json:"href" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { - _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct -// This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity -type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { - // The unique identifier for this instance network interface. - ID *string `json:"id" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { - _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN struct -// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity -type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN struct { - // The CRN for this subnet. - CRN *string `json:"crn" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN, err error) { - _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref struct -// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity -type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref struct { - // The URL for this subnet. - Href *string `json:"href" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref, err error) { - _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID struct -// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity -type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID struct { - // The unique identifier for this subnet. - ID *string `json:"id" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID, err error) { - _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN struct -// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity -type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN, err error) { - _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref struct -// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity -type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref struct { - // The URL for this VPC. - Href *string `json:"href" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref, err error) { - _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID struct -// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity -type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID struct { - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID, err error) { - _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity -type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity -type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity -type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec struct -// Models which "extend" this model: -// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup -// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager -// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototype -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { - return true -} - -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecIntf interface { - InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf - isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt struct -// Models which "extend" this model: -// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup -// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager -// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototype -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The date and time the scheduled action will run. - RunAt *strfmt.DateTime `json:"run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { - return true -} - -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtIntf interface { - InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf - isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionScheduledActionGroupTarget : InstanceGroupManagerActionScheduledActionGroupTarget struct -// This model "extends" InstanceGroupManagerActionScheduledAction -type InstanceGroupManagerActionScheduledActionGroupTarget struct { - // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. At present, this is always - // `true`, but may be modifiable in the future. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. - AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` - - // The date and time that the instance group manager action was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager action. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager action. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager action. The name is unique across all actions for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the instance group action - // - `active`: Action is ready to be run - // - `completed`: Action was completed successfully - // - `failed`: Action could not be completed successfully - // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. - Status *string `json:"status" validate:"required"` - - // The date and time that the instance group manager action was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The type of action for the instance group. - ActionType *string `json:"action_type" validate:"required"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - // The date and time the scheduled action was last applied. If absent, the action has never been applied. - LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` - - // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run - // time. - NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroup `json:"group" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionScheduledActionGroupTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) - -// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.Status property. -// The status of the instance group action -// - `active`: Action is ready to be run -// - `completed`: Action was completed successfully -// - `failed`: Action could not be completed successfully -// - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. -const ( - InstanceGroupManagerActionScheduledActionGroupTargetStatusActiveConst = "active" - InstanceGroupManagerActionScheduledActionGroupTargetStatusCompletedConst = "completed" - InstanceGroupManagerActionScheduledActionGroupTargetStatusFailedConst = "failed" - InstanceGroupManagerActionScheduledActionGroupTargetStatusIncompatibleConst = "incompatible" - InstanceGroupManagerActionScheduledActionGroupTargetStatusOmittedConst = "omitted" -) - -// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ActionType property. -// The type of action for the instance group. -const ( - InstanceGroupManagerActionScheduledActionGroupTargetActionTypeScheduledConst = "scheduled" -) - -func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerActionScheduledAction() bool { - return true -} - -func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerAction() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionGroupTarget from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionScheduledActionGroupTarget) - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionScheduledActionManagerTarget : InstanceGroupManagerActionScheduledActionManagerTarget struct -// This model "extends" InstanceGroupManagerActionScheduledAction -type InstanceGroupManagerActionScheduledActionManagerTarget struct { - // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. At present, this is always - // `true`, but may be modifiable in the future. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. - AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` - - // The date and time that the instance group manager action was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager action. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager action. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager action. The name is unique across all actions for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the instance group action - // - `active`: Action is ready to be run - // - `completed`: Action was completed successfully - // - `failed`: Action could not be completed successfully - // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. - Status *string `json:"status" validate:"required"` - - // The date and time that the instance group manager action was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The type of action for the instance group. - ActionType *string `json:"action_type" validate:"required"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - // The date and time the scheduled action was last applied. If absent, the action has never been applied. - LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` - - // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run - // time. - NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionScheduledActionManagerTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) - -// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.Status property. -// The status of the instance group action -// - `active`: Action is ready to be run -// - `completed`: Action was completed successfully -// - `failed`: Action could not be completed successfully -// - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. -const ( - InstanceGroupManagerActionScheduledActionManagerTargetStatusActiveConst = "active" - InstanceGroupManagerActionScheduledActionManagerTargetStatusCompletedConst = "completed" - InstanceGroupManagerActionScheduledActionManagerTargetStatusFailedConst = "failed" - InstanceGroupManagerActionScheduledActionManagerTargetStatusIncompatibleConst = "incompatible" - InstanceGroupManagerActionScheduledActionManagerTargetStatusOmittedConst = "omitted" -) - -// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ActionType property. -// The type of action for the instance group. -const ( - InstanceGroupManagerActionScheduledActionManagerTargetActionTypeScheduledConst = "scheduled" -) - -func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerActionScheduledAction() bool { - return true -} - -func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerAction() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionManagerTarget from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionScheduledActionManagerTarget) - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct -// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype -type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` -} - -// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(href string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref, err error) { - _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { - return true -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct -// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype -type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` -} - -// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(id string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID, err error) { - _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { - return true -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity -type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct { - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity -type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct { - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity -type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct { - // The unique identifier for this dedicated host. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity -type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct { - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity -type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct { - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity -type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct { - // The unique identifier for this dedicated host. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct -// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct { - // The CRN for this placement group. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN, err error) { - _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct -// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct { - // The URL for this placement group. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref, err error) { - _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct -// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct { - // The unique identifier for this placement group. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID, err error) { - _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct -// This model "extends" InstancePrototypeInstanceByCatalogOffering -type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment, err error) { - _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment{ - CatalogOffering: catalogOffering, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstancePrototypeInstanceByCatalogOffering() bool { - return true -} - -func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct -// This model "extends" InstancePrototypeInstanceByCatalogOffering -type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface, err error) { - _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface{ - CatalogOffering: catalogOffering, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstancePrototypeInstanceByCatalogOffering() bool { - return true -} - -func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment struct -// This model "extends" InstancePrototypeInstanceByImage -type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment, err error) { - _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment{ - Image: image, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstancePrototypeInstanceByImage() bool { - return true -} - -func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface : InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface struct -// This model "extends" InstancePrototypeInstanceByImage -type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface, err error) { - _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface{ - Image: image, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstancePrototypeInstanceByImage() bool { - return true -} - -func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct -// This model "extends" InstancePrototypeInstanceBySourceSnapshot -type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment, err error) { - _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstancePrototypeInstanceBySourceSnapshot() bool { - return true -} - -func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct -// This model "extends" InstancePrototypeInstanceBySourceSnapshot -type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface, err error) { - _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstancePrototypeInstanceBySourceSnapshot() bool { - return true -} - -func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment struct -// This model "extends" InstancePrototypeInstanceByVolume -type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment, err error) { - _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) isaInstancePrototypeInstanceByVolume() bool { - return true -} - -func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface : InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface struct -// This model "extends" InstancePrototypeInstanceByVolume -type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. If unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface, err error) { - _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) isaInstancePrototypeInstanceByVolume() bool { - return true -} - -func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering -type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment{ - CatalogOffering: catalogOffering, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { - return true -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering -type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface{ - CatalogOffering: catalogOffering, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { - return true -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage -type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment{ - Image: image, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { - return true -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage -type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface{ - Image: image, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { - return true -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { - return true -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { - return true -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext -type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { - return true -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct -// This model "extends" InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext -type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { - return true -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplateInstanceByImageInstanceTemplateContext -type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { - return true -} - -func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct -// This model "extends" InstanceTemplateInstanceByImageInstanceTemplateContext -type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { - return true -} - -func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext -type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *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"` -} - -func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { - return true -} - -func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct -// This model "extends" InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext -type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as - // SSH authorized keys for the administrative user. - // - // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if - // no keys are specified, the instance will be inaccessible unless the specified image provides another means of - // access. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *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"` -} - -func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { - return true -} - -func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct -// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { - return true -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct -// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { - return true -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct -// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { - return true -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct -// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { - return true -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct -// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity -type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` -} - -// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN, err error) { - _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { - return true -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct -// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity -type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct { - // The URL for this virtual server instance. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(href string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref, err error) { - _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { - return true -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct -// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity -type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct { - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(id string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID, err error) { - _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { - return true -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceIPPrototypeReservedIPIdentityByHref : NetworkInterfaceIPPrototypeReservedIPIdentityByHref struct -// This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity -type NetworkInterfaceIPPrototypeReservedIPIdentityByHref struct { - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` -} - -// NewNetworkInterfaceIPPrototypeReservedIPIdentityByHref : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByHref(href string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityByHref, err error) { - _model = &NetworkInterfaceIPPrototypeReservedIPIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkInterfaceIPPrototypeReservedIPIdentityByHref) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { - return true -} - -func (*NetworkInterfaceIPPrototypeReservedIPIdentityByHref) isaNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByHref unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityByHref from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceIPPrototypeReservedIPIdentityByID : NetworkInterfaceIPPrototypeReservedIPIdentityByID struct -// This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity -type NetworkInterfaceIPPrototypeReservedIPIdentityByID struct { - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` -} - -// NewNetworkInterfaceIPPrototypeReservedIPIdentityByID : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByID(id string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityByID, err error) { - _model = &NetworkInterfaceIPPrototypeReservedIPIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkInterfaceIPPrototypeReservedIPIdentityByID) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { - return true -} - -func (*NetworkInterfaceIPPrototypeReservedIPIdentityByID) isaNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByID unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityByID from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress struct -// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity -type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress struct { - // The globally unique IP address. - Address *string `json:"address" validate:"required"` -} - -// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(address string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress, err error) { - _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { - return true -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN struct -// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity -type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN struct { - // The CRN for this floating IP. - CRN *string `json:"crn" validate:"required"` -} - -// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN(crn string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN, err error) { - _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { - return true -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref struct -// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity -type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref struct { - // The URL for this floating IP. - Href *string `json:"href" validate:"required"` -} - -// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(href string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref, err error) { - _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { - return true -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID struct -// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity -type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID struct { - // The unique identifier for this floating IP. - ID *string `json:"id" validate:"required"` -} - -// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(id string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID, err error) { - _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { - return true -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN struct -// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity -type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN struct { - // The CRN for this endpoint gateway. - CRN *string `json:"crn" validate:"required"` -} - -// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(crn string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN, err error) { - _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { - return true -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref struct -// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity -type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref struct { - // The URL for this endpoint gateway. - Href *string `json:"href" validate:"required"` -} - -// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(href string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref, err error) { - _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { - return true -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID struct -// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity -type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID struct { - // The unique identifier for this endpoint gateway. - ID *string `json:"id" validate:"required"` -} - -// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID (Generic Model Constructor) -func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(id string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID, err error) { - _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { - return true -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity -type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity -type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity -type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP : RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct -// This model "extends" RouteNextHopPatchRouteNextHopIP -type RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct { - // The sentinel IP address (`0.0.0.0`). - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} - -// NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP : Instantiate RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP (Generic Model Constructor) -func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(address string) (_model *RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP, err error) { - _model = &RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPatchRouteNextHopIP() bool { - return true -} - -func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPatch() bool { - return true -} - -// UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP unmarshals an instance of RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP from the specified map of raw messages. -func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP : RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct -// This model "extends" RouteNextHopPatchRouteNextHopIP -type RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct { - // A unicast IP address, which must not be any of the following values: - // - // - `0.0.0.0` (the sentinel IP address) - // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) - // - `255.255.255.255` (the broadcast IP address) - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} - -// NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP : Instantiate RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP (Generic Model Constructor) -func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(address string) (_model *RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP, err error) { - _model = &RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPatchRouteNextHopIP() bool { - return true -} - -func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPatch() bool { - return true -} - -// UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP unmarshals an instance of RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP from the specified map of raw messages. -func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct -// This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity -type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { - _model = &RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { - return true -} - -func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPatch() bool { - return true -} - -// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. -func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct -// This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity -type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` -} - -// NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) -func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { - _model = &RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { - return true -} - -func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPatch() bool { - return true -} - -// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. -func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct -// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct { - // The sentinel IP address (`0.0.0.0`). - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} - -// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP (Generic Model Constructor) -func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP, err error) { - _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { - return true -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct -// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct { - // A unicast IP address, which must not be any of the following values: - // - // - `0.0.0.0` (the sentinel IP address) - // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) - // - `255.255.255.255` (the broadcast IP address) - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} - -// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP (Generic Model Constructor) -func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP, err error) { - _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { - return true -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct -// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { - _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { - return true -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct -// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` -} - -// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) -func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { - _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { - return true -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct -// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity -type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct { - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` -} - -// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN, err error) { - _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { - return true -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct -// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity -type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct { - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(href string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref, err error) { - _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { - return true -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct -// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity -type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct { - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` -} - -// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(id string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID, err error) { - _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { - return true -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct -// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity -type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct { - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` -} - -// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN, err error) { - _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { - return true -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct -// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity -type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct { - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(href string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref, err error) { - _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { - return true -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID struct -// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity -type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID struct { - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` -} - -// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(id string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID, err error) { - _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { - return true -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity -type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity -type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity -type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct -// This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext -type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct { - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` -} - -// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(href string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref, err error) { - _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { - return true -} - -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) isaVirtualNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID struct -// This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext -type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID struct { - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` -} - -// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(id string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID, err error) { - _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { - return true -} - -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) isaVirtualNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct -// This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext -type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct { - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` -} - -// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref(href string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref, err error) { - _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { - return true -} - -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID struct -// This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext -type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID struct { - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` -} - -// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID(id string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID, err error) { - _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { - return true -} - -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct -// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity -type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct { - // The CRN for this volume. - CRN *string `json:"crn" validate:"required"` -} - -// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(crn string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN, err error) { - _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { - return true -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref struct -// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity -type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref struct { - // The URL for this volume. - Href *string `json:"href" validate:"required"` -} - -// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref(href string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref, err error) { - _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { - return true -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID struct -// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity -type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID struct { - // The unique identifier for this volume. - ID *string `json:"id" validate:"required"` -} - -// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(id string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID, err error) { - _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { - return true -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct -// This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext -type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use for this volume. If unspecified, the instance's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. - Capacity *int64 `json:"capacity" validate:"required"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` -} - -// NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : Instantiate VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(profile VolumeProfileIdentityIntf, capacity int64) (_model *VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity, err error) { - _model = &VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity{ - Profile: profile, - Capacity: core.Int64Ptr(capacity), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { - return true -} - -func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct -// This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext -type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use for this volume. If unspecified, the instance's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's - // `minimum_capacity`. The maximum value may increase in the future. - // - // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` -} - -// NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : Instantiate VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(profile VolumeProfileIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot, err error) { - _model = &VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot{ - Profile: profile, - SourceSnapshot: sourceSnapshot, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { - return true -} - -func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup struct -// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group" validate:"required"` -} - -// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup(group *InstanceGroupManagerScheduledActionGroupPrototype) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup, err error) { - _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup{ - Group: group, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager struct -// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager" validate:"required"` -} - -// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager(manager InstanceGroupManagerScheduledActionManagerPrototypeIntf) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager, err error) { - _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager{ - Manager: manager, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup struct -// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The date and time the scheduled action will run. - RunAt *strfmt.DateTime `json:"run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group" validate:"required"` -} - -// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup(group *InstanceGroupManagerScheduledActionGroupPrototype) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup, err error) { - _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup{ - Group: group, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager struct -// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The date and time the scheduled action will run. - RunAt *strfmt.DateTime `json:"run_at,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager" validate:"required"` -} - -// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager(manager InstanceGroupManagerScheduledActionManagerPrototypeIntf) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager, err error) { - _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager{ - Manager: manager, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. -type VPCAddressPrefixesPager struct { - hasNext bool - options *ListVPCAddressPrefixesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPCAddressPrefixesPager returns a new VPCAddressPrefixesPager instance. -func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOptions) (pager *VPCAddressPrefixesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVPCAddressPrefixesOptions = *options - pager = &VPCAddressPrefixesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCAddressPrefixesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (page []AddressPrefix, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPCAddressPrefixesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.AddressPrefixes - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (allItems []AddressPrefix, err error) { - for pager.HasNext() { - var nextPage []AddressPrefix - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCAddressPrefixesPager) GetNext() (page []AddressPrefix, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VPCDnsResolutionBindingsPager can be used to simplify the use of the "ListVPCDnsResolutionBindings" method. -type VPCDnsResolutionBindingsPager struct { - hasNext bool - options *ListVPCDnsResolutionBindingsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPCDnsResolutionBindingsPager returns a new VPCDnsResolutionBindingsPager instance. -func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolutionBindingsOptions) (pager *VPCDnsResolutionBindingsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVPCDnsResolutionBindingsOptions = *options - pager = &VPCDnsResolutionBindingsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCDnsResolutionBindingsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Context) (page []VpcdnsResolutionBinding, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPCDnsResolutionBindingsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.DnsResolutionBindings - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Context) (allItems []VpcdnsResolutionBinding, err error) { - for pager.HasNext() { - var nextPage []VpcdnsResolutionBinding - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCDnsResolutionBindingsPager) GetNext() (page []VpcdnsResolutionBinding, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPCDnsResolutionBindingsPager) GetAll() (allItems []VpcdnsResolutionBinding, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. -type VPCRoutesPager struct { - hasNext bool - options *ListVPCRoutesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPCRoutesPager returns a new VPCRoutesPager instance. -func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRoutesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVPCRoutesOptions = *options - pager = &VPCRoutesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCRoutesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []RouteCollectionVPCContextRoutesItem, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPCRoutesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Routes - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems []RouteCollectionVPCContextRoutesItem, err error) { - for pager.HasNext() { - var nextPage []RouteCollectionVPCContextRoutesItem - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutesPager) GetNext() (page []RouteCollectionVPCContextRoutesItem, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutesPager) GetAll() (allItems []RouteCollectionVPCContextRoutesItem, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. -type VPCRoutingTableRoutesPager struct { - hasNext bool - options *ListVPCRoutingTableRoutesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. -func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVPCRoutingTableRoutesOptions = *options - pager = &VPCRoutingTableRoutesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCRoutingTableRoutesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) (page []Route, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Routes - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { - for pager.HasNext() { - var nextPage []Route - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutingTableRoutesPager) GetNext() (page []Route, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VPCRoutingTablesPager can be used to simplify the use of the "ListVPCRoutingTables" method. -type VPCRoutingTablesPager struct { - hasNext bool - options *ListVPCRoutingTablesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPCRoutingTablesPager returns a new VPCRoutingTablesPager instance. -func (vpc *VpcV1) NewVPCRoutingTablesPager(options *ListVPCRoutingTablesOptions) (pager *VPCRoutingTablesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVPCRoutingTablesOptions = *options - pager = &VPCRoutingTablesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCRoutingTablesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCRoutingTablesPager) GetNextWithContext(ctx context.Context) (page []RoutingTable, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPCRoutingTablesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.RoutingTables - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPCRoutingTablesPager) GetAllWithContext(ctx context.Context) (allItems []RoutingTable, err error) { - for pager.HasNext() { - var nextPage []RoutingTable - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutingTablesPager) GetNext() (page []RoutingTable, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutingTablesPager) GetAll() (allItems []RoutingTable, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VpcsPager can be used to simplify the use of the "ListVpcs" method. -type VpcsPager struct { - hasNext bool - options *ListVpcsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVpcsPager returns a new VpcsPager instance. -func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVpcsOptions = *options - pager = &VpcsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VpcsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVpcsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Vpcs - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, err error) { - for pager.HasNext() { - var nextPage []VPC - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VpcsPager) GetNext() (page []VPC, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VpcsPager) GetAll() (allItems []VPC, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. -type SubnetReservedIpsPager struct { - hasNext bool - options *ListSubnetReservedIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. -func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListSubnetReservedIpsOptions = *options - pager = &SubnetReservedIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SubnetReservedIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSubnetReservedIpsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.ReservedIps - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { - for pager.HasNext() { - var nextPage []ReservedIP - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SubnetReservedIpsPager) GetNext() (page []ReservedIP, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// SubnetsPager can be used to simplify the use of the "ListSubnets" method. -type SubnetsPager struct { - hasNext bool - options *ListSubnetsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSubnetsPager returns a new SubnetsPager instance. -func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListSubnetsOptions = *options - pager = &SubnetsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SubnetsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subnet, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSubnetsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Subnets - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Subnet, err error) { - for pager.HasNext() { - var nextPage []Subnet - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SubnetsPager) GetNext() (page []Subnet, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *SubnetsPager) GetAll() (allItems []Subnet, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// ImagesPager can be used to simplify the use of the "ListImages" method. -type ImagesPager struct { - hasNext bool - options *ListImagesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewImagesPager returns a new ImagesPager instance. -func (vpc *VpcV1) NewImagesPager(options *ListImagesOptions) (pager *ImagesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListImagesOptions = *options - pager = &ImagesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *ImagesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *ImagesPager) GetNextWithContext(ctx context.Context) (page []Image, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListImagesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Images - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *ImagesPager) GetAllWithContext(ctx context.Context) (allItems []Image, err error) { - for pager.HasNext() { - var nextPage []Image - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ImagesPager) GetNext() (page []Image, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *ImagesPager) GetAll() (allItems []Image, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// OperatingSystemsPager can be used to simplify the use of the "ListOperatingSystems" method. -type OperatingSystemsPager struct { - hasNext bool - options *ListOperatingSystemsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewOperatingSystemsPager returns a new OperatingSystemsPager instance. -func (vpc *VpcV1) NewOperatingSystemsPager(options *ListOperatingSystemsOptions) (pager *OperatingSystemsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListOperatingSystemsOptions = *options - pager = &OperatingSystemsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *OperatingSystemsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *OperatingSystemsPager) GetNextWithContext(ctx context.Context) (page []OperatingSystem, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListOperatingSystemsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.OperatingSystems - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *OperatingSystemsPager) GetAllWithContext(ctx context.Context) (allItems []OperatingSystem, err error) { - for pager.HasNext() { - var nextPage []OperatingSystem - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *OperatingSystemsPager) GetNext() (page []OperatingSystem, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *OperatingSystemsPager) GetAll() (allItems []OperatingSystem, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// KeysPager can be used to simplify the use of the "ListKeys" method. -type KeysPager struct { - hasNext bool - options *ListKeysOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewKeysPager returns a new KeysPager instance. -func (vpc *VpcV1) NewKeysPager(options *ListKeysOptions) (pager *KeysPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListKeysOptions = *options - pager = &KeysPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *KeysPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *KeysPager) GetNextWithContext(ctx context.Context) (page []Key, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListKeysWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Keys - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *KeysPager) GetAllWithContext(ctx context.Context) (allItems []Key, err error) { - for pager.HasNext() { - var nextPage []Key - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *KeysPager) GetNext() (page []Key, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *KeysPager) GetAll() (allItems []Key, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "ListInstanceNetworkInterfaceIps" method. -type InstanceNetworkInterfaceIpsPager struct { - hasNext bool - options *ListInstanceNetworkInterfaceIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstanceNetworkInterfaceIpsPager returns a new InstanceNetworkInterfaceIpsPager instance. -func (vpc *VpcV1) NewInstanceNetworkInterfaceIpsPager(options *ListInstanceNetworkInterfaceIpsOptions) (pager *InstanceNetworkInterfaceIpsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListInstanceNetworkInterfaceIpsOptions = *options - pager = &InstanceNetworkInterfaceIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceNetworkInterfaceIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstanceNetworkInterfaceIpsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Ips - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { - for pager.HasNext() { - var nextPage []ReservedIP - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceNetworkInterfaceIpsPager) GetNext() (page []ReservedIP, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// InstancesPager can be used to simplify the use of the "ListInstances" method. -type InstancesPager struct { - hasNext bool - options *ListInstancesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstancesPager returns a new InstancesPager instance. -func (vpc *VpcV1) NewInstancesPager(options *ListInstancesOptions) (pager *InstancesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListInstancesOptions = *options - pager = &InstancesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstancesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstancesPager) GetNextWithContext(ctx context.Context) (page []Instance, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstancesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Instances - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstancesPager) GetAllWithContext(ctx context.Context) (allItems []Instance, err error) { - for pager.HasNext() { - var nextPage []Instance - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstancesPager) GetNext() (page []Instance, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *InstancesPager) GetAll() (allItems []Instance, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. -type InstanceGroupManagerActionsPager struct { - hasNext bool - options *ListInstanceGroupManagerActionsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstanceGroupManagerActionsPager returns a new InstanceGroupManagerActionsPager instance. -func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroupManagerActionsOptions) (pager *InstanceGroupManagerActionsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListInstanceGroupManagerActionsOptions = *options - pager = &InstanceGroupManagerActionsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupManagerActionsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerActionIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstanceGroupManagerActionsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Actions - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerActionIntf, err error) { - for pager.HasNext() { - var nextPage []InstanceGroupManagerActionIntf - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagerActionsPager) GetNext() (page []InstanceGroupManagerActionIntf, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGroupManagerActionIntf, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. -type InstanceGroupManagerPoliciesPager struct { - hasNext bool - options *ListInstanceGroupManagerPoliciesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstanceGroupManagerPoliciesPager returns a new InstanceGroupManagerPoliciesPager instance. -func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGroupManagerPoliciesOptions) (pager *InstanceGroupManagerPoliciesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListInstanceGroupManagerPoliciesOptions = *options - pager = &InstanceGroupManagerPoliciesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupManagerPoliciesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerPolicyIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstanceGroupManagerPoliciesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Policies - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerPolicyIntf, err error) { - for pager.HasNext() { - var nextPage []InstanceGroupManagerPolicyIntf - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagerPoliciesPager) GetNext() (page []InstanceGroupManagerPolicyIntf, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGroupManagerPolicyIntf, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. -type InstanceGroupManagersPager struct { - hasNext bool - options *ListInstanceGroupManagersOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstanceGroupManagersPager returns a new InstanceGroupManagersPager instance. -func (vpc *VpcV1) NewInstanceGroupManagersPager(options *ListInstanceGroupManagersOptions) (pager *InstanceGroupManagersPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListInstanceGroupManagersOptions = *options - pager = &InstanceGroupManagersPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupManagersPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstanceGroupManagersWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Managers - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerIntf, err error) { - for pager.HasNext() { - var nextPage []InstanceGroupManagerIntf - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagersPager) GetNext() (page []InstanceGroupManagerIntf, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManagerIntf, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// InstanceGroupMembershipsPager can be used to simplify the use of the "ListInstanceGroupMemberships" method. -type InstanceGroupMembershipsPager struct { - hasNext bool - options *ListInstanceGroupMembershipsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstanceGroupMembershipsPager returns a new InstanceGroupMembershipsPager instance. -func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMembershipsOptions) (pager *InstanceGroupMembershipsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListInstanceGroupMembershipsOptions = *options - pager = &InstanceGroupMembershipsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupMembershipsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupMembership, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstanceGroupMembershipsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Memberships - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupMembership, err error) { - for pager.HasNext() { - var nextPage []InstanceGroupMembership - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupMembershipsPager) GetNext() (page []InstanceGroupMembership, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMembership, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. -type InstanceGroupsPager struct { - hasNext bool - options *ListInstanceGroupsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstanceGroupsPager returns a new InstanceGroupsPager instance. -func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListInstanceGroupsOptions = *options - pager = &InstanceGroupsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroup, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstanceGroupsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.InstanceGroups - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroup, err error) { - for pager.HasNext() { - var nextPage []InstanceGroup - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupsPager) GetNext() (page []InstanceGroup, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// DedicatedHostGroupsPager can be used to simplify the use of the "ListDedicatedHostGroups" method. -type DedicatedHostGroupsPager struct { - hasNext bool - options *ListDedicatedHostGroupsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewDedicatedHostGroupsPager returns a new DedicatedHostGroupsPager instance. -func (vpc *VpcV1) NewDedicatedHostGroupsPager(options *ListDedicatedHostGroupsOptions) (pager *DedicatedHostGroupsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListDedicatedHostGroupsOptions = *options - pager = &DedicatedHostGroupsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *DedicatedHostGroupsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *DedicatedHostGroupsPager) GetNextWithContext(ctx context.Context) (page []DedicatedHostGroup, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListDedicatedHostGroupsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Groups - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *DedicatedHostGroupsPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHostGroup, err error) { - for pager.HasNext() { - var nextPage []DedicatedHostGroup - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *DedicatedHostGroupsPager) GetNext() (page []DedicatedHostGroup, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *DedicatedHostGroupsPager) GetAll() (allItems []DedicatedHostGroup, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// DedicatedHostProfilesPager can be used to simplify the use of the "ListDedicatedHostProfiles" method. -type DedicatedHostProfilesPager struct { - hasNext bool - options *ListDedicatedHostProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewDedicatedHostProfilesPager returns a new DedicatedHostProfilesPager instance. -func (vpc *VpcV1) NewDedicatedHostProfilesPager(options *ListDedicatedHostProfilesOptions) (pager *DedicatedHostProfilesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListDedicatedHostProfilesOptions = *options - pager = &DedicatedHostProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *DedicatedHostProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *DedicatedHostProfilesPager) GetNextWithContext(ctx context.Context) (page []DedicatedHostProfile, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListDedicatedHostProfilesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *DedicatedHostProfilesPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHostProfile, err error) { - for pager.HasNext() { - var nextPage []DedicatedHostProfile - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *DedicatedHostProfilesPager) GetNext() (page []DedicatedHostProfile, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *DedicatedHostProfilesPager) GetAll() (allItems []DedicatedHostProfile, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// DedicatedHostsPager can be used to simplify the use of the "ListDedicatedHosts" method. -type DedicatedHostsPager struct { - hasNext bool - options *ListDedicatedHostsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewDedicatedHostsPager returns a new DedicatedHostsPager instance. -func (vpc *VpcV1) NewDedicatedHostsPager(options *ListDedicatedHostsOptions) (pager *DedicatedHostsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListDedicatedHostsOptions = *options - pager = &DedicatedHostsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *DedicatedHostsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *DedicatedHostsPager) GetNextWithContext(ctx context.Context) (page []DedicatedHost, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListDedicatedHostsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.DedicatedHosts - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *DedicatedHostsPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHost, err error) { - for pager.HasNext() { - var nextPage []DedicatedHost - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *DedicatedHostsPager) GetNext() (page []DedicatedHost, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *DedicatedHostsPager) GetAll() (allItems []DedicatedHost, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. -type BackupPoliciesPager struct { - hasNext bool - options *ListBackupPoliciesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBackupPoliciesPager returns a new BackupPoliciesPager instance. -func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pager *BackupPoliciesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListBackupPoliciesOptions = *options - pager = &BackupPoliciesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BackupPoliciesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicy, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBackupPoliciesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.BackupPolicies - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicy, err error) { - for pager.HasNext() { - var nextPage []BackupPolicy - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BackupPoliciesPager) GetNext() (page []BackupPolicy, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *BackupPoliciesPager) GetAll() (allItems []BackupPolicy, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. -type BackupPolicyJobsPager struct { - hasNext bool - options *ListBackupPolicyJobsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBackupPolicyJobsPager returns a new BackupPolicyJobsPager instance. -func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) (pager *BackupPolicyJobsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListBackupPolicyJobsOptions = *options - pager = &BackupPolicyJobsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BackupPolicyJobsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyJob, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBackupPolicyJobsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Jobs - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { - for pager.HasNext() { - var nextPage []BackupPolicyJob - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BackupPolicyJobsPager) GetNext() (page []BackupPolicyJob, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// PlacementGroupsPager can be used to simplify the use of the "ListPlacementGroups" method. -type PlacementGroupsPager struct { - hasNext bool - options *ListPlacementGroupsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewPlacementGroupsPager returns a new PlacementGroupsPager instance. -func (vpc *VpcV1) NewPlacementGroupsPager(options *ListPlacementGroupsOptions) (pager *PlacementGroupsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListPlacementGroupsOptions = *options - pager = &PlacementGroupsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *PlacementGroupsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *PlacementGroupsPager) GetNextWithContext(ctx context.Context) (page []PlacementGroup, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListPlacementGroupsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.PlacementGroups - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *PlacementGroupsPager) GetAllWithContext(ctx context.Context) (allItems []PlacementGroup, err error) { - for pager.HasNext() { - var nextPage []PlacementGroup - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *PlacementGroupsPager) GetNext() (page []PlacementGroup, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *PlacementGroupsPager) GetAll() (allItems []PlacementGroup, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. -type BareMetalServerNetworkAttachmentsPager struct { - hasNext bool - options *ListBareMetalServerNetworkAttachmentsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListBareMetalServerNetworkAttachmentsOptions = *options - pager = &BareMetalServerNetworkAttachmentsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkAttachments - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { - for pager.HasNext() { - var nextPage []BareMetalServerNetworkAttachmentIntf - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. -type BareMetalServerNetworkInterfacesPager struct { - hasNext bool - options *ListBareMetalServerNetworkInterfacesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListBareMetalServerNetworkInterfacesOptions = *options - pager = &BareMetalServerNetworkInterfacesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerNetworkInterfacesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkInterfaceIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkInterfaces - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { - for pager.HasNext() { - var nextPage []BareMetalServerNetworkInterfaceIntf - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. -type BareMetalServerProfilesPager struct { - hasNext bool - options *ListBareMetalServerProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. -func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListBareMetalServerProfilesOptions = *options - pager = &BareMetalServerProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfile, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { - for pager.HasNext() { - var nextPage []BareMetalServerProfile - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. -type BareMetalServersPager struct { - hasNext bool - options *ListBareMetalServersOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBareMetalServersPager returns a new BareMetalServersPager instance. -func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListBareMetalServersOptions = *options - pager = &BareMetalServersPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServersPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (page []BareMetalServer, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.BareMetalServers - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { - for pager.HasNext() { - var nextPage []BareMetalServer - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServersPager) GetNext() (page []BareMetalServer, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VolumeProfilesPager can be used to simplify the use of the "ListVolumeProfiles" method. -type VolumeProfilesPager struct { - hasNext bool - options *ListVolumeProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVolumeProfilesPager returns a new VolumeProfilesPager instance. -func (vpc *VpcV1) NewVolumeProfilesPager(options *ListVolumeProfilesOptions) (pager *VolumeProfilesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVolumeProfilesOptions = *options - pager = &VolumeProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VolumeProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VolumeProfilesPager) GetNextWithContext(ctx context.Context) (page []VolumeProfile, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVolumeProfilesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VolumeProfilesPager) GetAllWithContext(ctx context.Context) (allItems []VolumeProfile, err error) { - for pager.HasNext() { - var nextPage []VolumeProfile - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VolumeProfilesPager) GetNext() (page []VolumeProfile, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VolumeProfilesPager) GetAll() (allItems []VolumeProfile, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VolumesPager can be used to simplify the use of the "ListVolumes" method. -type VolumesPager struct { - hasNext bool - options *ListVolumesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVolumesPager returns a new VolumesPager instance. -func (vpc *VpcV1) NewVolumesPager(options *ListVolumesOptions) (pager *VolumesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVolumesOptions = *options - pager = &VolumesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VolumesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VolumesPager) GetNextWithContext(ctx context.Context) (page []Volume, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVolumesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Volumes - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VolumesPager) GetAllWithContext(ctx context.Context) (allItems []Volume, err error) { - for pager.HasNext() { - var nextPage []Volume - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VolumesPager) GetNext() (page []Volume, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VolumesPager) GetAll() (allItems []Volume, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// SnapshotsPager can be used to simplify the use of the "ListSnapshots" method. -type SnapshotsPager struct { - hasNext bool - options *ListSnapshotsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSnapshotsPager returns a new SnapshotsPager instance. -func (vpc *VpcV1) NewSnapshotsPager(options *ListSnapshotsOptions) (pager *SnapshotsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListSnapshotsOptions = *options - pager = &SnapshotsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SnapshotsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SnapshotsPager) GetNextWithContext(ctx context.Context) (page []Snapshot, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSnapshotsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Snapshots - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SnapshotsPager) GetAllWithContext(ctx context.Context) (allItems []Snapshot, err error) { - for pager.HasNext() { - var nextPage []Snapshot - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SnapshotsPager) GetNext() (page []Snapshot, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. -type ShareMountTargetsPager struct { - hasNext bool - options *ListShareMountTargetsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewShareMountTargetsPager returns a new ShareMountTargetsPager instance. -func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOptions) (pager *ShareMountTargetsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListShareMountTargetsOptions = *options - pager = &ShareMountTargetsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *ShareMountTargetsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (page []ShareMountTarget, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListShareMountTargetsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.MountTargets - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (allItems []ShareMountTarget, err error) { - for pager.HasNext() { - var nextPage []ShareMountTarget - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ShareMountTargetsPager) GetNext() (page []ShareMountTarget, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. -type ShareProfilesPager struct { - hasNext bool - options *ListShareProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewShareProfilesPager returns a new ShareProfilesPager instance. -func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (pager *ShareProfilesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListShareProfilesOptions = *options - pager = &ShareProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *ShareProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page []ShareProfile, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListShareProfilesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItems []ShareProfile, err error) { - for pager.HasNext() { - var nextPage []ShareProfile - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ShareProfilesPager) GetNext() (page []ShareProfile, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// SharesPager can be used to simplify the use of the "ListShares" method. -type SharesPager struct { - hasNext bool - options *ListSharesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSharesPager returns a new SharesPager instance. -func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListSharesOptions = *options - pager = &SharesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SharesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSharesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Shares - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Share, err error) { - for pager.HasNext() { - var nextPage []Share - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SharesPager) GetNext() (page []Share, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *SharesPager) GetAll() (allItems []Share, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. -type NetworkInterfaceFloatingIpsPager struct { - hasNext bool - options *ListNetworkInterfaceFloatingIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewNetworkInterfaceFloatingIpsPager returns a new NetworkInterfaceFloatingIpsPager instance. -func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterfaceFloatingIpsOptions) (pager *NetworkInterfaceFloatingIpsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListNetworkInterfaceFloatingIpsOptions = *options - pager = &NetworkInterfaceFloatingIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *NetworkInterfaceFloatingIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIPReference, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListNetworkInterfaceFloatingIpsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.FloatingIps - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIPReference, err error) { - for pager.HasNext() { - var nextPage []FloatingIPReference - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *NetworkInterfaceFloatingIpsPager) GetNext() (page []FloatingIPReference, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "ListVirtualNetworkInterfaceIps" method. -type VirtualNetworkInterfaceIpsPager struct { - hasNext bool - options *ListVirtualNetworkInterfaceIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVirtualNetworkInterfaceIpsPager returns a new VirtualNetworkInterfaceIpsPager instance. -func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetworkInterfaceIpsOptions) (pager *VirtualNetworkInterfaceIpsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVirtualNetworkInterfaceIpsOptions = *options - pager = &VirtualNetworkInterfaceIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VirtualNetworkInterfaceIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIPReference, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVirtualNetworkInterfaceIpsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Ips - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIPReference, err error) { - for pager.HasNext() { - var nextPage []ReservedIPReference - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VirtualNetworkInterfaceIpsPager) GetNext() (page []ReservedIPReference, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. -type VirtualNetworkInterfacesPager struct { - hasNext bool - options *ListVirtualNetworkInterfacesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. -func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVirtualNetworkInterfacesOptions = *options - pager = &VirtualNetworkInterfacesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VirtualNetworkInterfacesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []VirtualNetworkInterface, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.VirtualNetworkInterfaces - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []VirtualNetworkInterface, err error) { - for pager.HasNext() { - var nextPage []VirtualNetworkInterface - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. -type PublicGatewaysPager struct { - hasNext bool - options *ListPublicGatewaysOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewPublicGatewaysPager returns a new PublicGatewaysPager instance. -func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pager *PublicGatewaysPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListPublicGatewaysOptions = *options - pager = &PublicGatewaysPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *PublicGatewaysPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page []PublicGateway, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListPublicGatewaysWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.PublicGateways - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []PublicGateway, err error) { - for pager.HasNext() { - var nextPage []PublicGateway - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *PublicGatewaysPager) GetNext() (page []PublicGateway, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *PublicGatewaysPager) GetAll() (allItems []PublicGateway, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. -type FloatingIpsPager struct { - hasNext bool - options *ListFloatingIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewFloatingIpsPager returns a new FloatingIpsPager instance. -func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListFloatingIpsOptions = *options - pager = &FloatingIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *FloatingIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIP, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListFloatingIpsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.FloatingIps - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIP, err error) { - for pager.HasNext() { - var nextPage []FloatingIP - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *FloatingIpsPager) GetNext() (page []FloatingIP, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// NetworkACLRulesPager can be used to simplify the use of the "ListNetworkACLRules" method. -type NetworkACLRulesPager struct { - hasNext bool - options *ListNetworkACLRulesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewNetworkACLRulesPager returns a new NetworkACLRulesPager instance. -func (vpc *VpcV1) NewNetworkACLRulesPager(options *ListNetworkACLRulesOptions) (pager *NetworkACLRulesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListNetworkACLRulesOptions = *options - pager = &NetworkACLRulesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *NetworkACLRulesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page []NetworkACLRuleItemIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListNetworkACLRulesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Rules - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACLRuleItemIntf, err error) { - for pager.HasNext() { - var nextPage []NetworkACLRuleItemIntf - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *NetworkACLRulesPager) GetNext() (page []NetworkACLRuleItemIntf, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. -type NetworkAclsPager struct { - hasNext bool - options *ListNetworkAclsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewNetworkAclsPager returns a new NetworkAclsPager instance. -func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *NetworkAclsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListNetworkAclsOptions = *options - pager = &NetworkAclsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *NetworkAclsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []NetworkACL, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListNetworkAclsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkAcls - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACL, err error) { - for pager.HasNext() { - var nextPage []NetworkACL - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *NetworkAclsPager) GetNext() (page []NetworkACL, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// SecurityGroupTargetsPager can be used to simplify the use of the "ListSecurityGroupTargets" method. -type SecurityGroupTargetsPager struct { - hasNext bool - options *ListSecurityGroupTargetsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSecurityGroupTargetsPager returns a new SecurityGroupTargetsPager instance. -func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargetsOptions) (pager *SecurityGroupTargetsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListSecurityGroupTargetsOptions = *options - pager = &SecurityGroupTargetsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SecurityGroupTargetsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroupTargetReferenceIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSecurityGroupTargetsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Targets - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroupTargetReferenceIntf, err error) { - for pager.HasNext() { - var nextPage []SecurityGroupTargetReferenceIntf - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SecurityGroupTargetsPager) GetNext() (page []SecurityGroupTargetReferenceIntf, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTargetReferenceIntf, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. -type SecurityGroupsPager struct { - hasNext bool - options *ListSecurityGroupsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSecurityGroupsPager returns a new SecurityGroupsPager instance. -func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListSecurityGroupsOptions = *options - pager = &SecurityGroupsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SecurityGroupsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroup, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSecurityGroupsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.SecurityGroups - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroup, err error) { - for pager.HasNext() { - var nextPage []SecurityGroup - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SecurityGroupsPager) GetNext() (page []SecurityGroup, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. -type IkePoliciesPager struct { - hasNext bool - options *ListIkePoliciesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewIkePoliciesPager returns a new IkePoliciesPager instance. -func (vpc *VpcV1) NewIkePoliciesPager(options *ListIkePoliciesOptions) (pager *IkePoliciesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListIkePoliciesOptions = *options - pager = &IkePoliciesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *IkePoliciesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *IkePoliciesPager) GetNextWithContext(ctx context.Context) (page []IkePolicy, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListIkePoliciesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.IkePolicies - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *IkePoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IkePolicy, err error) { - for pager.HasNext() { - var nextPage []IkePolicy - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *IkePoliciesPager) GetNext() (page []IkePolicy, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *IkePoliciesPager) GetAll() (allItems []IkePolicy, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// IpsecPoliciesPager can be used to simplify the use of the "ListIpsecPolicies" method. -type IpsecPoliciesPager struct { - hasNext bool - options *ListIpsecPoliciesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewIpsecPoliciesPager returns a new IpsecPoliciesPager instance. -func (vpc *VpcV1) NewIpsecPoliciesPager(options *ListIpsecPoliciesOptions) (pager *IpsecPoliciesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListIpsecPoliciesOptions = *options - pager = &IpsecPoliciesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *IpsecPoliciesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *IpsecPoliciesPager) GetNextWithContext(ctx context.Context) (page []IPsecPolicy, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListIpsecPoliciesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.IpsecPolicies - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *IpsecPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IPsecPolicy, err error) { - for pager.HasNext() { - var nextPage []IPsecPolicy - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *IpsecPoliciesPager) GetNext() (page []IPsecPolicy, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *IpsecPoliciesPager) GetAll() (allItems []IPsecPolicy, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. -type VPNGatewaysPager struct { - hasNext bool - options *ListVPNGatewaysOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPNGatewaysPager returns a new VPNGatewaysPager instance. -func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVPNGatewaysOptions = *options - pager = &VPNGatewaysPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNGatewaysPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPNGatewaysWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.VPNGateways - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayIntf, err error) { - for pager.HasNext() { - var nextPage []VPNGatewayIntf - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNGatewaysPager) GetNext() (page []VPNGatewayIntf, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. -type VPNServerClientsPager struct { - hasNext bool - options *ListVPNServerClientsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPNServerClientsPager returns a new VPNServerClientsPager instance. -func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVPNServerClientsOptions = *options - pager = &VPNServerClientsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServerClientsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (page []VPNServerClient, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPNServerClientsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Clients - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerClient, err error) { - for pager.HasNext() { - var nextPage []VPNServerClient - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNServerClientsPager) GetNext() (page []VPNServerClient, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. -type VPNServerRoutesPager struct { - hasNext bool - options *ListVPNServerRoutesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. -func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVPNServerRoutesOptions = *options - pager = &VPNServerRoutesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServerRoutesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page []VPNServerRoute, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPNServerRoutesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Routes - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerRoute, err error) { - for pager.HasNext() { - var nextPage []VPNServerRoute - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNServerRoutesPager) GetNext() (page []VPNServerRoute, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// VPNServersPager can be used to simplify the use of the "ListVPNServers" method. -type VPNServersPager struct { - hasNext bool - options *ListVPNServersOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPNServersPager returns a new VPNServersPager instance. -func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListVPNServersOptions = *options - pager = &VPNServersPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServersPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VPNServer, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPNServersWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.VPNServers - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems []VPNServer, err error) { - for pager.HasNext() { - var nextPage []VPNServer - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNServersPager) GetNext() (page []VPNServer, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPNServersPager) GetAll() (allItems []VPNServer, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// LoadBalancerProfilesPager can be used to simplify the use of the "ListLoadBalancerProfiles" method. -type LoadBalancerProfilesPager struct { - hasNext bool - options *ListLoadBalancerProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewLoadBalancerProfilesPager returns a new LoadBalancerProfilesPager instance. -func (vpc *VpcV1) NewLoadBalancerProfilesPager(options *ListLoadBalancerProfilesOptions) (pager *LoadBalancerProfilesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListLoadBalancerProfilesOptions = *options - pager = &LoadBalancerProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *LoadBalancerProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *LoadBalancerProfilesPager) GetNextWithContext(ctx context.Context) (page []LoadBalancerProfile, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListLoadBalancerProfilesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *LoadBalancerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancerProfile, err error) { - for pager.HasNext() { - var nextPage []LoadBalancerProfile - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *LoadBalancerProfilesPager) GetNext() (page []LoadBalancerProfile, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *LoadBalancerProfilesPager) GetAll() (allItems []LoadBalancerProfile, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// LoadBalancersPager can be used to simplify the use of the "ListLoadBalancers" method. -type LoadBalancersPager struct { - hasNext bool - options *ListLoadBalancersOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewLoadBalancersPager returns a new LoadBalancersPager instance. -func (vpc *VpcV1) NewLoadBalancersPager(options *ListLoadBalancersOptions) (pager *LoadBalancersPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListLoadBalancersOptions = *options - pager = &LoadBalancersPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *LoadBalancersPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *LoadBalancersPager) GetNextWithContext(ctx context.Context) (page []LoadBalancer, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListLoadBalancersWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.LoadBalancers - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *LoadBalancersPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancer, err error) { - for pager.HasNext() { - var nextPage []LoadBalancer - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *LoadBalancersPager) GetNext() (page []LoadBalancer, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *LoadBalancersPager) GetAll() (allItems []LoadBalancer, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. -type EndpointGatewayIpsPager struct { - hasNext bool - options *ListEndpointGatewayIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. -func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListEndpointGatewayIpsOptions = *options - pager = &EndpointGatewayIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *EndpointGatewayIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListEndpointGatewayIpsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Ips - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { - for pager.HasNext() { - var nextPage []ReservedIP - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *EndpointGatewayIpsPager) GetNext() (page []ReservedIP, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. -type EndpointGatewaysPager struct { - hasNext bool - options *ListEndpointGatewaysOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. -func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListEndpointGatewaysOptions = *options - pager = &EndpointGatewaysPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *EndpointGatewaysPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (page []EndpointGateway, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListEndpointGatewaysWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.EndpointGateways - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []EndpointGateway, err error) { - for pager.HasNext() { - var nextPage []EndpointGateway - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *EndpointGatewaysPager) GetNext() (page []EndpointGateway, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// FlowLogCollectorsPager can be used to simplify the use of the "ListFlowLogCollectors" method. -type FlowLogCollectorsPager struct { - hasNext bool - options *ListFlowLogCollectorsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewFlowLogCollectorsPager returns a new FlowLogCollectorsPager instance. -func (vpc *VpcV1) NewFlowLogCollectorsPager(options *ListFlowLogCollectorsOptions) (pager *FlowLogCollectorsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListFlowLogCollectorsOptions = *options - pager = &FlowLogCollectorsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *FlowLogCollectorsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *FlowLogCollectorsPager) GetNextWithContext(ctx context.Context) (page []FlowLogCollector, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListFlowLogCollectorsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.FlowLogCollectors - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *FlowLogCollectorsPager) GetAllWithContext(ctx context.Context) (allItems []FlowLogCollector, err error) { - for pager.HasNext() { - var nextPage []FlowLogCollector - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *FlowLogCollectorsPager) GetNext() (page []FlowLogCollector, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *FlowLogCollectorsPager) GetAll() (allItems []FlowLogCollector, err error) { - return pager.GetAllWithContext(context.Background()) -} diff --git a/go.mod b/go.mod index 26563e53b7..2b8c59d107 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/IBM/schematics-go-sdk v0.2.2 github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2 github.com/IBM/vpc-beta-go-sdk v0.6.0 - github.com/IBM/vpc-go-sdk v0.46.0 + github.com/IBM/vpc-go-sdk v0.47.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 @@ -243,8 +243,6 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.43.0 => ./common/github.com/IBM/vpc-go-sdk - exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible diff --git a/go.sum b/go.sum index 4fd2380aab..621a5b12be 100644 --- a/go.sum +++ b/go.sum @@ -179,6 +179,8 @@ github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQy github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA= github.com/IBM/vpc-go-sdk v0.46.0 h1:OwXH3oaYgYmzt559n77AteSpNsW4H1PoeHcR4EOolzk= github.com/IBM/vpc-go-sdk v0.46.0/go.mod h1:4Hs5d/aClmsxAzwDQkwG+ri0vW2ykPJdpM6hDLRwKcA= +github.com/IBM/vpc-go-sdk v0.47.0 h1:2Qcjd4zQQRYjz+y4ZMDP6+aWGifyXCZ9uMmlpW7p9To= +github.com/IBM/vpc-go-sdk v0.47.0/go.mod h1:4Hs5d/aClmsxAzwDQkwG+ri0vW2ykPJdpM6hDLRwKcA= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= From 617aba370acea3610016923479077d309683e626 Mon Sep 17 00:00:00 2001 From: hkantare Date: Wed, 20 Dec 2023 18:24:02 +0530 Subject: [PATCH 115/132] Bump up versio to 1.61.0-beta0 --- CHANGELOG.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++ version/version.go | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be65d39357..342d230a24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,56 @@ +# 1.61.0-beta0 (Dec 20, 2023) +Features +* Support for MQ on Cloud + - **Datasources** + - ibm_mqcloud_queue_manager + - ibm_mqcloud_queue_manager_status + - ibm_mqcloud_application + - ibm_mqcloud_user + - ibm_mqcloud_keystore_certificate + - ibm_mqcloud_truststore_certificate + - **Resources** + - ibm_mqcloud_queue_manager + - ibm_mqcloud_application + - ibm_mqcloud_user + - ibm_mqcloud_keystore_certificate + - ibm_mqcloud_truststore_certificate +* Support for Secret Manager + - **Datasources** + - ibm_sm_service_credentials_secret_metadata + - ibm_sm_service_credentials_secret + - **Resources** + - ibm_sm_service_credentials_secret +* Support for VPC + - **Datasources** + - ibm_is_snapshot_consistency_group + - ibm_is_snapshot_consistency_groups + - **Resources** + - ibm_is_snapshot_consistency_group + +Enhancements +* feat(Cloud Databases): Database user password complexity validation ([4931](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4931)) +* Update pi_user_data to accept string input ([4974](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4974)) +* support host_link_agent_endpoint for Satellite host ([4970](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4970)) +* Add mtu and accessConfig flags to subnet create commands for terraform ([4690](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4690)) +* feat(Cloud Databases): Redis Database User RBAC support ([4982](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4982)) +* fix(Cloud Databases): fix Unwrap return value for go 1.18 compat ([4991](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4991)) +* update issue fixed ibm_is_subnet_reserved_ip ([4988](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4988)) +* Adding Flexible IOPS ([4992](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4992)) +* Removing Support For Power VPN Create ([4993](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4993)) +* Feature(share-crr): Share cross region replication ([4995](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4995)) +* Enhancement: Added operating system attributes to is images datasources ([4998](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4998)) +* added enhancement to one step delegate resolver in is_vpc ([5000](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/5000)) +* resolved delete issue for the floated nics on bm server ([5001](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/5001)) + +BugFixes +* Fix IBM pi documentation bug ([4969](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4969)) + +# 1.60.1 (Nov 09, 2023) + +BugFixes +* Regenerate Projects TF to fix generated doc and samples + ([4961](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4961)) + # 1.60.0 (Nov 29, 2023) Features * Support for Projects diff --git a/version/version.go b/version/version.go index 19638a80ae..09a75ca980 100644 --- a/version/version.go +++ b/version/version.go @@ -5,7 +5,7 @@ import ( ) // Version is the current provider main version -const Version = "1.60.0" +const Version = "1.61.0-beta0" // GitCommit is the git commit that was compiled. This will be filled in by the compiler. var GitCommit string From fa9b52fec97dbf8a70dea45c811bb63fcb9320de Mon Sep 17 00:00:00 2001 From: Riccardo Angelilli Date: Thu, 28 Dec 2023 06:40:29 +0100 Subject: [PATCH 116/132] Regenerate projects provider based off the latest go sdk (#5003) * new version * new version * new version * update code to the latest SDK level * fix integration tests * fix integration tests * fix integration tests * fix integration tests * address PR comment * typo * typo * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * add wait for create and delete * add wait for create and delete * . * fix integration tests * fix integration tests * fix integration tests * fix integration tests * fix integration tests * regenerate * new code generation * new generated code * point to latest sdk * point to latest sdk * adjust test cases and doc * adjust samples * update to latest node sdk * merge with master * Update project_instance.html.markdown Fixing formatting issues * Update project_event_notification.html.markdown * Update README.md * Update variables.tf * Update project_event_notification.html.markdown * new version * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * terraform * feat: projects graph fragment pattern * align with origin/master * update test cases * restore README.md and versions.tf to master branch * remove duplicated entries * feat: graph fragment pattern poc * feat: restore definition blocks * regenerate the terraform code based on latest YAML * regenerate the terraform code based on latest YAML * regenerate the terraform code based on latest YAML * update doc * update doc * fix test cases * commit generated code * commit fix * commit fix * test cases * test cases * test cases * test cases * updates * upgrade to latest go sdk * update generated doc * update generated code * updated secrets baseline * update code to latest API changes * secrets * fix secrets * update samples with real values * update secrets * update secrets * update generated code to the latest API definition * update secrets baseline * merge with master * merge with master * merge with master * update code to the latest SDK level * address some review comments * address PR comments * address PR comments * update to latest sdk level * update to latest sdk level * update to latest sdk level * merge with master * update to the latest sdk level * format test case * regenerate the code with generator fixes * regenerate code * fix "inputs" and "settings" properties * regenerated doc and samples * fix samples * terraform * terraform * terraform * terraform * terraform --------- Co-authored-by: dvesperini Co-authored-by: knee-na <130502432+knee-na@users.noreply.github.com> Co-authored-by: Mark-Kulube --- .secrets.baseline | 34 +- examples/ibm-project/README.md | 213 ++++++-- examples/ibm-project/main.tf | 4 +- examples/ibm-project/variables.tf | 10 +- go.mod | 2 +- go.sum | 4 +- .../project/data_source_ibm_project.go | 17 + .../project/data_source_ibm_project_config.go | 242 +++++++-- .../data_source_ibm_project_config_test.go | 2 +- .../data_source_ibm_project_environment.go | 9 + ...ata_source_ibm_project_environment_test.go | 1 + .../project/data_source_ibm_project_test.go | 1 + ibm/service/project/resource_ibm_project.go | 207 +++++++- .../project/resource_ibm_project_config.go | 499 +++++++++++++++--- .../resource_ibm_project_environment.go | 20 +- website/docs/d/project.html.markdown | 7 +- website/docs/d/project_config.html.markdown | 11 +- .../docs/d/project_environment.html.markdown | 3 + website/docs/r/project.html.markdown | 6 +- website/docs/r/project_config.html.markdown | 14 +- .../docs/r/project_environment.html.markdown | 2 + 21 files changed, 1085 insertions(+), 223 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index cb30966a3b..13208250a4 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.mod|go.sum|.*.map|^.secrets.baseline$", "lines": null }, - "generated_at": "2023-12-14T01:01:48Z", + "generated_at": "2023-12-20T09:37:58Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -760,7 +760,7 @@ "hashed_secret": "731438016c5ab94431f61820f35e3ae5f8ad6004", "is_secret": false, "is_verified": false, - "line_number": 426, + "line_number": 428, "type": "Secret Keyword", "verified_result": null }, @@ -768,7 +768,7 @@ "hashed_secret": "12da2e35d6b50c902c014f1ab9e3032650368df7", "is_secret": false, "is_verified": false, - "line_number": 432, + "line_number": 434, "type": "Secret Keyword", "verified_result": null }, @@ -776,7 +776,7 @@ "hashed_secret": "813274ccae5b6b509379ab56982d862f7b5969b6", "is_secret": false, "is_verified": false, - "line_number": 1143, + "line_number": 1157, "type": "Base64 High Entropy String", "verified_result": null } @@ -2056,7 +2056,7 @@ "hashed_secret": "deab23f996709b4e3d14e5499d1cc2de677bfaa8", "is_secret": false, "is_verified": false, - "line_number": 1367, + "line_number": 1372, "type": "Secret Keyword", "verified_result": null }, @@ -2064,7 +2064,7 @@ "hashed_secret": "20a25bac21219ffff1904bde871ded4027eca2f8", "is_secret": false, "is_verified": false, - "line_number": 1957, + "line_number": 1962, "type": "Secret Keyword", "verified_result": null }, @@ -2072,7 +2072,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 1976, + "line_number": 1981, "type": "Secret Keyword", "verified_result": null }, @@ -2080,7 +2080,7 @@ "hashed_secret": "1f5e25be9b575e9f5d39c82dfd1d9f4d73f1975c", "is_secret": false, "is_verified": false, - "line_number": 2189, + "line_number": 2194, "type": "Secret Keyword", "verified_result": null } @@ -2900,7 +2900,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 335, + "line_number": 342, "type": "Secret Keyword", "verified_result": null }, @@ -2908,7 +2908,7 @@ "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", "is_secret": false, "is_verified": false, - "line_number": 663, + "line_number": 700, "type": "Secret Keyword", "verified_result": null } @@ -2928,7 +2928,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 120, + "line_number": 125, "type": "Secret Keyword", "verified_result": null }, @@ -2936,7 +2936,7 @@ "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", "is_secret": false, "is_verified": false, - "line_number": 298, + "line_number": 307, "type": "Secret Keyword", "verified_result": null } @@ -2946,7 +2946,7 @@ "hashed_secret": "347cd9c53ff77d41a7b22aa56c7b4efaf54658e3", "is_secret": false, "is_verified": false, - "line_number": 55, + "line_number": 56, "type": "Secret Keyword", "verified_result": null } @@ -2956,7 +2956,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 237, + "line_number": 236, "type": "Secret Keyword", "verified_result": null }, @@ -2964,7 +2964,7 @@ "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", "is_secret": false, "is_verified": false, - "line_number": 875, + "line_number": 1091, "type": "Secret Keyword", "verified_result": null } @@ -2992,7 +2992,7 @@ "hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd", "is_secret": false, "is_verified": false, - "line_number": 499, + "line_number": 509, "type": "Secret Keyword", "verified_result": null } @@ -5034,7 +5034,7 @@ } ] }, - "version": "0.13.1+ibm.51.dss", + "version": "0.13.1+ibm.61.dss", "word_list": { "file": null, "hash": null diff --git a/examples/ibm-project/README.md b/examples/ibm-project/README.md index 479c92419c..51bef0de0e 100644 --- a/examples/ibm-project/README.md +++ b/examples/ibm-project/README.md @@ -1,12 +1,16 @@ -# Example for ProjectV1 +# Examples for Projects API -This example illustrates how to use the ProjectV1 +These examples illustrate how to use the resources and data sources associated with Projects API. -The following types of resources are supported: +The following resources are supported: +* ibm_project_config +* ibm_project +* ibm_project_environment -* project_config -* project -* project_environment +The following data sources are supported: +* ibm_project_config +* ibm_project +* ibm_project_environment ## Usage @@ -20,61 +24,200 @@ $ terraform apply Run `terraform destroy` when you don't need these resources. +## Projects API resources -## ProjectV1 resources - -project_config resource: +### Resource: ibm_project_config ```hcl -resource "project_config" "project_config_instance" { - project_id = ibm_project.project_instance.project_id +resource "ibm_project_config" "project_config_instance" { + project_id = ibm_project.project_instance.id definition = var.project_config_definition } ``` -project resource: + +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | +| project_id | The unique project ID. | `string` | true | +| schematics | A schematics workspace associated to a project configuration, with scripts. | `` | false | +| definition | | `` | true | + +#### Outputs + +| Name | Description | +|------|-------------| +| version | The version of the configuration. | +| is_draft | The flag that indicates whether the version of the configuration is draft, or active. | +| needs_attention_state | The needs attention state of a configuration. | +| created_at | A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. | +| modified_at | A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. | +| last_saved_at | A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. | +| outputs | The outputs of a Schematics template property. | +| project | The project referenced by this resource. | +| state | The state of the configuration. | +| update_available | The flag that indicates whether a configuration update is available. | +| href | A URL. | +| project_config_id | The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. | + +### Resource: ibm_project ```hcl -resource "project" "project_instance" { +resource "ibm_project" "project_instance" { location = var.project_location resource_group = var.project_resource_group definition = var.project_definition } ``` -project_environment resource: + +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | +| location | The IBM Cloud location where a resource is deployed. | `string` | true | +| resource_group | The resource group name where the project's data and tools are created. | `string` | true | +| definition | The definition of the project. | `` | true | + +#### Outputs + +| Name | Description | +|------|-------------| +| crn | An IBM Cloud resource name, which uniquely identifies a resource. | +| created_at | A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. | +| cumulative_needs_attention_view | The cumulative list of needs attention items for a project. If the view is successfully retrieved, an array which could be empty is returned. | +| cumulative_needs_attention_view_error | True indicates that the fetch of the needs attention items failed. It only exists if there was an error while retrieving the cumulative needs attention view. | +| resource_group_id | The resource group id where the project's data and tools are created. | +| state | The project status value. | +| href | A URL. | +| event_notifications_crn | The CRN of the event notifications instance if one is connected to this project. | +| configs | The project configurations. These configurations are only included in the response of creating a project if a configs array is specified in the request payload. | +| environments | The project environments. These environments are only included in the response if project environments were created on the project. | + +### Resource: ibm_project_environment ```hcl -resource "project_environment" "project_environment_instance" { - project_id = ibm_project.project_instance.project_id +resource "ibm_project_environment" "project_environment_instance" { + project_id = ibm_project.project_instance.id definition = var.project_environment_definition } ``` -## ProjectV1 data sources +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | +| project_id | The unique project ID. | `string` | true | +| definition | The environment definition. | `` | true | -project_config data source: +#### Outputs + +| Name | Description | +|------|-------------| +| project | The project referenced by this resource. | +| created_at | A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. | +| target_account | The target account ID derived from the authentication block values. | +| modified_at | A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. | +| href | A URL. | +| project_environment_id | The environment id as a friendly name. | + +## Projects API data sources + +### Data source: ibm_project_config ```hcl -data "project_config" "project_config_instance" { +data "ibm_project_config" "project_config_instance" { project_id = ibm_project.project_instance.id project_config_id = ibm_project_config.project_config_instance.project_config_id } ``` -project data source: + +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| project_id | The unique project ID. | `string` | true | +| project_config_id | The unique config ID. | `string` | true | + +#### Outputs + +| Name | Description | +|------|-------------| +| version | The version of the configuration. | +| is_draft | The flag that indicates whether the version of the configuration is draft, or active. | +| needs_attention_state | The needs attention state of a configuration. | +| created_at | A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. | +| modified_at | A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. | +| last_saved_at | A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. | +| outputs | The outputs of a Schematics template property. | +| project | The project referenced by this resource. | +| schematics | A schematics workspace associated to a project configuration, with scripts. | +| state | The state of the configuration. | +| update_available | The flag that indicates whether a configuration update is available. | +| href | A URL. | +| definition | | + +### Data source: ibm_project ```hcl -data "project" "project_instance" { +data "ibm_project" "project_instance" { project_id = ibm_project.project_instance.id } ``` -project_environment data source: + +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| project_id | The unique project ID. | `string` | true | + +#### Outputs + +| Name | Description | +|------|-------------| +| crn | An IBM Cloud resource name, which uniquely identifies a resource. | +| created_at | A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. | +| cumulative_needs_attention_view | The cumulative list of needs attention items for a project. If the view is successfully retrieved, an array which could be empty is returned. | +| cumulative_needs_attention_view_error | True indicates that the fetch of the needs attention items failed. It only exists if there was an error while retrieving the cumulative needs attention view. | +| location | The IBM Cloud location where a resource is deployed. | +| resource_group_id | The resource group id where the project's data and tools are created. | +| state | The project status value. | +| href | A URL. | +| resource_group | The resource group name where the project's data and tools are created. | +| event_notifications_crn | The CRN of the event notifications instance if one is connected to this project. | +| configs | The project configurations. These configurations are only included in the response of creating a project if a configs array is specified in the request payload. | +| environments | The project environments. These environments are only included in the response if project environments were created on the project. | +| definition | The definition of the project. | + +### Data source: ibm_project_environment ```hcl -data "project_environment" "project_environment_instance" { +data "ibm_project_environment" "project_environment_instance" { project_id = ibm_project.project_instance.id project_environment_id = ibm_project_environment.project_environment_instance.project_environment_id } ``` +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| project_id | The unique project ID. | `string` | true | +| project_environment_id | The environment ID. | `string` | true | + +#### Outputs + +| Name | Description | +|------|-------------| +| project | The project referenced by this resource. | +| created_at | A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. | +| target_account | The target account ID derived from the authentication block values. | +| modified_at | A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. | +| href | A URL. | +| definition | The environment definition. | + ## Assumptions 1. TODO @@ -94,27 +237,3 @@ data "project_environment" "project_environment_instance" { | Name | Version | |------|---------| | ibm | 1.13.1 | - -## Inputs - -| Name | Description | Type | Required | -|------|-------------|------|---------| -| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | -| project_id | The unique project ID. | `string` | true | -| schematics | A schematics workspace associated to a project configuration, with scripts. | `` | false | -| definition | The name and description of a project configuration. | `` | true | -| location | The IBM Cloud location where a resource is deployed. | `string` | true | -| resource_group | The resource group name where the project's data and tools are created. | `string` | true | -| definition | The definition of the project. | `` | true | -| definition | The environment definition. | `` | true | -| project_id | The unique project ID. | `string` | true | -| project_config_id | The unique config ID. | `string` | true | -| project_environment_id | The environment ID. | `string` | true | - -## Outputs - -| Name | Description | -|------|-------------| -| project_config | project_config object | -| project | project object | -| project_environment | project_environment object | diff --git a/examples/ibm-project/main.tf b/examples/ibm-project/main.tf index f07c03de9e..99f42bbc15 100644 --- a/examples/ibm-project/main.tf +++ b/examples/ibm-project/main.tf @@ -14,7 +14,7 @@ resource "ibm_project_config" "project_config_instance" { } locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.145be7c1-9ec4-4719-b586-584ee52fbed0-global" inputs = { - name = "app_repo_name" + app_repo_name = "static-website-repo" } } } @@ -45,7 +45,7 @@ resource "ibm_project_environment" "project_environment_instance" { // Create project_config data source data "ibm_project_config" "project_config_instance" { - project_id = ibm_project_config.project_config_instance.project_id + project_id = ibm_project.project_instance.id project_config_id = ibm_project_config.project_config_instance.project_config_id } diff --git a/examples/ibm-project/variables.tf b/examples/ibm-project/variables.tf index 82c28185f4..6ddd1b127b 100644 --- a/examples/ibm-project/variables.tf +++ b/examples/ibm-project/variables.tf @@ -30,31 +30,31 @@ variable "project_environment_project_id" { } // Data source arguments for project_config -variable "project_config_project_id" { +variable "data_project_config_project_id" { description = "The unique project ID." type = string default = "project_id" } -variable "project_config_id" { +variable "data_project_config_project_config_id" { description = "The unique config ID." type = string default = "project_config_id" } // Data source arguments for project -variable "project_id" { +variable "data_project_project_id" { description = "The unique project ID." type = string default = "project_id" } // Data source arguments for project_environment -variable "project_environment_project_id" { +variable "data_project_environment_project_id" { description = "The unique project ID." type = string default = "project_id" } -variable "project_environment_id" { +variable "data_project_environment_project_environment_id" { description = "The environment ID." type = string default = "project_environment_id" diff --git a/go.mod b/go.mod index 511405cb97..9b8b6a6517 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/IBM/keyprotect-go-client v0.12.2 github.com/IBM/networking-go-sdk v0.42.2 github.com/IBM/platform-services-go-sdk v0.55.0 - github.com/IBM/project-go-sdk v0.1.4 + github.com/IBM/project-go-sdk v0.1.6 github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 github.com/IBM/scc-go-sdk/v5 v5.1.3 github.com/IBM/schematics-go-sdk v0.2.2 diff --git a/go.sum b/go.sum index e472724d60..7640e1266d 100644 --- a/go.sum +++ b/go.sum @@ -160,8 +160,8 @@ github.com/IBM/networking-go-sdk v0.42.2 h1:caqjx4jyFHi10Vlf3skHvlL6K3YJRVstsmCB github.com/IBM/networking-go-sdk v0.42.2/go.mod h1:lTUZwtUkMANMnrLHFIgRhHrkBfwASY/Iho1fabaPHxo= github.com/IBM/platform-services-go-sdk v0.55.0 h1:W598xZanL61bwd8O2DQexr4qjIr+/tP0Y845zoms5yA= github.com/IBM/platform-services-go-sdk v0.55.0/go.mod h1:CWSprvsCsXWvujmBzbtoJSmbRZS9FVV3O594b0t/GiM= -github.com/IBM/project-go-sdk v0.1.4 h1:QGehJxpp/QqfrBYSmN2FRYwuGejlHlVscB/9QGQfdLk= -github.com/IBM/project-go-sdk v0.1.4/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig= +github.com/IBM/project-go-sdk v0.1.6 h1:sGrR0ej5wgBDhR2Xvf8Tgi5NmgMAJ77yep/CPGhvOx8= +github.com/IBM/project-go-sdk v0.1.6/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig= github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 h1:NPUhkoOCRuv3OFWt19PmwjXGGTKlvmbuPg9fUrBUNe4= github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5/go.mod h1:b07XHUVh0XYnQE9s2mqgjYST1h9buaQNqN4EcKhOsX0= github.com/IBM/sarama v1.41.2 h1:ZDBZfGPHAD4uuAtSv4U22fRZBgst0eEwGFzLj0fb85c= diff --git a/ibm/service/project/data_source_ibm_project.go b/ibm/service/project/data_source_ibm_project.go index 1ba775f958..2f662c1745 100644 --- a/ibm/service/project/data_source_ibm_project.go +++ b/ibm/service/project/data_source_ibm_project.go @@ -85,6 +85,11 @@ func DataSourceIbmProject() *schema.Resource { Computed: true, Description: "The project status value.", }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A URL.", + }, "resource_group": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -188,6 +193,11 @@ func DataSourceIbmProject() *schema.Resource { }, }, }, + "deployment_model": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The configuration type.", + }, }, }, }, @@ -356,6 +366,10 @@ func dataSourceIbmProjectRead(context context.Context, d *schema.ResourceData, m return diag.FromErr(fmt.Errorf("Error setting state: %s", err)) } + if err = d.Set("href", project.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + if err = d.Set("resource_group", project.ResourceGroup); err != nil { return diag.FromErr(fmt.Errorf("Error setting resource_group: %s", err)) } @@ -456,6 +470,9 @@ func dataSourceIbmProjectProjectConfigSummaryToMap(model *projectv1.ProjectConfi return modelMap, err } modelMap["project"] = []map[string]interface{}{projectMap} + if model.DeploymentModel != nil { + modelMap["deployment_model"] = model.DeploymentModel + } return modelMap, nil } diff --git a/ibm/service/project/data_source_ibm_project_config.go b/ibm/service/project/data_source_ibm_project_config.go index 8fadc48a9f..b9b7dc91b1 100644 --- a/ibm/service/project/data_source_ibm_project_config.go +++ b/ibm/service/project/data_source_ibm_project_config.go @@ -82,9 +82,12 @@ func DataSourceIbmProjectConfig() *schema.Resource { Description: "A short explanation of the output value.", }, "value": &schema.Schema{ - Type: schema.TypeString, + Type: schema.TypeMap, Computed: true, Description: "Can be any value - a string, number, boolean, array, or object.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, }, }, @@ -295,10 +298,14 @@ func DataSourceIbmProjectConfig() *schema.Resource { Computed: true, Description: "The flag that indicates whether a configuration update is available.", }, - "definition": &schema.Schema{ - Type: schema.TypeList, + "href": &schema.Schema{ + Type: schema.TypeString, Computed: true, - Description: "The name and description of a project configuration.", + Description: "A URL.", + }, + "definition": &schema.Schema{ + Type: schema.TypeList, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ @@ -341,6 +348,22 @@ func DataSourceIbmProjectConfig() *schema.Resource { }, }, }, + "inputs": &schema.Schema{ + Type: schema.TypeMap, + Computed: true, + Description: "The input variables for configuration definition and environment.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "settings": &schema.Schema{ + Type: schema.TypeMap, + Computed: true, + Description: "Schematics environment variables to use to deploy the configuration. Settings are only available if they were specified when the configuration was initially created.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, "compliance_profile": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -380,18 +403,10 @@ func DataSourceIbmProjectConfig() *schema.Resource { Computed: true, Description: "A unique concatenation of catalogID.versionID that identifies the DA in the catalog. Either schematics.workspace_crn, definition.locator_id, or both must be specified.", }, - "inputs": &schema.Schema{ - Type: schema.TypeMap, - Computed: true, - Description: "The input variables for configuration definition and environment.", - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "settings": &schema.Schema{ - Type: schema.TypeMap, + "resource_crns": &schema.Schema{ + Type: schema.TypeList, Computed: true, - Description: "Schematics environment variables to use to deploy the configuration. Settings are only available if they were specified when the configuration was initially created.", + Description: "The CRNs of resources associated with this configuration.", Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -430,10 +445,6 @@ func dataSourceIbmProjectConfigRead(context context.Context, d *schema.ResourceD return diag.FromErr(fmt.Errorf("Error setting is_draft: %s", err)) } - if err = d.Set("needs_attention_state", projectConfig.NeedsAttentionState); err != nil { - return diag.FromErr(fmt.Errorf("Error setting needs_attention_state: %s", err)) - } - if err = d.Set("created_at", flex.DateTimeToString(projectConfig.CreatedAt)); err != nil { return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) } @@ -492,6 +503,10 @@ func dataSourceIbmProjectConfigRead(context context.Context, d *schema.ResourceD return diag.FromErr(fmt.Errorf("Error setting update_available: %s", err)) } + if err = d.Set("href", projectConfig.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + definition := []map[string]interface{}{} if projectConfig.Definition != nil { modelMap, err := dataSourceIbmProjectConfigProjectConfigResponseDefinitionToMap(projectConfig.Definition) @@ -514,7 +529,15 @@ func dataSourceIbmProjectConfigOutputValueToMap(model *projectv1.OutputValue) (m modelMap["description"] = model.Description } if model.Value != nil { - modelMap["value"] = model.Value + value := make(map[string]interface{}) + for k, v := range model.Value { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + value[k] = string(bytes) + } + modelMap["value"] = value } return modelMap, nil } @@ -602,9 +625,108 @@ func dataSourceIbmProjectConfigScriptToMap(model *projectv1.Script) (map[string] return modelMap, nil } -func dataSourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *projectv1.ProjectConfigResponseDefinition) (map[string]interface{}, error) { +func dataSourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model projectv1.ProjectConfigResponseDefinitionIntf) (map[string]interface{}, error) { + if _, ok := model.(*projectv1.ProjectConfigResponseDefinitionDAConfigDefinitionProperties); ok { + return dataSourceIbmProjectConfigProjectConfigResponseDefinitionDAConfigDefinitionPropertiesToMap(model.(*projectv1.ProjectConfigResponseDefinitionDAConfigDefinitionProperties)) + } else if _, ok := model.(*projectv1.ProjectConfigResponseDefinitionResourceConfigDefinitionProperties); ok { + return dataSourceIbmProjectConfigProjectConfigResponseDefinitionResourceConfigDefinitionPropertiesToMap(model.(*projectv1.ProjectConfigResponseDefinitionResourceConfigDefinitionProperties)) + } else if _, ok := model.(*projectv1.ProjectConfigResponseDefinition); ok { + modelMap := make(map[string]interface{}) + model := model.(*projectv1.ProjectConfigResponseDefinition) + modelMap["name"] = model.Name + if model.Description != nil { + modelMap["description"] = model.Description + } + if model.EnvironmentID != nil { + modelMap["environment_id"] = model.EnvironmentID + } + if model.Authorizations != nil { + authorizationsMap, err := dataSourceIbmProjectConfigProjectConfigAuthToMap(model.Authorizations) + if err != nil { + return modelMap, err + } + modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} + } + if model.Inputs != nil { + inputs := make(map[string]interface{}) + for k, v := range model.Inputs { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + inputs[k] = string(bytes) + } + modelMap["inputs"] = inputs + } + if model.Settings != nil { + settings := make(map[string]interface{}) + for k, v := range model.Settings { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + settings[k] = string(bytes) + } + modelMap["settings"] = settings + } + if model.ComplianceProfile != nil { + complianceProfileMap, err := dataSourceIbmProjectConfigProjectComplianceProfileToMap(model.ComplianceProfile) + if err != nil { + return modelMap, err + } + modelMap["compliance_profile"] = []map[string]interface{}{complianceProfileMap} + } + if model.LocatorID != nil { + modelMap["locator_id"] = model.LocatorID + } + if model.ResourceCrns != nil { + modelMap["resource_crns"] = model.ResourceCrns + } + return modelMap, nil + } else { + return nil, fmt.Errorf("Unrecognized projectv1.ProjectConfigResponseDefinitionIntf subtype encountered") + } +} + +func dataSourceIbmProjectConfigProjectConfigAuthToMap(model *projectv1.ProjectConfigAuth) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.TrustedProfileID != nil { + modelMap["trusted_profile_id"] = model.TrustedProfileID + } + if model.Method != nil { + modelMap["method"] = model.Method + } + if model.ApiKey != nil { + modelMap["api_key"] = model.ApiKey + } + return modelMap, nil +} + +func dataSourceIbmProjectConfigProjectComplianceProfileToMap(model *projectv1.ProjectComplianceProfile) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) - modelMap["name"] = model.Name + if model.ID != nil { + modelMap["id"] = model.ID + } + if model.InstanceID != nil { + modelMap["instance_id"] = model.InstanceID + } + if model.InstanceLocation != nil { + modelMap["instance_location"] = model.InstanceLocation + } + if model.AttachmentID != nil { + modelMap["attachment_id"] = model.AttachmentID + } + if model.ProfileName != nil { + modelMap["profile_name"] = model.ProfileName + } + return modelMap, nil +} + +func dataSourceIbmProjectConfigProjectConfigResponseDefinitionDAConfigDefinitionPropertiesToMap(model *projectv1.ProjectConfigResponseDefinitionDAConfigDefinitionProperties) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Name != nil { + modelMap["name"] = model.Name + } if model.Description != nil { modelMap["description"] = model.Description } @@ -618,14 +740,6 @@ func dataSourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *proje } modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} } - if model.ComplianceProfile != nil { - complianceProfileMap, err := dataSourceIbmProjectConfigProjectComplianceProfileToMap(model.ComplianceProfile) - if err != nil { - return modelMap, err - } - modelMap["compliance_profile"] = []map[string]interface{}{complianceProfileMap} - } - modelMap["locator_id"] = model.LocatorID if model.Inputs != nil { inputs := make(map[string]interface{}) for k, v := range model.Inputs { @@ -648,39 +762,61 @@ func dataSourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *proje } modelMap["settings"] = settings } - return modelMap, nil -} - -func dataSourceIbmProjectConfigProjectConfigAuthToMap(model *projectv1.ProjectConfigAuth) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - if model.TrustedProfileID != nil { - modelMap["trusted_profile_id"] = model.TrustedProfileID - } - if model.Method != nil { - modelMap["method"] = model.Method + if model.ComplianceProfile != nil { + complianceProfileMap, err := dataSourceIbmProjectConfigProjectComplianceProfileToMap(model.ComplianceProfile) + if err != nil { + return modelMap, err + } + modelMap["compliance_profile"] = []map[string]interface{}{complianceProfileMap} } - if model.ApiKey != nil { - modelMap["api_key"] = model.ApiKey + if model.LocatorID != nil { + modelMap["locator_id"] = model.LocatorID } return modelMap, nil } -func dataSourceIbmProjectConfigProjectComplianceProfileToMap(model *projectv1.ProjectComplianceProfile) (map[string]interface{}, error) { +func dataSourceIbmProjectConfigProjectConfigResponseDefinitionResourceConfigDefinitionPropertiesToMap(model *projectv1.ProjectConfigResponseDefinitionResourceConfigDefinitionProperties) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) - if model.ID != nil { - modelMap["id"] = model.ID + if model.Name != nil { + modelMap["name"] = model.Name } - if model.InstanceID != nil { - modelMap["instance_id"] = model.InstanceID + if model.Description != nil { + modelMap["description"] = model.Description } - if model.InstanceLocation != nil { - modelMap["instance_location"] = model.InstanceLocation + if model.EnvironmentID != nil { + modelMap["environment_id"] = model.EnvironmentID } - if model.AttachmentID != nil { - modelMap["attachment_id"] = model.AttachmentID + if model.Authorizations != nil { + authorizationsMap, err := dataSourceIbmProjectConfigProjectConfigAuthToMap(model.Authorizations) + if err != nil { + return modelMap, err + } + modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} } - if model.ProfileName != nil { - modelMap["profile_name"] = model.ProfileName + if model.Inputs != nil { + inputs := make(map[string]interface{}) + for k, v := range model.Inputs { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + inputs[k] = string(bytes) + } + modelMap["inputs"] = inputs + } + if model.Settings != nil { + settings := make(map[string]interface{}) + for k, v := range model.Settings { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + settings[k] = string(bytes) + } + modelMap["settings"] = settings + } + if model.ResourceCrns != nil { + modelMap["resource_crns"] = model.ResourceCrns } return modelMap, nil } diff --git a/ibm/service/project/data_source_ibm_project_config_test.go b/ibm/service/project/data_source_ibm_project_config_test.go index e009ba0704..0b78bca324 100644 --- a/ibm/service/project/data_source_ibm_project_config_test.go +++ b/ibm/service/project/data_source_ibm_project_config_test.go @@ -29,7 +29,7 @@ func TestAccIbmProjectConfigDataSourceBasic(t *testing.T) { resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "modified_at"), resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "project.#"), resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "state"), - resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "update_available"), + resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "href"), resource.TestCheckResourceAttrSet("data.ibm_project_config.project_config_instance", "definition.#"), ), }, diff --git a/ibm/service/project/data_source_ibm_project_environment.go b/ibm/service/project/data_source_ibm_project_environment.go index dc095eea94..4e052b847b 100644 --- a/ibm/service/project/data_source_ibm_project_environment.go +++ b/ibm/service/project/data_source_ibm_project_environment.go @@ -85,6 +85,11 @@ func DataSourceIbmProjectEnvironment() *schema.Resource { Computed: true, Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A URL.", + }, "definition": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -218,6 +223,10 @@ func dataSourceIbmProjectEnvironmentRead(context context.Context, d *schema.Reso return diag.FromErr(fmt.Errorf("Error setting modified_at: %s", err)) } + if err = d.Set("href", environment.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + definition := []map[string]interface{}{} if environment.Definition != nil { modelMap, err := dataSourceIbmProjectEnvironmentEnvironmentDefinitionRequiredPropertiesToMap(environment.Definition) diff --git a/ibm/service/project/data_source_ibm_project_environment_test.go b/ibm/service/project/data_source_ibm_project_environment_test.go index 7edd07a90e..2f2d111aba 100644 --- a/ibm/service/project/data_source_ibm_project_environment_test.go +++ b/ibm/service/project/data_source_ibm_project_environment_test.go @@ -26,6 +26,7 @@ func TestAccIbmProjectEnvironmentDataSourceBasic(t *testing.T) { resource.TestCheckResourceAttrSet("data.ibm_project_environment.project_environment_instance", "project.#"), resource.TestCheckResourceAttrSet("data.ibm_project_environment.project_environment_instance", "created_at"), resource.TestCheckResourceAttrSet("data.ibm_project_environment.project_environment_instance", "modified_at"), + resource.TestCheckResourceAttrSet("data.ibm_project_environment.project_environment_instance", "href"), resource.TestCheckResourceAttrSet("data.ibm_project_environment.project_environment_instance", "definition.#"), ), }, diff --git a/ibm/service/project/data_source_ibm_project_test.go b/ibm/service/project/data_source_ibm_project_test.go index e8e3ade5c8..6ac9472a3c 100644 --- a/ibm/service/project/data_source_ibm_project_test.go +++ b/ibm/service/project/data_source_ibm_project_test.go @@ -30,6 +30,7 @@ func TestAccIbmProjectDataSourceBasic(t *testing.T) { resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "location"), resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "resource_group_id"), resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "state"), + resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "href"), resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "resource_group"), resource.TestCheckResourceAttrSet("data.ibm_project.project_instance", "definition.#"), ), diff --git a/ibm/service/project/resource_ibm_project.go b/ibm/service/project/resource_ibm_project.go index 4e51734983..d428f33c91 100644 --- a/ibm/service/project/resource_ibm_project.go +++ b/ibm/service/project/resource_ibm_project.go @@ -121,6 +121,11 @@ func ResourceIbmProject() *schema.Resource { Computed: true, Description: "The project status value.", }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A URL.", + }, "event_notifications_crn": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -219,6 +224,11 @@ func ResourceIbmProject() *schema.Resource { }, }, }, + "deployment_model": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The configuration type.", + }, }, }, }, @@ -349,6 +359,30 @@ func resourceIbmProjectCreate(context context.Context, d *schema.ResourceData, m createProjectOptions.SetDefinition(definitionModel) createProjectOptions.SetLocation(d.Get("location").(string)) createProjectOptions.SetResourceGroup(d.Get("resource_group").(string)) + if _, ok := d.GetOk("configs"); ok { + var configs []projectv1.ProjectConfigPrototype + for _, v := range d.Get("configs").([]interface{}) { + value := v.(map[string]interface{}) + configsItem, err := resourceIbmProjectMapToProjectConfigPrototype(value) + if err != nil { + return diag.FromErr(err) + } + configs = append(configs, *configsItem) + } + createProjectOptions.SetConfigs(configs) + } + if _, ok := d.GetOk("environments"); ok { + var environments []projectv1.EnvironmentPrototype + for _, v := range d.Get("environments").([]interface{}) { + value := v.(map[string]interface{}) + environmentsItem, err := resourceIbmProjectMapToEnvironmentPrototype(value) + if err != nil { + return diag.FromErr(err) + } + environments = append(environments, *environmentsItem) + } + createProjectOptions.SetEnvironments(environments) + } project, response, err := projectClient.CreateProjectWithContext(context, createProjectOptions) if err != nil { @@ -424,6 +458,9 @@ func resourceIbmProjectRead(context context.Context, d *schema.ResourceData, met if err = d.Set("state", project.State); err != nil { return diag.FromErr(fmt.Errorf("Error setting state: %s", err)) } + if err = d.Set("href", project.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } if !core.IsNil(project.EventNotificationsCrn) { if err = d.Set("event_notifications_crn", project.EventNotificationsCrn); err != nil { return diag.FromErr(fmt.Errorf("Error setting event_notifications_crn: %s", err)) @@ -541,7 +578,7 @@ func resourceIbmProjectMapToProjectConfigPrototype(modelMap map[string]interface return model, nil } -func resourceIbmProjectMapToProjectConfigPrototypeDefinitionBlock(modelMap map[string]interface{}) (*projectv1.ProjectConfigPrototypeDefinitionBlock, error) { +func resourceIbmProjectMapToProjectConfigPrototypeDefinitionBlock(modelMap map[string]interface{}) (projectv1.ProjectConfigPrototypeDefinitionBlockIntf, error) { model := &projectv1.ProjectConfigPrototypeDefinitionBlock{} model.Name = core.StringPtr(modelMap["name"].(string)) if modelMap["description"] != nil && modelMap["description"].(string) != "" { @@ -557,6 +594,22 @@ func resourceIbmProjectMapToProjectConfigPrototypeDefinitionBlock(modelMap map[s } model.Authorizations = AuthorizationsModel } + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Inputs = newMap + } + } + if modelMap["settings"] != nil { + bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Settings = newMap + } + } if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { ComplianceProfileModel, err := resourceIbmProjectMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) if err != nil { @@ -567,17 +620,12 @@ func resourceIbmProjectMapToProjectConfigPrototypeDefinitionBlock(modelMap map[s if modelMap["locator_id"] != nil && modelMap["locator_id"].(string) != "" { model.LocatorID = core.StringPtr(modelMap["locator_id"].(string)) } - if modelMap["inputs"] != nil { - bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) - newMap := make(map[string]interface{}) - json.Unmarshal(bytes, &newMap) - model.Inputs = newMap - } - if modelMap["settings"] != nil { - bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) - newMap := make(map[string]interface{}) - json.Unmarshal(bytes, &newMap) - model.Settings = newMap + if modelMap["resource_crns"] != nil && len(modelMap["resource_crns"].([]interface{})) > 0 { + resourceCrns := []string{} + for _, resourceCrnsItem := range modelMap["resource_crns"].([]interface{}) { + resourceCrns = append(resourceCrns, resourceCrnsItem.(string)) + } + model.ResourceCrns = resourceCrns } return model, nil } @@ -616,6 +664,97 @@ func resourceIbmProjectMapToProjectComplianceProfile(modelMap map[string]interfa return model, nil } +func resourceIbmProjectMapToProjectConfigPrototypeDefinitionBlockDAConfigDefinitionProperties(modelMap map[string]interface{}) (*projectv1.ProjectConfigPrototypeDefinitionBlockDAConfigDefinitionProperties, error) { + model := &projectv1.ProjectConfigPrototypeDefinitionBlockDAConfigDefinitionProperties{} + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["environment_id"] != nil && modelMap["environment_id"].(string) != "" { + model.EnvironmentID = core.StringPtr(modelMap["environment_id"].(string)) + } + if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { + AuthorizationsModel, err := resourceIbmProjectMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Authorizations = AuthorizationsModel + } + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Inputs = newMap + } + } + if modelMap["settings"] != nil { + bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Settings = newMap + } + } + if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { + ComplianceProfileModel, err := resourceIbmProjectMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.ComplianceProfile = ComplianceProfileModel + } + if modelMap["locator_id"] != nil && modelMap["locator_id"].(string) != "" { + model.LocatorID = core.StringPtr(modelMap["locator_id"].(string)) + } + return model, nil +} + +func resourceIbmProjectMapToProjectConfigPrototypeDefinitionBlockResourceConfigDefinitionProperties(modelMap map[string]interface{}) (*projectv1.ProjectConfigPrototypeDefinitionBlockResourceConfigDefinitionProperties, error) { + model := &projectv1.ProjectConfigPrototypeDefinitionBlockResourceConfigDefinitionProperties{} + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["environment_id"] != nil && modelMap["environment_id"].(string) != "" { + model.EnvironmentID = core.StringPtr(modelMap["environment_id"].(string)) + } + if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { + AuthorizationsModel, err := resourceIbmProjectMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Authorizations = AuthorizationsModel + } + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Inputs = newMap + } + } + if modelMap["settings"] != nil { + bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Settings = newMap + } + } + if modelMap["resource_crns"] != nil && len(modelMap["resource_crns"].([]interface{})) > 0 { + resourceCrns := []string{} + for _, resourceCrnsItem := range modelMap["resource_crns"].([]interface{}) { + resourceCrns = append(resourceCrns, resourceCrnsItem.(string)) + } + model.ResourceCrns = resourceCrns + } + return model, nil +} + func resourceIbmProjectMapToSchematicsWorkspace(modelMap map[string]interface{}) (*projectv1.SchematicsWorkspace, error) { model := &projectv1.SchematicsWorkspace{} if modelMap["workspace_crn"] != nil && modelMap["workspace_crn"].(string) != "" { @@ -624,6 +763,47 @@ func resourceIbmProjectMapToSchematicsWorkspace(modelMap map[string]interface{}) return model, nil } +func resourceIbmProjectMapToEnvironmentPrototype(modelMap map[string]interface{}) (*projectv1.EnvironmentPrototype, error) { + model := &projectv1.EnvironmentPrototype{} + DefinitionModel, err := resourceIbmProjectMapToEnvironmentDefinitionRequiredProperties(modelMap["definition"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Definition = DefinitionModel + return model, nil +} + +func resourceIbmProjectMapToEnvironmentDefinitionRequiredProperties(modelMap map[string]interface{}) (*projectv1.EnvironmentDefinitionRequiredProperties, error) { + model := &projectv1.EnvironmentDefinitionRequiredProperties{} + model.Name = core.StringPtr(modelMap["name"].(string)) + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { + AuthorizationsModel, err := resourceIbmProjectMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Authorizations = AuthorizationsModel + } + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Inputs = newMap + } + } + if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { + ComplianceProfileModel, err := resourceIbmProjectMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.ComplianceProfile = ComplianceProfileModel + } + return model, nil +} + func resourceIbmProjectMapToProjectPatchDefinitionBlock(modelMap map[string]interface{}) (*projectv1.ProjectPatchDefinitionBlock, error) { model := &projectv1.ProjectPatchDefinitionBlock{} if modelMap["name"] != nil && modelMap["name"].(string) != "" { @@ -697,6 +877,9 @@ func resourceIbmProjectProjectConfigSummaryToMap(model *projectv1.ProjectConfigS return modelMap, err } modelMap["project"] = []map[string]interface{}{projectMap} + if model.DeploymentModel != nil { + modelMap["deployment_model"] = model.DeploymentModel + } return modelMap, nil } diff --git a/ibm/service/project/resource_ibm_project_config.go b/ibm/service/project/resource_ibm_project_config.go index 161c7a41f1..f0ef27eeef 100644 --- a/ibm/service/project/resource_ibm_project_config.go +++ b/ibm/service/project/resource_ibm_project_config.go @@ -195,11 +195,10 @@ func ResourceIbmProjectConfig() *schema.Resource { }, }, "definition": &schema.Schema{ - Type: schema.TypeList, - MinItems: 1, - MaxItems: 1, - Required: true, - Description: "The name and description of a project configuration.", + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ @@ -243,6 +242,18 @@ func ResourceIbmProjectConfig() *schema.Resource { }, }, }, + "inputs": &schema.Schema{ + Type: schema.TypeMap, + Optional: true, + Description: "The input variables for configuration definition and environment.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "settings": &schema.Schema{ + Type: schema.TypeMap, + Optional: true, + Description: "Schematics environment variables to use to deploy the configuration. Settings are only available if they were specified when the configuration was initially created.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, "compliance_profile": &schema.Schema{ Type: schema.TypeList, MaxItems: 1, @@ -280,20 +291,14 @@ func ResourceIbmProjectConfig() *schema.Resource { }, "locator_id": &schema.Schema{ Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, Description: "A unique concatenation of catalogID.versionID that identifies the DA in the catalog. Either schematics.workspace_crn, definition.locator_id, or both must be specified.", }, - "inputs": &schema.Schema{ - Type: schema.TypeMap, - Optional: true, - Description: "The input variables for configuration definition and environment.", - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "settings": &schema.Schema{ - Type: schema.TypeMap, + "resource_crns": &schema.Schema{ + Type: schema.TypeList, Optional: true, - Description: "Schematics environment variables to use to deploy the configuration. Settings are only available if they were specified when the configuration was initially created.", + Description: "The CRNs of resources associated with this configuration.", Elem: &schema.Schema{Type: schema.TypeString}, }, }, @@ -313,7 +318,7 @@ func ResourceIbmProjectConfig() *schema.Resource { Type: schema.TypeList, Computed: true, Description: "The needs attention state of a configuration.", - Elem: &schema.Schema{Type: schema.TypeString}, + Elem: &schema.Schema{Type: schema.TypeMap, Elem: &schema.Schema{Type: schema.TypeString}}, }, "created_at": &schema.Schema{ Type: schema.TypeString, @@ -347,9 +352,10 @@ func ResourceIbmProjectConfig() *schema.Resource { Description: "A short explanation of the output value.", }, "value": &schema.Schema{ - Type: schema.TypeString, + Type: schema.TypeMap, Computed: true, Description: "Can be any value - a string, number, boolean, array, or object.", + Elem: &schema.Schema{Type: schema.TypeString}, }, }, }, @@ -402,6 +408,11 @@ func ResourceIbmProjectConfig() *schema.Resource { Computed: true, Description: "The flag that indicates whether a configuration update is available.", }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A URL.", + }, "project_config_id": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -543,8 +554,13 @@ func resourceIbmProjectConfigRead(context context.Context, d *schema.ResourceDat if err = d.Set("state", projectConfig.State); err != nil { return diag.FromErr(fmt.Errorf("Error setting state: %s", err)) } - if err = d.Set("update_available", projectConfig.UpdateAvailable); err != nil { - return diag.FromErr(fmt.Errorf("Error setting update_available: %s", err)) + if !core.IsNil(projectConfig.UpdateAvailable) { + if err = d.Set("update_available", projectConfig.UpdateAvailable); err != nil { + return diag.FromErr(fmt.Errorf("Error setting update_available: %s", err)) + } + } + if err = d.Set("href", projectConfig.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) } if err = d.Set("project_config_id", projectConfig.ID); err != nil { return diag.FromErr(fmt.Errorf("Error setting project_config_id: %s", err)) @@ -571,6 +587,10 @@ func resourceIbmProjectConfigUpdate(context context.Context, d *schema.ResourceD hasChange := false + if d.HasChange("project_id") { + return diag.FromErr(fmt.Errorf("Cannot update resource property \"%s\" with the ForceNew annotation."+ + " The resource must be re-created to update this property.", "project_id")) + } if d.HasChange("definition") { definition, err := resourceIbmProjectConfigMapToProjectConfigPatchDefinitionBlock(d.Get("definition.0").(map[string]interface{})) if err != nil { @@ -618,7 +638,7 @@ func resourceIbmProjectConfigDelete(context context.Context, d *schema.ResourceD return nil } -func resourceIbmProjectConfigMapToProjectConfigPrototypeDefinitionBlock(modelMap map[string]interface{}) (*projectv1.ProjectConfigPrototypeDefinitionBlock, error) { +func resourceIbmProjectConfigMapToProjectConfigPrototypeDefinitionBlock(modelMap map[string]interface{}) (projectv1.ProjectConfigPrototypeDefinitionBlockIntf, error) { model := &projectv1.ProjectConfigPrototypeDefinitionBlock{} model.Name = core.StringPtr(modelMap["name"].(string)) if modelMap["description"] != nil && modelMap["description"].(string) != "" { @@ -634,6 +654,22 @@ func resourceIbmProjectConfigMapToProjectConfigPrototypeDefinitionBlock(modelMap } model.Authorizations = AuthorizationsModel } + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Inputs = newMap + } + } + if modelMap["settings"] != nil { + bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Settings = newMap + } + } if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { ComplianceProfileModel, err := resourceIbmProjectConfigMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) if err != nil { @@ -644,17 +680,12 @@ func resourceIbmProjectConfigMapToProjectConfigPrototypeDefinitionBlock(modelMap if modelMap["locator_id"] != nil && modelMap["locator_id"].(string) != "" { model.LocatorID = core.StringPtr(modelMap["locator_id"].(string)) } - if modelMap["inputs"] != nil { - bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) - newMap := make(map[string]interface{}) - json.Unmarshal(bytes, &newMap) - model.Inputs = newMap - } - if modelMap["settings"] != nil { - bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) - newMap := make(map[string]interface{}) - json.Unmarshal(bytes, &newMap) - model.Settings = newMap + if modelMap["resource_crns"] != nil && len(modelMap["resource_crns"].([]interface{})) > 0 { + resourceCrns := []string{} + for _, resourceCrnsItem := range modelMap["resource_crns"].([]interface{}) { + resourceCrns = append(resourceCrns, resourceCrnsItem.(string)) + } + model.ResourceCrns = resourceCrns } return model, nil } @@ -693,6 +724,97 @@ func resourceIbmProjectConfigMapToProjectComplianceProfile(modelMap map[string]i return model, nil } +func resourceIbmProjectConfigMapToProjectConfigPrototypeDefinitionBlockDAConfigDefinitionProperties(modelMap map[string]interface{}) (*projectv1.ProjectConfigPrototypeDefinitionBlockDAConfigDefinitionProperties, error) { + model := &projectv1.ProjectConfigPrototypeDefinitionBlockDAConfigDefinitionProperties{} + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["environment_id"] != nil && modelMap["environment_id"].(string) != "" { + model.EnvironmentID = core.StringPtr(modelMap["environment_id"].(string)) + } + if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { + AuthorizationsModel, err := resourceIbmProjectConfigMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Authorizations = AuthorizationsModel + } + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Inputs = newMap + } + } + if modelMap["settings"] != nil { + bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Settings = newMap + } + } + if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { + ComplianceProfileModel, err := resourceIbmProjectConfigMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.ComplianceProfile = ComplianceProfileModel + } + if modelMap["locator_id"] != nil && modelMap["locator_id"].(string) != "" { + model.LocatorID = core.StringPtr(modelMap["locator_id"].(string)) + } + return model, nil +} + +func resourceIbmProjectConfigMapToProjectConfigPrototypeDefinitionBlockResourceConfigDefinitionProperties(modelMap map[string]interface{}) (*projectv1.ProjectConfigPrototypeDefinitionBlockResourceConfigDefinitionProperties, error) { + model := &projectv1.ProjectConfigPrototypeDefinitionBlockResourceConfigDefinitionProperties{} + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["environment_id"] != nil && modelMap["environment_id"].(string) != "" { + model.EnvironmentID = core.StringPtr(modelMap["environment_id"].(string)) + } + if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { + AuthorizationsModel, err := resourceIbmProjectConfigMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Authorizations = AuthorizationsModel + } + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Inputs = newMap + } + } + if modelMap["settings"] != nil { + bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Settings = newMap + } + } + if modelMap["resource_crns"] != nil && len(modelMap["resource_crns"].([]interface{})) > 0 { + resourceCrns := []string{} + for _, resourceCrnsItem := range modelMap["resource_crns"].([]interface{}) { + resourceCrns = append(resourceCrns, resourceCrnsItem.(string)) + } + model.ResourceCrns = resourceCrns + } + return model, nil +} + func resourceIbmProjectConfigMapToSchematicsWorkspace(modelMap map[string]interface{}) (*projectv1.SchematicsWorkspace, error) { model := &projectv1.SchematicsWorkspace{} if modelMap["workspace_crn"] != nil && modelMap["workspace_crn"].(string) != "" { @@ -701,7 +823,7 @@ func resourceIbmProjectConfigMapToSchematicsWorkspace(modelMap map[string]interf return model, nil } -func resourceIbmProjectConfigMapToProjectConfigPatchDefinitionBlock(modelMap map[string]interface{}) (*projectv1.ProjectConfigPatchDefinitionBlock, error) { +func resourceIbmProjectConfigMapToProjectConfigPatchDefinitionBlock(modelMap map[string]interface{}) (projectv1.ProjectConfigPatchDefinitionBlockIntf, error) { model := &projectv1.ProjectConfigPatchDefinitionBlock{} if modelMap["name"] != nil && modelMap["name"].(string) != "" { model.Name = core.StringPtr(modelMap["name"].(string)) @@ -719,6 +841,22 @@ func resourceIbmProjectConfigMapToProjectConfigPatchDefinitionBlock(modelMap map } model.Authorizations = AuthorizationsModel } + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Inputs = newMap + } + } + if modelMap["settings"] != nil { + bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Settings = newMap + } + } if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { ComplianceProfileModel, err := resourceIbmProjectConfigMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) if err != nil { @@ -729,17 +867,103 @@ func resourceIbmProjectConfigMapToProjectConfigPatchDefinitionBlock(modelMap map if modelMap["locator_id"] != nil && modelMap["locator_id"].(string) != "" { model.LocatorID = core.StringPtr(modelMap["locator_id"].(string)) } + if modelMap["resource_crns"] != nil && len(modelMap["resource_crns"].([]interface{})) > 0 { + resourceCrns := []string{} + for _, resourceCrnsItem := range modelMap["resource_crns"].([]interface{}) { + resourceCrns = append(resourceCrns, resourceCrnsItem.(string)) + } + model.ResourceCrns = resourceCrns + } + return model, nil +} + +func resourceIbmProjectConfigMapToProjectConfigPatchDefinitionBlockDAConfigDefinitionProperties(modelMap map[string]interface{}) (*projectv1.ProjectConfigPatchDefinitionBlockDAConfigDefinitionProperties, error) { + model := &projectv1.ProjectConfigPatchDefinitionBlockDAConfigDefinitionProperties{} + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["environment_id"] != nil && modelMap["environment_id"].(string) != "" { + model.EnvironmentID = core.StringPtr(modelMap["environment_id"].(string)) + } + if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { + AuthorizationsModel, err := resourceIbmProjectConfigMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Authorizations = AuthorizationsModel + } if modelMap["inputs"] != nil { bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) newMap := make(map[string]interface{}) json.Unmarshal(bytes, &newMap) - model.Inputs = newMap + if len(newMap) > 0 { + model.Inputs = newMap + } } if modelMap["settings"] != nil { bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) newMap := make(map[string]interface{}) json.Unmarshal(bytes, &newMap) - model.Settings = newMap + if len(newMap) > 0 { + model.Settings = newMap + } + } + if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { + ComplianceProfileModel, err := resourceIbmProjectConfigMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.ComplianceProfile = ComplianceProfileModel + } + if modelMap["locator_id"] != nil && modelMap["locator_id"].(string) != "" { + model.LocatorID = core.StringPtr(modelMap["locator_id"].(string)) + } + return model, nil +} + +func resourceIbmProjectConfigMapToProjectConfigPatchDefinitionBlockResourceConfigDefinitionProperties(modelMap map[string]interface{}) (*projectv1.ProjectConfigPatchDefinitionBlockResourceConfigDefinitionProperties, error) { + model := &projectv1.ProjectConfigPatchDefinitionBlockResourceConfigDefinitionProperties{} + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["description"] != nil && modelMap["description"].(string) != "" { + model.Description = core.StringPtr(modelMap["description"].(string)) + } + if modelMap["environment_id"] != nil && modelMap["environment_id"].(string) != "" { + model.EnvironmentID = core.StringPtr(modelMap["environment_id"].(string)) + } + if modelMap["authorizations"] != nil && len(modelMap["authorizations"].([]interface{})) > 0 { + AuthorizationsModel, err := resourceIbmProjectConfigMapToProjectConfigAuth(modelMap["authorizations"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.Authorizations = AuthorizationsModel + } + if modelMap["inputs"] != nil { + bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Inputs = newMap + } + } + if modelMap["settings"] != nil { + bytes, _ := json.Marshal(modelMap["settings"].(map[string]interface{})) + newMap := make(map[string]interface{}) + json.Unmarshal(bytes, &newMap) + if len(newMap) > 0 { + model.Settings = newMap + } + } + if modelMap["resource_crns"] != nil && len(modelMap["resource_crns"].([]interface{})) > 0 { + resourceCrns := []string{} + for _, resourceCrnsItem := range modelMap["resource_crns"].([]interface{}) { + resourceCrns = append(resourceCrns, resourceCrnsItem.(string)) + } + model.ResourceCrns = resourceCrns } return model, nil } @@ -808,9 +1032,116 @@ func resourceIbmProjectConfigScriptToMap(model *projectv1.Script) (map[string]in return modelMap, nil } -func resourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *projectv1.ProjectConfigResponseDefinition) (map[string]interface{}, error) { +func resourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model projectv1.ProjectConfigResponseDefinitionIntf) (map[string]interface{}, error) { + if _, ok := model.(*projectv1.ProjectConfigResponseDefinitionDAConfigDefinitionProperties); ok { + return resourceIbmProjectConfigProjectConfigResponseDefinitionDAConfigDefinitionPropertiesToMap(model.(*projectv1.ProjectConfigResponseDefinitionDAConfigDefinitionProperties)) + } else if _, ok := model.(*projectv1.ProjectConfigResponseDefinitionResourceConfigDefinitionProperties); ok { + return resourceIbmProjectConfigProjectConfigResponseDefinitionResourceConfigDefinitionPropertiesToMap(model.(*projectv1.ProjectConfigResponseDefinitionResourceConfigDefinitionProperties)) + } else if _, ok := model.(*projectv1.ProjectConfigResponseDefinition); ok { + modelMap := make(map[string]interface{}) + model := model.(*projectv1.ProjectConfigResponseDefinition) + modelMap["name"] = model.Name + if model.Description != nil { + modelMap["description"] = model.Description + } + if model.EnvironmentID != nil { + modelMap["environment_id"] = model.EnvironmentID + } + if model.Authorizations != nil { + authorizationsMap, err := resourceIbmProjectConfigProjectConfigAuthToMap(model.Authorizations) + if err != nil { + return modelMap, err + } + if len(authorizationsMap) > 0 { + modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} + } + } + if model.Inputs != nil { + inputs := make(map[string]interface{}) + for k, v := range model.Inputs { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + inputs[k] = string(bytes) + } + if len(inputs) > 0 { + modelMap["inputs"] = inputs + } + } + if model.Settings != nil { + settings := make(map[string]interface{}) + for k, v := range model.Settings { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + settings[k] = string(bytes) + } + if len(settings) > 0 { + modelMap["settings"] = settings + } + } + if model.ComplianceProfile != nil { + complianceProfileMap, err := resourceIbmProjectConfigProjectComplianceProfileToMap(model.ComplianceProfile) + if err != nil { + return modelMap, err + } + if len(complianceProfileMap) > 0 { + modelMap["compliance_profile"] = []map[string]interface{}{complianceProfileMap} + } + } + if model.LocatorID != nil { + modelMap["locator_id"] = model.LocatorID + } + if model.ResourceCrns != nil && len(model.ResourceCrns) > 0 { + modelMap["resource_crns"] = model.ResourceCrns + } + return modelMap, nil + } else { + return nil, fmt.Errorf("Unrecognized projectv1.ProjectConfigResponseDefinitionIntf subtype encountered") + } +} + +func resourceIbmProjectConfigProjectConfigAuthToMap(model *projectv1.ProjectConfigAuth) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) - modelMap["name"] = model.Name + if model.TrustedProfileID != nil { + modelMap["trusted_profile_id"] = model.TrustedProfileID + } + if model.Method != nil { + modelMap["method"] = model.Method + } + if model.ApiKey != nil { + modelMap["api_key"] = model.ApiKey + } + return modelMap, nil +} + +func resourceIbmProjectConfigProjectComplianceProfileToMap(model *projectv1.ProjectComplianceProfile) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ID != nil { + modelMap["id"] = model.ID + } + if model.InstanceID != nil { + modelMap["instance_id"] = model.InstanceID + } + if model.InstanceLocation != nil { + modelMap["instance_location"] = model.InstanceLocation + } + if model.AttachmentID != nil { + modelMap["attachment_id"] = model.AttachmentID + } + if model.ProfileName != nil { + modelMap["profile_name"] = model.ProfileName + } + return modelMap, nil +} + +func resourceIbmProjectConfigProjectConfigResponseDefinitionDAConfigDefinitionPropertiesToMap(model *projectv1.ProjectConfigResponseDefinitionDAConfigDefinitionProperties) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Name != nil { + modelMap["name"] = model.Name + } if model.Description != nil { modelMap["description"] = model.Description } @@ -822,18 +1153,10 @@ func resourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *project if err != nil { return modelMap, err } - modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} - } - if model.ComplianceProfile != nil { - complianceProfileMap, err := resourceIbmProjectConfigProjectComplianceProfileToMap(model.ComplianceProfile) - if err != nil { - return modelMap, err - } - if len(complianceProfileMap) > 0 { - modelMap["compliance_profile"] = []map[string]interface{}{complianceProfileMap} + if len(authorizationsMap) > 0 { + modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} } } - modelMap["locator_id"] = model.LocatorID if model.Inputs != nil { inputs := make(map[string]interface{}) for k, v := range model.Inputs { @@ -860,39 +1183,67 @@ func resourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *project modelMap["settings"] = settings } } - return modelMap, nil -} - -func resourceIbmProjectConfigProjectConfigAuthToMap(model *projectv1.ProjectConfigAuth) (map[string]interface{}, error) { - modelMap := make(map[string]interface{}) - if model.TrustedProfileID != nil { - modelMap["trusted_profile_id"] = model.TrustedProfileID - } - if model.Method != nil { - modelMap["method"] = model.Method + if model.ComplianceProfile != nil { + complianceProfileMap, err := resourceIbmProjectConfigProjectComplianceProfileToMap(model.ComplianceProfile) + if err != nil { + return modelMap, err + } + if len(complianceProfileMap) > 0 { + modelMap["compliance_profile"] = []map[string]interface{}{complianceProfileMap} + } } - if model.ApiKey != nil { - modelMap["api_key"] = model.ApiKey + if model.LocatorID != nil { + modelMap["locator_id"] = model.LocatorID } return modelMap, nil } -func resourceIbmProjectConfigProjectComplianceProfileToMap(model *projectv1.ProjectComplianceProfile) (map[string]interface{}, error) { +func resourceIbmProjectConfigProjectConfigResponseDefinitionResourceConfigDefinitionPropertiesToMap(model *projectv1.ProjectConfigResponseDefinitionResourceConfigDefinitionProperties) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) - if model.ID != nil { - modelMap["id"] = model.ID + if model.Name != nil { + modelMap["name"] = model.Name } - if model.InstanceID != nil { - modelMap["instance_id"] = model.InstanceID + if model.Description != nil { + modelMap["description"] = model.Description } - if model.InstanceLocation != nil { - modelMap["instance_location"] = model.InstanceLocation + if model.EnvironmentID != nil { + modelMap["environment_id"] = model.EnvironmentID } - if model.AttachmentID != nil { - modelMap["attachment_id"] = model.AttachmentID + if model.Authorizations != nil { + authorizationsMap, err := resourceIbmProjectConfigProjectConfigAuthToMap(model.Authorizations) + if err != nil { + return modelMap, err + } + modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} } - if model.ProfileName != nil { - modelMap["profile_name"] = model.ProfileName + if model.Inputs != nil { + inputs := make(map[string]interface{}) + for k, v := range model.Inputs { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + inputs[k] = string(bytes) + } + if len(inputs) > 0 { + modelMap["inputs"] = inputs + } + } + if model.Settings != nil { + settings := make(map[string]interface{}) + for k, v := range model.Settings { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + settings[k] = string(bytes) + } + if len(settings) > 0 { + modelMap["settings"] = settings + } + } + if model.ResourceCrns != nil && len(model.ResourceCrns) > 0 { + modelMap["resource_crns"] = model.ResourceCrns } return modelMap, nil } @@ -904,7 +1255,15 @@ func resourceIbmProjectConfigOutputValueToMap(model *projectv1.OutputValue) (map modelMap["description"] = model.Description } if model.Value != nil { - modelMap["value"] = model.Value + value := make(map[string]interface{}) + for k, v := range model.Value { + bytes, err := json.Marshal(v) + if err != nil { + return modelMap, err + } + value[k] = string(bytes) + } + modelMap["value"] = value } return modelMap, nil } diff --git a/ibm/service/project/resource_ibm_project_environment.go b/ibm/service/project/resource_ibm_project_environment.go index d9fa73b4d9..615895028e 100644 --- a/ibm/service/project/resource_ibm_project_environment.go +++ b/ibm/service/project/resource_ibm_project_environment.go @@ -176,6 +176,11 @@ func ResourceIbmProjectEnvironment() *schema.Resource { Computed: true, Description: "A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339.", }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "A URL.", + }, "project_environment_id": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -279,6 +284,9 @@ func resourceIbmProjectEnvironmentRead(context context.Context, d *schema.Resour if err = d.Set("modified_at", flex.DateTimeToString(environment.ModifiedAt)); err != nil { return diag.FromErr(fmt.Errorf("Error setting modified_at: %s", err)) } + if err = d.Set("href", environment.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } if err = d.Set("project_environment_id", environment.ID); err != nil { return diag.FromErr(fmt.Errorf("Error setting project_environment_id: %s", err)) } @@ -372,7 +380,9 @@ func resourceIbmProjectEnvironmentMapToEnvironmentDefinitionRequiredProperties(m bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) newMap := make(map[string]interface{}) json.Unmarshal(bytes, &newMap) - model.Inputs = newMap + if len(newMap) > 0 { + model.Inputs = newMap + } } if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { ComplianceProfileModel, err := resourceIbmProjectEnvironmentMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) @@ -437,7 +447,9 @@ func resourceIbmProjectEnvironmentMapToEnvironmentDefinitionProperties(modelMap bytes, _ := json.Marshal(modelMap["inputs"].(map[string]interface{})) newMap := make(map[string]interface{}) json.Unmarshal(bytes, &newMap) - model.Inputs = newMap + if len(newMap) > 0 { + model.Inputs = newMap + } } if modelMap["compliance_profile"] != nil && len(modelMap["compliance_profile"].([]interface{})) > 0 { ComplianceProfileModel, err := resourceIbmProjectEnvironmentMapToProjectComplianceProfile(modelMap["compliance_profile"].([]interface{})[0].(map[string]interface{})) @@ -460,7 +472,9 @@ func resourceIbmProjectEnvironmentEnvironmentDefinitionRequiredPropertiesToMap(m if err != nil { return modelMap, err } - modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} + if len(authorizationsMap) > 0 { + modelMap["authorizations"] = []map[string]interface{}{authorizationsMap} + } } if model.Inputs != nil { inputs := make(map[string]interface{}) diff --git a/website/docs/d/project.html.markdown b/website/docs/d/project.html.markdown index 6cac923733..7960495c97 100644 --- a/website/docs/d/project.html.markdown +++ b/website/docs/d/project.html.markdown @@ -40,6 +40,8 @@ Nested schema for **configs**: * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. * `name` - (String) The configuration name. It is unique within the account across projects and regions. * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. + * `deployment_model` - (String) The configuration type. + * Constraints: Allowable values are: `project_deployed`, `user_deployed`. * `href` - (String) A URL. * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. * `id` - (String) The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. @@ -58,7 +60,7 @@ Nested schema for **configs**: * `id` - (String) The unique ID. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. * `state` - (String) The state of the configuration. - * Constraints: Allowable values are: `approved`, `deleted`, `deleting`, `deleting_failed`, `discarded`, `draft`, `deployed`, `deploying_failed`, `deploying`, `superseded`, `undeploying`, `undeploying_failed`, `validated`, `validating`, `validating_failed`. + * Constraints: Allowable values are: `approved`, `deleted`, `deleting`, `deleting_failed`, `discarded`, `draft`, `deployed`, `deploying_failed`, `deploying`, `superseded`, `undeploying`, `undeploying_failed`, `validated`, `validating`, `validating_failed`, `applied`, `apply_failed`. * `version` - (Integer) The version of the configuration. * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. @@ -118,6 +120,9 @@ Nested schema for **environments**: * `event_notifications_crn` - (String) The CRN of the event notifications instance if one is connected to this project. * Constraints: The maximum length is `512` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. +* `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `location` - (Forces new resource, String) The IBM Cloud location where a resource is deployed. * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]*$/`. diff --git a/website/docs/d/project_config.html.markdown b/website/docs/d/project_config.html.markdown index 8a3b1e183b..21021df943 100644 --- a/website/docs/d/project_config.html.markdown +++ b/website/docs/d/project_config.html.markdown @@ -35,7 +35,7 @@ After your data source is created, you can read values from the following attrib * `id` - The unique identifier of the project_config. * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. -* `definition` - (List) The name and description of a project configuration. +* `definition` - (List) Nested schema for **definition**: * `authorizations` - (List) The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. Nested schema for **authorizations**: @@ -66,8 +66,13 @@ Nested schema for **definition**: * Constraints: The maximum length is `512` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/`. * `name` - (String) The configuration name. It is unique within the account across projects and regions. * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. + * `resource_crns` - (List) The CRNs of resources associated with this configuration. + * Constraints: The list items must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. The maximum length is `110` items. The minimum length is `0` items. * `settings` - (Map) Schematics environment variables to use to deploy the configuration. Settings are only available if they were specified when the configuration was initially created. +* `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `is_draft` - (Boolean) The flag that indicates whether the version of the configuration is draft, or active. * `last_saved_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. @@ -84,7 +89,7 @@ Nested schema for **outputs**: * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. * `name` - (String) The variable name. * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. - * `value` - (String) Can be any value - a string, number, boolean, array, or object. + * `value` - (Map) Can be any value - a string, number, boolean, array, or object. * `project` - (List) The project referenced by this resource. Nested schema for **project**: @@ -153,7 +158,7 @@ Nested schema for **schematics**: * Constraints: The maximum length is `512` characters. The minimum length is `4` characters. The value must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. * `state` - (String) The state of the configuration. - * Constraints: Allowable values are: `approved`, `deleted`, `deleting`, `deleting_failed`, `discarded`, `draft`, `deployed`, `deploying_failed`, `deploying`, `superseded`, `undeploying`, `undeploying_failed`, `validated`, `validating`, `validating_failed`. + * Constraints: Allowable values are: `approved`, `deleted`, `deleting`, `deleting_failed`, `discarded`, `draft`, `deployed`, `deploying_failed`, `deploying`, `superseded`, `undeploying`, `undeploying_failed`, `validated`, `validating`, `validating_failed`, `applied`, `apply_failed`. * `update_available` - (Boolean) The flag that indicates whether a configuration update is available. diff --git a/website/docs/d/project_environment.html.markdown b/website/docs/d/project_environment.html.markdown index e7c6fd774c..a975ff2fb4 100644 --- a/website/docs/d/project_environment.html.markdown +++ b/website/docs/d/project_environment.html.markdown @@ -63,6 +63,9 @@ Nested schema for **definition**: * `name` - (String) The name of the environment. It is unique within the account across projects and regions. * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`. +* `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. + * `modified_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. * `project` - (List) The project referenced by this resource. diff --git a/website/docs/r/project.html.markdown b/website/docs/r/project.html.markdown index b447a1d627..3f0b5d0280 100644 --- a/website/docs/r/project.html.markdown +++ b/website/docs/r/project.html.markdown @@ -55,6 +55,8 @@ Nested schema for **configs**: * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. * `name` - (String) The configuration name. It is unique within the account across projects and regions. * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. + * `deployment_model` - (String) The configuration type. + * Constraints: Allowable values are: `project_deployed`, `user_deployed`. * `href` - (String) A URL. * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. * `id` - (String) The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. @@ -73,7 +75,7 @@ Nested schema for **configs**: * `id` - (String) The unique ID. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. * `state` - (String) The state of the configuration. - * Constraints: Allowable values are: `approved`, `deleted`, `deleting`, `deleting_failed`, `discarded`, `draft`, `deployed`, `deploying_failed`, `deploying`, `superseded`, `undeploying`, `undeploying_failed`, `validated`, `validating`, `validating_failed`. + * Constraints: Allowable values are: `approved`, `deleted`, `deleting`, `deleting_failed`, `discarded`, `draft`, `deployed`, `deploying_failed`, `deploying`, `superseded`, `undeploying`, `undeploying_failed`, `validated`, `validating`, `validating_failed`, `applied`, `apply_failed`. * `version` - (Integer) The version of the configuration. * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. @@ -118,6 +120,8 @@ Nested schema for **environments**: * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. * `event_notifications_crn` - (String) The CRN of the event notifications instance if one is connected to this project. * Constraints: The maximum length is `512` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^crn:v[0-9](:([A-Za-z0-9\\-._~!$&'()*+,;=@\/]|%[0-9A-Z]{2})*){8}$/`. +* `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. * `resource_group_id` - (String) The resource group id where the project's data and tools are created. * Constraints: The maximum length is `64` characters. The minimum length is `0` characters. The value must match regular expression `/^[0-9a-zA-Z]+$/`. * `state` - (String) The project status value. diff --git a/website/docs/r/project_config.html.markdown b/website/docs/r/project_config.html.markdown index 86be477768..ab71abbf40 100644 --- a/website/docs/r/project_config.html.markdown +++ b/website/docs/r/project_config.html.markdown @@ -23,7 +23,7 @@ resource "ibm_project_config" "project_config_instance" { } locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.145be7c1-9ec4-4719-b586-584ee52fbed0-global" inputs = { - name = "app_repo_name" + app_repo_name = "static-website-repo" } } project_id = ibm_project.project_instance.id @@ -34,7 +34,7 @@ resource "ibm_project_config" "project_config_instance" { You can specify the following arguments for this resource. -* `definition` - (Required, List) The name and description of a project configuration. +* `definition` - (Required, List) Nested schema for **definition**: * `authorizations` - (Optional, List) The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. Nested schema for **authorizations**: @@ -61,10 +61,12 @@ Nested schema for **definition**: * `environment_id` - (Optional, String) The ID of the project environment. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. * `inputs` - (Optional, Map) The input variables for configuration definition and environment. - * `locator_id` - (Required, Forces new resource, String) A unique concatenation of catalogID.versionID that identifies the DA in the catalog. Either schematics.workspace_crn, definition.locator_id, or both must be specified. + * `locator_id` - (Optional, Forces new resource, String) A unique concatenation of catalogID.versionID that identifies the DA in the catalog. Either schematics.workspace_crn, definition.locator_id, or both must be specified. * Constraints: The maximum length is `512` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/`. * `name` - (Required, String) The configuration name. It is unique within the account across projects and regions. * Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/`. + * `resource_crns` - (Optional, List) The CRNs of resources associated with this configuration. + * Constraints: The list items must match regular expression `/(?!\\s)(?!.*\\s$)^(crn)[^'"`<>{}\\s\\x00-\\x1F]*/`. The maximum length is `110` items. The minimum length is `0` items. * `settings` - (Optional, Map) Schematics environment variables to use to deploy the configuration. Settings are only available if they were specified when the configuration was initially created. * `project_id` - (Required, Forces new resource, String) The unique project ID. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. @@ -127,6 +129,8 @@ After your resource is created, you can read values from the listed arguments an * `id` - The unique identifier of the project_config. * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. +* `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. * `is_draft` - (Boolean) The flag that indicates whether the version of the configuration is draft, or active. * `last_saved_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. * `modified_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. @@ -139,7 +143,7 @@ Nested schema for **outputs**: * Constraints: The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`. * `name` - (String) The variable name. * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$).+$/`. - * `value` - (String) Can be any value - a string, number, boolean, array, or object. + * `value` - (Map) Can be any value - a string, number, boolean, array, or object. * `project` - (List) The project referenced by this resource. Nested schema for **project**: * `crn` - (String) An IBM Cloud resource name, which uniquely identifies a resource. @@ -155,7 +159,7 @@ Nested schema for **project**: * `project_config_id` - (String) The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. * Constraints: The maximum length is `128` characters. The value must match regular expression `/^[\\.\\-0-9a-zA-Z]+$/`. * `state` - (String) The state of the configuration. - * Constraints: Allowable values are: `approved`, `deleted`, `deleting`, `deleting_failed`, `discarded`, `draft`, `deployed`, `deploying_failed`, `deploying`, `superseded`, `undeploying`, `undeploying_failed`, `validated`, `validating`, `validating_failed`. + * Constraints: Allowable values are: `approved`, `deleted`, `deleting`, `deleting_failed`, `discarded`, `draft`, `deployed`, `deploying_failed`, `deploying`, `superseded`, `undeploying`, `undeploying_failed`, `validated`, `validating`, `validating_failed`, `applied`, `apply_failed`. * `update_available` - (Boolean) The flag that indicates whether a configuration update is available. * `version` - (Integer) The version of the configuration. diff --git a/website/docs/r/project_environment.html.markdown b/website/docs/r/project_environment.html.markdown index 99299f2fd4..218a8dfa38 100644 --- a/website/docs/r/project_environment.html.markdown +++ b/website/docs/r/project_environment.html.markdown @@ -66,6 +66,8 @@ After your resource is created, you can read values from the listed arguments an * `id` - The unique identifier of the project_environment. * `created_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. +* `href` - (String) A URL. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^(http(s)?:\/\/)[a-zA-Z0-9\\$\\-_\\.+!\\*'\\(\\),=&?\/]+$/`. * `modified_at` - (String) A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time format as specified by RFC 3339. * `project` - (List) The project referenced by this resource. Nested schema for **project**: From f2f674eb3947c47838b08728daf40a6df17252cf Mon Sep 17 00:00:00 2001 From: sreekarbvibm <139211144+sreekarbvibm@users.noreply.github.com> Date: Thu, 28 Dec 2023 11:12:35 +0530 Subject: [PATCH 117/132] Feature(vpc Advertise routes): Support route advertising in vpc (#5005) * added advertised route support * doc updates for routing table/s * Change advertise_routes_to from List to HashSet and modify create, update and read methods accordingly * Add latest generated go sdk * update with latest sdk * add beta maturity to sdk * corrected docs as per review comment * updated go mod * Update resource_ibm_is_bare_metal_server.go * rm common --------- Co-authored-by: Bhavesh Shrivastav Co-authored-by: Ujjwal Kumar --- go.mod | 3 +- go.sum | 4 +- .../data_source_ibm_is_vpc_routing_table.go | 11 ++++++ ...a_source_ibm_is_vpc_routing_table_route.go | 9 +++++ ..._source_ibm_is_vpc_routing_table_routes.go | 8 ++++ .../data_source_ibm_is_vpc_routing_tables.go | 11 ++++++ .../vpc/resource_ibm_is_bare_metal_server.go | 11 +++--- .../vpc/resource_ibm_is_vpc_routing_table.go | 37 +++++++++++++++++++ ...resource_ibm_is_vpc_routing_table_route.go | 29 +++++++++++++++ ...rce_ibm_is_vpc_routing_table_route_test.go | 15 ++++++-- .../resource_ibm_is_vpc_routing_table_test.go | 32 ++++++++++++++++ .../docs/d/is_vpc_routing_table.html.markdown | 5 +++ .../is_vpc_routing_table_route.html.markdown | 1 + .../is_vpc_routing_table_routes.html.markdown | 1 + .../d/is_vpc_routing_tables.html.markdown | 5 +++ .../docs/r/is_vpc_routing_table.html.markdown | 25 ++++++++++++- .../is_vpc_routing_table_route.html.markdown | 5 ++- 17 files changed, 198 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index 9b8b6a6517..f90c4389cf 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/IBM/schematics-go-sdk v0.2.2 github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2 github.com/IBM/vpc-beta-go-sdk v0.6.0 - github.com/IBM/vpc-go-sdk v0.46.0 + github.com/IBM/vpc-go-sdk v0.47.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 @@ -235,6 +235,7 @@ replace github.com/softlayer/softlayer-go v1.0.3 => github.com/IBM-Cloud/softlay replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt/jwt v3.2.1+incompatible +// add sdk changes. replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 exclude ( diff --git a/go.sum b/go.sum index 7640e1266d..b3be0e1e92 100644 --- a/go.sum +++ b/go.sum @@ -174,8 +174,8 @@ github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2 h1:+Svh1OmoFxMBnZQSOUtp2UUzrOGFs github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2/go.mod h1:WII+LS4VkQYykmq65NWSuPb5xGNvsqkcK1aCWZoU2x4= github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc= github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA= -github.com/IBM/vpc-go-sdk v0.46.0 h1:OwXH3oaYgYmzt559n77AteSpNsW4H1PoeHcR4EOolzk= -github.com/IBM/vpc-go-sdk v0.46.0/go.mod h1:4Hs5d/aClmsxAzwDQkwG+ri0vW2ykPJdpM6hDLRwKcA= +github.com/IBM/vpc-go-sdk v0.47.0 h1:2Qcjd4zQQRYjz+y4ZMDP6+aWGifyXCZ9uMmlpW7p9To= +github.com/IBM/vpc-go-sdk v0.47.0/go.mod h1:4Hs5d/aClmsxAzwDQkwG+ri0vW2ykPJdpM6hDLRwKcA= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= diff --git a/ibm/service/vpc/data_source_ibm_is_vpc_routing_table.go b/ibm/service/vpc/data_source_ibm_is_vpc_routing_table.go index c3023bba21..7293a719fd 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpc_routing_table.go +++ b/ibm/service/vpc/data_source_ibm_is_vpc_routing_table.go @@ -60,6 +60,14 @@ func DataSourceIBMIBMIsVPCRoutingTable() *schema.Resource { Description: "The routing table identifier.", }, + "advertise_routes_to": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these sources.The enumerated values for this property are expected to expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected property value was encountered.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, rtCreateAt: &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -297,6 +305,9 @@ func dataSourceIBMIBMIsVPCRoutingTableRead(context context.Context, d *schema.Re return diag.FromErr(fmt.Errorf("[ERROR] Error setting route_vpc_zone_ingress: %s", err)) } + if err = d.Set("advertise_routes_to", routingTable.AdvertiseRoutesTo); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting value of advertise_routes_to: %s", err)) + } routes := []map[string]interface{}{} if routingTable.Routes != nil { for _, modelItem := range routingTable.Routes { diff --git a/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_route.go b/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_route.go index 2798f27aa8..da18a18571 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_route.go +++ b/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_route.go @@ -57,6 +57,11 @@ func DataSourceIBMIBMIsVPCRoutingTableRoute() *schema.Resource { Computed: true, Description: "The action to perform with a packet matching the route:- `delegate`: delegate to the system's built-in routes- `delegate_vpc`: delegate to the system's built-in routes, ignoring Internet-bound routes- `deliver`: deliver the packet to the specified `next_hop`- `drop`: drop the packet.", }, + "advertise": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` routing table property.", + }, rtCreateAt: &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -271,6 +276,10 @@ func dataSourceIBMIBMIsVPCRoutingTableRouteRead(context context.Context, d *sche return diag.FromErr(fmt.Errorf("[ERROR] Error setting action: %s", err)) } + if err = d.Set("advertise", route.Advertise); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting advertise: %s", err)) + } + if err = d.Set(rtCreateAt, flex.DateTimeToString(route.CreatedAt)); err != nil { return diag.FromErr(fmt.Errorf("[ERROR] Error setting created_at: %s", err)) } diff --git a/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_routes.go b/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_routes.go index a1a5ac299a..205d002bdc 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_routes.go +++ b/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_routes.go @@ -126,6 +126,11 @@ func DataSourceIBMISVPCRoutingTableRoutes() *schema.Resource { Computed: true, Description: "Routing Table Route Action", }, + "advertise": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` routing table property.", + }, isRoutingTableRouteDestination: { Type: schema.TypeString, Computed: true, @@ -216,6 +221,9 @@ func dataSourceIBMISVPCRoutingTableRoutesList(d *schema.ResourceData, meta inter if instance.LifecycleState != nil { route[isRoutingTableRouteLifecycleState] = *instance.LifecycleState } + if instance.Advertise != nil { + route["advertise"] = *instance.Advertise + } if instance.Destination != nil { route[isRoutingTableRouteDestination] = *instance.Destination } diff --git a/ibm/service/vpc/data_source_ibm_is_vpc_routing_tables.go b/ibm/service/vpc/data_source_ibm_is_vpc_routing_tables.go index b157c50f04..ffec0e8c74 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpc_routing_tables.go +++ b/ibm/service/vpc/data_source_ibm_is_vpc_routing_tables.go @@ -72,6 +72,14 @@ func DataSourceIBMISVPCRoutingTables() *schema.Resource { Computed: true, Description: "Routing Table ID", }, + "advertise_routes_to": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these sources.The enumerated values for this property are expected to expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected property value was encountered.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, isRoutingTableHref: { Type: schema.TypeString, Computed: true, @@ -241,6 +249,9 @@ func dataSourceIBMISVPCRoutingTablesList(d *schema.ResourceData, meta interface{ if routingTable.RouteVPCZoneIngress != nil { rtable[isRoutingTableVPCZoneIngress] = *routingTable.RouteVPCZoneIngress } + if routingTable.AdvertiseRoutesTo != nil { + rtable["advertise_routes_to"] = routingTable.AdvertiseRoutesTo + } if routingTable.IsDefault != nil { rtable[isRoutingTableDefault] = *routingTable.IsDefault } diff --git a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go index 94c1ede67f..8e419168b9 100644 --- a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go +++ b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go @@ -696,7 +696,8 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou if err != nil { return diag.FromErr(err) } - options := &vpcv1.CreateBareMetalServerOptions{} + createbmsoptions := &vpcv1.CreateBareMetalServerOptions{} + options := &vpcv1.BareMetalServerPrototype{} var imageStr string if image, ok := d.GetOk(isBareMetalServerImage); ok { imageStr = image.(string) @@ -705,7 +706,7 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou // enable secure boot if _, ok := d.GetOkExists(isBareMetalServerEnableSecureBoot); ok { - options.SetEnableSecureBoot(d.Get(isBareMetalServerEnableSecureBoot).(bool)) + options.EnableSecureBoot = core.BoolPtr(d.Get(isBareMetalServerEnableSecureBoot).(bool)) } // trusted_platform_module @@ -715,7 +716,7 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou if err != nil { return diag.FromErr(err) } - options.SetTrustedPlatformModule(trustedPlatformModuleModel) + options.TrustedPlatformModule = trustedPlatformModuleModel } keySet := d.Get(isBareMetalServerKeys).(*schema.Set) @@ -1300,8 +1301,8 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou ID: &vpc, } } - - bms, response, err := sess.CreateBareMetalServerWithContext(context, options) + createbmsoptions.BareMetalServerPrototype = options + bms, response, err := sess.CreateBareMetalServerWithContext(context, createbmsoptions) if err != nil { return diag.FromErr(fmt.Errorf("[DEBUG] Create bare metal server err %s\n%s", err, response)) } diff --git a/ibm/service/vpc/resource_ibm_is_vpc_routing_table.go b/ibm/service/vpc/resource_ibm_is_vpc_routing_table.go index 50c6a9c8ce..2935d1817b 100644 --- a/ibm/service/vpc/resource_ibm_is_vpc_routing_table.go +++ b/ibm/service/vpc/resource_ibm_is_vpc_routing_table.go @@ -65,6 +65,14 @@ func ResourceIBMISVPCRoutingTable() *schema.Resource { Set: schema.HashString, Description: "The filters specifying the resources that may create routes in this routing table, The resource type: vpn_gateway or vpn_server", }, + "advertise_routes_to": &schema.Schema{ + Type: schema.TypeSet, + Optional: true, + Computed: true, + Set: schema.HashString, + Description: "The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these sources.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, rtRouteDirectLinkIngress: { Type: schema.TypeBool, ForceNew: false, @@ -209,6 +217,15 @@ func resourceIBMISVPCRoutingTableCreate(d *schema.ResourceData, meta interface{} } createVpcRoutingTableOptions.AcceptRoutesFrom = aroutes } + if _, ok := d.GetOk("advertise_routes_to"); ok { + var advertiseRoutesToList []string + advertiseRoutesTo := d.Get("advertise_routes_to").(*schema.Set) + + for _, val := range advertiseRoutesTo.List() { + advertiseRoutesToList = append(advertiseRoutesToList, val.(string)) + } + createVpcRoutingTableOptions.AdvertiseRoutesTo = advertiseRoutesToList + } if _, ok := d.GetOk(rtRouteInternetIngress); ok { rtRouteInternetIngress := d.Get(rtRouteInternetIngress).(bool) @@ -263,12 +280,22 @@ func resourceIBMISVPCRoutingTableRead(d *schema.ResourceData, meta interface{}) d.Set(rtRouteVPCZoneIngress, routeTable.RouteVPCZoneIngress) d.Set(rtIsDefault, routeTable.IsDefault) acceptRoutesFromArray := make([]string, 0) + advertiseRoutesToArray := make([]string, 0) for i := 0; i < len(routeTable.AcceptRoutesFrom); i++ { acceptRoutesFromArray = append(acceptRoutesFromArray, string(*(routeTable.AcceptRoutesFrom[i].ResourceType))) } if err = d.Set("accept_routes_from_resource_type", acceptRoutesFromArray); err != nil { return fmt.Errorf("[ERROR] Error setting accept_routes_from_resource_type: %s", err) } + + for i := 0; i < len(routeTable.AdvertiseRoutesTo); i++ { + advertiseRoutesToArray = append(advertiseRoutesToArray, routeTable.AdvertiseRoutesTo[i]) + } + + if err = d.Set("advertise_routes_to", advertiseRoutesToArray); err != nil { + return fmt.Errorf("[ERROR] Error setting advertise_routes_to: %s", err) + } + subnets := make([]map[string]interface{}, 0) for _, s := range routeTable.Subnets { @@ -320,6 +347,16 @@ func resourceIBMISVPCRoutingTableUpdate(d *schema.ResourceData, meta interface{} routingTablePatchModel.AcceptRoutesFrom = aroutes hasChange = true } + if d.HasChange("advertise_routes_to") { + var advertiseRoutesToList []string + advertiseRoutesTo := d.Get("advertise_routes_to").(*schema.Set) + + for _, val := range advertiseRoutesTo.List() { + advertiseRoutesToList = append(advertiseRoutesToList, val.(string)) + } + routingTablePatchModel.AdvertiseRoutesTo = advertiseRoutesToList + hasChange = true + } if d.HasChange(rtRouteDirectLinkIngress) { routeDirectLinkIngress := d.Get(rtRouteDirectLinkIngress).(bool) routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(routeDirectLinkIngress) diff --git a/ibm/service/vpc/resource_ibm_is_vpc_routing_table_route.go b/ibm/service/vpc/resource_ibm_is_vpc_routing_table_route.go index 2a0495e69c..2862c247f6 100644 --- a/ibm/service/vpc/resource_ibm_is_vpc_routing_table_route.go +++ b/ibm/service/vpc/resource_ibm_is_vpc_routing_table_route.go @@ -78,6 +78,12 @@ func ResourceIBMISVPCRoutingTableRoute() *schema.Resource { Description: "The action to perform with a packet matching the route.", ValidateFunc: validate.InvokeValidator("ibm_is_vpc_routing_table_route", rAction), }, + "advertise": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` routing table property.", + }, rName: { Type: schema.TypeString, Optional: true, @@ -242,6 +248,11 @@ func resourceIBMISVPCRoutingTableRouteCreate(d *schema.ResourceData, meta interf createVpcRoutingTableRouteOptions.SetAction(routeAction) } + if advertiseVal, ok := d.GetOk("advertise"); ok { + advertise := advertiseVal.(bool) + createVpcRoutingTableRouteOptions.SetAdvertise(advertise) + } + if name, ok := d.GetOk(rName); ok { routeName := name.(string) createVpcRoutingTableRouteOptions.SetName(routeName) @@ -282,6 +293,9 @@ func resourceIBMISVPCRoutingTableRouteRead(d *schema.ResourceData, meta interfac } d.Set(rID, *route.ID) + if route.Advertise != nil { + d.Set("Advertise", route.Advertise) + } d.Set(rName, *route.Name) d.Set(rDestination, *route.Destination) if route.NextHop != nil { @@ -329,6 +343,21 @@ func resourceIBMISVPCRoutingTableRouteUpdate(d *schema.ResourceData, meta interf // Construct an instance of the RoutePatch model routePatchModel := new(vpcv1.RoutePatch) + if d.HasChange(rName) || d.HasChange("advertise") { + // Construct an instance of the RoutePatch model + routePatchModel := new(vpcv1.RoutePatch) + if d.HasChange(rName) { + name := d.Get(rName).(string) + routePatchModel.Name = &name + hasChange = true + } + + if d.HasChange("advertise") { + advertiseVal := d.Get("advertise").(bool) + routePatchModel.Advertise = &advertiseVal + hasChange = true + } + } if d.HasChange(rName) { name := d.Get(rName).(string) routePatchModel.Name = &name diff --git a/ibm/service/vpc/resource_ibm_is_vpc_routing_table_route_test.go b/ibm/service/vpc/resource_ibm_is_vpc_routing_table_route_test.go index 5157cbcf68..4ce678bd24 100644 --- a/ibm/service/vpc/resource_ibm_is_vpc_routing_table_route_test.go +++ b/ibm/service/vpc/resource_ibm_is_vpc_routing_table_route_test.go @@ -24,6 +24,8 @@ func TestAccIBMISVPCRoutingTableRoute_basic(t *testing.T) { routeName1 := fmt.Sprintf("tfvpcuat-create-%d", acctest.RandIntRange(10, 100)) routeTableName := fmt.Sprintf("tfvpcrt-create-%d", acctest.RandIntRange(10, 100)) routeTableName1 := fmt.Sprintf("tfvpcrt-up-create-%d", acctest.RandIntRange(10, 100)) + advertiseVal := fmt.Sprintf("tfpvpcuat-create-%d", acctest.RandIntRange(10, 50)) + advertiseValUpd := fmt.Sprintf("tfpvpcuat-update-%d", acctest.RandIntRange(60, 100)) resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, @@ -31,19 +33,23 @@ func TestAccIBMISVPCRoutingTableRoute_basic(t *testing.T) { CheckDestroy: testAccCheckIBMISVPCRouteTableRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccCheckIBMISVPCRouteTableRouteConfig(routeTableName, name1, subnetName, routeName), + Config: testAccCheckIBMISVPCRouteTableRouteConfig(routeTableName, name1, subnetName, routeName, advertiseVal), Check: resource.ComposeTestCheckFunc( testAccCheckIBMISVPCRouteTableRouteExists("ibm_is_vpc_routing_table_route.test_custom_route1", vpcRouteTables), resource.TestCheckResourceAttr( "ibm_is_vpc_routing_table_route.test_custom_route1", "name", routeName), + resource.TestCheckResourceAttr( + "ibm_is_vpc_routing_table_route.test_custom_route1", "advertise", advertiseVal), ), }, { - Config: testAccCheckIBMISVPCRouteTableRouteConfig(routeTableName1, name1, subnetName, routeName1), + Config: testAccCheckIBMISVPCRouteTableRouteConfig(routeTableName1, name1, subnetName, routeName1, advertiseValUpd), Check: resource.ComposeTestCheckFunc( testAccCheckIBMISVPCRouteTableRouteExists("ibm_is_vpc_routing_table_route.test_custom_route1", vpcRouteTables), resource.TestCheckResourceAttr( "ibm_is_vpc_routing_table_route.test_custom_route1", "name", routeName1), + resource.TestCheckResourceAttr( + "ibm_is_vpc_routing_table_route.test_custom_route1", "advertise", advertiseValUpd), ), }, }, @@ -114,7 +120,7 @@ func testAccCheckIBMISVPCRouteTableRouteExists(n, vpcrouteTableID string) resour } } -func testAccCheckIBMISVPCRouteTableRouteConfig(rtName, name, subnetName, routeName string) string { +func testAccCheckIBMISVPCRouteTableRouteConfig(rtName, name, subnetName, routeName, advertise string) string { return fmt.Sprintf(` resource "ibm_is_vpc" "testacc_vpc" { name = "%s" @@ -137,10 +143,11 @@ resource "ibm_is_vpc_routing_table_route" "test_custom_route1" { depends_on = [ibm_is_vpc_routing_table.test_ibm_is_vpc_routing_table, ibm_is_subnet.test_cr_subnet1] vpc = ibm_is_vpc.testacc_vpc.id routing_table = ibm_is_vpc_routing_table.test_ibm_is_vpc_routing_table.routing_table + advertise = "%s" name = "%s" zone = "%s" next_hop = "%s" destination = ibm_is_subnet.test_cr_subnet1.ipv4_cidr_block } -`, name, rtName, subnetName, acc.ISZoneName, acc.ISCIDR, routeName, acc.ISZoneName, acc.ISRouteNextHop) +`, name, rtName, subnetName, acc.ISZoneName, acc.ISCIDR, advertise, routeName, acc.ISZoneName, acc.ISRouteNextHop) } diff --git a/ibm/service/vpc/resource_ibm_is_vpc_routing_table_test.go b/ibm/service/vpc/resource_ibm_is_vpc_routing_table_test.go index 3068c21d0a..39007bf996 100644 --- a/ibm/service/vpc/resource_ibm_is_vpc_routing_table_test.go +++ b/ibm/service/vpc/resource_ibm_is_vpc_routing_table_test.go @@ -89,6 +89,38 @@ func TestAccIBMISVPCRoutingTable_acceptRoutesFrom(t *testing.T) { }) } +// advertise_routes_to +func TestAccIBMISVPCRoutingTable_advertiseRoutesTO(t *testing.T) { + var vpcRouteTables string + name1 := fmt.Sprintf("tfvpc-create-%d", acctest.RandIntRange(10, 100)) + routeTableName := fmt.Sprintf("tfvpcrt-create-%d", acctest.RandIntRange(10, 100)) + routeTableName1 := fmt.Sprintf("tfvpcrt-up-create-%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMISVPCRouteTableDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISVPCRouteTableConfig(routeTableName, name1), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMISVPCRouteTableExists("ibm_is_vpc_routing_table.test_ibm_is_vpc_routing_table", vpcRouteTables), + resource.TestCheckResourceAttrSet( + "ibm_is_vpc_routing_table.test_ibm_is_vpc_routing_table", "advertise_routes_to"), + ), + }, + { + Config: testAccCheckIBMISVPCRouteTableConfig(routeTableName1, name1), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMISVPCRouteTableExists("ibm_is_vpc_routing_table.test_ibm_is_vpc_routing_table", vpcRouteTables), + resource.TestCheckResourceAttrSet( + "ibm_is_vpc_routing_table.test_ibm_is_vpc_routing_table", "advertise_routes_to"), + ), + }, + }, + }) +} + func testAccCheckIBMISVPCRouteTableDestroy(s *terraform.State) error { //userDetails, _ := acc.TestAccProvider.Meta().(conns.ClientSession).BluemixUserDetails() diff --git a/website/docs/d/is_vpc_routing_table.html.markdown b/website/docs/d/is_vpc_routing_table.html.markdown index 752281c49c..04f6388bcd 100644 --- a/website/docs/d/is_vpc_routing_table.html.markdown +++ b/website/docs/d/is_vpc_routing_table.html.markdown @@ -52,6 +52,11 @@ In addition to all argument references listed, you can access the following attr - `accept_routes_from` - (List) The filters specifying the resources that may create routes in this routing table.At present, only the `resource_type` filter is permitted, and only the `vpn_gateway` value is supported, but filter support is expected to expand in the future. Nested scheme for **accept_routes_from**: - `resource_type` - (String) The resource type. +- `advertise_routes_to` - (Optional, List) The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these sources. + + ->**Options** 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`) - `created_at` - (String) The date and time that this routing table was created. - `href` - (String) The URL for this routing table. - `id` - (String) The unique identifier of the RoutingTable. diff --git a/website/docs/d/is_vpc_routing_table_route.html.markdown b/website/docs/d/is_vpc_routing_table_route.html.markdown index 858af62286..ace775cc16 100644 --- a/website/docs/d/is_vpc_routing_table_route.html.markdown +++ b/website/docs/d/is_vpc_routing_table_route.html.markdown @@ -54,6 +54,7 @@ Review the argument reference that you can specify for your data source. In addition to all argument references listed, you can access the following attribute references after your data source is created. - `action` - (String) The action to perform with a packet matching the route, allowable values are: `delegate`, `delegate_vpc`, `deliver`, `drop`. +- `advertise` - (Boolean) Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` routing table property. - `delegate`: delegate to the system's built-in routes - `delegate_vpc`: delegate to the system's built-in routes, ignoring Internet-bound routes - `deliver`: deliver the packet to the specified `next_hop` diff --git a/website/docs/d/is_vpc_routing_table_routes.html.markdown b/website/docs/d/is_vpc_routing_table_routes.html.markdown index 2d906396de..7ada595c45 100644 --- a/website/docs/d/is_vpc_routing_table_routes.html.markdown +++ b/website/docs/d/is_vpc_routing_table_routes.html.markdown @@ -72,6 +72,7 @@ In addition to all argument reference list, you can access the following attribu - `resource_type` - (String) The resource type. - Constraints: Allowable values are: `vpn_gateway`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. - `action` - (String) The action to perform with a packet matching the route. + - `advertise` - (Boolean) Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` routing table property. - `destination` - (String) The destination of the route. - `next_hop` - (String) The next hop address of the route. - `origin` - (String) The origin of this route:- `service`: route was directly created by a service - `user`: route was directly created by a userThe enumerated values for this property are expected to expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the unexpected property value was encountered. diff --git a/website/docs/d/is_vpc_routing_tables.html.markdown b/website/docs/d/is_vpc_routing_tables.html.markdown index b38983b1be..d7b750a62d 100644 --- a/website/docs/d/is_vpc_routing_tables.html.markdown +++ b/website/docs/d/is_vpc_routing_tables.html.markdown @@ -48,6 +48,11 @@ In addition to the argument reference list, you can access the following attribu - `accept_routes_from` - (List) The filters specifying the resources that may create routes in this routing table.At present, only the `resource_type` filter is permitted, and only the `vpn_gateway` value is supported, but filter support is expected to expand in the future. Nested scheme for **accept_routes_from**: - `resource_type` - (String) The resource type. + - `advertise_routes_to` - (Optional, List) The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these sources. + + ->**Options** 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`) - `created_at` - (Timestamp) The date and time the routing table was created. - `href` - (String) The routing table URL. - `is_default` - (String) Indicates whether the default routing table. diff --git a/website/docs/r/is_vpc_routing_table.html.markdown b/website/docs/r/is_vpc_routing_table.html.markdown index e84b962497..ace815208c 100644 --- a/website/docs/r/is_vpc_routing_table.html.markdown +++ b/website/docs/r/is_vpc_routing_table.html.markdown @@ -38,11 +38,27 @@ resource "ibm_is_vpc_routing_table" "example" { ``` +## Example usage: Advertising routes +``` +resource "ibm_is_vpc" "example" { + name = "example-vpc" +} +resource "ibm_is_vpc_routing_table" "is_vpc_routing_table_instance" { + vpc = ibm_is_vpc.example.id + name = "example-vpc-routing-table" + route_direct_link_ingress = true + route_transit_gateway_ingress = false + route_vpc_zone_ingress = false + advertise_routes_to = ["direct_link", "transit_gateway"] + +} +``` # Example usage for accept_routes_from_resource_type ```terraform resource "ibm_is_vpc" "example" { name = "example-vpc" } + resource "ibm_is_vpc_routing_table" "example" { vpc = ibm_is_vpc.example.id name = "example-vpc-routing-table" @@ -51,10 +67,17 @@ resource "ibm_is_vpc_routing_table" "example" { route_vpc_zone_ingress = false accept_routes_from_resource_type = ["vpn_server"] } - ``` + + ## Argument reference Review the argument references that you can specify for your resource. + +- `advertise_routes_to` - (Optional, List) The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these sources. + + ->**Options** 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`) - `accept_routes_from_resource_type` - (Optional, List) The resource type filter specifying the resources that may create routes in this routing table. Ex: `vpn_server`, `vpn_gateway` - `created_at` - (Timestamp) The date and time when the routing table was created. - `name` - (Optional, String) The routing table name. diff --git a/website/docs/r/is_vpc_routing_table_route.html.markdown b/website/docs/r/is_vpc_routing_table_route.html.markdown index 234faacca6..b17eec3634 100644 --- a/website/docs/r/is_vpc_routing_table_route.html.markdown +++ b/website/docs/r/is_vpc_routing_table_route.html.markdown @@ -30,7 +30,8 @@ resource "ibm_is_vpc" "example" { resource "ibm_is_vpc_routing_table" "example" { vpc = ibm_is_vpc.example.id name = "example-routing-table" - route_direct_link_ingress = false + advertise_routes_to = ["direct_link", "transit_gateway"] + route_direct_link_ingress = true route_transit_gateway_ingress = false route_vpc_zone_ingress = false } @@ -41,6 +42,7 @@ resource "ibm_is_vpc_routing_table_route" "example" { name = "custom-route-2" destination = "192.168.4.0/24" action = "deliver" + advertise = true next_hop = ibm_is_vpn_gateway_connection.example.gateway_connection // Example value "10.0.0.4" } ``` @@ -63,6 +65,7 @@ resource "ibm_is_vpc_routing_table_route" "example" { Review the argument references that you can specify for your resource. - `action` - (Optional, String) The action to perform with a packet matching the route `delegate`, `delegate_vpc`, `deliver`, `drop`. +- `advertise` - (Optional, Bool) Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` routing table's property. - `destination` - (Required, Forces new resource, String) The destination of the route. - `name` - (Optional, String) The user-defined name of the route. If unspecified, the name will be a hyphenated list of randomly selected words. You need to provide unique name within the VPC routing table the route resides in. - `next_hop` - (Required, String) The next hop of the route. It accepts IP address or a VPN gateway connection ID (`ibm_is_vpn_gateway_connection`) of a VPN Gateway (`ibm_is_vpn_gateway`) with the `mode = "route"` argument and in the same VPC as the route table for this route for an egress route. For action other than deliver, you must specify `0.0.0.0`. From ab4912c3d834062af38f613b074431c7ffbbcca9 Mon Sep 17 00:00:00 2001 From: yonatanyell <69857977+yonatanyell@users.noreply.github.com> Date: Fri, 29 Dec 2023 12:31:51 +0200 Subject: [PATCH 118/132] Bugs fixes for Secrets Manager (#5008) * SC addition * SC addition * SC addition * update function updated * SC unit tests added * SC unit tests added * d * tests fixes * tests fixes * update sdk * .secrets.baseline update * .secrets.baseline update * .secrets.baseline update * Update sm_service_credentials_secret_metadata.html.markdown * bugs fixes * bugs fixes * bugs fixes --------- Co-authored-by: Yonathan-Yellin Co-authored-by: Avi Ribchinsky Co-authored-by: Tatyana Co-authored-by: Idan Adar --- .secrets.baseline | 60 ++++++++++++------- ...ta_source_ibm_sm_iam_credentials_secret.go | 8 --- ..._ibm_sm_iam_credentials_secret_metadata.go | 8 --- .../data_source_ibm_sm_private_certificate.go | 8 --- ...rce_ibm_sm_private_certificate_metadata.go | 8 --- ..._source_ibm_sm_username_password_secret.go | 8 --- ...bm_sm_username_password_secret_metadata.go | 8 --- .../resource_ibm_sm_iam_credentials_secret.go | 12 ---- .../resource_ibm_sm_private_certificate.go | 3 +- .../d/sm_iam_credentials_secret.html.markdown | 1 - ..._credentials_secret_metadata.html.markdown | 1 - .../d/sm_private_certificate.html.markdown | 1 - ...private_certificate_metadata.html.markdown | 1 - .../sm_username_password_secret.html.markdown | 1 - ...ame_password_secret_metadata.html.markdown | 1 - .../r/sm_iam_credentials_secret.html.markdown | 1 - .../r/sm_private_certificate.html.markdown | 1 - ...icate_configuration_template.html.markdown | 2 + .../sm_username_password_secret.html.markdown | 1 - 19 files changed, 42 insertions(+), 92 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index 13208250a4..dae78c7d80 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.mod|go.sum|.*.map|^.secrets.baseline$", "lines": null }, - "generated_at": "2023-12-20T09:37:58Z", + "generated_at": "2023-12-26T12:35:45Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -3224,7 +3224,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 185, + "line_number": 180, "type": "Secret Keyword", "verified_result": null }, @@ -3232,7 +3232,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 312, + "line_number": 307, "type": "Secret Keyword", "verified_result": null } @@ -3250,7 +3250,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 291, + "line_number": 286, "type": "Secret Keyword", "verified_result": null } @@ -3298,7 +3298,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 235, + "line_number": 230, "type": "Secret Keyword", "verified_result": null }, @@ -3306,7 +3306,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 414, + "line_number": 409, "type": "Secret Keyword", "verified_result": null } @@ -3510,7 +3510,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 162, + "line_number": 157, "type": "Secret Keyword", "verified_result": null }, @@ -3518,7 +3518,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 278, + "line_number": 273, "type": "Secret Keyword", "verified_result": null } @@ -3556,7 +3556,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 204, + "line_number": 198, "type": "Secret Keyword", "verified_result": null }, @@ -3564,7 +3564,7 @@ "hashed_secret": "108b310facc1a193833fc2971fd83081f775ea0c", "is_secret": false, "is_verified": false, - "line_number": 395, + "line_number": 389, "type": "Secret Keyword", "verified_result": null }, @@ -3572,7 +3572,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 398, + "line_number": 392, "type": "Secret Keyword", "verified_result": null } @@ -3636,7 +3636,7 @@ "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", "is_secret": false, "is_verified": false, - "line_number": 298, + "line_number": 297, "type": "Secret Keyword", "verified_result": null }, @@ -3644,7 +3644,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 539, + "line_number": 538, "type": "Secret Keyword", "verified_result": null } @@ -3831,6 +3831,24 @@ "verified_result": null } ], + "ibm/service/secretsmanager/resource_ibm_sm_service_credentilas_secret.go": [ + { + "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", + "is_secret": false, + "is_verified": false, + "line_number": 190, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", + "is_secret": false, + "is_verified": false, + "line_number": 443, + "type": "Secret Keyword", + "verified_result": null + } + ], "ibm/service/secretsmanager/resource_ibm_sm_username_password_secret.go": [ { "hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4", @@ -4736,7 +4754,7 @@ "hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e", "is_secret": false, "is_verified": false, - "line_number": 128, + "line_number": 127, "type": "Secret Keyword", "verified_result": null }, @@ -4744,7 +4762,7 @@ "hashed_secret": "e66e7d67fdf3c596c435fc7828b13205e4950a0f", "is_secret": false, "is_verified": false, - "line_number": 130, + "line_number": 129, "type": "Secret Keyword", "verified_result": null } @@ -4790,7 +4808,7 @@ "hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e", "is_secret": false, "is_verified": false, - "line_number": 148, + "line_number": 147, "type": "Secret Keyword", "verified_result": null }, @@ -4798,7 +4816,7 @@ "hashed_secret": "e66e7d67fdf3c596c435fc7828b13205e4950a0f", "is_secret": false, "is_verified": false, - "line_number": 150, + "line_number": 149, "type": "Secret Keyword", "verified_result": null } @@ -4844,7 +4862,7 @@ "hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e", "is_secret": false, "is_verified": false, - "line_number": 137, + "line_number": 139, "type": "Secret Keyword", "verified_result": null }, @@ -4852,7 +4870,7 @@ "hashed_secret": "e66e7d67fdf3c596c435fc7828b13205e4950a0f", "is_secret": false, "is_verified": false, - "line_number": 139, + "line_number": 141, "type": "Secret Keyword", "verified_result": null } @@ -5010,7 +5028,7 @@ "hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e", "is_secret": false, "is_verified": false, - "line_number": 122, + "line_number": 121, "type": "Secret Keyword", "verified_result": null }, @@ -5018,7 +5036,7 @@ "hashed_secret": "e66e7d67fdf3c596c435fc7828b13205e4950a0f", "is_secret": false, "is_verified": false, - "line_number": 124, + "line_number": 123, "type": "Secret Keyword", "verified_result": null } diff --git a/ibm/service/secretsmanager/data_source_ibm_sm_iam_credentials_secret.go b/ibm/service/secretsmanager/data_source_ibm_sm_iam_credentials_secret.go index 75ad6a8306..bce495303b 100644 --- a/ibm/service/secretsmanager/data_source_ibm_sm_iam_credentials_secret.go +++ b/ibm/service/secretsmanager/data_source_ibm_sm_iam_credentials_secret.go @@ -169,11 +169,6 @@ func DataSourceIbmSmIamCredentialsSecret() *schema.Resource { Computed: true, Description: "The units for the secret rotation time interval.", }, - "rotate_keys": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate.", - }, }, }, }, @@ -330,9 +325,6 @@ func dataSourceIbmSmIamCredentialsSecretRotationPolicyToMap(model secretsmanager if model.Unit != nil { modelMap["unit"] = *model.Unit } - if model.RotateKeys != nil { - modelMap["rotate_keys"] = *model.RotateKeys - } return modelMap, nil } else { return nil, fmt.Errorf("Unrecognized secretsmanagerv2.RotationPolicyIntf subtype encountered") diff --git a/ibm/service/secretsmanager/data_source_ibm_sm_iam_credentials_secret_metadata.go b/ibm/service/secretsmanager/data_source_ibm_sm_iam_credentials_secret_metadata.go index d1124752b9..f58be6333d 100644 --- a/ibm/service/secretsmanager/data_source_ibm_sm_iam_credentials_secret_metadata.go +++ b/ibm/service/secretsmanager/data_source_ibm_sm_iam_credentials_secret_metadata.go @@ -161,11 +161,6 @@ func DataSourceIbmSmIamCredentialsSecretMetadata() *schema.Resource { Computed: true, Description: "The units for the secret rotation time interval.", }, - "rotate_keys": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate.", - }, }, }, }, @@ -325,9 +320,6 @@ func dataSourceIbmSmIamCredentialsSecretMetadataRotationPolicyToMap(model secret if model.Unit != nil { modelMap["unit"] = *model.Unit } - if model.RotateKeys != nil { - modelMap["rotate_keys"] = *model.RotateKeys - } return modelMap, nil } else { return nil, fmt.Errorf("Unrecognized secretsmanagerv2.RotationPolicyIntf subtype encountered") diff --git a/ibm/service/secretsmanager/data_source_ibm_sm_private_certificate.go b/ibm/service/secretsmanager/data_source_ibm_sm_private_certificate.go index 31043b4a78..59ce4a1fa8 100644 --- a/ibm/service/secretsmanager/data_source_ibm_sm_private_certificate.go +++ b/ibm/service/secretsmanager/data_source_ibm_sm_private_certificate.go @@ -184,11 +184,6 @@ func DataSourceIbmSmPrivateCertificate() *schema.Resource { Computed: true, Description: "The units for the secret rotation time interval.", }, - "rotate_keys": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate.", - }, }, }, }, @@ -436,9 +431,6 @@ func dataSourceIbmSmPrivateCertificateRotationPolicyToMap(model secretsmanagerv2 if model.Unit != nil { modelMap["unit"] = *model.Unit } - if model.RotateKeys != nil { - modelMap["rotate_keys"] = *model.RotateKeys - } return modelMap, nil } else { return nil, fmt.Errorf("Unrecognized secretsmanagerv2.RotationPolicyIntf subtype encountered") diff --git a/ibm/service/secretsmanager/data_source_ibm_sm_private_certificate_metadata.go b/ibm/service/secretsmanager/data_source_ibm_sm_private_certificate_metadata.go index 1585e1a831..a1afb4a638 100644 --- a/ibm/service/secretsmanager/data_source_ibm_sm_private_certificate_metadata.go +++ b/ibm/service/secretsmanager/data_source_ibm_sm_private_certificate_metadata.go @@ -176,11 +176,6 @@ func DataSourceIbmSmPrivateCertificateMetadata() *schema.Resource { Computed: true, Description: "The units for the secret rotation time interval.", }, - "rotate_keys": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate.", - }, }, }, }, @@ -403,9 +398,6 @@ func dataSourceIbmSmPrivateCertificateMetadataRotationPolicyToMap(model secretsm if model.Unit != nil { modelMap["unit"] = *model.Unit } - if model.RotateKeys != nil { - modelMap["rotate_keys"] = *model.RotateKeys - } return modelMap, nil } else { return nil, fmt.Errorf("Unrecognized secretsmanagerv2.RotationPolicyIntf subtype encountered") diff --git a/ibm/service/secretsmanager/data_source_ibm_sm_username_password_secret.go b/ibm/service/secretsmanager/data_source_ibm_sm_username_password_secret.go index 5a9fa84aff..a1119f17e0 100644 --- a/ibm/service/secretsmanager/data_source_ibm_sm_username_password_secret.go +++ b/ibm/service/secretsmanager/data_source_ibm_sm_username_password_secret.go @@ -136,11 +136,6 @@ func DataSourceIbmSmUsernamePasswordSecret() *schema.Resource { Computed: true, Description: "The units for the secret rotation time interval.", }, - "rotate_keys": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate.", - }, }, }, }, @@ -296,9 +291,6 @@ func dataSourceIbmSmUsernamePasswordSecretRotationPolicyToMap(model secretsmanag if model.Unit != nil { modelMap["unit"] = *model.Unit } - if model.RotateKeys != nil { - modelMap["rotate_keys"] = *model.RotateKeys - } return modelMap, nil } else { return nil, fmt.Errorf("Unrecognized secretsmanagerv2.RotationPolicyIntf subtype encountered") diff --git a/ibm/service/secretsmanager/data_source_ibm_sm_username_password_secret_metadata.go b/ibm/service/secretsmanager/data_source_ibm_sm_username_password_secret_metadata.go index 35d24ef67b..6eada6eb8b 100644 --- a/ibm/service/secretsmanager/data_source_ibm_sm_username_password_secret_metadata.go +++ b/ibm/service/secretsmanager/data_source_ibm_sm_username_password_secret_metadata.go @@ -128,11 +128,6 @@ func DataSourceIbmSmUsernamePasswordSecretMetadata() *schema.Resource { Computed: true, Description: "The units for the secret rotation time interval.", }, - "rotate_keys": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate.", - }, }, }, }, @@ -282,9 +277,6 @@ func dataSourceIbmSmUsernamePasswordSecretMetadataRotationPolicyToMap(model secr if model.Unit != nil { modelMap["unit"] = *model.Unit } - if model.RotateKeys != nil { - modelMap["rotate_keys"] = *model.RotateKeys - } return modelMap, nil } else { return nil, fmt.Errorf("Unrecognized secretsmanagerv2.RotationPolicyIntf subtype encountered") diff --git a/ibm/service/secretsmanager/resource_ibm_sm_iam_credentials_secret.go b/ibm/service/secretsmanager/resource_ibm_sm_iam_credentials_secret.go index e47da2cee7..542275b142 100644 --- a/ibm/service/secretsmanager/resource_ibm_sm_iam_credentials_secret.go +++ b/ibm/service/secretsmanager/resource_ibm_sm_iam_credentials_secret.go @@ -113,12 +113,6 @@ func ResourceIbmSmIamCredentialsSecret() *schema.Resource { Description: "The units for the secret rotation time interval.", DiffSuppressFunc: rotationAttributesDiffSuppress, }, - "rotate_keys": &schema.Schema{ - Type: schema.TypeBool, - Optional: true, - Computed: true, - Description: "Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate.", - }, }, }, }, @@ -576,9 +570,6 @@ func resourceIbmSmIamCredentialsSecretMapToRotationPolicy(modelMap map[string]in if modelMap["unit"] != nil && modelMap["unit"].(string) != "" { model.Unit = core.StringPtr(modelMap["unit"].(string)) } - if modelMap["rotate_keys"] != nil { - model.RotateKeys = core.BoolPtr(modelMap["rotate_keys"].(bool)) - } return model, nil } @@ -594,8 +585,5 @@ func resourceIbmSmIamCredentialsSecretRotationPolicyToMap(modelIntf secretsmanag if model.Unit != nil { modelMap["unit"] = model.Unit } - if model.RotateKeys != nil { - modelMap["rotate_keys"] = model.RotateKeys - } return modelMap, nil } diff --git a/ibm/service/secretsmanager/resource_ibm_sm_private_certificate.go b/ibm/service/secretsmanager/resource_ibm_sm_private_certificate.go index dfbbc39e69..7fe6c10bd6 100644 --- a/ibm/service/secretsmanager/resource_ibm_sm_private_certificate.go +++ b/ibm/service/secretsmanager/resource_ibm_sm_private_certificate.go @@ -245,9 +245,8 @@ func ResourceIbmSmPrivateCertificate() *schema.Resource { }, "key_algorithm": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, ForceNew: true, - Default: "RSA2048", Description: "The identifier for the cryptographic algorithm to be used to generate the public key that is associated with the certificate.The algorithm that you select determines the encryption algorithm (`RSA` or `ECDSA`) and key size to be used to generate keys and sign certificates. For longer living certificates, it is recommended to use longer keys to provide more encryption protection. Allowed values: RSA2048, RSA4096, EC256, EC384.", }, "next_rotation_date": &schema.Schema{ diff --git a/website/docs/d/sm_iam_credentials_secret.html.markdown b/website/docs/d/sm_iam_credentials_secret.html.markdown index 8355a081f0..79fe4ce3c0 100644 --- a/website/docs/d/sm_iam_credentials_secret.html.markdown +++ b/website/docs/d/sm_iam_credentials_secret.html.markdown @@ -93,7 +93,6 @@ Nested scheme for **rotation**: * `auto_rotate` - (Boolean) Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval. * `interval` - (Integer) The length of the secret rotation time interval. * Constraints: The minimum value is `1`. - * `rotate_keys` - (Boolean) Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate. * `unit` - (String) The units for the secret rotation time interval. * Constraints: Allowable values are: `day`, `month`. diff --git a/website/docs/d/sm_iam_credentials_secret_metadata.html.markdown b/website/docs/d/sm_iam_credentials_secret_metadata.html.markdown index e429c1892f..1db8123221 100644 --- a/website/docs/d/sm_iam_credentials_secret_metadata.html.markdown +++ b/website/docs/d/sm_iam_credentials_secret_metadata.html.markdown @@ -74,7 +74,6 @@ Nested scheme for **rotation**: * `auto_rotate` - (Boolean) Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval. * `interval` - (Integer) The length of the secret rotation time interval. * Constraints: The minimum value is `1`. - * `rotate_keys` - (Boolean) Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate. * `unit` - (String) The units for the secret rotation time interval. * Constraints: Allowable values are: `day`, `month`. diff --git a/website/docs/d/sm_private_certificate.html.markdown b/website/docs/d/sm_private_certificate.html.markdown index 22bc586770..abecd98dc0 100644 --- a/website/docs/d/sm_private_certificate.html.markdown +++ b/website/docs/d/sm_private_certificate.html.markdown @@ -119,7 +119,6 @@ In addition to all argument references listed, you can access the following attr * `auto_rotate` - (Boolean) Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval. * `interval` - (Integer) The length of the secret rotation time interval. * Constraints: The minimum value is `1`. - * `rotate_keys` - (Boolean) Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate. * `unit` - (String) The units for the secret rotation time interval. * Constraints: Allowable values are: `day`, `month`. diff --git a/website/docs/d/sm_private_certificate_metadata.html.markdown b/website/docs/d/sm_private_certificate_metadata.html.markdown index caf491c86c..4d16d2b1a8 100644 --- a/website/docs/d/sm_private_certificate_metadata.html.markdown +++ b/website/docs/d/sm_private_certificate_metadata.html.markdown @@ -90,7 +90,6 @@ Nested scheme for **rotation**: * `auto_rotate` - (Boolean) Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval. * `interval` - (Integer) The length of the secret rotation time interval. * Constraints: The minimum value is `1`. - * `rotate_keys` - (Boolean) Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate. * `unit` - (String) The units for the secret rotation time interval. * Constraints: Allowable values are: `day`, `month`. diff --git a/website/docs/d/sm_username_password_secret.html.markdown b/website/docs/d/sm_username_password_secret.html.markdown index c18a55df9c..64768e067f 100644 --- a/website/docs/d/sm_username_password_secret.html.markdown +++ b/website/docs/d/sm_username_password_secret.html.markdown @@ -88,7 +88,6 @@ Nested scheme for **rotation**: * `auto_rotate` - (Boolean) Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval. * `interval` - (Integer) The length of the secret rotation time interval. * Constraints: The minimum value is `1`. - * `rotate_keys` - (Boolean) Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate. * `unit` - (String) The units for the secret rotation time interval. * Constraints: Allowable values are: `day`, `month`. diff --git a/website/docs/d/sm_username_password_secret_metadata.html.markdown b/website/docs/d/sm_username_password_secret_metadata.html.markdown index e4a10d832b..781f524f1a 100644 --- a/website/docs/d/sm_username_password_secret_metadata.html.markdown +++ b/website/docs/d/sm_username_password_secret_metadata.html.markdown @@ -69,7 +69,6 @@ Nested scheme for **rotation**: * `auto_rotate` - (Boolean) Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval. * `interval` - (Integer) The length of the secret rotation time interval. * Constraints: The minimum value is `1`. - * `rotate_keys` - (Boolean) Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate. * `unit` - (String) The units for the secret rotation time interval. * Constraints: Allowable values are: `day`, `month`. diff --git a/website/docs/r/sm_iam_credentials_secret.html.markdown b/website/docs/r/sm_iam_credentials_secret.html.markdown index 2f3e78f8f6..3c108eb82c 100644 --- a/website/docs/r/sm_iam_credentials_secret.html.markdown +++ b/website/docs/r/sm_iam_credentials_secret.html.markdown @@ -55,7 +55,6 @@ Nested scheme for **rotation**: * `auto_rotate` - (Optional, Boolean) Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval. * `interval` - (Optional, Integer) The length of the secret rotation time interval. * Constraints: The minimum value is `1`. - * `rotate_keys` - (Optional, Boolean) Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate. * `unit` - (Optional, String) The units for the secret rotation time interval. * Constraints: Allowable values are: `day`, `month`. * `secret_group_id` - (Optional, Forces new resource, String) A v4 UUID identifier, or `default` secret group. diff --git a/website/docs/r/sm_private_certificate.html.markdown b/website/docs/r/sm_private_certificate.html.markdown index 64f1bb83b7..98c1d2c122 100644 --- a/website/docs/r/sm_private_certificate.html.markdown +++ b/website/docs/r/sm_private_certificate.html.markdown @@ -56,7 +56,6 @@ Nested scheme for **rotation**: * `auto_rotate` - (Optional, Boolean) Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval. * `interval` - (Optional, Integer) The length of the secret rotation time interval. * Constraints: The minimum value is `1`. - * `rotate_keys` - (Optional, Boolean) Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate. * `unit` - (Optional, String) The units for the secret rotation time interval. * Constraints: Allowable values are: `day`, `month`. * `secret_group_id` - (Optional, Forces new resource, String) A v4 UUID identifier, or `default` secret group. diff --git a/website/docs/r/sm_private_certificate_configuration_template.html.markdown b/website/docs/r/sm_private_certificate_configuration_template.html.markdown index d34b20e904..00f6d033fd 100644 --- a/website/docs/r/sm_private_certificate_configuration_template.html.markdown +++ b/website/docs/r/sm_private_certificate_configuration_template.html.markdown @@ -67,6 +67,7 @@ Review the argument reference that you can specify for your resource. * Constraints: The list items must match regular expression `/^[a-zA-Z]+$/`. The maximum length is `100` items. The minimum length is `0` items. * `locality` - (Optional, Forces new resource, List) The Locality (L) values to define in the subject field of the resulting certificate. * Constraints: The list items must match regular expression `/(.*?)/`. The maximum length is `10` items. The minimum length is `0` items. +* `max_ttl` - (Optional, String) The maximum time-to-live (TTL) for certificates that are created by this template. * `name` - (Required, String) A human-readable unique name to assign to your configuration. * `organization` - (Optional, Forces new resource, List) The Organization (O) values to define in the subject field of the resulting certificate. * Constraints: The list items must match regular expression `/(.*?)/`. The maximum length is `10` items. The minimum length is `0` items. @@ -84,6 +85,7 @@ Review the argument reference that you can specify for your resource. * Constraints: The maximum length is `64` characters. The minimum length is `32` characters. The value must match regular expression `/[^a-fA-F0-9]/`. * `street_address` - (Optional, Forces new resource, List) The street address values to define in the subject field of the resulting certificate. * Constraints: The list items must match regular expression `/(.*?)/`. The maximum length is `10` items. The minimum length is `0` items. +* `ttl` - The requested time-to-live (TTL) for certificates that are created by this template. This field's value can't be longer than the max_ttl limit. * `use_csr_common_name` - (Optional, Boolean) When used with the `private_cert_configuration_action_sign_csr` action, this field determines whether to use the common name (CN) from a certificate signing request (CSR) instead of the CN that's included in the data of the certificate.Does not include any requested Subject Alternative Names (SANs) in the CSR. To use the alternative names, include the `use_csr_sans` property. * `use_csr_sans` - (Optional, Boolean) When used with the `private_cert_configuration_action_sign_csr` action, this field determines whether to use the Subject Alternative Names(SANs) from a certificate signing request (CSR) instead of the SANs that are included in the data of the certificate.Does not include the common name in the CSR. To use the common name, include the `use_csr_common_name` property. diff --git a/website/docs/r/sm_username_password_secret.html.markdown b/website/docs/r/sm_username_password_secret.html.markdown index b8a07c3af0..fdb4605f15 100644 --- a/website/docs/r/sm_username_password_secret.html.markdown +++ b/website/docs/r/sm_username_password_secret.html.markdown @@ -55,7 +55,6 @@ Nested scheme for **rotation**: * `auto_rotate` - (Optional, Boolean) Determines whether Secrets Manager rotates your secret automatically.Default is `false`. If `auto_rotate` is set to `true` the service rotates your secret based on the defined interval. * `interval` - (Optional, Integer) The length of the secret rotation time interval. * Constraints: The minimum value is `1`. - * `rotate_keys` - (Optional, Boolean) Determines whether Secrets Manager rotates the private key for your public certificate automatically.Default is `false`. If it is set to `true`, the service generates and stores a new private key for your rotated certificate. * `unit` - (Optional, String) The units for the secret rotation time interval. * Constraints: Allowable values are: `day`, `month`. * `secret_group_id` - (Optional, Forces new resource, String) A v4 UUID identifier, or `default` secret group. From 38dd47ede177ae206b89822ef9c6aeb6853ef223 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Dec 2023 21:13:14 +0000 Subject: [PATCH 119/132] dependabot: bump crazy-max/ghaction-import-gpg from 6.0.0 to 6.1.0 Bumps [crazy-max/ghaction-import-gpg](https://github.com/crazy-max/ghaction-import-gpg) from 6.0.0 to 6.1.0. - [Release notes](https://github.com/crazy-max/ghaction-import-gpg/releases) - [Commits](https://github.com/crazy-max/ghaction-import-gpg/compare/v6.0.0...v6.1.0) --- updated-dependencies: - dependency-name: crazy-max/ghaction-import-gpg dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15f3a980ec..2bf9694fad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: - name: Import GPG key id: import_gpg - uses: crazy-max/ghaction-import-gpg@v6.0.0 + uses: crazy-max/ghaction-import-gpg@v6.1.0 with: # These secrets will need to be configured for the repository: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} From 7bdec7ee8a6c2996e6f05e56d15a6f3d3baef5ff Mon Sep 17 00:00:00 2001 From: Shuaib Bapputty <42908782+shuaibabubakker@users.noreply.github.com> Date: Tue, 2 Jan 2024 12:34:57 +0530 Subject: [PATCH 120/132] fix: add multipart support for mqcloud service (#5010) * fix: multipart fix for mqcloud (cherry picked from commit e7253421db30943d3582ce07d9504a2117f30ce1) * enable enforceReservedDeploymentPlan --------- Co-authored-by: Shuaib Bapputty --- examples/ibm-mqcloud/README.md | 330 ++++++++++++++---- examples/ibm-mqcloud/main.tf | 27 +- examples/ibm-mqcloud/variables.tf | 62 ++-- go.mod | 2 +- go.sum | 4 +- ibm/acctest/acctest.go | 42 ++- ibm/conns/config.go | 22 +- .../data_source_ibm_mqcloud_application.go | 6 +- ...ata_source_ibm_mqcloud_application_test.go | 40 +-- ...source_ibm_mqcloud_keystore_certificate.go | 4 +- ...e_ibm_mqcloud_keystore_certificate_test.go | 59 +--- .../data_source_ibm_mqcloud_queue_manager.go | 4 +- ...a_source_ibm_mqcloud_queue_manager_test.go | 13 +- ...urce_ibm_mqcloud_truststore_certificate.go | 4 +- ...ibm_mqcloud_truststore_certificate_test.go | 58 +-- .../mqcloud/data_source_ibm_mqcloud_user.go | 4 +- .../data_source_ibm_mqcloud_user_test.go | 42 +-- .../resource_ibm_mqcloud_application_test.go | 33 +- ...source_ibm_mqcloud_keystore_certificate.go | 36 +- ...e_ibm_mqcloud_keystore_certificate_test.go | 47 +-- .../resource_ibm_mqcloud_queue_manager.go | 9 +- ...resource_ibm_mqcloud_queue_manager_test.go | 15 +- ...urce_ibm_mqcloud_truststore_certificate.go | 36 +- ...ibm_mqcloud_truststore_certificate_test.go | 47 +-- .../mqcloud/resource_ibm_mqcloud_user_test.go | 36 +- ibm/service/mqcloud/utils.go | 7 +- ...mqcloud_keystore_certificate.html.markdown | 9 +- .../r/mqcloud_queue_manager.html.markdown | 2 +- ...cloud_truststore_certificate.html.markdown | 9 +- 29 files changed, 448 insertions(+), 561 deletions(-) diff --git a/examples/ibm-mqcloud/README.md b/examples/ibm-mqcloud/README.md index ae8ef2a8dd..05d15097c6 100644 --- a/examples/ibm-mqcloud/README.md +++ b/examples/ibm-mqcloud/README.md @@ -1,14 +1,21 @@ -# Example for MqcloudV1 +# Examples for MQ on Cloud -This example illustrates how to use the MqcloudV1 +These examples illustrate how to use the resources and data sources associated with MQ on Cloud. -The following types of resources are supported: +The following resources are supported: +* ibm_mqcloud_queue_manager +* ibm_mqcloud_application +* ibm_mqcloud_user +* ibm_mqcloud_keystore_certificate +* ibm_mqcloud_truststore_certificate -* mqcloud_queue_manager -* mqcloud_application -* mqcloud_user -* mqcloud_keystore_certificate -* mqcloud_truststore_certificate +The following data sources are supported: +* ibm_mqcloud_queue_manager +* ibm_mqcloud_queue_manager_status +* ibm_mqcloud_application +* ibm_mqcloud_user +* ibm_mqcloud_truststore_certificate +* ibm_mqcloud_keystore_certificate ## Usage @@ -22,13 +29,12 @@ $ terraform apply Run `terraform destroy` when you don't need these resources. +## MQ on Cloud resources -## MqcloudV1 resources - -mqcloud_queue_manager resource: +### Resource: ibm_mqcloud_queue_manager ```hcl -resource "mqcloud_queue_manager" "mqcloud_queue_manager_instance" { +resource "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" { service_instance_guid = var.mqcloud_queue_manager_service_instance_guid name = var.mqcloud_queue_manager_name display_name = var.mqcloud_queue_manager_display_name @@ -37,95 +43,301 @@ resource "mqcloud_queue_manager" "mqcloud_queue_manager_instance" { version = var.mqcloud_queue_manager_version } ``` -mqcloud_application resource: + +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | +| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true | +| name | A queue manager name conforming to MQ restrictions. | `string` | true | +| display_name | A displayable name for the queue manager - limited only in length. | `string` | false | +| location | The locations in which the queue manager could be deployed. | `string` | true | +| size | The queue manager sizes of deployment available. Deployment of lite queue managers for aws_us_east_1 and aws_eu_west_1 locations is not available. | `string` | true | +| version | The MQ version of the queue manager. | `string` | false | + +#### Outputs + +| Name | Description | +|------|-------------| +| status_uri | A reference uri to get deployment status of the queue manager. | +| web_console_url | The url through which to access the web console for this queue manager. | +| rest_api_endpoint_url | The url through which to access REST APIs for this queue manager. | +| administrator_api_endpoint_url | The url through which to access the Admin REST APIs for this queue manager. | +| connection_info_uri | The uri through which the CDDT for this queue manager can be obtained. | +| date_created | RFC3339 formatted UTC date for when the queue manager was created. | +| upgrade_available | Describes whether an upgrade is available for this queue manager. | +| available_upgrade_versions_uri | The uri through which the available versions to upgrade to can be found for this queue manager. | +| href | The URL for this queue manager. | +| queue_manager_id | The ID of the queue manager which was allocated on creation, and can be used for delete calls. | + +### Resource: ibm_mqcloud_application ```hcl -resource "mqcloud_application" "mqcloud_application_instance" { +resource "ibm_mqcloud_application" "mqcloud_application_instance" { service_instance_guid = var.mqcloud_application_service_instance_guid name = var.mqcloud_application_name } ``` -mqcloud_user resource: + +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | +| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true | +| name | The name of the application - conforming to MQ rules. | `string` | true | + +#### Outputs + +| Name | Description | +|------|-------------| +| create_api_key_uri | The URI to create a new apikey for the application. | +| href | The URL for this application. | +| application_id | The ID of the application which was allocated on creation, and can be used for delete calls. | + +### Resource: ibm_mqcloud_user ```hcl -resource "mqcloud_user" "mqcloud_user_instance" { +resource "ibm_mqcloud_user" "mqcloud_user_instance" { service_instance_guid = var.mqcloud_user_service_instance_guid name = var.mqcloud_user_name email = var.mqcloud_user_email } ``` -mqcloud_keystore_certificate resource: + +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | +| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true | +| name | The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance. | `string` | true | +| email | The email of the user. | `string` | true | + +#### Outputs + +| Name | Description | +|------|-------------| +| href | The URL for the user details. | +| user_id | The ID of the user which was allocated on creation, and can be used for delete calls. | + +### Resource: ibm_mqcloud_keystore_certificate ```hcl -resource "mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { +resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { service_instance_guid = var.mqcloud_keystore_certificate_service_instance_guid queue_manager_id = var.mqcloud_keystore_certificate_queue_manager_id label = var.mqcloud_keystore_certificate_label + certificate_file = var.mqcloud_keystore_certificate_certificate_file } ``` -mqcloud_truststore_certificate resource: + +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | +| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true | +| queue_manager_id | The id of the queue manager to retrieve its full details. | `string` | true | +| label | The label to use for the certificate to be uploaded. | `string` | true | +| certificate_file | The filename and path of the certificate to be uploaded. | `base64-encoded string` | true | + +#### Outputs + +| Name | Description | +|------|-------------| +| certificate_type | The type of certificate. | +| fingerprint_sha256 | Fingerprint SHA256. | +| subject_dn | Subject's Distinguished Name. | +| subject_cn | Subject's Common Name. | +| issuer_dn | Issuer's Distinguished Name. | +| issuer_cn | Issuer's Common Name. | +| issued | Date certificate was issued. | +| expiry | Expiry date for the certificate. | +| is_default | Indicates whether it is the queue manager's default certificate. | +| dns_names_total_count | The total count of dns names. | +| dns_names | The list of DNS names. | +| href | The URL for this key store certificate. | +| certificate_id | ID of the certificate. | + +### Resource: ibm_mqcloud_truststore_certificate ```hcl -resource "mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { +resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { service_instance_guid = var.mqcloud_truststore_certificate_service_instance_guid queue_manager_id = var.mqcloud_truststore_certificate_queue_manager_id label = var.mqcloud_truststore_certificate_label + certificate_file = var.mqcloud_truststore_certificate_certificate_file } ``` -## MqcloudV1 data sources +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | +| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true | +| queue_manager_id | The id of the queue manager to retrieve its full details. | `string` | true | +| label | The label to use for the certificate to be uploaded. | `string` | true | +| certificate_file | The filename and path of the certificate to be uploaded. | `base64-encoded string` | true | + +#### Outputs -mqcloud_queue_manager data source: +| Name | Description | +|------|-------------| +| certificate_type | The type of certificate. | +| fingerprint_sha256 | Fingerprint SHA256. | +| subject_dn | Subject's Distinguished Name. | +| subject_cn | Subject's Common Name. | +| issuer_dn | Issuer's Distinguished Name. | +| issuer_cn | Issuer's Common Name. | +| issued | The Date the certificate was issued. | +| expiry | Expiry date for the certificate. | +| trusted | Indicates whether a certificate is trusted. | +| href | The URL for this trust store certificate. | +| certificate_id | Id of the certificate. | + +## MQ on Cloud data sources + +### Data source: ibm_mqcloud_queue_manager ```hcl -data "mqcloud_queue_manager" "mqcloud_queue_manager_instance" { - service_instance_guid = var.mqcloud_queue_manager_service_instance_guid - name = var.mqcloud_queue_manager_name +data "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" { + service_instance_guid = var.data_mqcloud_queue_manager_service_instance_guid + name = var.data_mqcloud_queue_manager_name } ``` -mqcloud_queue_manager_status data source: + +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true | +| name | A queue manager name conforming to MQ restrictions. | `string` | false | + +#### Outputs + +| Name | Description | +|------|-------------| +| queue_managers | List of queue managers. | + +### Data source: ibm_mqcloud_queue_manager_status ```hcl -data "mqcloud_queue_manager_status" "mqcloud_queue_manager_status_instance" { +data "ibm_mqcloud_queue_manager_status" "mqcloud_queue_manager_status_instance" { service_instance_guid = var.mqcloud_queue_manager_status_service_instance_guid queue_manager_id = var.mqcloud_queue_manager_status_queue_manager_id } ``` -mqcloud_application data source: + +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true | +| queue_manager_id | The id of the queue manager to retrieve its full details. | `string` | true | + +#### Outputs + +| Name | Description | +|------|-------------| +| status | The deploying and failed states are not queue manager states, they are states which can occur when the request to deploy has been fired, or with that request has failed without producing a queue manager to have any state. The other states map to the queue manager states. State "ending" is either quiesing or ending immediately. State "ended" is either ended normally or endedimmediately. The others map one to one with queue manager states. | + +### Data source: ibm_mqcloud_application ```hcl -data "mqcloud_application" "mqcloud_application_instance" { - service_instance_guid = var.mqcloud_application_service_instance_guid - name = var.mqcloud_application_name +data "ibm_mqcloud_application" "mqcloud_application_instance" { + service_instance_guid = var.data_mqcloud_application_service_instance_guid + name = var.data_mqcloud_application_name } ``` -mqcloud_user data source: + +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true | +| name | The name of the application - conforming to MQ rules. | `string` | false | + +#### Outputs + +| Name | Description | +|------|-------------| +| applications | List of applications. | + +### Data source: ibm_mqcloud_user ```hcl -data "mqcloud_user" "mqcloud_user_instance" { - service_instance_guid = var.mqcloud_user_service_instance_guid - name = var.mqcloud_user_name +data "ibm_mqcloud_user" "mqcloud_user_instance" { + service_instance_guid = var.data_mqcloud_user_service_instance_guid + name = var.data_mqcloud_user_name } ``` -mqcloud_truststore_certificate data source: + +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true | +| name | The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance. | `string` | false | + +#### Outputs + +| Name | Description | +|------|-------------| +| users | List of users. | + +### Data source: ibm_mqcloud_truststore_certificate ```hcl -data "mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { - service_instance_guid = var.mqcloud_truststore_certificate_service_instance_guid - queue_manager_id = var.mqcloud_truststore_certificate_queue_manager_id - label = var.mqcloud_truststore_certificate_label +data "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { + service_instance_guid = var.data_mqcloud_truststore_certificate_service_instance_guid + queue_manager_id = var.data_mqcloud_truststore_certificate_queue_manager_id + label = var.data_mqcloud_truststore_certificate_label } ``` -mqcloud_keystore_certificate data source: + +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true | +| queue_manager_id | The id of the queue manager to retrieve its full details. | `string` | true | +| label | Certificate label in queue manager store. | `string` | false | + +#### Outputs + +| Name | Description | +|------|-------------| +| total_count | The total count of trust store certificates. | +| trust_store | The list of trust store certificates. | + +### Data source: ibm_mqcloud_keystore_certificate ```hcl -data "mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { - service_instance_guid = var.mqcloud_keystore_certificate_service_instance_guid - queue_manager_id = var.mqcloud_keystore_certificate_queue_manager_id - label = var.mqcloud_keystore_certificate_label +data "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { + service_instance_guid = var.data_mqcloud_keystore_certificate_service_instance_guid + queue_manager_id = var.data_mqcloud_keystore_certificate_queue_manager_id + label = var.data_mqcloud_keystore_certificate_label } ``` +#### Inputs + +| Name | Description | Type | Required | +|------|-------------|------|---------| +| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true | +| queue_manager_id | The id of the queue manager to retrieve its full details. | `string` | true | +| label | Certificate label in queue manager store. | `string` | false | + +#### Outputs + +| Name | Description | +|------|-------------| +| total_count | The total count of key store certificates. | +| key_store | The list of key store certificates. | + ## Assumptions 1. TODO @@ -145,31 +357,3 @@ data "mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { | Name | Version | |------|---------| | ibm | 1.13.1 | - -## Inputs - -| Name | Description | Type | Required | -|------|-------------|------|---------| -| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | -| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true | -| name | A queue manager name conforming to MQ restrictions. | `string` | true | -| display_name | A displayable name for the queue manager - limited only in length. | `string` | false | -| location | The locations in which the queue manager could be deployed. | `string` | true | -| size | The queue manager sizes of deployment available. Deployment of lite queue managers for aws_us_east_1 and aws_eu_west_1 locations is not available. | `string` | true | -| version | The MQ version of the queue manager. | `string` | false | -| name | The name of the application - conforming to MQ rules. | `string` | true | -| name | The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance. | `string` | true | -| email | The email of the user. | `string` | true | -| queue_manager_id | The id of the queue manager to retrieve its full details. | `string` | true | -| label | Certificate label in queue manager store. | `string` | true | - -## Outputs - -| Name | Description | -|------|-------------| -| mqcloud_queue_manager | mqcloud_queue_manager object | -| mqcloud_queue_manager_status | mqcloud_queue_manager_status object | -| mqcloud_application | mqcloud_application object | -| mqcloud_user | mqcloud_user object | -| mqcloud_truststore_certificate | mqcloud_truststore_certificate object | -| mqcloud_keystore_certificate | mqcloud_keystore_certificate object | diff --git a/examples/ibm-mqcloud/main.tf b/examples/ibm-mqcloud/main.tf index b89e08c72a..16dc2df7dc 100644 --- a/examples/ibm-mqcloud/main.tf +++ b/examples/ibm-mqcloud/main.tf @@ -30,6 +30,7 @@ resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instan service_instance_guid = var.mqcloud_keystore_certificate_service_instance_guid queue_manager_id = var.mqcloud_keystore_certificate_queue_manager_id label = var.mqcloud_keystore_certificate_label + certificate_file = var.mqcloud_keystore_certificate_certificate_file } // Provision mqcloud_truststore_certificate resource instance @@ -37,6 +38,7 @@ resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_in service_instance_guid = var.mqcloud_truststore_certificate_service_instance_guid queue_manager_id = var.mqcloud_truststore_certificate_queue_manager_id label = var.mqcloud_truststore_certificate_label + certificate_file = var.mqcloud_truststore_certificate_certificate_file } // Data source is not linked to a resource instance @@ -44,9 +46,8 @@ resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_in /* // Create mqcloud_queue_manager data source data "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" { - service_instance_guid = var.mqcloud_queue_manager_service_instance_guid - - name = var.mqcloud_queue_manager_name + service_instance_guid = var.data_mqcloud_queue_manager_service_instance_guid + name = var.data_mqcloud_queue_manager_name } */ @@ -65,8 +66,8 @@ data "ibm_mqcloud_queue_manager_status" "mqcloud_queue_manager_status_instance" /* // Create mqcloud_application data source data "ibm_mqcloud_application" "mqcloud_application_instance" { - service_instance_guid = var.mqcloud_application_service_instance_guid - name = var.mqcloud_application_name + service_instance_guid = var.data_mqcloud_application_service_instance_guid + name = var.data_mqcloud_application_name } */ @@ -75,8 +76,8 @@ data "ibm_mqcloud_application" "mqcloud_application_instance" { /* // Create mqcloud_user data source data "ibm_mqcloud_user" "mqcloud_user_instance" { - service_instance_guid = var.mqcloud_user_service_instance_guid - name = var.mqcloud_user_name + service_instance_guid = var.data_mqcloud_user_service_instance_guid + name = var.data_mqcloud_user_name } */ @@ -85,9 +86,9 @@ data "ibm_mqcloud_user" "mqcloud_user_instance" { /* // Create mqcloud_truststore_certificate data source data "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { - service_instance_guid = var.mqcloud_truststore_certificate_service_instance_guid - queue_manager_id = var.mqcloud_truststore_certificate_queue_manager_id - label = var.mqcloud_truststore_certificate_label + service_instance_guid = var.data_mqcloud_truststore_certificate_service_instance_guid + queue_manager_id = var.data_mqcloud_truststore_certificate_queue_manager_id + label = var.data_mqcloud_truststore_certificate_label } */ @@ -96,8 +97,8 @@ data "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instan /* // Create mqcloud_keystore_certificate data source data "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { - service_instance_guid = var.mqcloud_keystore_certificate_service_instance_guid - queue_manager_id = var.mqcloud_keystore_certificate_queue_manager_id - label = var.mqcloud_keystore_certificate_label + service_instance_guid = var.data_mqcloud_keystore_certificate_service_instance_guid + queue_manager_id = var.data_mqcloud_keystore_certificate_queue_manager_id + label = var.data_mqcloud_keystore_certificate_label } */ diff --git a/examples/ibm-mqcloud/variables.tf b/examples/ibm-mqcloud/variables.tf index dba4d0fff0..66a9dda4ae 100644 --- a/examples/ibm-mqcloud/variables.tf +++ b/examples/ibm-mqcloud/variables.tf @@ -22,7 +22,7 @@ variable "mqcloud_queue_manager_display_name" { variable "mqcloud_queue_manager_location" { description = "The locations in which the queue manager could be deployed." type = string - default = "reserved-eu-fr-cluster-f884" + default = "reserved-eu-de-cluster-f884" } variable "mqcloud_queue_manager_size" { description = "The queue manager sizes of deployment available. Deployment of lite queue managers for aws_us_east_1 and aws_eu_west_1 locations is not available." @@ -53,24 +53,6 @@ variable "mqcloud_user_service_instance_guid" { type = string default = "Service Instance ID" } - -// Data source arguments for mqcloud_application -variable "mqcloud_application_service_instance_guid" { - description = "The GUID that uniquely identifies the MQ on Cloud service instance." - type = string - default = "Service Instance ID" -} -variable "mqcloud_user_name" { - description = "The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance." - type = string - default = "name" -} - -variable "mqcloud_application_name" { - description = "The name of the application - conforming to MQ rules." - type = string - default = "name" -} variable "mqcloud_user_name" { description = "The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance." type = string @@ -94,10 +76,15 @@ variable "mqcloud_keystore_certificate_queue_manager_id" { default = "Queue Manager ID" } variable "mqcloud_keystore_certificate_label" { - description = "Certificate label in queue manager store." + description = "The label to use for the certificate to be uploaded." type = string default = "label" } +variable "mqcloud_keystore_certificate_certificate_file" { + description = "The filename and path of the certificate to be uploaded." + type = string + default = "SGVsbG8gd29ybGQ=" +} // Resource arguments for mqcloud_truststore_certificate variable "mqcloud_truststore_certificate_service_instance_guid" { @@ -110,21 +97,24 @@ variable "mqcloud_truststore_certificate_queue_manager_id" { type = string default = "Queue Manager ID" } - variable "mqcloud_truststore_certificate_label" { - description = "Certificate label in queue manager store." + description = "The label to use for the certificate to be uploaded." type = string default = "label" } +variable "mqcloud_truststore_certificate_certificate_file" { + description = "The filename and path of the certificate to be uploaded." + type = string + default = "SGVsbG8gd29ybGQ=" +} // Data source arguments for mqcloud_queue_manager -variable "mqcloud_queue_manager_service_instance_guid" { +variable "data_mqcloud_queue_manager_service_instance_guid" { description = "The GUID that uniquely identifies the MQ on Cloud service instance." type = string default = "Service Instance ID" } - -variable "mqcloud_queue_manager_name" { +variable "data_mqcloud_queue_manager_name" { description = "A queue manager name conforming to MQ restrictions." type = string default = "name" @@ -143,60 +133,58 @@ variable "mqcloud_queue_manager_status_queue_manager_id" { } // Data source arguments for mqcloud_application -variable "mqcloud_application_service_instance_guid" { +variable "data_mqcloud_application_service_instance_guid" { description = "The GUID that uniquely identifies the MQ on Cloud service instance." type = string default = "Service Instance ID" } - -variable "mqcloud_application_name" { +variable "data_mqcloud_application_name" { description = "The name of the application - conforming to MQ rules." type = string default = "name" } // Data source arguments for mqcloud_user -variable "mqcloud_user_service_instance_guid" { +variable "data_mqcloud_user_service_instance_guid" { description = "The GUID that uniquely identifies the MQ on Cloud service instance." type = string default = "Service Instance ID" } - -variable "mqcloud_user_name" { +variable "data_mqcloud_user_name" { description = "The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance." type = string default = "name" } // Data source arguments for mqcloud_truststore_certificate -variable "mqcloud_truststore_certificate_service_instance_guid" { +variable "data_mqcloud_truststore_certificate_service_instance_guid" { description = "The GUID that uniquely identifies the MQ on Cloud service instance." type = string default = "Service Instance ID" } -variable "mqcloud_truststore_certificate_queue_manager_id" { +variable "data_mqcloud_truststore_certificate_queue_manager_id" { description = "The id of the queue manager to retrieve its full details." type = string default = "Queue Manager ID" } -variable "mqcloud_truststore_certificate_label" { +variable "data_mqcloud_truststore_certificate_label" { description = "Certificate label in queue manager store." type = string default = "label" } // Data source arguments for mqcloud_keystore_certificate -variable "mqcloud_keystore_certificate_service_instance_guid" { +variable "data_mqcloud_keystore_certificate_service_instance_guid" { description = "The GUID that uniquely identifies the MQ on Cloud service instance." type = string default = "Service Instance ID" } -variable "mqcloud_keystore_certificate_queue_manager_id" { +variable "data_mqcloud_keystore_certificate_queue_manager_id" { description = "The id of the queue manager to retrieve its full details." type = string default = "Queue Manager ID" } -variable "mqcloud_keystore_certificate_label" { +variable "data_mqcloud_keystore_certificate_label" { description = "Certificate label in queue manager store." type = string default = "label" diff --git a/go.mod b/go.mod index f90c4389cf..2669b596d2 100644 --- a/go.mod +++ b/go.mod @@ -62,7 +62,7 @@ require ( ) require ( - github.com/IBM/mqcloud-go-sdk v0.0.0-20231207105140-14d858932788 + github.com/IBM/mqcloud-go-sdk v0.0.4 github.com/IBM/sarama v1.41.2 k8s.io/utils v0.0.0-20230313181309-38a27ef9d749 sigs.k8s.io/controller-runtime v0.14.1 diff --git a/go.sum b/go.sum index b3be0e1e92..3d4a146889 100644 --- a/go.sum +++ b/go.sum @@ -154,8 +154,8 @@ github.com/IBM/ibm-hpcs-uko-sdk v0.0.20-beta/go.mod h1:MLVNHMYoKsvovJZ4v1gQCpIYt github.com/IBM/keyprotect-go-client v0.5.1/go.mod h1:5TwDM/4FRJq1ZOlwQL1xFahLWQ3TveR88VmL1u3njyI= github.com/IBM/keyprotect-go-client v0.12.2 h1:Cjxcqin9Pl0xz3MnxdiVd4v/eIa79xL3hQpSbwOr/DQ= github.com/IBM/keyprotect-go-client v0.12.2/go.mod h1:yr8h2noNgU8vcbs+vhqoXp3Lmv73PI0zAc6VMgFvWwM= -github.com/IBM/mqcloud-go-sdk v0.0.0-20231207105140-14d858932788 h1:cIT0YSzqMGqxM3OJQx1gp4gtYYy9U35O0tVdcFHOgwc= -github.com/IBM/mqcloud-go-sdk v0.0.0-20231207105140-14d858932788/go.mod h1:R4NBbDMygpHiFywUnOdV0UfBZap4HcHa3QXLlACr9TU= +github.com/IBM/mqcloud-go-sdk v0.0.4 h1:gqMpoU5a0qJ0GETG4PQrkgeEEoaQLvbxRJnEe6ytvC4= +github.com/IBM/mqcloud-go-sdk v0.0.4/go.mod h1:gQptHC6D+rxfg0muRFFGvTDmvl4YfiDE0uXkaRRewRk= github.com/IBM/networking-go-sdk v0.42.2 h1:caqjx4jyFHi10Vlf3skHvlL6K3YJRVstsmCBmvdyqkA= github.com/IBM/networking-go-sdk v0.42.2/go.mod h1:lTUZwtUkMANMnrLHFIgRhHrkBfwASY/Iho1fabaPHxo= github.com/IBM/platform-services-go-sdk v0.55.0 h1:W598xZanL61bwd8O2DQexr4qjIr+/tP0Y845zoms5yA= diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 8a90bdea06..16bfc30ab4 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -126,10 +126,14 @@ var ( // MQ on Cloud var ( - MqcloudInstanceID string - MqcloudQueueManagerID string - MqcloudKSCertFilePath string - MqcloudTSCertFilePath string + MqcloudConfigEndpoint string + MqcloudInstanceID string + MqcloudQueueManagerID string + MqcloudKSCertFilePath string + MqcloudTSCertFilePath string + MqCloudQueueManagerLocation string + MqCloudQueueManagerVersion string + MqCloudQueueManagerVersionUpdate string ) // Secrets Manager @@ -1591,11 +1595,15 @@ func init() { fmt.Println("[WARN] Set the environment variable IBM_SATELLITE_SSH_PUB_KEY with a ssh public key or ibm_satellite_* tests may fail") } + MqcloudConfigEndpoint = os.Getenv("IBMCLOUD_MQCLOUD_CONFIG_ENDPOINT") + if MqcloudConfigEndpoint == "" { + fmt.Println("[INFO] Set the environment variable IBMCLOUD_MQCLOUD_CONFIG_ENDPOINT for ibm_mqcloud service else tests will fail if this is not set correctly") + } + MqcloudInstanceID = os.Getenv("IBM_MQCLOUD_INSTANCE_ID") if MqcloudInstanceID == "" { fmt.Println("[INFO] Set the environment variable IBM_MQCLOUD_INSTANCE_ID for ibm_mqcloud_queue_manager resource or datasource else tests will fail if this is not set correctly") } - MqcloudQueueManagerID = os.Getenv("IBM_MQCLOUD_QUEUEMANAGER_ID") if MqcloudQueueManagerID == "" { fmt.Println("[INFO] Set the environment variable IBM_MQCLOUD_QUEUEMANAGER_ID for ibm_mqcloud_queue_manager resource or datasource else tests will fail if this is not set correctly") @@ -1608,6 +1616,18 @@ func init() { if MqcloudTSCertFilePath == "" { fmt.Println("[INFO] Set the environment variable IBM_MQCLOUD_TS_CERT_PATH for ibm_mqcloud_truststore_certificate resource or datasource else tests will fail if this is not set correctly") } + MqCloudQueueManagerLocation = os.Getenv(("IBM_MQCLOUD_QUEUEMANAGER_LOCATION")) + if MqCloudQueueManagerLocation == "" { + fmt.Println("[INFO] Set the environment variable IBM_MQCLOUD_QUEUEMANAGER_LOCATION for ibm_mqcloud_queue_manager resource or datasource else tests will fail if this is not set correctly") + } + MqCloudQueueManagerVersion = os.Getenv(("IBM_MQCLOUD_QUEUEMANAGER_VERSION")) + if MqCloudQueueManagerVersion == "" { + fmt.Println("[INFO] Set the environment variable IBM_MQCLOUD_QUEUEMANAGER_VERSION for ibm_mqcloud_queue_manager resource or datasource else tests will fail if this is not set correctly") + } + MqCloudQueueManagerVersionUpdate = os.Getenv(("IBM_MQCLOUD_QUEUEMANAGER_VERSIONUPDATE")) + if MqCloudQueueManagerVersionUpdate == "" { + fmt.Println("[INFO] Set the environment variable IBM_MQCLOUD_QUEUEMANAGER_VERSIONUPDATE for ibm_mqcloud_queue_manager resource or datasource else tests will fail if this is not set correctly") + } } var ( @@ -1821,6 +1841,9 @@ func TestAccPreCheckSatelliteSSH(t *testing.T) { func TestAccPreCheckMqcloud(t *testing.T) { TestAccPreCheck(t) + if MqcloudConfigEndpoint == "" { + t.Fatal("IBMCLOUD_MQCLOUD_CONFIG_ENDPOINT must be set for acceptance tests") + } if MqcloudInstanceID == "" { t.Fatal("IBM_MQCLOUD_INSTANCE_ID must be set for acceptance tests") } @@ -1833,6 +1856,15 @@ func TestAccPreCheckMqcloud(t *testing.T) { if MqcloudKSCertFilePath == "" { t.Fatal("IBM_MQCLOUD_KS_CERT_PATH must be set for acceptance tests") } + if MqCloudQueueManagerLocation == "" { + t.Fatal("IBM_MQCLOUD_QUEUEMANAGER_LOCATION must be set for acceptance tests") + } + if MqCloudQueueManagerVersion == "" { + t.Fatal("IBM_MQCLOUD_QUEUEMANAGER_VERSION must be set for acceptance tests") + } + if MqCloudQueueManagerVersionUpdate == "" { + t.Fatal("IBM_MQCLOUD_QUEUEMANAGER_VERSIONUPDATE must be set for acceptance tests") + } } func TestAccProviderFactories() map[string]func() (*schema.Provider, error) { diff --git a/ibm/conns/config.go b/ibm/conns/config.go index fd99350034..c2fc691288 100644 --- a/ibm/conns/config.go +++ b/ibm/conns/config.go @@ -1210,9 +1210,12 @@ func (session clientSession) ProjectV1() (*project.ProjectV1, error) { // MQ on Cloud func (session clientSession) MqcloudV1() (*mqcloudv1.MqcloudV1, error) { - sessionMqcloudClient := session.mqcloudClient - sessionMqcloudClient.EnableRetries(0, 0) - return session.mqcloudClient, session.mqcloudClientErr + if session.mqcloudClientErr != nil { + sessionMqcloudClient := session.mqcloudClient + sessionMqcloudClient.EnableRetries(0, 0) + return session.mqcloudClient, session.mqcloudClientErr + } + return session.mqcloudClient.Clone(), nil } // ClientSession configures and returns a fully initialized ClientSession @@ -3266,23 +3269,24 @@ func (c *Config) ClientSession() (interface{}, error) { if fileMap != nil && c.Visibility != "public-and-private" { mqCloudURL = fileFallBack(fileMap, c.Visibility, "IBMCLOUD_MQCLOUD_CONFIG_ENDPOINT", c.Region, mqCloudURL) } - + accept_language := os.Getenv("IBMCLOUD_MQCLOUD_ACCEPT_LANGUAGE") mqcloudClientOptions := &mqcloudv1.MqcloudV1Options{ - Authenticator: authenticator, - URL: EnvFallBack([]string{"IBMCLOUD_MQCLOUD_CONFIG_ENDPOINT"}, mqCloudURL), + Authenticator: authenticator, + AcceptLanguage: core.StringPtr(accept_language), + URL: EnvFallBack([]string{"IBMCLOUD_MQCLOUD_CONFIG_ENDPOINT"}, mqCloudURL), } // Construct the service client for MQ Cloud. session.mqcloudClient, err = mqcloudv1.NewMqcloudV1(mqcloudClientOptions) - if err != nil { - session.mqcloudClientErr = fmt.Errorf("Error occurred while configuring MQ Cloud service: %q", err) - } else { + if err == nil { // Enable retries for API calls session.mqcloudClient.Service.EnableRetries(c.RetryCount, c.RetryDelay) // Add custom header for analytics session.mqcloudClient.SetDefaultHeaders(gohttp.Header{ "X-Original-User-Agent": {fmt.Sprintf("terraform-provider-ibm/%s", version.Version)}, }) + } else { + session.mqcloudClientErr = fmt.Errorf("Error occurred while configuring MQ on Cloud service: %q", err) } // Construct the service options. diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_application.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_application.go index 9cef9c4831..8f2ea42810 100644 --- a/ibm/service/mqcloud/data_source_ibm_mqcloud_application.go +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_application.go @@ -9,11 +9,11 @@ import ( "time" - "github.com/IBM/mqcloud-go-sdk/mqcloudv1" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM/mqcloud-go-sdk/mqcloudv1" ) func DataSourceIbmMqcloudApplication() *schema.Resource { @@ -128,7 +128,7 @@ func dataSourceIbmMqcloudApplicationRead(context context.Context, d *schema.Reso if suppliedFilter { if len(allItems) == 0 { - return diag.FromErr(fmt.Errorf("No Applications found with name %s", name)) + return diag.FromErr(fmt.Errorf("No Application found with name: \"%s\"", name)) } d.SetId(name) } else { @@ -146,7 +146,7 @@ func dataSourceIbmMqcloudApplicationRead(context context.Context, d *schema.Reso } if err = d.Set("applications", mapSlice); err != nil { - return diag.FromErr(fmt.Errorf("Error setting applications %s", err)) + return diag.FromErr(fmt.Errorf("Error setting applications: %s", err)) } return nil diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_application_test.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_application_test.go index 1c9f1d7347..49eed96b15 100644 --- a/ibm/service/mqcloud/data_source_ibm_mqcloud_application_test.go +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_application_test.go @@ -13,6 +13,7 @@ import ( ) func TestAccIbmMqcloudApplicationDataSourceBasic(t *testing.T) { + t.Parallel() applicationDetailsServiceInstanceGuid := acc.MqcloudInstanceID applicationDetailsName := "appdsbasic" @@ -33,31 +34,6 @@ func TestAccIbmMqcloudApplicationDataSourceBasic(t *testing.T) { }) } -func TestAccIbmMqcloudApplicationDataSourceAllArgs(t *testing.T) { - applicationDetailsServiceInstanceGuid := acc.MqcloudInstanceID - applicationDetailsName := "appdsargs" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckIbmMqcloudApplicationDataSourceConfig(applicationDetailsServiceInstanceGuid, applicationDetailsName), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "id"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "service_instance_guid"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "name"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "applications.#"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "applications.0.id"), - resource.TestCheckResourceAttr("data.ibm_mqcloud_application.mqcloud_application_instance", "applications.0.name", applicationDetailsName), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "applications.0.create_api_key_uri"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_application.mqcloud_application_instance", "applications.0.href"), - ), - }, - }, - }) -} - func testAccCheckIbmMqcloudApplicationDataSourceConfigBasic(applicationDetailsServiceInstanceGuid string, applicationDetailsName string) string { return fmt.Sprintf(` resource "ibm_mqcloud_application" "mqcloud_application_instance" { @@ -71,17 +47,3 @@ func testAccCheckIbmMqcloudApplicationDataSourceConfigBasic(applicationDetailsSe } `, applicationDetailsServiceInstanceGuid, applicationDetailsName) } - -func testAccCheckIbmMqcloudApplicationDataSourceConfig(applicationDetailsServiceInstanceGuid string, applicationDetailsName string) string { - return fmt.Sprintf(` - resource "ibm_mqcloud_application" "mqcloud_application_instance" { - service_instance_guid = "%s" - name = "%s" - } - - data "ibm_mqcloud_application" "mqcloud_application_instance" { - service_instance_guid = ibm_mqcloud_application.mqcloud_application_instance.service_instance_guid - name = ibm_mqcloud_application.mqcloud_application_instance.name - } - `, applicationDetailsServiceInstanceGuid, applicationDetailsName) -} diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate.go index 0f27f37fa3..0881b79156 100644 --- a/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate.go +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate.go @@ -169,7 +169,7 @@ func dataSourceIbmMqcloudKeystoreCertificateRead(context context.Context, d *sch if suppliedFilter { if len(keyStoreCertificateDetailsCollection.KeyStore) == 0 { - return diag.FromErr(fmt.Errorf("no KeyStore found with label %s", label)) + return diag.FromErr(fmt.Errorf("No Key Store Certificate found with label: \"%s\"", label)) } d.SetId(label) } else { @@ -192,7 +192,7 @@ func dataSourceIbmMqcloudKeystoreCertificateRead(context context.Context, d *sch } } if err = d.Set("key_store", keyStore); err != nil { - return diag.FromErr(fmt.Errorf("Error setting key_store %s", err)) + return diag.FromErr(fmt.Errorf("Error setting key_store: %s", err)) } return nil diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate_test.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate_test.go index 9f0b3218e6..984831aac7 100644 --- a/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate_test.go +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_keystore_certificate_test.go @@ -14,6 +14,7 @@ import ( ) func TestAccIbmMqcloudKeystoreCertificateDataSourceBasic(t *testing.T) { + t.Parallel() keyStoreCertificateDetailsServiceInstanceGuid := acc.MqcloudInstanceID keyStoreCertificateDetailsQueueManagerID := acc.MqcloudQueueManagerID keyStoreCertificateDetailsLabel := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) @@ -26,46 +27,9 @@ func TestAccIbmMqcloudKeystoreCertificateDataSourceBasic(t *testing.T) { { Config: testAccCheckIbmMqcloudKeystoreCertificateDataSourceConfigBasic(keyStoreCertificateDetailsServiceInstanceGuid, keyStoreCertificateDetailsQueueManagerID, keyStoreCertificateDetailsLabel, keyStoreCertificateDetailsCertificateFile), Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "id"), resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "service_instance_guid"), resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "queue_manager_id"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.#"), - resource.TestCheckResourceAttr("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.label", keyStoreCertificateDetailsLabel), - ), - }, - }, - }) -} - -func TestAccIbmMqcloudKeystoreCertificateDataSourceAllArgs(t *testing.T) { - keyStoreCertificateDetailsServiceInstanceGuid := acc.MqcloudInstanceID - keyStoreCertificateDetailsQueueManagerID := acc.MqcloudQueueManagerID - keyStoreCertificateDetailsLabel := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) - keyStoreCertificateDetailsCertificateFile := acc.MqcloudKSCertFilePath - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckIbmMqcloudKeystoreCertificateDataSourceConfig(keyStoreCertificateDetailsServiceInstanceGuid, keyStoreCertificateDetailsQueueManagerID, keyStoreCertificateDetailsLabel, keyStoreCertificateDetailsCertificateFile), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "service_instance_guid"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "queue_manager_id"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "label"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "total_count"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.#"), - resource.TestCheckResourceAttr("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.label", keyStoreCertificateDetailsLabel), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.certificate_type"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.fingerprint_sha256"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.subject_dn"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.subject_cn"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.issuer_dn"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.issuer_cn"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.issued"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.expiry"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.is_default"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.dns_names_total_count"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "key_store.0.href"), ), }, }, @@ -78,24 +42,7 @@ func testAccCheckIbmMqcloudKeystoreCertificateDataSourceConfigBasic(keyStoreCert service_instance_guid = "%s" queue_manager_id = "%s" label = "%s" - certificate_file = "%s" - } - - data "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { - service_instance_guid = ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance.service_instance_guid - queue_manager_id = ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance.queue_manager_id - label = ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance.label - } - `, keyStoreCertificateDetailsServiceInstanceGuid, keyStoreCertificateDetailsQueueManagerID, keyStoreCertificateDetailsLabel, keyStoreCertificateDetailsCertificateFile) -} - -func testAccCheckIbmMqcloudKeystoreCertificateDataSourceConfig(keyStoreCertificateDetailsServiceInstanceGuid string, keyStoreCertificateDetailsQueueManagerID string, keyStoreCertificateDetailsLabel string, keyStoreCertificateDetailsCertificateFile string) string { - return fmt.Sprintf(` - resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { - service_instance_guid = "%s" - queue_manager_id = "%s" - label = "%s" - certificate_file = "%s" + certificate_file = filebase64("%s") } data "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager.go index 42774e4bce..245cbf93b7 100644 --- a/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager.go +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager.go @@ -182,7 +182,7 @@ func dataSourceIbmMqcloudQueueManagerRead(context context.Context, d *schema.Res if suppliedFilter { if len(allItems) == 0 { - return diag.FromErr(fmt.Errorf("No Queue Managers found with name %s", name)) + return diag.FromErr(fmt.Errorf("No Queue Manager found with name: \"%s\"", name)) } d.SetId(name) } else { @@ -200,7 +200,7 @@ func dataSourceIbmMqcloudQueueManagerRead(context context.Context, d *schema.Res } if err = d.Set("queue_managers", mapSlice); err != nil { - return diag.FromErr(fmt.Errorf("Error setting queue_managers %s", err)) + return diag.FromErr(fmt.Errorf("Error setting queue_managers: %s", err)) } return nil diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_test.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_test.go index 69f9690370..1bf9dccef8 100644 --- a/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_test.go +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_queue_manager_test.go @@ -7,6 +7,7 @@ import ( "fmt" "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" @@ -15,8 +16,8 @@ import ( func TestAccIbmMqcloudQueueManagerDataSourceBasic(t *testing.T) { t.Parallel() queueManagerDetailsServiceInstanceGuid := acc.MqcloudInstanceID - queueManagerDetailsName := "queue_manager_ds_basic" - queueManagerDetailsLocation := "ibmcloud_eu_de" + queueManagerDetailsName := fmt.Sprintf("tf_queue_manager_ds_basic%d", acctest.RandIntRange(10, 100)) + queueManagerDetailsLocation := acc.MqCloudQueueManagerLocation queueManagerDetailsSize := "small" resource.Test(t, resource.TestCase{ @@ -41,11 +42,11 @@ func TestAccIbmMqcloudQueueManagerDataSourceBasic(t *testing.T) { func TestAccIbmMqcloudQueueManagerDataSourceAllArgs(t *testing.T) { t.Parallel() queueManagerDetailsServiceInstanceGuid := acc.MqcloudInstanceID - queueManagerDetailsName := "queue_manager_ds_allargs" - queueManagerDetailsDisplayName := "queue_manager_ds_allargs" - queueManagerDetailsLocation := "ibmcloud_eu_de" + queueManagerDetailsName := fmt.Sprintf("tf_queue_manager_ds_allargs%d", acctest.RandIntRange(10, 100)) + queueManagerDetailsDisplayName := queueManagerDetailsName + queueManagerDetailsLocation := acc.MqCloudQueueManagerLocation queueManagerDetailsSize := "small" - queueManagerDetailsVersion := "9.3.3_3" + queueManagerDetailsVersion := acc.MqCloudQueueManagerVersion resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate.go index 265c2cb8b1..c8d0604ab0 100644 --- a/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate.go +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate.go @@ -156,7 +156,7 @@ func dataSourceIbmMqcloudTruststoreCertificateRead(context context.Context, d *s if suppliedFilter { if len(trustStoreCertificateDetailsCollection.TrustStore) == 0 { - return diag.FromErr(fmt.Errorf("no TrustStore found with label %s", label)) + return diag.FromErr(fmt.Errorf("No Trust Store Certificate found with label: \"%s\"", label)) } d.SetId(label) } else { @@ -179,7 +179,7 @@ func dataSourceIbmMqcloudTruststoreCertificateRead(context context.Context, d *s } } if err = d.Set("trust_store", trustStore); err != nil { - return diag.FromErr(fmt.Errorf("Error setting trust_store %s", err)) + return diag.FromErr(fmt.Errorf("Error setting trust_store: %s", err)) } return nil diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate_test.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate_test.go index a4c50e196f..75552460a4 100644 --- a/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate_test.go +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_truststore_certificate_test.go @@ -14,6 +14,7 @@ import ( ) func TestAccIbmMqcloudTruststoreCertificateDataSourceBasic(t *testing.T) { + t.Parallel() trustStoreCertificateDetailsServiceInstanceGuid := acc.MqcloudInstanceID trustStoreCertificateDetailsQueueManagerID := acc.MqcloudQueueManagerID trustStoreCertificateDetailsLabel := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) @@ -26,45 +27,9 @@ func TestAccIbmMqcloudTruststoreCertificateDataSourceBasic(t *testing.T) { { Config: testAccCheckIbmMqcloudTruststoreCertificateDataSourceConfigBasic(trustStoreCertificateDetailsServiceInstanceGuid, trustStoreCertificateDetailsQueueManagerID, trustStoreCertificateDetailsLabel, trustStoreCertificateDetailsCertificateFile), Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "id"), resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "service_instance_guid"), resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "queue_manager_id"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.#"), - resource.TestCheckResourceAttr("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.label", trustStoreCertificateDetailsLabel), - ), - }, - }, - }) -} - -func TestAccIbmMqcloudTruststoreCertificateDataSourceAllArgs(t *testing.T) { - trustStoreCertificateDetailsServiceInstanceGuid := acc.MqcloudInstanceID - trustStoreCertificateDetailsQueueManagerID := acc.MqcloudQueueManagerID - trustStoreCertificateDetailsLabel := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) - trustStoreCertificateDetailsCertificateFile := acc.MqcloudTSCertFilePath - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckIbmMqcloudTruststoreCertificateDataSourceConfig(trustStoreCertificateDetailsServiceInstanceGuid, trustStoreCertificateDetailsQueueManagerID, trustStoreCertificateDetailsLabel, trustStoreCertificateDetailsCertificateFile), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "service_instance_guid"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "queue_manager_id"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "label"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "total_count"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.#"), - resource.TestCheckResourceAttr("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.label", trustStoreCertificateDetailsLabel), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.certificate_type"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.fingerprint_sha256"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.subject_dn"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.subject_cn"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.issuer_dn"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.issuer_cn"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.issued"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.expiry"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.trusted"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "trust_store.0.href"), ), }, }, @@ -77,24 +42,7 @@ func testAccCheckIbmMqcloudTruststoreCertificateDataSourceConfigBasic(trustStore service_instance_guid = "%s" queue_manager_id = "%s" label = "%s" - certificate_file = "%s" - } - - data "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { - service_instance_guid = ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance.service_instance_guid - queue_manager_id = ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance.queue_manager_id - label = ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance.label - } - `, trustStoreCertificateDetailsServiceInstanceGuid, trustStoreCertificateDetailsQueueManagerID, trustStoreCertificateDetailsLabel, trustStoreCertificateDetailsCertificateFile) -} - -func testAccCheckIbmMqcloudTruststoreCertificateDataSourceConfig(trustStoreCertificateDetailsServiceInstanceGuid string, trustStoreCertificateDetailsQueueManagerID string, trustStoreCertificateDetailsLabel string, trustStoreCertificateDetailsCertificateFile string) string { - return fmt.Sprintf(` - resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { - service_instance_guid = "%s" - queue_manager_id = "%s" - label = "%s" - certificate_file = "%s" + certificate_file = filebase64("%s") } data "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_user.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_user.go index 259aefa17d..c89a9e0f9e 100644 --- a/ibm/service/mqcloud/data_source_ibm_mqcloud_user.go +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_user.go @@ -127,7 +127,7 @@ func dataSourceIbmMqcloudUserRead(context context.Context, d *schema.ResourceDat if suppliedFilter { if len(allItems) == 0 { - return diag.FromErr(fmt.Errorf("No Users found with name %s", name)) + return diag.FromErr(fmt.Errorf("No User found with name: \"%s\"", name)) } d.SetId(name) } else { @@ -145,7 +145,7 @@ func dataSourceIbmMqcloudUserRead(context context.Context, d *schema.ResourceDat } if err = d.Set("users", mapSlice); err != nil { - return diag.FromErr(fmt.Errorf("Error setting users %s", err)) + return diag.FromErr(fmt.Errorf("Error setting users: %s", err)) } return nil diff --git a/ibm/service/mqcloud/data_source_ibm_mqcloud_user_test.go b/ibm/service/mqcloud/data_source_ibm_mqcloud_user_test.go index eb3491817e..8823e06d76 100644 --- a/ibm/service/mqcloud/data_source_ibm_mqcloud_user_test.go +++ b/ibm/service/mqcloud/data_source_ibm_mqcloud_user_test.go @@ -14,6 +14,7 @@ import ( ) func TestAccIbmMqcloudUserDataSourceBasic(t *testing.T) { + t.Parallel() userDetailsServiceInstanceGuid := acc.MqcloudInstanceID userDetailsName := fmt.Sprintf("tfname%d", acctest.RandIntRange(10, 100)) userDetailsEmail := fmt.Sprintf("tfemail%d@ibm.com", acctest.RandIntRange(10, 100)) @@ -36,32 +37,6 @@ func TestAccIbmMqcloudUserDataSourceBasic(t *testing.T) { }) } -func TestAccIbmMqcloudUserDataSourceAllArgs(t *testing.T) { - userDetailsServiceInstanceGuid := acc.MqcloudInstanceID - userDetailsName := fmt.Sprintf("tfname%d", acctest.RandIntRange(10, 100)) - userDetailsEmail := fmt.Sprintf("tfemail%d@ibm.com", acctest.RandIntRange(10, 100)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckIbmMqcloudUserDataSourceConfig(userDetailsServiceInstanceGuid, userDetailsName, userDetailsEmail), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "id"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "service_instance_guid"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "name"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "users.#"), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "users.0.id"), - resource.TestCheckResourceAttr("data.ibm_mqcloud_user.mqcloud_user_instance", "users.0.name", userDetailsName), - resource.TestCheckResourceAttr("data.ibm_mqcloud_user.mqcloud_user_instance", "users.0.email", userDetailsEmail), - resource.TestCheckResourceAttrSet("data.ibm_mqcloud_user.mqcloud_user_instance", "users.0.href"), - ), - }, - }, - }) -} - func testAccCheckIbmMqcloudUserDataSourceConfigBasic(userDetailsServiceInstanceGuid string, userDetailsName string, userDetailsEmail string) string { return fmt.Sprintf(` resource "ibm_mqcloud_user" "mqcloud_user_instance" { @@ -76,18 +51,3 @@ func testAccCheckIbmMqcloudUserDataSourceConfigBasic(userDetailsServiceInstanceG } `, userDetailsServiceInstanceGuid, userDetailsName, userDetailsEmail) } - -func testAccCheckIbmMqcloudUserDataSourceConfig(userDetailsServiceInstanceGuid string, userDetailsName string, userDetailsEmail string) string { - return fmt.Sprintf(` - resource "ibm_mqcloud_user" "mqcloud_user_instance" { - service_instance_guid = "%s" - name = "%s" - email = "%s" - } - - data "ibm_mqcloud_user" "mqcloud_user_instance" { - service_instance_guid = ibm_mqcloud_user.mqcloud_user_instance.service_instance_guid - name = ibm_mqcloud_user.mqcloud_user_instance.name - } - `, userDetailsServiceInstanceGuid, userDetailsName, userDetailsEmail) -} diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_application_test.go b/ibm/service/mqcloud/resource_ibm_mqcloud_application_test.go index b780d789d1..fec357e6ed 100644 --- a/ibm/service/mqcloud/resource_ibm_mqcloud_application_test.go +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_application_test.go @@ -17,6 +17,7 @@ import ( ) func TestAccIbmMqcloudApplicationBasic(t *testing.T) { + t.Parallel() var conf mqcloudv1.ApplicationDetails serviceInstanceGuid := acc.MqcloudInstanceID name := "appbasic" @@ -34,28 +35,6 @@ func TestAccIbmMqcloudApplicationBasic(t *testing.T) { resource.TestCheckResourceAttr("ibm_mqcloud_application.mqcloud_application_instance", "name", name), ), }, - }, - }) -} - -func TestAccIbmMqcloudApplicationAllArgs(t *testing.T) { - var conf mqcloudv1.ApplicationDetails - serviceInstanceGuid := acc.MqcloudInstanceID - name := "appallargs" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, - Providers: acc.TestAccProviders, - CheckDestroy: testAccCheckIbmMqcloudApplicationDestroy, - Steps: []resource.TestStep{ - { - Config: testAccCheckIbmMqcloudApplicationConfig(serviceInstanceGuid, name), - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIbmMqcloudApplicationExists("ibm_mqcloud_application.mqcloud_application_instance", conf), - resource.TestCheckResourceAttr("ibm_mqcloud_application.mqcloud_application_instance", "service_instance_guid", serviceInstanceGuid), - resource.TestCheckResourceAttr("ibm_mqcloud_application.mqcloud_application_instance", "name", name), - ), - }, { ResourceName: "ibm_mqcloud_application.mqcloud_application_instance", ImportState: true, @@ -74,16 +53,6 @@ func testAccCheckIbmMqcloudApplicationConfigBasic(serviceInstanceGuid string, na `, serviceInstanceGuid, name) } -func testAccCheckIbmMqcloudApplicationConfig(serviceInstanceGuid string, name string) string { - return fmt.Sprintf(` - - resource "ibm_mqcloud_application" "mqcloud_application_instance" { - service_instance_guid = "%s" - name = "%s" - } - `, serviceInstanceGuid, name) -} - func testAccCheckIbmMqcloudApplicationExists(n string, obj mqcloudv1.ApplicationDetails) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate.go b/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate.go index 859d0aa5cc..9cc0f6be06 100644 --- a/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate.go +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate.go @@ -4,12 +4,12 @@ package mqcloud import ( + "bytes" "context" + "encoding/base64" "fmt" "io" "log" - "os" - "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -47,7 +47,13 @@ func ResourceIbmMqcloudKeystoreCertificate() *schema.Resource { Required: true, ForceNew: true, ValidateFunc: validate.InvokeValidator("ibm_mqcloud_keystore_certificate", "label"), - Description: "Certificate label in queue manager store.", + Description: "The label to use for the certificate to be uploaded.", + }, + "certificate_file": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The filename and path of the certificate to be uploaded.", }, "certificate_type": { Type: schema.TypeString, @@ -115,12 +121,6 @@ func ResourceIbmMqcloudKeystoreCertificate() *schema.Resource { Computed: true, Description: "ID of the certificate.", }, - "certificate_file": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: "The filename and path of the certificate to be uploaded.", - }, }, } } @@ -175,18 +175,11 @@ func resourceIbmMqcloudKeystoreCertificateCreate(context context.Context, d *sch createKeyStorePemCertificateOptions.SetServiceInstanceGuid(d.Get("service_instance_guid").(string)) createKeyStorePemCertificateOptions.SetQueueManagerID(d.Get("queue_manager_id").(string)) createKeyStorePemCertificateOptions.SetLabel(d.Get("label").(string)) - //Custom code to read certs and pass to SDK - certBytes, err := os.ReadFile(d.Get("certificate_file").(string)) // just pass the file name + certificateFileBytes, err := base64.StdEncoding.DecodeString(d.Get("certificate_file").(string)) if err != nil { - fmt.Print(err) + return diag.FromErr(err) } - certString := string(certBytes) // convert content to a 'string' - rc := io.NopCloser(strings.NewReader(certString)) - // certificateFileModel, err := resourceIbmMqcloudKeystoreCertificateMapToio.ReadCloser(d.Get("certificate_file.0").(map[string]interface{})) - // if err != nil { - // return diag.FromErr(err) - // } - createKeyStorePemCertificateOptions.SetCertificateFile(rc) + createKeyStorePemCertificateOptions.SetCertificateFile(io.NopCloser(bytes.NewReader(certificateFileBytes))) keyStoreCertificateDetails, response, err := mqcloudClient.CreateKeyStorePemCertificateWithContext(context, createKeyStorePemCertificateOptions) if err != nil { @@ -225,16 +218,13 @@ func resourceIbmMqcloudKeystoreCertificateRead(context context.Context, d *schem log.Printf("[DEBUG] GetKeyStoreCertificateWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("GetKeyStoreCertificateWithContext failed %s\n%s", err, response)) } + if err = d.Set("service_instance_guid", parts[0]); err != nil { return diag.FromErr(fmt.Errorf("Error setting service_instance_guid: %s", err)) } if err = d.Set("queue_manager_id", parts[1]); err != nil { return diag.FromErr(fmt.Errorf("Error setting queue_manager_id: %s", err)) } - downloadCertificatePath := "./certificates/keystore/" + *keyStoreCertificateDetails.Label + ".pem" - if err = d.Set("certificate_file", downloadCertificatePath); err != nil { - return diag.FromErr(fmt.Errorf("Error setting certificate_file: %s", err)) - } if err = d.Set("label", keyStoreCertificateDetails.Label); err != nil { return diag.FromErr(fmt.Errorf("Error setting label: %s", err)) } diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate_test.go b/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate_test.go index 5041c8ed77..83461fc0a2 100644 --- a/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate_test.go +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_keystore_certificate_test.go @@ -18,6 +18,7 @@ import ( ) func TestAccIbmMqcloudKeystoreCertificateBasic(t *testing.T) { + t.Parallel() var conf mqcloudv1.KeyStoreCertificateDetails serviceInstanceGuid := acc.MqcloudInstanceID queueManagerID := acc.MqcloudQueueManagerID @@ -38,35 +39,11 @@ func TestAccIbmMqcloudKeystoreCertificateBasic(t *testing.T) { resource.TestCheckResourceAttr("ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "label", label), ), }, - }, - }) -} - -func TestAccIbmMqcloudKeystoreCertificateAllArgs(t *testing.T) { - var conf mqcloudv1.KeyStoreCertificateDetails - serviceInstanceGuid := acc.MqcloudInstanceID - queueManagerID := acc.MqcloudQueueManagerID - label := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) - certificateFile := acc.MqcloudKSCertFilePath - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, - Providers: acc.TestAccProviders, - CheckDestroy: testAccCheckIbmMqcloudKeystoreCertificateDestroy, - Steps: []resource.TestStep{ { - Config: testAccCheckIbmMqcloudKeystoreCertificateConfig(serviceInstanceGuid, queueManagerID, label, certificateFile), - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIbmMqcloudKeystoreCertificateExists("ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", conf), - resource.TestCheckResourceAttr("ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "service_instance_guid", serviceInstanceGuid), - resource.TestCheckResourceAttr("ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "queue_manager_id", queueManagerID), - resource.TestCheckResourceAttr("ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", "label", label), - ), - }, - { - ResourceName: "ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", - ImportState: true, - ImportStateVerify: true, + ResourceName: "ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate_instance", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"certificate_file"}, }, }, }) @@ -78,19 +55,7 @@ func testAccCheckIbmMqcloudKeystoreCertificateConfigBasic(serviceInstanceGuid st service_instance_guid = "%s" queue_manager_id = "%s" label = "%s" - certificate_file = "%s" - } - `, serviceInstanceGuid, queueManagerID, label, certificateFile) -} - -func testAccCheckIbmMqcloudKeystoreCertificateConfig(serviceInstanceGuid string, queueManagerID string, label string, certificateFile string) string { - return fmt.Sprintf(` - - resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { - service_instance_guid = "%s" - queue_manager_id = "%s" - label = "%s" - certificate_file = "%s" + certificate_file = filebase64("%s") } `, serviceInstanceGuid, queueManagerID, label, certificateFile) } diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager.go b/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager.go index a94f6fa5c9..252837593f 100644 --- a/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager.go +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager.go @@ -252,14 +252,15 @@ func resourceIbmMqcloudQueueManagerRead(context context.Context, d *schema.Resou var queueManagerDetails *mqcloudv1.QueueManagerDetails var response *core.DetailedResponse - err = resource.RetryContext(context, 10*time.Second, func() *resource.RetryError { + err = resource.RetryContext(context, 150*time.Second, func() *resource.RetryError { queueManagerDetails, response, err = mqcloudClient.GetQueueManagerWithContext(context, getQueueManagerOptions) - if err != nil || response == nil { - if response.StatusCode == 404 { - return resource.RetryableError(err) + if err != nil || queueManagerDetails == nil { + if response != nil && response.StatusCode == 404 { + return resource.RetryableError(fmt.Errorf("Queue Manager not found, retrying")) } return resource.NonRetryableError(err) } + return nil }) diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager_test.go b/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager_test.go index a6ccbd7feb..d010549e4f 100644 --- a/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager_test.go +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_queue_manager_test.go @@ -14,14 +14,15 @@ import ( "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/IBM/mqcloud-go-sdk/mqcloudv1" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" ) func TestAccIbmMqcloudQueueManagerBasic(t *testing.T) { t.Parallel() var conf mqcloudv1.QueueManagerDetails serviceInstanceGuid := acc.MqcloudInstanceID - name := "queue_manager_basic" - location := "ibmcloud_eu_de" + name := fmt.Sprintf("tf_queue_manager_basic%d", acctest.RandIntRange(10, 100)) + location := acc.MqCloudQueueManagerLocation size := "small" resource.Test(t, resource.TestCase{ @@ -47,12 +48,12 @@ func TestAccIbmMqcloudQueueManagerAllArgs(t *testing.T) { t.Parallel() var conf mqcloudv1.QueueManagerDetails serviceInstanceGuid := acc.MqcloudInstanceID - name := "queue_manager_allargs" - displayName := "queue_manager_allargs" - location := "ibmcloud_eu_de" + name := fmt.Sprintf("tf_queue_manager_allargs%d", acctest.RandIntRange(10, 100)) + displayName := name + location := acc.MqCloudQueueManagerLocation size := "small" - version := "9.3.3_3" - versionUpdate := "9.3.4_1" + version := acc.MqCloudQueueManagerVersion + versionUpdate := acc.MqCloudQueueManagerVersionUpdate resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate.go b/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate.go index 63a35c247e..ed12be2ddf 100644 --- a/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate.go +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate.go @@ -4,12 +4,12 @@ package mqcloud import ( + "bytes" "context" + "encoding/base64" "fmt" "io" "log" - "os" - "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -47,7 +47,13 @@ func ResourceIbmMqcloudTruststoreCertificate() *schema.Resource { Required: true, ForceNew: true, ValidateFunc: validate.InvokeValidator("ibm_mqcloud_truststore_certificate", "label"), - Description: "Certificate label in queue manager store.", + Description: "The label to use for the certificate to be uploaded.", + }, + "certificate_file": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The filename and path of the certificate to be uploaded.", }, "certificate_type": { Type: schema.TypeString, @@ -104,12 +110,6 @@ func ResourceIbmMqcloudTruststoreCertificate() *schema.Resource { Computed: true, Description: "Id of the certificate.", }, - "certificate_file": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: "The filename and path of the certificate to be uploaded.", - }, }, } } @@ -165,18 +165,11 @@ func resourceIbmMqcloudTruststoreCertificateCreate(context context.Context, d *s createTrustStorePemCertificateOptions.SetServiceInstanceGuid(d.Get("service_instance_guid").(string)) createTrustStorePemCertificateOptions.SetQueueManagerID(d.Get("queue_manager_id").(string)) createTrustStorePemCertificateOptions.SetLabel(d.Get("label").(string)) - //Custom code to read certs and pass to SDK - certBytes, err := os.ReadFile(d.Get("certificate_file").(string)) // just pass the file name + certificateFileBytes, err := base64.StdEncoding.DecodeString(d.Get("certificate_file").(string)) if err != nil { - fmt.Print(err) + return diag.FromErr(err) } - certString := string(certBytes) // convert content to a 'string' - rc := io.NopCloser(strings.NewReader(certString)) - // certificateFileModel, err := resourceIbmMqcloudTruststoreCertificateMapToio.ReadCloser(d.Get("certificate_file.0").(map[string]interface{})) - // if err != nil { - // return diag.FromErr(err) - // } - createTrustStorePemCertificateOptions.SetCertificateFile(rc) + createTrustStorePemCertificateOptions.SetCertificateFile(io.NopCloser(bytes.NewReader(certificateFileBytes))) trustStoreCertificateDetails, response, err := mqcloudClient.CreateTrustStorePemCertificateWithContext(context, createTrustStorePemCertificateOptions) if err != nil { @@ -215,16 +208,13 @@ func resourceIbmMqcloudTruststoreCertificateRead(context context.Context, d *sch log.Printf("[DEBUG] GetTrustStoreCertificateWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("GetTrustStoreCertificateWithContext failed %s\n%s", err, response)) } + if err = d.Set("service_instance_guid", parts[0]); err != nil { return diag.FromErr(fmt.Errorf("Error setting service_instance_guid: %s", err)) } if err = d.Set("queue_manager_id", parts[1]); err != nil { return diag.FromErr(fmt.Errorf("Error setting queue_manager_id: %s", err)) } - downloadCertificatePath := "./certificates/truststore/" + *trustStoreCertificateDetails.Label + ".pem" - if err = d.Set("certificate_file", downloadCertificatePath); err != nil { - return diag.FromErr(fmt.Errorf("Error setting certificate_file: %s", err)) - } if err = d.Set("label", trustStoreCertificateDetails.Label); err != nil { return diag.FromErr(fmt.Errorf("Error setting label: %s", err)) } diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate_test.go b/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate_test.go index 80acc0e4a1..bfea0ce68e 100644 --- a/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate_test.go +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_truststore_certificate_test.go @@ -18,6 +18,7 @@ import ( ) func TestAccIbmMqcloudTruststoreCertificateBasic(t *testing.T) { + t.Parallel() var conf mqcloudv1.TrustStoreCertificateDetails serviceInstanceGuid := acc.MqcloudInstanceID queueManagerID := acc.MqcloudQueueManagerID @@ -38,35 +39,11 @@ func TestAccIbmMqcloudTruststoreCertificateBasic(t *testing.T) { resource.TestCheckResourceAttr("ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "label", label), ), }, - }, - }) -} - -func TestAccIbmMqcloudTruststoreCertificateAllArgs(t *testing.T) { - var conf mqcloudv1.TrustStoreCertificateDetails - serviceInstanceGuid := acc.MqcloudInstanceID - queueManagerID := acc.MqcloudQueueManagerID - label := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100)) - certificateFile := acc.MqcloudTSCertFilePath - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, - Providers: acc.TestAccProviders, - CheckDestroy: testAccCheckIbmMqcloudTruststoreCertificateDestroy, - Steps: []resource.TestStep{ { - Config: testAccCheckIbmMqcloudTruststoreCertificateConfig(serviceInstanceGuid, queueManagerID, label, certificateFile), - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIbmMqcloudTruststoreCertificateExists("ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", conf), - resource.TestCheckResourceAttr("ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "service_instance_guid", serviceInstanceGuid), - resource.TestCheckResourceAttr("ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "queue_manager_id", queueManagerID), - resource.TestCheckResourceAttr("ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", "label", label), - ), - }, - { - ResourceName: "ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", - ImportState: true, - ImportStateVerify: true, + ResourceName: "ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate_instance", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"certificate_file"}, }, }, }) @@ -78,19 +55,7 @@ func testAccCheckIbmMqcloudTruststoreCertificateConfigBasic(serviceInstanceGuid service_instance_guid = "%s" queue_manager_id = "%s" label = "%s" - certificate_file = "%s" - } - `, serviceInstanceGuid, queueManagerID, label, certificateFile) -} - -func testAccCheckIbmMqcloudTruststoreCertificateConfig(serviceInstanceGuid string, queueManagerID string, label string, certificateFile string) string { - return fmt.Sprintf(` - - resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" { - service_instance_guid = "%s" - queue_manager_id = "%s" - label = "%s" - certificate_file = "%s" + certificate_file = filebase64("%s") } `, serviceInstanceGuid, queueManagerID, label, certificateFile) } diff --git a/ibm/service/mqcloud/resource_ibm_mqcloud_user_test.go b/ibm/service/mqcloud/resource_ibm_mqcloud_user_test.go index 551827f583..fd7ad738af 100644 --- a/ibm/service/mqcloud/resource_ibm_mqcloud_user_test.go +++ b/ibm/service/mqcloud/resource_ibm_mqcloud_user_test.go @@ -18,6 +18,7 @@ import ( ) func TestAccIbmMqcloudUserBasic(t *testing.T) { + t.Parallel() var conf mqcloudv1.UserDetails serviceInstanceGuid := acc.MqcloudInstanceID name := fmt.Sprintf("tfname%d", acctest.RandIntRange(10, 100)) @@ -37,30 +38,6 @@ func TestAccIbmMqcloudUserBasic(t *testing.T) { resource.TestCheckResourceAttr("ibm_mqcloud_user.mqcloud_user_instance", "email", email), ), }, - }, - }) -} - -func TestAccIbmMqcloudUserAllArgs(t *testing.T) { - var conf mqcloudv1.UserDetails - serviceInstanceGuid := acc.MqcloudInstanceID - name := fmt.Sprintf("tfname%d", acctest.RandIntRange(10, 100)) - email := fmt.Sprintf("tfemail%d@ibm.com", acctest.RandIntRange(10, 100)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheckMqcloud(t) }, - Providers: acc.TestAccProviders, - CheckDestroy: testAccCheckIbmMqcloudUserDestroy, - Steps: []resource.TestStep{ - { - Config: testAccCheckIbmMqcloudUserConfig(serviceInstanceGuid, name, email), - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIbmMqcloudUserExists("ibm_mqcloud_user.mqcloud_user_instance", conf), - resource.TestCheckResourceAttr("ibm_mqcloud_user.mqcloud_user_instance", "service_instance_guid", serviceInstanceGuid), - resource.TestCheckResourceAttr("ibm_mqcloud_user.mqcloud_user_instance", "name", name), - resource.TestCheckResourceAttr("ibm_mqcloud_user.mqcloud_user_instance", "email", email), - ), - }, { ResourceName: "ibm_mqcloud_user.mqcloud_user_instance", ImportState: true, @@ -80,17 +57,6 @@ func testAccCheckIbmMqcloudUserConfigBasic(serviceInstanceGuid string, name stri `, serviceInstanceGuid, name, email) } -func testAccCheckIbmMqcloudUserConfig(serviceInstanceGuid string, name string, email string) string { - return fmt.Sprintf(` - - resource "ibm_mqcloud_user" "mqcloud_user_instance" { - service_instance_guid = "%s" - name = "%s" - email = "%s" - } - `, serviceInstanceGuid, name, email) -} - func testAccCheckIbmMqcloudUserExists(n string, obj mqcloudv1.UserDetails) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] diff --git a/ibm/service/mqcloud/utils.go b/ibm/service/mqcloud/utils.go index 877b5ed79b..58cd7c50eb 100644 --- a/ibm/service/mqcloud/utils.go +++ b/ibm/service/mqcloud/utils.go @@ -33,7 +33,7 @@ const isQueueManagerDeleteDone = "true" const reservedDeploymentPlan = "reserved-deployment" const enforceReservedDeploymentPlan = true -// waitForQmStatusUpdate Waits for QM to be in running state +// waitForQmStatusUpdate waits for Queue Manager to be in running state func waitForQmStatusUpdate(context context.Context, d *schema.ResourceData, meta interface{}) (interface{}, error) { mqcloudClient, err := meta.(conns.ClientSession).MqcloudV1() if err != nil { @@ -58,7 +58,6 @@ func waitForQmStatusUpdate(context context.Context, d *schema.ResourceData, meta if queueManagerStatus == nil || queueManagerStatus.Status == nil { return nil, "", fmt.Errorf("queueManagerStatus or queueManagerStatus.Status is nil") } - fmt.Println("The queue manager is currently in the " + *queueManagerStatus.Status + " state ....") if *queueManagerStatus.Status == "running" { return queueManagerStatus, qmStatus, nil @@ -135,7 +134,7 @@ func checkSIPlan(d *schema.ResourceData, meta interface{}) error { } instance, response, err := rsConClient.GetResourceInstance(&rsInst) if err != nil { - return fmt.Errorf("[ERROR] Failed to retrieve resource instance: %s, Response: %s", err, response) + return fmt.Errorf("[ERROR] Failed to retrieve Resource Instance: %s, Response: %s", err, response) } // Creating a Resource Catalog Client @@ -148,7 +147,7 @@ func checkSIPlan(d *schema.ResourceData, meta interface{}) error { // Checking the service plan plan, err := rsCatRepo.GetServicePlanName(*instance.ResourcePlanID) if err != nil { - return fmt.Errorf("[ERROR] Failed to retrieve service plan: %s", err) + return fmt.Errorf("[ERROR] Failed to retrieve Service Plan: %s", err) } // Update cache diff --git a/website/docs/r/mqcloud_keystore_certificate.html.markdown b/website/docs/r/mqcloud_keystore_certificate.html.markdown index e3b1a0108c..b4740f2661 100644 --- a/website/docs/r/mqcloud_keystore_certificate.html.markdown +++ b/website/docs/r/mqcloud_keystore_certificate.html.markdown @@ -14,6 +14,7 @@ Create, update, and delete mqcloud_keystore_certificates with this resource. ```hcl resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" { + certificate_file = filebase64("certificate_file.data") label = "label" queue_manager_id = var.queue_manager_id service_instance_guid = var.service_instance_guid @@ -24,7 +25,9 @@ resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instan You can specify the following arguments for this resource. -* `label` - (Required, Forces new resource, String) Certificate label in queue manager store. +* `certificate_file` - (Required, Forces new resource, String) The filename and path of the certificate to be uploaded. + * Constraints: The maximum length is `65537` characters. The minimum length is `1500` characters. +* `label` - (Required, Forces new resource, String) The label to use for the certificate to be uploaded. * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9_.]*$/`. * `queue_manager_id` - (Required, Forces new resource, String) The id of the queue manager to retrieve its full details. * Constraints: The maximum length is `32` characters. The minimum length is `32` characters. The value must match regular expression `/^[0-9a-fA-F]{32}$/`. @@ -67,6 +70,10 @@ The `id` property can be formed from `service_instance_guid`, `queue_manager_id` * `queue_manager_id`: A string in the format `b8e1aeda078009cf3db74e90d5d42328`. The id of the queue manager to retrieve its full details. * `certificate_id`: A string. ID of the certificate. +> ### Important Note +> When configuring the `ibm_mqcloud_keystore_certificate` resource in the root module: +> Ensure to set the `certificate_file` value to an empty string (`certificate_file=""`). This step is crucial as we are not downloading the certificate to the local system. + # Syntax
 $ terraform import ibm_mqcloud_keystore_certificate.mqcloud_keystore_certificate <service_instance_guid>/<queue_manager_id>/<certificate_id>
diff --git a/website/docs/r/mqcloud_queue_manager.html.markdown b/website/docs/r/mqcloud_queue_manager.html.markdown
index b26b62631e..abb8eec5f6 100644
--- a/website/docs/r/mqcloud_queue_manager.html.markdown
+++ b/website/docs/r/mqcloud_queue_manager.html.markdown
@@ -15,7 +15,7 @@ Create, update, and delete mqcloud_queue_managers with this resource.
 ```hcl
 resource "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" {
   display_name = "A test queue manager"
-  location = "reserved-eu-fr-cluster-f884"
+  location = "reserved-eu-de-cluster-f884"
   name = "testqm"
   service_instance_guid = var.service_instance_guid
   size = "lite"
diff --git a/website/docs/r/mqcloud_truststore_certificate.html.markdown b/website/docs/r/mqcloud_truststore_certificate.html.markdown
index ebc00ef103..66d9ab191b 100644
--- a/website/docs/r/mqcloud_truststore_certificate.html.markdown
+++ b/website/docs/r/mqcloud_truststore_certificate.html.markdown
@@ -14,6 +14,7 @@ Create, update, and delete mqcloud_truststore_certificates with this resource.
 
 ```hcl
 resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" {
+  certificate_file = filebase64("certificate_file.data")
   label = "label"
   queue_manager_id = var.queue_manager_id
   service_instance_guid = var.service_instance_guid
@@ -24,7 +25,9 @@ resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_in
 
 You can specify the following arguments for this resource.
 
-* `label` - (Required, Forces new resource, String) Certificate label in queue manager store.
+* `certificate_file` - (Required, Forces new resource, String) The filename and path of the certificate to be uploaded.
+  * Constraints: The maximum length is `65537` characters. The minimum length is `1500` characters.
+* `label` - (Required, Forces new resource, String) The label to use for the certificate to be uploaded.
   * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[a-zA-Z0-9_.]*$/`.
 * `queue_manager_id` - (Required, Forces new resource, String) The id of the queue manager to retrieve its full details.
   * Constraints: The maximum length is `32` characters. The minimum length is `32` characters. The value must match regular expression `/^[0-9a-fA-F]{32}$/`.
@@ -64,6 +67,10 @@ The `id` property can be formed from `service_instance_guid`, `queue_manager_id`
 * `queue_manager_id`: A string in the format `b8e1aeda078009cf3db74e90d5d42328`. The id of the queue manager to retrieve its full details.
 * `certificate_id`: A string. Id of the certificate.
 
+> ### Important Note
+> When configuring the `ibm_mqcloud_keystore_certificate` resource in the root module:
+> Ensure to set the `certificate_file` value to an empty string (`certificate_file=""`). This step is crucial as we are not downloading the certificate to the local system.
+
 # Syntax
 
 $ terraform import ibm_mqcloud_truststore_certificate.mqcloud_truststore_certificate <service_instance_guid>/<queue_manager_id>/<certificate_id>

From b5794002f39d894330773d9057cb62d5874e7916 Mon Sep 17 00:00:00 2001
From: Ujjwal Kumar 
Date: Thu, 28 Dec 2023 23:07:22 +0530
Subject: [PATCH 121/132] added a nil check for boottarget of bms

---
 ibm/service/vpc/resource_ibm_is_bare_metal_server.go | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go
index 8e419168b9..0d16c8493b 100644
--- a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go
+++ b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go
@@ -1361,9 +1361,11 @@ func bareMetalServerGet(context context.Context, d *schema.ResourceData, meta in
 	}
 	d.SetId(*bms.ID)
 	d.Set(isBareMetalServerBandwidth, bms.Bandwidth)
-	bmsBootTargetIntf := bms.BootTarget.(*vpcv1.BareMetalServerBootTarget)
-	bmsBootTarget := bmsBootTargetIntf.ID
-	d.Set(isBareMetalServerBootTarget, bmsBootTarget)
+	if bms.BootTarget != nil {
+		bmsBootTargetIntf := bms.BootTarget.(*vpcv1.BareMetalServerBootTarget)
+		bmsBootTarget := bmsBootTargetIntf.ID
+		d.Set(isBareMetalServerBootTarget, bmsBootTarget)
+	}
 	cpuList := make([]map[string]interface{}, 0)
 	if bms.Cpu != nil {
 		currentCPU := map[string]interface{}{}

From 160caa0fcaf0c6aecb07b937afc0d3cf6b33f3c3 Mon Sep 17 00:00:00 2001
From: SunithaGudisagar 
Date: Fri, 29 Dec 2023 23:26:39 +0530
Subject: [PATCH 122/132] Delete wait logic changes

---
 ibm/service/vpc/resource_ibm_is_vpn_server.go       | 4 ++--
 ibm/service/vpc/resource_ibm_is_vpn_server_route.go | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ibm/service/vpc/resource_ibm_is_vpn_server.go b/ibm/service/vpc/resource_ibm_is_vpn_server.go
index 23a6e5ecdb..fa0042b9af 100644
--- a/ibm/service/vpc/resource_ibm_is_vpn_server.go
+++ b/ibm/service/vpc/resource_ibm_is_vpn_server.go
@@ -1027,9 +1027,9 @@ func isWaitForVPNServerDeleted(context context.Context, sess *vpcv1.VpcV1, d *sc
 				if response != nil && response.StatusCode == 404 {
 					return vpnServer, isVPNServerStatusDeleted, nil
 				}
-				return vpnServer, isVPNServerStatusDeleting, fmt.Errorf("The VPC route %s failed to delete: %s\n%s", d.Id(), err, response)
+				return vpnServer, *vpnServer.LifecycleState, fmt.Errorf("The VPC vpn server %s failed to delete: %s\n%s", d.Id(), err, response)
 			}
-			return vpnServer, isVPNServerStatusDeleting, nil
+			return vpnServer, *vpnServer.LifecycleState, nil
 
 		},
 		Timeout:    d.Timeout(schema.TimeoutDelete),
diff --git a/ibm/service/vpc/resource_ibm_is_vpn_server_route.go b/ibm/service/vpc/resource_ibm_is_vpn_server_route.go
index ed38a19bd8..95ce9764cd 100644
--- a/ibm/service/vpc/resource_ibm_is_vpn_server_route.go
+++ b/ibm/service/vpc/resource_ibm_is_vpn_server_route.go
@@ -422,9 +422,9 @@ func isWaitForVPNServerRouteDeleted(context context.Context, sess *vpcv1.VpcV1,
 				if response != nil && response.StatusCode == 404 {
 					return vpnServerRoute, isVPNServerRouteStatusDeleted, nil
 				}
-				return vpnServerRoute, isVPNServerRouteStatusDeleting, fmt.Errorf("The VPC route %s failed to delete: %s\n%s", d.Id(), err, response)
+				return vpnServerRoute, *vpnServerRoute.LifecycleState, fmt.Errorf("The VPC route %s failed to delete: %s\n%s", d.Id(), err, response)
 			}
-			return vpnServerRoute, isVPNServerRouteStatusDeleting, nil
+			return vpnServerRoute, *vpnServerRoute.LifecycleState, nil
 
 		},
 		Timeout:    d.Timeout(schema.TimeoutDelete),

From 690d8458866a0d63875d9e921cf9abdf40c8aebb Mon Sep 17 00:00:00 2001
From: VaishnaviGopal 
Date: Tue, 2 Jan 2024 20:46:49 +0530
Subject: [PATCH 123/132] Changes wrt latest schematics sdk

---
 go.mod                                        |  2 +-
 go.sum                                        |  4 +-
 .../data_source_ibm_schematics_agent.go       |  8 ++-
 ...data_source_ibm_schematics_agent_deploy.go |  8 ++-
 ...data_source_ibm_schematics_agent_health.go |  8 ++-
 .../data_source_ibm_schematics_agent_prs.go   |  8 ++-
 .../data_source_ibm_schematics_job.go         |  2 +-
 .../data_source_ibm_schematics_output.go      | 34 -------------
 .../data_source_ibm_schematics_workspace.go   | 51 ++++---------------
 .../resource_ibm_schematics_agent.go          | 26 ++++++++--
 .../resource_ibm_schematics_agent_deploy.go   | 18 ++++---
 ...source_ibm_schematics_agent_deploy_test.go | 12 +++--
 .../resource_ibm_schematics_agent_health.go   |  8 ++-
 ...source_ibm_schematics_agent_health_test.go | 12 +++--
 .../resource_ibm_schematics_agent_prs.go      |  8 ++-
 .../resource_ibm_schematics_agent_prs_test.go | 12 +++--
 .../resource_ibm_schematics_agent_test.go     |  9 ++--
 .../schematics/resource_ibm_schematics_job.go |  8 +--
 .../docs/d/schematics_workspace.html.markdown |  6 +--
 19 files changed, 116 insertions(+), 128 deletions(-)

diff --git a/go.mod b/go.mod
index 2669b596d2..4248d65661 100644
--- a/go.mod
+++ b/go.mod
@@ -28,7 +28,7 @@ require (
 	github.com/IBM/project-go-sdk v0.1.6
 	github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5
 	github.com/IBM/scc-go-sdk/v5 v5.1.3
-	github.com/IBM/schematics-go-sdk v0.2.2
+	github.com/IBM/schematics-go-sdk v0.2.3
 	github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2
 	github.com/IBM/vpc-beta-go-sdk v0.6.0
 	github.com/IBM/vpc-go-sdk v0.47.0
diff --git a/go.sum b/go.sum
index 3d4a146889..f32ddb4c0b 100644
--- a/go.sum
+++ b/go.sum
@@ -168,8 +168,8 @@ github.com/IBM/sarama v1.41.2 h1:ZDBZfGPHAD4uuAtSv4U22fRZBgst0eEwGFzLj0fb85c=
 github.com/IBM/sarama v1.41.2/go.mod h1:xdpu7sd6OE1uxNdjYTSKUfY8FaKkJES9/+EyjSgiGQk=
 github.com/IBM/scc-go-sdk/v5 v5.1.3 h1:8zqJx/HgChTlMaC21HzthIR4HbFkuJ3dR/D68254jRg=
 github.com/IBM/scc-go-sdk/v5 v5.1.3/go.mod h1:YtAVlzq10bwR82QX4ZavhDIwa1s85RuVO9N/KmXVcuk=
-github.com/IBM/schematics-go-sdk v0.2.2 h1:8S3hoVLzF/ZRgWDaLqwHnLmZvlEBHCKgHszmMh7yD2E=
-github.com/IBM/schematics-go-sdk v0.2.2/go.mod h1:Tw2OSAPdpC69AxcwoyqcYYaGTTW6YpERF9uNEU+BFRQ=
+github.com/IBM/schematics-go-sdk v0.2.3 h1:lgTt0Sbudii3cuSk1YSQgrtiZAXDbBABAoVj3eQuBrU=
+github.com/IBM/schematics-go-sdk v0.2.3/go.mod h1:Tw2OSAPdpC69AxcwoyqcYYaGTTW6YpERF9uNEU+BFRQ=
 github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2 h1:+Svh1OmoFxMBnZQSOUtp2UUzrOGFsSQlE5TFL/ptJco=
 github.com/IBM/secrets-manager-go-sdk/v2 v2.0.2/go.mod h1:WII+LS4VkQYykmq65NWSuPb5xGNvsqkcK1aCWZoU2x4=
 github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc=
diff --git a/ibm/service/schematics/data_source_ibm_schematics_agent.go b/ibm/service/schematics/data_source_ibm_schematics_agent.go
index a5c21acfd5..70cd85f7d3 100644
--- a/ibm/service/schematics/data_source_ibm_schematics_agent.go
+++ b/ibm/service/schematics/data_source_ibm_schematics_agent.go
@@ -541,9 +541,13 @@ func dataSourceIbmSchematicsAgentRead(context context.Context, d *schema.Resourc
 	}
 
 	getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-		XFeatureAgents: core.BoolPtr(true),
-		Profile:        core.StringPtr("detailed"),
+		// XFeatureAgents: core.BoolPtr(true),
+		Profile: core.StringPtr("detailed"),
 	}
+	ff := map[string]string{
+		"X-Feature-Agents": "true",
+	}
+	getAgentDataOptions.Headers = ff
 
 	getAgentDataOptions.SetAgentID(d.Get("agent_id").(string))
 
diff --git a/ibm/service/schematics/data_source_ibm_schematics_agent_deploy.go b/ibm/service/schematics/data_source_ibm_schematics_agent_deploy.go
index 7fa062e5b4..d1e758d291 100644
--- a/ibm/service/schematics/data_source_ibm_schematics_agent_deploy.go
+++ b/ibm/service/schematics/data_source_ibm_schematics_agent_deploy.go
@@ -79,9 +79,13 @@ func dataSourceIbmSchematicsAgentDeployRead(context context.Context, d *schema.R
 	}
 
 	getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-		XFeatureAgents: core.BoolPtr(true),
-		Profile:        core.StringPtr("detailed"),
+		// XFeatureAgents: core.BoolPtr(true),
+		Profile: core.StringPtr("detailed"),
 	}
+	ff := map[string]string{
+		"X-Feature-Agents": "true",
+	}
+	getAgentDataOptions.Headers = ff
 	getAgentDataOptions.SetAgentID(d.Get("agent_id").(string))
 
 	agentData, response, err := schematicsClient.GetAgentDataWithContext(context, getAgentDataOptions)
diff --git a/ibm/service/schematics/data_source_ibm_schematics_agent_health.go b/ibm/service/schematics/data_source_ibm_schematics_agent_health.go
index 87ea05609d..bd6b34faf6 100644
--- a/ibm/service/schematics/data_source_ibm_schematics_agent_health.go
+++ b/ibm/service/schematics/data_source_ibm_schematics_agent_health.go
@@ -74,9 +74,13 @@ func dataSourceIbmSchematicsAgentHealthRead(context context.Context, d *schema.R
 	}
 
 	getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-		XFeatureAgents: core.BoolPtr(true),
-		Profile:        core.StringPtr("detailed"),
+		// XFeatureAgents: core.BoolPtr(true),
+		Profile: core.StringPtr("detailed"),
 	}
+	ff := map[string]string{
+		"X-Feature-Agents": "true",
+	}
+	getAgentDataOptions.Headers = ff
 	getAgentDataOptions.SetAgentID(d.Get("agent_id").(string))
 
 	agentData, response, err := schematicsClient.GetAgentDataWithContext(context, getAgentDataOptions)
diff --git a/ibm/service/schematics/data_source_ibm_schematics_agent_prs.go b/ibm/service/schematics/data_source_ibm_schematics_agent_prs.go
index e0c4eb613f..a1f1fab48c 100644
--- a/ibm/service/schematics/data_source_ibm_schematics_agent_prs.go
+++ b/ibm/service/schematics/data_source_ibm_schematics_agent_prs.go
@@ -74,9 +74,13 @@ func dataSourceIbmSchematicsAgentPrsRead(context context.Context, d *schema.Reso
 	}
 
 	getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-		XFeatureAgents: core.BoolPtr(true),
-		Profile:        core.StringPtr("detailed"),
+		// XFeatureAgents: core.BoolPtr(true),
+		Profile: core.StringPtr("detailed"),
 	}
+	ff := map[string]string{
+		"X-Feature-Agents": "true",
+	}
+	getAgentDataOptions.Headers = ff
 	getAgentDataOptions.SetAgentID(d.Get("agent_id").(string))
 
 	agentData, response, err := schematicsClient.GetAgentDataWithContext(context, getAgentDataOptions)
diff --git a/ibm/service/schematics/data_source_ibm_schematics_job.go b/ibm/service/schematics/data_source_ibm_schematics_job.go
index 64f35170d5..663e3fa14b 100644
--- a/ibm/service/schematics/data_source_ibm_schematics_job.go
+++ b/ibm/service/schematics/data_source_ibm_schematics_job.go
@@ -4212,7 +4212,7 @@ func dataSourceJobLogSummaryToMap(logSummaryItem schematicsv1.JobLogSummary) (lo
 	return logSummaryMap
 }
 
-func dataSourceJobLogSummaryLogErrorsToMap(logErrorsItem schematicsv1.JobLogSummaryLogErrors) (logErrorsMap map[string]interface{}) {
+func dataSourceJobLogSummaryLogErrorsToMap(logErrorsItem schematicsv1.JobLogSummaryLogErrorsItem) (logErrorsMap map[string]interface{}) {
 	logErrorsMap = map[string]interface{}{}
 
 	if logErrorsItem.ErrorCode != nil {
diff --git a/ibm/service/schematics/data_source_ibm_schematics_output.go b/ibm/service/schematics/data_source_ibm_schematics_output.go
index ec81390106..0e46b0c9c9 100644
--- a/ibm/service/schematics/data_source_ibm_schematics_output.go
+++ b/ibm/service/schematics/data_source_ibm_schematics_output.go
@@ -123,37 +123,3 @@ func dataSourceIBMSchematicsOutputRead(d *schema.ResourceData, meta interface{})
 func dataSourceIBMSchematicsOutputID(d *schema.ResourceData) string {
 	return time.Now().UTC().String()
 }
-
-func dataSourceOutputValuesListFlattenOutputValues(result []schematicsv1.OutputValuesInner) (outputValues interface{}) {
-	for _, outputValuesItem := range result {
-		outputValues = dataSourceOutputValuesListOutputValuesToMap(outputValuesItem)
-	}
-
-	return outputValues
-}
-
-func dataSourceOutputValuesListOutputValuesToMap(outputValuesItem schematicsv1.OutputValuesInner) (outputValuesMap map[string]interface{}) {
-	outputValuesMap = map[string]interface{}{}
-
-	if outputValuesItem.Folder != nil {
-		outputValuesMap["folder"] = outputValuesItem.Folder
-	}
-	if outputValuesItem.ID != nil {
-		outputValuesMap["id"] = outputValuesItem.ID
-	}
-
-	m := []flex.Map{}
-
-	for _, outputValues := range outputValuesItem.OutputValues {
-		m = append(m, flex.Flatten(outputValues))
-	}
-
-	if outputValuesItem.OutputValues != nil {
-		outputValuesMap["output_values"] = m
-	}
-	if outputValuesItem.ValueType != nil {
-		outputValuesMap["value_type"] = outputValuesItem.ValueType
-	}
-
-	return outputValuesMap
-}
diff --git a/ibm/service/schematics/data_source_ibm_schematics_workspace.go b/ibm/service/schematics/data_source_ibm_schematics_workspace.go
index bdd9f28d1f..7e59232d2f 100644
--- a/ibm/service/schematics/data_source_ibm_schematics_workspace.go
+++ b/ibm/service/schematics/data_source_ibm_schematics_workspace.go
@@ -5,6 +5,7 @@ package schematics
 
 import (
 	"context"
+	"encoding/json"
 	"fmt"
 	"log"
 
@@ -86,30 +87,10 @@ func DataSourceIBMSchematicsWorkspace() *schema.Resource {
 							Description: "The version of the software template that you chose to install from the IBM Cloud catalog.",
 						},
 						"service_extensions": {
-							Type:        schema.TypeList,
+							Type:        schema.TypeString,
 							Computed:    true,
-							Description: "List of service data",
-							Elem: &schema.Resource{
-								Schema: map[string]*schema.Schema{
-									"name": {
-										Type:        schema.TypeString,
-										Computed:    true,
-										Description: "Name of the Service Data.",
-									},
-									"value": {
-										Type:        schema.TypeString,
-										Computed:    true,
-										Description: "Value of the Service Data.",
-									},
-									"type": {
-										Type:        schema.TypeString,
-										Computed:    true,
-										Description: "Type of the value string, int, bool.",
-									},
-								},
-							},
-						},
-					}}},
+							Description: "Service extensions defined as string of json",
+						}}}},
 			"created_at": {
 				Type:        schema.TypeString,
 				Computed:    true,
@@ -880,30 +861,16 @@ func dataSourceWorkspaceResponseCatalogRefToMap(catalogRefItem schematicsv1.Cata
 		catalogRefMap["offering_version"] = catalogRefItem.OfferingVersion
 	}
 	if catalogRefItem.ServiceExtensions != nil {
-		serviceExtensionsList := []map[string]interface{}{}
-		for _, serviceExtensionsItem := range catalogRefItem.ServiceExtensions {
-			serviceExtensionsList = append(serviceExtensionsList, dataSourceWorkspaceResponseCatalogRefServiceExtensionsToMap(serviceExtensionsItem))
+		serviceExtensionsByte, err := json.MarshalIndent(catalogRefItem.ServiceExtensions, "", "")
+		if err != nil {
+			log.Printf("[DEBUG] Marshelling of service extensions failed %s", err)
 		}
-		catalogRefMap["service_extensions"] = serviceExtensionsList
+		serviceExtensionsJSON := string(serviceExtensionsByte[:])
+		catalogRefMap["service_extensions"] = serviceExtensionsJSON
 	}
 	return catalogRefMap
 }
 
-func dataSourceWorkspaceResponseCatalogRefServiceExtensionsToMap(serviceExtensionsItem schematicsv1.ServiceExtensions) (serviceExtensionMap map[string]interface{}) {
-	serviceExtensionMap = map[string]interface{}{}
-
-	if serviceExtensionsItem.Name != nil {
-		serviceExtensionMap["name"] = *serviceExtensionsItem.Name
-	}
-	if serviceExtensionsItem.Type != nil {
-		serviceExtensionMap["type"] = serviceExtensionsItem.Type
-	}
-	if serviceExtensionsItem.Value != nil {
-		serviceExtensionMap["value"] = *serviceExtensionsItem.Value
-	}
-	return serviceExtensionMap
-}
-
 func dataSourceWorkspaceResponseFlattenRuntimeData(result []schematicsv1.TemplateRunTimeDataResponse) (runtimeData []map[string]interface{}) {
 	for _, runtimeDataItem := range result {
 		runtimeData = append(runtimeData, dataSourceWorkspaceResponseRuntimeDataToMap(runtimeDataItem))
diff --git a/ibm/service/schematics/resource_ibm_schematics_agent.go b/ibm/service/schematics/resource_ibm_schematics_agent.go
index edfbf33540..8f7896fd03 100644
--- a/ibm/service/schematics/resource_ibm_schematics_agent.go
+++ b/ibm/service/schematics/resource_ibm_schematics_agent.go
@@ -560,8 +560,12 @@ func resourceIbmSchematicsAgentCreate(context context.Context, d *schema.Resourc
 	}
 
 	createAgentDataOptions := &schematicsv1.CreateAgentDataOptions{
-		XFeatureAgents: core.BoolPtr(true),
+		// XFeatureAgents: core.BoolPtr(true),
 	}
+	ff := map[string]string{
+		"X-Feature-Agents": "true",
+	}
+	createAgentDataOptions.Headers = ff
 
 	createAgentDataOptions.SetName(d.Get("name").(string))
 	createAgentDataOptions.SetResourceGroup(d.Get("resource_group").(string))
@@ -636,9 +640,13 @@ func resourceIbmSchematicsAgentRead(context context.Context, d *schema.ResourceD
 	}
 
 	getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-		XFeatureAgents: core.BoolPtr(true),
-		Profile:        core.StringPtr("detailed"),
+		// XFeatureAgents: core.BoolPtr(true),
+		Profile: core.StringPtr("detailed"),
+	}
+	ff := map[string]string{
+		"X-Feature-Agents": "true",
 	}
+	getAgentDataOptions.Headers = ff
 
 	getAgentDataOptions.SetAgentID(d.Id())
 
@@ -788,8 +796,12 @@ func resourceIbmSchematicsAgentUpdate(context context.Context, d *schema.Resourc
 	}
 
 	updateAgentDataOptions := &schematicsv1.UpdateAgentDataOptions{
-		XFeatureAgents: core.BoolPtr(true),
+		// XFeatureAgents: core.BoolPtr(true),
 	}
+	ff := map[string]string{
+		"X-Feature-Agents": "true",
+	}
+	updateAgentDataOptions.Headers = ff
 
 	updateAgentDataOptions.SetAgentID(d.Id())
 
@@ -878,8 +890,12 @@ func resourceIbmSchematicsAgentDelete(context context.Context, d *schema.Resourc
 	}
 
 	deleteAgentDataOptions := &schematicsv1.DeleteAgentDataOptions{
-		XFeatureAgents: core.BoolPtr(true),
+		// XFeatureAgents: core.BoolPtr(true),
+	}
+	ff := map[string]string{
+		"X-Feature-Agents": "true",
 	}
+	deleteAgentDataOptions.Headers = ff
 
 	deleteAgentDataOptions.SetAgentID(d.Id())
 
diff --git a/ibm/service/schematics/resource_ibm_schematics_agent_deploy.go b/ibm/service/schematics/resource_ibm_schematics_agent_deploy.go
index ec9564c686..7944008120 100644
--- a/ibm/service/schematics/resource_ibm_schematics_agent_deploy.go
+++ b/ibm/service/schematics/resource_ibm_schematics_agent_deploy.go
@@ -120,7 +120,6 @@ func resourceIbmSchematicsAgentDeployCreate(context context.Context, d *schema.R
 
 	d.SetId(fmt.Sprintf("%s/%s", *deployAgentJobOptions.AgentID, *agentDeployJob.JobID))
 	log.Printf("[INFO] Agent : %s", *deployAgentJobOptions.AgentID)
-	d.Set("status_message", *agentDeployJob.StatusMessage)
 
 	_, err = isWaitForAgentAvailable(context, schematicsClient, *deployAgentJobOptions.AgentID, d.Timeout(schema.TimeoutCreate))
 	if err != nil {
@@ -152,10 +151,13 @@ func isWaitForAgentAvailable(context context.Context, schematicsClient *schemati
 func agentRefreshFunc(schematicsClient *schematicsv1.SchematicsV1, id string) resource.StateRefreshFunc {
 	return func() (interface{}, string, error) {
 		getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-			AgentID:        core.StringPtr(id),
-			XFeatureAgents: core.BoolPtr(true),
-			Profile:        core.StringPtr("detailed"),
+			AgentID: core.StringPtr(id),
+			Profile: core.StringPtr("detailed"),
 		}
+		ff := map[string]string{
+			"X-Feature-Agents": "true",
+		}
+		getAgentDataOptions.Headers = ff
 
 		agent, response, err := schematicsClient.GetAgentData(getAgentDataOptions)
 		if err != nil {
@@ -180,9 +182,12 @@ func resourceIbmSchematicsAgentDeployRead(context context.Context, d *schema.Res
 	}
 
 	getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-		XFeatureAgents: core.BoolPtr(true),
-		Profile:        core.StringPtr("detailed"),
+		Profile: core.StringPtr("detailed"),
+	}
+	ff := map[string]string{
+		"X-Feature-Agents": "true",
 	}
+	getAgentDataOptions.Headers = ff
 
 	getAgentDataOptions.SetAgentID(parts[0])
 	agentData, response, err := schematicsClient.GetAgentDataWithContext(context, getAgentDataOptions)
@@ -269,7 +274,6 @@ func resourceIbmSchematicsAgentDeployUpdate(context context.Context, d *schema.R
 			return diag.FromErr(fmt.Errorf("DeployAgentJobWithContext failed %s\n%s", err, response))
 		}
 		d.SetId(fmt.Sprintf("%s/%s", *deployAgentJobOptions.AgentID, *agentDeployJob.JobID))
-		d.Set("status_message", *agentDeployJob.StatusMessage)
 
 		_, err = isWaitForAgentAvailable(context, schematicsClient, parts[0], d.Timeout(schema.TimeoutUpdate))
 		if err != nil {
diff --git a/ibm/service/schematics/resource_ibm_schematics_agent_deploy_test.go b/ibm/service/schematics/resource_ibm_schematics_agent_deploy_test.go
index bd73dc2fcf..da25827366 100644
--- a/ibm/service/schematics/resource_ibm_schematics_agent_deploy_test.go
+++ b/ibm/service/schematics/resource_ibm_schematics_agent_deploy_test.go
@@ -106,9 +106,13 @@ func testAccCheckIbmSchematicsAgentDeployExists(n string, obj *schematicsv1.Agen
 		}
 
 		getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-			XFeatureAgents: core.BoolPtr(true),
-			Profile:        core.StringPtr("detailed"),
+			// XFeatureAgents: core.BoolPtr(true),
+			Profile: core.StringPtr("detailed"),
 		}
+		ff := map[string]string{
+			"X-Feature-Agents": "true",
+		}
+		getAgentDataOptions.Headers = ff
 
 		parts, err := flex.SepIdParts(rs.Primary.ID, "/")
 		if err != nil {
@@ -138,8 +142,8 @@ func testAccCheckIbmSchematicsAgentDeployDestroy(s *terraform.State) error {
 		}
 
 		getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-			XFeatureAgents: core.BoolPtr(true),
-			Profile:        core.StringPtr("detailed"),
+			// XFeatureAgents: core.BoolPtr(true),
+			Profile: core.StringPtr("detailed"),
 		}
 
 		parts, err := flex.SepIdParts(rs.Primary.ID, "/")
diff --git a/ibm/service/schematics/resource_ibm_schematics_agent_health.go b/ibm/service/schematics/resource_ibm_schematics_agent_health.go
index 01f9e5c34b..a49e9e63f9 100644
--- a/ibm/service/schematics/resource_ibm_schematics_agent_health.go
+++ b/ibm/service/schematics/resource_ibm_schematics_agent_health.go
@@ -124,9 +124,13 @@ func resourceIbmSchematicsAgentHealthRead(context context.Context, d *schema.Res
 	}
 
 	getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-		XFeatureAgents: core.BoolPtr(true),
-		Profile:        core.StringPtr("detailed"),
+		// XFeatureAgents: core.BoolPtr(true),
+		Profile: core.StringPtr("detailed"),
 	}
+	ff := map[string]string{
+		"X-Feature-Agents": "true",
+	}
+	getAgentDataOptions.Headers = ff
 
 	getAgentDataOptions.SetAgentID(parts[0])
 
diff --git a/ibm/service/schematics/resource_ibm_schematics_agent_health_test.go b/ibm/service/schematics/resource_ibm_schematics_agent_health_test.go
index 3b20dc5dd5..87577ec253 100644
--- a/ibm/service/schematics/resource_ibm_schematics_agent_health_test.go
+++ b/ibm/service/schematics/resource_ibm_schematics_agent_health_test.go
@@ -106,9 +106,13 @@ func testAccCheckIbmSchematicsAgentHealthExists(n string, obj *schematicsv1.Agen
 		}
 
 		getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-			XFeatureAgents: core.BoolPtr(true),
-			Profile:        core.StringPtr("detailed"),
+			// XFeatureAgents: core.BoolPtr(true),
+			Profile: core.StringPtr("detailed"),
 		}
+		ff := map[string]string{
+			"X-Feature-Agents": "true",
+		}
+		getAgentDataOptions.Headers = ff
 
 		parts, err := flex.SepIdParts(rs.Primary.ID, "/")
 		if err != nil {
@@ -138,8 +142,8 @@ func testAccCheckIbmSchematicsAgentHealthDestroy(s *terraform.State) error {
 		}
 
 		getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-			XFeatureAgents: core.BoolPtr(true),
-			Profile:        core.StringPtr("detailed"),
+			// XFeatureAgents: core.BoolPtr(true),
+			Profile: core.StringPtr("detailed"),
 		}
 
 		parts, err := flex.SepIdParts(rs.Primary.ID, "/")
diff --git a/ibm/service/schematics/resource_ibm_schematics_agent_prs.go b/ibm/service/schematics/resource_ibm_schematics_agent_prs.go
index a672152b16..4bb0950451 100644
--- a/ibm/service/schematics/resource_ibm_schematics_agent_prs.go
+++ b/ibm/service/schematics/resource_ibm_schematics_agent_prs.go
@@ -123,9 +123,13 @@ func resourceIbmSchematicsAgentPrsRead(context context.Context, d *schema.Resour
 	}
 
 	getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-		XFeatureAgents: core.BoolPtr(true),
-		Profile:        core.StringPtr("detailed"),
+		// XFeatureAgents: core.BoolPtr(true),
+		Profile: core.StringPtr("detailed"),
 	}
+	ff := map[string]string{
+		"X-Feature-Agents": "true",
+	}
+	getAgentDataOptions.Headers = ff
 
 	getAgentDataOptions.SetAgentID(parts[0])
 
diff --git a/ibm/service/schematics/resource_ibm_schematics_agent_prs_test.go b/ibm/service/schematics/resource_ibm_schematics_agent_prs_test.go
index 66894e0125..5538cc95bd 100644
--- a/ibm/service/schematics/resource_ibm_schematics_agent_prs_test.go
+++ b/ibm/service/schematics/resource_ibm_schematics_agent_prs_test.go
@@ -105,8 +105,8 @@ func testAccCheckIbmSchematicsAgentPrsExists(n string, obj *schematicsv1.AgentDa
 		}
 
 		getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-			XFeatureAgents: core.BoolPtr(true),
-			Profile:        core.StringPtr("detailed"),
+			// XFeatureAgents: core.BoolPtr(true),
+			Profile: core.StringPtr("detailed"),
 		}
 
 		parts, err := flex.SepIdParts(rs.Primary.ID, "/")
@@ -137,9 +137,13 @@ func testAccCheckIbmSchematicsAgentPrsDestroy(s *terraform.State) error {
 		}
 
 		getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-			XFeatureAgents: core.BoolPtr(true),
-			Profile:        core.StringPtr("detailed"),
+			// XFeatureAgents: core.BoolPtr(true),
+			Profile: core.StringPtr("detailed"),
 		}
+		ff := map[string]string{
+			"X-Feature-Agents": "true",
+		}
+		getAgentDataOptions.Headers = ff
 
 		parts, err := flex.SepIdParts(rs.Primary.ID, "/")
 		if err != nil {
diff --git a/ibm/service/schematics/resource_ibm_schematics_agent_test.go b/ibm/service/schematics/resource_ibm_schematics_agent_test.go
index b4fcbcc098..ac1be46629 100644
--- a/ibm/service/schematics/resource_ibm_schematics_agent_test.go
+++ b/ibm/service/schematics/resource_ibm_schematics_agent_test.go
@@ -13,7 +13,6 @@ import (
 
 	acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest"
 	"github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns"
-	"github.com/IBM/go-sdk-core/v5/core"
 	"github.com/IBM/schematics-go-sdk/schematicsv1"
 )
 
@@ -205,7 +204,7 @@ func testAccCheckIbmSchematicsAgentExists(n string, obj schematicsv1.AgentData)
 		}
 
 		getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-			XFeatureAgents: core.BoolPtr(true),
+			// XFeatureAgents: core.BoolPtr(true),
 		}
 
 		getAgentDataOptions.SetAgentID(rs.Primary.ID)
@@ -231,8 +230,12 @@ func testAccCheckIbmSchematicsAgentDestroy(s *terraform.State) error {
 		}
 
 		getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
-			XFeatureAgents: core.BoolPtr(true),
+			// XFeatureAgents: core.BoolPtr(true),
 		}
+		ff := map[string]string{
+			"X-Feature-Agents": "true",
+		}
+		getAgentDataOptions.Headers = ff
 
 		getAgentDataOptions.SetAgentID(rs.Primary.ID)
 
diff --git a/ibm/service/schematics/resource_ibm_schematics_job.go b/ibm/service/schematics/resource_ibm_schematics_job.go
index 4893b8b7ae..b8927e5101 100644
--- a/ibm/service/schematics/resource_ibm_schematics_job.go
+++ b/ibm/service/schematics/resource_ibm_schematics_job.go
@@ -3701,7 +3701,7 @@ func resourceIBMSchematicsJobMapToJobLogSummary(jobLogSummaryMap map[string]inte
 		jobLogSummary.ElapsedTime = core.Float64Ptr(jobLogSummaryMap["elapsed_time"].(float64))
 	}
 	if jobLogSummaryMap["log_errors"] != nil {
-		logErrors := []schematicsv1.JobLogSummaryLogErrors{}
+		logErrors := []schematicsv1.JobLogSummaryLogErrorsItem{}
 		for _, logErrorsItem := range jobLogSummaryMap["log_errors"].([]interface{}) {
 			logErrorsItemModel := resourceIBMSchematicsJobMapToJobLogSummaryLogErrors(logErrorsItem.(map[string]interface{}))
 			logErrors = append(logErrors, logErrorsItemModel)
@@ -3732,8 +3732,8 @@ func resourceIBMSchematicsJobMapToJobLogSummary(jobLogSummaryMap map[string]inte
 	return jobLogSummary
 }
 
-func resourceIBMSchematicsJobMapToJobLogSummaryLogErrors(jobLogSummaryLogErrorsMap map[string]interface{}) schematicsv1.JobLogSummaryLogErrors {
-	jobLogSummaryLogErrors := schematicsv1.JobLogSummaryLogErrors{}
+func resourceIBMSchematicsJobMapToJobLogSummaryLogErrors(jobLogSummaryLogErrorsMap map[string]interface{}) schematicsv1.JobLogSummaryLogErrorsItem {
+	jobLogSummaryLogErrors := schematicsv1.JobLogSummaryLogErrorsItem{}
 
 	if jobLogSummaryLogErrorsMap["error_code"] != nil {
 		jobLogSummaryLogErrors.ErrorCode = core.StringPtr(jobLogSummaryLogErrorsMap["error_code"].(string))
@@ -4803,7 +4803,7 @@ func resourceIBMSchematicsJobJobLogSummaryToMap(jobLogSummary schematicsv1.JobLo
 	return jobLogSummaryMap
 }
 
-func resourceIBMSchematicsJobJobLogSummaryLogErrorsToMap(jobLogSummaryLogErrors schematicsv1.JobLogSummaryLogErrors) map[string]interface{} {
+func resourceIBMSchematicsJobJobLogSummaryLogErrorsToMap(jobLogSummaryLogErrors schematicsv1.JobLogSummaryLogErrorsItem) map[string]interface{} {
 	jobLogSummaryLogErrorsMap := map[string]interface{}{}
 
 	if jobLogSummaryLogErrors.ErrorCode != nil {
diff --git a/website/docs/d/schematics_workspace.html.markdown b/website/docs/d/schematics_workspace.html.markdown
index 2f21acc368..4aa3a50e45 100644
--- a/website/docs/d/schematics_workspace.html.markdown
+++ b/website/docs/d/schematics_workspace.html.markdown
@@ -45,11 +45,7 @@ Nested scheme for **catalog_ref**:
 	* `item_url` - (String) The URL to the software template in the IBM Cloud catalog.
 	* `launch_url` - (String) The URL to the dashboard to access your software.
 	* `offering_version` - (String) The version of the software template that you chose to install from the IBM Cloud catalog.
-	* `service_extensions` - (List) List of service data
-Nested scheme for **service_extensions**:
-	* `name` - (String) Name of the Service Data.
-	* `value` - (String) Value of the Service Data.
-	* `type` - (String) Type of the value string, int, bool.
+	* `service_extensions` - (String) Service extensions defined as string of json
 
 * `created_at` - (String) The timestamp when the workspace was created.
 

From 3f33267716b0537d490facf30efd6fbe7c48e046 Mon Sep 17 00:00:00 2001
From: michael kad 
Date: Wed, 3 Jan 2024 09:01:42 -0600
Subject: [PATCH 124/132] Revert VPN Changes, will go in at end Q1

---
 go.mod                                        | 20 ++++----
 go.sum                                        | 47 ++++++++-----------
 .../docs/r/pi_vpn_connection.html.markdown    |  4 +-
 3 files changed, 31 insertions(+), 40 deletions(-)

diff --git a/go.mod b/go.mod
index 4248d65661..da656ead28 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.18
 require (
 	github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc
 	github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231116055201-2a84da7b9bd6
-	github.com/IBM-Cloud/power-go-client v1.5.7
+	github.com/IBM-Cloud/power-go-client v1.5.8
 	github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca
 	github.com/IBM/appconfiguration-go-admin-sdk v0.3.0
 	github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f
@@ -38,7 +38,7 @@ require (
 	github.com/apache/openwhisk-client-go v0.0.0-20200201143223-a804fb82d105
 	github.com/apparentlymart/go-cidr v1.1.0
 	github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
-	github.com/go-openapi/strfmt v0.21.9
+	github.com/go-openapi/strfmt v0.21.10
 	github.com/golang-jwt/jwt v3.2.2+incompatible
 	github.com/google/go-cmp v0.6.0
 	github.com/google/uuid v1.4.0
@@ -102,15 +102,15 @@ require (
 	github.com/go-jose/go-jose/v3 v3.0.1 // indirect
 	github.com/go-logr/logr v1.3.0 // indirect
 	github.com/go-logr/stdr v1.2.2 // indirect
-	github.com/go-openapi/analysis v0.21.4 // indirect
-	github.com/go-openapi/errors v0.20.4 // indirect
-	github.com/go-openapi/jsonpointer v0.20.0 // indirect
-	github.com/go-openapi/jsonreference v0.20.2 // indirect
-	github.com/go-openapi/loads v0.21.2 // indirect
+	github.com/go-openapi/analysis v0.21.5 // indirect
+	github.com/go-openapi/errors v0.21.0 // indirect
+	github.com/go-openapi/jsonpointer v0.20.1 // indirect
+	github.com/go-openapi/jsonreference v0.20.3 // indirect
+	github.com/go-openapi/loads v0.21.3 // indirect
 	github.com/go-openapi/runtime v0.26.0 // indirect
-	github.com/go-openapi/spec v0.20.11 // indirect
-	github.com/go-openapi/swag v0.22.4 // indirect
-	github.com/go-openapi/validate v0.22.3 // indirect
+	github.com/go-openapi/spec v0.20.12 // indirect
+	github.com/go-openapi/swag v0.22.5 // indirect
+	github.com/go-openapi/validate v0.22.4 // indirect
 	github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect
 	github.com/go-playground/locales v0.14.1 // indirect
 	github.com/go-playground/universal-translator v0.18.1 // indirect
diff --git a/go.sum b/go.sum
index f32ddb4c0b..1b508fa5cb 100644
--- a/go.sum
+++ b/go.sum
@@ -106,8 +106,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc/go.mod h1:jIG
 github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231116055201-2a84da7b9bd6 h1:QXU1Atl/JSI3ZtYB9tHbWLhrFYE1E+5Iww1sjQ7mqdo=
 github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231116055201-2a84da7b9bd6/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY=
 github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs=
-github.com/IBM-Cloud/power-go-client v1.5.7 h1:B1EOApEtlOb7tjZkAg9g8GTZthFKmjNU8XqONocBw7c=
-github.com/IBM-Cloud/power-go-client v1.5.7/go.mod h1:jsa4ujstGjKWbfu3SQML8KLJDvpGZLErWnlmfKKCQrs=
+github.com/IBM-Cloud/power-go-client v1.5.8 h1:4l9PmnYRXV/KfVNBRuc9hya6kW5cQZhN4UMUMdpn1JU=
+github.com/IBM-Cloud/power-go-client v1.5.8/go.mod h1:y4WDw/l9+29CKX98ngCCvGoHdzX49LL00B1euoAbWzQ=
 github.com/IBM-Cloud/softlayer-go v1.0.5-tf h1:koUAyF9b6X78lLLruGYPSOmrfY2YcGYKOj/Ug9nbKNw=
 github.com/IBM-Cloud/softlayer-go v1.0.5-tf/go.mod h1:6HepcfAXROz0Rf63krk5hPZyHT6qyx2MNvYyHof7ik4=
 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca h1:crniVcf+YcmgF03NmmfonXwSQ73oJF+IohFYBwknMxs=
@@ -494,8 +494,8 @@ github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpR
 github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik=
 github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk=
 github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU=
-github.com/go-openapi/analysis v0.21.4 h1:ZDFLvSNxpDaomuCueM0BlSXxpANBlFYiBvr+GXrvIHc=
-github.com/go-openapi/analysis v0.21.4/go.mod h1:4zQ35W4neeZTqh3ol0rv/O8JBbka9QyAgQRPp9y3pfo=
+github.com/go-openapi/analysis v0.21.5 h1:3tHfEBh6Ia8eKc4M7khOGjPOAlWKJ10d877Cr9teujI=
+github.com/go-openapi/analysis v0.21.5/go.mod h1:25YcZosX9Lwz2wBsrFrrsL8bmjjXdlyP6zsr2AMy29M=
 github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0=
 github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0=
 github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94=
@@ -503,32 +503,30 @@ github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpX
 github.com/go-openapi/errors v0.20.0/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M=
 github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M=
 github.com/go-openapi/errors v0.20.3/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk=
-github.com/go-openapi/errors v0.20.4 h1:unTcVm6PispJsMECE3zWgvG4xTiKda1LIR5rCRWLG6M=
-github.com/go-openapi/errors v0.20.4/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk=
+github.com/go-openapi/errors v0.21.0 h1:FhChC/duCnfoLj1gZ0BgaBmzhJC2SL/sJr8a2vAobSY=
+github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho=
 github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
 github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
 github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
 github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
 github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
 github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
-github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
-github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ=
-github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA=
+github.com/go-openapi/jsonpointer v0.20.1 h1:MkK4VEIEZMj4wT9PmjaUmGflVBr9nvud4Q4UVFbDoBE=
+github.com/go-openapi/jsonpointer v0.20.1/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs=
 github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
 github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
 github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
 github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
 github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8=
-github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo=
-github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
-github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
+github.com/go-openapi/jsonreference v0.20.3 h1:EjGcjTW8pD1mRis6+w/gmoBdqv5+RbE9B85D1NgDOVQ=
+github.com/go-openapi/jsonreference v0.20.3/go.mod h1:FviDZ46i9ivh810gqzFLl5NttD5q3tSlMLqLr6okedM=
 github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU=
 github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU=
 github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU=
 github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs=
 github.com/go-openapi/loads v0.19.4/go.mod h1:zZVHonKd8DXyxyw4yfnVjPzBjIQcLt0CCsn0N0ZrQsk=
-github.com/go-openapi/loads v0.21.2 h1:r2a/xFIYeZ4Qd2TnGpWDIQNcP80dIaZgf704za8enro=
-github.com/go-openapi/loads v0.21.2/go.mod h1:Jq58Os6SSGz0rzh62ptiu8Z31I+OTHqmULx5e/gJbNw=
+github.com/go-openapi/loads v0.21.3 h1:8sSH2FIm/SnbDUGv572md4YqVMFne/a9Eubvcd3anew=
+github.com/go-openapi/loads v0.21.3/go.mod h1:Y3aMR24iHbKHppOj91nQ/SHc0cuPbAr4ndY4a02xydc=
 github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA=
 github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64=
 github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4=
@@ -539,9 +537,8 @@ github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsd
 github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
 github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY=
 github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo=
-github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA=
-github.com/go-openapi/spec v0.20.11 h1:J/TzFDLTt4Rcl/l1PmyErvkqlJDncGvPTMnCI39I4gY=
-github.com/go-openapi/spec v0.20.11/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA=
+github.com/go-openapi/spec v0.20.12 h1:cgSLbrsmziAP2iais+Vz7kSazwZ8rsUZd6TUzdDgkVI=
+github.com/go-openapi/spec v0.20.12/go.mod h1:iSCgnBcwbMW9SfzJb8iYynXvcY6C/QFrI7otzF7xGM4=
 github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU=
 github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU=
 github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY=
@@ -554,23 +551,20 @@ github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrC
 github.com/go-openapi/strfmt v0.21.2/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k=
 github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg=
 github.com/go-openapi/strfmt v0.21.7/go.mod h1:adeGTkxE44sPyLk0JV235VQAO/ZXUr8KAzYjclFs3ew=
-github.com/go-openapi/strfmt v0.21.9 h1:LnEGOO9qyEC1v22Bzr323M98G13paIUGPU7yeJtG9Xs=
-github.com/go-openapi/strfmt v0.21.9/go.mod h1:0k3v301mglEaZRJdDDGSlN6Npq4VMVU69DE0LUyf7uA=
+github.com/go-openapi/strfmt v0.21.10 h1:JIsly3KXZB/Qf4UzvzJpg4OELH/0ASDQsyk//TTBDDk=
+github.com/go-openapi/strfmt v0.21.10/go.mod h1:vNDMwbilnl7xKiO/Ve/8H8Bb2JIInBnH+lqiw6QWgis=
 github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
 github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
 github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
 github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
 github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
-github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
-github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
-github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
-github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
-github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
+github.com/go-openapi/swag v0.22.5 h1:fVS63IE3M0lsuWRzuom3RLwUMVI2peDH01s6M70ugys=
+github.com/go-openapi/swag v0.22.5/go.mod h1:Gl91UqO+btAM0plGGxHqJcQZ1ZTy6jbmridBTsDy8A0=
 github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4=
 github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA=
 github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4=
-github.com/go-openapi/validate v0.22.3 h1:KxG9mu5HBRYbecRb37KRCihvGGtND2aXziBAv0NNfyI=
-github.com/go-openapi/validate v0.22.3/go.mod h1:kVxh31KbfsxU8ZyoHaDbLBWU5CnMdqBUEtadQ2G4d5M=
+github.com/go-openapi/validate v0.22.4 h1:5v3jmMyIPKTR8Lv9syBAIRxG6lY0RqeBPB1LKEijzk8=
+github.com/go-openapi/validate v0.22.4/go.mod h1:qm6O8ZIcPVdSY5219468Jv7kBdGvkiZLPOmqnqTUZ2A=
 github.com/go-ozzo/ozzo-validation v3.6.0+incompatible h1:msy24VGS42fKO9K1vLz82/GeYW1cILu7Nuuj1N3BBkE=
 github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es=
 github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew=
@@ -1114,7 +1108,6 @@ github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN
 github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
 github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
 github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
-github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
 github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
 github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE=
diff --git a/website/docs/r/pi_vpn_connection.html.markdown b/website/docs/r/pi_vpn_connection.html.markdown
index 2b63272631..1fc2a0117a 100644
--- a/website/docs/r/pi_vpn_connection.html.markdown
+++ b/website/docs/r/pi_vpn_connection.html.markdown
@@ -8,10 +8,8 @@ description: |-
 ---
 
 # ibm_pi_vpn_connection
-Update or delete a VPN connection. For more information, about IBM power virtual server cloud, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started).
+Create, update, delete a VPN connection. For more information, about IBM power virtual server cloud, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started).
 
-~> **Deprecated:**
-  Create VPN connection is deprecated and no longer supported. Existing `pi_vpn_connection` will still have support for `update` and `delete`.
 ## Example usage
 The following example creates a VPN Connection.
 

From 295dcc12353818eba989c8dbcd22fa3868b16d49 Mon Sep 17 00:00:00 2001
From: yonatanyell <69857977+yonatanyell@users.noreply.github.com>
Date: Thu, 4 Jan 2024 07:36:41 +0200
Subject: [PATCH 125/132] SM docs bug fix (#5018)

* SC addition

* SC addition

* SC addition

* update function updated

* SC unit tests added

* SC unit tests added

* d

* tests fixes

* tests fixes

* update sdk

* .secrets.baseline update

* .secrets.baseline update

* .secrets.baseline update

* Update sm_service_credentials_secret_metadata.html.markdown

* bugs fixes

* bugs fixes

* bugs fixes

* docs bugs fixes

---------

Co-authored-by: Yonathan-Yellin 
Co-authored-by: Avi Ribchinsky 
Co-authored-by: Tatyana 
Co-authored-by: Idan Adar 
---
 website/docs/r/sm_service_credentials_secret.html.markdown | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/website/docs/r/sm_service_credentials_secret.html.markdown b/website/docs/r/sm_service_credentials_secret.html.markdown
index cdf60c3e9f..12b43a166b 100644
--- a/website/docs/r/sm_service_credentials_secret.html.markdown
+++ b/website/docs/r/sm_service_credentials_secret.html.markdown
@@ -43,6 +43,7 @@ resource "ibm_sm_service_credentials_secret" "sm_service_credentials_secret" {
 
 ```terraform
 resource "ibm_sm_service_credentials_secret" "sm_service_credentials_secret" {
+  instance_id   = ibm_resource_instance.sm_instance.guid
   region        = "us-south"
   name 			= "secret-name"
   source_service {
@@ -89,11 +90,11 @@ Nested scheme for **rotation**:
 	  * Constraints: Allowable values are: `day`, `month`.
 * `secret_group_id` - (Optional, Forces new resource, String) A v4 UUID identifier, or `default` secret group.
   * Constraints: The maximum length is `36` characters. The minimum length is `7` characters. The value must match regular expression `/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|default)$/`.
-* `source_service` - (Optional, List) The properties required for creating the service credentials for the specified source service instance.
+* `source_service` - (Required, List) The properties required for creating the service credentials for the specified source service instance.
 Nested scheme for **source_service**:
-    * `instance` - (Optional, List) The source service instance identifier.
+    * `instance` - (Required, List) The source service instance identifier.
       Nested scheme for **instance**:
-          * `crn` - (Optional, String) A CRN that uniquely identifies a service credentials source.
+          * `crn` - (Required, String) A CRN that uniquely identifies a service credentials source.
     * `role` - (Optional, List) The service-specific custom role object, CRN role is accepted. Refer to the service’s documentation for supported roles.
       Nested scheme for **role**:
           * `crn` - (Optional, String) The service role CRN.

From 78ebdfb20af9d490992c068d8a9de118abfeb364 Mon Sep 17 00:00:00 2001
From: sreekarbvibm <139211144+sreekarbvibm@users.noreply.github.com>
Date: Wed, 27 Dec 2023 13:09:55 +0530
Subject: [PATCH 126/132] fix(docs): UI-33634: mention correct image name in
 image data source example

---
 website/docs/d/is_image.html.markdown | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/website/docs/d/is_image.html.markdown b/website/docs/d/is_image.html.markdown
index 994d2f510e..e5a27a0ada 100644
--- a/website/docs/d/is_image.html.markdown
+++ b/website/docs/d/is_image.html.markdown
@@ -25,7 +25,7 @@ provider "ibm" {
 ```terraform
 
 data "ibm_is_image" "example" {
-  name = "centos-7.x-amd64"
+  name = "ibm-centos-7-9-minimal-amd64-12"
 }
 ```
 ```terraform

From 6813506dece4528e326e44c15b69f7235d0ce035 Mon Sep 17 00:00:00 2001
From: hkantare 
Date: Fri, 5 Jan 2024 17:41:49 +0530
Subject: [PATCH 127/132] Bump up version to 1.61.0

---
 CHANGELOG.md       | 56 ++++++++++++++++++++++++++++++++++++++++++++++
 version/version.go |  2 +-
 2 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 342d230a24..3385e48a4c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,59 @@
+# 1.61.0 (Jan 05, 2024)
+Features
+* Support for MQ on Cloud
+    - **Datasources**
+       - ibm_mqcloud_queue_manager
+       - ibm_mqcloud_queue_manager_status
+       - ibm_mqcloud_application 
+       - ibm_mqcloud_user
+       - ibm_mqcloud_keystore_certificate
+       - ibm_mqcloud_truststore_certificate
+    - **Resources**
+       - ibm_mqcloud_queue_manager
+       - ibm_mqcloud_application 
+       - ibm_mqcloud_user
+       - ibm_mqcloud_keystore_certificate
+       - ibm_mqcloud_truststore_certificate
+* Support for Secret Manager
+     - **Datasources**
+        - ibm_sm_service_credentials_secret_metadata
+        - ibm_sm_service_credentials_secret
+     - **Resources**
+        - ibm_sm_service_credentials_secret
+* Support for VPC
+     - **Datasources**
+        - ibm_is_snapshot_consistency_group
+        - ibm_is_snapshot_consistency_groups
+     - **Resources**
+        - ibm_is_snapshot_consistency_group
+
+Enhancements
+* feat(Cloud Databases): Database user password complexity validation ([4931](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4931))
+* Update pi_user_data to accept string input ([4974](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4974))
+* support host_link_agent_endpoint for Satellite host ([4970](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4970))
+* Add mtu and accessConfig flags to subnet create commands for terraform ([4690](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4690))
+* feat(Cloud Databases): Redis Database User RBAC support ([4982](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4982))
+* fix(Cloud Databases): fix Unwrap return value for go 1.18 compat ([4991](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4991))
+* update issue fixed ibm_is_subnet_reserved_ip ([4988](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4988))
+* Adding Flexible IOPS ([4992](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4992))
+* Removing Support For Power VPN Create ([4993](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4993))
+* Feature(share-crr): Share cross region replication ([4995](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4995))
+* Enhancement: Added operating system attributes to is images datasources ([4998](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4998))
+* added enhancement to one step delegate resolver in is_vpc ([5000](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/5000))
+* resolved delete issue for the floated nics on bm server ([5001](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/5001))
+* Regenerate projects provider based off the latest go sdk ([5003](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/5003))
+* Support route advertising in vpc ([5005](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/5005))
+* Add a nil check for boottarget of bms ([5014](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/5014))
+* Delete wait logic changes ([5017](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/5017))
+
+BugFixes
+* Fix IBM pi documentation bug ([4969](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4969))
+* Incorrect key_algorithm handling forces delete & replace of ibm_sm_private_certificate on every apply ([4978](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4978))
+* ibm_sm_private_certificate_configuration_template arguments ttl and max_ttl are not documented ([4977](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4977))
+* ibm_sm_private_certificate unsupported argument: rotation.rotate_keys ([4976](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4976))
+* data ibm_schematics_workspace bug ([4990](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4990))
+* Secret Manager docs bug fix ([5018](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/5018))
+
 # 1.61.0-beta0 (Dec 20, 2023)
 Features
 * Support for MQ on Cloud
diff --git a/version/version.go b/version/version.go
index 09a75ca980..87cf3b417d 100644
--- a/version/version.go
+++ b/version/version.go
@@ -5,7 +5,7 @@ import (
 )
 
 // Version is the current provider main version
-const Version = "1.61.0-beta0"
+const Version = "1.61.0"
 
 // GitCommit is the git commit that was compiled. This will be filled in by the compiler.
 var GitCommit string

From b991118092aebc153f86b113b9a82f5bd4410520 Mon Sep 17 00:00:00 2001
From: hkantare 
Date: Fri, 5 Jan 2024 19:04:57 +0530
Subject: [PATCH 128/132] update go version to 1.19

---
 .github/workflows/go.yml      | 2 +-
 .github/workflows/release.yml | 2 +-
 .travis.yml                   | 2 +-
 go.mod                        | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index 2fd6abc9a2..856a64b814 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -16,7 +16,7 @@ jobs:
     - name: Set up Go 1.x
       uses: actions/setup-go@v5
       with:
-        go-version: ^1.18
+        go-version: ^1.19
       id: go
 
     - name: Check out code into the Go module directory
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 2bf9694fad..8b22906eb9 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -28,7 +28,7 @@ jobs:
         name: Set up Go
         uses: actions/setup-go@v5
         with:
-          go-version: 1.18
+          go-version: 1.19
       -
         name: Import GPG key
         id: import_gpg
diff --git a/.travis.yml b/.travis.yml
index 06452293b7..8b5a0e900f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,7 +2,7 @@ dist: bionic
 sudo: false
 language: go
 go:
-  - 1.18.x
+  - 1.19.x
 
 addons:
   apt:
diff --git a/go.mod b/go.mod
index da656ead28..f9c2987535 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
 module github.com/IBM-Cloud/terraform-provider-ibm
 
-go 1.18
+go 1.19
 
 require (
 	github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc

From ad8eae36f3ee5c35be8023aa7d9f539bf49e7e98 Mon Sep 17 00:00:00 2001
From: Gary Marjoram 
Date: Tue, 12 Dec 2023 14:38:27 +0000
Subject: [PATCH 129/132] CD scc doc updates

---
 .../data_source_ibm_cd_toolchain_tool_securitycompliance.go     | 2 +-
 .../resource_ibm_cd_toolchain_tool_securitycompliance.go        | 2 +-
 .../docs/d/cd_toolchain_tool_securitycompliance.html.markdown   | 2 +-
 .../docs/r/cd_toolchain_tool_securitycompliance.html.markdown   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance.go b/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance.go
index 143fe95bb7..95c298e1b0 100644
--- a/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance.go
+++ b/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance.go
@@ -99,7 +99,7 @@ func DataSourceIBMCdToolchainToolSecuritycompliance() *schema.Resource {
 						"use_profile_attachment": &schema.Schema{
 							Type:        schema.TypeString,
 							Computed:    true,
-							Description: "Set to `enabled` to enable use profile with attachment, so that the scripts in the pipeline can interact with the Security and Compliance Center service. When enabled, other parameters become relevant; `scc_api_key`, `instance_crn`, `profile_name`, `profile_version`, `attachment_id`.",
+							Description: "Set to `enabled` to enable use profile with attachment, so that the scripts in the pipeline can interact with the Security and Compliance Center service to perform pre-deploy validation against compliance rules for Continuous Deployment (CD) and compliance monitoring for Continuous Compliance (CC). When enabled, other parameters become relevant; `scc_api_key`, `instance_crn`, `profile_name`, `profile_version`, `attachment_id`.",
 						},
 						"scc_api_key": &schema.Schema{
 							Type:        schema.TypeString,
diff --git a/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance.go b/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance.go
index be80157483..de7725163e 100644
--- a/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance.go
+++ b/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance.go
@@ -63,7 +63,7 @@ func ResourceIBMCdToolchainToolSecuritycompliance() *schema.Resource {
 						"use_profile_attachment": &schema.Schema{
 							Type:        schema.TypeString,
 							Optional:    true,
-							Description: "Set to `enabled` to enable use profile with attachment, so that the scripts in the pipeline can interact with the Security and Compliance Center service. When enabled, other parameters become relevant; `scc_api_key`, `instance_crn`, `profile_name`, `profile_version`, `attachment_id`.",
+							Description: "Set to `enabled` to enable use profile with attachment, so that the scripts in the pipeline can interact with the Security and Compliance Center service to perform pre-deploy validation against compliance rules for Continuous Deployment (CD) and compliance monitoring for Continuous Compliance (CC). When enabled, other parameters become relevant; `scc_api_key`, `instance_crn`, `profile_name`, `profile_version`, `attachment_id`.",
 						},
 						"scc_api_key": &schema.Schema{
 							Type:             schema.TypeString,
diff --git a/website/docs/d/cd_toolchain_tool_securitycompliance.html.markdown b/website/docs/d/cd_toolchain_tool_securitycompliance.html.markdown
index bf3493ad3e..524c2740cf 100644
--- a/website/docs/d/cd_toolchain_tool_securitycompliance.html.markdown
+++ b/website/docs/d/cd_toolchain_tool_securitycompliance.html.markdown
@@ -55,7 +55,7 @@ Nested schema for **parameters**:
 	* `profile_name` - (String) The name of a Security and Compliance Center profile. Usually, use the "IBM Cloud Framework for Financial Services" predefined profile, which contains the DevSecOps Toolchain rules. Or use a user-authored customized profile that has been configured to contain those rules. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`.
 	* `profile_version` - (String) The version of a Security and Compliance Center profile, in SemVer format, like '0.0.0'. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`.
 	* `scc_api_key` - (String) The IBM Cloud API key used to access the Security and Compliance Center service, for the use profile with attachment setting. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. You can use a toolchain secret reference for this parameter. For more information, see [Protecting your sensitive data in Continuous Delivery](https://cloud.ibm.com/docs/ContinuousDelivery?topic=ContinuousDelivery-cd_data_security#cd_secure_credentials).
-	* `use_profile_attachment` - (String) Set to `enabled` to enable use profile with attachment, so that the scripts in the pipeline can interact with the Security and Compliance Center service. When enabled, other parameters become relevant; `scc_api_key`, `instance_crn`, `profile_name`, `profile_version`, `attachment_id`.
+	* `use_profile_attachment` - (String) Set to `enabled` to enable use profile with attachment, so that the scripts in the pipeline can interact with the Security and Compliance Center service to perform pre-deploy validation against compliance rules for Continuous Deployment (CD) and compliance monitoring for Continuous Compliance (CC). When enabled, other parameters become relevant; `scc_api_key`, `instance_crn`, `profile_name`, `profile_version`, `attachment_id`.
 	  * Constraints: Allowable values are: `disabled`, `enabled`.
 
 * `referent` - (List) Information on URIs to access this resource through the UI or API.
diff --git a/website/docs/r/cd_toolchain_tool_securitycompliance.html.markdown b/website/docs/r/cd_toolchain_tool_securitycompliance.html.markdown
index 47011c756e..40d68237f7 100644
--- a/website/docs/r/cd_toolchain_tool_securitycompliance.html.markdown
+++ b/website/docs/r/cd_toolchain_tool_securitycompliance.html.markdown
@@ -44,7 +44,7 @@ Nested schema for **parameters**:
 	* `profile_name` - (Optional, String) The name of a Security and Compliance Center profile. Usually, use the "IBM Cloud Framework for Financial Services" predefined profile, which contains the DevSecOps Toolchain rules. Or use a user-authored customized profile that has been configured to contain those rules. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`.
 	* `profile_version` - (Optional, String) The version of a Security and Compliance Center profile, in SemVer format, like '0.0.0'. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`.
 	* `scc_api_key` - (Optional, String) The IBM Cloud API key used to access the Security and Compliance Center service, for the use profile with attachment setting. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`. You can use a toolchain secret reference for this parameter. For more information, see [Protecting your sensitive data in Continuous Delivery](https://cloud.ibm.com/docs/ContinuousDelivery?topic=ContinuousDelivery-cd_data_security#cd_secure_credentials).
-	* `use_profile_attachment` - (Optional, String) Set to `enabled` to enable use profile with attachment, so that the scripts in the pipeline can interact with the Security and Compliance Center service. When enabled, other parameters become relevant; `scc_api_key`, `instance_crn`, `profile_name`, `profile_version`, `attachment_id`.
+	* `use_profile_attachment` - (Optional, String) Set to `enabled` to enable use profile with attachment, so that the scripts in the pipeline can interact with the Security and Compliance Center service to perform pre-deploy validation against compliance rules for Continuous Deployment (CD) and compliance monitoring for Continuous Compliance (CC). When enabled, other parameters become relevant; `scc_api_key`, `instance_crn`, `profile_name`, `profile_version`, `attachment_id`.
 	  * Constraints: Allowable values are: `disabled`, `enabled`.
 * `toolchain_id` - (Required, Forces new resource, String) ID of the toolchain to bind the tool to.
   * Constraints: The maximum length is `36` characters. The minimum length is `36` characters. The value must match regular expression `/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$/`.

From ba2dedbd327fdfff9483a0f3afbfd551edc7b2b2 Mon Sep 17 00:00:00 2001
From: Gary Marjoram 
Date: Tue, 9 Jan 2024 15:31:50 +0000
Subject: [PATCH 130/132] Latest SCC description updates

---
 .../data_source_ibm_cd_toolchain_tool_securitycompliance.go   | 4 ++--
 .../resource_ibm_cd_toolchain_tool_securitycompliance.go      | 4 ++--
 .../docs/d/cd_toolchain_tool_securitycompliance.html.markdown | 2 +-
 .../docs/r/cd_toolchain_tool_securitycompliance.html.markdown | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance.go b/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance.go
index 95c298e1b0..8f7ab24ed1 100644
--- a/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance.go
+++ b/ibm/service/cdtoolchain/data_source_ibm_cd_toolchain_tool_securitycompliance.go
@@ -1,4 +1,4 @@
-// Copyright IBM Corp. 2023 All Rights Reserved.
+// Copyright IBM Corp. 2024 All Rights Reserved.
 // Licensed under the Mozilla Public License v2.0
 
 package cdtoolchain
@@ -94,7 +94,7 @@ func DataSourceIBMCdToolchainToolSecuritycompliance() *schema.Resource {
 						"evidence_namespace": &schema.Schema{
 							Type:        schema.TypeString,
 							Computed:    true,
-							Description: "The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment pipeline, or `cc` which will use evidence generated by a Continuous Compliance pipeline.",
+							Description: "The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment (CD) pipeline, or `cc` which will use evidence generated by a Continuous Compliance (CC) pipeline. The default behavior is to use the CD evidence.",
 						},
 						"use_profile_attachment": &schema.Schema{
 							Type:        schema.TypeString,
diff --git a/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance.go b/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance.go
index de7725163e..d6d382ba56 100644
--- a/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance.go
+++ b/ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_securitycompliance.go
@@ -1,4 +1,4 @@
-// Copyright IBM Corp. 2023 All Rights Reserved.
+// Copyright IBM Corp. 2024 All Rights Reserved.
 // Licensed under the Mozilla Public License v2.0
 
 package cdtoolchain
@@ -58,7 +58,7 @@ func ResourceIBMCdToolchainToolSecuritycompliance() *schema.Resource {
 						"evidence_namespace": &schema.Schema{
 							Type:        schema.TypeString,
 							Optional:    true,
-							Description: "The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment pipeline, or `cc` which will use evidence generated by a Continuous Compliance pipeline.",
+							Description: "The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment (CD) pipeline, or `cc` which will use evidence generated by a Continuous Compliance (CC) pipeline. The default behavior is to use the CD evidence.",
 						},
 						"use_profile_attachment": &schema.Schema{
 							Type:        schema.TypeString,
diff --git a/website/docs/d/cd_toolchain_tool_securitycompliance.html.markdown b/website/docs/d/cd_toolchain_tool_securitycompliance.html.markdown
index 524c2740cf..bff8d39dca 100644
--- a/website/docs/d/cd_toolchain_tool_securitycompliance.html.markdown
+++ b/website/docs/d/cd_toolchain_tool_securitycompliance.html.markdown
@@ -46,7 +46,7 @@ After your data source is created, you can read values from the following attrib
 Nested schema for **parameters**:
 	* `attachment_id` - (String) An attachment ID. An attachment is configured under a profile to define how a scan will be run. To find the attachment ID, in the browser, in the attachments list, click on the attachment link, and a panel appears with a button to copy the attachment ID. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`.
 	  * Constraints: The value must match regular expression `/^[-0-9a-f]{32,36}$/`.
-	* `evidence_namespace` - (String) The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment pipeline, or `cc` which will use evidence generated by a Continuous Compliance pipeline.
+	* `evidence_namespace` - (String) The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment (CD) pipeline, or `cc` which will use evidence generated by a Continuous Compliance (CC) pipeline. The default behavior is to use the CD evidence.
 	  * Constraints: Allowable values are: `cd`, `cc`.
 	* `evidence_repo_url` - (String) The URL to a Git repository evidence locker. The DevSecOps toolchain templates will collect and store evidence for scans and tasks in an evidence repository. This evidence URL should match the `repo_url` for a Git tool integration in this toolchain. The DevSecOps toolchain goals in the Security and Compliance Center will check the evidence repository for the pass or fail results for those goals.
 	* `instance_crn` - (String) The Security and Compliance Center service instance CRN (Cloud Resource Name). It is recommended to provide an instance CRN, but when absent, the oldest service instance will be used. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`.
diff --git a/website/docs/r/cd_toolchain_tool_securitycompliance.html.markdown b/website/docs/r/cd_toolchain_tool_securitycompliance.html.markdown
index 40d68237f7..45378f9847 100644
--- a/website/docs/r/cd_toolchain_tool_securitycompliance.html.markdown
+++ b/website/docs/r/cd_toolchain_tool_securitycompliance.html.markdown
@@ -35,7 +35,7 @@ You can specify the following arguments for this resource.
 Nested schema for **parameters**:
 	* `attachment_id` - (Optional, String) An attachment ID. An attachment is configured under a profile to define how a scan will be run. To find the attachment ID, in the browser, in the attachments list, click on the attachment link, and a panel appears with a button to copy the attachment ID. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`.
 	  * Constraints: The value must match regular expression `/^[-0-9a-f]{32,36}$/`.
-	* `evidence_namespace` - (Optional, String) The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment pipeline, or `cc` which will use evidence generated by a Continuous Compliance pipeline.
+	* `evidence_namespace` - (Optional, String) The kind of pipeline evidence to be displayed in Security and Compliance Center for this toolchain. The values are; `cd` which will use evidence generated by a Continuous Deployment (CD) pipeline, or `cc` which will use evidence generated by a Continuous Compliance (CC) pipeline. The default behavior is to use the CD evidence.
 	  * Constraints: Allowable values are: `cd`, `cc`.
 	* `evidence_repo_url` - (Required, String) The URL to a Git repository evidence locker. The DevSecOps toolchain templates will collect and store evidence for scans and tasks in an evidence repository. This evidence URL should match the `repo_url` for a Git tool integration in this toolchain. The DevSecOps toolchain goals in the Security and Compliance Center will check the evidence repository for the pass or fail results for those goals.
 	* `instance_crn` - (Optional, String) The Security and Compliance Center service instance CRN (Cloud Resource Name). It is recommended to provide an instance CRN, but when absent, the oldest service instance will be used. This parameter is only relevant when the `use_profile_attachment` parameter is `enabled`.

From 8d929f3014d60beb81a7c209b4a209a625ec48b1 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 8 Jan 2024 16:55:00 +0000
Subject: [PATCH 131/132] dependabot: bump github.com/cloudflare/circl from
 1.3.3 to 1.3.7

Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.3 to 1.3.7.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.3.3...v1.3.7)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] 
---
 go.mod | 2 +-
 go.sum | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/go.mod b/go.mod
index f9c2987535..55a52d0104 100644
--- a/go.mod
+++ b/go.mod
@@ -83,7 +83,7 @@ require (
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/cenkalti/backoff/v3 v3.2.2 // indirect
 	github.com/cespare/xxhash/v2 v2.2.0 // indirect
-	github.com/cloudflare/circl v1.3.3 // indirect
+	github.com/cloudflare/circl v1.3.7 // indirect
 	github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 // indirect
 	github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
 	github.com/coreos/pkg v0.0.0-20220810130054-c7d1c02cb6cf // indirect
diff --git a/go.sum b/go.sum
index 1b508fa5cb..b1db6b42b2 100644
--- a/go.sum
+++ b/go.sum
@@ -314,8 +314,9 @@ github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6D
 github.com/circonus-labs/circonusllhist v0.1.3 h1:TJH+oke8D16535+jHExHj4nQvzlZrj7ug5D7I/orNUA=
 github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
 github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
-github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs=
 github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
+github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
+github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
 github.com/cloudfoundry-community/go-cfclient v0.0.0-20190201205600-f136f9222381/go.mod h1:e5+USP2j8Le2M0Jo3qKPFnNhuo1wueU4nWHCXBOfQ14=
 github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 h1:tuijfIjZyjZaHq9xDUh0tNitwXshJpbLkqMOJv4H3do=
 github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21/go.mod h1:po7NpZ/QiTKzBKyrsEAxwnTamCoh8uDk/egRpQ7siIc=

From dfb2339ce46614f4e098a497ef93707817ae87e1 Mon Sep 17 00:00:00 2001
From: Axel Ismirlian 
Date: Fri, 5 Jan 2024 10:52:51 -0600
Subject: [PATCH 132/132] Fix mtu requirement bug

There a bug with the MTU field in terraform where ExactlyOneOf
requires Jumbo or MTU to be set, but the intent was to allow
at most one of those fields to be set, but are optional.
---
 ibm/service/power/resource_ibm_pi_network.go | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/ibm/service/power/resource_ibm_pi_network.go b/ibm/service/power/resource_ibm_pi_network.go
index 49e85d9aa5..d6ad8826c6 100644
--- a/ibm/service/power/resource_ibm_pi_network.go
+++ b/ibm/service/power/resource_ibm_pi_network.go
@@ -75,19 +75,19 @@ func ResourceIBMPINetwork() *schema.Resource {
 				Description: "PI network gateway",
 			},
 			helpers.PINetworkJumbo: {
-				Type:         schema.TypeBool,
-				Optional:     true,
-				Computed:     true,
-				Deprecated:   "deprecated use pi_network_mtu instead",
-				ExactlyOneOf: []string{helpers.PINetworkMtu, helpers.PINetworkJumbo},
-				Description:  "PI network enable MTU Jumbo option",
+				Type:          schema.TypeBool,
+				Optional:      true,
+				Computed:      true,
+				Deprecated:    "deprecated use pi_network_mtu instead",
+				ConflictsWith: []string{helpers.PINetworkMtu},
+				Description:   "PI network enable MTU Jumbo option",
 			},
 			helpers.PINetworkMtu: {
-				Type:         schema.TypeInt,
-				Optional:     true,
-				Computed:     true,
-				ExactlyOneOf: []string{helpers.PINetworkMtu, helpers.PINetworkJumbo},
-				Description:  "PI Maximum Transmission Unit",
+				Type:          schema.TypeInt,
+				Optional:      true,
+				Computed:      true,
+				ConflictsWith: []string{helpers.PINetworkJumbo},
+				Description:   "PI Maximum Transmission Unit",
 			},
 			helpers.PINetworkAccessConfig: {
 				Type:         schema.TypeString,